/** * Pure parse + summarize for ledger-backed skill observability. * * Workflow progress for ultragoal/ralplan cannot be observed via subagent tool * events (those skills persist through `bash`-backed `gjc` CLI calls whose tool * `details` carry no structured payload). The durable source of truth is the * append-only ledgers: * - ultragoal: `.gjc/ultragoal/ledger.jsonl` * - ralplan: `.gjc/plans/ralplan//index.jsonl` * * This module is I/O-free: callers read the files and pass lines or already-parsed * rows. It feeds the compact HUD chip builders in `skill-state/workflow-hud.ts` * via the runtime sync paths. Display-string helpers stay theme-free. */ /** Minimal projection of an ultragoal ledger row used for the HUD chip. */ export interface UltragoalLedgerEventLite { /** Normalized from the row's `event` field, or `type` for reconcile rows. */ event: string; goalId?: string; status?: string; timestamp?: string; } /** * Coerce an already-parsed ledger row into the lite shape. Accepts both the * `event`-keyed vocabulary (plan_created, goal_started, goal_checkpointed, * steering_accepted/rejected, review_blockers_recorded) and the `type`-keyed * reconcile-failure row (`type: "reconcile_failed"`). Returns undefined when no * event/type discriminator is present. */ export declare function coerceUltragoalLedgerEvent(row: Record): UltragoalLedgerEventLite | undefined; /** Parse a single ultragoal ledger JSONL line; undefined for blank/malformed lines. */ export declare function parseUltragoalLedgerLine(line: string): UltragoalLedgerEventLite | undefined; /** The most recent event, or undefined when the ledger is empty. */ export declare function latestUltragoalLedgerEvent(events: readonly UltragoalLedgerEventLite[]): UltragoalLedgerEventLite | undefined; /** * Best-effort latest event from raw ledger text: parses line-by-line and skips * blank/malformed rows so a torn or hand-edited ledger never throws on the HUD * path. Strict receipt consumers should keep using the validating reader. */ export declare function latestUltragoalLedgerEventFromText(text: string): UltragoalLedgerEventLite | undefined; /** Minimal projection of a ralplan `index.jsonl` row. */ export interface RalplanIndexRow { stage: string; stageN?: number; } /** Parse a single ralplan index JSONL line; undefined for blank/malformed lines. */ export declare function parseRalplanIndexLine(line: string): RalplanIndexRow | undefined; export interface RalplanIndexSummary { /** Number of consensus iterations (planner/revision boundaries), >= 0. */ iteration: number; /** Stage names present in the current (latest) iteration, in append order. */ currentStages: string[]; } /** * Derive iteration count and current-iteration stage presence from index rows. * * `stage_n` is NOT used as the iteration key: it is stored verbatim per row and a * single planner/architect/critic pass can span multiple stage_n values. Instead, * a `planner` or `revision` row opens a new iteration and subsequent rows attach * to it. No verdict is derived here (index rows carry none). */ export declare function summarizeRalplanIndex(rows: readonly RalplanIndexRow[]): RalplanIndexSummary; /** * Compact, theme-free presence string for the ralplan `stages` chip, e.g. * `P·A·C`. Collapses past `cap` with a "… N more" suffix. Returns undefined when * there are no stages. */ export declare function formatRalplanStagePresence(stages: readonly string[], cap?: number): string | undefined;