import { type RolePolicyConfig } from "../domain/role-policy.js"; import { type ClaudeInteractiveLaunchPlan, type CodexGoalLaunchPlan, type GoalCapabilityProbeAdapter } from "./providers.js"; import { launchCompleteOpId, launchActivationDoneOpId, launchActivationIntentOpId, launchEffectOpId, launchIntentOpId } from "./result-op-ids.js"; import { type Clock, type KernelPaths } from "./types.js"; import { type WorktreeAdapter, type WorktreeVerifyResult } from "./worktree.js"; export { launchIntentOpId, launchEffectOpId, launchCompleteOpId, launchActivationIntentOpId, launchActivationDoneOpId, }; export type LaunchLane = "short" | "long"; export interface WorkerLaunchBinding { readonly pane_id: string; readonly session_id: string; } export type WorkerLaunchEnsureResult = WorkerLaunchBinding | { readonly ok: false; readonly reason: string; readonly ambiguous?: boolean; readonly pending?: boolean; /** Exact deterministic window exists but still needs its durable binding/stamps. */ readonly recoverable?: boolean; readonly pane_id?: string; }; export interface WorkerLaunchAdapter { /** * Synchronous physical boundary: after this call returns, it must not create * another pane later. The kernel holds the per-attempt creation lock across * this call and the durable record_created receipt. */ readonly ensureExact: (input: { readonly operation_id: string; /** Stable launch completion identity used by the physical pane/window binding. */ readonly launch_operation_id: string; readonly identity_digest: string; readonly physical_nonce: string; readonly plan: ClaudeInteractiveLaunchPlan | CodexGoalLaunchPlan; readonly prebound_session_id: string; /** Task ownership for pane user-option stamping (Phase 5/6 stop contract). */ readonly task_id: string; /** * Must be called immediately after physical create/adopt and before provider * metadata stamping or activation. The kernel durably receipts the pane. */ readonly record_created: (binding: WorkerLaunchBinding) => void; }) => WorkerLaunchEnsureResult; readonly inspectExact: (input: { readonly operation_id: string; readonly launch_operation_id: string; readonly identity_digest: string; readonly physical_nonce: string; readonly prebound_session_id: string; readonly expected_pane_id?: string; readonly expected_session_id?: string; }) => WorkerLaunchEnsureResult; /** * Starts the provider only after the launch completion has durably bound the * task to the inert physical placeholder. Replays must be idempotent. */ readonly activateExact?: (input: { readonly operation_id: string; readonly launch_operation_id: string; readonly identity_digest: string; readonly physical_nonce: string; readonly plan: ClaudeInteractiveLaunchPlan | CodexGoalLaunchPlan; readonly prebound_session_id: string; readonly task_id: string; readonly expected_pane_id: string; readonly expected_session_id: string; }) => WorkerLaunchEnsureResult; } export interface LaunchWorkerInput { readonly paths: KernelPaths; readonly clock: Clock; readonly expectedRunId?: string; readonly expectedRunVersion?: number; readonly taskId: string; readonly expectedVersion: number; readonly expectedSourceDigest: string; readonly lane: LaunchLane; readonly worktreeAdapter: WorktreeAdapter; readonly launchAdapter: WorkerLaunchAdapter; readonly binary: string; readonly resolveMcpConfigPath: (worktree: WorktreeVerifyResult) => string; readonly resolveClaudeSettingsPath?: (worktree: WorktreeVerifyResult) => string; readonly resolveCodexHomePath?: (input: { readonly session_id: string; readonly worktree_path: string; readonly worktree_git_dir: string; }) => string; readonly goalCapabilityAdapter?: GoalCapabilityProbeAdapter; readonly env?: NodeJS.ProcessEnv; readonly rolePolicy: RolePolicyConfig; } export interface LaunchWorkerResult { readonly ok: boolean; readonly reused: boolean; readonly pane_id: string | null; readonly session_id: string | null; readonly operation_id: string; readonly attempt: number; readonly reason?: string; readonly needs_human?: boolean; readonly pending?: boolean; } /** * Journal-only activation evidence used by the pure campaign classifier. * The pane binding supplied here has already passed exact launch-completion * validation in loadJournalPaneBindings. */ export declare function hasValidLaunchActivation(input: { readonly paths: KernelPaths; readonly run_id: string; readonly task_id: string; readonly attempt: number; readonly pane_id: string; readonly session_id: string; readonly launch_operation_id: string; readonly launch_identity_digest: string; readonly physical_nonce: string; }): boolean; export declare function launchWorker(input: LaunchWorkerInput): LaunchWorkerResult; export type { WorktreeVerifyResult };