import { type UltragoalGoal, type UltragoalLedgerEvent, type UltragoalNudgeSurface, type UltragoalPlan, type UltragoalReceiptKind } from "./ultragoal-runtime"; export type UltragoalGuardState = "inactive" | "unrelated_goal" | "active_verified_complete" | "active_missing_receipt" | "active_stale_receipt" | "active_missing_final_receipt" | "active_dirty_quality_gate" | "active_review_blocked_unrecorded" | "active_review_blocked_recorded" | "active_missing_critic_verdict" | "unreadable_fail_closed"; export interface UltragoalGuardDiagnostic { state: UltragoalGuardState; message: string; goalId?: string; } export interface UltragoalAskBlockDiagnostic { active: boolean; reason: string; source: "absent" | "durable_state" | "durable_state_unreadable" | "ledger" | "goals_json"; goalsPath?: string; ledgerPath?: string; goalIds?: string[]; message: string; } export interface CurrentGoalLike { objective: string; status?: string; provenance?: { source: "ultragoal"; runId: string; goalId: string; } | { source: "user"; }; } export declare function isKnownUltragoalObjective(currentObjective: string): boolean; export declare function validateCompletionReceipt(input: { plan: UltragoalPlan; ledger: readonly UltragoalLedgerEvent[]; goal: UltragoalGoal; receiptKind: UltragoalReceiptKind; }): UltragoalGuardDiagnostic; export declare function readUltragoalVerificationState(input: { cwd: string; currentGoal?: CurrentGoalLike | null; sessionId?: string | null; }): Promise; export declare function verifyUltragoalDurableCompletionState(input: { cwd: string; sessionId?: string | null; }): Promise; export declare function isUltragoalAskBlocked(cwd: string, options?: { sessionId?: string | null; }): Promise; /** * Escalating per-attempt refusal text. Deliberately avoids every * `isUltragoalBypassPrompt` trigger: no `update_goal(`, no "skip/weaken verification", * no "mark ... complete", no "--status complete", and the word "complete" never * appears (so the `goal` ... `complete` proximity rule cannot match). */ export declare function formatUltragoalNudgeMessage(input: { surface: UltragoalNudgeSurface; attempt: number; budget: number; goalId: string; }): string; /** * Assert-path entry for the `ask` surface (the ask guard lives in another module). * Resolves the active (leader) Ultragoal session so subagent/headless asks consume * the leader run's budget rather than a fresh child ledger. */ export declare function consumeUltragoalAskNudge(cwd: string, sessionId?: string | null, agentDir?: string): Promise<{ nudged: true; message: string; } | { nudged: false; }>; export declare function assertCanCompleteCurrentGoal(input: { cwd: string; currentGoal?: CurrentGoalLike | null; sessionId?: string | null; agentDir?: string; }): Promise; export declare function isUltragoalBypassPrompt(prompt: string): boolean; export interface UltragoalPauseBlockDiagnostic { blocked: boolean; reason: string; } /** * While an Ultragoal run is active, `goal({"op":"pause"})` is only allowed when the * current durable Ultragoal state is readable, the latest `blocker_classified` * event is `human_blocked`, and a later fresh clean pause terminal critic verdict is bound to * that exact classification. Reads fail closed so unreadable durable state or * ledger data blocks pause rather than silently allowing a give-up. */ export declare function isUltragoalPauseBlocked(cwd: string): Promise; export declare function assertUltragoalPauseAllowed(cwd: string, agentDir?: string): Promise; /** * Guard `goal({"op":"drop"})` during an active Ultragoal run. A *real give-up* (an * aggregate run still mid-flight with incomplete required stories) is nudged while * budget remains; once exhausted it falls through to today's drop behavior. Legitimate * aggregate-reset drops — no durable run, unrelated goal, an already dropped/stale * aggregate, or an all-stories-complete run — are never nudged. If durable state * exists but cannot be read to classify the drop, fail closed. */ export declare function assertUltragoalDropAllowed(input: { cwd: string; currentGoal?: CurrentGoalLike | null; sessionId?: string | null; agentDir?: string; }): Promise;