@remoraflow/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +110 -0
  3. package/dist/compiler/index.d.ts +25 -0
  4. package/dist/compiler/index.d.ts.map +1 -0
  5. package/dist/compiler/passes/apply-best-practices.d.ts +19 -0
  6. package/dist/compiler/passes/apply-best-practices.d.ts.map +1 -0
  7. package/dist/compiler/passes/build-graph.d.ts +7 -0
  8. package/dist/compiler/passes/build-graph.d.ts.map +1 -0
  9. package/dist/compiler/passes/generate-constrained-tool-schemas.d.ts +4 -0
  10. package/dist/compiler/passes/generate-constrained-tool-schemas.d.ts.map +1 -0
  11. package/dist/compiler/passes/validate-control-flow.d.ts +4 -0
  12. package/dist/compiler/passes/validate-control-flow.d.ts.map +1 -0
  13. package/dist/compiler/passes/validate-foreach-target.d.ts +4 -0
  14. package/dist/compiler/passes/validate-foreach-target.d.ts.map +1 -0
  15. package/dist/compiler/passes/validate-jmespath.d.ts +4 -0
  16. package/dist/compiler/passes/validate-jmespath.d.ts.map +1 -0
  17. package/dist/compiler/passes/validate-limits.d.ts +9 -0
  18. package/dist/compiler/passes/validate-limits.d.ts.map +1 -0
  19. package/dist/compiler/passes/validate-references.d.ts +4 -0
  20. package/dist/compiler/passes/validate-references.d.ts.map +1 -0
  21. package/dist/compiler/passes/validate-tools.d.ts +4 -0
  22. package/dist/compiler/passes/validate-tools.d.ts.map +1 -0
  23. package/dist/compiler/types.d.ts +100 -0
  24. package/dist/compiler/types.d.ts.map +1 -0
  25. package/dist/compiler/utils/graph.d.ts +35 -0
  26. package/dist/compiler/utils/graph.d.ts.map +1 -0
  27. package/dist/compiler/utils/jmespath-helpers.d.ts +34 -0
  28. package/dist/compiler/utils/jmespath-helpers.d.ts.map +1 -0
  29. package/dist/compiler/utils/schema.d.ts +33 -0
  30. package/dist/compiler/utils/schema.d.ts.map +1 -0
  31. package/dist/example-tasks.d.ts +834 -0
  32. package/dist/example-tasks.d.ts.map +1 -0
  33. package/dist/executor/context.d.ts +42 -0
  34. package/dist/executor/context.d.ts.map +1 -0
  35. package/dist/executor/errors.d.ts +57 -0
  36. package/dist/executor/errors.d.ts.map +1 -0
  37. package/dist/executor/executor-types.d.ts +117 -0
  38. package/dist/executor/executor-types.d.ts.map +1 -0
  39. package/dist/executor/helpers.d.ts +21 -0
  40. package/dist/executor/helpers.d.ts.map +1 -0
  41. package/dist/executor/index.d.ts +16 -0
  42. package/dist/executor/index.d.ts.map +1 -0
  43. package/dist/executor/schema-inference.d.ts +3 -0
  44. package/dist/executor/schema-inference.d.ts.map +1 -0
  45. package/dist/executor/state.d.ts +292 -0
  46. package/dist/executor/state.d.ts.map +1 -0
  47. package/dist/executor/steps/agent-loop.d.ts +15 -0
  48. package/dist/executor/steps/agent-loop.d.ts.map +1 -0
  49. package/dist/executor/steps/end.d.ts +5 -0
  50. package/dist/executor/steps/end.d.ts.map +1 -0
  51. package/dist/executor/steps/extract-data.d.ts +15 -0
  52. package/dist/executor/steps/extract-data.d.ts.map +1 -0
  53. package/dist/executor/steps/for-each.d.ts +11 -0
  54. package/dist/executor/steps/for-each.d.ts.map +1 -0
  55. package/dist/executor/steps/llm-prompt.d.ts +13 -0
  56. package/dist/executor/steps/llm-prompt.d.ts.map +1 -0
  57. package/dist/executor/steps/sleep.d.ts +7 -0
  58. package/dist/executor/steps/sleep.d.ts.map +1 -0
  59. package/dist/executor/steps/start.d.ts +2 -0
  60. package/dist/executor/steps/start.d.ts.map +1 -0
  61. package/dist/executor/steps/switch-case.d.ts +11 -0
  62. package/dist/executor/steps/switch-case.d.ts.map +1 -0
  63. package/dist/executor/steps/tool-call.d.ts +9 -0
  64. package/dist/executor/steps/tool-call.d.ts.map +1 -0
  65. package/dist/executor/steps/wait-for-condition.d.ts +8 -0
  66. package/dist/executor/steps/wait-for-condition.d.ts.map +1 -0
  67. package/dist/generator/index.d.ts +59 -0
  68. package/dist/generator/index.d.ts.map +1 -0
  69. package/dist/generator/prompt.d.ts +6 -0
  70. package/dist/generator/prompt.d.ts.map +1 -0
  71. package/dist/lib.d.ts +15 -0
  72. package/dist/lib.d.ts.map +1 -0
  73. package/dist/lib.js +3566 -0
  74. package/dist/lib.js.map +42 -0
  75. package/dist/types.d.ts +481 -0
  76. package/dist/types.d.ts.map +1 -0
  77. package/package.json +54 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-tasks.d.ts","sourceRoot":"","sources":["../src/example-tasks.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAyHP,OAAO;uBAAS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+qBxC,CAAC"}
@@ -0,0 +1,42 @@
1
+ export interface WaitForConditionOptions {
2
+ maxAttempts: number;
3
+ intervalMs: number;
4
+ backoffMultiplier: number;
5
+ timeoutMs?: number;
6
+ }
7
+ /**
8
+ * Injectable execution context for durable execution environments.
9
+ *
10
+ * In a durable environment (AWS Step Functions, Temporal, Inngest, etc.),
11
+ * each `step()` runs in its own execution environment. The workflow code
12
+ * **outside** of `step()` closures re-executes on every resume, so it
13
+ * must be idempotent (pure reads, expression evaluation, scope construction).
14
+ * Code **inside** a `step()` closure runs exactly once — the environment
15
+ * records its result and replays the cached value on subsequent resumes
16
+ * instead of re-executing the function.
17
+ */
18
+ export interface DurableContext {
19
+ /**
20
+ * Wrap a step that should execute exactly once. In durable environments,
21
+ * `fn` runs on the first invocation and its result is persisted; on
22
+ * subsequent resumes the cached result is returned without calling `fn`
23
+ * again. All code outside `step()` must be idempotent because it
24
+ * re-runs on every resume.
25
+ * Default: executes the function directly (passthrough).
26
+ */
27
+ step: (name: string, fn: () => Promise<unknown>) => Promise<unknown>;
28
+ /**
29
+ * Sleep for the given duration. In durable environments,
30
+ * this uses a durable timer that survives process restarts.
31
+ * Default: setTimeout-based promise.
32
+ */
33
+ sleep: (name: string, durationMs: number) => Promise<void>;
34
+ /**
35
+ * Wait for a condition by polling. In durable environments,
36
+ * this might use waitForCallback or durable polling.
37
+ * Default: loop with setTimeout + backoff.
38
+ */
39
+ waitForCondition: (name: string, checkFn: () => Promise<unknown>, options: WaitForConditionOptions) => Promise<unknown>;
40
+ }
41
+ export declare function createDefaultDurableContext(): DurableContext;
42
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/executor/context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;;;OAOG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAErE;;;;OAIG;IACH,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;OAIG;IACH,gBAAgB,EAAE,CACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC/B,OAAO,EAAE,uBAAuB,KAC5B,OAAO,CAAC,OAAO,CAAC,CAAC;CACtB;AAID,wBAAgB,2BAA2B,IAAI,cAAc,CAuC5D"}
@@ -0,0 +1,57 @@
1
+ /** Strategy for recovering from a step execution error. */
2
+ export type RecoveryStrategy = "none" | "retry" | "llm-transform" | "llm-reprompt";
3
+ /**
4
+ * High-level category of a step execution error.
5
+ * - `configuration` — the workflow is misconfigured (missing tools, no agent)
6
+ * - `validation` — input or output data doesn't match the expected schema
7
+ * - `external-service` — a tool or LLM call failed
8
+ * - `expression` — a JMESPath or template expression failed to evaluate
9
+ * - `output-quality` — the LLM produced output that couldn't be parsed
10
+ */
11
+ export type ErrorCategory = "configuration" | "validation" | "external-service" | "expression" | "output-quality";
12
+ /** Machine-readable error code identifying the specific failure. */
13
+ export type ErrorCode = "TOOL_NOT_FOUND" | "TOOL_MISSING_EXECUTE" | "AGENT_NOT_PROVIDED" | "TOOL_INPUT_VALIDATION_FAILED" | "FOREACH_TARGET_NOT_ARRAY" | "WORKFLOW_OUTPUT_VALIDATION_FAILED" | "TOOL_EXECUTION_FAILED" | "LLM_API_ERROR" | "LLM_RATE_LIMITED" | "LLM_NETWORK_ERROR" | "LLM_NO_CONTENT" | "JMESPATH_EVALUATION_ERROR" | "TEMPLATE_INTERPOLATION_ERROR" | "LLM_OUTPUT_PARSE_ERROR" | "EXTRACTION_GAVE_UP" | "SLEEP_INVALID_DURATION" | "WAIT_CONDITION_TIMEOUT" | "WAIT_CONDITION_MAX_ATTEMPTS" | "EXECUTION_TOTAL_TIMEOUT" | "EXECUTION_ACTIVE_TIMEOUT";
14
+ /**
15
+ * Base error class for all step execution failures. Contains the step ID,
16
+ * error code, error category, and optional cause. All executor error classes
17
+ * extend this.
18
+ */
19
+ export declare class StepExecutionError extends Error {
20
+ readonly stepId: string;
21
+ readonly code: ErrorCode;
22
+ readonly category: ErrorCategory;
23
+ readonly cause?: unknown | undefined;
24
+ readonly name = "StepExecutionError";
25
+ constructor(stepId: string, code: ErrorCode, category: ErrorCategory, message: string, cause?: unknown | undefined);
26
+ }
27
+ /** Thrown when the workflow is misconfigured (missing tools, missing agent, missing execute function). Not retryable. */
28
+ export declare class ConfigurationError extends StepExecutionError {
29
+ constructor(stepId: string, code: ErrorCode, message: string);
30
+ }
31
+ /** Thrown when input or output data doesn't match the expected schema. Not retryable. */
32
+ export declare class ValidationError extends StepExecutionError {
33
+ readonly input: unknown;
34
+ constructor(stepId: string, code: ErrorCode, message: string, input: unknown, cause?: unknown);
35
+ }
36
+ /** Thrown when a tool execution or LLM API call fails. May be retryable (check {@link isRetryable}). */
37
+ export declare class ExternalServiceError extends StepExecutionError {
38
+ readonly statusCode?: number | undefined;
39
+ readonly isRetryable: boolean;
40
+ constructor(stepId: string, code: ErrorCode, message: string, cause?: unknown, statusCode?: number | undefined, isRetryable?: boolean);
41
+ }
42
+ /** Thrown when a JMESPath expression or template interpolation fails to evaluate. Not retryable. */
43
+ export declare class ExpressionError extends StepExecutionError {
44
+ readonly expression: string;
45
+ constructor(stepId: string, code: ErrorCode, message: string, expression: string, cause?: unknown);
46
+ }
47
+ /** Thrown when an LLM produces output that can't be parsed as valid JSON. Retryable via automatic retry. */
48
+ export declare class OutputQualityError extends StepExecutionError {
49
+ readonly rawOutput: unknown;
50
+ constructor(stepId: string, code: ErrorCode, message: string, rawOutput: unknown, cause?: unknown);
51
+ }
52
+ /** Thrown when the LLM determines that the requested data cannot be found or extracted from the source data during probe mode. Not retryable. */
53
+ export declare class ExtractionError extends StepExecutionError {
54
+ readonly reason: string;
55
+ constructor(stepId: string, message: string, reason: string);
56
+ }
57
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/executor/errors.ts"],"names":[],"mappings":"AAEA,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,OAAO,GACP,eAAe,GACf,cAAc,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GACtB,eAAe,GACf,YAAY,GACZ,kBAAkB,GAClB,YAAY,GACZ,gBAAgB,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,SAAS,GAElB,gBAAgB,GAChB,sBAAsB,GACtB,oBAAoB,GAEpB,8BAA8B,GAC9B,0BAA0B,GAC1B,mCAAmC,GAEnC,uBAAuB,GACvB,eAAe,GACf,kBAAkB,GAClB,mBAAmB,GACnB,gBAAgB,GAEhB,2BAA2B,GAC3B,8BAA8B,GAE9B,wBAAwB,GAExB,oBAAoB,GAEpB,wBAAwB,GACxB,wBAAwB,GACxB,6BAA6B,GAE7B,yBAAyB,GACzB,0BAA0B,CAAC;AAI9B;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;aAI3B,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,SAAS;aACf,QAAQ,EAAE,aAAa;aAEd,KAAK,CAAC,EAAE,OAAO;IAPzC,SAAkB,IAAI,wBAAwB;gBA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AE,MAAM;gBAF9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM;CAI/B"}
@@ -0,0 +1,117 @@
1
+ import type { Agent, LanguageModel, ToolSet } from "ai";
2
+ import type { WorkflowStep } from "../types";
3
+ import type { DurableContext } from "./context";
4
+ import { type StepExecutionError } from "./errors";
5
+ import type { ExecutionDelta, ExecutionPathSegment, ExecutionState, RetryRecord, TraceEntry } from "./state";
6
+ /** The result of executing a workflow. */
7
+ export interface ExecutionResult {
8
+ /** Whether the workflow completed without errors. */
9
+ success: boolean;
10
+ /** Map of step ID to that step's output value. */
11
+ stepOutputs: Record<string, unknown>;
12
+ /** The workflow's final output (from the `end` step's output expression), if any. */
13
+ output?: unknown;
14
+ /** The error that caused execution to fail, if `success` is `false`. */
15
+ error?: StepExecutionError;
16
+ /** The final execution state snapshot after the run completes. */
17
+ executionState: ExecutionState;
18
+ }
19
+ export interface ExecutorLimits {
20
+ /** Max wall-clock time from start to finish, including sleeps/waits. Default: 600_000 (10 min). */
21
+ maxTotalMs?: number;
22
+ /** Max active execution time (inside step() + checkFn, excluding sleeps/waits). Default: 300_000 (5 min). */
23
+ maxActiveMs?: number;
24
+ /** Soft cap on sleep durationMs and wait intervalMs. Clamped silently. Default: 300_000 (5 min). */
25
+ maxSleepMs?: number;
26
+ /** Soft cap on wait-for-condition maxAttempts. Clamped silently. Default: Infinity (unbounded). */
27
+ maxAttempts?: number;
28
+ /** Soft cap on backoffMultiplier upper bound. Clamped silently. Default: 2. */
29
+ maxBackoffMultiplier?: number;
30
+ /** Soft cap on backoffMultiplier lower bound. Clamped silently. Default: 1. */
31
+ minBackoffMultiplier?: number;
32
+ /** Soft cap on wait-for-condition timeoutMs. Clamped silently. Default: 600_000 (10 min). */
33
+ maxTimeoutMs?: number;
34
+ /** Byte threshold above which extract-data uses probe mode instead of inline data. Default: 50_000 (50KB). */
35
+ probeThresholdBytes?: number;
36
+ /** Maximum bytes returned per probe-data call. Default: 10_000 (10KB). */
37
+ probeResultMaxBytes?: number;
38
+ /** Maximum probe steps for extract-data probe mode. Default: 10. */
39
+ probeMaxSteps?: number;
40
+ }
41
+ /** Options for {@link executeWorkflow}. */
42
+ export interface ExecuteWorkflowOptions {
43
+ /** Tool definitions. Every tool referenced by a `tool-call` step must be present with an `execute` function. */
44
+ tools: ToolSet;
45
+ /** An AI SDK `LanguageModel` for `llm-prompt`, `extract-data`, and `agent-loop` steps. Required if the workflow contains LLM steps. */
46
+ model?: LanguageModel;
47
+ /** An AI SDK `Agent` to use for `agent-loop` steps. When provided, agent-loop steps use the Agent's own tools
48
+ * and describe the expected output shape in the prompt. The bare `model` is then used to coerce the Agent's
49
+ * text output into the structured format. Only applies to `agent-loop` steps. */
50
+ agent?: Agent<any, any, any>;
51
+ /** Input values passed to the workflow's `start` step. Validated against the start step's `inputSchema`. */
52
+ inputs?: Record<string, unknown>;
53
+ /** Maximum number of retries for recoverable errors (rate limits, network errors, parse failures). Defaults to 3. */
54
+ maxRetries?: number;
55
+ /** Base delay in milliseconds for exponential backoff between retries. Defaults to 1000. */
56
+ retryDelayMs?: number;
57
+ /** Called when a step begins execution. */
58
+ onStepStart?: (stepId: string, step: WorkflowStep) => void;
59
+ /** Called when a step completes successfully. */
60
+ onStepComplete?: (stepId: string, output: unknown) => void;
61
+ /** Called on every state transition with the full execution state and the idempotent delta that produced it. */
62
+ onStateChange?: (state: ExecutionState, delta: ExecutionDelta) => void;
63
+ /** Injectable durable execution context. Default: simple in-process implementation. */
64
+ context?: DurableContext;
65
+ /** Execution limits for sleep/wait/timeout bounds. */
66
+ limits?: ExecutorLimits;
67
+ }
68
+ export type Expression = {
69
+ type: "literal";
70
+ value: unknown;
71
+ } | {
72
+ type: "jmespath";
73
+ expression: string;
74
+ } | {
75
+ type: "template";
76
+ template: string;
77
+ };
78
+ /**
79
+ * Internal resolved options. Currently identical to the public options
80
+ * but kept as a separate type for future internal-only fields.
81
+ */
82
+ export type ResolvedExecuteWorkflowOptions = ExecuteWorkflowOptions;
83
+ /**
84
+ * Callback type for `executeChain`, injected into structural steps
85
+ * (switch-case, for-each, wait-for-condition) to avoid circular imports.
86
+ */
87
+ export type ExecuteChainFn = (startStepId: string, stepIndex: Map<string, WorkflowStep>, stepOutputs: Record<string, unknown>, loopVars: Record<string, unknown>, options: ResolvedExecuteWorkflowOptions, context: DurableContext, timer: ExecutionTimer | undefined, stateManager: ExecutionStateManager | undefined, execPath: ExecutionPathSegment[]) => Promise<unknown>;
88
+ export declare const DEFAULT_EXECUTOR_LIMITS: Required<ExecutorLimits>;
89
+ export declare class ExecutionTimer {
90
+ private readonly startTime;
91
+ private activeMs;
92
+ private activeStart;
93
+ private readonly limits;
94
+ constructor(limits?: ExecutorLimits);
95
+ get resolvedLimits(): Required<ExecutorLimits>;
96
+ /** Call before entering active work (step execution, condition check). */
97
+ beginActive(): void;
98
+ /** Call after active work completes. Checks active timeout. */
99
+ endActive(stepId: string): void;
100
+ /** Check total wall-clock timeout before starting a step. */
101
+ checkTotal(stepId: string): void;
102
+ }
103
+ export declare class ExecutionStateManager {
104
+ private state;
105
+ private readonly onChange?;
106
+ constructor(onChange?: (state: ExecutionState, delta: ExecutionDelta) => void);
107
+ get currentState(): ExecutionState;
108
+ private emit;
109
+ runStarted(): void;
110
+ stepStarted(stepId: string, path: ExecutionPathSegment[]): void;
111
+ stepCompleted(stepId: string, path: ExecutionPathSegment[], output: unknown, durationMs: number, resolvedInputs?: unknown, trace?: TraceEntry[]): void;
112
+ stepFailed(stepId: string, path: ExecutionPathSegment[], error: StepExecutionError, durationMs: number, resolvedInputs?: unknown): void;
113
+ retryAttempted(stepId: string, path: ExecutionPathSegment[], retry: RetryRecord): void;
114
+ runCompleted(output?: unknown): void;
115
+ runFailed(error: StepExecutionError): void;
116
+ }
117
+ //# sourceMappingURL=executor-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor-types.d.ts","sourceRoot":"","sources":["../../src/executor/executor-types.ts"],"names":[],"m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AM,EACd,IAAI,EAAE,oBAAoB,EAAE,EAC5B,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,OAAO,EACxB,KAAK,CAAC,EAAE,UAAU,EAAE,GAClB,IAAI;IAaP,UAAU,CACT,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,oBAAoB,EAAE,EAC5B,KAAK,EAAE,kBAAkB,EACzB,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,OAAO,GACtB,IAAI;IAYP,cAAc,CACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,oBAAoB,EAAE,EAC5B,KAAK,EAAE,WAAW,GAChB,IAAI;IASP,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAWpC,SAAS,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;CAU1C"}
@@ -0,0 +1,21 @@
1
+ import { type StepExecutionError } from "./errors";
2
+ import type { Expression } from "./executor-types";
3
+ export declare function stripCodeFence(text: string): string;
4
+ export declare function evaluateExpression(expr: Expression, scope: Record<string, unknown>, stepId: string): unknown;
5
+ export declare function stringifyValue(value: unknown): string;
6
+ export declare function interpolateTemplate(template: string, scope: Record<string, unknown>, stepId: string): string;
7
+ export declare function classifyLlmError(stepId: string, e: unknown): StepExecutionError;
8
+ export declare function createProbeDataTool(sourceData: unknown, limits: {
9
+ probeResultMaxBytes: number;
10
+ }): import("ai").Tool<{
11
+ expression: string;
12
+ }, string>;
13
+ export declare function createGiveUpTool(): {
14
+ tool: import("ai").Tool<{
15
+ reason: string;
16
+ }, {
17
+ acknowledged: boolean;
18
+ }>;
19
+ getReason: () => string | undefined;
20
+ };
21
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/executor/helpers.ts"],"names":[],"mappings":"AAYA,OAAO,EAIN,KAAK,kBAAkB,EACvB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AAID,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,MAAM,GACZ,OAAO,CAkBT;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,MAAM,GACZ,MAAM,CA2BR;AAID,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,EACd,CAAC,EAAE,OAAO,GACR,kBAAkB,CA2DpB;AAID,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,OAAO,EACnB,MAAM,EAAE;IAAE,mBAAmB,EAAE,MAAM,CAAA;CAAE;;WAiCvC;AAED,wBAAgB,gBAAgB;;;;;;;EAqB/B"}
@@ -0,0 +1,16 @@
1
+ import type { WorkflowDefinition } from "../types";
2
+ import { type ExecuteWorkflowOptions, type ExecutionResult } from "./executor-types";
3
+ export type { ExecuteWorkflowOptions, ExecutionResult, ExecutorLimits, } from "./executor-types";
4
+ /**
5
+ * Executes a compiled workflow by walking its step graph from `initialStepId`.
6
+ *
7
+ * Handles all step types (tool calls, LLM prompts, data extraction, branching,
8
+ * loops) and supports automatic retry with exponential backoff for recoverable
9
+ * errors (rate limits, network failures, LLM parse errors).
10
+ *
11
+ * @param workflow - The workflow definition to execute (should be compiled first via {@link compileWorkflow}).
12
+ * @param options - Execution options including tools, agent, inputs, and callbacks.
13
+ * @returns An {@link ExecutionResult} with success status, all step outputs, and the final workflow output.
14
+ */
15
+ export declare function executeWorkflow(workflow: WorkflowDefinition, options: ExecuteWorkflowOptions): Promise<ExecutionResult>;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/executor/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,UAAU,CAAC;AAQjE,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EAIpB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACX,sBAAsB,EACtB,eAAe,EACf,cAAc,GACd,MAAM,kBAAkB,CAAC;AAolB1B;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACpC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,sBAAsB,GAC7B,OAAO,CAAC,eAAe,CAAC,CA8E1B"}
@@ -0,0 +1,3 @@
1
+ export declare function inferSchema(value: unknown, types?: unknown[], maxKeys?: number): unknown;
2
+ export declare function summarizeObjectStructure(value: object, indent?: string | number): string;
3
+ //# sourceMappingURL=schema-inference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-inference.d.ts","sourceRoot":"","sources":["../../src/executor/schema-inference.ts"],"names":[],"mappings":"AAwDA,wBAAgB,WAAW,CAC1B,KAAK,EAAE,OAAO,EACd,KAAK,GAAE,OAAO,EAAO,EACrB,OAAO,SAAK,WAgGZ;AAiFD,wBAAgB,wBAAwB,CACvC,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,UAIxB"}
@@ -0,0 +1,292 @@
1
+ import type { StepExecutionError } from "./errors";
2
+ export declare const stepStatusSchema: import("arktype/internal/variants/string.ts").StringType<"pending" | "running" | "completed" | "failed" | "skipped", {}>;
3
+ export type StepStatus = typeof stepStatusSchema.infer;
4
+ export declare const runStatusSchema: import("arktype/internal/variants/string.ts").StringType<"pending" | "running" | "completed" | "failed", {}>;
5
+ export type RunStatus = typeof runStatusSchema.infer;
6
+ export declare const errorSnapshotSchema: import("arktype/internal/variants/object.ts").ObjectType<{
7
+ code: string;
8
+ category: string;
9
+ message: string;
10
+ stepId?: string | undefined;
11
+ statusCode?: number | undefined;
12
+ isRetryable?: boolean | undefined;
13
+ }, {}>;
14
+ export type ErrorSnapshot = typeof errorSnapshotSchema.infer;
15
+ export declare const retryRecordSchema: import("arktype/internal/variants/object.ts").ObjectType<{
16
+ attempt: number;
17
+ startedAt: string;
18
+ failedAt: string;
19
+ errorCode: string;
20
+ errorMessage: string;
21
+ }, {}>;
22
+ export type RetryRecord = typeof retryRecordSchema.infer;
23
+ export declare const executionPathSegmentSchema: import("arktype/internal/variants/object.ts").ObjectType<{
24
+ type: "for-each";
25
+ stepId: string;
26
+ iterationIndex: number;
27
+ itemValue: unknown;
28
+ } | {
29
+ type: "switch-case";
30
+ stepId: string;
31
+ matchedCaseIndex: number;
32
+ matchedValue: unknown;
33
+ } | {
34
+ type: "wait-for-condition";
35
+ stepId: string;
36
+ pollAttempt: number;
37
+ }, {}>;
38
+ export type ExecutionPathSegment = typeof executionPathSegmentSchema.infer;
39
+ export declare const traceEntrySchema: import("arktype/internal/variants/object.ts").ObjectType<{
40
+ type: "log";
41
+ message: string;
42
+ data?: unknown;
43
+ } | {
44
+ type: "agent-step";
45
+ step: unknown;
46
+ }, {}>;
47
+ export type TraceEntry = typeof traceEntrySchema.infer;
48
+ export declare const stepExecutionRecordSchema: import("arktype/internal/variants/object.ts").ObjectType<{
49
+ stepId: string;
50
+ status: "pending" | "running" | "completed" | "failed" | "skipped";
51
+ retries: {
52
+ attempt: number;
53
+ startedAt: string;
54
+ failedAt: string;
55
+ errorCode: string;
56
+ errorMessage: string;
57
+ }[];
58
+ path: ({
59
+ type: "for-each";
60
+ stepId: string;
61
+ iterationIndex: number;
62
+ itemValue: unknown;
63
+ } | {
64
+ type: "switch-case";
65
+ stepId: string;
66
+ matchedCaseIndex: number;
67
+ matchedValue: unknown;
68
+ } | {
69
+ type: "wait-for-condition";
70
+ stepId: string;
71
+ pollAttempt: number;
72
+ })[];
73
+ startedAt?: string | undefined;
74
+ completedAt?: string | undefined;
75
+ durationMs?: number | undefined;
76
+ output?: unknown;
77
+ error?: {
78
+ code: string;
79
+ category: string;
80
+ message: string;
81
+ stepId?: string | undefined;
82
+ statusCode?: number | undefined;
83
+ isRetryable?: boolean | undefined;
84
+ } | undefined;
85
+ resolvedInputs?: unknown;
86
+ trace?: ({
87
+ type: "log";
88
+ message: string;
89
+ data?: unknown;
90
+ } | {
91
+ type: "agent-step";
92
+ step: unknown;
93
+ })[] | undefined;
94
+ }, {}>;
95
+ export type StepExecutionRecord = typeof stepExecutionRecordSchema.infer;
96
+ export declare const executionStateSchema: import("arktype/internal/variants/object.ts").ObjectType<{
97
+ runId: string;
98
+ status: "pending" | "running" | "completed" | "failed";
99
+ startedAt: string;
100
+ stepRecords: {
101
+ stepId: string;
102
+ status: "pending" | "running" | "completed" | "failed" | "skipped";
103
+ retries: {
104
+ attempt: number;
105
+ startedAt: string;
106
+ failedAt: string;
107
+ errorCode: string;
108
+ errorMessage: string;
109
+ }[];
110
+ path: ({
111
+ type: "for-each";
112
+ stepId: string;
113
+ iterationIndex: number;
114
+ itemValue: unknown;
115
+ } | {
116
+ type: "switch-case";
117
+ stepId: string;
118
+ matchedCaseIndex: number;
119
+ matchedValue: unknown;
120
+ } | {
121
+ type: "wait-for-condition";
122
+ stepId: string;
123
+ pollAttempt: number;
124
+ })[];
125
+ startedAt?: string | undefined;
126
+ completedAt?: string | undefined;
127
+ durationMs?: number | undefined;
128
+ output?: unknown;
129
+ error?: {
130
+ code: string;
131
+ category: string;
132
+ message: string;
133
+ stepId?: string | undefined;
134
+ statusCode?: number | undefined;
135
+ isRetryable?: boolean | undefined;
136
+ } | undefined;
137
+ resolvedInputs?: unknown;
138
+ trace?: ({
139
+ type: "log";
140
+ message: string;
141
+ data?: unknown;
142
+ } | {
143
+ type: "agent-step";
144
+ step: unknown;
145
+ })[] | undefined;
146
+ }[];
147
+ completedAt?: string | undefined;
148
+ durationMs?: number | undefined;
149
+ output?: unknown;
150
+ error?: {
151
+ code: string;
152
+ category: string;
153
+ message: string;
154
+ stepId?: string | undefined;
155
+ statusCode?: number | undefined;
156
+ isRetryable?: boolean | undefined;
157
+ } | undefined;
158
+ }, {}>;
159
+ export type ExecutionState = typeof executionStateSchema.infer;
160
+ export declare const executionDeltaSchema: import("arktype/internal/variants/object.ts").ObjectType<{
161
+ type: "run-started";
162
+ runId: string;
163
+ startedAt: string;
164
+ } | {
165
+ type: "step-started";
166
+ stepId: string;
167
+ path: ({
168
+ type: "for-each";
169
+ stepId: string;
170
+ iterationIndex: number;
171
+ itemValue: unknown;
172
+ } | {
173
+ type: "switch-case";
174
+ stepId: string;
175
+ matchedCaseIndex: number;
176
+ matchedValue: unknown;
177
+ } | {
178
+ type: "wait-for-condition";
179
+ stepId: string;
180
+ pollAttempt: number;
181
+ })[];
182
+ startedAt: string;
183
+ } | {
184
+ type: "step-completed";
185
+ stepId: string;
186
+ path: ({
187
+ type: "for-each";
188
+ stepId: string;
189
+ iterationIndex: number;
190
+ itemValue: unknown;
191
+ } | {
192
+ type: "switch-case";
193
+ stepId: string;
194
+ matchedCaseIndex: number;
195
+ matchedValue: unknown;
196
+ } | {
197
+ type: "wait-for-condition";
198
+ stepId: string;
199
+ pollAttempt: number;
200
+ })[];
201
+ completedAt: string;
202
+ durationMs: number;
203
+ output: unknown;
204
+ resolvedInputs?: unknown;
205
+ trace?: ({
206
+ type: "log";
207
+ message: string;
208
+ data?: unknown;
209
+ } | {
210
+ type: "agent-step";
211
+ step: unknown;
212
+ })[] | undefined;
213
+ } | {
214
+ type: "step-failed";
215
+ stepId: string;
216
+ path: ({
217
+ type: "for-each";
218
+ stepId: string;
219
+ iterationIndex: number;
220
+ itemValue: unknown;
221
+ } | {
222
+ type: "switch-case";
223
+ stepId: string;
224
+ matchedCaseIndex: number;
225
+ matchedValue: unknown;
226
+ } | {
227
+ type: "wait-for-condition";
228
+ stepId: string;
229
+ pollAttempt: number;
230
+ })[];
231
+ failedAt: string;
232
+ durationMs: number;
233
+ error: {
234
+ code: string;
235
+ category: string;
236
+ message: string;
237
+ stepId?: string | undefined;
238
+ statusCode?: number | undefined;
239
+ isRetryable?: boolean | undefined;
240
+ };
241
+ resolvedInputs?: unknown;
242
+ } | {
243
+ type: "step-retry";
244
+ stepId: string;
245
+ path: ({
246
+ type: "for-each";
247
+ stepId: string;
248
+ iterationIndex: number;
249
+ itemValue: unknown;
250
+ } | {
251
+ type: "switch-case";
252
+ stepId: string;
253
+ matchedCaseIndex: number;
254
+ matchedValue: unknown;
255
+ } | {
256
+ type: "wait-for-condition";
257
+ stepId: string;
258
+ pollAttempt: number;
259
+ })[];
260
+ retry: {
261
+ attempt: number;
262
+ startedAt: string;
263
+ failedAt: string;
264
+ errorCode: string;
265
+ errorMessage: string;
266
+ };
267
+ } | {
268
+ type: "run-completed";
269
+ runId: string;
270
+ completedAt: string;
271
+ durationMs: number;
272
+ output?: unknown;
273
+ } | {
274
+ type: "run-failed";
275
+ runId: string;
276
+ failedAt: string;
277
+ durationMs: number;
278
+ error: {
279
+ code: string;
280
+ category: string;
281
+ message: string;
282
+ stepId?: string | undefined;
283
+ statusCode?: number | undefined;
284
+ isRetryable?: boolean | undefined;
285
+ };
286
+ }, {}>;
287
+ export type ExecutionDelta = typeof executionDeltaSchema.infer;
288
+ /** Convert a StepExecutionError class instance to a serializable snapshot. */
289
+ export declare function snapshotError(err: StepExecutionError): ErrorSnapshot;
290
+ /** Apply a delta to an execution state, returning a new state. Pure — no mutations. */
291
+ export declare function applyDelta(state: ExecutionState, delta: ExecutionDelta): ExecutionState;
292
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/executor/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,eAAO,MAAM,gBAAgB,0HAE5B,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,OAAO,gB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aAAa,CAcpE;AAkDD,uFAAuF;AACvF,wBAAgB,UAAU,CACzB,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,cAAc,GACnB,cAAc,CA6FhB"}
@@ -0,0 +1,15 @@
1
+ import type { WorkflowStep } from "../../types";
2
+ import type { ExecutorLimits, ResolvedExecuteWorkflowOptions } from "../executor-types";
3
+ import type { TraceEntry } from "../state";
4
+ type StepOutput = {
5
+ output: unknown;
6
+ trace?: TraceEntry[];
7
+ };
8
+ export declare function executeAgentLoop(step: WorkflowStep & {
9
+ type: "agent-loop";
10
+ }, scope: Record<string, unknown>, options: ResolvedExecuteWorkflowOptions, limits: Required<ExecutorLimits>): Promise<StepOutput>;
11
+ export declare function resolveAgentLoopInputs(step: WorkflowStep & {
12
+ type: "agent-loop";
13
+ }, scope: Record<string, unknown>): unknown;
14
+ export {};
15
+ //# sourceMappingURL=agent-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../../../src/executor/steps/agent-loop.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhD,OAAO,KAAK,EACX,cAAc,EAEd,8BAA8B,EAC9B,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,KAAK,UAAU,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAE5D,wBAAsB,gBAAgB,CACrC,IAAI,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,EAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,EAAE,8BAA8B,EACvC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,UAAU,CAAC,CAuCrB;AAsID,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,EAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAYT"}
@@ -0,0 +1,5 @@
1
+ import type { WorkflowStep } from "../../types";
2
+ export declare function executeEnd(step: WorkflowStep & {
3
+ type: "end";
4
+ }, scope: Record<string, unknown>): unknown;
5
+ //# sourceMappingURL=end.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end.d.ts","sourceRoot":"","sources":["../../../src/executor/steps/end.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,wBAAgB,UAAU,CACzB,IAAI,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,EACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAKT"}
@@ -0,0 +1,15 @@
1
+ import type { WorkflowStep } from "../../types";
2
+ import type { ExecutorLimits, ResolvedExecuteWorkflowOptions } from "../executor-types";
3
+ import type { TraceEntry } from "../state";
4
+ type StepOutput = {
5
+ output: unknown;
6
+ trace?: TraceEntry[];
7
+ };
8
+ export declare function executeExtractData(step: WorkflowStep & {
9
+ type: "extract-data";
10
+ }, scope: Record<string, unknown>, options: ResolvedExecuteWorkflowOptions, limits: Required<ExecutorLimits>): Promise<StepOutput>;
11
+ export declare function resolveExtractDataInputs(step: WorkflowStep & {
12
+ type: "extract-data";
13
+ }, scope: Record<string, unknown>): unknown;
14
+ export {};
15
+ //# sourceMappingURL=extract-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-data.d.ts","sourceRoot":"","sources":["../../../src/executor/steps/extract-data.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhD,OAAO,KAAK,EACX,cAAc,EAEd,8BAA8B,EAC9B,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,KAAK,UAAU,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC;AAE5D,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,EAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,EAAE,8BAA8B,EACvC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,GAC9B,OAAO,CAAC,UAAU,CAAC,CA+DrB;AA4ID,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,YAAY,GAAG;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,EAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAYT"}