@renseiai/agentfactory 0.8.7 → 0.8.9
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/dist/src/config/index.d.ts +1 -1
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/repository-config.d.ts +37 -0
- package/dist/src/config/repository-config.d.ts.map +1 -1
- package/dist/src/config/repository-config.js +47 -0
- package/dist/src/config/repository-config.test.js +140 -1
- package/dist/src/governor/decision-engine.d.ts +3 -0
- package/dist/src/governor/decision-engine.d.ts.map +1 -1
- package/dist/src/governor/decision-engine.js +11 -0
- package/dist/src/governor/decision-engine.test.js +33 -0
- package/dist/src/governor/event-types.d.ts +18 -1
- package/dist/src/governor/event-types.d.ts.map +1 -1
- package/dist/src/governor/event-types.js +4 -0
- package/dist/src/governor/governor-types.d.ts +1 -1
- package/dist/src/governor/governor-types.d.ts.map +1 -1
- package/dist/src/governor/governor.d.ts +17 -1
- package/dist/src/governor/governor.d.ts.map +1 -1
- package/dist/src/governor/governor.js +112 -1
- package/dist/src/governor/governor.test.js +155 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/merge-queue/adapters/github-native.d.ts +22 -0
- package/dist/src/merge-queue/adapters/github-native.d.ts.map +1 -0
- package/dist/src/merge-queue/adapters/github-native.js +243 -0
- package/dist/src/merge-queue/adapters/github-native.test.d.ts +2 -0
- package/dist/src/merge-queue/adapters/github-native.test.d.ts.map +1 -0
- package/dist/src/merge-queue/adapters/github-native.test.js +384 -0
- package/dist/src/merge-queue/index.d.ts +18 -0
- package/dist/src/merge-queue/index.d.ts.map +1 -0
- package/dist/src/merge-queue/index.js +28 -0
- package/dist/src/merge-queue/merge-queue.integration.test.d.ts +2 -0
- package/dist/src/merge-queue/merge-queue.integration.test.d.ts.map +1 -0
- package/dist/src/merge-queue/merge-queue.integration.test.js +128 -0
- package/dist/src/merge-queue/types.d.ts +48 -0
- package/dist/src/merge-queue/types.d.ts.map +1 -0
- package/dist/src/merge-queue/types.js +8 -0
- package/dist/src/orchestrator/artifact-tracker.d.ts +93 -0
- package/dist/src/orchestrator/artifact-tracker.d.ts.map +1 -0
- package/dist/src/orchestrator/artifact-tracker.js +235 -0
- package/dist/src/orchestrator/artifact-tracker.test.d.ts +2 -0
- package/dist/src/orchestrator/artifact-tracker.test.d.ts.map +1 -0
- package/dist/src/orchestrator/artifact-tracker.test.js +189 -0
- package/dist/src/orchestrator/context-manager.d.ts +72 -0
- package/dist/src/orchestrator/context-manager.d.ts.map +1 -0
- package/dist/src/orchestrator/context-manager.js +120 -0
- package/dist/src/orchestrator/context-manager.test.d.ts +2 -0
- package/dist/src/orchestrator/context-manager.test.d.ts.map +1 -0
- package/dist/src/orchestrator/context-manager.test.js +137 -0
- package/dist/src/orchestrator/index.d.ts +8 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +8 -1
- package/dist/src/orchestrator/issue-tracker-client.d.ts +4 -0
- package/dist/src/orchestrator/issue-tracker-client.d.ts.map +1 -1
- package/dist/src/orchestrator/orchestrator.d.ts +12 -0
- package/dist/src/orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/src/orchestrator/orchestrator.js +282 -2
- package/dist/src/orchestrator/parse-work-result.d.ts.map +1 -1
- package/dist/src/orchestrator/parse-work-result.js +6 -0
- package/dist/src/orchestrator/parse-work-result.test.js +19 -0
- package/dist/src/orchestrator/state-recovery.d.ts +21 -2
- package/dist/src/orchestrator/state-recovery.d.ts.map +1 -1
- package/dist/src/orchestrator/state-recovery.js +54 -2
- package/dist/src/orchestrator/state-recovery.test.js +106 -2
- package/dist/src/orchestrator/state-types.d.ts +62 -0
- package/dist/src/orchestrator/state-types.d.ts.map +1 -1
- package/dist/src/orchestrator/state-types.js +5 -1
- package/dist/src/orchestrator/summary-builder.d.ts +47 -0
- package/dist/src/orchestrator/summary-builder.d.ts.map +1 -0
- package/dist/src/orchestrator/summary-builder.js +240 -0
- package/dist/src/orchestrator/summary-builder.test.d.ts +2 -0
- package/dist/src/orchestrator/summary-builder.test.d.ts.map +1 -0
- package/dist/src/orchestrator/summary-builder.test.js +236 -0
- package/dist/src/orchestrator/types.d.ts +2 -0
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/work-types.d.ts +1 -1
- package/dist/src/orchestrator/work-types.d.ts.map +1 -1
- package/dist/src/providers/index.d.ts +64 -1
- package/dist/src/providers/index.d.ts.map +1 -1
- package/dist/src/providers/index.js +132 -1
- package/dist/src/providers/index.test.js +340 -2
- package/dist/src/routing/index.d.ts +7 -0
- package/dist/src/routing/index.d.ts.map +1 -0
- package/dist/src/routing/index.js +6 -0
- package/dist/src/routing/observation-recorder.d.ts +19 -0
- package/dist/src/routing/observation-recorder.d.ts.map +1 -0
- package/dist/src/routing/observation-recorder.js +73 -0
- package/dist/src/routing/observation-recorder.test.d.ts +2 -0
- package/dist/src/routing/observation-recorder.test.d.ts.map +1 -0
- package/dist/src/routing/observation-recorder.test.js +322 -0
- package/dist/src/routing/observation-store.d.ts +40 -0
- package/dist/src/routing/observation-store.d.ts.map +1 -0
- package/dist/src/routing/observation-store.js +1 -0
- package/dist/src/routing/observation-store.test.d.ts +2 -0
- package/dist/src/routing/observation-store.test.d.ts.map +1 -0
- package/dist/src/routing/observation-store.test.js +138 -0
- package/dist/src/routing/posterior-store.d.ts +12 -0
- package/dist/src/routing/posterior-store.d.ts.map +1 -0
- package/dist/src/routing/posterior-store.js +13 -0
- package/dist/src/routing/posterior-store.test.d.ts +2 -0
- package/dist/src/routing/posterior-store.test.d.ts.map +1 -0
- package/dist/src/routing/posterior-store.test.js +37 -0
- package/dist/src/routing/reward.d.ts +16 -0
- package/dist/src/routing/reward.d.ts.map +1 -0
- package/dist/src/routing/reward.js +29 -0
- package/dist/src/routing/reward.test.d.ts +2 -0
- package/dist/src/routing/reward.test.d.ts.map +1 -0
- package/dist/src/routing/reward.test.js +210 -0
- package/dist/src/routing/routing-engine.d.ts +20 -0
- package/dist/src/routing/routing-engine.d.ts.map +1 -0
- package/dist/src/routing/routing-engine.js +113 -0
- package/dist/src/routing/routing-engine.test.d.ts +2 -0
- package/dist/src/routing/routing-engine.test.d.ts.map +1 -0
- package/dist/src/routing/routing-engine.test.js +310 -0
- package/dist/src/routing/types.d.ts +157 -0
- package/dist/src/routing/types.d.ts.map +1 -0
- package/dist/src/routing/types.js +68 -0
- package/dist/src/routing/types.test.d.ts +2 -0
- package/dist/src/routing/types.test.d.ts.map +1 -0
- package/dist/src/routing/types.test.js +184 -0
- package/dist/src/templates/registry.test.js +2 -2
- package/dist/src/templates/types.d.ts +5 -0
- package/dist/src/templates/types.d.ts.map +1 -1
- package/dist/src/templates/types.js +3 -0
- package/dist/src/workflow/agent-cancellation.d.ts +37 -0
- package/dist/src/workflow/agent-cancellation.d.ts.map +1 -0
- package/dist/src/workflow/agent-cancellation.js +41 -0
- package/dist/src/workflow/agent-cancellation.test.d.ts +2 -0
- package/dist/src/workflow/agent-cancellation.test.d.ts.map +1 -0
- package/dist/src/workflow/agent-cancellation.test.js +86 -0
- package/dist/src/workflow/branching-router.d.ts +38 -0
- package/dist/src/workflow/branching-router.d.ts.map +1 -0
- package/dist/src/workflow/branching-router.js +52 -0
- package/dist/src/workflow/branching-router.test.d.ts +2 -0
- package/dist/src/workflow/branching-router.test.d.ts.map +1 -0
- package/dist/src/workflow/branching-router.test.js +209 -0
- package/dist/src/workflow/concurrency-semaphore.d.ts +21 -0
- package/dist/src/workflow/concurrency-semaphore.d.ts.map +1 -0
- package/dist/src/workflow/concurrency-semaphore.js +46 -0
- package/dist/src/workflow/concurrency-semaphore.test.d.ts +2 -0
- package/dist/src/workflow/concurrency-semaphore.test.d.ts.map +1 -0
- package/dist/src/workflow/concurrency-semaphore.test.js +183 -0
- package/dist/src/workflow/duration.d.ts +28 -0
- package/dist/src/workflow/duration.d.ts.map +1 -0
- package/dist/src/workflow/duration.js +57 -0
- package/dist/src/workflow/duration.test.d.ts +2 -0
- package/dist/src/workflow/duration.test.d.ts.map +1 -0
- package/dist/src/workflow/duration.test.js +74 -0
- package/dist/src/workflow/expression/ast.d.ts +53 -0
- package/dist/src/workflow/expression/ast.d.ts.map +1 -0
- package/dist/src/workflow/expression/ast.js +8 -0
- package/dist/src/workflow/expression/context.d.ts +40 -0
- package/dist/src/workflow/expression/context.d.ts.map +1 -0
- package/dist/src/workflow/expression/context.js +37 -0
- package/dist/src/workflow/expression/evaluator.d.ts +28 -0
- package/dist/src/workflow/expression/evaluator.d.ts.map +1 -0
- package/dist/src/workflow/expression/evaluator.js +165 -0
- package/dist/src/workflow/expression/evaluator.test.d.ts +2 -0
- package/dist/src/workflow/expression/evaluator.test.d.ts.map +1 -0
- package/dist/src/workflow/expression/evaluator.test.js +792 -0
- package/dist/src/workflow/expression/expression.test.d.ts +2 -0
- package/dist/src/workflow/expression/expression.test.d.ts.map +1 -0
- package/dist/src/workflow/expression/expression.test.js +516 -0
- package/dist/src/workflow/expression/helpers.d.ts +21 -0
- package/dist/src/workflow/expression/helpers.d.ts.map +1 -0
- package/dist/src/workflow/expression/helpers.js +56 -0
- package/dist/src/workflow/expression/index.d.ts +55 -0
- package/dist/src/workflow/expression/index.d.ts.map +1 -0
- package/dist/src/workflow/expression/index.js +71 -0
- package/dist/src/workflow/expression/lexer.d.ts +37 -0
- package/dist/src/workflow/expression/lexer.d.ts.map +1 -0
- package/dist/src/workflow/expression/lexer.js +166 -0
- package/dist/src/workflow/expression/parser.d.ts +23 -0
- package/dist/src/workflow/expression/parser.d.ts.map +1 -0
- package/dist/src/workflow/expression/parser.js +181 -0
- package/dist/src/workflow/gate-state.d.ts +115 -0
- package/dist/src/workflow/gate-state.d.ts.map +1 -0
- package/dist/src/workflow/gate-state.js +185 -0
- package/dist/src/workflow/gate-state.test.d.ts +2 -0
- package/dist/src/workflow/gate-state.test.d.ts.map +1 -0
- package/dist/src/workflow/gate-state.test.js +251 -0
- package/dist/src/workflow/gates/gate-evaluator.d.ts +119 -0
- package/dist/src/workflow/gates/gate-evaluator.d.ts.map +1 -0
- package/dist/src/workflow/gates/gate-evaluator.js +243 -0
- package/dist/src/workflow/gates/gate-evaluator.test.d.ts +2 -0
- package/dist/src/workflow/gates/gate-evaluator.test.d.ts.map +1 -0
- package/dist/src/workflow/gates/gate-evaluator.test.js +240 -0
- package/dist/src/workflow/gates/signal-gate.d.ts +114 -0
- package/dist/src/workflow/gates/signal-gate.d.ts.map +1 -0
- package/dist/src/workflow/gates/signal-gate.js +216 -0
- package/dist/src/workflow/gates/signal-gate.test.d.ts +2 -0
- package/dist/src/workflow/gates/signal-gate.test.d.ts.map +1 -0
- package/dist/src/workflow/gates/signal-gate.test.js +199 -0
- package/dist/src/workflow/gates/timeout-engine.d.ts +96 -0
- package/dist/src/workflow/gates/timeout-engine.d.ts.map +1 -0
- package/dist/src/workflow/gates/timeout-engine.js +162 -0
- package/dist/src/workflow/gates/timeout-engine.test.d.ts +2 -0
- package/dist/src/workflow/gates/timeout-engine.test.d.ts.map +1 -0
- package/dist/src/workflow/gates/timeout-engine.test.js +186 -0
- package/dist/src/workflow/gates/timer-gate.d.ts +125 -0
- package/dist/src/workflow/gates/timer-gate.d.ts.map +1 -0
- package/dist/src/workflow/gates/timer-gate.js +381 -0
- package/dist/src/workflow/gates/timer-gate.test.d.ts +2 -0
- package/dist/src/workflow/gates/timer-gate.test.d.ts.map +1 -0
- package/dist/src/workflow/gates/timer-gate.test.js +211 -0
- package/dist/src/workflow/gates/webhook-gate.d.ts +132 -0
- package/dist/src/workflow/gates/webhook-gate.d.ts.map +1 -0
- package/dist/src/workflow/gates/webhook-gate.js +216 -0
- package/dist/src/workflow/gates/webhook-gate.test.d.ts +2 -0
- package/dist/src/workflow/gates/webhook-gate.test.d.ts.map +1 -0
- package/dist/src/workflow/gates/webhook-gate.test.js +182 -0
- package/dist/src/workflow/index.d.ts +31 -3
- package/dist/src/workflow/index.d.ts.map +1 -1
- package/dist/src/workflow/index.js +20 -1
- package/dist/src/workflow/parallelism-executor.d.ts +25 -0
- package/dist/src/workflow/parallelism-executor.d.ts.map +1 -0
- package/dist/src/workflow/parallelism-executor.js +53 -0
- package/dist/src/workflow/parallelism-executor.test.d.ts +2 -0
- package/dist/src/workflow/parallelism-executor.test.d.ts.map +1 -0
- package/dist/src/workflow/parallelism-executor.test.js +191 -0
- package/dist/src/workflow/parallelism-types.d.ts +80 -0
- package/dist/src/workflow/parallelism-types.d.ts.map +1 -0
- package/dist/src/workflow/parallelism-types.js +8 -0
- package/dist/src/workflow/phase-context-injector.d.ts +29 -0
- package/dist/src/workflow/phase-context-injector.d.ts.map +1 -0
- package/dist/src/workflow/phase-context-injector.js +43 -0
- package/dist/src/workflow/phase-context-injector.test.d.ts +2 -0
- package/dist/src/workflow/phase-context-injector.test.d.ts.map +1 -0
- package/dist/src/workflow/phase-context-injector.test.js +123 -0
- package/dist/src/workflow/phase-output-collector.d.ts +39 -0
- package/dist/src/workflow/phase-output-collector.d.ts.map +1 -0
- package/dist/src/workflow/phase-output-collector.js +141 -0
- package/dist/src/workflow/phase-output-collector.test.d.ts +2 -0
- package/dist/src/workflow/phase-output-collector.test.d.ts.map +1 -0
- package/dist/src/workflow/phase-output-collector.test.js +179 -0
- package/dist/src/workflow/retry-resolver.d.ts +51 -0
- package/dist/src/workflow/retry-resolver.d.ts.map +1 -0
- package/dist/src/workflow/retry-resolver.js +70 -0
- package/dist/src/workflow/retry-resolver.test.d.ts +2 -0
- package/dist/src/workflow/retry-resolver.test.d.ts.map +1 -0
- package/dist/src/workflow/retry-resolver.test.js +149 -0
- package/dist/src/workflow/strategies/fan-in-strategy.d.ts +21 -0
- package/dist/src/workflow/strategies/fan-in-strategy.d.ts.map +1 -0
- package/dist/src/workflow/strategies/fan-in-strategy.js +92 -0
- package/dist/src/workflow/strategies/fan-in-strategy.test.d.ts +2 -0
- package/dist/src/workflow/strategies/fan-in-strategy.test.d.ts.map +1 -0
- package/dist/src/workflow/strategies/fan-in-strategy.test.js +182 -0
- package/dist/src/workflow/strategies/fan-out-strategy.d.ts +16 -0
- package/dist/src/workflow/strategies/fan-out-strategy.d.ts.map +1 -0
- package/dist/src/workflow/strategies/fan-out-strategy.js +47 -0
- package/dist/src/workflow/strategies/fan-out-strategy.test.d.ts +2 -0
- package/dist/src/workflow/strategies/fan-out-strategy.test.d.ts.map +1 -0
- package/dist/src/workflow/strategies/fan-out-strategy.test.js +97 -0
- package/dist/src/workflow/strategies/index.d.ts +4 -0
- package/dist/src/workflow/strategies/index.d.ts.map +1 -0
- package/dist/src/workflow/strategies/index.js +3 -0
- package/dist/src/workflow/strategies/race-strategy.d.ts +19 -0
- package/dist/src/workflow/strategies/race-strategy.d.ts.map +1 -0
- package/dist/src/workflow/strategies/race-strategy.js +92 -0
- package/dist/src/workflow/strategies/race-strategy.test.d.ts +2 -0
- package/dist/src/workflow/strategies/race-strategy.test.d.ts.map +1 -0
- package/dist/src/workflow/strategies/race-strategy.test.js +318 -0
- package/dist/src/workflow/transition-engine.d.ts +3 -1
- package/dist/src/workflow/transition-engine.d.ts.map +1 -1
- package/dist/src/workflow/transition-engine.js +26 -7
- package/dist/src/workflow/transition-engine.test.js +215 -11
- package/dist/src/workflow/workflow-registry.d.ts +46 -1
- package/dist/src/workflow/workflow-registry.d.ts.map +1 -1
- package/dist/src/workflow/workflow-registry.js +74 -0
- package/dist/src/workflow/workflow-registry.test.js +54 -0
- package/dist/src/workflow/workflow-types.d.ts +330 -12
- package/dist/src/workflow/workflow-types.d.ts.map +1 -1
- package/dist/src/workflow/workflow-types.js +100 -5
- package/dist/src/workflow/workflow-types.test.js +293 -2
- package/package.json +2 -2
|
@@ -15,6 +15,27 @@ import { z } from 'zod';
|
|
|
15
15
|
* Mirrors the hard-coded ladder in agent-tracking.ts:computeStrategy().
|
|
16
16
|
*/
|
|
17
17
|
export type EscalationStrategy = 'normal' | 'context-enriched' | 'decompose' | 'escalate-human';
|
|
18
|
+
/**
|
|
19
|
+
* Declares a structured output that a phase produces.
|
|
20
|
+
* Outputs are extracted from agent results using marker comments.
|
|
21
|
+
*/
|
|
22
|
+
export interface PhaseOutputDeclaration {
|
|
23
|
+
/** Data type of the output value */
|
|
24
|
+
type: 'string' | 'json' | 'url' | 'boolean';
|
|
25
|
+
/** Human-readable description of the output */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Whether this output must be present (default: false) */
|
|
28
|
+
required?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Declares an input dependency on an upstream phase's output.
|
|
32
|
+
*/
|
|
33
|
+
export interface PhaseInputDeclaration {
|
|
34
|
+
/** Reference to upstream output in "phaseName.outputKey" format */
|
|
35
|
+
from: string;
|
|
36
|
+
/** Human-readable description of the input */
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
18
39
|
/**
|
|
19
40
|
* A phase in the workflow graph. Each phase references a WorkflowTemplate
|
|
20
41
|
* by name and optionally provides strategy-specific template variants.
|
|
@@ -32,6 +53,34 @@ export interface PhaseDefinition {
|
|
|
32
53
|
* Example: { "context-enriched": "refinement-context-enriched" }
|
|
33
54
|
*/
|
|
34
55
|
variants?: Record<string, string>;
|
|
56
|
+
/** Per-template retry configuration override */
|
|
57
|
+
retry?: TemplateRetryConfig;
|
|
58
|
+
/** Per-template timeout configuration */
|
|
59
|
+
timeout?: TemplateTimeoutConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Structured outputs this phase produces.
|
|
62
|
+
* Keys are output names; values describe the output type and requirements.
|
|
63
|
+
*
|
|
64
|
+
* Outputs are extracted from agent session results using marker comments
|
|
65
|
+
* and made available to downstream phases via {@link PhaseInputDeclaration.from}.
|
|
66
|
+
*
|
|
67
|
+
* When a phase runs inside a parallelism group, each parallel branch
|
|
68
|
+
* produces its own output values. Downstream phases that declare inputs
|
|
69
|
+
* referencing these outputs receive an aggregated array of all branch values
|
|
70
|
+
* (e.g., an array of PR URLs from all parallel development branches).
|
|
71
|
+
*/
|
|
72
|
+
outputs?: Record<string, PhaseOutputDeclaration>;
|
|
73
|
+
/**
|
|
74
|
+
* Input dependencies on upstream phase outputs.
|
|
75
|
+
* Keys are local input names; values reference upstream outputs
|
|
76
|
+
* using "phaseName.outputKey" dot-notation in the `from` field.
|
|
77
|
+
*
|
|
78
|
+
* The orchestrator resolves these references before phase execution,
|
|
79
|
+
* injecting the upstream output values into the agent session context.
|
|
80
|
+
* If the upstream phase is part of a parallelism group, the input receives
|
|
81
|
+
* the collected array of all branch outputs rather than a single value.
|
|
82
|
+
*/
|
|
83
|
+
inputs?: Record<string, PhaseInputDeclaration>;
|
|
35
84
|
}
|
|
36
85
|
/**
|
|
37
86
|
* A transition edge in the workflow graph. Maps a Linear status to a phase.
|
|
@@ -105,21 +154,116 @@ export interface GateDefinition {
|
|
|
105
154
|
}
|
|
106
155
|
/**
|
|
107
156
|
* Defines a group of phases that can execute concurrently.
|
|
157
|
+
*
|
|
158
|
+
* Parallelism groups allow the orchestrator to spawn multiple concurrent
|
|
159
|
+
* executions of the listed phases (e.g., one per sub-issue). The strategy
|
|
160
|
+
* controls how branches are dispatched and how their results are collected.
|
|
161
|
+
*
|
|
162
|
+
* **Strategies:**
|
|
163
|
+
*
|
|
164
|
+
* - **fan-out** -- Spawn one execution per work item and let them run
|
|
165
|
+
* independently. Use when downstream phases do not depend on the results
|
|
166
|
+
* of all branches completing (e.g., independent deploys).
|
|
167
|
+
*
|
|
168
|
+
* - **fan-in** -- Spawn one execution per work item and **wait for every
|
|
169
|
+
* branch to complete** before allowing downstream phases to proceed. Use
|
|
170
|
+
* when a subsequent phase (e.g., QA) needs the collected outputs from all
|
|
171
|
+
* branches (e.g., all PR URLs). This is the most common strategy for
|
|
172
|
+
* parallel sub-issue development.
|
|
173
|
+
*
|
|
174
|
+
* - **race** -- Spawn multiple executions but **only keep the first one
|
|
175
|
+
* that succeeds**, cancelling the rest. Use for speculative execution
|
|
176
|
+
* where multiple approaches are tried and the fastest wins (e.g.,
|
|
177
|
+
* competing solution strategies).
|
|
178
|
+
*
|
|
179
|
+
* **Output aggregation:** When phases inside a parallelism group declare
|
|
180
|
+
* `outputs`, each branch produces its own values. Downstream phases that
|
|
181
|
+
* reference those outputs via `inputs.from` receive an aggregated array
|
|
182
|
+
* of all branch results (fan-in) or the winning branch's result (race).
|
|
108
183
|
*/
|
|
109
184
|
export interface ParallelismGroupDefinition {
|
|
110
|
-
/** Unique group name */
|
|
185
|
+
/** Unique group name used to reference this parallelism configuration */
|
|
111
186
|
name: string;
|
|
112
|
-
/** Human-readable description */
|
|
187
|
+
/** Human-readable description of the parallelism group's purpose */
|
|
113
188
|
description?: string;
|
|
114
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Phase names to execute in parallel. Each listed phase must be defined
|
|
191
|
+
* in the top-level `phases` array. The orchestrator spawns concurrent
|
|
192
|
+
* executions of these phases (e.g., one per sub-issue).
|
|
193
|
+
*/
|
|
115
194
|
phases: string[];
|
|
116
|
-
/**
|
|
195
|
+
/**
|
|
196
|
+
* Parallelism strategy controlling dispatch and result collection.
|
|
197
|
+
*
|
|
198
|
+
* - `fan-out`: fire-and-forget concurrent execution
|
|
199
|
+
* - `fan-in`: concurrent execution with barrier -- wait for all branches
|
|
200
|
+
* - `race`: concurrent execution -- keep first success, cancel the rest
|
|
201
|
+
*/
|
|
117
202
|
strategy: 'fan-out' | 'fan-in' | 'race';
|
|
118
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* Maximum number of concurrent branch executions (default: unlimited).
|
|
205
|
+
*
|
|
206
|
+
* This limit applies **within this parallelism group only** and is
|
|
207
|
+
* independent of the orchestrator-level `maxConcurrent` setting. The
|
|
208
|
+
* effective concurrency is the minimum of both values. For example, if
|
|
209
|
+
* the orchestrator allows 10 concurrent sessions and this group sets
|
|
210
|
+
* `maxConcurrent: 5`, at most 5 branches run at once for this group.
|
|
211
|
+
*
|
|
212
|
+
* Values above 10 trigger a validation warning as they may overwhelm
|
|
213
|
+
* downstream services or CI systems.
|
|
214
|
+
*/
|
|
119
215
|
maxConcurrent?: number;
|
|
120
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* Whether to wait for all parallel executions to complete before
|
|
218
|
+
* proceeding to downstream phases. Defaults to `false`.
|
|
219
|
+
*
|
|
220
|
+
* Typically set to `true` with the `fan-in` strategy so that a
|
|
221
|
+
* subsequent phase (e.g., QA) can consume outputs from every branch.
|
|
222
|
+
*/
|
|
121
223
|
waitForAll?: boolean;
|
|
122
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Per-template retry configuration. Overrides phase-level and global
|
|
227
|
+
* escalation settings when attached to a phase or branching block.
|
|
228
|
+
*/
|
|
229
|
+
export interface TemplateRetryConfig {
|
|
230
|
+
/** Max attempts before escalation action. Overrides circuitBreaker.maxSessionsPerPhase */
|
|
231
|
+
maxAttempts?: number;
|
|
232
|
+
/** Override escalation ladder for this template */
|
|
233
|
+
ladder?: EscalationLadderRung[];
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Per-template timeout configuration. When the duration elapses,
|
|
237
|
+
* the specified action is taken.
|
|
238
|
+
*/
|
|
239
|
+
export interface TemplateTimeoutConfig {
|
|
240
|
+
/** Duration string: "30m", "2h", "1d" */
|
|
241
|
+
duration: string;
|
|
242
|
+
/** Action when timeout is reached */
|
|
243
|
+
action: 'escalate' | 'skip' | 'fail';
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* A branching block that conditionally selects a template.
|
|
247
|
+
* Evaluated in order; the first matching branch wins.
|
|
248
|
+
*/
|
|
249
|
+
export interface BranchingDefinition {
|
|
250
|
+
/** Unique name for this branching rule */
|
|
251
|
+
name: string;
|
|
252
|
+
/** Condition expression (Handlebars-style, e.g., "{{ isParentIssue }}") */
|
|
253
|
+
condition: string;
|
|
254
|
+
/** Template to select when condition is true */
|
|
255
|
+
then: {
|
|
256
|
+
template: string;
|
|
257
|
+
retry?: TemplateRetryConfig;
|
|
258
|
+
timeout?: TemplateTimeoutConfig;
|
|
259
|
+
};
|
|
260
|
+
/** Optional template to select when condition is false */
|
|
261
|
+
else?: {
|
|
262
|
+
template: string;
|
|
263
|
+
retry?: TemplateRetryConfig;
|
|
264
|
+
timeout?: TemplateTimeoutConfig;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
123
267
|
/**
|
|
124
268
|
* A declarative workflow definition. This is the primary document kind
|
|
125
269
|
* introduced in schema v1.1, replacing the hard-coded workflow graph
|
|
@@ -142,12 +286,22 @@ export interface WorkflowDefinition {
|
|
|
142
286
|
gates?: GateDefinition[];
|
|
143
287
|
/** Parallelism groups for concurrent phase execution (Phase 4) */
|
|
144
288
|
parallelism?: ParallelismGroupDefinition[];
|
|
289
|
+
/** Branching blocks for conditional template selection */
|
|
290
|
+
branching?: BranchingDefinition[];
|
|
145
291
|
}
|
|
146
|
-
export declare const
|
|
147
|
-
|
|
292
|
+
export declare const PhaseOutputDeclarationSchema: z.ZodObject<{
|
|
293
|
+
type: z.ZodEnum<{
|
|
294
|
+
string: "string";
|
|
295
|
+
boolean: "boolean";
|
|
296
|
+
url: "url";
|
|
297
|
+
json: "json";
|
|
298
|
+
}>;
|
|
299
|
+
description: z.ZodOptional<z.ZodString>;
|
|
300
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
301
|
+
}, z.core.$strip>;
|
|
302
|
+
export declare const PhaseInputDeclarationSchema: z.ZodObject<{
|
|
303
|
+
from: z.ZodString;
|
|
148
304
|
description: z.ZodOptional<z.ZodString>;
|
|
149
|
-
template: z.ZodString;
|
|
150
|
-
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
151
305
|
}, z.core.$strip>;
|
|
152
306
|
export declare const TransitionDefinitionSchema: z.ZodObject<{
|
|
153
307
|
from: z.ZodString;
|
|
@@ -159,6 +313,56 @@ export declare const EscalationLadderRungSchema: z.ZodObject<{
|
|
|
159
313
|
cycle: z.ZodNumber;
|
|
160
314
|
strategy: z.ZodString;
|
|
161
315
|
}, z.core.$strip>;
|
|
316
|
+
export declare const TemplateRetryConfigSchema: z.ZodObject<{
|
|
317
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
318
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
319
|
+
cycle: z.ZodNumber;
|
|
320
|
+
strategy: z.ZodString;
|
|
321
|
+
}, z.core.$strip>>>;
|
|
322
|
+
}, z.core.$strip>;
|
|
323
|
+
export declare const TemplateTimeoutConfigSchema: z.ZodObject<{
|
|
324
|
+
duration: z.ZodString;
|
|
325
|
+
action: z.ZodEnum<{
|
|
326
|
+
fail: "fail";
|
|
327
|
+
escalate: "escalate";
|
|
328
|
+
skip: "skip";
|
|
329
|
+
}>;
|
|
330
|
+
}, z.core.$strip>;
|
|
331
|
+
export declare const PhaseDefinitionSchema: z.ZodObject<{
|
|
332
|
+
name: z.ZodString;
|
|
333
|
+
description: z.ZodOptional<z.ZodString>;
|
|
334
|
+
template: z.ZodString;
|
|
335
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
336
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
337
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
338
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
339
|
+
cycle: z.ZodNumber;
|
|
340
|
+
strategy: z.ZodString;
|
|
341
|
+
}, z.core.$strip>>>;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
timeout: z.ZodOptional<z.ZodObject<{
|
|
344
|
+
duration: z.ZodString;
|
|
345
|
+
action: z.ZodEnum<{
|
|
346
|
+
fail: "fail";
|
|
347
|
+
escalate: "escalate";
|
|
348
|
+
skip: "skip";
|
|
349
|
+
}>;
|
|
350
|
+
}, z.core.$strip>>;
|
|
351
|
+
outputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
352
|
+
type: z.ZodEnum<{
|
|
353
|
+
string: "string";
|
|
354
|
+
boolean: "boolean";
|
|
355
|
+
url: "url";
|
|
356
|
+
json: "json";
|
|
357
|
+
}>;
|
|
358
|
+
description: z.ZodOptional<z.ZodString>;
|
|
359
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
360
|
+
}, z.core.$strip>>>;
|
|
361
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
362
|
+
from: z.ZodString;
|
|
363
|
+
description: z.ZodOptional<z.ZodString>;
|
|
364
|
+
}, z.core.$strip>>>;
|
|
365
|
+
}, z.core.$strip>;
|
|
162
366
|
export declare const EscalationConfigSchema: z.ZodObject<{
|
|
163
367
|
ladder: z.ZodArray<z.ZodObject<{
|
|
164
368
|
cycle: z.ZodNumber;
|
|
@@ -181,9 +385,9 @@ export declare const GateDefinitionSchema: z.ZodObject<{
|
|
|
181
385
|
timeout: z.ZodOptional<z.ZodObject<{
|
|
182
386
|
duration: z.ZodString;
|
|
183
387
|
action: z.ZodEnum<{
|
|
388
|
+
fail: "fail";
|
|
184
389
|
escalate: "escalate";
|
|
185
390
|
skip: "skip";
|
|
186
|
-
fail: "fail";
|
|
187
391
|
}>;
|
|
188
392
|
}, z.core.$strip>>;
|
|
189
393
|
appliesTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -200,6 +404,46 @@ export declare const ParallelismGroupDefinitionSchema: z.ZodObject<{
|
|
|
200
404
|
maxConcurrent: z.ZodOptional<z.ZodNumber>;
|
|
201
405
|
waitForAll: z.ZodOptional<z.ZodBoolean>;
|
|
202
406
|
}, z.core.$strip>;
|
|
407
|
+
export declare const BranchingDefinitionSchema: z.ZodObject<{
|
|
408
|
+
name: z.ZodString;
|
|
409
|
+
condition: z.ZodString;
|
|
410
|
+
then: z.ZodObject<{
|
|
411
|
+
template: z.ZodString;
|
|
412
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
413
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
414
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
415
|
+
cycle: z.ZodNumber;
|
|
416
|
+
strategy: z.ZodString;
|
|
417
|
+
}, z.core.$strip>>>;
|
|
418
|
+
}, z.core.$strip>>;
|
|
419
|
+
timeout: z.ZodOptional<z.ZodObject<{
|
|
420
|
+
duration: z.ZodString;
|
|
421
|
+
action: z.ZodEnum<{
|
|
422
|
+
fail: "fail";
|
|
423
|
+
escalate: "escalate";
|
|
424
|
+
skip: "skip";
|
|
425
|
+
}>;
|
|
426
|
+
}, z.core.$strip>>;
|
|
427
|
+
}, z.core.$strip>;
|
|
428
|
+
else: z.ZodOptional<z.ZodObject<{
|
|
429
|
+
template: z.ZodString;
|
|
430
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
431
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
432
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
433
|
+
cycle: z.ZodNumber;
|
|
434
|
+
strategy: z.ZodString;
|
|
435
|
+
}, z.core.$strip>>>;
|
|
436
|
+
}, z.core.$strip>>;
|
|
437
|
+
timeout: z.ZodOptional<z.ZodObject<{
|
|
438
|
+
duration: z.ZodString;
|
|
439
|
+
action: z.ZodEnum<{
|
|
440
|
+
fail: "fail";
|
|
441
|
+
escalate: "escalate";
|
|
442
|
+
skip: "skip";
|
|
443
|
+
}>;
|
|
444
|
+
}, z.core.$strip>>;
|
|
445
|
+
}, z.core.$strip>>;
|
|
446
|
+
}, z.core.$strip>;
|
|
203
447
|
export declare const WorkflowDefinitionSchema: z.ZodObject<{
|
|
204
448
|
apiVersion: z.ZodLiteral<"v1.1">;
|
|
205
449
|
kind: z.ZodLiteral<"WorkflowDefinition">;
|
|
@@ -212,6 +456,35 @@ export declare const WorkflowDefinitionSchema: z.ZodObject<{
|
|
|
212
456
|
description: z.ZodOptional<z.ZodString>;
|
|
213
457
|
template: z.ZodString;
|
|
214
458
|
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
459
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
460
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
461
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
462
|
+
cycle: z.ZodNumber;
|
|
463
|
+
strategy: z.ZodString;
|
|
464
|
+
}, z.core.$strip>>>;
|
|
465
|
+
}, z.core.$strip>>;
|
|
466
|
+
timeout: z.ZodOptional<z.ZodObject<{
|
|
467
|
+
duration: z.ZodString;
|
|
468
|
+
action: z.ZodEnum<{
|
|
469
|
+
fail: "fail";
|
|
470
|
+
escalate: "escalate";
|
|
471
|
+
skip: "skip";
|
|
472
|
+
}>;
|
|
473
|
+
}, z.core.$strip>>;
|
|
474
|
+
outputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
475
|
+
type: z.ZodEnum<{
|
|
476
|
+
string: "string";
|
|
477
|
+
boolean: "boolean";
|
|
478
|
+
url: "url";
|
|
479
|
+
json: "json";
|
|
480
|
+
}>;
|
|
481
|
+
description: z.ZodOptional<z.ZodString>;
|
|
482
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
483
|
+
}, z.core.$strip>>>;
|
|
484
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
485
|
+
from: z.ZodString;
|
|
486
|
+
description: z.ZodOptional<z.ZodString>;
|
|
487
|
+
}, z.core.$strip>>>;
|
|
215
488
|
}, z.core.$strip>>;
|
|
216
489
|
transitions: z.ZodArray<z.ZodObject<{
|
|
217
490
|
from: z.ZodString;
|
|
@@ -241,9 +514,9 @@ export declare const WorkflowDefinitionSchema: z.ZodObject<{
|
|
|
241
514
|
timeout: z.ZodOptional<z.ZodObject<{
|
|
242
515
|
duration: z.ZodString;
|
|
243
516
|
action: z.ZodEnum<{
|
|
517
|
+
fail: "fail";
|
|
244
518
|
escalate: "escalate";
|
|
245
519
|
skip: "skip";
|
|
246
|
-
fail: "fail";
|
|
247
520
|
}>;
|
|
248
521
|
}, z.core.$strip>>;
|
|
249
522
|
appliesTo: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -260,10 +533,55 @@ export declare const WorkflowDefinitionSchema: z.ZodObject<{
|
|
|
260
533
|
maxConcurrent: z.ZodOptional<z.ZodNumber>;
|
|
261
534
|
waitForAll: z.ZodOptional<z.ZodBoolean>;
|
|
262
535
|
}, z.core.$strip>>>;
|
|
536
|
+
branching: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
537
|
+
name: z.ZodString;
|
|
538
|
+
condition: z.ZodString;
|
|
539
|
+
then: z.ZodObject<{
|
|
540
|
+
template: z.ZodString;
|
|
541
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
542
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
543
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
544
|
+
cycle: z.ZodNumber;
|
|
545
|
+
strategy: z.ZodString;
|
|
546
|
+
}, z.core.$strip>>>;
|
|
547
|
+
}, z.core.$strip>>;
|
|
548
|
+
timeout: z.ZodOptional<z.ZodObject<{
|
|
549
|
+
duration: z.ZodString;
|
|
550
|
+
action: z.ZodEnum<{
|
|
551
|
+
fail: "fail";
|
|
552
|
+
escalate: "escalate";
|
|
553
|
+
skip: "skip";
|
|
554
|
+
}>;
|
|
555
|
+
}, z.core.$strip>>;
|
|
556
|
+
}, z.core.$strip>;
|
|
557
|
+
else: z.ZodOptional<z.ZodObject<{
|
|
558
|
+
template: z.ZodString;
|
|
559
|
+
retry: z.ZodOptional<z.ZodObject<{
|
|
560
|
+
maxAttempts: z.ZodOptional<z.ZodNumber>;
|
|
561
|
+
ladder: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
562
|
+
cycle: z.ZodNumber;
|
|
563
|
+
strategy: z.ZodString;
|
|
564
|
+
}, z.core.$strip>>>;
|
|
565
|
+
}, z.core.$strip>>;
|
|
566
|
+
timeout: z.ZodOptional<z.ZodObject<{
|
|
567
|
+
duration: z.ZodString;
|
|
568
|
+
action: z.ZodEnum<{
|
|
569
|
+
fail: "fail";
|
|
570
|
+
escalate: "escalate";
|
|
571
|
+
skip: "skip";
|
|
572
|
+
}>;
|
|
573
|
+
}, z.core.$strip>>;
|
|
574
|
+
}, z.core.$strip>>;
|
|
575
|
+
}, z.core.$strip>>>;
|
|
263
576
|
}, z.core.$strip>;
|
|
264
577
|
/**
|
|
265
578
|
* Validate a parsed YAML object as a WorkflowDefinition.
|
|
266
579
|
* Throws ZodError with detailed messages on failure.
|
|
580
|
+
*
|
|
581
|
+
* After Zod schema validation succeeds, performs cross-validation to ensure:
|
|
582
|
+
* - Parallelism group phase names reference defined phases
|
|
583
|
+
* - Phase input `from` references point to valid phase.output declarations
|
|
584
|
+
* - Warns (via console.warn) if maxConcurrent exceeds 10
|
|
267
585
|
*/
|
|
268
586
|
export declare function validateWorkflowDefinition(data: unknown, filePath?: string): WorkflowDefinition;
|
|
269
587
|
//# sourceMappingURL=workflow-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-types.d.ts","sourceRoot":"","sources":["../../../src/workflow/workflow-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,gBAAgB,CAAA;AAMpB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"workflow-types.d.ts","sourceRoot":"","sources":["../../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|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
// Zod Schemas
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
|
-
export const
|
|
17
|
-
|
|
16
|
+
export const PhaseOutputDeclarationSchema = z.object({
|
|
17
|
+
type: z.enum(['string', 'json', 'url', 'boolean']),
|
|
18
|
+
description: z.string().optional(),
|
|
19
|
+
required: z.boolean().optional(),
|
|
20
|
+
});
|
|
21
|
+
export const PhaseInputDeclarationSchema = z.object({
|
|
22
|
+
from: z.string().min(1),
|
|
18
23
|
description: z.string().optional(),
|
|
19
|
-
template: z.string().min(1),
|
|
20
|
-
variants: z.record(z.string(), z.string()).optional(),
|
|
21
24
|
});
|
|
22
25
|
export const TransitionDefinitionSchema = z.object({
|
|
23
26
|
from: z.string().min(1),
|
|
@@ -29,6 +32,24 @@ export const EscalationLadderRungSchema = z.object({
|
|
|
29
32
|
cycle: z.number().int().nonnegative(),
|
|
30
33
|
strategy: z.string().min(1),
|
|
31
34
|
});
|
|
35
|
+
export const TemplateRetryConfigSchema = z.object({
|
|
36
|
+
maxAttempts: z.number().int().positive().optional(),
|
|
37
|
+
ladder: z.array(EscalationLadderRungSchema).min(1).optional(),
|
|
38
|
+
});
|
|
39
|
+
export const TemplateTimeoutConfigSchema = z.object({
|
|
40
|
+
duration: z.string().min(1),
|
|
41
|
+
action: z.enum(['escalate', 'skip', 'fail']),
|
|
42
|
+
});
|
|
43
|
+
export const PhaseDefinitionSchema = z.object({
|
|
44
|
+
name: z.string().min(1),
|
|
45
|
+
description: z.string().optional(),
|
|
46
|
+
template: z.string().min(1),
|
|
47
|
+
variants: z.record(z.string(), z.string()).optional(),
|
|
48
|
+
retry: TemplateRetryConfigSchema.optional(),
|
|
49
|
+
timeout: TemplateTimeoutConfigSchema.optional(),
|
|
50
|
+
outputs: z.record(z.string(), PhaseOutputDeclarationSchema).optional(),
|
|
51
|
+
inputs: z.record(z.string(), PhaseInputDeclarationSchema).optional(),
|
|
52
|
+
});
|
|
32
53
|
export const EscalationConfigSchema = z.object({
|
|
33
54
|
ladder: z.array(EscalationLadderRungSchema).min(1),
|
|
34
55
|
circuitBreaker: z.object({
|
|
@@ -55,6 +76,20 @@ export const ParallelismGroupDefinitionSchema = z.object({
|
|
|
55
76
|
maxConcurrent: z.number().int().positive().optional(),
|
|
56
77
|
waitForAll: z.boolean().optional(),
|
|
57
78
|
});
|
|
79
|
+
export const BranchingDefinitionSchema = z.object({
|
|
80
|
+
name: z.string().min(1),
|
|
81
|
+
condition: z.string().min(1),
|
|
82
|
+
then: z.object({
|
|
83
|
+
template: z.string().min(1),
|
|
84
|
+
retry: TemplateRetryConfigSchema.optional(),
|
|
85
|
+
timeout: TemplateTimeoutConfigSchema.optional(),
|
|
86
|
+
}),
|
|
87
|
+
else: z.object({
|
|
88
|
+
template: z.string().min(1),
|
|
89
|
+
retry: TemplateRetryConfigSchema.optional(),
|
|
90
|
+
timeout: TemplateTimeoutConfigSchema.optional(),
|
|
91
|
+
}).optional(),
|
|
92
|
+
});
|
|
58
93
|
export const WorkflowDefinitionSchema = z.object({
|
|
59
94
|
apiVersion: z.literal('v1.1'),
|
|
60
95
|
kind: z.literal('WorkflowDefinition'),
|
|
@@ -67,6 +102,7 @@ export const WorkflowDefinitionSchema = z.object({
|
|
|
67
102
|
escalation: EscalationConfigSchema.optional(),
|
|
68
103
|
gates: z.array(GateDefinitionSchema).optional(),
|
|
69
104
|
parallelism: z.array(ParallelismGroupDefinitionSchema).optional(),
|
|
105
|
+
branching: z.array(BranchingDefinitionSchema).optional(),
|
|
70
106
|
});
|
|
71
107
|
// ---------------------------------------------------------------------------
|
|
72
108
|
// Validation Helpers
|
|
@@ -74,10 +110,18 @@ export const WorkflowDefinitionSchema = z.object({
|
|
|
74
110
|
/**
|
|
75
111
|
* Validate a parsed YAML object as a WorkflowDefinition.
|
|
76
112
|
* Throws ZodError with detailed messages on failure.
|
|
113
|
+
*
|
|
114
|
+
* After Zod schema validation succeeds, performs cross-validation to ensure:
|
|
115
|
+
* - Parallelism group phase names reference defined phases
|
|
116
|
+
* - Phase input `from` references point to valid phase.output declarations
|
|
117
|
+
* - Warns (via console.warn) if maxConcurrent exceeds 10
|
|
77
118
|
*/
|
|
78
119
|
export function validateWorkflowDefinition(data, filePath) {
|
|
79
120
|
try {
|
|
80
|
-
|
|
121
|
+
const workflow = WorkflowDefinitionSchema.parse(data);
|
|
122
|
+
// Cross-validation after schema parse succeeds
|
|
123
|
+
crossValidateWorkflow(workflow, filePath);
|
|
124
|
+
return workflow;
|
|
81
125
|
}
|
|
82
126
|
catch (error) {
|
|
83
127
|
if (filePath && error instanceof z.ZodError) {
|
|
@@ -86,3 +130,54 @@ export function validateWorkflowDefinition(data, filePath) {
|
|
|
86
130
|
throw error;
|
|
87
131
|
}
|
|
88
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Perform cross-validation checks that go beyond what Zod schema can enforce.
|
|
135
|
+
* Validates referential integrity between phases, parallelism groups, and input/output declarations.
|
|
136
|
+
*/
|
|
137
|
+
function crossValidateWorkflow(workflow, filePath) {
|
|
138
|
+
const phaseNames = new Set(workflow.phases.map(p => p.name));
|
|
139
|
+
const phaseOutputs = new Map();
|
|
140
|
+
// Build map of phase outputs
|
|
141
|
+
for (const phase of workflow.phases) {
|
|
142
|
+
if (phase.outputs) {
|
|
143
|
+
phaseOutputs.set(phase.name, new Set(Object.keys(phase.outputs)));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Validate parallelism group phase references
|
|
147
|
+
if (workflow.parallelism) {
|
|
148
|
+
for (const group of workflow.parallelism) {
|
|
149
|
+
for (const phaseName of group.phases) {
|
|
150
|
+
if (!phaseNames.has(phaseName)) {
|
|
151
|
+
const loc = filePath ? ` in ${filePath}` : '';
|
|
152
|
+
throw new Error(`Parallelism group "${group.name}" references undefined phase "${phaseName}"${loc}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Warn if maxConcurrent is very high
|
|
156
|
+
if (group.maxConcurrent && group.maxConcurrent > 10) {
|
|
157
|
+
console.warn(`[workflow] Parallelism group "${group.name}" has maxConcurrent=${group.maxConcurrent} which may be excessive`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Validate phase input references
|
|
162
|
+
for (const phase of workflow.phases) {
|
|
163
|
+
if (phase.inputs) {
|
|
164
|
+
for (const [inputName, decl] of Object.entries(phase.inputs)) {
|
|
165
|
+
const parts = decl.from.split('.');
|
|
166
|
+
if (parts.length !== 2) {
|
|
167
|
+
const loc = filePath ? ` in ${filePath}` : '';
|
|
168
|
+
throw new Error(`Phase "${phase.name}" input "${inputName}" has invalid from reference "${decl.from}" — expected "phaseName.outputKey" format${loc}`);
|
|
169
|
+
}
|
|
170
|
+
const [sourcePhaseName, sourceOutputKey] = parts;
|
|
171
|
+
if (!phaseNames.has(sourcePhaseName)) {
|
|
172
|
+
const loc = filePath ? ` in ${filePath}` : '';
|
|
173
|
+
throw new Error(`Phase "${phase.name}" input "${inputName}" references undefined phase "${sourcePhaseName}"${loc}`);
|
|
174
|
+
}
|
|
175
|
+
const sourceOutputs = phaseOutputs.get(sourcePhaseName);
|
|
176
|
+
if (sourceOutputs && !sourceOutputs.has(sourceOutputKey)) {
|
|
177
|
+
const loc = filePath ? ` in ${filePath}` : '';
|
|
178
|
+
throw new Error(`Phase "${phase.name}" input "${inputName}" references undefined output "${sourceOutputKey}" on phase "${sourcePhaseName}"${loc}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|