/** * Shared launch orchestration for the compiler tools, spawn the engine * detached, persist the job record, and then EITHER wait inline up to a budget * for completion (bounded-synchronous) OR hand back a pollable job id. * * This is the anti-drop shape: the common case (a small compile, and a re-run * over unchanged local sources, whose files the engine skips by checksum) * finishes inside `maxWaitMs`, so the tool returns the finished library + * diagnostics in a single call and there is no second phase for an agent to * forget. A genuinely long first compile overruns the budget and returns a * running handle, but the run finishes on its own (it is detached) and writes * to a PINNED output folder, so the work is never lost: polling * log10x_compile_status collects it. A second call for the same output folder * while that run is still going joins it (same job_id) instead of spawning a * second engine into the folder. * * Both log10x_compile and log10x_compile_link funnel through here so they share * the same precondition handling, record shape, and wait behaviour. */ import { type StructuredOutput } from '../lib/output-types.js'; import { type CompileConfig, type CompilerIdentity } from '../lib/compile-runner.js'; import { type CompileJobKind } from '../lib/compile-jobs.js'; export interface LaunchParams { cfg: CompileConfig; kind: CompileJobKind; /** Human description of the sources, for headlines. */ sources: string; runtimeName: string; mode: 'auto' | 'docker' | 'local'; /** Compiler already resolved by the caller (log10x_compile); the spawn reuses it. */ identity?: CompilerIdentity; /** Inline wait budget in ms; 0 = return the handle immediately. */ maxWaitMs: number; /** Tool name for envelope attribution. */ tool: string; scopeWindow: string; candidatesCount: number; /** Tool-specific fields merged into the handle payload (e.g. output_folder). */ startedPayloadExtra: Record; } /** * Map the precondition failures a spawn (or an identity resolution) throws * before anything runs (docker missing / non-compiler flavor / helm repo add) * to branchable envelopes. Returns null for anything else. */ export declare function preconditionEnvelope(e: unknown, tool: string): StructuredOutput | null; export declare function launchCompileJob(p: LaunchParams): Promise;