import type { ExtensionAPI } from "./pi.js"; /** One item in the shared plan wire format. Rich fields (`kind`, `tainted`, `deps`) are * populated by cribsheet; a simpler source may omit them. */ export interface PlanItem { /** crib's namespaced id, `:` (already the wire id scheme). */ id: string; /** display text (the wire field is `title`). */ title: string; /** kind passed through verbatim from crib (plan|design|note). */ kind: string; status: string | null; /** must-precede refs (this item depends on these), by node id. */ deps: string[]; tainted?: boolean; ulid?: string; updated?: string; } /** A full-replace snapshot on the `plan:snapshot` channel. `ns` attributes the source; * `seq` lets a consumer drop out-of-order arrivals. */ export interface PlanSnapshot { ns: "cribsheet"; seq: number; project?: string; items: PlanItem[]; } interface CribNode { id: string; ulid?: string; name?: string; kind?: string; status?: string | null; updated?: string; tainted?: boolean; } interface CribEdge { from: string; to: string; kind: string; } interface CribGraph { project?: string; nodes?: CribNode[]; edges?: CribEdge[]; } /** Map a crib `plan graph` payload into a `source=plan` snapshot. Edge `from -> to` * (kind `dep`) means `from` depends on `to`, so `to` lands in `from`'s `deps`. */ export declare function graphToSnapshot(graph: CribGraph, seq: number): PlanSnapshot; /** A stable, volatile-field-free fingerprint of a snapshot's MEANINGFUL shape, so the * source emits only when the plan actually changed — not on every turn that merely * touches it (e.g. a re-status that bumps `updated`, or a no-op mutation). Excludes * `seq`, `updated`, and `ulid`; sorts items and deps so order churn isn't a change. */ export declare function planDigest(snapshot: PlanSnapshot): string; export declare function isCribPlanMutation(toolName: string): boolean; /** How to invoke crib — mirrors index.ts's resolveCrib() shape. */ export type CribCommand = { cmd: string; args: string[]; }; export interface PlanSourceOptions { /** Resolve the crib CLI (env command → `crib` on PATH → `uv run … crib`). */ resolveCrib: () => CribCommand | undefined; /** Pull timeout in ms (default 15000). */ timeoutMs?: number; } /** * Wire the crib plan source into the extension: prime on `session_start`, mark dirty when * a crib plan-mutation tool completes, and re-snapshot at `turn_end` if dirty. Emits via * `pi.events.emit("plan:snapshot", snapshot)` on the shared in-process bus (for pi-plan's TUI). */ export declare function installCribPlanSource(pi: ExtensionAPI, opts: PlanSourceOptions): void; export {}; //# sourceMappingURL=plan-source.d.ts.map