/** * Session events to terminal lines. * * The session log is the source of truth for everything the model saw, so the * transcript is a projection of it rather than a record the frontend keeps in * parallel. Each committed event becomes lines that are written once into * scrollback and never revisited; the streaming reply is the only mutable part * and lives in the live region until its `assistant/message` commits it. * * Every string reaching here came from a model, a tool, or a log, so every * string is escaped before it is returned. * @module dshline/transcript */ import type { SessionEvent } from '@deepseek-ai/dsh-session'; import type { ContentBlock } from '@deepseek-ai/dsh-llm'; /** * Concatenate the text of every text block, dropping non-text blocks. * @param content - message content blocks. * @returns the joined text, empty when the message carries none. */ export declare function textOf(content: readonly ContentBlock[]): string; /** * Compact presentation of one durable image reference. * * Reference metadata is sufficient for history layout, so transcript rendering * never reads binary content and never exposes the opaque id or provider-owned * storage location. * @param block - durable Harness image content. * @returns one unescaped, presentation-only label. */ export declare function imageLine(block: Extract): string; /** * Compact presentation of one durable verbatim file reference. * * Everything shown is a field the reference publishes: a display name and an * exact byte length. The opaque content-addressed id, the provider's storage * location, and any host path are all deliberately absent — this is history * that anyone sharing the scrollback will read, and none of those three is * information a reader can act on. * @param block - durable Harness file content. * @returns one unescaped, presentation-only label. */ export declare function fileLine(block: Extract): string; /** * One prompt as the ordered lines its durable blocks describe. * * Order is the point. Grouping every text block first and every attachment after * it was accurate while an ordinary prompt could carry images or nothing; it is * a lie the moment one prompt carries a text block, an image, and a file in the * order the reader staged them, because the terminal would then show a sequence * the session log does not contain and a later replay would quietly disagree * with what was watched. So the blocks are walked in place: consecutive text * joins into one line, and an attachment flushes whatever text came before it. * A text block after an attachment stays after it rather than being hoisted. * * Blocks this transcript has no presentation for are skipped rather than * guessed at, for the same reason `projectEvent` never throws on an unfamiliar * event: `ContentBlockMap` is merge-extensible, and a plugin's block is not * something to invent a line for. * @param content - the message's durable content, in its own order. * @returns display lines, unescaped, each one a block or a run of text blocks. */ export declare function userContentLines(content: readonly ContentBlock[]): string[]; /** * Project one committed session event to lines, or nothing when the event has no * terminal representation. * * Unrecognized event types return nothing rather than throwing: `SessionEventMap` * is merge-extensible, so any plugin may add a type this frontend has never seen, * and a frontend that failed on one would break the moment a deployment mounted * an unfamiliar plugin. `system/message` is silent for a stated reason rather * than by falling through, so removing that reason has to be a deliberate edit. * @param event - the committed event. * @param columns - the terminal's current width. * @returns lines to commit to scrollback. */ export declare function projectEvent(event: SessionEvent, columns: number): string[]; /** * The echo of a command line the user submitted. * * Projected from `command/run` rather than written when the line is submitted, * because a resumed session has to show the command too: the result alone tells a * reader that something happened without saying what was asked for. * * Marked as the user's line, because it is one — but without the separator rule a * prompt gets. A command is not a conversation turn, and drawing a rule for each * one would break a transcript into fragments. * @param name - the command name, without its slash. * @param args - the verbatim text following the name, if the command records it. * @param columns - the terminal's current width. * @returns lines to commit to scrollback. */ export declare function commandEcho(name: string, args: string | undefined, columns: number): string[]; /** * What one settled command contributes to the transcript. * * A command runs without a model turn, so this is the ONLY thing that says what it * did — there is no reply to read and no card to look at. A failure always speaks, * because a command that fails silently is indistinguishable from one that is * broken. A success with no text of its own is acknowledged by name rather than * passed over: `{ kind: 'success' }` alone is a valid outcome, and the commands * that return it are exactly the ones whose effect this frontend cannot otherwise * show — so silence there is the same defect one layer down. * * Marked like the rest of the transcript rather than framed: a command's answer is * a note about the session, the same weight as `· interrupted`, and multi-line text * — the usage `/goal` prints, the preset list `/permission` prints — is indented * under its mark so it reads as one block at any width. * @param result - the handler's normalized outcome, as `command/done` carries it. * @param name - the command's name, paired from its `command/run`; undefined when * the log begins between the two. * @param columns - the terminal's current width. * @returns lines to commit to scrollback. */ export declare function commandLines(result: { readonly kind: 'success' | 'error'; readonly text?: string; }, name: string | undefined, columns: number): string[]; //# sourceMappingURL=transcript.d.ts.map