Expose native chat compaction activity and retained replay

This commit is contained in:
2026-10-20 22:17:13 +01:00
parent d8b111913e
commit 4969d667b3
17 changed files with 666 additions and 26 deletions
+23 -12
View File
@@ -101,13 +101,14 @@ const (
// text of a prompt another client sent, so a transcript can show it live; it is
// never sent back to the client that sent the prompt.
const (
ChatEventText = ChatPartText
ChatEventReasoning = ChatPartReasoning
ChatEventTool = ChatPartTool
ChatEventStep = "step"
ChatEventResync = "resync"
ChatEventUsage = "usage"
ChatEventUser = "user"
ChatEventText = ChatPartText
ChatEventReasoning = ChatPartReasoning
ChatEventTool = ChatPartTool
ChatEventStep = "step"
ChatEventResync = "resync"
ChatEventUsage = "usage"
ChatEventUser = "user"
ChatEventCompaction = "compaction"
// ChatEventShell reports the lifecycle of one shell the agent started. It
// carries no ChatPart and no message id: a shell can outlive the tool call
// that started it, so it is a frame of its own rather than a tool part.
@@ -418,11 +419,14 @@ type ChatTime struct {
// tool carries a full Part with its state, step marks turn progress and usage
// reports the turn's totals.
type ChatEventFrame struct {
SessionID string `json:"session_id"`
MessageID string `json:"message_id,omitempty"`
Kind string `json:"kind"`
Delta string `json:"delta,omitempty"`
Part *ChatPart `json:"part,omitempty"`
// NativeTurnID scopes session activity to a harness turn when available.
NativeTurnID string `json:"native_turn_id,omitempty"`
Compaction *ChatCompaction `json:"compaction,omitempty"`
SessionID string `json:"session_id"`
MessageID string `json:"message_id,omitempty"`
Kind string `json:"kind"`
Delta string `json:"delta,omitempty"`
Part *ChatPart `json:"part,omitempty"`
// Attachments carries the file parts of a user turn another client sent.
// A frame has one Part, so the prompt's files travel alongside its text.
Attachments []ChatPart `json:"attachments,omitempty"`
@@ -441,6 +445,13 @@ type ChatEventFrame struct {
OperationID string `json:"operation_id,omitempty"`
}
// ChatCompaction is session activity, never a transcript message or tool.
// ID is optional: OpenCode V2 compaction events have no shared lifecycle id.
type ChatCompaction struct {
Status string `json:"status"` // running | completed | failed
ID string `json:"id,omitempty"`
}
// ChatStep is a progress marker for the current step of a turn.
type ChatStep struct {
Status string `json:"status"`