feat: add TCP connection protocol - #488
Kyle Cutler (kycutler) wants to merge 2 commits into
Conversation
|
Kyle Cutler (@kycutler) I like this addition. I opened #492 to explore moving flow control into the general channel/subscription model, so busy TCP, terminal, or telemetry channels cannot crowd out other traffic on the connection. The idea is to negotiate receive windows in Could TCP use that shared mechanism, replacing its dedicated window and consumed-credit actions while keeping byte offsets, EOF/close/reset, and lossless replay? I would prefer one flow-control mechanism rather than two. This does not need to block this PR, but I would appreciate your take on the direction and any TCP-specific requirements it would need to cover. |
Summary
Add optional, session-scoped TCP channels to Agent Host Protocol.
Clients can open a byte stream to a destination on the Agent Host’s network over the existing AHP connection. This enables remote browsing of development servers without a separate forwarding endpoint or transport-specific proxy.
Channel model
Each private
ahp-tcp:channel represents one outbound TCP connection:subscribe.create;DNS, loopback, and routing belong to the Agent Host’s network. Session ownership does not implicitly move the connection into an agent sandbox or delegated execution environment.
Reconnect and delivery
TCP channels retain their original socket, consumer, and pending actions across transport replacement. Replay reconciles acknowledgments before resending unacknowledged actions with their original sequences and offsets.
Snapshots cannot restore byte streams. Missing channels, unavailable replay, or lost local state terminate the connection rather than silently opening a replacement socket.
TCP delivery is loss-sensitive: payload actions cannot be coalesced or dropped. Ordinary-channel replay remains independently checkpointed to avoid applying existing state twice.
SDK support
Adds reducers and owned byte-stream adapters across TypeScript, Rust, Go, .NET, Swift, and Kotlin.
Deliberate boundaries
Generated surfaces and validation
The contract is propagated through JSON Schema, reference documentation, all six SDKs, shared reducer fixtures, and wire round-trip fixtures.
Validation includes root checks, SDK builds and tests, native routing/reconnect regressions, documentation builds, and the companion VS Code real-socket integration suite.