Repository navigation
Conversation
`Builder::with_mcp_server` on a v1 proxy parsed `session/new`, `session/load`, `session/resume` and `session/fork` into the v1 schema types and re-serialized them, so fields those types do not model (for example `systemPrompt` without its schema feature, or future fields) were dropped before the request reached the agent. The v1 handler now validates the typed request and appends its declaration to the raw `mcpServers` array, sharing the raw-append path with the v2 handler. Co-Authored-By: Claude <noreply@anthropic.com>
`v1::ActiveSession::send_prompt` returned the `session/prompt` result through `?` inside the response callback, so an ordinary error response closed the whole connection and every session on it, and the caller never saw the error. The success path also kept only the stop reason. - `SessionMessage::StopReason(StopReason)` is now `SessionMessage::PromptResponse(Result<PromptResponse, Error>)`, sent on the session stream for both outcomes. It keeps `usage` and `_meta`. - `SessionMessage::SessionMessage(Dispatch)` is now `SessionMessage::Message(v1::Dispatch)` with v1-typed request handles. - `read_to_string` returns the prompt's error. - Add `send_prompt_blocks` for non-text prompts. - Seal `v1::SessionBlockState`. - Document that `v1::ActiveSession` has no cancel, mode, config, close or fork helpers and how to send those messages. BREAKING CHANGE: `v1::SessionMessage` variants are renamed and reshaped: `SessionMessage(Dispatch)` becomes `Message(v1::Dispatch)` (call `.into_raw()` before `MatchDispatch::new`) and `StopReason(StopReason)` becomes `PromptResponse(Result<PromptResponse, Error>)`. `read_to_string` now returns prompt errors. `v1::SessionBlockState` is sealed. Co-Authored-By: Claude <noreply@anthropic.com>
…e builder exports - `v1::SessionBuilder::on_proxy_session_start` passes a clone of the complete `NewSessionResponse` to its callback, and `start_session_proxy` returns it, instead of only the `SessionId`. The v2 equivalents already receive the full response. - `RestoreSessionBuilder` is no longer exported. `v1::LoadSessionBuilder` and `v1::ResumeSessionBuilder` are the only names for it, matching `v2::ResumeSessionBuilder`. - Document that the v1 load and resume builders have no `with_mcp_server` or proxy helpers, and point to the proxy builder's `with_mcp_server` instead. BREAKING CHANGE: the `v1::SessionBuilder::on_proxy_session_start` callback takes a `NewSessionResponse` instead of a `SessionId`, and `start_session_proxy` returns `NewSessionResponse`. Read `response.session_id` for the ID. `v1::RestoreSessionBuilder` is removed from the public API; use `v1::LoadSessionBuilder` or `v1::ResumeSessionBuilder`. Co-Authored-By: Claude <noreply@anthropic.com>
…link Run session/new through a conductor chain whose v1 proxy uses with_mcp_server, and assert the agent receives unmodeled fields together with the appended MCP declaration. Co-Authored-By: Claude <noreply@anthropic.com>
systemPrompt is modeled as a struct when unstable features are on, so the all-features build rejected the string value. Co-Authored-By: Claude <noreply@anthropic.com>
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.
Part of the 5.0 public-API cleanup. This PR covers the v1 session API.
Addressed
v1::SessionMessagerework.session/promptused to close the whole connection. It now arrives on the session stream asSessionMessage::PromptResponse(Result<PromptResponse, Error>), which also keepsusageand_meta.SessionMessage::SessionMessage(Dispatch)is renamed toSessionMessage::Message(v1::Dispatch), with v1-typed request handles.read_to_stringreturns the prompt's error.send_prompt_blocks.v1::SessionBlockStateis sealed.v1::ActiveSessiondocs now say it has no cancel/mode/config/close/fork helpers and show how to send those messages throughconnection().on_proxy_session_startcallback receives the fullNewSessionResponse, andstart_session_proxyreturns it. Before, both gave only theSessionId.RestoreSessionBuilderis no longer exported.v1::LoadSessionBuilder/v1::ResumeSessionBuilderare the names, which matchesv2::ResumeSessionBuilder.with_mcp_serverand no proxy helpers, and point to the proxy builder'swith_mcp_server. Adding them means threading a runner type parameter and proxy setup through the restore builders, which is not a small change. Adding a defaulted type parameter later is additive.Builder::with_mcp_server(proxy-global) appends its declaration to the rawmcpServersarray, using the same path as v2. Before, it re-serialized typed setup requests and dropped fields the schema types don't model. This one is non-breaking.Updated
md/migration-v5.md, rustdoc, the concepts pages, the cookbook and yopo.New tests:
PromptResponsearrives with_metav1_chain_equivalence.rs): a v1 proxy built withwith_mcp_serverforwardssession/new, and the agent receives the unmodeled fields together with the appended declaration. I checked that this test fails when the old typed re-serialization is put back.Skipped
None.
Checks
These pass: fmt, both clippy runs, the
cargo hackfeature powerset at depth 2, workspace tests with all features, core tests with no default features, rustdoc-D warningsfor core, andmdbook build.Two known failures, neither caused by this PR:
agent-client-protocol-derive --libaborts under the local kache runner. It does the same onmain.cargo doc -p agent-client-protocol-cookbookwith-D warningsfails on unresolvedagent_client_protocol::*links in lines this PR does not touch. It looks like the same failure happens onmain; I did not confirm that.🤖 Generated with Claude Code