Skip to content

Commit 6d43479

Browse files
committed
Update ts docs
1 parent 659687a commit 6d43479

7 files changed

Lines changed: 49 additions & 13 deletions

File tree

docs/protocol/schema.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,19 @@ See protocol docs: [Check for Completion](https://agentclientprotocol.com/protoc
389389
<a id="session-set_mode"></a>
390390
### <span class="font-mono">session/set_mode</span>
391391

392-
**UNSTABLE**
392+
Sets the current mode for a session.
393393

394-
This method is not part of the spec, and may be removed or changed at any point.
394+
Allows switching between different agent modes (e.g., "ask", "architect", "code")
395+
that affect system prompts, tool availability, and permission behaviors.
396+
397+
The mode must be one of the modes advertised in `availableModes` during session
398+
creation or loading. Agents may also change modes autonomously and notify the
399+
client via `current_mode_update` notifications.
400+
401+
This method can be called at any time during a session, whether the Agent is
402+
idle or actively generating a response.
403+
404+
See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
395405

396406
#### <span class="font-mono">SetSessionModeRequest</span>
397407

docs/protocol/session-modes.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ During [Session Setup](./session-setup) the Agent **MAY** return a list of modes
3232
"id": "code",
3333
"name": "Code",
3434
"description": "Write and modify code with full tool access"
35-
},
35+
}
3636
]
3737
}
3838
}
@@ -92,7 +92,8 @@ Typically, Clients display the available modes to the user and allow them to cha
9292
</ParamField>
9393

9494
<ParamField path="modeId" type="SessionModeId" required>
95-
The ID of the mode to switch to. Must be one of the modes listed in `availableModes`
95+
The ID of the mode to switch to. Must be one of the modes listed in
96+
`availableModes`
9697
</ParamField>
9798

9899
### From the Agent

rust/acp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ impl<T: Agent> MessageHandler<AgentSide> for T {
684684
let response = self.prompt(args).await?;
685685
Ok(AgentResponse::PromptResponse(response))
686686
}
687-
#[cfg(feature = "unstable")]
688687
ClientRequest::SetSessionModeRequest(args) => {
689688
let response = self.set_session_mode(args).await?;
690689
Ok(AgentResponse::SetSessionModeResponse(response))

rust/example_agent.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ impl acp::Agent for ExampleAgent {
112112
Ok(())
113113
}
114114

115+
async fn set_session_mode(
116+
&self,
117+
args: acp::SetSessionModeRequest,
118+
) -> Result<acp::SetSessionModeResponse, acp::Error> {
119+
log::info!("Received set session mode request {args:?}");
120+
Ok(Default::default())
121+
}
122+
115123
async fn ext_method(
116124
&self,
117125
method: std::sync::Arc<str>,

rust/example_client.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ impl acp::Client for ExampleClient {
9797
| acp::SessionUpdate::AgentThoughtChunk { .. }
9898
| acp::SessionUpdate::ToolCall(_)
9999
| acp::SessionUpdate::ToolCallUpdate(_)
100-
| acp::SessionUpdate::Plan(_) => {}
100+
| acp::SessionUpdate::Plan(_)
101+
| acp::SessionUpdate::CurrentModeUpdate { .. } => {}
101102
}
102103
Ok(())
103104
}

rust/rpc_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl Agent for TestAgent {
211211
&self,
212212
_arguments: SetSessionModeRequest,
213213
) -> Result<SetSessionModeResponse, Error> {
214-
Ok(SetSessionModeResponse {})
214+
Ok(SetSessionModeResponse { meta: None })
215215
}
216216

217217
async fn prompt(&self, arguments: PromptRequest) -> Result<PromptResponse, Error> {

typescript/acp.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,19 @@ export class ClientSideConnection implements Agent {
571571
}
572572

573573
/**
574-
* Sets the mode for an existing session.
574+
* Sets the operational mode for a session.
575575
*
576-
* This method allows changing the operational mode of an existing session.
577-
* The available modes are advertised in the agent's capabilities during initialization.
576+
* Allows switching between different agent modes (e.g., "ask", "architect", "code")
577+
* that affect system prompts, tool availability, and permission behaviors.
578578
*
579-
* See protocol docs: [Session Mode Management](https://agentclientprotocol.com/protocol/session-management#mode-setting)
579+
* The mode must be one of the modes advertised in `availableModes` during session
580+
* creation or loading. Agents may also change modes autonomously and notify the
581+
* client via `current_mode_update` notifications.
582+
*
583+
* This method can be called at any time during a session, whether the Agent is
584+
* idle or actively generating a turn.
585+
*
586+
* See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
580587
*/
581588
async setSessionMode(
582589
params: schema.SetSessionModeRequest,
@@ -1239,9 +1246,19 @@ export interface Agent {
12391246
params: schema.LoadSessionRequest,
12401247
): Promise<schema.LoadSessionResponse>;
12411248
/**
1242-
* @internal **UNSTABLE**
1249+
* Sets the operational mode for a session.
1250+
*
1251+
* Allows switching between different agent modes (e.g., "ask", "architect", "code")
1252+
* that affect system prompts, tool availability, and permission behaviors.
1253+
*
1254+
* The mode must be one of the modes advertised in `availableModes` during session
1255+
* creation or loading. Agents may also change modes autonomously and notify the
1256+
* client via `current_mode_update` notifications.
1257+
*
1258+
* This method can be called at any time during a session, whether the Agent is
1259+
* idle or actively generating a turn.
12431260
*
1244-
* This method is not part of the spec, and may be removed or changed at any point.
1261+
* See protocol docs: [Session Modes](https://agentclientprotocol.com/protocol/session-modes)
12451262
*/
12461263
setSessionMode?(
12471264
params: schema.SetSessionModeRequest,

0 commit comments

Comments
 (0)