| 1 | package eventwire |
| 2 | |
| 3 | import ( |
| 4 | "reasonix/internal/event" |
| 5 | "reasonix/internal/provider" |
| 6 | ) |
| 7 | |
| 8 | // Event is the JSON-friendly form shared by event frontends. |
| 9 | // externalizable:"true" marks large string payloads the Remote protocol may |
| 10 | // offload via content refs without changing provider-visible semantics. |
| 11 | type Event struct { |
| 12 | RuntimeState *event.RuntimeStateSnapshot `json:"runtimeState,omitempty"` |
| 13 | Kind string `json:"kind"` |
| 14 | MessageID string `json:"messageId,omitempty"` |
| 15 | AttemptID string `json:"attemptId,omitempty"` |
| 16 | Source string `json:"source,omitempty"` |
| 17 | SessionID string `json:"sessionId,omitempty"` |
| 18 | RuntimeEpoch string `json:"runtimeEpoch,omitempty"` |
| 19 | SubmissionID string `json:"submissionId,omitempty"` |
| 20 | PromptID string `json:"promptId,omitempty"` |
| 21 | PromptKind string `json:"promptKind,omitempty"` |
| 22 | PromptLegacy bool `json:"promptLegacy,omitempty"` |
| 23 | TurnID string `json:"turnId,omitempty"` |
| 24 | Sequence uint64 `json:"seq,omitempty"` |
| 25 | Status string `json:"status,omitempty"` |
| 26 | Text string `json:"text,omitempty" externalizable:"true"` |
| 27 | Detail string `json:"detail,omitempty" externalizable:"true"` |
| 28 | Code string `json:"code,omitempty"` |
| 29 | Reasoning string `json:"reasoning,omitempty" externalizable:"true"` |
| 30 | MemoryCitations []MemoryCitation `json:"memoryCitations,omitempty"` |
| 31 | Level string `json:"level,omitempty"` |
| 32 | Tool *Tool `json:"tool,omitempty"` |
| 33 | ReadStatus *ReadStatus `json:"readStatus,omitempty"` |
| 34 | ReadPause *provider.ReadPause `json:"readPause,omitempty"` |
| 35 | ReadCompletion *provider.ReadCompletion `json:"readCompletion,omitempty"` |
| 36 | Usage *Usage `json:"usage,omitempty"` |
| 37 | Approval *Approval `json:"approval,omitempty"` |
| 38 | Ask *Ask `json:"ask,omitempty"` |
| 39 | MCPInteraction *MCPInteraction `json:"mcpInteraction,omitempty"` |
| 40 | Compaction *Compaction `json:"compaction,omitempty"` |
| 41 | Maintenance *ContextMaintenance `json:"maintenance,omitempty"` |
| 42 | Guardian *Guardian `json:"guardian,omitempty"` |
| 43 | DecisionReceipt *DecisionReceipt `json:"decisionReceipt,omitempty"` |
| 44 | Extension *ExtensionSurface `json:"extension,omitempty"` |
| 45 | Err string `json:"err,omitempty" externalizable:"true"` |
| 46 | Outcome string `json:"outcome,omitempty"` |
| 47 | Readiness *FinalReadiness `json:"readiness,omitempty"` |
| 48 | ProtocolRecovery *provider.ProtocolRecoveryAction `json:"protocolRecovery,omitempty"` |
| 49 | Diagnostic *provider.FailureDiagnostic `json:"diagnostic,omitempty"` |
| 50 | Receipt *CompletionReceipt `json:"receipt,omitempty"` |
| 51 | CheckpointTurn *int `json:"checkpointTurn,omitempty"` |
| 52 | Recovery *event.RecoveryStatus `json:"recovery,omitempty"` |
| 53 | RetryAttempt int `json:"retryAttempt,omitempty"` |
| 54 | RetryMax int `json:"retryMax,omitempty"` |
| 55 | RetryScope string `json:"retryScope,omitempty"` // "headers" | "stream" | "protocol"; omit for older clients |
| 56 | StreamAttempt *StreamAttempt `json:"streamAttempt,omitempty"` |
| 57 | // ItemID correlates Steer / TurnDone / unapplied-steer with a durable |
| 58 | // session-inbox entry. Empty for legacy text-only guidance. |
| 59 | ItemID string `json:"itemId,omitempty"` |
| 60 | // SessionPath routes frames emitted by detached Serve controllers. Older |
| 61 | // clients ignore the omitted/unknown field and keep single-session behavior. |
| 62 | SessionPath string `json:"sessionPath,omitempty"` |
| 63 | // SessionCurrent is set by Serve at publication time for frames belonging |
| 64 | // to its foreground controller. It lets all-session clients adopt an |
| 65 | // externally selected/recovered foreground without polling on every token. |
| 66 | SessionCurrent bool `json:"sessionCurrent,omitempty"` |
| 67 | // SessionReset distinguishes a fresh /new or /clear target from a resumed |
| 68 | // durable session when a different client rotates the foreground. |
| 69 | SessionReset bool `json:"sessionReset,omitempty"` |
| 70 | Workspace *WorkspaceChanged `json:"workspace,omitempty"` |
| 71 | // Phase is set on turn_phase events: working | checking | verifying | reviewing. |
| 72 | Phase string `json:"phase,omitempty"` |
| 73 | // Completion is set on completion_summary events (content-free quality summary). |
| 74 | Completion *CompletionSummary `json:"completion,omitempty"` |
| 75 | } |
| 76 |