Repository navigation
refactor(acp)!: reach each protocol version's schema only through v1::schema / v2::schema - #481
Merged
Merged
Conversation
…:schema / v2::schema Each protocol version's message types were reachable twice: as `agent_client_protocol::schema::v1::X` and as `agent_client_protocol::v1::schema::X` (and the same for v2). Make the version modules the only path. - `v1::schema` and `v2::schema` now re-export `agent_client_protocol_schema::v1` and `::v2` directly. - `schema::v1` and `schema::v2` are removed. The root `schema` module keeps only the version-neutral items: `ProtocolVersion`, `MaybeUndefined`, `IntoOption`, `IntoMaybeUndefined` and `SuccessorMessage`. - All internal code, tests, examples, the cookbook, doctests and the book use the new paths. Public doc examples import `vN::schema` and write `schema::X`; internal code uses a local `vN::schema as vN` alias where that keeps the diff readable. - The migration guide gains a rename row and drops the text that presented both paths. The stability guidance in lib.rs, the README and the book, and the "Adding a protocol version" checklist, point at `vN::schema`. BREAKING CHANGE: `agent_client_protocol::schema::v1` and `agent_client_protocol::schema::v2` are removed. Use `agent_client_protocol::v1::schema` and `agent_client_protocol::v2::schema` instead. `schema::ProtocolVersion`, `schema::MaybeUndefined`, `schema::IntoOption`, `schema::IntoMaybeUndefined` and `schema::SuccessorMessage` are unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Each protocol version's message types were reachable at two paths:
agent_client_protocol::schema::v1::Xandagent_client_protocol::v1::schema::X(same for v2). This PR keeps only the version modules. It was written as a stacked PR on #480; #480 has merged, so it targetsmain.Changes
v1::schemais nowpub use agent_client_protocol_schema::v1 as schema;, andv2::schemais the same behindunstable_protocol_v2.schema::v1andschema::v2are removed. The rootschemamodule now holds only the version-neutral items:ProtocolVersion,MaybeUndefined,IntoOption,IntoMaybeUndefinedandSuccessorMessage. It keeps its name. The items in it are schema items, and renaming it would break everyschema::ProtocolVersionimport for no gain.vN::schemaand writeschema::X.vN::schema as vNalias where that keeps the diff small.v2::NewSessionResponseinsession/v2.rs) now showv2::schema::....impl_proxy_jsonrpc!macro now reaches the proxy types through$crate::$ns::schema. The derive crate emits no schema paths.md/migration-v5.mdgets a rename table (schema::v1::X->v1::schema::X, same for v2). The text that presented both paths is gone, and the "After" examples use the new paths.lib.rsand the README, plusmd/design.md,md/protocol.md,md/protocol-v2.mdand the "Adding a protocol version" checklist inmd/versioning.mdare updated.Left at the old path on purpose
md/migration-v5.md.md/migration_v2.0.mdandmd/migration_v0.11.x.md, which describe the APIs of those releases.Checks
These pass:
cargo fmt --checkcargo build --workspace --bins --examples --all-features --lockedcargo hack check --feature-powerset --depth 2cargo test --workspace --all-featurescargo test --no-default-features-D warningsmdbook buildtyposagent-client-protocol-derive --libaborts under the local kache runner, which also happens onmain.