/** Skills whose durable state can produce a structured recovery projection. */ export type WorkflowRecoverySkill = "ralplan" | "ultragoal"; export interface WorkflowRecoveryScopeItem { kind: "accepted" | "non_goal"; text: string; } export interface WorkflowRecoveryProjection { skill: WorkflowRecoverySkill; /** Canonical durable state that produced this projection. */ source: "ralplan-final" | "ralplan-run" | "ultragoal-plan"; /** Bounded accepted objective for the current work contract. */ objective: string; /** Bounded accepted scope + explicit non-goals (scope reload, not expansion). */ scope: WorkflowRecoveryScopeItem[]; /** Bounded acceptance criteria / verification obligations. */ acceptanceCriteria: string[]; /** Unresolved decisions carried from the durable contract, bounded. */ unresolved: string[]; /** Durable identity + integrity digest of the source state. */ provenance: { planPath?: string; runId?: string; stage?: string; sha256?: string; }; /** Current goal + measurable progress counters from canonical state. */ currentGoal?: { goalId: string; status: string; objective: string; }; progress: { totalGoals?: number; completedGoals?: number; outstandingGoals?: number; /** Latest boundary review generation recorded in the ledger. */ latestReviewGeneration?: number; /** Frozen source hash of the latest joined review cohort, if any. */ latestCohortSourceHash?: string; /** Ledger event id of the newest event backing this projection. */ latestLedgerEventId?: string; }; /** Exact next bounded action class for resumption. */ nextAction: { actionClass: "continue-current-goal" | "start-next-goal" | "resolve-review-blockers" | "run-boundary-cohort" | "run-plan-review" | "revise-plan" | "reconcile-intent" | "final-aggregate-checkpoint" | "awaiting-approval" | "unknown"; goalId?: string; detail?: string; }; /** #4560: measurable-progress basis for bounding zero-progress cycles. */ zeroProgress: { fingerprint: string; unchangedObservations: number; stalled: boolean; }; } /** #4560: compaction-observation memory for zero-progress bounding. */ export interface WorkflowRecoveryZeroProgressMemory { /** Last observed progress fingerprint per skill. */ lastFingerprint?: string; /** Consecutive compaction observations with an unchanged fingerprint. */ unchangedObservations: number; } /** #4560: bound repeated zero-progress continuation cycles (#4560). */ export declare const ZERO_PROGRESS_STALL_THRESHOLD = 2; export declare function trackWorkflowRecoveryZeroProgress(memory: WorkflowRecoveryZeroProgressMemory | undefined, projection: WorkflowRecoveryProjection): WorkflowRecoveryZeroProgressMemory; export declare function isWorkflowRecoveryStalled(memory: WorkflowRecoveryZeroProgressMemory | undefined): boolean; export interface RalplanFinalProjectionInput { cwd: string; sessionId: string; runId: string; } interface RalplanProjectionInput extends RalplanFinalProjectionInput { lastReviewVerdict?: string; lastReviewVerdictLane?: string; } export declare function projectRalplanFinalRun(input: RalplanFinalProjectionInput): Promise; export declare function projectRalplanRun(input: RalplanProjectionInput): Promise; /** * Project the active Ralplan run recorded in durable mode state. When legacy * state has no run id, fall back to complete runs ordered by index freshness, * skipping unfinished or malformed candidates instead of letting them shadow * the newest usable final contract. */ export declare function projectLatestRalplanRun(input: { cwd: string; sessionId: string; }): Promise; /** * Build a recovery projection from Ultragoal canonical durable state. The * accepted contract is the aggregate objective plus the goal list; progress * and next action are derived from `goals.json` status plus the newest ledger * receipts, never from conversation memory. */ export declare function projectUltragoalRun(input: { cwd: string; sessionId: string; }): Promise; /** Stable digest over the projection's contract-relevant fields. */ export declare function hashWorkflowRecoveryProjection(projection: WorkflowRecoveryProjection): string; export {};