Skip to content

Commit 5e97274

Browse files
committed
Add pushToolCall RPC method
1 parent d9d614a commit 5e97274

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed

rust/acp_tests.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ impl Client for TestClient {
8383
})
8484
}
8585

86+
async fn push_tool_call(&self, _request: PushToolCallParams) -> Result<PushToolCallResponse> {
87+
Ok(PushToolCallResponse { id: ToolCallId(0) })
88+
}
89+
8690
async fn update_tool_call(
8791
&self,
8892
_request: UpdateToolCallParams,

rust/schema.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ acp_peer!(
176176
RequestToolCallConfirmationParams,
177177
RequestToolCallConfirmationResponse
178178
),
179+
(
180+
push_tool_call,
181+
"pushToolCall",
182+
PushToolCallParams,
183+
PushToolCallResponse
184+
),
179185
(
180186
update_tool_call,
181187
"updateToolCall",
@@ -442,6 +448,20 @@ pub enum ToolCallConfirmationOutcome {
442448
Reject,
443449
}
444450

451+
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
452+
#[serde(rename_all = "camelCase")]
453+
pub struct PushToolCallParams {
454+
pub thread_id: ThreadId,
455+
pub title: String,
456+
pub description: String,
457+
}
458+
459+
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
460+
#[serde(tag = "type", rename_all = "camelCase")]
461+
pub struct PushToolCallResponse {
462+
pub id: ToolCallId,
463+
}
464+
445465
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, Eq, PartialEq, Hash)]
446466
#[serde(rename_all = "camelCase")]
447467
pub struct ToolCallId(pub u64);

schema.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@
7373
{
7474
"$ref": "#/$defs/RequestToolCallConfirmationParams"
7575
},
76+
{
77+
"$ref": "#/$defs/PushToolCallParams"
78+
},
7679
{
7780
"$ref": "#/$defs/UpdateToolCallParams"
7881
}
@@ -98,6 +101,9 @@
98101
{
99102
"$ref": "#/$defs/RequestToolCallConfirmationResponse"
100103
},
104+
{
105+
"$ref": "#/$defs/PushToolCallResponse"
106+
},
101107
{
102108
"$ref": "#/$defs/UpdateToolCallResponse"
103109
}
@@ -224,6 +230,30 @@
224230
"OpenThreadResponse": {
225231
"type": "null"
226232
},
233+
"PushToolCallParams": {
234+
"type": "object",
235+
"properties": {
236+
"title": {
237+
"type": "string"
238+
},
239+
"description": {
240+
"type": "string"
241+
},
242+
"threadId": {
243+
"$ref": "#/$defs/ThreadId"
244+
}
245+
},
246+
"required": ["threadId", "title", "description"]
247+
},
248+
"PushToolCallResponse": {
249+
"type": "object",
250+
"properties": {
251+
"id": {
252+
"$ref": "#/$defs/ToolCallId"
253+
}
254+
},
255+
"required": ["id"]
256+
},
227257
"ReadBinaryFileParams": {
228258
"type": "object",
229259
"properties": {

typescript/acp.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
GlobSearchResponse,
1414
OpenThreadParams,
1515
OpenThreadResponse,
16+
PushToolCallParams,
17+
PushToolCallResponse,
1618
ReadBinaryFileParams,
1719
ReadBinaryFileResponse,
1820
ReadTextFileParams,
@@ -323,6 +325,9 @@ class StubClient implements Client {
323325
): Promise<RequestToolCallConfirmationResponse> {
324326
throw new Error("Method not implemented.");
325327
}
328+
pushToolCall(_: PushToolCallParams): Promise<PushToolCallResponse> {
329+
throw new Error("Method not implemented.");
330+
}
326331
updateToolCall(_: UpdateToolCallParams): Promise<UpdateToolCallResponse> {
327332
throw new Error("Method not implemented.");
328333
}

typescript/schema.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type AnyClientRequest =
1010
| StatParams
1111
| GlobSearchParams
1212
| RequestToolCallConfirmationParams
13+
| PushToolCallParams
1314
| UpdateToolCallParams;
1415
export type MessageChunk = {
1516
type: "text";
@@ -51,6 +52,7 @@ export type AnyClientResult =
5152
| StatResponse
5253
| GlobSearchResponse
5354
| RequestToolCallConfirmationResponse
55+
| PushToolCallResponse
5456
| UpdateToolCallResponse;
5557
export type StreamMessageChunkResponse = null;
5658
export type FileVersion = number;
@@ -113,6 +115,11 @@ export interface RequestToolCallConfirmationParams {
113115
confirmation: ToolCallConfirmation;
114116
threadId: ThreadId;
115117
}
118+
export interface PushToolCallParams {
119+
title: string;
120+
description: string;
121+
threadId: ThreadId;
122+
}
116123
export interface UpdateToolCallParams {
117124
content: ToolCallContent | null;
118125
status: ToolCallStatus;
@@ -138,6 +145,9 @@ export interface RequestToolCallConfirmationResponse {
138145
id: ToolCallId;
139146
outcome: ToolCallConfirmationOutcome;
140147
}
148+
export interface PushToolCallResponse {
149+
id: ToolCallId;
150+
}
141151
export interface OpenThreadParams {
142152
threadId: ThreadId;
143153
}
@@ -178,6 +188,7 @@ export interface Client {
178188
requestToolCallConfirmation(
179189
params: RequestToolCallConfirmationParams,
180190
): Promise<RequestToolCallConfirmationResponse>;
191+
pushToolCall(params: PushToolCallParams): Promise<PushToolCallResponse>;
181192
updateToolCall(params: UpdateToolCallParams): Promise<UpdateToolCallResponse>;
182193
}
183194

@@ -188,6 +199,7 @@ export const CLIENT_METHODS = new Set([
188199
"stat",
189200
"globSearch",
190201
"requestToolCallConfirmation",
202+
"pushToolCall",
191203
"updateToolCall",
192204
]);
193205

0 commit comments

Comments
 (0)