/** * What a harness hook needs to know about the lifecycle: which instance is * claimed in this checkout, what phase it is in, and what comes next. * * Read-only by contract (hooks-carry-lifecycle-state/AC-8). Everything here runs * inside a `SessionStart` or `PreToolUse` hook, on every session start or every * edit, so it reads only the claims and the claimed instances' own files — never * every instance, ledger or cache. `aidlc status --json` reads all of those and * took 3.5 s on this repository; the CLI itself starts in 0.16 s (AC-10). * * Requirements: hooks-carry-lifecycle-state/AC-1..AC-9 * Design: design.md C2 * * @module */ import type { NextStep } from '../core/types.js'; /** Phases in which code is not yet written — what the phase guard asks about. */ export declare const PLANNING_PHASES: readonly string[]; /** Longest line either hook prints (AC-9). */ export declare const MAX_LINE = 200; export interface InstanceContext { name: string; template: string; scope: string; /** `current_phase` from instance.yaml — what `aidlc status --json` reports (AC-2). */ phase: string; /** What `aidlc continue --json` reports as `nextStep` (AC-2). */ step: NextStep; /** The lowest-numbered open task, in implementation only (AC-3). */ openTask: { id: number; title: string; } | null; } /** * Instances claimed in this checkout, sorted by name (AC-6). * * Held here means recorded from this working directory: the claim's * `worktree_path` is this checkout, or it has none and this is the primary * checkout. A claim on an instance this checkout records as complete is not held. Staleness is deliberately not consulted — claims renew only at phase * transitions, and one phase routinely outlasts the 60-minute window, so a * live-only rule would go quiet on a compaction deep into implementation, the * case this hook exists for (design D3). Session ids are not compared either: * they change across `startup`. */ export declare function claimsHere(projectRoot: string): string[]; /** `current_phase` of one instance, or null when its state cannot be read. */ export declare function currentPhase(projectRoot: string, name: string): string | null; /** * One instance's phase and next step, or null when any of its state cannot be * read (AC-7) — a hook must never stop a session starting. */ export declare function instanceContext(projectRoot: string, name: string): InstanceContext | null; /** * One printable line: control characters (escape codes included) become spaces, * and anything past `max` is cut with an ellipsis (AC-9). */ export declare function plainLine(text: string, max?: number): string; /** * What `aidlc hook session-start` prints: three lines for one claim, one line * for several, nothing for none (AC-1, AC-4, AC-5). An instance whose state * cannot be read is left out (AC-7). */ export declare function sessionStartLines(projectRoot: string): string[]; //# sourceMappingURL=lifecycle-context.d.ts.map