[WIP] Add experimental HTTP backend SPI#198
Draft
federicociner wants to merge 2 commits into
Draft
Conversation
c36d6fc to
2bfed85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an experimental
httpBackendSPI to the TypeScript SDK’sAcpServer. The motivation is to make the Streamable HTTP transport implementation deployable in the same kinds of environments the RFD is targeting: remote ACP servers behind normal HTTP load balancers, potentially with many stateless web nodes.Today, the SDK’s HTTP transport state is process-local.
Acp-Connection-Ideffectively points into an in-memoryConnectionRegistry, which owns the connection metadata, SSE streams, replay buffers, pending response-route maps, and server→client request correlation state. That is fine for a single process, but it means a client that initializes on node A must keep hitting node A for subsequentPOST,GETSSE, andDELETErequests. That makes Streamable HTTP much less useful for cloud/server deployments unless the deployment provides perfect stickiness.The RFD already describes Streamable HTTP as a remote transport with connection-scoped and session-scoped SSE streams, where most POSTs return
202 Acceptedand the actual JSON-RPC response is later delivered on the appropriate stream. It also notes that deployments may preserve affinity using cookies or supply their own affinity/state via an external store such as Redis.Concretely, the SPI lets the SDK server delegate HTTP transport state to a backend while keeping the public wire protocol unchanged:
That last point matters because server → client requests such as permission requests, elicitation, terminal, and filesystem methods need request IDs that do not collide if multiple web nodes can originate messages for the same logical ACP connection.
Importantly, this is not a protocol fork and does not change client behavior. A stock ACP HTTP client still sees the same
initialize,Acp-Connection-Id,POST 202,GETSSE, andDELETEbehavior described by the RFD. The default SDK behavior also remains in-memory, so simple/local deployments keep working as before. WebSocket upgrades remain on the existing in-memory full-duplex path, which preserves the RFD’s simpler WebSocket deployment story.The main benefit is that SDK users can choose the right operational model: