From 9d353ad02302b58c5860737dabd52b4ff86e606a Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Mon, 22 Sep 2025 16:34:40 +0200 Subject: [PATCH 1/2] Fix missing method for experimental model selection --- rust/acp.rs | 10 +++++++--- rust/agent.rs | 4 ++-- schema/schema.json | 4 ++-- typescript/schema.ts | 16 ++++++++-------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/rust/acp.rs b/rust/acp.rs index 43a8dd00..ea24b876 100644 --- a/rust/acp.rs +++ b/rust/acp.rs @@ -242,7 +242,7 @@ impl Agent for ClientSideConnection { self.conn .request( SESSION_SET_MODEL_METHOD_NAME, - Some(ClientRequest::ModelSelectRequest(args)), + Some(ClientRequest::SetSessionModelRequest(args)), ) .await } @@ -613,6 +613,10 @@ impl Side for AgentSide { SESSION_SET_MODE_METHOD_NAME => serde_json::from_str(params.get()) .map(ClientRequest::SetSessionModeRequest) .map_err(Into::into), + #[cfg(feature = "unstable")] + SESSION_SET_MODEL_METHOD_NAME => serde_json::from_str(params.get()) + .map(ClientRequest::SetSessionModelRequest) + .map_err(Into::into), SESSION_PROMPT_METHOD_NAME => serde_json::from_str(params.get()) .map(ClientRequest::PromptRequest) .map_err(Into::into), @@ -681,9 +685,9 @@ impl MessageHandler for T { Ok(AgentResponse::SetSessionModeResponse(response)) } #[cfg(feature = "unstable")] - ClientRequest::ModelSelectRequest(args) => { + ClientRequest::SetSessionModelRequest(args) => { let response = self.set_session_model(args).await?; - Ok(AgentResponse::ModelSelectResponse(response)) + Ok(AgentResponse::SetSessionModelResponse(response)) } ClientRequest::ExtMethodRequest(args) => { let response = self.ext_method(args).await?; diff --git a/rust/agent.rs b/rust/agent.rs index 51c18815..ddf74b1c 100644 --- a/rust/agent.rs +++ b/rust/agent.rs @@ -778,7 +778,7 @@ pub enum ClientRequest { SetSessionModeRequest(SetSessionModeRequest), PromptRequest(PromptRequest), #[cfg(feature = "unstable")] - ModelSelectRequest(SetSessionModelRequest), + SetSessionModelRequest(SetSessionModelRequest), ExtMethodRequest(ExtRequest), } @@ -799,7 +799,7 @@ pub enum AgentResponse { SetSessionModeResponse(#[serde(default)] SetSessionModeResponse), PromptResponse(PromptResponse), #[cfg(feature = "unstable")] - ModelSelectResponse(SetSessionModelResponse), + SetSessionModelResponse(SetSessionModelResponse), ExtMethodResponse(#[schemars(with = "serde_json::Value")] Arc), } diff --git a/schema/schema.json b/schema/schema.json index c9a83cea..96b13780 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -113,7 +113,7 @@ }, { "$ref": "#/$defs/SetSessionModelResponse", - "title": "ModelSelectResponse" + "title": "SetSessionModelResponse" }, { "title": "ExtMethodResponse" @@ -367,7 +367,7 @@ }, { "$ref": "#/$defs/SetSessionModelRequest", - "title": "ModelSelectRequest" + "title": "SetSessionModelRequest" }, { "title": "ExtMethodRequest" diff --git a/typescript/schema.ts b/typescript/schema.ts index 52c7f4ae..b2f94c07 100644 --- a/typescript/schema.ts +++ b/typescript/schema.ts @@ -250,7 +250,7 @@ export type AgentRequest = | LoadSessionRequest | SetSessionModeRequest | PromptRequest - | ModelSelectRequest + | SetSessionModelRequest | ExtMethodRequest1; /** * Configuration for connecting to an MCP (Model Context Protocol) server. @@ -388,7 +388,7 @@ export type AgentResponse = | LoadSessionResponse | SetSessionModeResponse | PromptResponse - | ModelSelectResponse + | SetSessionModelResponse | ExtMethodResponse1; /** * Unique identifier for a Session Mode. @@ -1157,7 +1157,7 @@ export interface PromptRequest { * * Request parameters for setting a session model. */ -export interface ModelSelectRequest { +export interface SetSessionModelRequest { /** * Extension point for implementations */ @@ -1477,7 +1477,7 @@ export interface PromptResponse { * * Response to `session/set_model` method. */ -export interface ModelSelectResponse { +export interface SetSessionModelResponse { /** * Extension point for implementations */ @@ -1876,7 +1876,7 @@ export const setSessionModeRequestSchema = z.object({ }); /** @internal */ -export const modelSelectRequestSchema = z.object({ +export const setSessionModelRequestSchema = z.object({ _meta: z.record(z.unknown()).optional(), modelId: z.string(), sessionId: z.string(), @@ -1929,7 +1929,7 @@ export const promptResponseSchema = z.object({ }); /** @internal */ -export const modelSelectResponseSchema = z.object({ +export const setSessionModelResponseSchema = z.object({ _meta: z.record(z.unknown()).optional(), }); @@ -2413,7 +2413,7 @@ export const agentRequestSchema = z.union([ loadSessionRequestSchema, setSessionModeRequestSchema, promptRequestSchema, - modelSelectRequestSchema, + setSessionModelRequestSchema, extMethodRequest1Schema, ]); @@ -2425,7 +2425,7 @@ export const agentResponseSchema = z.union([ loadSessionResponseSchema, setSessionModeResponseSchema, promptResponseSchema, - modelSelectResponseSchema, + setSessionModelResponseSchema, extMethodResponse1Schema, ]); From 8ce0d07dd6eb3f292b9b9b78743bc0d1c1a67120 Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Mon, 22 Sep 2025 16:36:16 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 6 ++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f17645..f9888584 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 0.4.2 (2025-09-22) + +### Rust + +**Unstable** fix missing method for model selection in Rust library. + ## 0.4.1 (2025-09-22) ### Protocol diff --git a/Cargo.lock b/Cargo.lock index 3596b17b..dd4a5c00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,7 +19,7 @@ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "agent-client-protocol" -version = "0.4.1" +version = "0.4.2" dependencies = [ "anyhow", "async-broadcast", diff --git a/Cargo.toml b/Cargo.toml index 3b6435a4..b25da29b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "agent-client-protocol" authors = ["Zed "] -version = "0.4.1" +version = "0.4.2" edition = "2024" license = "Apache-2.0" description = "A protocol for standardizing communication between code editors and AI coding agents" diff --git a/package-lock.json b/package-lock.json index 2b2bccf1..181e5d1c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@zed-industries/agent-client-protocol", - "version": "0.4.1", + "version": "0.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@zed-industries/agent-client-protocol", - "version": "0.4.1", + "version": "0.4.2", "license": "Apache-2.0", "dependencies": { "zod": "^3.0.0" diff --git a/package.json b/package.json index e9882690..e0ce4544 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zed-industries/agent-client-protocol", - "version": "0.4.1", + "version": "0.4.2", "publishConfig": { "access": "public" },