/** * First-Class Mission Executor contract (2.3.0). * * The executor seam decouples mission identity from any execution mechanism. * Executors accept a canonical MissionRequest, produce a canonical * MissionHandle, and resolve a canonical MissionResult. Nothing in this file * references Node ChildProcess, a provider client, a CLI parser, or UI. */ import type { MissionHandle } from "./mission-handle.js"; import type { MissionRequest } from "./mission-request.js"; import { type MissionResult } from "./mission-result.js"; /** Stable correlation carried by execution observers and remote transports. */ export interface MissionExecutionCorrelation { missionId: string; assignmentId?: string; attemptId?: string; executionId?: string; sessionId?: string; } export type MissionExecutionEvent = { type: "attempt_started" | "execution_launch_started" | "execution_started"; eventId: string; atMs: number; correlation: MissionExecutionCorrelation; } | { type: "execution_retry"; eventId: string; atMs: number; retryClass: "execution" | "remote_execution"; retryIndex: number; reason: string; correlation: MissionExecutionCorrelation; } | { type: "execution_completed" | "execution_failed" | "execution_cancelled"; eventId: string; atMs: number; correlation: MissionExecutionCorrelation; state: MissionResult["state"]; executionOutcome: MissionResult["executionOutcome"]; }; export interface MissionExecutionObserver { onEvent: (event: MissionExecutionEvent) => void; } export interface MissionLaunchOptions { signal?: AbortSignal; /** * Execution fencing identity (leaseId + fencingToken) carried into the * executor launch so a remote substrate can correlate its result back to the * authoritative owner. The durable coordinator remains the only authority * that accepts/rejects the terminal commit; this field is correlation, not * authorization. */ fencing?: { leaseId: string; fencingToken: number; }; /** Authoritative attempt identity for runtime correlation. */ executionId?: string; attemptId?: string; /** One-based attempt number; >1 identifies an actual execution retry. */ attemptNumber?: number; assignmentId?: string; sessionId?: string; } export interface MissionExecutor { /** * Stable executor identity (e.g. "process", "in-process", "remote"). Used to * select an executor and to tag executor diagnostics. */ readonly executorId: string; /** Launch a mission and return a handle immediately (or after the child is started). */ launch(request: MissionRequest, options?: MissionLaunchOptions): Promise; /** Resolve a launched mission to its final MissionResult. */ awaitResult(handle: MissionHandle, options?: { signal?: AbortSignal; }): Promise; /** Request cancellation of a launched mission. Idempotent. */ cancel(handle: MissionHandle, reason?: string): Promise; } export declare class MissionExecutionService { private readonly _executors; private _defaultExecutorId; register(executor: MissionExecutor): void; /** Set the executor used when no explicit executorId is supplied. */ setDefaultExecutorId(executorId: string): void; executor(executorId: string): MissionExecutor; /** * Launch + await a single mission, producing a MissionResult. The caller * reasons in domain terms; executor-specific machinery stays behind the seam. */ execute(request: MissionRequest, options?: { executorId?: string; signal?: AbortSignal; }): Promise; /** * Execute several missions concurrently and return their individual * MissionResults in request order. Aggregation is the caller's concern * (see `aggregateMissionResults`); this method never collapses failures into * a scalar success boolean. */ executeMany(requests: readonly MissionRequest[], options?: { executorId?: string; signal?: AbortSignal; }): Promise; /** * Execute missions sequentially. The transitional runtime uses an * execution-compatible chain policy: a child that SUCCEEDED (verified) or * PARTIAL (execution completed normally but unverified) allows the next * dependent child to run; a hard failure (FAILED / CANCELLED / TIMED_OUT / * CRASHED) stops the chain. Returns the results produced up to and * including the stopping child. Callers aggregate with * `aggregateMissionResults` for a structured final verdict. */ executeChain(requests: readonly MissionRequest[], options?: { executorId?: string; signal?: AbortSignal; }): Promise; } //# sourceMappingURL=mission-executor.d.ts.map