From 17ed3fa605d11bb7cf2111f36f6594855a2d02b2 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 31 Dec 2025 13:53:45 +0100 Subject: [PATCH] Update rpc.md to match actual implementation - AppMessage -> AgentMessage - compact response shows full CompactionResult fields - auto_compaction_start includes reason field - auto_compaction_end includes willRetry field - Fix source file references --- packages/coding-agent/docs/rpc.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/coding-agent/docs/rpc.md b/packages/coding-agent/docs/rpc.md index bf1276f0..6b968dfc 100644 --- a/packages/coding-agent/docs/rpc.md +++ b/packages/coding-agent/docs/rpc.md @@ -145,7 +145,7 @@ Response: } ``` -Messages are `AppMessage` objects (see [Message Types](#message-types)). +Messages are `AgentMessage` objects (see [Message Types](#message-types)). ### Model @@ -289,8 +289,10 @@ Response: "command": "compact", "success": true, "data": { + "summary": "Summary of conversation...", + "firstKeptEntryId": "abc123", "tokensBefore": 150000, - "summary": "Summary of conversation..." + "details": {} } } ``` @@ -618,7 +620,7 @@ A turn consists of one assistant response plus any resulting tool calls and resu ### message_start / message_end -Emitted when a message begins and completes. The `message` field contains an `AppMessage`. +Emitted when a message begins and completes. The `message` field contains an `AgentMessage`. ```json {"type": "message_start", "message": {...}} @@ -717,20 +719,27 @@ Use `toolCallId` to correlate events. The `partialResult` in `tool_execution_upd Emitted when automatic compaction runs (when context is nearly full). ```json -{"type": "auto_compaction_start"} +{"type": "auto_compaction_start", "reason": "threshold"} ``` +The `reason` field is `"threshold"` (context getting large) or `"overflow"` (context exceeded limit). + ```json { "type": "auto_compaction_end", "result": { + "summary": "Summary of conversation...", + "firstKeptEntryId": "abc123", "tokensBefore": 150000, - "summary": "Summary of conversation..." + "details": {} }, - "aborted": false + "aborted": false, + "willRetry": false } ``` +If `reason` was `"overflow"` and compaction succeeds, `willRetry` is `true` and the agent will automatically retry the prompt. + If compaction was aborted, `result` is `null` and `aborted` is `true`. ### auto_retry_start / auto_retry_end @@ -806,7 +815,7 @@ Parse errors: Source files: - [`packages/ai/src/types.ts`](../../ai/src/types.ts) - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage` -- [`packages/agent/src/types.ts`](../../agent/src/types.ts) - `AppMessage`, `Attachment`, `AgentEvent` +- [`packages/agent/src/types.ts`](../../agent/src/types.ts) - `AgentMessage`, `AgentEvent` - [`src/core/messages.ts`](../src/core/messages.ts) - `BashExecutionMessage` - [`src/modes/rpc/rpc-types.ts`](../src/modes/rpc/rpc-types.ts) - RPC command/response types