/** * ADR-406 §19.4 — mission state transitions as a data table, and the reducer * that folds an event log into a `MissionView`. * * The table is the single authority: `checkTransition` (before an append) and * `applyEvent` (during replay) both consult it, so a log that replays is a log * whose every control event was a permitted transition. Observations never * change state or revision; a disconnected executor is an observation, not a * failure. */ import { type ControlEventType, type MissionRecord, type MissionState, type PlanBody } from './schemas.js'; export type TaskStatus = 'pending' | 'running' | 'recorded-done' | 'failed' | 'unknown'; export interface EvidenceEntry { readonly evidenceId: string; readonly criterionId: string; readonly taskId: string | null; readonly artifactDigest: string; readonly producer: string; /** True only when the service authenticated the producer; never caller-asserted. */ readonly verified: boolean; readonly planRevision: number; readonly criteriaDigest: string; readonly at: string; } export interface BudgetLedger { readonly currency: string; readonly ceilingMinor: number; readonly estimatedMinor: number; readonly reservedMinor: number; readonly settledMinor: number; readonly unresolvedMinor: number; } export interface MissionView { readonly record: MissionRecord; readonly planBody: PlanBody | null; readonly budget: BudgetLedger | null; readonly tasks: Readonly>; readonly evidence: readonly EvidenceEntry[]; readonly executor: { readonly executorId: string; readonly connection: string; readonly observedAt: string; readonly lastAckExecutionId: string | null; } | null; readonly lease: { readonly executorId: string | null; readonly epoch: number; }; readonly unresolvedOperations: readonly string[]; readonly blockedReason: string | null; readonly lastHash: string; } export declare class TransitionError extends Error { readonly code: string; constructor(code: string, message: string); } type Guard = (view: MissionView, payload: Record) => string | null; export interface TransitionRule { readonly event: ControlEventType; readonly from: readonly MissionState[]; readonly to: MissionState; readonly guard: Guard; } export declare function digestOf(value: unknown): string; /** Well-formedness for §19.4 row 1: graph acyclic, deps resolvable, budget fits. */ export declare function validatePlan(raw: unknown): { plan: PlanBody; error: null; } | { plan: null; error: string; }; export declare const TRANSITIONS: readonly TransitionRule[]; export declare function ruleFor(event: ControlEventType, from: MissionState): TransitionRule | undefined; /** Throws `TransitionError` unless `type` is permitted from the view's state. */ export declare function checkTransition(view: MissionView, type: ControlEventType, payload: Record): TransitionRule; export {}; //# sourceMappingURL=transitions.d.ts.map