/** * bridge.ts — Stable discovery pointer for host integration (the filesystem * artifact protocol). * * The single source of truth for host integration is the on-disk artifact * directory (/.pi/context-optimizer//). Hosts that want to * discover the ACTIVE session's directory without globbing watch one stable * file written here: /.pi/context-optimizer/active.json. * * active.json is ADDITIVE — it mirrors status.json plus the absolute * artifactDir. It is written on every phase transition (via index.ts * writeStatus) and on session resume. Hosts may also read per-session * status.json directly. See BRIDGE.md for the full contract. * * Everything here is pure + best-effort: a write/read failure degrades * gracefully (the workflow never blocks on this pointer). */ import { rm } from "node:fs/promises"; export declare const ACTIVE_FILE = "active.json"; /** The active.json shape — a stable, host-readable pointer to the live session. */ export interface ActivePointer { /** Absolute path to the active session's artifact directory. */ artifactDir: string; /** Current phase (mirrors status.json): INERT | RESEARCHING | PLAN_DRAFTING | REVIEW_PENDING | EXECUTING. */ phase: string; /** Approval state (mirrors status.json): none | pending | approved | rejected. */ approval: string; /** Completed step count. */ done: number; /** Total step count. */ total: number; /** ISO timestamp of the last update. */ updatedAt: string; } /** Input for writeActivePointer (updatedAt is stamped here). */ export interface ActivePointerInput { artifactDir: string; phase: string; approval: string; done: number; total: number; } /** Stable path to the active-session pointer: /.pi/context-optimizer/active.json */ export declare function activeFilePath(cwd: string): string; /** * Atomically write (overwrite) the active.json pointer. Writes are queued via * withFileMutationQueue to avoid torn writes; parent dirs are created. * Throws on filesystem errors so callers can decide to swallow — index.ts * wraps every call in try/catch so a failure never breaks the workflow. */ export declare function writeActivePointer(cwd: string, input: ActivePointerInput): Promise; /** * Read + validate active.json. Returns null when missing or malformed (never * throws) so callers can treat an absent pointer as "no active session yet". */ export declare function readActivePointer(path: string): Promise; export { rm }; //# sourceMappingURL=bridge.d.ts.map