/** * exec/driver — event-sourced schedule loop for all phase kinds (S2). * * **Default OFF.** Engaged when `deps.eventKernel === true` or * `PI_TASKFLOW_EVENT_KERNEL=1`, and only when {@link canUseEventKernel} admits * the def (no unsupported advanced features). */ import type { RunState } from "../store.ts"; import { type Budget, type Taskflow } from "../schema.ts"; import type { TraceSink } from "../trace.ts"; import { EVENT_KERNEL_PHASE_TYPES, type KernelApprovalDecision, type KernelApprovalRequest, type RunTaskFn } from "./step.ts"; import type { AgentConfig } from "../agents.ts"; import type { UsageStats } from "../usage.ts"; import type { TaskflowVerifier } from "../verify.ts"; import type { DirectoryIdentity } from "../cwd-bridge.ts"; import { kernelUnsupportedReason } from "./kernel-policy.ts"; export { EVENT_KERNEL_PHASE_TYPES, kernelUnsupportedReason }; export interface EventKernelDeps { cwd: string; agents: AgentConfig[]; runTask: RunTaskFn; signal?: AbortSignal; globalThinking?: string; usageAccounting?: "available" | "tokens-only" | "unavailable"; trace?: TraceSink; persist?: (state: RunState) => void; onProgress?: (state: RunState) => void; eventKernel?: boolean; requestApproval?: (req: KernelApprovalRequest) => Promise; loadFlow?: (name: string) => Taskflow | undefined; loadSavedFlow?: (name: string) => { def: Taskflow; filePath?: string; sourceDirIdentity?: DirectoryIdentity; } | undefined; /** Caller-supplied zero-token verifiers (see verify.ts). Run in runNested's * plugin-error preflight before every child-flow dispatch on this engine, and * recursed via the ...deps spread. */ verifiers?: TaskflowVerifier[]; _stack?: string[]; _dynamic?: boolean; } export interface EventKernelResult { state: RunState; finalOutput: string; ok: boolean; totalUsage: UsageStats; /** Id of the PhaseState whose output supplied finalOutput (0.2.0 dogfood * issue 6). Mirrors `RuntimeResult.outputSourcePhaseId`; the event kernel * delegates final-phase selection to the shared `resolveFinalOutput` * helper so attribution matches the imperative path exactly. */ outputSourcePhaseId?: string; } /** True when types are known AND no advanced features force imperative fall-back. */ export declare function canUseEventKernel(def: Taskflow, loadFlow?: (name: string) => Taskflow | undefined, seen?: Set, inheritedBudget?: Budget): boolean; export declare function eventKernelEnabled(deps: { eventKernel?: boolean; }): boolean; /** * Run a Taskflow on the event kernel. * Caller must have checked {@link canUseEventKernel}. */ export declare function runEventKernel(state: RunState, deps: EventKernelDeps): Promise; //# sourceMappingURL=driver.d.ts.map