/** * Parent orchestration lifecycle executor (2.15.0). * * The parent side of the child execution boundary. It owns the parent's * lifecycle step of driving a materialized orchestration toward execution * without ever launching anything itself and without re-implementing the * port's verification: * * 1. Load the parent mission from the durable mission store. * 2. Read the parent's durable execution contract * (`MissionRequest.orchestrationExecution`) — the plan identity and the * named child execution authority. * 3. Resolve the named authority against the registered ports' * `authority` identities. Verified, never defaulted: an unknown * authority is a hard error, and duplicate authority identities fail * construction. * 4. Load the named plan and verify it belongs to this parent. * 5. Request execution of every materialized node through * `port.executeChild` using the node's durable structured identity. * 6. Poll status/terminal outcome for a materialized node through the * port's optional `childStatus` when the named authority provides it. * * The port remains the single verification and launch authority (it * re-verifies plan/node identity, child metadata, the parent's contract, and * terminal state, and owns the launch — Scheduler/Worker, local runtime, or * remote executor). This executor is read-only against both stores: it * never enqueues, assigns, starts, or launches, and it writes no plan or * mission state. */ import type { DurableMissionStore } from "../mission-domain/durable-store.js"; import type { OrchestrationChildExecutionPort, OrchestrationChildExecutionReceipt, OrchestrationChildExecutionStatus, OrchestrationStore } from "./types.js"; export interface OrchestrationLifecycleExecutorOptions { /** Durable mission store for parent contract resolution. */ missions: DurableMissionStore; /** Orchestration plan store for materialized node identity. */ store: OrchestrationStore; /** * Registered child execution authorities. The parent's durable contract * names exactly one by `childExecutionAuthority`; a duplicate authority * identity is a construction error (verified, never defaulted). */ ports: readonly OrchestrationChildExecutionPort[]; } /** Structured outcome for one plan node in a lifecycle launch pass. */ export interface OrchestrationLifecycleNodeOutcome { nodeId: string; /** True when the node carries a durable child identity (mission + session). */ materialized: boolean; /** True when the port accepted the execution request. */ launched: boolean; /** Authoritative port receipt for materialized nodes. */ receipt?: OrchestrationChildExecutionReceipt; } /** Structured outcome of one lifecycle launch pass for a parent mission. */ export interface OrchestrationLifecycleLaunchOutcome { parentMissionId: string; orchestrationId: string; /** Authority identity that handled the pass. */ authority: string; nodes: OrchestrationLifecycleNodeOutcome[]; materializedCount: number; launchedCount: number; declinedCount: number; } /** * Resolve the child execution authority named by a parent mission's durable * contract against the registered ports. * * Throws (never defaults): * - `PARENT_MISSION_NOT_FOUND` / `PARENT_MISSION_CORRUPT` — parent missing * - `NO_ORCHESTRATION_EXECUTION_CONTRACT` — parent does not own an * orchestration * - `AUTHORITY_NOT_REGISTERED` — the named authority is not registered */ export declare function resolveChildExecutionAuthority(missions: DurableMissionStore, parentMissionId: string, ports: readonly OrchestrationChildExecutionPort[]): Promise; export declare class OrchestrationLifecycleExecutor { private readonly _missions; private readonly _store; private readonly _portsByAuthority; constructor(options: OrchestrationLifecycleExecutorOptions); /** Registered authorities, in registration order. */ get authorities(): readonly string[]; /** * Resolve the child execution authority named by the parent's durable * contract. See `resolveChildExecutionAuthority` for the error contract. */ resolvePort(parentMissionId: string): Promise; /** * Drive one lifecycle launch pass for the parent mission's orchestration. * * Loads the parent's durable contract, resolves the named authority, * verifies the named plan belongs to this parent, and requests execution * of every materialized node through the port. Non-materialized nodes are * reported as such and never presented to the port. The port's receipt is * authoritative; the executor never launches and never writes state. * * Throws (never defaults): `PARENT_MISSION_NOT_FOUND`, * `PARENT_MISSION_CORRUPT`, `NO_ORCHESTRATION_EXECUTION_CONTRACT`, * `AUTHORITY_NOT_REGISTERED`, `ORCHESTRATION_NOT_FOUND`, * `ORCHESTRATION_PLAN_CORRUPT`, `ORCHESTRATION_PARENT_MISMATCH`. */ launchChildren(parentMissionId: string): Promise; /** * Poll the status/terminal outcome of one materialized node through the * child execution authority named by the parent's durable contract. * * The request is built from the node's durable structured identity in the * plan — the caller never supplies child mission or session identity. The * port's polling is authoritative (it owns the read model); the executor * performs no launches and writes no state. * * Throws (never defaults): `PARENT_MISSION_NOT_FOUND`, * `PARENT_MISSION_CORRUPT`, `NO_ORCHESTRATION_EXECUTION_CONTRACT`, * `AUTHORITY_NOT_REGISTERED`, `ORCHESTRATION_NOT_FOUND`, * `ORCHESTRATION_PLAN_CORRUPT`, `ORCHESTRATION_PARENT_MISMATCH`, * `NODE_NOT_FOUND`, `CHILD_NOT_MATERIALIZED`, `PORT_LACKS_CHILD_STATUS`. */ childStatus(parentMissionId: string, nodeId: string): Promise; private _resolveExecutionContext; private _loadPlan; } /** Build an `OrchestrationLifecycleExecutor` over the given stores and ports. */ export declare function createOrchestrationLifecycleExecutor(options: OrchestrationLifecycleExecutorOptions): OrchestrationLifecycleExecutor; //# sourceMappingURL=lifecycle-executor.d.ts.map