import { type TreeIndex } from "./forest.js"; import type { HostedCall } from "./hostedCalls.js"; import { type Round } from "./timeline/rounds.js"; import type { EventEnvelope, TreeNode } from "./types.js"; export type Interrupt = { effect: string; message: string; outcome: string; resolvedBy?: string; }; export type ToolStatus = "completed" | "failed" | "rejected" | "awaitingApproval" | "unfinished"; export type ToolWork = "started" | "notStarted" | "unknown"; export type ToolOutcome = { status: ToolStatus; work: ToolWork; }; export type ToolFailure = { neverStarted: boolean; destructiveRan: boolean; }; export type ToolEvidence = { completed: boolean; errors: ToolFailure[]; interrupts: ("approved" | "rejected" | "pending")[]; }; type RowBase = { id: string; depth: number; node: TreeNode; /** The row's span (or its event's span) names a parent this log never * recorded, so it sits at the top level. */ orphan: boolean; }; export type RoundStoryRow = RowBase & { kind: "round"; round: Round; gist: string; }; export type UserStoryRow = RowBase & { kind: "user"; text: string; }; export type ToolStoryRow = RowBase & { kind: "tool"; name: string; argSummary: string; durationMs: number | undefined; status: ToolStatus; work: ToolWork; /** Arguments the model sent as null that the runtime dropped before the * call, so the parameter's default applied. */ droppedNulls: string[]; }; /** A tool the provider ran inside the call above it, such as its built-in * web search. It has no events of its own; its node is the call's. */ export type HostedStoryRow = RowBase & { kind: "hosted"; call: HostedCall; round: Round; }; export type InterruptStoryRow = RowBase & { kind: "interrupt"; interrupt: Interrupt; toolName: string | undefined; }; export type ErrorStoryRow = RowBase & { kind: "error"; message: string; }; /** The run stopped under this interrupt and waited; `pausedMs` is undefined * while it still waits. */ export type PauseStoryRow = RowBase & { kind: "pause"; pausedMs: number | undefined; resumed: boolean; }; export type SubagentStoryRow = RowBase & { kind: "subagent"; label: string; }; /** `title` is the row's name on every screen: `Thread ·