SessionEvent:
| { steer?: boolean; text: string; type: "user" }
| { text: string; type: "assistant" }
| {
detail: string;
elapsedMs: number;
input?: Record<string, unknown>;
name: string;
ok: boolean;
result?: string;
type: "tool";
}
| { text: string; type: "notice" }
| { text: string; type: "error" }
| {
cached: number;
cost?: number;
input?: number;
output?: number;
tokens: number;
type: "usage";
}
| { elapsedMs: number; text: string; type: "reasoning"; variant?: string }
| { custom: string; data: unknown; type: "custom" }
| { reason: string; type: "cleared" }
| { dropped: number; summary: string; type: "compacted" }
| { messages: ModelMessage[]; type: "turn" }
Durable event variants stored in a session JSON record.