/** * One row shape for every capability listing. * * Plugins, marketplaces, agents and skills are listed in at least five places — * the `/plugin` commands, the startup resource summary, and the model-facing * `SearchPlugins`/`ListPlugins` tools. Each had grown its own `name [a, b] — desc` * variant, so the same plugin printed three different ways depending on which * surface you asked. This module owns the layout so they cannot drift again. * * Two constraints shape the API: * * 1. **Styling is injected, never assumed.** The same rows are rendered as plain * text (tool results the model reads, RPC payloads a client formats itself) * and as themed terminal output. Callers pass a {@link ListStyle}; the default * is identity, so the plain path costs nothing and can never emit an escape * code into a protocol message. * 2. **Width is optional.** Only the interactive surface knows the terminal * width. With `columns` set, detail text is wrapped and indented under its * row; without it, detail is emitted unwrapped and the consumer wraps. The * TUI's own wrapper has no hanging indent, which is what made the old * listings unreadable — a wrapped description restarted at column 0 and read * as a new entry. */ /** `1 plugin` / `2 plugins`, so listings stop printing `plugin(s)`. */ export declare function plural(count: number, word: string, pluralForm?: string): string; /** Pad to `width` display columns, measuring ANSI-aware. */ export declare function padCell(text: string, width: number): string; /** * Truncate to `maxWidth` display columns. * * Deliberately not the TUI's `truncateToWidth`, which wraps its result in * `\x1b[0m` even for plain input. That would put escape codes into text the * model and RPC clients read, and a *full* reset at that — dropping any style * the caller had applied around it, mid-line. */ export declare function truncateVisible(text: string, maxWidth: number, ellipsis?: string): string; /** * Wrap `text` to `width`, indenting every line by `indent` spaces — including * the continuations, which is the whole point (see the module note). */ export declare function wrapIndented(text: string, indent: number, width?: number): string[]; /** A single listed capability. */ export interface ListRow { /** Primary identifier. Every row in the listing aligns on this column. */ name: string; /** Marker before the name — e.g. an installed tick. Counted in the column width. */ marker?: string; /** Short facts beside the name (platforms, capabilities, source kind). */ facts?: string[]; /** Free text on its own wrapped, indented line(s) below the row. */ detail?: string; /** Extra indented line below the detail — provenance, a path, a URL. */ trailer?: string; } /** Rows under an optional heading (a marketplace, a scope). */ export interface ListGroup { title?: string; rows: ListRow[]; } /** * Styling hooks. Every one defaults to identity so the plain-text path emits no * escape codes at all — required for tool results and RPC payloads. */ export interface ListStyle { name?(text: string): string; marker?(text: string): string; facts?(text: string): string; detail?(text: string): string; trailer?(text: string): string; groupTitle?(text: string): string; } export interface RenderListOptions { /** Terminal width, when the surface knows it. Enables wrapping and truncation. */ columns?: number; /** Columns of indent applied to group titles. Rows sit two further in. */ indent?: number; style?: ListStyle; /** Separator between facts. Defaults to the shared segment dot. */ factSeparator?: string; } /** * Render grouped rows as aligned text. * * The name column is measured across *every* group, not per group, so the * listing reads as one table rather than a stack of independently ragged ones. */ export declare function renderList(groups: ListGroup[], options?: RenderListOptions): string; /** * Single-line variant: name column plus one description, truncated to width * rather than wrapped. Used where a listing must stay one row per item (the * startup summary, where every extra line pushes the prompt down a page). */ export declare function renderCompactRows(rows: Array<{ name: string; detail: string; }>, options?: { columns?: number; indent?: number; style?: Pick; }): string; //# sourceMappingURL=format-list.d.ts.map