import type { EnvPolicy, PipelineConfig, PromptContextBlock, SecretResolver, TaskContinuationSeed, TaskState, RunEventPayload } from './types'; import type { PluginRegistry } from './registry'; import { type ApprovalGateway } from './approval'; import type { TagmaRuntime } from './types'; export { TriggerBlockedError, TriggerTimeoutError } from './types'; export interface EngineResult { readonly success: boolean; readonly runId: string; readonly logPath: string; readonly summary: { total: number; success: number; failed: number; skipped: number; timeout: number; blocked: number; }; readonly states: ReadonlyMap; } /** * Recommended per-task timeout (2 hours) applied when neither the task nor * the pipeline declares an explicit timeout. Long enough for heavy AI tasks; * short enough to prevent truly hung processes from blocking the pipeline * indefinitely. The editor passes this value; SDK callers may opt in or * supply their own via RunPipelineOptions.defaultTaskTimeoutMs. */ export declare const DEFAULT_TASK_TIMEOUT_MS: number; export type { RunEventPayload } from './types'; export interface RunPipelineOptions { readonly approvalGateway?: ApprovalGateway; /** * Maximum number of per-run log directories to retain under `/.tagma/logs/`. * Oldest directories are deleted after each run. Defaults to 20. Set to 0 to disable cleanup. */ readonly maxLogRuns?: number; /** * Caller-supplied run ID. When provided the engine uses this instead of * generating its own via `generateRunId()`, keeping the editor and SDK * log directories aligned on the same ID. */ readonly runId?: string; readonly envPolicy?: EnvPolicy; readonly secretResolver?: SecretResolver; readonly logPrompt?: boolean; readonly maxConcurrency?: number; /** * Host-supplied prompt context keyed by fully-qualified task id. These * blocks are appended after middleware enrichment, immediately before the * task instruction in the default prompt serialization. */ readonly taskPromptContexts?: Readonly>; /** * Prior attempt state keyed by fully-qualified task id. Prompt drivers * receive each seed through their existing continue_from maps, allowing * native session resume when possible and normalized-text fallback * otherwise. */ readonly taskContinuations?: Readonly>; /** * Fully-qualified task ids to run. The engine executes these targets plus * all upstream prerequisites; tasks outside that closure are marked skipped. */ readonly targetTaskIds?: readonly string[]; /** * External AbortSignal — aborting it cancels the pipeline immediately. * Equivalent to the pipeline timeout firing, but caller-controlled. */ readonly signal?: AbortSignal; /** * Called on every pipeline/task status transition. * Use for real-time UI updates (e.g. updating a visual workflow graph). */ readonly onEvent?: (event: RunEventPayload) => void; /** * Import and register packages named in `config.plugins` before preflight. * * Loading plugin packages executes their top-level module code. Leave this * false unless the host has made an explicit trust decision for the pipeline * YAML and its declared plugins. */ readonly loadDeclaredPlugins?: boolean; /** * Legacy opt-out for the old implicit plugin-loading path. The safe default * is now to skip YAML-declared plugin imports unless `loadDeclaredPlugins` * is true. Passing `skipPluginLoading: false` is still treated as an * explicit opt-in for compatibility with existing hosts that deliberately * enabled this behavior. */ readonly skipPluginLoading?: boolean; /** * Plugin registry to resolve drivers/triggers/completions/middlewares from. * Callers pass a per-instance or per-workspace registry so concurrent runs * do not share handler state. */ readonly registry: PluginRegistry; /** * Runtime implementation for command and driver process execution. */ readonly runtime: TagmaRuntime; /** * Fallback per-task timeout (ms) applied when a task has no explicit * `timeout` and the pipeline has no pipeline-level `timeout`. Guards * against indefinitely-hung AI API calls or shell commands. When unset, * tasks without their own timeout run until completion or external abort. * * Editor hosts set this from workspace Settings (recommended default 2h) so * an otherwise unbounded task still has a safety net. SDK callers can pass their own * value or omit it for the legacy "no default" behavior. */ readonly defaultTaskTimeoutMs?: number; /** * Fallback total pipeline timeout (ms) when the pipeline YAML has no * explicit top-level `timeout`. An authored pipeline timeout always wins. * Undefined preserves the low-level API's legacy unbounded lifecycle. */ readonly defaultPipelineTimeoutMs?: number; } export declare function resolvePipelineTimeoutMs(config: Pick, defaultPipelineTimeoutMs?: number): number; export declare function runPipeline(config: PipelineConfig, workDir: string, options: RunPipelineOptions): Promise; //# sourceMappingURL=engine.d.ts.map