/** * Operation journal — the invocation-scoped record of a plan-family * operation's progress. * * The resolution boundary writes the frozen candidate's facts at planning, * records each phase transition, and records per-unit started and resolved * facts as execution reaches them — settlement is recorded before the next * interruptible boundary. When an external termination request interrupts the * invocation, the lifecycle wrapper reads this journal to resolve the * interruption truthfully: which units settled, which were in flight, which * were never attempted, and what the durable-state disposition of each is. * The journal is invocation-local; nothing here persists past the process. * * @experimental This API is unstable and may change without notice. */ import * as Effect from "effect/Effect"; import * as Option from "effect/Option"; import * as Ref from "effect/Ref"; import * as ServiceMap from "effect/Context"; import type { CompletedJobStep, OperationPresentation, PlanRiskCondition } from "./plan.js"; import type { ReleaseAgeOperationEvidence } from "../registry/index.js"; import type { OperationPrecondition } from "./plan.js"; import type { OperationAtomicity, OperationPhase, ResolvedUnit } from "./operation-resolution.js"; export interface OperationJournalState { readonly name: string; readonly description: Option.Option; readonly mode: "preview" | "apply"; readonly candidateId?: string; readonly atomicity: OperationAtomicity; readonly presentation?: OperationPresentation; readonly releaseAge?: ReleaseAgeOperationEvidence; readonly preconditions?: ReadonlyArray; readonly riskConditions?: ReadonlyArray; /** Units of the frozen candidate, in planned states. */ readonly plannedUnits: ReadonlyArray>; /** The lifecycle phase the invocation had reached when last recorded. */ readonly phase: OperationPhase; /** Ids of units whose run began, in start order. */ readonly startedUnitIds: ReadonlyArray; /** * Settlement facts, recorded the moment each unit resolved — before any * interruptible boundary — in execution order. A started unit missing here * is in flight: its durable effects are restored by the closure's rollback * or unknown, never "not attempted". */ readonly resolved: ReadonlyArray>; /** True while the apply runs inside a restoring (closure-atomic) guard. */ readonly restoresOnFailure: boolean; } export interface OperationJournalService { readonly ref: Ref.Ref>; } declare const OperationJournal_base: ServiceMap.ServiceClass; export declare class OperationJournal extends OperationJournal_base { } /** Record the operation's frozen facts. No-op when no journal is provided. */ export declare const recordOperationJournal: (state: OperationJournalState) => Effect.Effect; /** Merge updates onto the recorded state. No-op when nothing was recorded. */ export declare const updateOperationJournal: (update: (state: OperationJournalState) => OperationJournalState) => Effect.Effect; /** Record the lifecycle phase the invocation has entered. */ export declare const recordJournalPhase: (phase: OperationPhase) => Effect.Effect; /** Record that a unit's run began. */ export declare const appendStartedUnit: (unitId: string) => Effect.Effect; /** Record one unit's settlement fact. */ export declare const appendResolvedUnit: (step: CompletedJobStep) => Effect.Effect; export declare const getOperationJournal: Effect.Effect>; export declare const makeOperationJournal: Effect.Effect; export {}; //# sourceMappingURL=operation-journal.d.ts.map