feat(proxy): serve the daemon proxy over any transport and publish it

Merged
TH
2mo ago
+825-274

Summary

Publishes @agent-device/proxy so gateways such as simlock can embed the agent-device proxy logic and choose the transport on both sides. Stacked on #3255; publishes through the #3252 release flow.

const proxy = createDaemonProxy({
  upstreamBaseUrl, upstreamToken, clientToken,
  upstreamFetch: (request) => tunnel.send(request), // optional; defaults to fetch
});
const response = await proxy.handle(request); // Fetch Request -> Response
  • request.signal cancels the daemon request, upload tickets point at request.url's origin, and handle never rejects.
  • @agent-device/proxy/node serves it on node:http/node:https. The CLI uses it, and the wire behavior is unchanged.
  • The published build bundles its workspace siblings and has no runtime dependencies.
  • chore(gates): R11 reads a published package's siblings from devDependencies and names that field in its error. Fallow lists the entry points. Wire-compat acks the rewritten declarations.

27 files changed, 825 insertions and 274 deletions. About 100 lines over budget: roughly 300 lines are tests and 120 are docs, and the API, adapter, and docs form one unit.

Validation

Tested commit 3cc67072bf:

  • pnpm check:affected --run passed. Wire-compat against v0.21.22: protocol unchanged, 3 changed and acked.
  • Unit tests cover the injected transport, auth, aborts (RPC and health), the upload-ticket origin, the TLS scheme, a malformed Host header, the bare 404, and the body limit.
  • Packed install in an empty project: both entry points import.
  • Built CLI: agent-device proxy serves health, returns 401 without a token, and returns 404 for unserved routes.

Not device-facing.