import type { AgentMessage } from "@earendil-works/pi-agent-core"; export declare const RISKY_TAG = "\uD83D\uDD12"; export interface GlyphInfo { glyph: string; risky: boolean; } export declare function toolGlyph(toolName: string, args: unknown): GlyphInfo; export declare function argHint(toolName: string, args: unknown, maxLen?: number): string; /** * Full argument content for the activity log — the producer plays no display * role: the log entry carries the complete command/pattern/query (newlines * and all) and the VIEWS decide how to clamp, wrap, or expand it (dashboard: * 2-row clamp + ctrl+o expand). Paths stay full (not basenamed) — same * principle. */ export declare function argContent(toolName: string, args: unknown): string; /** * View-side display normalization: split a raw log entry (stored verbatim in * the tail buffers) into display-safe lines — split on any line-break flavour, * expand tabs (tabs break visible-width column math), strip layout-breaking C0 * control characters while preserving ANSI styling (\x1b). Blank continuation * segments are dropped; fully-empty input stays one empty line. Every view * that renders tail entries into a row-based layout MUST route them through * this (a raw \n inside a composed pane row resets the terminal cursor to * column 0 and the remainder renders under the adjacent pane). */ export declare function toDisplayLines(raw: string): string[]; /** * Truncate at a whitespace boundary when possible so we don't slice mid-token * (e.g. `FORGE_ROOT=$(node -e` cut at the open paren). Appends `…(+Nc)` so the * user knows there's more. */ export declare function truncateAtBoundary(s: string, max: number): string; /** * Extract a small "shape" hint from a tool result so users see `read ok 247L` * instead of `read ok`. Defensive: result shapes vary across tools and providers. */ export declare function resultShape(_toolName: string, result: unknown): string; /** * Pull the first sentence (or first 100 chars) from any `thinking` block on an * assistant message. Returns `undefined` if no thinking content present. */ export declare function extractThinkingOneLiner(message: AgentMessage | undefined): string | undefined; /** * Full thinking text from an assistant message — every `thinking` block * joined, VERBATIM (no length cap, newlines preserved). Companion to * {@link extractThinkingOneLiner}: the one-liner feeds compact single-line * surfaces (the registry breadcrumb), this feeds the activity log so the * saved tail keeps the complete reasoning. The dashboard view clamps it to a * couple of rows and ctrl+o expands — no data is lost. Returns "" if absent. */ export declare function extractThinkingText(message: AgentMessage | undefined): string; export interface UsageDelta { input: number; output: number; cacheRead: number; /** * Per-turn context-window size (pi's totalTokens). Accumulated as a PEAK * (high-water), not a sum — see viewport/events.ts. This is the honest * "how big is this agent" number; cumulative cacheRead re-counts the same * cached prefix every turn and balloons to tens of millions. */ context: number; } /** Extract usage from an assistant message; returns zeros if missing. */ export declare function readUsage(message: AgentMessage | undefined): UsageDelta; /** * Extract the last assistant-authored text from a turn_end message and * collapse to a single-line preview (max 120 chars). Returns "" if the * message has no text content (e.g. all-tool-call turn). */ export declare function extractTurnPreview(message: unknown): string; /** * Full assistant-authored text from a message — every `text` block joined, * VERBATIM (no length cap, newlines preserved). Companion to * {@link extractTurnPreview}: the preview feeds compact single-line surfaces * (registry/tree node label, status line), this feeds the activity-log * narration line so the saved tail keeps the complete message. The dashboard * view clamps it and ctrl+o expands — no data is lost. Returns "" if the * message has no text content (e.g. an all-tool-call turn). */ export declare function extractAssistantText(message: unknown): string; export declare function fmtTokenMeter(u: UsageDelta): string; /** Format a one-shot phase-completion line for the tail buffer. */ export declare function fmtPhaseSummary(opts: { role: string; turns: number; tools: number; errors: number; wallSeconds: number; usage: UsageDelta; model?: string; provider?: string; compression?: { calls: number; tokensSaved: number; }; }): string; /** * Build the sticky footer line shown at the bottom of the tail view. * Includes cacheRead only when nonzero — most non-Anthropic providers (ollama, * glm, etc.) return 0 for cache fields and we don't want the noise. */ export declare function fmtTokenFooter(usage: UsageDelta | undefined, compression?: { calls: number; tokensSaved: number; }, detailed?: boolean): string; /** * Compact `(provider) model` label used to annotate token footers so users * can see which model a phase ran with. Returns "" when neither field is * populated. */ export declare function fmtModelLabel(info: { provider?: string; model?: string; } | undefined): string; /** * Combine a model label with a token footer, separated by ` · `. Either * half may be empty — the separator is only inserted when both halves are * present. Returns "" when both are empty. */ export declare function fmtModelAndTokenFooter(info: { provider?: string; model?: string; } | undefined, usage: UsageDelta | undefined, compression?: { calls: number; tokensSaved: number; }, detailed?: boolean): string;