/** * OpenCode-style transcript styling. pi has no renderer hooks for these, so two prototype patches * (pi and extensions share one module instance; verified on pi 1.4.0 and 1.5.0), both undone on uninstall: * * 1. User messages (UserMessageComponent.render): a ┃ bar in the agent colour, then the message * on the panel background with 1 row of padding above and below and 2 columns on the left, * like OpenCode's UserMessage box. * * ┃ * ┃ fix the failing test in src/app.ts * ┃ * * 2. Tool rows (ToolExecutionComponent.render): pi puts a blank line above every tool. OpenCode * stacks consecutive one-line tools with no gap, so for our one-line rows ("self" shell, a * single content line) the blank line is dropped when the item above is also a tool or a * hidden thinking-only message. * * Other extensions' tools (default shell: a padded, shaded box) are compacted the same way * when collapsed and their box holds at most 2 short lines: one row with "⚙", the call line, * and the result line right-aligned and dim, e.g. * lsp_diagnostics button.ts ✓ No diagnostics * Errors, partial results, multi-line output and the expanded view (ctrl+o) keep pi's box. * * 3. Finished thinking (AssistantMessageComponent.render): with thinking blocks hidden, pi leaves a * "Thinking..." label plus a blank line for every thinking block, i.e. between most tool calls * and above every answer. OpenCode shows nothing once thinking is done, so in a finished message * the hidden-thinking labels (and the spacer after each) are left out, and a message left with * nothing visible renders no lines. While streaming the label stays (the thinking peek lives * there). ctrl+t (pi's app.thinking.toggle) still shows full thinking. * * 4. Extension messages (CustomMessageComponent.render, e.g. a recall notice from a memory extension): pi * draws them in a full-width shaded box. OpenCode draws notices as a ┃ bar in a muted colour * beside a panel-shaded block, like its revert/error notices, so the box's own background is * replaced with the panel shade and a dim bar is added. Messages whose renderer draws a plain * row of its own (PLAIN_MESSAGE_TYPES) are left as that renderer draws them: no panel, no bar. * * Lines keep their OSC 133 prompt markers, which pi uses for prompt-to-prompt navigation. */ import { type Theme } from "@earendil-works/pi-coding-agent"; import type { AgentMode, UiState } from "./state.ts"; export declare function memoLines(owner: object, slot: string, width: number, key: string, src: string[], build: () => string[]): string[]; /** * Custom message types that draw themselves as a plain row, like a tool row, and so get no panel * or bar from chassis. Extensions in other module scopes add theirs through the shared set, with * `globalThis[Symbol.for("pi-chassis/plainMessageTypes")]`, so no import of chassis is needed. */ export declare const PLAIN_MESSAGE_TYPES: Set; /** * The mode a user box was sent in, so its bar keeps that colour when the mode changes later. It is * read from the session once the box can be matched to its message: the Nth box is the Nth user * message, trusted only when the two counts agree. Until then (a message not saved yet, or the chat * not found yet) it is the mode the box was first drawn in, and `final` is false so the caller does * not cache that guess. */ export declare function modeOfUserBox(state: UiState, box: object): { mode: AgentMode; final: boolean; }; /** * Width of the label column on the right of a user box. It is the same for every mode, so a message * wraps at the same place whichever mode it was sent in. */ export declare const LABEL_COLUMN: number; /** The text area is never narrower than this: a box too narrow to keep it has no label column at all. */ export declare const MIN_TEXT_WIDTH = 24; export declare function installMessageStyle(state: UiState, getTheme: () => Theme | undefined): () => void; /** True when a tool row draws more than one content line (a block, or an expanded row). */ export declare function isTall(c: any, width: number): boolean; /** * A finished assistant message whose only visible content is hidden thinking (it renders nothing). */ export declare function isHiddenThoughtOnly(c: any): boolean; export declare function setChatContainer(c: { children: unknown[]; } | undefined): void;