import type { AvailableCommand, PlanEntry, SessionConfigOption, SessionModelState, SessionModeState, ToolCallContent, Usage } from '@agentclientprotocol/sdk'; import type { RuntimeEvent, RuntimeToolStatus } from './events.js'; export interface TranscriptBlock { id: string; kind: 'message' | 'reasoning'; sessionId: string; turnId?: string; content: string; completed: boolean; } export interface TranscriptToolRecord { toolCallId: string; sessionId: string; turnId?: string; name: string; title?: string; kind?: string; status: RuntimeToolStatus; input?: unknown; output?: unknown; locations?: unknown[]; /** * Latest structured tool output (text/image content blocks, file diffs, * embedded terminals) from ACP `tool_call.content` / * `tool_call_update.content`. Replaced wholesale on each update that * supplies a new array. */ content?: ToolCallContent[]; } export interface TranscriptSessionMetadata { commands: AvailableCommand[]; configOptions: SessionConfigOption[]; modes?: SessionModeState; currentModeId?: string; models?: SessionModelState; currentModelId?: string; /** * Latest agent execution plan, replaced wholesale on every ACP `plan` * session update. `undefined` if the agent has not emitted a plan yet for * this session. */ currentPlan?: { entries: PlanEntry[]; }; usage: { used?: number; size?: number; cost?: number | null; inputTokens?: Usage['inputTokens']; outputTokens?: Usage['outputTokens']; totalTokens?: Usage['totalTokens']; cachedReadTokens?: Usage['cachedReadTokens']; cachedWriteTokens?: Usage['cachedWriteTokens']; thoughtTokens?: Usage['thoughtTokens']; }; } export interface TranscriptState { blocks: TranscriptBlock[]; tools: Record; session: TranscriptSessionMetadata; } export declare function createTranscriptState(): TranscriptState; export declare function cloneTranscriptState(state: TranscriptState): TranscriptState; export declare function applyRuntimeEvent(state: TranscriptState, event: RuntimeEvent): TranscriptState; export declare function applyRuntimeEvents(state: TranscriptState, events: RuntimeEvent[]): TranscriptState; export declare function flushOpenStreamCompletions(state: TranscriptState, at?: number): RuntimeEvent[];