Conversation
The Streamable HTTP + WebSocket transports predate the experimental v2 runtime and were hard-wired to the v1 AgentSideConnection and its method table. This completes the port so the transports are protocol-agnostic, matching the TypeScript reference (AcpServer takes an AgentConnector): - AcpServer / handle_websocket accept an AgentProtocolRouter, which negotiates v1 or v2 from the first initialize and attaches the right runtime. - AgentProtocolConnection gains a public listen() so stdio, HTTP and WebSocket drive it uniformly. - session/resume joins session/load as a replay method, so v2 resume routes replay over the connection stream exactly like v1 load. - v2 AgentSideConnection.attach now calls on_connect, matching __init__ and the v1 attach (agents like crow-cli v2 that learn their connection from on_connect would otherwise never receive it). Tests: v2 over HTTP, v2 over WebSocket, v2 resume replay, and a dual-stack test serving v1 and v2 clients on one port. Session-Id: enchanted-spectral-skunk-of-ampleness
This branch has not been deployed
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
The Streamable HTTP + WebSocket transports predate the experimental v2 runtime and were hard-wired to the v1
AgentSideConnectionand its method table. This completes the port so both transports are protocol-agnostic, matching the TypeScript reference (AcpServertakes anAgentConnector).What changed
AcpServer/handle_websocketaccept anAgentProtocolRouter, which negotiates v1 or v2 from the firstinitializeand attaches the matching runtime (v1AgentFactorykeeps working unchanged).AgentProtocolConnectiongains a publiclisten()so stdio, Streamable HTTP, and WebSocket drive it uniformly.session/resumejoinssession/loadas a replay method (LOAD_SESSION_METHODS), so v2 resume routes replayed history over the connection stream exactly like v1 load.V2AgentSideConnection.attachnow callson_connect, matching__init__and v1'sattach. (v2 agents that learn their connection viaon_connect— e.g. crow-cli v2 — otherwise never receive it through the router path.)Testing
tests/http/test_v2_loopback.py: v2 over Streamable HTTP, v2 over WebSocket, v2session/resumereplay, and a dual-stack test serving v1 + v2 clients on one port.361 passed, 1 skipped.ruff check,ruff format --check,ty check,deptry src,uv lock --lockedall pass.Checklist
make testgreen (pytest --doctest-modules).