import { type FlatRole } from "./structured.js"; import { type StoryRow, type ToolStoryRow } from "./story.js"; import { type Round } from "./timeline/rounds.js"; import { type OverviewCall } from "./overviewData.js"; import type { TreeNode } from "./types.js"; import type { CommentThread } from "../runDirectory/comments.js"; /** `faded` marks a line that is history, painted in one muted color. * `oneRow` keeps a line to a single painted row, cut with an ellipsis. */ export type PayloadLine = ({ kind: "heading"; text: string; tone: "assistant" | "tool" | "interrupt" | "error" | "user" | "chrome" | "accent"; } | { kind: "meta"; text: string; } /** A rule across the width with a label on it: `── RESULT · ~4.4k tokens ──`. */ | { kind: "rule"; text: string; tone?: "assistant" | "tool" | "interrupt" | "error" | "user" | "chrome" | "accent"; } | { kind: "text"; text: string; indent: number; role: FlatRole | "plain" | "error"; } /** A field with its value on the same line; the painter colors the key. */ | { kind: "pair"; key: string; text: string; indent: number; } /** A list of same-shaped objects; the painter draws rows when they fit. */ | { kind: "table"; columns: string[]; rows: string[][]; indent: number; } | { kind: "code"; text: string; language: string; indent?: number; } | { kind: "json"; text: string; } /** The overview's three charts over these calls, painted by `overviewCharts`. */ | { kind: "charts"; calls: OverviewCall[]; } | { kind: "blank"; }) & { faded?: boolean; oneRow?: boolean; }; export type PayloadOptions = { raw: boolean; /** The trace the row belongs to. A group row charts its calls with it * and shows its summary alone without it. */ trace?: TreeNode; /** The comment threads on this row, listed after the payload. */ comments?: CommentThread[]; }; export declare function payloadFor(row: StoryRow, options: PayloadOptions): PayloadLine[]; /** The `comments` section under a row's payload: each thread as * `✎ adit · 14:30: why…`, its replies indented under it. */ export declare function commentsPayload(threads: readonly CommentThread[]): PayloadLine[]; /** How much of a tool result the overview shows until `x` is pressed. */ export declare const RESULT_PREVIEW_CHARS = 600; /** The first RESULT_PREVIEW_CHARS of a result and a line counting the rest. */ export declare function cutResultPayload(text: string): PayloadLine[]; /** The completion, then each requested tool call with its arguments and, * when `tools` holds the call's tool rows, what came back. Requests are * matched to tool rows by name, in order, so a tool called twice in one * round pairs first with first. */ export type ResultOptions = { /** Print every result whole instead of its first RESULT_PREVIEW_CHARS. */ fullResults?: boolean; /** Cut each argument longer than this many characters. */ argumentChars?: number; }; /** How much of each argument an LLM call's row shows. The call row says * which tools were requested; the tool's own row has the arguments whole. */ export declare const ARGUMENT_PREVIEW_CHARS = 120; /** Whether any completed tool's result is longer than the preview keeps. */ export declare function hasCutResult(tools: ToolStoryRow[]): boolean; export declare function roundResponsePayload(round: Round, tools?: ToolStoryRow[], options?: ResultOptions): PayloadLine[]; /** The arguments with every value longer than `cap` characters cut to * that many and an ellipsis, measured as the text the viewer would print. */ export declare function cutArguments(args: unknown, cap: number): unknown; /** What a requested tool gave back, by its recorded status. */ export declare function toolResultPayload(tool: ToolStoryRow, options?: ResultOptions): PayloadLine[]; /** One line of token counts, the same on every screen: what the model * read, how much of that was cached (and written to the cache), and what * it wrote. `exact` prints full numbers instead of rounded ones. */ export declare function roundTokenLine(round: Round, opts?: { exact?: boolean; }): string; export declare function resultTokenEstimate(output: unknown): number; /** Whole code blocks stay intact until the painter highlights them. */ export declare function valuePayload(value: unknown): PayloadLine[];