import type { AcquiredRunResources, ConsumedRunResources, PreTurnFailedCause, ResourceDisposition, ResourceId, StartupReady, StartupResult, TurnCompletion } from "./run-contracts.js"; /** One resource's final disposition, as the coordinator or settlement records it. */ export interface ResourceDispositionRecord { readonly id: ResourceId; readonly disposition: ResourceDisposition; } /** The per-resource disposition report the coordinator records at each end. */ export interface SettlementDispositionReport { readonly records: readonly ResourceDispositionRecord[]; } /** The cause the coordinator hands to settlement. A clean turn carries no cause. */ export type SettlementReason = { readonly kind: "pre_turn"; readonly cause: PreTurnFailedCause; } | { readonly kind: "turn"; readonly completion: TurnCompletion; }; /** The outcome the coordinator hands to result reproduction. */ export type ReproducibleOutcome = SettlementReason; /** * The four steps the coordinator sequences, plus the run ledger. The engine * supplies each step; the coordinator owns only the order and the startup * rollback. This keeps the coordinator free of the engine's private run state. */ export interface RunPlan { /** The one run ledger for the attempt. The coordinator creates it (see `runAttempt`). */ readonly ledger: AcquiredRunResources; /** * Run the startup sequence. It returns a `ready` or a `settle` result, or it * throws on a build failure or a partial-bridge failure. */ startup(): Promise; /** * Replay the `startup_rollback` entries the partial ledger carries. The * coordinator calls it only on a startup throw, with the claimed entries. */ rollbackStartup(consumed: ConsumedRunResources): Promise | void; /** Record the per-resource disposition report at the end of the run. */ recordDisposition(report: SettlementDispositionReport): void; /** Run the turn against the ready resources. It never rejects. */ runTurn(ready: StartupReady): Promise; /** * Settle the run's resources for the given reason. The one cleanup owner. A * synchronous return adds no awaited boundary, so a step that already settled * inline keeps the caller's timing unchanged. */ settle(reason: SettlementReason): void | Promise; /** Reproduce the external result after settlement. */ reproduceResult(outcome: ReproducibleOutcome): TResult | Promise; } /** * Run the attempt through the routing table. The coordinator is the one owner of * the startup-to-settlement order. */ export declare function runAttempt(plan: RunPlan): Promise; //# sourceMappingURL=run-coordinator.d.ts.map