@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.
- package/LICENSE +674 -0
- package/README.md +110 -0
- package/dist/compiler/index.d.ts +25 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/passes/apply-best-practices.d.ts +19 -0
- package/dist/compiler/passes/apply-best-practices.d.ts.map +1 -0
- package/dist/compiler/passes/build-graph.d.ts +7 -0
- package/dist/compiler/passes/build-graph.d.ts.map +1 -0
- package/dist/compiler/passes/generate-constrained-tool-schemas.d.ts +4 -0
- package/dist/compiler/passes/generate-constrained-tool-schemas.d.ts.map +1 -0
- package/dist/compiler/passes/validate-control-flow.d.ts +4 -0
- package/dist/compiler/passes/validate-control-flow.d.ts.map +1 -0
- package/dist/compiler/passes/validate-foreach-target.d.ts +4 -0
- package/dist/compiler/passes/validate-foreach-target.d.ts.map +1 -0
- package/dist/compiler/passes/validate-jmespath.d.ts +4 -0
- package/dist/compiler/passes/validate-jmespath.d.ts.map +1 -0
- package/dist/compiler/passes/validate-limits.d.ts +9 -0
- package/dist/compiler/passes/validate-limits.d.ts.map +1 -0
- package/dist/compiler/passes/validate-references.d.ts +4 -0
- package/dist/compiler/passes/validate-references.d.ts.map +1 -0
- package/dist/compiler/passes/validate-tools.d.ts +4 -0
- package/dist/compiler/passes/validate-tools.d.ts.map +1 -0
- package/dist/compiler/types.d.ts +100 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/compiler/utils/graph.d.ts +35 -0
- package/dist/compiler/utils/graph.d.ts.map +1 -0
- package/dist/compiler/utils/jmespath-helpers.d.ts +34 -0
- package/dist/compiler/utils/jmespath-helpers.d.ts.map +1 -0
- package/dist/compiler/utils/schema.d.ts +33 -0
- package/dist/compiler/utils/schema.d.ts.map +1 -0
- package/dist/example-tasks.d.ts +834 -0
- package/dist/example-tasks.d.ts.map +1 -0
- package/dist/executor/context.d.ts +42 -0
- package/dist/executor/context.d.ts.map +1 -0
- package/dist/executor/errors.d.ts +57 -0
- package/dist/executor/errors.d.ts.map +1 -0
- package/dist/executor/executor-types.d.ts +117 -0
- package/dist/executor/executor-types.d.ts.map +1 -0
- package/dist/executor/helpers.d.ts +21 -0
- package/dist/executor/helpers.d.ts.map +1 -0
- package/dist/executor/index.d.ts +16 -0
- package/dist/executor/index.d.ts.map +1 -0
- package/dist/executor/schema-inference.d.ts +3 -0
- package/dist/executor/schema-inference.d.ts.map +1 -0
- package/dist/executor/state.d.ts +292 -0
- package/dist/executor/state.d.ts.map +1 -0
- package/dist/executor/steps/agent-loop.d.ts +15 -0
- package/dist/executor/steps/agent-loop.d.ts.map +1 -0
- package/dist/executor/steps/end.d.ts +5 -0
- package/dist/executor/steps/end.d.ts.map +1 -0
- package/dist/executor/steps/extract-data.d.ts +15 -0
- package/dist/executor/steps/extract-data.d.ts.map +1 -0
- package/dist/executor/steps/for-each.d.ts +11 -0
- package/dist/executor/steps/for-each.d.ts.map +1 -0
- package/dist/executor/steps/llm-prompt.d.ts +13 -0
- package/dist/executor/steps/llm-prompt.d.ts.map +1 -0
- package/dist/executor/steps/sleep.d.ts +7 -0
- package/dist/executor/steps/sleep.d.ts.map +1 -0
- package/dist/executor/steps/start.d.ts +2 -0
- package/dist/executor/steps/start.d.ts.map +1 -0
- package/dist/executor/steps/switch-case.d.ts +11 -0
- package/dist/executor/steps/switch-case.d.ts.map +1 -0
- package/dist/executor/steps/tool-call.d.ts +9 -0
- package/dist/executor/steps/tool-call.d.ts.map +1 -0
- package/dist/executor/steps/wait-for-condition.d.ts +8 -0
- package/dist/executor/steps/wait-for-condition.d.ts.map +1 -0
- package/dist/generator/index.d.ts +59 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/prompt.d.ts +6 -0
- package/dist/generator/prompt.d.ts.map +1 -0
- package/dist/lib.d.ts +15 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +3566 -0
- package/dist/lib.js.map +42 -0
- package/dist/types.d.ts +481 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# ๐ฆ Remora
|
|
2
|
+
|
|
3
|
+
Workflows by agents, for agents.
|
|
4
|
+
|
|
5
|
+
**[Documentation](https://isaacwasserman.github.io/remora/)** ยท **[GitHub](https://github.com/isaacwasserman/remora)**
|
|
6
|
+
|
|
7
|
+
Remora is a DSL for agents to write workflows for themselves. An agent receives a task, defines a workflow using Remora's JSON-based syntax, and gets it compiled and validated โ producing an executable plan that is well-defined, repeatable, and auditable.
|
|
8
|
+
|
|
9
|
+
> Unlike unstructured instructions, a Remora workflow is a concrete artifact that can be inspected, versioned, and re-run deterministically.
|
|
10
|
+
|
|
11
|
+
The workflow definition is a JSON object, which means agents can produce it via a single tool call. The compiler returns structured diagnostics โ errors and warnings with specific codes and locations โ so the agent gets immediate feedback on whether its logic is sound and can fix issues before anything runs.
|
|
12
|
+
|
|
13
|
+
> An agent can author a workflow, compile it, read the diagnostics, and iterate โ all within a single conversation turn.
|
|
14
|
+
|
|
15
|
+
The name comes from the remora fish, which attaches to sharks and other large animals. Remora workflows work alongside agents in a similar way: rather than constraining behavior through guardrails, the agent authors its own concrete, inspectable plan using familiar primitives โ tool calls, loops, switch statements, and data extraction steps โ connected by JMESPath expressions for data flow.
|
|
16
|
+
|
|
17
|
+
## ๐ Constrained Tool Schemas
|
|
18
|
+
|
|
19
|
+
When the compiler analyzes a workflow, it determines exactly which tool parameters are static (known at compile time) versus dynamic (resolved at runtime). This produces a narrowed input schema for each tool.
|
|
20
|
+
|
|
21
|
+
This matters for safety: a human supervisor can review the constrained schemas and approve a limited set of behaviors ahead of time. The compiler makes this distinction explicit, enabling workflows to run without human-in-the-loop supervision where appropriate.
|
|
22
|
+
|
|
23
|
+
> A workflow that only ever calls `sendEmail` with a specific template and a dynamic recipient is meaningfully different from one with unconstrained access to the email API.
|
|
24
|
+
|
|
25
|
+
## ๐๏ธ Architecture
|
|
26
|
+
|
|
27
|
+
Remora has three main components:
|
|
28
|
+
|
|
29
|
+
### Compiler
|
|
30
|
+
|
|
31
|
+
A multi-pass compiler that takes a raw workflow definition and produces a validated execution graph. Passes include:
|
|
32
|
+
|
|
33
|
+
- **Graph construction** โ builds the DAG, detects cycles and duplicate step IDs
|
|
34
|
+
- **Reference validation** โ verifies all step references resolve
|
|
35
|
+
- **Control flow validation** โ checks branching and looping logic
|
|
36
|
+
- **JMESPath validation** โ parses and validates all expressions
|
|
37
|
+
- **Tool validation** โ ensures tool call parameters match available tool schemas
|
|
38
|
+
- **Constrained schema generation** โ produces narrowed tool input schemas
|
|
39
|
+
- **Best practices** โ applies non-destructive transformations (e.g., adding missing end steps)
|
|
40
|
+
|
|
41
|
+
Diagnostics are emitted as structured errors and warnings with specific codes, step locations, and field paths.
|
|
42
|
+
|
|
43
|
+
### Executor
|
|
44
|
+
|
|
45
|
+
A runtime engine that walks the compiled execution graph step by step. It handles:
|
|
46
|
+
|
|
47
|
+
- **Tool calls** with literal or expression-based arguments
|
|
48
|
+
- **LLM prompts** with template string interpolation from step outputs
|
|
49
|
+
- **Data extraction** via JMESPath or LLM-based extraction
|
|
50
|
+
- **Switch-case** branching on step output values
|
|
51
|
+
- **For-each** loops over arrays with scoped iteration variables
|
|
52
|
+
|
|
53
|
+
Each step's output is stored in a scope that subsequent steps can reference via JMESPath expressions, providing structured data flow without arbitrary code.
|
|
54
|
+
|
|
55
|
+
The executor is compatible with the [Vercel AI SDK](https://ai-sdk.dev/) and will eventually support any agent implementing the AI SDK's agent interface.
|
|
56
|
+
|
|
57
|
+
### Viewer
|
|
58
|
+
|
|
59
|
+
A React-based workflow visualizer built on [React Flow](https://reactflow.dev/) that renders compiled workflows as interactive DAGs. Available as an npm import (`remora/viewer`) or via the [shadcn component registry](https://isaacwasserman.github.io/remora/guide/component-registry) for full customization:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx shadcn@latest add https://isaacwasserman.github.io/remora/r/workflow-viewer.json
|
|
63
|
+
npx shadcn@latest add https://isaacwasserman.github.io/remora/r/workflow-step-detail-panel.json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Component Registry
|
|
67
|
+
|
|
68
|
+
The viewer components are available via a [shadcn-compatible component registry](https://isaacwasserman.github.io/remora/guide/component-registry), giving you full control over the source code and styling. See the [component registry docs](https://isaacwasserman.github.io/remora/guide/component-registry) for details.
|
|
69
|
+
|
|
70
|
+
## The DSL
|
|
71
|
+
|
|
72
|
+
Workflows are defined as a list of steps with an initial step ID. Each step has a type (`tool-call`, `llm-prompt`, `extract-data`, `switch-case`, `for-each`, or `end`), a `nextStepId` for sequencing, and type-specific parameters. Data flows between steps through JMESPath expressions that reference previous step outputs.
|
|
73
|
+
|
|
74
|
+
See [`src/example-tasks.ts`](src/example-tasks.ts) for complete workflow examples including support ticket triage, order fulfillment, content moderation, and student course assignment.
|
|
75
|
+
|
|
76
|
+
See [`src/types.ts`](src/types.ts) for the full type definitions.
|
|
77
|
+
|
|
78
|
+
## Getting Started
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
bun install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Run the workflow viewer:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
bun run viewer
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Run tests:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
bun test
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Lint:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
bun run lint
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Type check:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
bun run typecheck
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## โ ๏ธ Status
|
|
109
|
+
|
|
110
|
+
Early prototype. The core compiler, executor, and viewer are functional, but the API is unstable and breaking changes should be expected.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ToolSet } from "ai";
|
|
2
|
+
import type { WorkflowDefinition } from "../types";
|
|
3
|
+
import type { CompilerLimits, CompilerResult } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Compiles a workflow definition through a multi-pass validation pipeline,
|
|
6
|
+
* producing an execution graph and structured diagnostics.
|
|
7
|
+
*
|
|
8
|
+
* Passes: graph construction, reference validation, control flow validation,
|
|
9
|
+
* JMESPath validation, tool validation, for-each target validation, and
|
|
10
|
+
* best-practice transformations.
|
|
11
|
+
*
|
|
12
|
+
* @param workflow - The workflow definition to compile.
|
|
13
|
+
* @param options - Optional configuration.
|
|
14
|
+
* @param options.tools - Tool definitions to validate tool-call steps against.
|
|
15
|
+
* When provided, enables tool input validation and constrained schema generation.
|
|
16
|
+
* @returns A {@link CompilerResult} containing diagnostics, the execution graph
|
|
17
|
+
* (if structurally valid), an optimized workflow (if error-free), and
|
|
18
|
+
* constrained tool schemas (if tools were provided).
|
|
19
|
+
*/
|
|
20
|
+
export declare function compileWorkflow(workflow: WorkflowDefinition, options?: {
|
|
21
|
+
tools?: ToolSet;
|
|
22
|
+
limits?: CompilerLimits;
|
|
23
|
+
}): Promise<CompilerResult>;
|
|
24
|
+
export type { CompilerLimits, CompilerResult, ConstrainedToolSchema, ConstrainedToolSchemaMap, Diagnostic, DiagnosticCode, DiagnosticLocation, DiagnosticSeverity, ExecutionGraph, } from "./types";
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAUnD,OAAO,KAAK,EACX,cAAc,EACd,cAAc,EAId,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,eAAe,CACpC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE;IACT,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB,GACC,OAAO,CAAC,cAAc,CAAC,CAkEzB;AAiBD,YAAY,EACX,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,GACd,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { Diagnostic, ExecutionGraph } from "../types";
|
|
3
|
+
interface BestPracticeRuleResult {
|
|
4
|
+
workflow: WorkflowDefinition;
|
|
5
|
+
diagnostics: Diagnostic[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A best-practice rule that can non-destructively modify a workflow.
|
|
9
|
+
* Each rule receives a deep-cloned workflow and the execution graph,
|
|
10
|
+
* and returns the (possibly modified) workflow along with any diagnostics.
|
|
11
|
+
*/
|
|
12
|
+
export type BestPracticeRule = (workflow: WorkflowDefinition, graph: ExecutionGraph) => BestPracticeRuleResult;
|
|
13
|
+
/**
|
|
14
|
+
* Applies all registered best-practice rules to a deep copy of the workflow.
|
|
15
|
+
* The original workflow is never mutated.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyBestPractices(workflow: WorkflowDefinition, graph: ExecutionGraph): BestPracticeRuleResult;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=apply-best-practices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-best-practices.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/apply-best-practices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE3D,UAAU,sBAAsB;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC9B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,KACjB,sBAAsB,CAAC;AAQ5B;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,GACnB,sBAAsB,CAWxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { Diagnostic, ExecutionGraph } from "../types";
|
|
3
|
+
export declare function buildGraph(workflow: WorkflowDefinition): {
|
|
4
|
+
graph: ExecutionGraph | null;
|
|
5
|
+
diagnostics: Diagnostic[];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=build-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-graph.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/build-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAW3D,wBAAgB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG;IACzD,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,UAAU,EAAE,CAAC;CAC1B,CAuIA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { ConstrainedToolSchemaMap, ToolDefinitionMap } from "../types";
|
|
3
|
+
export declare function generateConstrainedToolSchemas(workflow: WorkflowDefinition, tools: ToolDefinitionMap): ConstrainedToolSchemaMap;
|
|
4
|
+
//# sourceMappingURL=generate-constrained-tool-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-constrained-tool-schemas.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/generate-constrained-tool-schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAEX,wBAAwB,EACxB,iBAAiB,EACjB,MAAM,UAAU,CAAC;AA4GlB,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,iBAAiB,GACtB,wBAAwB,CA0F1B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { Diagnostic, ExecutionGraph, ToolDefinitionMap } from "../types";
|
|
3
|
+
export declare function validateControlFlow(workflow: WorkflowDefinition, graph: ExecutionGraph, tools?: ToolDefinitionMap | null): Diagnostic[];
|
|
4
|
+
//# sourceMappingURL=validate-control-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-control-flow.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/validate-control-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG9E,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,EACrB,KAAK,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAC9B,UAAU,EAAE,CA8Jd"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { Diagnostic, ExecutionGraph, ToolDefinitionMap } from "../types";
|
|
3
|
+
export declare function validateForeachTarget(workflow: WorkflowDefinition, graph: ExecutionGraph, tools: ToolDefinitionMap): Diagnostic[];
|
|
4
|
+
//# sourceMappingURL=validate-foreach-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-foreach-target.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/validate-foreach-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAS9E,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,iBAAiB,GACtB,UAAU,EAAE,CA6Dd"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { Diagnostic, ExecutionGraph } from "../types";
|
|
3
|
+
export declare function validateJmespath(workflow: WorkflowDefinition, graph: ExecutionGraph): Diagnostic[];
|
|
4
|
+
//# sourceMappingURL=validate-jmespath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-jmespath.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/validate-jmespath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAa3D,wBAAgB,gBAAgB,CAC/B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,GACnB,UAAU,EAAE,CAyBd"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { CompilerLimits, Diagnostic } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Validates literal values in sleep/wait-for-condition steps against
|
|
5
|
+
* configured upper/lower bounds. Only checks expressions with
|
|
6
|
+
* type === 'literal' โ JMESPath expressions are unknown at compile time.
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateLimits(workflow: WorkflowDefinition, limits?: CompilerLimits): Diagnostic[];
|
|
9
|
+
//# sourceMappingURL=validate-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-limits.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/validate-limits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAU3D;;;;GAIG;AACH,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,CAAC,EAAE,cAAc,GACrB,UAAU,EAAE,CAqFd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-references.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/validate-references.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,UAAU,EAAE,CA0E7E"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from "../../types";
|
|
2
|
+
import type { Diagnostic, ToolDefinitionMap } from "../types";
|
|
3
|
+
export declare function validateTools(workflow: WorkflowDefinition, tools: ToolDefinitionMap): Diagnostic[];
|
|
4
|
+
//# sourceMappingURL=validate-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-tools.d.ts","sourceRoot":"","sources":["../../../src/compiler/passes/validate-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAgB,aAAa,CAC5B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,iBAAiB,GACtB,UAAU,EAAE,CAuEd"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { WorkflowDefinition, WorkflowStep } from "../types";
|
|
2
|
+
/** Severity level of a compiler diagnostic. */
|
|
3
|
+
export type DiagnosticSeverity = "error" | "warning";
|
|
4
|
+
/** Identifies the source location of a diagnostic within the workflow. */
|
|
5
|
+
export interface DiagnosticLocation {
|
|
6
|
+
/** The step that triggered the diagnostic, or `null` for workflow-level issues. */
|
|
7
|
+
stepId: string | null;
|
|
8
|
+
/** The field path within the step (e.g. `"params.toolInput.email"`). */
|
|
9
|
+
field: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Machine-readable code identifying the specific diagnostic.
|
|
13
|
+
* Useful for programmatic handling of compiler feedback.
|
|
14
|
+
*/
|
|
15
|
+
export type DiagnosticCode = "INVALID_STEP_ID" | "INVALID_ITEM_NAME" | "ITEM_NAME_SHADOWS_STEP_ID" | "DUPLICATE_STEP_ID" | "MISSING_INITIAL_STEP" | "MISSING_NEXT_STEP" | "MISSING_BRANCH_BODY_STEP" | "MISSING_LOOP_BODY_STEP" | "UNREACHABLE_STEP" | "CYCLE_DETECTED" | "UNCLOSED_TEMPLATE_EXPRESSION" | "JMESPATH_SYNTAX_ERROR" | "JMESPATH_INVALID_ROOT_REFERENCE" | "JMESPATH_FORWARD_REFERENCE" | "END_STEP_HAS_NEXT" | "BRANCH_BODY_ESCAPES" | "LOOP_BODY_ESCAPES" | "MULTIPLE_DEFAULT_CASES" | "UNKNOWN_TOOL" | "MISSING_TOOL_INPUT_KEY" | "EXTRA_TOOL_INPUT_KEY" | "MISSING_START_STEP" | "END_STEP_MISSING_OUTPUT" | "END_STEP_UNEXPECTED_OUTPUT" | "PATH_MISSING_END_STEP" | "LITERAL_OUTPUT_SHAPE_MISMATCH" | "FOREACH_TARGET_NOT_ARRAY" | "MISSING_CONDITION_BODY_STEP" | "CONDITION_BODY_ESCAPES" | "SLEEP_DURATION_EXCEEDS_LIMIT" | "WAIT_ATTEMPTS_EXCEEDS_LIMIT" | "WAIT_INTERVAL_EXCEEDS_LIMIT" | "BACKOFF_MULTIPLIER_OUT_OF_RANGE" | "WAIT_TIMEOUT_EXCEEDS_LIMIT";
|
|
16
|
+
/**
|
|
17
|
+
* A structured compiler diagnostic with a severity, location, human-readable message,
|
|
18
|
+
* and machine-readable code. Emitted during compilation to report errors and warnings.
|
|
19
|
+
*/
|
|
20
|
+
export interface Diagnostic {
|
|
21
|
+
severity: DiagnosticSeverity;
|
|
22
|
+
location: DiagnosticLocation;
|
|
23
|
+
/** A human-readable description of the issue. */
|
|
24
|
+
message: string;
|
|
25
|
+
code: DiagnosticCode;
|
|
26
|
+
}
|
|
27
|
+
/** JSON Schema representation of a tool's input and output. */
|
|
28
|
+
export interface ToolSchemaDefinition {
|
|
29
|
+
inputSchema: {
|
|
30
|
+
required?: string[];
|
|
31
|
+
properties?: Record<string, unknown>;
|
|
32
|
+
};
|
|
33
|
+
outputSchema?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/** Maps tool names to their schema definitions. */
|
|
36
|
+
export type ToolDefinitionMap = Record<string, ToolSchemaDefinition>;
|
|
37
|
+
/**
|
|
38
|
+
* DAG representation of a compiled workflow. Produced by the compiler's graph
|
|
39
|
+
* construction pass when the workflow is structurally valid.
|
|
40
|
+
*/
|
|
41
|
+
export interface ExecutionGraph {
|
|
42
|
+
/** Lookup from step ID to step definition. */
|
|
43
|
+
stepIndex: Map<string, WorkflowStep>;
|
|
44
|
+
/** Maps each step ID to the set of step IDs it transitions to. */
|
|
45
|
+
successors: Map<string, Set<string>>;
|
|
46
|
+
/** Maps each step ID to the set of step IDs that transition to it. */
|
|
47
|
+
predecessors: Map<string, Set<string>>;
|
|
48
|
+
/** Step IDs in topological order (respects data dependencies). */
|
|
49
|
+
topologicalOrder: string[];
|
|
50
|
+
/** Set of step IDs reachable from `initialStepId`. */
|
|
51
|
+
reachableSteps: Set<string>;
|
|
52
|
+
/** Maps each step ID to the set of loop variable names in scope at that step. */
|
|
53
|
+
loopVariablesInScope: Map<string, Set<string>>;
|
|
54
|
+
/** Maps body step IDs to the ID of the for-each or switch-case that owns them. */
|
|
55
|
+
bodyOwnership: Map<string, string>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A narrowed tool schema produced by the compiler showing which inputs are
|
|
59
|
+
* static (known at compile time) vs. dynamic (resolved at runtime). This
|
|
60
|
+
* enables safety reviews: a human can approve a limited set of behaviors
|
|
61
|
+
* before execution begins.
|
|
62
|
+
*/
|
|
63
|
+
export interface ConstrainedToolSchema {
|
|
64
|
+
/** The narrowed input schema, intersecting constraints from all call sites. */
|
|
65
|
+
inputSchema: {
|
|
66
|
+
required: string[];
|
|
67
|
+
properties: Record<string, unknown>;
|
|
68
|
+
};
|
|
69
|
+
outputSchema?: Record<string, unknown>;
|
|
70
|
+
/** True when ALL inputs across ALL call sites are literals โ safe for unsupervised execution. */
|
|
71
|
+
fullyStatic: boolean;
|
|
72
|
+
/** Step IDs that call this tool. */
|
|
73
|
+
callSites: string[];
|
|
74
|
+
}
|
|
75
|
+
/** Maps tool names to their constrained schemas. */
|
|
76
|
+
export type ConstrainedToolSchemaMap = Record<string, ConstrainedToolSchema>;
|
|
77
|
+
export interface CompilerLimits {
|
|
78
|
+
/** Upper bound for wait-for-condition maxAttempts. Default: Infinity (unbounded). */
|
|
79
|
+
maxAttempts?: number;
|
|
80
|
+
/** Upper bound for sleep durationMs and wait intervalMs in ms. Default: 300_000 (5 min). */
|
|
81
|
+
maxSleepMs?: number;
|
|
82
|
+
/** Upper bound for backoffMultiplier. Default: 2. */
|
|
83
|
+
maxBackoffMultiplier?: number;
|
|
84
|
+
/** Lower bound for backoffMultiplier. Default: 1. */
|
|
85
|
+
minBackoffMultiplier?: number;
|
|
86
|
+
/** Upper bound for wait-for-condition timeoutMs in ms. Default: 600_000 (10 min). */
|
|
87
|
+
maxTimeoutMs?: number;
|
|
88
|
+
}
|
|
89
|
+
/** The result of compiling a workflow definition. */
|
|
90
|
+
export interface CompilerResult {
|
|
91
|
+
/** Errors and warnings produced during compilation. */
|
|
92
|
+
diagnostics: Diagnostic[];
|
|
93
|
+
/** The execution graph, or `null` if the workflow has structural errors. */
|
|
94
|
+
graph: ExecutionGraph | null;
|
|
95
|
+
/** The optimized workflow with best-practice transformations applied, or `null` if there are errors. */
|
|
96
|
+
workflow: WorkflowDefinition | null;
|
|
97
|
+
/** Constrained tool schemas, or `null` if no tools were provided. */
|
|
98
|
+
constrainedToolSchemas: ConstrainedToolSchemaMap | null;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/compiler/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjE,+CAA+C;AAC/C,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;AAErD,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IAClC,mFAAmF;IACnF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACvB,iBAAiB,GACjB,mBAAmB,GACnB,2BAA2B,GAC3B,mBAAmB,GACnB,sBAAsB,GACtB,mBAAmB,GACnB,0BAA0B,GAC1B,wBAAwB,GACxB,kBAAkB,GAClB,gBAAgB,GAChB,8BAA8B,GAC9B,uBAAuB,GACvB,iCAAiC,GACjC,4BAA4B,GAC5B,mBAAmB,GACnB,qBAAqB,GACrB,mBAAmB,GACnB,wBAAw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epIndex(steps: WorkflowStep[]): {
|
|
3
|
+
index: Map<string, WorkflowStep>;
|
|
4
|
+
duplicates: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare function computeSuccessors(stepIndex: Map<string, WorkflowStep>): Map<string, Set<string>>;
|
|
7
|
+
export declare function computeReachability(initialStepId: string, successors: Map<string, Set<string>>): Set<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Detect cycles using DFS with white/gray/black coloring.
|
|
10
|
+
* Returns arrays of step IDs forming each detected cycle.
|
|
11
|
+
*/
|
|
12
|
+
export declare function detectCycles(stepIndex: Map<string, WorkflowStep>, successors: Map<string, Set<string>>): string[][];
|
|
13
|
+
/**
|
|
14
|
+
* Compute the set of predecessor step IDs for each step.
|
|
15
|
+
* A predecessor of step X is any step that must have executed before X
|
|
16
|
+
* in the execution order.
|
|
17
|
+
*
|
|
18
|
+
* This uses topological order: for each step, its predecessors are the
|
|
19
|
+
* union of all steps that can reach it via successor edges.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computePredecessors(topologicalOrder: string[], successors: Map<string, Set<string>>): Map<string, Set<string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Compute topological order using Kahn's algorithm.
|
|
24
|
+
* Returns null if cycles exist.
|
|
25
|
+
*/
|
|
26
|
+
export declare function topologicalSort(stepIds: string[], successors: Map<string, Set<string>>): string[] | null;
|
|
27
|
+
/**
|
|
28
|
+
* Walk the execution graph to determine which loop variables (itemName)
|
|
29
|
+
* are in scope at each step, and which steps belong to a body (loop or branch).
|
|
30
|
+
*/
|
|
31
|
+
export declare function computeLoopScopesAndOwnership(initialStepId: string, stepIndex: Map<string, WorkflowStep>): {
|
|
32
|
+
loopVariablesInScope: Map<string, Set<string>>;
|
|
33
|
+
bodyOwnership: Map<string, string>;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/compiler/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Y,CAAC,GAClC;IACF,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAqDA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate that a JMESPath expression is syntactically valid.
|
|
3
|
+
*/
|
|
4
|
+
export declare function validateJmespathSyntax(expression: string): {
|
|
5
|
+
valid: true;
|
|
6
|
+
} | {
|
|
7
|
+
valid: false;
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Extract root identifiers from a JMESPath AST.
|
|
12
|
+
* A "root identifier" is a Field node that represents a top-level
|
|
13
|
+
* reference (e.g., `stepId` in `stepId.field`, `foo` in `length(foo.bar)`).
|
|
14
|
+
*
|
|
15
|
+
* We walk the AST and collect Field nodes that appear in "root position" โ
|
|
16
|
+
* meaning they are the leftmost leaf in a chain of Subexpressions,
|
|
17
|
+
* or standalone fields, or the first field in a function argument.
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractRootIdentifiers(expression: string): string[];
|
|
20
|
+
export interface TemplateExpression {
|
|
21
|
+
expression: string;
|
|
22
|
+
start: number;
|
|
23
|
+
end: number;
|
|
24
|
+
}
|
|
25
|
+
export interface TemplateExtractionResult {
|
|
26
|
+
expressions: TemplateExpression[];
|
|
27
|
+
unclosed: number[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extract all ${...} template expressions from an llm-prompt template string.
|
|
31
|
+
* Also reports positions of unclosed ${ sequences.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractTemplateExpressions(template: string): TemplateExtractionResult;
|
|
34
|
+
//# sourceMappingURL=jmespath-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jmespath-helpers.d.ts","sourceRoot":"","sources":["../../../src/compiler/utils/jmespath-helpers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,MAAM,GAChB;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAOnD;AAYD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAWnE;AAmID,MAAM,WAAW,kBAAkB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,wBAAwB;IACxC,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,MAAM,GACd,wBAAwB,CA+B1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WorkflowDefinition, WorkflowStep } from "../../types";
|
|
2
|
+
import type { ExecutionGraph, ToolDefinitionMap } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Parse a simple dotted JMESPath expression (e.g. "step_id.field.nested")
|
|
5
|
+
* into path segments. Returns null for complex expressions (filters,
|
|
6
|
+
* projections, functions, etc.).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseSimplePath(expression: string): string[] | null;
|
|
9
|
+
/**
|
|
10
|
+
* Walk a JSON Schema along a dotted path, resolving through `properties`
|
|
11
|
+
* at each segment. Returns null if the path can't be resolved.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolvePath(schema: Record<string, unknown>, path: string[]): Record<string, unknown> | null;
|
|
14
|
+
/**
|
|
15
|
+
* Extract the `type` string from a JSON Schema object.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSchemaType(schema: Record<string, unknown>): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Find property names in a schema that are arrays.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findArrayProperties(schema: Record<string, unknown>): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the output schema of a workflow step. Returns null if the
|
|
24
|
+
* output schema is unknown or can't be determined statically.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getStepOutputSchema(step: WorkflowStep, tools: ToolDefinitionMap | null, workflow: WorkflowDefinition, graph: ExecutionGraph): Record<string, unknown> | null;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve a JMESPath output expression to a JSON Schema by tracing
|
|
29
|
+
* through step output schemas. Only handles simple dotted paths.
|
|
30
|
+
* Returns null for complex expressions or when schemas are unavailable.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveExpressionSchema(expression: string, _endStepId: string, tools: ToolDefinitionMap | null, workflow: WorkflowDefinition, graph: ExecutionGraph): Record<string, unknown> | null;
|
|
33
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/compiler/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAKnE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,EAAE,MAAM,EAAE,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAUhC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAG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