Skip to content

Commit 3b2e049

Browse files
committed
WIP
1 parent 6d6a441 commit 3b2e049

File tree

7 files changed

+93
-16
lines changed

7 files changed

+93
-16
lines changed

docs/protocol/schema.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/ini
9292
<ResponseField name="agentCapabilities" type={<a href="#agentcapabilities">AgentCapabilities</a>} >
9393
Capabilities supported by the agent.
9494

95-
- Default: `{"loadSession":false,"promptCapabilities":{"audio":false,"embeddedContext":false,"image":false,"supportsCustomCommands":false}}`
95+
- Default: `{"loadSession":false,"promptCapabilities":{"audio":false,"embeddedContext":false,"image":false,"supportsCommands":false}}`
9696

9797
</ResponseField>
9898
<ResponseField name="authMethods" type={<><span><a href="#authmethod">AuthMethod</a></span><span>[]</span></>} >
@@ -616,7 +616,7 @@ See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol
616616
<ResponseField name="promptCapabilities" type={<a href="#promptcapabilities">PromptCapabilities</a>} >
617617
Prompt capabilities supported by the agent.
618618

619-
- Default: `{"audio":false,"embeddedContext":false,"image":false,"supportsCustomCommands":false}`
619+
- Default: `{"audio":false,"embeddedContext":false,"image":false,"supportsCommands":false}`
620620

621621
</ResponseField>
622622

@@ -1247,8 +1247,8 @@ in prompt requests for pieces of context that are referenced in the message.
12471247
- Default: `false`
12481248

12491249
</ResponseField>
1250-
<ResponseField name="supportsCustomCommands" type={"boolean"} >
1251-
Agent supports custom slash commands via `list_commands` and `run_command`.
1250+
<ResponseField name="supportsCommands" type={"boolean"} >
1251+
Agent supports commands via `list_commands` and `run_command`.
12521252

12531253
- Default: `false`
12541254

rust/agent.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,9 @@ pub struct PromptCapabilities {
383383
/// in prompt requests for pieces of context that are referenced in the message.
384384
#[serde(default)]
385385
pub embedded_context: bool,
386-
/// Agent supports custom slash commands via `list_commands` and `run_command`.
386+
/// Agent supports commands via `list_commands` and `run_command`.
387387
#[serde(default)]
388-
pub supports_custom_commands: bool,
388+
pub supports_commands: bool,
389389
}
390390

391391
// Slash commands
@@ -452,6 +452,10 @@ pub struct AgentMethodNames {
452452
pub session_prompt: &'static str,
453453
/// Notification for cancelling operations.
454454
pub session_cancel: &'static str,
455+
/// Method for listing available commands.
456+
pub session_list_commands: &'static str,
457+
/// Method for running a command.
458+
pub session_run_command: &'static str,
455459
}
456460

457461
/// Constant containing all agent method names.
@@ -462,6 +466,8 @@ pub const AGENT_METHOD_NAMES: AgentMethodNames = AgentMethodNames {
462466
session_load: SESSION_LOAD_METHOD_NAME,
463467
session_prompt: SESSION_PROMPT_METHOD_NAME,
464468
session_cancel: SESSION_CANCEL_METHOD_NAME,
469+
session_list_commands: SESSION_LIST_COMMANDS,
470+
session_run_command: SESSION_RUN_COMMAND,
465471
};
466472

467473
/// Method name for the initialize request.
@@ -478,7 +484,7 @@ pub(crate) const SESSION_PROMPT_METHOD_NAME: &str = "session/prompt";
478484
pub(crate) const SESSION_CANCEL_METHOD_NAME: &str = "session/cancel";
479485
/// Method name for listing custom commands in a session.
480486
pub const SESSION_LIST_COMMANDS: &str = "session/list_commands";
481-
/// Method name for running a custom command in a session.
487+
/// Method name for running a custom command in a session.
482488
pub const SESSION_RUN_COMMAND: &str = "session/run_command";
483489

484490
/// All possible requests that a client can send to an agent.

schema/meta.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"authenticate": "authenticate",
44
"initialize": "initialize",
55
"session_cancel": "session/cancel",
6+
"session_list_commands": "session/list_commands",
67
"session_load": "session/load",
78
"session_new": "session/new",
8-
"session_prompt": "session/prompt"
9+
"session_prompt": "session/prompt",
10+
"session_run_command": "session/run_command"
911
},
1012
"clientMethods": {
1113
"fs_read_text_file": "fs/read_text_file",

schema/schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"audio": false,
1515
"embeddedContext": false,
1616
"image": false,
17-
"supportsCustomCommands": false
17+
"supportsCommands": false
1818
},
1919
"description": "Prompt capabilities supported by the agent."
2020
}
@@ -636,7 +636,7 @@
636636
"audio": false,
637637
"embeddedContext": false,
638638
"image": false,
639-
"supportsCustomCommands": false
639+
"supportsCommands": false
640640
}
641641
},
642642
"description": "Capabilities supported by the agent."
@@ -913,9 +913,9 @@
913913
"description": "Agent supports [`ContentBlock::Image`].",
914914
"type": "boolean"
915915
},
916-
"supportsCustomCommands": {
916+
"supportsCommands": {
917917
"default": false,
918-
"description": "Agent supports custom slash commands via `list_commands` and `run_command`.",
918+
"description": "Agent supports commands via `list_commands` and `run_command`.",
919919
"type": "boolean"
920920
}
921921
},

typescript/acp.test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import {
2424
CancelNotification,
2525
SessionNotification,
2626
PROTOCOL_VERSION,
27+
ListCommandsRequest,
28+
ListCommandsResponse,
29+
RunCommandRequest,
2730
} from "./acp.js";
2831

2932
describe("Connection", () => {
@@ -78,6 +81,14 @@ describe("Connection", () => {
7881
async cancel(_: CancelNotification): Promise<void> {
7982
// no-op
8083
}
84+
async listCommands(
85+
_: ListCommandsRequest,
86+
): Promise<ListCommandsResponse> {
87+
throw new Error("not implemented");
88+
}
89+
async runCommand(_: RunCommandRequest): Promise<void> {
90+
throw new Error("not implemented");
91+
}
8192
}
8293

8394
// Set up connections
@@ -170,6 +181,14 @@ describe("Connection", () => {
170181
async cancel(_: CancelNotification): Promise<void> {
171182
// no-op
172183
}
184+
async listCommands(
185+
_: ListCommandsRequest,
186+
): Promise<ListCommandsResponse> {
187+
throw new Error("not implemented");
188+
}
189+
async runCommand(_: RunCommandRequest): Promise<void> {
190+
throw new Error("not implemented");
191+
}
173192
}
174193

175194
new ClientSideConnection(
@@ -276,6 +295,14 @@ describe("Connection", () => {
276295
async cancel(params: CancelNotification): Promise<void> {
277296
messageLog.push(`cancelled called: ${params.sessionId}`);
278297
}
298+
async listCommands(
299+
_: ListCommandsRequest,
300+
): Promise<ListCommandsResponse> {
301+
throw new Error("not implemented");
302+
}
303+
async runCommand(_: RunCommandRequest): Promise<void> {
304+
throw new Error("not implemented");
305+
}
279306
}
280307

281308
// Set up connections
@@ -407,6 +434,14 @@ describe("Connection", () => {
407434
async cancel(params: CancelNotification): Promise<void> {
408435
notificationLog.push(`cancelled: ${params.sessionId}`);
409436
}
437+
async listCommands(
438+
_: ListCommandsRequest,
439+
): Promise<ListCommandsResponse> {
440+
throw new Error("not implemented");
441+
}
442+
async runCommand(_: RunCommandRequest): Promise<void> {
443+
throw new Error("not implemented");
444+
}
410445
}
411446

412447
// Create shared instances
@@ -506,6 +541,14 @@ describe("Connection", () => {
506541
async cancel(_: CancelNotification): Promise<void> {
507542
// no-op
508543
}
544+
async listCommands(
545+
_: ListCommandsRequest,
546+
): Promise<ListCommandsResponse> {
547+
throw new Error("not implemented");
548+
}
549+
async runCommand(_: RunCommandRequest): Promise<void> {
550+
throw new Error("not implemented");
551+
}
509552
}
510553

511554
const agentConnection = new ClientSideConnection(

typescript/acp.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,24 @@ export class ClientSideConnection implements Agent {
446446
params,
447447
);
448448
}
449+
450+
// todo!()
451+
async listCommands(
452+
params: schema.ListCommandsRequest,
453+
): Promise<schema.ListCommandsResponse> {
454+
return await this.#connection.sendRequest(
455+
schema.AGENT_METHODS.session_list_commands,
456+
params,
457+
);
458+
}
459+
460+
// todo!()
461+
async runCommand(params: schema.RunCommandRequest): Promise<void> {
462+
return await this.#connection.sendRequest(
463+
schema.AGENT_METHODS.session_run_command,
464+
params,
465+
);
466+
}
449467
}
450468

451469
type AnyMessage = AnyRequest | AnyResponse | AnyNotification;
@@ -814,7 +832,7 @@ export interface Client {
814832
*/
815833
createTerminal?(
816834
params: schema.CreateTerminalRequest,
817-
): Promise<schema.CreateTerminalResponse>;
835+
): Promise<TerminalHandle>;
818836

819837
/**
820838
* @internal **UNSTABLE**
@@ -934,4 +952,10 @@ export interface Agent {
934952
* See protocol docs: [Cancellation](https://agentclientprotocol.com/protocol/prompt-turn#cancellation)
935953
*/
936954
cancel(params: schema.CancelNotification): Promise<void>;
955+
956+
listCommands(
957+
params: schema.ListCommandsRequest,
958+
): Promise<schema.ListCommandsResponse>;
959+
960+
runCommand(params: schema.RunCommandRequest): Promise<void>;
937961
}

typescript/schema.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ export const AGENT_METHODS = {
22
authenticate: "authenticate",
33
initialize: "initialize",
44
session_cancel: "session/cancel",
5+
session_list_commands: "session/list_commands",
56
session_load: "session/load",
67
session_new: "session/new",
78
session_prompt: "session/prompt",
9+
session_run_command: "session/run_command",
810
};
911

1012
export const CLIENT_METHODS = {
@@ -841,9 +843,9 @@ export interface PromptCapabilities {
841843
*/
842844
image?: boolean;
843845
/**
844-
* Agent supports custom slash commands via `list_commands` and `run_command`.
846+
* Agent supports commands via `list_commands` and `run_command`.
845847
*/
846-
supportsCustomCommands?: boolean;
848+
supportsCommands?: boolean;
847849
}
848850
/**
849851
* Describes an available authentication method.
@@ -1398,7 +1400,7 @@ export const promptCapabilitiesSchema = z.object({
13981400
audio: z.boolean().optional(),
13991401
embeddedContext: z.boolean().optional(),
14001402
image: z.boolean().optional(),
1401-
supportsCustomCommands: z.boolean().optional(),
1403+
supportsCommands: z.boolean().optional(),
14021404
});
14031405

14041406
/** @internal */

0 commit comments

Comments
 (0)