cleanup and refactor the API#16
Merged
nikomatsakis merged 10 commits intoagentclientprotocol:mainfrom Nov 8, 2025
Merged
Conversation
- Add outgoing_protocol_actor: converts OutgoingMessage → jsonrpcmsg::Message - Add transport_outgoing_actor: serializes jsonrpcmsg::Message → bytes - Add incoming_protocol_actor: routes jsonrpcmsg::Message to handlers/replies - Add transport_incoming_actor: parses bytes → jsonrpcmsg::Message - Update serve() to use split actors with intermediate channels - Remove old monolithic incoming_actor and outgoing_actor - Keep dispatch_request as shared helper function - All tests pass - no API changes, refactored internals only This is Phase 2 of the pluggable transport refactoring. Protocol layer now handles JSON-RPC semantics (IDs, correlation) while transport layer handles serialization/deserialization. Clear boundary at jsonrpcmsg::Message. Co-authored-by: Claude <claude@anthropic.com>
- Add comment explaining response with id: None (error notifications) - Remove '(Phase 2)' reference from code comments - Keep phase tracking in PLAN.md only Co-authored-by: Claude <claude@anthropic.com>
- Add IntoJrConnectionTransport trait for pluggable transports - Create ByteStreamTransport struct for byte stream I/O - Export both from crate root - Update actor signatures to take owned values for 'static lifetime - Fix transport_incoming_actor to clone JrConnectionCx - All tests pass (unit + doc tests) This enables different transport mechanisms while maintaining the same protocol layer. ByteStreamTransport provides the default implementation for AsyncRead + AsyncWrite streams. Part of Phase 3: Transport trait introduction. Co-authored-by: Claude <claude@anthropic.com>
- Remove unnecessary Unpin bounds from all transport types - AsyncRead/AsyncWrite traits already handle pinning internally - Simplifies method signatures throughout the codebase - Make AcpAgent implement IntoJrTransport directly - Eliminates need for JrConnectionExt trait - Simpler API: pass AcpAgent directly as transport - Automatic child process lifecycle management - Inline transport creation in examples and doctests - More readable and idiomatic code - Reduces variable declaration overhead - Add MockTransport helper for doctests - Implements IntoJrTransport but panics if used - Allows doctests to compile without real I/O BREAKING CHANGE: JrConnection::new() no longer takes byte stream arguments. Use .serve(transport) or .with_client(transport, ...) instead. BREAKING CHANGE: JrConnectionExt trait removed. AcpAgent now implements IntoJrTransport and can be passed directly as a transport.
`chain_handler` now takes that
Add convenience methods to simplify the most common usage patterns: - JrHandlerChain::serve(transport) - shorthand for connect_to(transport)?.serve().await - JrHandlerChain::serve_with(transport, main_fn) - shorthand for connect_to(transport)?.with_client(main_fn).await - Conductor::run(transport) - shorthand for into_handler_chain().connect_to(transport)?.serve().await These reduce boilerplate and make the API more ergonomic for typical use cases. Co-authored-by: Claude <claude@anthropic.com>
- Export JrConnection from lib.rs public API - Rename ViaBytes to ByteStreams in all doctests - Update JrConnection::new() to JrHandlerChain::new() - Fix .with_client() examples to use .connect_to() first - Add comprehensive docs and examples for spawn_connection() - Update forward_to_request_cx doctest to show proper proxy pattern - Add missing documentation for JrConnection struct - Fix describe_chain() implementation in conductor (was todo!()) All workspace doctests now pass. Co-authored-by: Claude <claude@anthropic.com>
Merged
This was referenced Dec 15, 2025
Merged
Merged
Merged
Merged
This was referenced Dec 28, 2025
Merged
Merged
Merged
Merged
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.
It is not designed to be more composable and better support trees of composers without copying around bytestreams.