import type { DoneVerdict } from "./done.js"; import type { Verdict } from "./guard.js"; import type { ProseVerdict } from "./prose.js"; import type { RulesVerdict } from "./rules.js"; import type { RunawayVerdict } from "./runaway.js"; import type { StuckVerdict } from "./stuck.js"; export type WidgetPlacement = "aboveEditor" | "belowEditor"; export type WidgetBarMode = "stack" | "live"; /** Palette shared by the status line and the trace sidebar: one place decides what a verdict looks like. */ export interface ThemeLike { fg(color: string, text: string): string; bold(text: string): string; } export declare const LEVEL_COLOR: Record; export interface WidgetConfig { enabled: boolean; placement: WidgetPlacement; barMode: WidgetBarMode; /** Keyboard shortcut that toggles the trace sidebar; empty string disables it. */ shortcut: string; /** Sidebar width: a percentage string such as "40%" or a column count. */ panelWidth: string | number; /** Templates per guard. Segments are separated by " · "; a segment whose token has no value is dropped. */ action: string; stuck: string; done: string; prose: string; security: string; context: string; runaway: string; rules: string; subagent: string; } export declare const DEFAULT_TEMPLATES: { readonly action: "warden · {tool} · irreversible {irreversible} · off-task {offTask} · {scope} · slop: {slop} · patterns: {patterns} · {flags} · {level}"; readonly stuck: "warden · stuck · {failures} failures · same strategy {sameStrategy} · change {approachChange} · progress {progress} · {flags} · {status}"; readonly done: "warden · done-check · {changes} changes · {checksPassed}/{checks} checks passed · claims done {claimsDone} · claims verified {claimsVerified} · checks apply {checksApply} · {outcome} · {status}"; readonly prose: "warden · prose · wordy {wordy} · clichés {cliches} · jargon {jargon} · {flags} · {status}"; readonly security: "warden · security · {tool} · injection {injection} · exfiltration {exfiltration} · {status}"; readonly context: "warden · context · {tool} · {retention} · saved {bytesSaved} bytes"; readonly runaway: "warden · runaway · {kind} · {count}× repeated · {chars} chars · {signal} · {status}"; readonly rules: "warden · rules · {tool} {path} · {asked} rules · {violations} · {status}"; readonly subagent: "warden · subagent · {agent} · {kind} · {wake} · {status}"; }; /** Sentence-style templates: natural language, no " · " separators between semantic groups. */ export declare const SENTENCE_TEMPLATES: { readonly action: { readonly allow_default: "warden allowed {tool} action — {scope}"; readonly allow_safe: "warden allowed {tool} action — low risk"; readonly allow_read_only: "warden allowed {tool} action — read-only operation"; readonly allow_with_context: "warden allowed {tool} action — {scope}, irreversibility {irreversible}"; readonly allow_off_task: "warden allowed {tool} action — off-task but below threshold ({offTask})"; readonly allow_intent_mismatch: "warden allowed {tool} action — plan mismatch ({intent}) but not blocking"; readonly allow_slop: "warden allowed {tool} action — slop detected ({slop})"; readonly allow_patterns: "warden allowed {tool} action — patterns matched ({patterns})"; readonly allow_approved: "warden allowed {tool} action — approved by user"; readonly allow_typesafe_error: "warden allowed {tool} action — TypeSafe unavailable, pattern checks only"; readonly warn_off_task: "warden warned about {tool} action — off-task risk ({offTask})"; readonly warn_irreversible: "warden warned about {tool} action — high irreversibility ({irreversible})"; readonly warn_intent: "warden warned about {tool} action — differs from stated plan"; readonly warn_slop: "warden warned about {tool} action — code slop detected ({slop})"; readonly warn_patterns: "warden warned about {tool} action — security patterns matched ({patterns})"; readonly warn_visible: "warden warned about {tool} action — visible outside working tree"; readonly hold_irreversible: "warden held {tool} action — irreversibility {irreversible} exceeds threshold"; readonly hold_dangerous: "warden held {tool} action — destructive pattern detected ({patterns})"; readonly hold_deny: "warden blocked {tool} action — deny rule matched ({patterns})"; readonly default: "warden {level}ed {tool} action"; }; readonly stuck: { readonly stuck_repeat: "warden detected stuck loop — {failures} failures, same strategy ({sameStrategy})"; readonly stuck_churn: "warden detected stuck loop — {failures} failures, churning approaches"; readonly stuck_no_progress: "warden detected stuck loop — {failures} failures, no progress ({progress})"; readonly stuck_repeat_successful: "warden detected repeated success — {failures} identical results, consider if the task is done"; readonly stuck_typesafe_error: "warden stuck check unavailable — TypeSafe error"; readonly stuck_recovering: "warden detected stuck loop — {failures} failures, now recovering"; readonly ok: "warden checked stuck — no loop detected ({failures} failures, approach change {approachChange})"; readonly default: "warden {status} — {failures} failures"; }; readonly done: { readonly unverified: "warden flagged done claim — {checksPassed}/{checks} checks passed, {changes} changes, not verified"; readonly false_claim: "warden flagged false done claim — {checksPassed}/{checks} checks failed"; readonly ok: "warden confirmed done — {checksPassed}/{checks} checks passed, {changes} changes"; readonly ok_all_passed: "warden confirmed done — all {checks} checks passed"; readonly partial: "warden flagged done — {checksPassed}/{checks} checks passed, needs attention"; readonly no_checks: "warden flagged done claim — no verification checks run"; readonly typesafe_error: "warden done check unavailable — TypeSafe error"; readonly unverified_nudged: "warden flagged done claim — agent asked to verify ({checksPassed}/{checks} passed)"; readonly false_claim_nudged: "warden flagged false claim — agent asked to recheck"; readonly default: "warden done check — {outcome}"; }; readonly prose: { readonly nudged: "warden nudged prose — {status} in recent replies"; readonly wordy: "warden flagged prose — wordy ({wordy})"; readonly cliches: "warden flagged prose — clichés detected ({cliches})"; readonly jargon: "warden flagged prose — jargon detected ({jargon})"; readonly multiple: "warden flagged prose — {status}"; readonly ok: "warden checked prose — all clear"; readonly typesafe_error: "warden prose check unavailable — TypeSafe error"; readonly default: "warden prose — {status}"; }; readonly security: { readonly injection: "warden flagged security — injection risk in {tool} output"; readonly exfiltration: "warden flagged security — possible credentials in {tool} output"; readonly both: "warden flagged security — injection and exfiltration risk in {tool} output"; readonly suspicious: "warden flagged security — suspicious content in {tool} output"; readonly ok: "warden checked {tool} output — no security issues"; readonly default: "warden security — {tool}"; }; readonly context: { readonly compressed: "warden compressed {tool} output — kept {retention}, saved {bytesSaved} bytes"; readonly recalled: "warden recalled full {tool} output — agent needed the original"; readonly kept: "warden kept {tool} output — {retention}"; readonly large: "warden compressed {tool} output — {bytesSaved} bytes saved"; readonly default: "warden context — {tool}, {retention}"; }; readonly runaway: { readonly stopped: "warden stopped runaway {kind} — repeated {count}× ({chars} chars)"; readonly stopped_recovering: "warden stopped runaway {kind} — repeated {count}×, agent recovering"; readonly detected: "warden detected runaway {kind} — {count}× repetition"; readonly default: "warden runaway — {kind}"; }; readonly rules: { readonly violations: "warden flagged rules — {violations} in {tool} {path}"; readonly violation_single: "warden flagged rule — {violations}"; readonly none: "warden checked rules — no violations in {tool} {path}"; readonly skipped: "warden rules — skipped ({reasons})"; readonly typesafe_error: "warden rules check unavailable — TypeSafe error"; readonly default: "warden rules — {tool}"; }; readonly subagent: { readonly wake: "warden woke for subagent report — {agent}, {kind}"; readonly silent: "warden ignored subagent report — {agent}, {kind}"; readonly appended: "warden appended subagent report — {agent}"; readonly default: "warden subagent — {agent}"; }; }; /** Pick the best sentence template for a verdict. Falls back to the data-style template. */ export declare function pickSentenceTemplate(guard: string, tokens: Tokens): string; export declare function defaultWidgetConfig(): WidgetConfig; export type Tokens = Record; /** * Fill `{token}` placeholders. The template is split on " · "; a segment is dropped when any of its tokens is empty, * so optional information disappears together with its label. Unknown tokens render as empty (and drop their segment). */ export declare function renderTemplate(template: string, tokens: Tokens): string; /** * Body segments read as data, not prose: the subject (tool, path, agent) stays in the text tone, numeric values keep * the text tone, and the labels around them sit one step down in muted. Labels dim so the eye lands on what was measured. */ export declare function renderSegment(segment: string, subject: boolean, theme: ThemeLike): string; /** * Split a rendered line into its verdict and its body. The verdict is the trailing segment when the template ends on a * known level, wherever the template put `{level}` or `{status}`; the body drops the `warden` prefix and the guard's own * name, so the guard is named once by the rail that renders this. */ export declare function parseVerdictLine(line: string, guard: string): { status?: string; body: string[]; }; export interface WidgetEntry { guard: string; line: string; } /** * The status stack as a component. It renders from the width the layout hands it, so a body wraps to the pane and a * continuation keeps its column instead of reading as a second event. */ export declare function statusWidget(entries: readonly WidgetEntry[], theme: ThemeLike): { render(width: number): string[]; invalidate(): void; }; /** * The status line above the editor: a verdict chip leads each line, the guard follows in muted, and the body reads as * data. Guards whose last verdict found nothing fold into one line per verdict, so a calm turn costs one line instead * of one per guard; a verdict that ends nearest the editor is the one most worth the eye. The trace sidebar keeps every * event, its scores, and its detail; `/warden status` prints the last raw line per guard. * * With a `width`, each line wraps to it and a continuation keeps the column of the body, so a narrow pane does not turn * one verdict into two lines that look like two events. */ export declare function widgetLines(entries: readonly WidgetEntry[], theme: ThemeLike, width?: number): string[]; export declare function actionTokens(verdict: Verdict, at?: number): Tokens; export declare function stuckTokens(verdict: StuckVerdict, at?: number): Tokens; export declare function runawayTokens(verdict: RunawayVerdict, recovering: boolean, at?: number): Tokens; export declare function doneTokens(verdict: DoneVerdict, at?: number): Tokens; export declare function proseTokens(verdict: ProseVerdict, at?: number): Tokens; export declare function rulesTokens(verdict: RulesVerdict, at?: number): Tokens; /** Token names users can put in templates, for /warden status and the README. */ export declare const TOKEN_NAMES: { readonly security: readonly ["tool", "injection", "exfiltration", "status"]; readonly context: readonly ["tool", "retention", "bytesSaved"]; readonly runaway: readonly ["kind", "count", "chars", "signal", "block", "status", "time", "guard"]; readonly rules: readonly ["tool", "path", "asked", "violations", "status", "source", "reasons", "model", "ms", "flags", "time", "guard"]; readonly action: readonly ["tool", "level", "source", "irreversible", "offTask", "scope", "approved", "intent", "visible", "plan", "slop", "slopStub", "slopComments", "slopDead", "slopHedging", "patterns", "reasons", "path", "model", "ms", "flags", "time", "guard"]; readonly prose: readonly ["wordy", "cliches", "jargon", "status", "reasons", "model", "ms", "flags", "time", "guard"]; readonly stuck: readonly ["failures", "sameStrategy", "approachChange", "progress", "status", "source", "reasons", "model", "ms", "flags", "time", "guard"]; readonly done: readonly ["changes", "checks", "checksPassed", "claimsDone", "claimsVerified", "checksApply", "outcome", "status", "reasons", "model", "ms", "flags", "time", "guard"]; readonly subagent: readonly ["agent", "kind", "wake", "status", "time", "guard"]; };