import type { RuntimeContentItem } from "../code-mode/types.ts"; import type { BindingRecipe, PortableState } from "./portable-state.ts"; export interface TsWorkerInput { mode?: "live" | "isolated"; /** Empty source captures the current heap without replaying or replacing it. */ captureOnly?: boolean; /** Restore only these noncolliding durable additions into an existing kernel. */ restore?: PortableState; state: PortableState; javascript: string; bindings: Record; toolNames: Record; toolMetadata: unknown[]; outputHints: Record; commandFormatter: string; maxStateBytes: number; } export type TsWorkerCommand = { kind: "start"; runId: number; input: TsWorkerInput; } | TsWorkerReply; export type TsWorkerMessage = { kind: "output"; items: RuntimeContentItem[]; } | { kind: "notify"; text: string; } | { kind: "yield"; } | { kind: "request"; id: number; operation: "tool" | "import"; name: string; input: unknown; } | { kind: "done"; state: PortableState; } | { kind: "live-done"; state: PortableState; skipped: { name: string; reason: string; }[]; sourceStarted: boolean; error?: string; captureError?: string; restoreFailed?: string[]; } | { kind: "error"; error: string; }; export type TsWorkerEnvelope = { runId: number; message: TsWorkerMessage; }; export type TsWorkerOutcome = Extract; export interface TsWorkerReply { id: number; value?: unknown; error?: string; } export declare function tsGlobalDeclarations(contentOccupied?: boolean): string;