Skip to content

feat: add Forward, an egress over a host fetch, and give socket dispatches their endpoint - #173

Closed
gakonst wants to merge 1 commit into
mainfrom
forward-egress
Closed

gakonst wants to merge 1 commit into
mainfrom
forward-egress

Conversation

@gakonst

@gakonst gakonst commented Oct 28, 2026

Copy link
Copy Markdown
Owner

A host that sends model traffic through a proxy of its own can now plug it into App.create with one function. The test case was paradigmxyz/iron-proxy, where a Worker holds no credentials and the proxy injects them.

  • Forward.create({ fetch }) (nanocode-ts/cloudflare) is a generic egress. It answers the private binding's /model with a Request to the dispatch's endpoint, carrying its headers and body, and /socket with a WebSocket upgrade to the socket's endpoint. It hands each to fetch(request, dispatch) and returns the response, which for sockets is a 101 with its webSocket. /warm answers 204, /metrics ok and /remote 501. Before this, every such host had to reimplement nanocode-ts's internal /model and /socket protocol.
  • SocketDispatch now carries the Codex Responses endpoint the socket opens, plus subscription, as ModelDispatch does. Before, an egress had to hard-code chatgpt.com for plan sockets. The App computes the endpoint once and uses it for both the runtime's config and the socket dispatch.
  • AGENTS.md documents both and the end-to-end check below.

Checked:

  • npm run check:types passes.
  • npx vp check reports 0 errors.
  • npx vp test run passes 39 of 39.
  • End to end, 2026-10-28. A Worker using Forward sent every request through an mtls_certificates binding to iron-proxy's reverse listener (feat(proxy): add an mTLS reverse listener for clients that cannot trust the MITM CA paradigmxyz/iron-proxy#294) on a GCP VM. iron-proxy injected a ChatGPT plan's token, which iron-token-broker kept refreshed, and a Claude plan's token. With subscription: () => true and no credential in the Worker:
    • Claude Haiku 5.5 over HTTPS ran a Code Mode turn in 4 s.
    • GPT-6 Luna over the Codex WebSocket ran one in 6 s.

@gakonst

gakonst commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Landed on main directly as 095cd57, without comments, following nanocode-ts's development rules (66394d0).

@gakonst gakonst closed this Oct 28, 2026
@gakonst
gakonst deleted the forward-egress branch October 28, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant