/** * Text the panel draws: columns, colours and the words behind each cell. Pure * functions over records — no terminal, no clock, no store — so a renderer can * be read and tested without the panel around it. * * @author mystery4f <40482524+mystery4f@users.noreply.github.com> */ import type { ThemeColor } from "@earendil-works/pi-coding-agent"; import type { CmdLoopTask, FireRecord, LoopBase, PromptLoopTask, Task, TaskKind, TaskStatus } from "../../tasks/base/task.js"; import { type Iteration, type IterationCall, type IterationRetry } from "../../tasks/loop/iteration.js"; import type { PromptPreview } from "../../tasks/loop/prompt-file.js"; import { type PanelTaskView } from "./model.js"; /** Size column: output bytes for a process task; a loop task has no output file. */ export declare function formatSize(row: PanelTaskView): string; /** The live dot: running is loud, a stopped task is a hollow ring, paused is a warning. */ export declare function dotColour(task: Task): ThemeColor; /** Exit column: a process has a code, a loop has fires instead, a chain has steps. */ export declare function exitText(task: Task): string; /** * The provider retry as one phrase: `retry 2/4`, and the status the failure named * when it named one. The denominator is every attempt the turn is allowed — pi's * retry budget plus the first try — because `attempt` counts the first try too: a * budget of 3 gives four attempts, and the fourth failure is the one pi gives up * on. A fire that spent those attempts on a busy provider otherwise reads as one * ordinary slow turn (ticket #47). */ export declare function retryText(retry: IterationRetry): string; /** * The retry a loop is on right now: only an open turn can be retrying, so a record * left behind by a turn that ended — a process that died mid-turn — is not shown as * in flight. What a finished turn's retry was is read on its own iteration page. */ export declare function openRetry(task: PromptLoopTask): IterationRetry | undefined; /** * Right-hand numbers: a process reports runtime, output size and how long ago it last * changed; a loop its fires, schedule and the same age. Recency sits on the right so a * row that just moved to the top says why (ADR-0010). */ export declare function rightText(row: PanelTaskView, now: number, room?: number, foreign?: boolean): string; /** Name colour, as the replaced panel had it: the ending decides, not the kind. */ export declare function nameColour(task: Task): ThemeColor; export declare function messageOf(error: unknown): string; export declare const ITERATION_COLOUR: { running: "accent"; completed: "success"; aborted: "warning"; interrupted: "warning"; /** A turn the provider gave up on: closed, but its verdict is not a clean one. */ failed: "error"; }; /** Tool-call states, read from the same palette. */ export declare const CALL_COLOUR: { running: "accent"; completed: "success"; failed: "error"; aborted: "warning"; interrupted: "warning"; }; export declare function isCommandCall(call: IterationCall): boolean; export declare function firesText(task: LoopBase): string; /** * Failed fires in a row: a command loop counts a fire that exited non-zero, and a * prompt loop one whose turn the provider gave up on (ticket #46) — the same count * on the same backoff curve, cleared by the same healthy fire (ADR-0017). A process * and a chain have no schedule to fail, so they answer zero. */ export declare function failureStreak(task: Task): number; /** A raised signal on a command loop: the check has something outstanding (ADR-0018). */ export declare function signalWord(task: Task): string; /** Fires that never ran because the previous one still was, appended to the count. */ export declare function missedText(task: CmdLoopTask): string; export declare function nextFireText(task: LoopBase, row: PanelTaskView, backingOff?: boolean): string; /** Iteration list heading: kept and dropped counts are both stated, never hidden. */ export declare function iterationsText(task: PromptLoopTask): string; /** Fire list heading: kept and dropped counts are both stated, never hidden. */ export declare function firesHeading(task: CmdLoopTask): string; /** One fire row: number, time, outcome, exit code, duration and bytes (ADR-0015). */ export declare function fireLine(fire: FireRecord): string; /** The glyph a strip cell prints for its outcome; `–` never ran (ADR-0015). */ export declare const FIRE_MARK: { running: string; success: string; failed: string; signalled: string; skipped: string; interrupted: string; }; /** Strip colour by outcome: live, done, failed, never-ran, cut short by a stop. */ export declare const FIRE_COLOUR: { running: "accent"; success: "success"; failed: "error"; signalled: "warning"; skipped: "muted"; interrupted: "warning"; }; /** The mark a chain step carries on its line, one glyph per status it can hold. */ export declare const STEP_MARK: { running: string; paused: string; completed: string; failed: string; killed: string; interrupted: string; waiting: string; skipped: string; stopped: string; }; /** Step colour by status, so a finished step reads as done and a skipped one as absent. */ export declare function stepColour(status: TaskStatus): ThemeColor; /** * One iteration row: fire number, result, when it ran, what it cost, and — once a * second fire in a row made no call — the run that says the loop has stalled. */ export declare function iterationLine(iteration: Iteration, iterations: readonly Iteration[]): string; /** How many calls the iteration kept; the dropped ones are marked below the list. */ export declare function callsText(iteration: Iteration): string; /** * Where the visible call window sits, oldest first. `rows` is how many lines the * pane can give the calls, so a short pane reports the shorter range it shows * instead of promising rows it never drew. */ export declare function callsHeading(iteration: Iteration, requested: number, rows?: number): string; export declare function callTopFor(iteration: Iteration, requested: number, rows?: number): number; /** A free-form field as one line: the panel draws rows, not paragraphs. */ export declare function singleLine(text: string, maxLength: number): string; /** * Short kind word printed in a row. Search uses the same word, so a reader who * sees `llm` can type `llm` and find that row. */ export declare function kindWord(kind: TaskKind): "proc" | "llm" | "cmd" | "chn"; /** * What a loop page says under the prompt's path. `lines` is at most the three the * loop layer trimmed; `changed` carries the file's own time in the same clock the * `Updated` row above it uses, so a reader can tell a prompt written a moment ago * from one nobody has touched. `problem` is whatever needs saying alongside them: * the record's own warning first — a fire that fell back to the creation text * leaves behind a file that reads fine again, so the file alone would hide it — * and otherwise the file's own state ("the prompt file is empty"). */ export interface PromptBody { readonly lines: readonly string[]; readonly changed?: string; readonly problem?: string; } export declare function promptBody(preview: PromptPreview, warning: string | undefined): PromptBody;