Skip to content

feat(acp)!: version-neutral Builder::new and v1::schema / v2::schema - #470

Merged
benbrandt merged 2 commits into
mainfrom
raw-builder-and-schema
Oct 30, 2026
Merged

benbrandt merged 2 commits into
mainfrom
raw-builder-and-schema

Conversation

@benbrandt

Copy link
Copy Markdown
Member

Follow-up to #469. Two breaking-release changes so imports say which protocol version code speaks, and v1 and v2 mirror each other.

Builder::new is version-neutral

Builder::new(Client | Agent | Proxy) and Builder::new_with no longer apply the v1 wire guard. Their marker was already Raw; 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 from Builder::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 call Builder::new alone.

Wire change for code that kept Builder::new with an ACP role and relied on the guard: such a connection no longer negotiates initialize / proxy/initialize down to v1, no longer rejects a response that selects another version, and no longer rejects requests before initialization. The tests that asserted the guard on Builder::new now assert that it is absent (Agent.v1() keeps its own test). The migration guide describes the change.

v1::schema and v2::schema

agent_client_protocol::v1::schema re-exports schema::v1, and agent_client_protocol::v2::schema (behind unstable_protocol_v2) re-exports schema::v2. Code can write use agent_client_protocol::v2::{self, schema}; and use v2::ConnectionTo next to schema::PromptRequest without a name clash.

The root schema::v1 / schema::v2 stay, next to the version-neutral items (ProtocolVersion, SuccessorMessage, the proxy/* 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 check feature powerset, cargo test --workspace --all-features (only the known agent-client-protocol-derive --lib abort under the local runner), cargo test -p agent-client-protocol --no-default-features, cargo doc -D warnings (all features and default), mdbook build.

benbrandt and others added 2 commits October 30, 2026 23:34
`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
benbrandt force-pushed the raw-builder-and-schema branch from b9db1ea to 0d71451 Compare October 30, 2026 22:40
@benbrandt
benbrandt merged commit 264fcbd into main Oct 30, 2026
13 checks passed
@benbrandt
benbrandt deleted the raw-builder-and-schema branch October 30, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant