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
This commit is contained in:
Mario Zechner 2025-12-31 13:53:45 +01:00
parent ee64d29487
commit 17ed3fa605

View file

@ -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