Skip to content

Commit 0d54a79

Browse files
committed
add agent_message_clear
impls agentclientprotocol/agent-client-protocol#465
1 parent bd70e7e commit 0d54a79

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

schema/schema.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,17 @@
30913091
"required": ["sessionUpdate"],
30923092
"type": "object"
30933093
},
3094+
{
3095+
"description": "Instructs the client to clear the accumulated streamed content for the current agent message. Subsequent agent_message_chunk updates append from empty. Enables non-monotonic streaming (e.g. reformatting, delegation, iterative refinement).",
3096+
"properties": {
3097+
"sessionUpdate": {
3098+
"const": "agent_message_clear",
3099+
"type": "string"
3100+
}
3101+
},
3102+
"required": ["sessionUpdate"],
3103+
"type": "object"
3104+
},
30943105
{
30953106
"allOf": [
30963107
{

src/examples/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ class ExampleClient implements acp.Client {
5353
console.log(`[${update.content.type}]`);
5454
}
5555
break;
56+
case "agent_message_clear":
57+
// Client should clear accumulated streamed content for current agent message.
58+
console.log(`[${update.sessionUpdate}]`);
59+
break;
5660
case "tool_call":
5761
console.log(`\n🔧 ${update.title} (${update.status})`);
5862
break;

src/schema/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type {
1818
CancelRequestNotification,
1919
ClientCapabilities,
2020
ClientNotification,
21+
ClientOptions,
2122
ClientRequest,
2223
ClientResponse,
2324
ConfigOptionUpdate,

src/schema/types.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,9 @@ export type SessionUpdate =
24342434
| (ContentChunk & {
24352435
sessionUpdate: "agent_message_chunk";
24362436
})
2437+
| {
2438+
sessionUpdate: "agent_message_clear";
2439+
}
24372440
| (ContentChunk & {
24382441
sessionUpdate: "agent_thought_chunk";
24392442
})

src/schema/zod.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,9 @@ export const zSessionUpdate = z.union([
15801580
sessionUpdate: z.literal("agent_message_chunk"),
15811581
}),
15821582
),
1583+
z.object({
1584+
sessionUpdate: z.literal("agent_message_clear"),
1585+
}),
15831586
zContentChunk.and(
15841587
z.object({
15851588
sessionUpdate: z.literal("agent_thought_chunk"),

0 commit comments

Comments
 (0)