Repository navigation
feat(acp)!: version-neutral Builder::new and v1::schema / v2::schema - #470
Merged
Merged
Conversation
`Builder::new` and `Builder::new_with` no longer apply the v1 wire guard for the `Client`, `Agent` and `Proxy` roles. The builder's marker was already `Raw`; now its wire behavior matches. Only `.v1()` applies v1's guard and only `.v2()` applies v2's, so `Proxy.v1()` sets the v1 proxy mode explicitly. `without_acp_version_guard()` is removed: every builder it applied to is now either unguarded already (`Builder::new`) or versioned on purpose. The conductor and tests that used it now call `Builder::new` alone. BREAKING CHANGE: `Builder::new(Client | Agent | Proxy)` and `Builder::new_with` apply no protocol-version guard. They no longer negotiate `initialize`/`proxy/initialize` down to v1, reject a response selecting another version, or reject requests before initialization. Use `Client.v1()`, `Agent.v1()` or `Proxy.v1()` to keep the v1 guard. `Builder::without_acp_version_guard()` is removed; use `Builder::new`. Co-Authored-By: Claude <noreply@anthropic.com>
`agent_client_protocol::v1::schema` is `schema::v1` and, with
`unstable_protocol_v2`, `agent_client_protocol::v2::schema` is
`schema::v2`. Code can now write `use agent_client_protocol::v2::{self,
schema};` and name `v2::ConnectionTo` next to `schema::PromptRequest`
without the clash between the SDK `v2` module and `schema::v2`.
The root `schema::v1` and `schema::v2` stay, next to the version-neutral
schema items (`ProtocolVersion`, `SuccessorMessage`, the `proxy/*`
constants).
The v2 examples, the cookbook's v2 patterns, Testy v2, the rmcp example
and the book import messages through `v2::schema`; the migration guide
replaces the name-clash workaround with the new form.
Co-Authored-By: Claude <noreply@anthropic.com>
benbrandt
force-pushed
the
raw-builder-and-schema
branch
from
October 30, 2026 22:40
b9db1ea to
0d71451
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.
Follow-up to #469. Two breaking-release changes so imports say which protocol version code speaks, and
v1andv2mirror each other.Builder::newis version-neutralBuilder::new(Client | Agent | Proxy)andBuilder::new_withno longer apply the v1 wire guard. Their marker was alreadyRaw; their wire behavior now matches. Only.v1()applies v1's guard and only.v2()applies v2's (Proxy.v1()now sets the v1 proxy mode explicitly instead of inheriting it fromBuilder::new).without_acp_version_guard()is removed. Every builder it applied to is now either unguarded already (Builder::new) or versioned on purpose; the conductor and the tests that used it callBuilder::newalone.Wire change for code that kept
Builder::newwith an ACP role and relied on the guard: such a connection no longer negotiatesinitialize/proxy/initializedown to v1, no longer rejects a response that selects another version, and no longer rejects requests before initialization. The tests that asserted the guard onBuilder::newnow assert that it is absent (Agent.v1()keeps its own test). The migration guide describes the change.v1::schemaandv2::schemaagent_client_protocol::v1::schemare-exportsschema::v1, andagent_client_protocol::v2::schema(behindunstable_protocol_v2) re-exportsschema::v2. Code can writeuse agent_client_protocol::v2::{self, schema};and usev2::ConnectionTonext toschema::PromptRequestwithout a name clash.The root
schema::v1/schema::v2stay, next to the version-neutral items (ProtocolVersion,SuccessorMessage, theproxy/*constants).The v2 examples, the cookbook's v2 patterns, Testy v2, the rmcp example, the book and the migration guide use the new form where they used to work around the clash. Tests are not churned.
Checks
cargo fmt --check, clippy (all features and default),cargo hack checkfeature powerset,cargo test --workspace --all-features(only the knownagent-client-protocol-derive --libabort under the local runner),cargo test -p agent-client-protocol --no-default-features,cargo doc -D warnings(all features and default),mdbook build.