/** * Goal advance-with-persist — load → advance → persist → continuation. * * This is the ORCHESTRATED entry point called by `cleo goal advance ` * (CLI) and by the Claude Code Stop-hook. It wraps the PURE * {@link advanceGoal} (no I/O) with the persistence and continuation steps * that complete the AC loop: * * ``` * getGoalById(id) * → advanceGoal(goal, judgeGoal-closure) [pure, no I/O] * → updateGoal(id, { status, turnsUsed, lastVerdict }) * → buildContinuation(updatedGoal, verdict) [null when terminal] * ``` * * The injected `llmJudge` is only called for `fuzzy` goals — task-completion * goals use the ADR-051 evidence path (pure, offline). Tests pass * {@link StaticGoalJudge} to stay fully hermetic. * * ## Return shape * * The returned {@link AdvanceWithPersistResult} always carries the * `advanceResult` (verdict, nextStatus, turnsRemaining), the fully-updated * `goal` record (after the persistence write), and — critically — the * `continuation` nudge ({@link GoalContinuation}) or `null` when the goal * has reached a terminal state. The CLI formats this as a LAFS envelope; the * Stop-hook uses `continuation` to decide whether to emit a block decision. * * @module @cleocode/core/goal/advance-with-persist * * @epic T11290 EP-CLEO-GOAL-SYSTEM * @task T11496 E4-GOAL-LOOP * @saga T11283 SG-COGNITIVE-SUBSTRATE */ import type { GoalAdvanceResult, GoalContinuation, GoalJudge, GoalRecord } from '@cleocode/contracts'; /** * The combined result of one orchestrated advance turn. * * @task T11496 */ export interface AdvanceWithPersistResult { /** * The raw advance result from the pure `advanceGoal` engine (verdict, * nextStatus, turnsRemaining). This is what is persisted. */ readonly advanceResult: GoalAdvanceResult; /** * The goal record AFTER the persistence write. Status and verdict are * already updated — callers render this, not the pre-advance snapshot. */ readonly goal: GoalRecord; /** * The continuation nudge, or `null` when the goal is terminal. * * Non-null for `active` and `paused` goals — the Stop-hook emits this as a * `{ decision: 'block', reason: continuation.content }` response to keep * Claude working. Null for `satisfied`, `abandoned`, `impossible`. */ readonly continuation: GoalContinuation | null; } /** * Advance a goal one turn and persist the result. * * Orchestrates the full load → advance (pure) → persist → continuation * pipeline in one call. Returns `null` when the goal id is not found. * * @param goalId - The goal to advance (idempotency key / primary key). * @param options - Optional overrides. * @param options.llmJudge - LLM judge for fuzzy goals (default: offline stub). * @param options.cwd - Project root override. * @returns The combined result, or `null` when the goal is absent. * * @task T11496 * @adr ADR-051 */ export declare function advanceGoalWithPersist(goalId: string, options?: { readonly llmJudge?: GoalJudge; readonly cwd?: string; }): Promise; //# sourceMappingURL=advance-with-persist.d.ts.map