import { type CacheDirective, type CacheRef, type CacheRegistryDefinition } from "./cache.js"; export { defineCache, fileCache, memoryCache } from "./cache.js"; export declare const cache: CacheRegistryDefinition; export type RuntimeStatus = "idle" | "running" | "passed" | "failed" | "started" | "stopped"; export type RuntimeNext = () => Promise; export type RuntimeNodeKind = "task" | "middleware" | "series" | "parallel" | "branch" | "cache"; export type RuntimeNodeStatus = "passed" | "failed" | "cached"; export interface RuntimeContext { input: Input; state: Record; taskId: string; path: string[]; signal?: AbortSignal; output?: unknown; cacheHit?: boolean; } export type RuntimeMiddleware = (context: RuntimeContext, next: RuntimeNext) => unknown | Promise; export type RuntimeBranchPredicate = (context: RuntimeContext) => boolean | Promise; export interface RuntimeSeriesDefinition { kind: "async-pipeline.runtime.series"; items: RuntimeRunItem[]; } export interface RuntimeParallelDefinition { kind: "async-pipeline.runtime.parallel"; items: RuntimeRunItem[]; concurrency?: number; } export interface RuntimeParallelOptions { concurrency?: number; } export interface RuntimeBranchDefinition { kind: "async-pipeline.runtime.branch"; predicate: RuntimeBranchPredicate; whenTrue: RuntimeRunItem[]; whenFalse?: RuntimeRunItem[]; } export type RuntimeFlowDefinition = RuntimeSeriesDefinition | RuntimeParallelDefinition | RuntimeBranchDefinition; export type RuntimeRunItem = RuntimeMiddleware | CacheDirective | RuntimeFlowDefinition | readonly RuntimeRunItem[]; export type RuntimeRunDefinition = RuntimeRunItem | readonly RuntimeRunItem[]; export interface RuntimeInspectNode { kind: RuntimeNodeKind; id: string; path: string[]; children: RuntimeInspectNode[]; } export interface RuntimeTaskConfig { id?: string; description?: string; dependsOn?: string[]; cache?: false | CacheRef; run?: RuntimeRunDefinition; } export interface RuntimeTaskDefinition extends RuntimeTaskConfig { children: RuntimeTaskDefinition[]; flow?: RuntimeInspectNode; } export interface RuntimeDefinition { kind: "runtime-definition"; tasks: RuntimeTaskDefinition[]; cache: CacheRegistryDefinition; } export interface RuntimeTaskResult { id: string; status: "passed" | "failed" | "cached"; cacheHit: boolean; path?: string[]; error?: string; errorCode?: string; nodes?: RuntimeNodeResult[]; } export interface RuntimeNodeResult { id: string; kind: RuntimeNodeKind; path: string[]; status: RuntimeNodeStatus; error?: string; errorCode?: string; } export interface RuntimeExecution { status: "passed" | "failed"; tasks: RuntimeTaskResult[]; nodes: RuntimeNodeResult[]; output?: unknown; error?: string; errorCode?: string; } export interface Runtime { inspect(): RuntimeDefinition; run(input?: Input, options?: { task?: string; signal?: AbortSignal; }): Promise; start(): Promise; stop(): Promise; close(): Promise; } export declare function compose(...items: RuntimeRunDefinition[]): RuntimeSeriesDefinition; export declare function series(items: RuntimeRunDefinition): RuntimeSeriesDefinition; export declare function parallel(items: readonly RuntimeRunDefinition[]): RuntimeParallelDefinition; export declare function parallel(options: RuntimeParallelOptions, items: readonly RuntimeRunDefinition[]): RuntimeParallelDefinition; export declare function branch(predicate: RuntimeBranchPredicate, whenTrue: RuntimeRunDefinition, whenFalse?: RuntimeRunDefinition): RuntimeBranchDefinition; export declare function task(config: RuntimeTaskConfig): RuntimeTaskDefinition; export declare function task(config: RuntimeTaskConfig, runOrChildren: RuntimeRunDefinition | readonly RuntimeTaskDefinition[]): RuntimeTaskDefinition; export declare function defineRuntime(definition: readonly RuntimeTaskDefinition[] | readonly RuntimeRunItem[] | { tasks: readonly RuntimeTaskDefinition[] | readonly RuntimeRunItem[]; cache?: CacheRegistryDefinition; }): RuntimeDefinition; export declare function createRuntime(definition: RuntimeDefinition | readonly RuntimeTaskDefinition[], options?: { cache?: CacheRegistryDefinition; }): Runtime; //# sourceMappingURL=runtime.d.ts.map