/** * The cockpit's structured-stream renderer — S8's drill-in for an ACP stream. * * When a drilled worker's relay stream is a **structured** ACP stream (its chunks * are {@link TRANSCRIPT_EVENT_MARKER}-tagged transcript-event envelopes rather than * raw PTY bytes), the {@link TerminalSession} routes each decoded event here instead * of the byte-terminal. This renderer does **not** re-parse or pretty-print JSON: it * feeds the accumulated typed events straight through the ONE canonical * {@link deriveView} fold from `@nanobpm/agentic/transcript` and renders the resulting * {@link DerivedView} (turns → messages + tool cards) into the DOM. * * Like {@link renderCockpit} it builds against the structural {@link ElementLike} / * {@link DocumentLike} subset (not lib.dom), so it renders identically embedded and * standalone, is unit-tested on Node with the in-memory fake and no `as` cast, and is * browser-safe — it relies only on the browser-safe transcript vocab (no `Buffer`). * * Events arrive offset-keyed and immutable in offset order, so re-deriving the whole * (idempotent) log on each event is correct across a resume-from-offset reconnect: a * replayed chunk below the resume point never reaches this sink, so no event is * dropped or double-applied. */ import { type DerivedView } from "../transcript/index.ts"; import type { DocumentLike, ElementLike } from "./render.ts"; import type { StructuredSink } from "./terminal-session.ts"; /** * Render a derived structured view into `host`, replacing whatever was there. * Idempotent: re-call it with the latest {@link DerivedView} on every new event. */ export declare function renderStructured(host: ElementLike, doc: DocumentLike, view: DerivedView): void; /** A structured sink with a `dispose` teardown (mirrors {@link TerminalSink}). */ export interface StructuredTerminal extends StructuredSink { dispose(): void; } /** * Build a {@link StructuredSink} that accumulates the offset-ordered transcript * events a structured stream delivers, folds them through the canonical * {@link deriveView}, and renders the derived view into `host` on each event. The * accumulated log is this sink's own state, so constructing one per drill-in gives * each worker its own structured view. */ export declare function createStructuredSink(host: ElementLike, doc: DocumentLike): StructuredTerminal;