import type { ChatResult, TransportEvent } from '../agent/llm.ts'; import type { InboxItem, QuestionMode, ToolSpec } from '../shared/types.ts'; export type ScenarioId = 'sync' | 'background' | 'blocking' | 'async'; export type Question = { id: string; callId: string; mode: QuestionMode; kind: 'priority' | 'selection'; text: string; options: string[]; }; export type Answer = { text: string } | { selected: number[] }; export type ScenarioInfo = { id: ScenarioId; task: string; system: string; tools: ToolSpec[]; }; export type Delivery = { inboxId: string; ref: string; kind: InboxItem['kind']; messageIndex: number }; export type LiveBody = | { type: 'run.start'; id: string; scenario: ScenarioId; workspace: string; startedAt: number } | { type: 'run.state'; state: 'running' | 'waiting' | 'done' | 'stopped' | 'error'; note?: string; summary?: string } | (TransportEvent & { n: number; deliveries?: Delivery[] }) | { type: 'model.result'; n: number; response: ChatResult } | { type: 'model.text'; n: number; text: string } | { type: 'tool.call'; n: number; callId: string; name: string; args: unknown } | { type: 'tool.result'; n: number; callId: string; name: string; result: string; ref?: string } | { type: 'job.start'; jobId: string; callId: string; command: string } | { type: 'job.exit'; jobId: string; callId: string; code: number | null; duration: number; output: string } | { type: 'inbox.push'; item: InboxItem } | { type: 'inbox.deliver'; items: Delivery[] } | { type: 'question.open'; question: Question } | { type: 'question.answer'; questionId: string; callId: string; answer: Answer } | { type: 'report.written'; path: string; markdown: string }; export type LiveEvent = LiveBody & { seq: number; t: number };