38ce04790a
Adds a compile-only JavaScript/TypeScript authoring path that extracts a JSON-compatible workflow({...}) object, lowers it to the existing WorkflowSpec IR, and runs the Rust validation gate before execution.
Includes a branch/reduce .workflow.js example and a short authoring design note comparing YAML/JSON, Starlark, JavaScript, and TypeScript. The compiler rejects effectful JavaScript constructs instead of executing workflow source as a second runtime.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
export default workflow({
|
|
"id": "issue-audit-js",
|
|
"goal": "Audit an issue fix with parallel specialist agents, then synthesize a release note",
|
|
"description": "Declarative JavaScript authoring example lowered to typed WhaleFlow IR without executing JS.",
|
|
"nodes": [
|
|
{
|
|
"branch": {
|
|
"id": "parallel-audit",
|
|
"parallel": true,
|
|
"children": [
|
|
{
|
|
"agent": {
|
|
"id": "code-audit",
|
|
"prompt": "Inspect the implementation for correctness and regression risk.",
|
|
"agent_type": "review",
|
|
"mode": "read_only",
|
|
"file_scope": ["crates"]
|
|
}
|
|
},
|
|
{
|
|
"agent": {
|
|
"id": "test-audit",
|
|
"prompt": "Inspect targeted tests and identify missing verification.",
|
|
"agent_type": "verifier",
|
|
"mode": "read_only",
|
|
"file_scope": ["crates", "tests"],
|
|
"budget": { "max_steps": 4, "timeout_secs": 300 }
|
|
}
|
|
},
|
|
{
|
|
"agent": {
|
|
"id": "docs-audit",
|
|
"prompt": "Check whether docs or release notes should mention the change.",
|
|
"agent_type": "review",
|
|
"mode": "read_only",
|
|
"file_scope": ["docs"]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"reduce": {
|
|
"id": "synthesize-release-risk",
|
|
"inputs": ["code-audit", "test-audit", "docs-audit"],
|
|
"prompt": "Combine specialist findings into a release-ready risk summary."
|
|
}
|
|
}
|
|
]
|
|
});
|