@bastani/atomic 0.9.0-alpha.1 → 0.9.0-alpha.3
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/CHANGELOG.md +29 -0
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +19 -0
- package/dist/builtin/workflows/README.md +189 -122
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +30 -27
- package/dist/builtin/workflows/builtin/goal-ledger.ts +2 -0
- package/dist/builtin/workflows/builtin/goal-reports.ts +5 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +17 -20
- package/dist/builtin/workflows/builtin/goal-types.ts +2 -0
- package/dist/builtin/workflows/builtin/goal.d.ts +1 -0
- package/dist/builtin/workflows/builtin/goal.ts +40 -44
- package/dist/builtin/workflows/builtin/index.d.ts +1 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +16 -17
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +42 -50
- package/dist/builtin/workflows/builtin/prompt-refinement.ts +102 -0
- package/dist/builtin/workflows/builtin/ralph-core.ts +6 -4
- package/dist/builtin/workflows/builtin/ralph-runner.ts +22 -24
- package/dist/builtin/workflows/builtin/ralph.d.ts +2 -0
- package/dist/builtin/workflows/builtin/ralph.ts +46 -41
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/authoring/typebox-defaults.d.ts +41 -0
- package/dist/builtin/workflows/src/authoring/typebox-defaults.ts +217 -0
- package/dist/builtin/workflows/src/authoring/workflow.ts +184 -0
- package/dist/builtin/workflows/src/authoring.d.ts +14 -66
- package/dist/builtin/workflows/src/engine/graph-inference.ts +100 -0
- package/dist/builtin/workflows/src/engine/options.ts +40 -0
- package/dist/builtin/workflows/src/engine/primitives/chain.ts +29 -0
- package/dist/builtin/workflows/src/engine/primitives/exit.ts +2 -0
- package/dist/builtin/workflows/src/engine/primitives/parallel.ts +47 -0
- package/dist/builtin/workflows/src/engine/primitives/task.ts +108 -0
- package/dist/builtin/workflows/src/engine/primitives/ui.ts +41 -0
- package/dist/builtin/workflows/src/engine/primitives/workflow.ts +159 -0
- package/dist/builtin/workflows/src/engine/replay.ts +8 -0
- package/dist/builtin/workflows/src/engine/run.ts +356 -0
- package/dist/builtin/workflows/src/engine/runtime.ts +160 -0
- package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +9 -3
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -1
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +0 -18
- package/dist/builtin/workflows/src/index.ts +0 -2
- package/dist/builtin/workflows/src/runs/background/runner.ts +6 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +3 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-child-helpers.ts +4 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-child-workflow.ts +1 -158
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-outputs.ts +2 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-run.ts +1 -359
- package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +2 -5
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +12 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +4 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +9 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-task-context.ts +2 -132
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +2 -2
- package/dist/builtin/workflows/src/runs/shared/graph-inference.ts +2 -100
- package/dist/builtin/workflows/src/sdk-surface.ts +6 -9
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +9 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +17 -3
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +3 -33
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +9 -81
- package/dist/builtin/workflows/src/shared/types.ts +25 -8
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +49 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +84 -0
- package/dist/builtin/workflows/src/workflows/registry.ts +7 -3
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +6 -1
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +0 -5
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +0 -2
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +0 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +0 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +0 -2
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +0 -2
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +0 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +0 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +1 -1
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts +1 -3
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +13 -6
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts +7 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +34 -2
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +2 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +2 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +0 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js +6 -0
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-schemas.d.ts +65 -13
- package/dist/core/model-registry-schemas.d.ts.map +1 -1
- package/dist/core/model-registry-schemas.js +10 -0
- package/dist/core/model-registry-schemas.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -0
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +2 -0
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +3 -3
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-internals.d.ts +1 -0
- package/dist/core/resource-loader-internals.d.ts.map +1 -1
- package/dist/core/resource-loader-internals.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +6 -2
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +1 -1
- package/dist/core/sdk-exports.d.ts.map +1 -1
- package/dist/core/sdk-exports.js.map +1 -1
- package/dist/core/sdk-types.d.ts +0 -3
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +0 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +2 -1
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +0 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +0 -5
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +10 -11
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff-preserve.d.ts +18 -0
- package/dist/core/tools/edit-diff-preserve.d.ts.map +1 -0
- package/dist/core/tools/edit-diff-preserve.js +85 -0
- package/dist/core/tools/edit-diff-preserve.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +3 -2
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +15 -18
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/index.d.ts +0 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +0 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/model-search.d.ts +5 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -1
- package/dist/modes/interactive/model-search.js +9 -0
- package/dist/modes/interactive/model-search.js.map +1 -1
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +12 -5
- package/dist/utils/shell.js.map +1 -1
- package/docs/custom-provider.md +4 -3
- package/docs/models.md +3 -2
- package/docs/packages.md +2 -2
- package/docs/quickstart.md +1 -1
- package/docs/sdk.md +2 -40
- package/docs/security.md +1 -1
- package/docs/workflows.md +991 -176
- package/package.json +5 -5
- package/dist/builtin/workflows/src/workflows/define-workflow.ts +0 -277
- package/dist/core/tools/bash-policy-compile.d.ts +0 -5
- package/dist/core/tools/bash-policy-compile.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-compile.js +0 -241
- package/dist/core/tools/bash-policy-compile.js.map +0 -1
- package/dist/core/tools/bash-policy-evaluate.d.ts +0 -3
- package/dist/core/tools/bash-policy-evaluate.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-evaluate.js +0 -92
- package/dist/core/tools/bash-policy-evaluate.js.map +0 -1
- package/dist/core/tools/bash-policy-format.d.ts +0 -5
- package/dist/core/tools/bash-policy-format.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-format.js +0 -49
- package/dist/core/tools/bash-policy-format.js.map +0 -1
- package/dist/core/tools/bash-policy-parser.d.ts +0 -4
- package/dist/core/tools/bash-policy-parser.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-parser.js +0 -155
- package/dist/core/tools/bash-policy-parser.js.map +0 -1
- package/dist/core/tools/bash-policy-segment.d.ts +0 -3
- package/dist/core/tools/bash-policy-segment.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-segment.js +0 -275
- package/dist/core/tools/bash-policy-segment.js.map +0 -1
- package/dist/core/tools/bash-policy-shell.d.ts +0 -11
- package/dist/core/tools/bash-policy-shell.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-shell.js +0 -267
- package/dist/core/tools/bash-policy-shell.js.map +0 -1
- package/dist/core/tools/bash-policy-types.d.ts +0 -146
- package/dist/core/tools/bash-policy-types.d.ts.map +0 -1
- package/dist/core/tools/bash-policy-types.js +0 -2
- package/dist/core/tools/bash-policy-types.js.map +0 -1
- package/dist/core/tools/bash-policy.d.ts +0 -6
- package/dist/core/tools/bash-policy.d.ts.map +0 -1
- package/dist/core/tools/bash-policy.js +0 -5
- package/dist/core/tools/bash-policy.js.map +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { RunSnapshot } from "../shared/store-types.js";
|
|
2
|
+
import type { Store } from "../shared/store.js";
|
|
3
|
+
import type { StageOptions } from "../shared/types.js";
|
|
4
|
+
import type { ConcurrencyLimiter } from "../runs/shared/concurrency.js";
|
|
5
|
+
import type { ParallelFailFastScope } from "../runs/foreground/executor-types.js";
|
|
6
|
+
import type { WorkflowExitManager } from "../runs/foreground/executor-exit-manager.js";
|
|
7
|
+
import type { ContinuationReplayIndex } from "../runs/foreground/executor-continuation.js";
|
|
8
|
+
import type { StageScheduler } from "../runs/foreground/executor-scheduler.js";
|
|
9
|
+
import type { StageControlRegistry } from "../runs/foreground/stage-control-registry.js";
|
|
10
|
+
import type { StageAdapters } from "../runs/foreground/stage-runner.js";
|
|
11
|
+
import type { LiveStageRuntime, StageMcpScope, StageContextWithMeta } from "../runs/foreground/executor-stage-types.js";
|
|
12
|
+
import { createWorkflowStageFactory } from "../runs/foreground/executor-stage-factory.js";
|
|
13
|
+
import { createWorkflowBoundaryFactory, type WorkflowBoundaryStage } from "../runs/foreground/executor-child-boundary.js";
|
|
14
|
+
import type { GraphFrontierTracker } from "./graph-inference.js";
|
|
15
|
+
import type { EngineChildRunOptions, EngineStageRuntimeOptions, EngineWorkflowBoundaryOptions } from "./options.js";
|
|
16
|
+
|
|
17
|
+
export interface EngineRuntimeInput {
|
|
18
|
+
readonly runId: string;
|
|
19
|
+
readonly depth: number;
|
|
20
|
+
readonly runSnapshot: RunSnapshot;
|
|
21
|
+
readonly activeStore: Store;
|
|
22
|
+
readonly stageOptions: EngineStageRuntimeOptions;
|
|
23
|
+
readonly workflowBoundaryOptions: EngineWorkflowBoundaryOptions;
|
|
24
|
+
readonly childRunOptions: EngineChildRunOptions;
|
|
25
|
+
readonly parentRootRunId?: string;
|
|
26
|
+
readonly adapters: StageAdapters;
|
|
27
|
+
readonly signal: AbortSignal;
|
|
28
|
+
readonly tracker: GraphFrontierTracker;
|
|
29
|
+
readonly scheduler: StageScheduler;
|
|
30
|
+
readonly replayIndex: ContinuationReplayIndex;
|
|
31
|
+
readonly limiter: ConcurrencyLimiter;
|
|
32
|
+
readonly inputRuntimeDefaults: Partial<StageOptions>;
|
|
33
|
+
readonly workflowInvocationCwd: string;
|
|
34
|
+
readonly stageRegistry: StageControlRegistry;
|
|
35
|
+
readonly exit: WorkflowExitManager;
|
|
36
|
+
readonly classifyExecutorFailure: LiveStageRuntime["classifyExecutorFailure"];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface EngineSpawnAgentStageOptions {
|
|
40
|
+
readonly kind?: "agent";
|
|
41
|
+
readonly options?: StageOptions;
|
|
42
|
+
readonly failFastScope?: ParallelFailFastScope;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface EngineSpawnWorkflowBoundaryOptions {
|
|
46
|
+
readonly kind: "workflow-boundary";
|
|
47
|
+
readonly replayKey: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type EngineSpawnStageOptions = EngineSpawnAgentStageOptions | EngineSpawnWorkflowBoundaryOptions;
|
|
51
|
+
|
|
52
|
+
export interface EngineAgentStageHandle {
|
|
53
|
+
readonly kind: "agent";
|
|
54
|
+
readonly context: StageContextWithMeta;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface EngineWorkflowBoundaryHandle {
|
|
58
|
+
readonly kind: "workflow-boundary";
|
|
59
|
+
readonly boundary: WorkflowBoundaryStage;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type StageHandle = EngineAgentStageHandle | EngineWorkflowBoundaryHandle;
|
|
63
|
+
|
|
64
|
+
export class EngineRuntime {
|
|
65
|
+
readonly runId: string;
|
|
66
|
+
readonly depth: number;
|
|
67
|
+
readonly activeStore: Store;
|
|
68
|
+
readonly childRunOptions: EngineChildRunOptions;
|
|
69
|
+
readonly parentRootRunId?: string;
|
|
70
|
+
readonly adapters: StageAdapters;
|
|
71
|
+
readonly signal: AbortSignal;
|
|
72
|
+
readonly tracker: GraphFrontierTracker;
|
|
73
|
+
readonly exit: WorkflowExitManager;
|
|
74
|
+
readonly inputRuntimeDefaults: Partial<StageOptions>;
|
|
75
|
+
readonly workflowInvocationCwd: string;
|
|
76
|
+
|
|
77
|
+
private readonly spawnAgentStage: (
|
|
78
|
+
name: string,
|
|
79
|
+
options?: StageOptions,
|
|
80
|
+
stageFailFastScope?: ParallelFailFastScope,
|
|
81
|
+
) => StageContextWithMeta;
|
|
82
|
+
private readonly spawnWorkflowBoundary: (name: string, replayKey: string) => WorkflowBoundaryStage;
|
|
83
|
+
|
|
84
|
+
constructor(input: EngineRuntimeInput) {
|
|
85
|
+
this.runId = input.runId;
|
|
86
|
+
this.depth = input.depth;
|
|
87
|
+
this.activeStore = input.activeStore;
|
|
88
|
+
this.childRunOptions = input.childRunOptions;
|
|
89
|
+
this.parentRootRunId = input.parentRootRunId;
|
|
90
|
+
this.adapters = input.adapters;
|
|
91
|
+
this.signal = input.signal;
|
|
92
|
+
this.tracker = input.tracker;
|
|
93
|
+
this.exit = input.exit;
|
|
94
|
+
this.inputRuntimeDefaults = input.inputRuntimeDefaults;
|
|
95
|
+
this.workflowInvocationCwd = input.workflowInvocationCwd;
|
|
96
|
+
|
|
97
|
+
// The runtime only wires host-injected ports; stage sessions are still
|
|
98
|
+
// created lazily by the stage runner through input.adapters.agentSession.
|
|
99
|
+
this.spawnAgentStage = createWorkflowStageFactory({
|
|
100
|
+
runId: input.runId,
|
|
101
|
+
activeStore: input.activeStore,
|
|
102
|
+
opts: input.stageOptions,
|
|
103
|
+
adapters: input.adapters,
|
|
104
|
+
signal: input.signal,
|
|
105
|
+
tracker: input.tracker,
|
|
106
|
+
scheduler: input.scheduler,
|
|
107
|
+
replayIndex: input.replayIndex,
|
|
108
|
+
limiter: input.limiter,
|
|
109
|
+
inputRuntimeDefaults: input.inputRuntimeDefaults,
|
|
110
|
+
workflowInvocationCwd: input.workflowInvocationCwd,
|
|
111
|
+
stageRegistry: input.stageRegistry,
|
|
112
|
+
exit: input.exit,
|
|
113
|
+
classifyExecutorFailure: input.classifyExecutorFailure,
|
|
114
|
+
createMcpScope: (stageId, options) => this.createMcpScope(stageId, options),
|
|
115
|
+
});
|
|
116
|
+
this.spawnWorkflowBoundary = createWorkflowBoundaryFactory({
|
|
117
|
+
runId: input.runId,
|
|
118
|
+
runSnapshot: input.runSnapshot,
|
|
119
|
+
activeStore: input.activeStore,
|
|
120
|
+
opts: input.workflowBoundaryOptions,
|
|
121
|
+
tracker: input.tracker,
|
|
122
|
+
replayIndex: input.replayIndex,
|
|
123
|
+
registerWorkflowExitCleanup: input.exit.registerWorkflowExitCleanup,
|
|
124
|
+
workflowExitSkippedReason: input.exit.workflowExitSkippedReason,
|
|
125
|
+
classifyExecutorFailure: input.classifyExecutorFailure,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
spawnStage(name: string, opts: EngineSpawnWorkflowBoundaryOptions): EngineWorkflowBoundaryHandle;
|
|
130
|
+
spawnStage(name: string, opts?: EngineSpawnAgentStageOptions): EngineAgentStageHandle;
|
|
131
|
+
spawnStage(name: string, opts: EngineSpawnStageOptions = {}): StageHandle {
|
|
132
|
+
if (opts.kind === "workflow-boundary") {
|
|
133
|
+
return { kind: "workflow-boundary", boundary: this.spawnWorkflowBoundary(name, opts.replayKey) };
|
|
134
|
+
}
|
|
135
|
+
return { kind: "agent", context: this.spawnAgentStage(name, opts.options, opts.failFastScope) };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
readonly stage = (name: string, options?: StageOptions, failFastScope?: ParallelFailFastScope): StageContextWithMeta => {
|
|
139
|
+
const handle = this.spawnStage(name, {
|
|
140
|
+
kind: "agent",
|
|
141
|
+
...(options !== undefined ? { options } : {}),
|
|
142
|
+
...(failFastScope !== undefined ? { failFastScope } : {}),
|
|
143
|
+
});
|
|
144
|
+
return handle.context;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
private createMcpScope(stageId: string, options: StageOptions | undefined): StageMcpScope {
|
|
148
|
+
const allow = options?.mcp?.allow ?? null;
|
|
149
|
+
const deny = options?.mcp?.deny ?? null;
|
|
150
|
+
const hasScope = allow !== null || deny !== null;
|
|
151
|
+
return {
|
|
152
|
+
apply: () => {
|
|
153
|
+
if (this.childRunOptions.mcp && hasScope) this.childRunOptions.mcp.setScope(stageId, allow, deny);
|
|
154
|
+
},
|
|
155
|
+
clear: () => {
|
|
156
|
+
if (this.childRunOptions.mcp && hasScope) this.childRunOptions.mcp.clearScope(stageId);
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createJiti } from "jiti/static";
|
|
10
|
+
import * as typeboxModule from "typebox";
|
|
10
11
|
import * as workflowsSdkSurface from "../sdk-surface.js";
|
|
11
|
-
import { isBrandedWorkflowDefinition } from "../
|
|
12
|
+
import { isBrandedWorkflowDefinition } from "../authoring/workflow.js";
|
|
12
13
|
import deepResearchCodebase from "../../builtin/deep-research-codebase.js";
|
|
13
14
|
import goal from "../../builtin/goal.js";
|
|
14
15
|
import openClaudeDesign from "../../builtin/open-claude-design.js";
|
|
@@ -16,6 +17,7 @@ import ralph from "../../builtin/ralph.js";
|
|
|
16
17
|
|
|
17
18
|
const WORKFLOWS_MODULE_SPECIFIER = "@bastani/workflows";
|
|
18
19
|
const WORKFLOWS_BUILTIN_MODULE_SPECIFIER = `${WORKFLOWS_MODULE_SPECIFIER}/builtin`;
|
|
20
|
+
const TYPEBOX_MODULE_SPECIFIER = "typebox";
|
|
19
21
|
// Keep this in sync with index.ts through sdk-surface.ts.
|
|
20
22
|
const WORKFLOWS_SDK_MODULE: Record<string, unknown> = {
|
|
21
23
|
...workflowsSdkSurface,
|
|
@@ -26,9 +28,13 @@ const WORKFLOWS_BUILTIN_MODULE: Record<string, unknown> = {
|
|
|
26
28
|
openClaudeDesign,
|
|
27
29
|
ralph,
|
|
28
30
|
};
|
|
31
|
+
const TYPEBOX_MODULE: Record<string, unknown> = {
|
|
32
|
+
...typeboxModule,
|
|
33
|
+
};
|
|
29
34
|
const WORKFLOWS_VIRTUAL_MODULES: Record<string, unknown> = {
|
|
30
35
|
[WORKFLOWS_MODULE_SPECIFIER]: WORKFLOWS_SDK_MODULE,
|
|
31
36
|
[WORKFLOWS_BUILTIN_MODULE_SPECIFIER]: WORKFLOWS_BUILTIN_MODULE,
|
|
37
|
+
[TYPEBOX_MODULE_SPECIFIER]: TYPEBOX_MODULE,
|
|
32
38
|
[`${WORKFLOWS_BUILTIN_MODULE_SPECIFIER}/deep-research-codebase`]: { default: deepResearchCodebase },
|
|
33
39
|
[`${WORKFLOWS_BUILTIN_MODULE_SPECIFIER}/goal`]: { default: goal },
|
|
34
40
|
[`${WORKFLOWS_BUILTIN_MODULE_SPECIFIER}/open-claude-design`]: { default: openClaudeDesign },
|
|
@@ -95,10 +101,10 @@ export function validateWorkflowDefinitionShape(value: unknown): string | null {
|
|
|
95
101
|
const d = value as Record<string, unknown>;
|
|
96
102
|
|
|
97
103
|
if (d["__piWorkflow"] !== true) {
|
|
98
|
-
return "missing or incorrect __piWorkflow sentinel (expected true); export a workflow from
|
|
104
|
+
return "missing or incorrect __piWorkflow sentinel (expected true); export a workflow from workflow({...})";
|
|
99
105
|
}
|
|
100
106
|
if (!isBrandedWorkflowDefinition(value)) {
|
|
101
|
-
return "workflow definition is not produced by
|
|
107
|
+
return "workflow definition is not produced by workflow({...}); hand-rolled __piWorkflow objects are not supported";
|
|
102
108
|
}
|
|
103
109
|
if (typeof d["name"] !== "string" || (d["name"] as string).trim().length === 0) {
|
|
104
110
|
return "name must be a non-empty string";
|
|
@@ -19,5 +19,7 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
|
|
|
19
19
|
- For transcripts, avoid reading whole session transcripts at once. Use \`stages\` or \`stage\` to get \`sessionFile\`/\`transcriptPath\`, quote the exact path without rewriting separators (preserve Windows backslashes), search it with \`rg\`/\`grep\`, and read small relevant ranges; use \`transcript\` with explicit \`tail\` or \`limit\` only for quick recent-context checks.
|
|
20
20
|
- If a user asks to create or edit a workflow, use the create-spec skill when available and ask detailed clarifying questions until you understand its purpose, inputs, stages, handoffs, validation, success criteria, and selected starter pattern. Then read the workflow docs/examples and implement the workflow from the created spec directly as a TypeScript definition. After you implement the workflow, reload it to access it and run it with test inputs to validate it works as intended before presenting it to the user.
|
|
21
21
|
- Tip: when designing workflows, implement it in a way that you pass information from stage to stage by writing it to a file or artifact (either deterministic or model-driven), pass the path with \`reads\`, and explicitly prompt the downstream agent with wording like \`Read the file at <path>...\`; do not inject large \`previous\` payloads or session history into the next prompt unless explicitly requested to.
|
|
22
|
-
-
|
|
22
|
+
- Prefer using the \`goal\` workflow for small fixes/quick fixes and the \`ralph\` workflow for tasks that are non-trivial (over 2K LoC estimated diff).
|
|
23
|
+
- Adjust the \`max_loops\` based on task complexity (estimated LoC and number of unique files that are touched).
|
|
24
|
+
- Define an objective that includes tight scope, concrete and verifiable done criteria, and validation steps; then monitor progress as above instead of doing parallel implementation yourself.`,
|
|
23
25
|
];
|
|
@@ -43,23 +43,6 @@ const JsonSchemaObject = Type.Unsafe<Record<string, unknown>>({
|
|
|
43
43
|
description: "Plain JSON Schema used as final-answer tool arguments for this workflow item.",
|
|
44
44
|
});
|
|
45
45
|
|
|
46
|
-
const BashCommandRuleSchema = Type.Union([
|
|
47
|
-
Type.String(),
|
|
48
|
-
Type.Object({ prefix: Type.String() }, { additionalProperties: false }),
|
|
49
|
-
Type.Object({ glob: Type.String() }, { additionalProperties: false }),
|
|
50
|
-
Type.Object({
|
|
51
|
-
regex: Type.String(),
|
|
52
|
-
flags: Type.Optional(Type.String()),
|
|
53
|
-
}, { additionalProperties: false }),
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
const BashCommandPolicySchema = Type.Object({
|
|
57
|
-
default: Type.Optional(Type.Union([Type.Literal("allow"), Type.Literal("deny")])),
|
|
58
|
-
allow: Type.Optional(Type.Array(BashCommandRuleSchema)),
|
|
59
|
-
deny: Type.Optional(Type.Array(BashCommandRuleSchema)),
|
|
60
|
-
match: Type.Optional(Type.Union([Type.Literal("whole"), Type.Literal("segments")])),
|
|
61
|
-
}, { additionalProperties: false });
|
|
62
|
-
|
|
63
46
|
const StageSessionOptionProperties = {
|
|
64
47
|
schema: Type.Optional(JsonSchemaObject),
|
|
65
48
|
cwd: Type.Optional(Type.String()),
|
|
@@ -76,7 +59,6 @@ const StageSessionOptionProperties = {
|
|
|
76
59
|
})),
|
|
77
60
|
tools: Type.Optional(Type.Array(Type.String())),
|
|
78
61
|
customTools: Type.Optional(Type.Array(SdkSessionOptionArrayElementSchema("customTools"))),
|
|
79
|
-
bashPolicy: Type.Optional(BashCommandPolicySchema),
|
|
80
62
|
resourceLoader: Type.Optional(SdkSessionOptionSchema("resourceLoader")),
|
|
81
63
|
sessionManager: Type.Optional(SdkSessionOptionSchema("sessionManager")),
|
|
82
64
|
settingsManager: Type.Optional(SdkSessionOptionSchema("settingsManager")),
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* cross-ref: spec detached-runner
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import type { WorkflowDefinition, WorkflowExecutionMode, WorkflowInputValues } from "../../shared/types.js";
|
|
17
|
+
import type { WorkflowDefinition, WorkflowExecutionMode, WorkflowInputValues, WorkflowOutputValues } from "../../shared/types.js";
|
|
18
18
|
import type { RunOpts, RunResult } from "../foreground/executor.js";
|
|
19
19
|
import type { CancellationRegistry } from "./cancellation-registry.js";
|
|
20
20
|
import type { JobTracker } from "./job-tracker.js";
|
|
@@ -85,8 +85,11 @@ export function buildDetachedAccepted(
|
|
|
85
85
|
* the store remains source of truth for run status. Cancellation is wired
|
|
86
86
|
* through the provided (or default) CancellationRegistry.
|
|
87
87
|
*/
|
|
88
|
-
export function runDetached<
|
|
89
|
-
|
|
88
|
+
export function runDetached<
|
|
89
|
+
TInputs extends WorkflowInputValues,
|
|
90
|
+
TRunInputs extends WorkflowInputValues = TInputs,
|
|
91
|
+
>(
|
|
92
|
+
def: WorkflowDefinition<TInputs, WorkflowOutputValues, TRunInputs>,
|
|
90
93
|
inputs: Readonly<Record<string, unknown>>,
|
|
91
94
|
opts: DetachedRunOpts = {},
|
|
92
95
|
): DetachedAccepted {
|
|
@@ -4,12 +4,12 @@ import type { WorkflowChildResult } from "../../shared/types.js";
|
|
|
4
4
|
import { appendStageEnd, appendStageStart } from "../../shared/persistence-session-entries.js";
|
|
5
5
|
import { elapsedStageMs } from "../../shared/timing.js";
|
|
6
6
|
import type { WorkflowFailure } from "../../shared/workflow-failures.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { EngineWorkflowBoundaryOptions } from "../../engine/options.js";
|
|
8
8
|
import type { ContinuationReplayIndex } from "./executor-continuation.js";
|
|
9
9
|
import { sameStringSet } from "./executor-continuation.js";
|
|
10
10
|
import { applyFailureToStage, stageReplayFields } from "./executor-lifecycle.js";
|
|
11
11
|
import { cloneWorkflowChildReplaySnapshot, cloneWorkflowChildValue } from "./executor-child-helpers.js";
|
|
12
|
-
import type { GraphFrontierTracker } from "
|
|
12
|
+
import type { GraphFrontierTracker } from "../../engine/graph-inference.js";
|
|
13
13
|
import type { WorkflowExitCleanup } from "./executor-types.js";
|
|
14
14
|
import { makeParentWorkflowExitAbortReason } from "./executor-abort.js";
|
|
15
15
|
|
|
@@ -71,7 +71,7 @@ export function createWorkflowBoundaryFactory(input: {
|
|
|
71
71
|
readonly runId: string;
|
|
72
72
|
readonly runSnapshot: RunSnapshot;
|
|
73
73
|
readonly activeStore: Store;
|
|
74
|
-
readonly opts:
|
|
74
|
+
readonly opts: EngineWorkflowBoundaryOptions;
|
|
75
75
|
readonly tracker: GraphFrontierTracker;
|
|
76
76
|
readonly replayIndex: ContinuationReplayIndex;
|
|
77
77
|
readonly registerWorkflowExitCleanup: (stageId: string, cleanup: WorkflowExitCleanup) => () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBrandedWorkflowDefinition } from "../../
|
|
1
|
+
import { isBrandedWorkflowDefinition } from "../../authoring/workflow.js";
|
|
2
2
|
import type {
|
|
3
3
|
WorkflowChildResult,
|
|
4
4
|
WorkflowDefinition,
|
|
@@ -16,7 +16,7 @@ function workflowChildSerializationMessage(err: unknown): string {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function isWorkflowDefinition(value: unknown): value is WorkflowDefinition {
|
|
19
|
-
if (!isBrandedWorkflowDefinition(value)) return false;
|
|
19
|
+
if (value === null || typeof value !== "object" || !isBrandedWorkflowDefinition(value)) return false;
|
|
20
20
|
const record = value as Partial<WorkflowDefinition>;
|
|
21
21
|
return record.__piWorkflow === true &&
|
|
22
22
|
typeof record.name === "string" && record.name.trim().length > 0 &&
|
|
@@ -27,9 +27,9 @@ export function isWorkflowDefinition(value: unknown): value is WorkflowDefinitio
|
|
|
27
27
|
|
|
28
28
|
export function workflowDefinitionRequirementMessage(callSite: string, value: unknown): string {
|
|
29
29
|
if (value !== null && typeof value === "object" && (value as { __piWorkflow?: unknown }).__piWorkflow === true) {
|
|
30
|
-
return `atomic-workflows: ${callSite} requires a
|
|
30
|
+
return `atomic-workflows: ${callSite} requires a workflow definition produced by workflow({...}); hand-rolled __piWorkflow objects are not supported`;
|
|
31
31
|
}
|
|
32
|
-
return `atomic-workflows: ${callSite} requires a
|
|
32
|
+
return `atomic-workflows: ${callSite} requires a workflow definition`;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function cloneWorkflowChildReplaySnapshot(snapshot: WorkflowChildReplaySnapshot): WorkflowChildReplaySnapshot {
|
|
@@ -1,158 +1 @@
|
|
|
1
|
-
|
|
2
|
-
WorkflowChildResult,
|
|
3
|
-
WorkflowDefinition,
|
|
4
|
-
WorkflowInputValues,
|
|
5
|
-
WorkflowOutputValues,
|
|
6
|
-
WorkflowRunChildOptions,
|
|
7
|
-
} from "../../shared/types.js";
|
|
8
|
-
import type { WorkflowChildRunRef } from "../../shared/store-types.js";
|
|
9
|
-
import type { RunOpts, RunResult } from "./executor-types.js";
|
|
10
|
-
import type { WorkflowExitManager } from "./executor-exit-manager.js";
|
|
11
|
-
import type { WorkflowBoundaryStage } from "./executor-child-boundary.js";
|
|
12
|
-
import { findWorkflowExitSignal, isWorkflowExitStatus, makeParentWorkflowExitAbortReason } from "./executor-abort.js";
|
|
13
|
-
import { selectWorkflowOutputs } from "./executor-outputs.js";
|
|
14
|
-
import { resolveAndValidateInputs } from "./executor-inputs.js";
|
|
15
|
-
import {
|
|
16
|
-
isWorkflowDefinition,
|
|
17
|
-
workflowChildReplaySnapshot,
|
|
18
|
-
workflowDefinitionRequirementMessage,
|
|
19
|
-
} from "./executor-child-helpers.js";
|
|
20
|
-
|
|
21
|
-
export function createChildWorkflowRunner(input: {
|
|
22
|
-
readonly runId: string;
|
|
23
|
-
readonly depth: number;
|
|
24
|
-
readonly opts: RunOpts;
|
|
25
|
-
readonly exit: WorkflowExitManager;
|
|
26
|
-
readonly ownController: AbortController;
|
|
27
|
-
readonly resolveWorkflowCwd: () => string;
|
|
28
|
-
readonly nextWorkflowBoundaryReplayKey: (name: string) => string;
|
|
29
|
-
readonly startWorkflowBoundaryStage: (name: string, replayKey: string) => WorkflowBoundaryStage;
|
|
30
|
-
readonly runWorkflow: <TInputs extends WorkflowInputValues>(
|
|
31
|
-
def: WorkflowDefinition<TInputs>,
|
|
32
|
-
inputs: Readonly<Record<string, unknown>>,
|
|
33
|
-
opts?: RunOpts,
|
|
34
|
-
) => Promise<RunResult>;
|
|
35
|
-
}): <TChildInputs extends WorkflowInputValues, TChildOutputs extends WorkflowOutputValues>(
|
|
36
|
-
child: WorkflowDefinition<TChildInputs, TChildOutputs>,
|
|
37
|
-
options?: WorkflowRunChildOptions<TChildInputs>,
|
|
38
|
-
) => Promise<WorkflowChildResult<TChildOutputs>> {
|
|
39
|
-
return async <TChildInputs extends WorkflowInputValues, TChildOutputs extends WorkflowOutputValues>(
|
|
40
|
-
child: WorkflowDefinition<TChildInputs, TChildOutputs>,
|
|
41
|
-
options: WorkflowRunChildOptions<TChildInputs> = {},
|
|
42
|
-
): Promise<WorkflowChildResult<TChildOutputs>> => {
|
|
43
|
-
input.exit.throwIfWorkflowExitSelected();
|
|
44
|
-
if (!isWorkflowDefinition(child)) throw new Error(workflowDefinitionRequirementMessage("ctx.workflow(definition)", child));
|
|
45
|
-
const childName = child.normalizedName;
|
|
46
|
-
const boundaryName = options.stageName ?? `workflow:${childName}`;
|
|
47
|
-
const boundaryReplayKey = input.nextWorkflowBoundaryReplayKey(boundaryName);
|
|
48
|
-
const boundary = input.startWorkflowBoundaryStage(boundaryName, boundaryReplayKey);
|
|
49
|
-
let childRunId: string | undefined;
|
|
50
|
-
let detachParentAbort: (() => void) | undefined;
|
|
51
|
-
try {
|
|
52
|
-
if (boundary.replayedChild !== undefined) {
|
|
53
|
-
await Promise.resolve();
|
|
54
|
-
input.exit.throwIfWorkflowExitSelected();
|
|
55
|
-
boundary.finalizeReplay();
|
|
56
|
-
return boundary.replayedChild as WorkflowChildResult<TChildOutputs>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const childInputs = resolveAndValidateInputs(child.inputs, options.inputs ?? {}, `child workflow "${childName}" (${child.name})`);
|
|
60
|
-
input.exit.throwIfWorkflowExitSelected();
|
|
61
|
-
|
|
62
|
-
childRunId = crypto.randomUUID();
|
|
63
|
-
const childController = new AbortController();
|
|
64
|
-
const childRef: WorkflowChildRunRef = { alias: childName, workflow: child.normalizedName, runId: childRunId };
|
|
65
|
-
boundary.linkChildRun(childRef, childController);
|
|
66
|
-
|
|
67
|
-
const abortChildFromParent = (): void => {
|
|
68
|
-
const parentExit = findWorkflowExitSignal(input.ownController.signal.reason, input.exit.exitScope);
|
|
69
|
-
childController.abort(parentExit !== undefined ? makeParentWorkflowExitAbortReason(parentExit.reason) : input.ownController.signal.reason);
|
|
70
|
-
};
|
|
71
|
-
if (input.ownController.signal.aborted) abortChildFromParent();
|
|
72
|
-
else {
|
|
73
|
-
input.ownController.signal.addEventListener("abort", abortChildFromParent, { once: true });
|
|
74
|
-
detachParentAbort = () => input.ownController.signal.removeEventListener("abort", abortChildFromParent);
|
|
75
|
-
}
|
|
76
|
-
input.exit.throwIfWorkflowExitSelected();
|
|
77
|
-
input.opts.cancellation?.register(childRunId, childController);
|
|
78
|
-
input.exit.throwIfWorkflowExitSelected();
|
|
79
|
-
|
|
80
|
-
const {
|
|
81
|
-
runId: _parentRunId,
|
|
82
|
-
continuation: _parentContinuation,
|
|
83
|
-
deferWorkflowStart: _parentDeferWorkflowStart,
|
|
84
|
-
parentRun: _parentRun,
|
|
85
|
-
onRunStart: _parentOnRunStart,
|
|
86
|
-
onRunEnd: _parentOnRunEnd,
|
|
87
|
-
...childBaseOpts
|
|
88
|
-
} = input.opts;
|
|
89
|
-
const childRunPromise = input.runWorkflow(child, childInputs, {
|
|
90
|
-
...childBaseOpts,
|
|
91
|
-
runId: childRunId,
|
|
92
|
-
cwd: input.resolveWorkflowCwd(),
|
|
93
|
-
depth: input.depth + 1,
|
|
94
|
-
...(input.opts.registry !== undefined ? { registry: input.opts.registry } : {}),
|
|
95
|
-
parentRun: {
|
|
96
|
-
runId: input.runId,
|
|
97
|
-
stageId: boundary.id,
|
|
98
|
-
rootRunId: input.opts.parentRun?.rootRunId ?? input.runId,
|
|
99
|
-
},
|
|
100
|
-
signal: childController.signal,
|
|
101
|
-
deferWorkflowStart: false,
|
|
102
|
-
});
|
|
103
|
-
boundary.observeChildRun(childRunPromise);
|
|
104
|
-
const childRun = await childRunPromise;
|
|
105
|
-
input.exit.throwIfWorkflowExitSelected();
|
|
106
|
-
|
|
107
|
-
if (!isWorkflowExitStatus(childRun.status)) {
|
|
108
|
-
const failedChildStage = childRun.stages.find((stage) => stage.failureKind !== undefined);
|
|
109
|
-
throw new Error(
|
|
110
|
-
`atomic-workflows: child workflow "${childName}" (${child.name}) failed with status ${childRun.status}${childRun.error !== undefined ? `: ${childRun.error}` : ""}`,
|
|
111
|
-
{
|
|
112
|
-
cause: {
|
|
113
|
-
...(failedChildStage?.failureKind !== undefined ? { code: failedChildStage.failureKind } : {}),
|
|
114
|
-
...(failedChildStage?.failureMessage !== undefined ? { message: failedChildStage.failureMessage } : {}),
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const outputs = selectWorkflowOutputs(child, childRun.result);
|
|
121
|
-
const childExited = childRun.exited === true || childRun.status !== "completed";
|
|
122
|
-
const childResult: WorkflowChildResult<TChildOutputs> = childExited
|
|
123
|
-
? {
|
|
124
|
-
workflow: child.normalizedName,
|
|
125
|
-
runId: childRun.runId,
|
|
126
|
-
status: childRun.status,
|
|
127
|
-
exited: true,
|
|
128
|
-
outputs: outputs as Partial<TChildOutputs>,
|
|
129
|
-
...(childRun.exitReason !== undefined ? { exitReason: childRun.exitReason } : {}),
|
|
130
|
-
}
|
|
131
|
-
: {
|
|
132
|
-
workflow: child.normalizedName,
|
|
133
|
-
runId: childRun.runId,
|
|
134
|
-
status: "completed",
|
|
135
|
-
exited: false,
|
|
136
|
-
outputs: outputs as TChildOutputs,
|
|
137
|
-
};
|
|
138
|
-
const workflowChild = workflowChildReplaySnapshot(childName, childResult);
|
|
139
|
-
const outputKeys = Object.keys(outputs);
|
|
140
|
-
boundary.complete(
|
|
141
|
-
`Workflow "${child.name}" ${childRun.status} (runId: ${childRun.runId}; outputs: ${outputKeys.length > 0 ? outputKeys.join(", ") : "(none)"})`,
|
|
142
|
-
workflowChild,
|
|
143
|
-
);
|
|
144
|
-
return childResult;
|
|
145
|
-
} catch (err) {
|
|
146
|
-
const exit = findWorkflowExitSignal(err, input.exit.exitScope) ?? findWorkflowExitSignal(input.ownController.signal.reason, input.exit.exitScope);
|
|
147
|
-
if (exit !== undefined) {
|
|
148
|
-
await boundary.skipForWorkflowExit(exit.reason);
|
|
149
|
-
throw exit;
|
|
150
|
-
}
|
|
151
|
-
boundary.fail(err);
|
|
152
|
-
throw err;
|
|
153
|
-
} finally {
|
|
154
|
-
detachParentAbort?.();
|
|
155
|
-
if (childRunId !== undefined) input.opts.cancellation?.unregister(childRunId);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
1
|
+
export { createChildWorkflowRunner } from "../../engine/primitives/workflow.js";
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
WorkflowTaskResult,
|
|
16
16
|
WorkflowTaskStep,
|
|
17
17
|
} from "../../shared/types.js";
|
|
18
|
-
import { stampWorkflowDefinition } from "../../
|
|
18
|
+
import { stampWorkflowDefinition } from "../../authoring/workflow.js";
|
|
19
19
|
import { classifyWorkflowFailure } from "../../shared/workflow-failures.js";
|
|
20
20
|
import { buildModelCandidatesFromCatalog, validateWorkflowModels, workflowModelId } from "../shared/model-fallback.js";
|
|
21
21
|
import {
|
|
@@ -31,7 +31,7 @@ function assertWorkflowOutputsExplicit(
|
|
|
31
31
|
for (const key of Object.keys(sourceOutput)) {
|
|
32
32
|
if (!hasOwnWorkflowOutput(declarations, key)) {
|
|
33
33
|
throw new Error(
|
|
34
|
-
`atomic-workflows: ${scope} returned undeclared output "${key}"; declare it
|
|
34
|
+
`atomic-workflows: ${scope} returned undeclared output "${key}"; declare it in outputs: { "${key}": Type.... } or remove it from the .run() return`,
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -119,7 +119,7 @@ export function assertWorkflowExitOutputs(
|
|
|
119
119
|
for (const key of Object.keys(sourceOutput)) {
|
|
120
120
|
if (!hasOwnWorkflowOutput(declarations, key)) {
|
|
121
121
|
throw new Error(
|
|
122
|
-
`atomic-workflows: ${scope} provided undeclared output "${key}"; declare it
|
|
122
|
+
`atomic-workflows: ${scope} provided undeclared output "${key}"; declare it in outputs: { "${key}": Type.... } or remove it from ctx.exit({ outputs })`,
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
@@ -5,7 +5,7 @@ import { stageUiBroker } from "../../shared/stage-ui-broker.js";
|
|
|
5
5
|
import { appendStageEnd, appendStageStart } from "../../shared/persistence-session-entries.js";
|
|
6
6
|
import { elapsedStageMs } from "../../shared/timing.js";
|
|
7
7
|
import type { WorkflowFailure } from "../../shared/workflow-failures.js";
|
|
8
|
-
import type { GraphFrontierTracker } from "
|
|
8
|
+
import type { GraphFrontierTracker } from "../../engine/graph-inference.js";
|
|
9
9
|
import type { RunOpts, WorkflowExitCleanup } from "./executor-types.js";
|
|
10
10
|
import type { ContinuationReplayIndex } from "./executor-continuation.js";
|
|
11
11
|
import { getPromptAnswerState, sameStringSet } from "./executor-continuation.js";
|