refactor(proxy): export the Node adapter from the main entry point

Merged
TH
2mo ago
+107-55

Summary

Follow-up to #3256. @agent-device/proxy now has one entry point. The Node adapter moves from @agent-device/proxy/node into the main entry. The subpath was never published, so nothing outside this repo depends on it.

import { createDaemonProxy, createDaemonProxyServer } from '@agent-device/proxy';

Importing the package still evaluates the same 8 modules as before. createDaemonProxyServer and createDaemonProxyRequestListener live in daemon-proxy.ts, and the Node request adapter in node-http.ts loads on the first request, as the health helpers already do.

The Node adapter now answers TRACE with 404, as the proxy did before the Fetch rewrite. Before this change it dropped the socket, because Fetch refuses to construct a Request with that method. Review of #3256 found this. TRACK and CONNECT never reach the listener: node:http answers TRACK with 400 and routes CONNECT to its 'connect' event, which drops the socket, as it did before the rewrite. A URL with credentials, which Fetch also refuses, now gets 400.

15 files: the package exports and build entry, the README, the CLI and test imports, and a gates commit for the exports map and fallow entries.

Validation

Tested commit 5ed888a3f:

  • vitest run scripts/__tests__/eager-closure-budgets.test.ts passed. This is the check that failed on the Coverage job.
  • pnpm check:affected --run passed, including lint, typecheck, layering, fallow and build.
  • vitest run packages/proxy src/__tests__/daemon-proxy.test.ts: 25 passed. A new test sends TRACE to a real http.createServer and gets 404. Another checks that a Host with credentials gets 400.
  • Packed install: exports lists only . and ./package.json. dist/index.mjs exports createDaemonProxy, createDaemonProxyServer and createDaemonProxyRequestListener.

No device-facing change.