@boboddy/sdk 0.4.3 → 0.5.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/dist/client.js +0 -23
- package/dist/definitions/advancement-policies/define-advancement-policy.d.ts +30 -5
- package/dist/definitions/advancement-policies/index.js +11 -1
- package/dist/definitions/pipelines/bindings.d.ts +62 -0
- package/dist/definitions/pipelines/builder-helpers.d.ts +19 -106
- package/dist/definitions/pipelines/chain-graph.d.ts +15 -14
- package/dist/definitions/pipelines/compile-node-definitions.d.ts +27 -0
- package/dist/definitions/pipelines/define-pipeline.d.ts +101 -154
- package/dist/definitions/pipelines/index.d.ts +0 -2
- package/dist/definitions/pipelines/index.js +470 -615
- package/dist/definitions/pipelines/node-input-ctx.d.ts +31 -0
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +18 -4
- package/dist/definitions/pipelines/pipeline-states.d.ts +104 -0
- package/dist/definitions/steps/define-code-step.d.ts +50 -0
- package/dist/definitions/steps/define-step.d.ts +22 -1
- package/dist/definitions/steps/index.d.ts +1 -0
- package/dist/definitions/steps/index.js +41 -24
- package/dist/definitions/steps/step-definitions-client.d.ts +29 -5
- package/dist/definitions/validation/index.js +15148 -94
- package/dist/definitions/validation/validate-definition-specs.d.ts +19 -1
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/sdk.gen.d.ts +1 -4
- package/dist/generated/types.gen.d.ts +296 -878
- package/dist/index.js +510 -615
- package/dist/push/collect-definitions.d.ts +40 -1
- package/dist/push/index.d.ts +2 -2
- package/dist/push/index.js +788 -738
- package/dist/step-execution-plane-client.d.ts +9 -4
- package/package.json +2 -2
- package/dist/definitions/pipelines/builder.d.ts +0 -80
- package/dist/definitions/pipelines/fan-out-builder.d.ts +0 -66
- package/dist/definitions/pipelines/input-accessor.d.ts +0 -25
|
@@ -1,165 +1,114 @@
|
|
|
1
|
-
import { type ZodType } from "zod";
|
|
2
|
-
import type { StepDefinitionSpec
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { z, type ZodType } from "zod";
|
|
2
|
+
import type { StepDefinitionSpec } from "../steps/define-step";
|
|
3
|
+
import type { SerializedAdvancementPolicy, SerializedComputedSignalDefinition, SerializedCondition } from "../advancement-policies/define-advancement-policy";
|
|
4
|
+
import type { SerializedCohortAdvancementPolicy, SerializedStepSignalsListDefinition } from "../advancement-policies/cohort-advancement-policy";
|
|
5
|
+
import type { SerializedBinding } from "./bindings";
|
|
6
|
+
import type { DefinePipelineInput } from "./pipeline-states";
|
|
5
7
|
export type { AdvancementPolicy, PipelineStepComputedSignalType, } from "../advancement-policies/define-advancement-policy";
|
|
6
8
|
export { Computed, Rule, } from "../advancement-policies/define-advancement-policy";
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export * from "./pipeline-states";
|
|
10
|
+
export * from "./node-input-ctx";
|
|
11
|
+
export * from "./bindings";
|
|
12
|
+
export type NodeDefinitionKind = "step" | "fanOut" | "cohortGate" | "choice" | "parallel" | "loop" | "succeed" | "fail";
|
|
13
|
+
export type ChoiceCaseSpec = {
|
|
14
|
+
conditionJson: SerializedCondition;
|
|
15
|
+
targetNodeKey: string;
|
|
11
16
|
};
|
|
12
|
-
export type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
source: "step_signal";
|
|
18
|
-
step: AnyTypedStep;
|
|
19
|
-
signalKey: string;
|
|
20
|
-
};
|
|
21
|
-
export type StepOutputBinding = {
|
|
22
|
-
source: "step_output";
|
|
23
|
-
step: AnyTypedStep;
|
|
24
|
-
};
|
|
25
|
-
export type LiteralBinding = {
|
|
26
|
-
source: "literal";
|
|
27
|
-
value: unknown;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* `ctx.signalsList(fanOutStep)`'s binding (issue #167): reaches a fan-out's
|
|
31
|
-
* whole cohort — every terminal branch's own signals + output — from a
|
|
32
|
-
* later, non-adjacent step's input mapper. Resolved server-side against
|
|
33
|
-
* `ResolvedNodeInputContext.cohorts[stepKey]` (an array of
|
|
34
|
-
* `{ branchIndex, signals, outputJson }`, sorted by `branchIndex`).
|
|
35
|
-
*/
|
|
36
|
-
export type SignalsListBinding = {
|
|
37
|
-
source: "signals_list";
|
|
38
|
-
fanOutStep: AnyTypedStep;
|
|
17
|
+
export type ParallelBranchSpec = {
|
|
18
|
+
stepKey: string;
|
|
19
|
+
stepName: string;
|
|
20
|
+
stepDescription: string | null;
|
|
21
|
+
inputBindingsJson: Record<string, SerializedBinding>;
|
|
39
22
|
};
|
|
40
23
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* — see `FanOutItemType` — and at the wire level, since no `fanOut` node
|
|
46
|
-
* config would carry an `item` binding for it). Carries no extra fields:
|
|
47
|
-
* the branch index alone (implicit in which branch is executing) is enough
|
|
48
|
-
* to resolve the right element server-side.
|
|
24
|
+
* Fields shared by every node kind that does its own work by running a step
|
|
25
|
+
* template (`step`/`fanOut`/`loop`) — the step's own key/name/description,
|
|
26
|
+
* its resolved input bindings, and its timeout. Intersected into each of
|
|
27
|
+
* those three kinds' own type below rather than duplicated field-for-field.
|
|
49
28
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
type StepTemplateFields = {
|
|
30
|
+
stepKey: string;
|
|
31
|
+
stepName: string;
|
|
32
|
+
stepDescription: string | null;
|
|
33
|
+
inputBindingsJson: Record<string, SerializedBinding>;
|
|
34
|
+
timeoutSeconds: number | null;
|
|
52
35
|
};
|
|
53
|
-
export type
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[K in keyof NonNullable<TStep["__inputType"]> & string]: AnyBinding;
|
|
59
|
-
}>;
|
|
60
|
-
timeout?: number | null;
|
|
61
|
-
/**
|
|
62
|
-
* Controls when and how this step advances in the pipeline.
|
|
63
|
-
* Signal keys in `Rule.signal()` / `Rule.when()` calls are type-checked
|
|
64
|
-
* against the step's declared signals. Inline `Computed.X(...)` tokens can
|
|
65
|
-
* also appear in the signal position; they're hoisted into the step's
|
|
66
|
-
* `computedSignalDefinitions` at serialization time.
|
|
67
|
-
* Defaults to `{ defaultOutcome: "continue" }` when omitted.
|
|
68
|
-
*/
|
|
69
|
-
advancement?: AdvancementPolicy<TStep["__signalKeys"]>;
|
|
36
|
+
export type StepNodeDefinitionSpec = StepTemplateFields & {
|
|
37
|
+
nodeKey: string;
|
|
38
|
+
kind: "step";
|
|
39
|
+
advancementPolicyDefinition: SerializedAdvancementPolicy;
|
|
40
|
+
computedSignalDefinitions: SerializedComputedSignalDefinition[];
|
|
70
41
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* each branch's own result is evaluated against. Pushes exactly one
|
|
76
|
-
* `fanOut` node onto the pipeline's node sequence (paired with exactly one
|
|
77
|
-
* `PipelineCohortGateNodeConfig` immediately after it — see `.advanceAll()`
|
|
78
|
-
* — never more than the fan-out+gate pair itself).
|
|
79
|
-
*
|
|
80
|
-
* Named `*StepConfig` (rather than a bare `PipelineFanOutConfig`) to reserve
|
|
81
|
-
* room for a future sibling `PipelineFanOutSubPipelineConfig` — a fan-out
|
|
82
|
-
* whose template is a whole sub-pipeline rather than a single step. That
|
|
83
|
-
* sibling is out of scope for issue #167 and is not implemented here.
|
|
84
|
-
*/
|
|
85
|
-
export type PipelineFanOutStepConfig<TStep extends AnyTypedStep = AnyTypedStep> = {
|
|
86
|
-
nodeType: "fanOut";
|
|
87
|
-
fanOutStep: TStep;
|
|
42
|
+
export type FanOutNodeDefinitionSpec = StepTemplateFields & {
|
|
43
|
+
nodeKey: string;
|
|
44
|
+
kind: "fanOut";
|
|
45
|
+
/** The signal its branch cardinality is resolved from. */
|
|
88
46
|
overSignalKey: string;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
advanceEach?: CohortAdvancementPolicy;
|
|
47
|
+
/** Each branch's own continue/block decision. */
|
|
48
|
+
advanceEachPolicyDefinition: SerializedCohortAdvancementPolicy;
|
|
49
|
+
/** Caps how many branches release to the claim pool up front. */
|
|
50
|
+
maxConcurrency: number | null;
|
|
94
51
|
};
|
|
95
|
-
|
|
96
|
-
* `.advanceAll(callback)`'s node config (issue #167): the pure decision
|
|
97
|
-
* gate that aggregates a fan-out's cohort back together — no work of its
|
|
98
|
-
* own, so no `step`/`input`/`timeout`. `nodeKey` is derived by the builder
|
|
99
|
-
* (`${fanOutStep.key}__cohortGate`), not user-supplied.
|
|
100
|
-
*/
|
|
101
|
-
export type PipelineCohortGateNodeConfig = {
|
|
102
|
-
nodeType: "cohortGate";
|
|
52
|
+
export type CohortGateNodeDefinitionSpec = {
|
|
103
53
|
nodeKey: string;
|
|
104
|
-
|
|
105
|
-
|
|
54
|
+
kind: "cohortGate";
|
|
55
|
+
/** The whole cohort's continue/block decision. */
|
|
56
|
+
advanceAllPolicyDefinition: SerializedCohortAdvancementPolicy;
|
|
57
|
+
/** Every `ctx.stepSignalsList`-derived value `advanceAll`'s rules may reference. */
|
|
58
|
+
stepSignalsListDefinitions: SerializedStepSignalsListDefinition[];
|
|
106
59
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
|
-
export type SerializedBinding = {
|
|
115
|
-
source: "pipeline_input";
|
|
116
|
-
path: string;
|
|
117
|
-
} | {
|
|
118
|
-
source: "work_item";
|
|
119
|
-
field: string;
|
|
120
|
-
} | {
|
|
121
|
-
source: "step_signal";
|
|
122
|
-
stepKey: string;
|
|
123
|
-
signalKey: string;
|
|
124
|
-
} | {
|
|
125
|
-
source: "step_output";
|
|
126
|
-
stepKey: string;
|
|
127
|
-
} | {
|
|
128
|
-
source: "literal";
|
|
129
|
-
value: unknown;
|
|
130
|
-
} | {
|
|
131
|
-
source: "signals_list";
|
|
132
|
-
stepKey: string;
|
|
133
|
-
} | {
|
|
134
|
-
source: "fan_out_item";
|
|
60
|
+
export type ChoiceNodeDefinitionSpec = {
|
|
61
|
+
nodeKey: string;
|
|
62
|
+
kind: "choice";
|
|
63
|
+
/** The routing table — may be empty when `default` alone covers every case. */
|
|
64
|
+
choices: ChoiceCaseSpec[];
|
|
65
|
+
/** The fallback target when no `choices[]` entry matches. */
|
|
66
|
+
default: string | null;
|
|
135
67
|
};
|
|
136
|
-
export type
|
|
137
|
-
export type NodeDefinitionSpec = {
|
|
138
|
-
/** Unique within the pipeline; equals `stepKey` for a step/fanOut node, or the builder-derived gate key for a cohortGate node. */
|
|
68
|
+
export type ParallelNodeDefinitionSpec = {
|
|
139
69
|
nodeKey: string;
|
|
140
|
-
kind:
|
|
141
|
-
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
stepDescription?: string | null;
|
|
145
|
-
inputBindingsJson?: Record<string, SerializedBinding>;
|
|
146
|
-
timeoutSeconds?: number | null;
|
|
147
|
-
/** `step` only. */
|
|
148
|
-
advancementPolicyDefinition?: SerializedAdvancementPolicy;
|
|
149
|
-
/** `step` only. */
|
|
150
|
-
computedSignalDefinitions?: SerializedComputedSignalDefinition[];
|
|
151
|
-
/** `fanOut` only — the signal its branch cardinality is resolved from. */
|
|
152
|
-
overSignalKey?: string;
|
|
153
|
-
/** `fanOut` only — each branch's own continue/block decision. */
|
|
154
|
-
advanceEachPolicyDefinition?: SerializedCohortAdvancementPolicy;
|
|
155
|
-
/** `cohortGate` only — the whole cohort's continue/block decision. */
|
|
70
|
+
kind: "parallel";
|
|
71
|
+
/** Its named, single-step branches. */
|
|
72
|
+
branches: Record<string, ParallelBranchSpec>;
|
|
73
|
+
/** The whole cohort's continue/block decision — absent means "continue iff every branch continued." */
|
|
156
74
|
advanceAllPolicyDefinition?: SerializedCohortAdvancementPolicy;
|
|
157
|
-
/** `cohortGate` only — every `ctx.stepSignalsList`-derived value `advanceAll`'s rules may reference. */
|
|
158
|
-
stepSignalsListDefinitions?: SerializedStepSignalsListDefinition[];
|
|
159
75
|
};
|
|
76
|
+
export type LoopNodeDefinitionSpec = StepTemplateFields & {
|
|
77
|
+
nodeKey: string;
|
|
78
|
+
kind: "loop";
|
|
79
|
+
maxIterations: number;
|
|
80
|
+
/** The condition tested after each iteration. */
|
|
81
|
+
untilConditionJson: SerializedCondition;
|
|
82
|
+
};
|
|
83
|
+
/** `succeed`/`fail` carry no fields of their own besides `nodeKey`/`kind`. */
|
|
84
|
+
export type TerminalNodeDefinitionSpec = {
|
|
85
|
+
nodeKey: string;
|
|
86
|
+
kind: "succeed" | "fail";
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* One compiled node in the pipeline's graph, discriminated by `kind` — each
|
|
90
|
+
* kind's own fields (see its type above) are the only ones legal on it; a
|
|
91
|
+
* `choice` node has no `stepKey`, a `step` node has no `choices`, etc. The
|
|
92
|
+
* ones that need real ids (a `step`/`fanOut`/`loop`'s `stepKey`, a
|
|
93
|
+
* `parallel` branch's own `stepKey`) are resolved to `stepDefinitionId`s by
|
|
94
|
+
* `pipeline-definitions-client.ts` at push time, not here — this spec only
|
|
95
|
+
* ever carries author-declared keys.
|
|
96
|
+
*/
|
|
97
|
+
export type NodeDefinitionSpec = StepNodeDefinitionSpec | FanOutNodeDefinitionSpec | CohortGateNodeDefinitionSpec | ChoiceNodeDefinitionSpec | ParallelNodeDefinitionSpec | LoopNodeDefinitionSpec | TerminalNodeDefinitionSpec;
|
|
98
|
+
/** The kinds that run a step template and therefore carry `StepTemplateFields`. */
|
|
99
|
+
export type WorkingNodeDefinitionSpec = StepNodeDefinitionSpec | FanOutNodeDefinitionSpec | LoopNodeDefinitionSpec;
|
|
100
|
+
/** Narrows a `NodeDefinitionSpec` to the kinds that run a step template. */
|
|
101
|
+
export declare function isWorkingNodeDefinition(node: NodeDefinitionSpec): node is WorkingNodeDefinitionSpec;
|
|
160
102
|
export type DependencyEdgeSpec = {
|
|
161
103
|
fromNodeKey: string;
|
|
162
104
|
toNodeKey: string;
|
|
105
|
+
/**
|
|
106
|
+
* A `loop` node's `next`/`onExhausted` disambiguation
|
|
107
|
+
* (`{loopExit: "next" | "onExhausted"}` — the routing source of truth
|
|
108
|
+
* for `loop`) or a `choice` edge's designer-only display summary (never
|
|
109
|
+
* the routing source of truth for `choice` — see §4).
|
|
110
|
+
*/
|
|
111
|
+
discriminantJson?: Record<string, unknown> | null;
|
|
163
112
|
};
|
|
164
113
|
export type PipelineDefinitionSpec = {
|
|
165
114
|
key: string;
|
|
@@ -173,14 +122,12 @@ export type PipelineDefinitionSpec = {
|
|
|
173
122
|
/** Step specs referenced by this pipeline. Used by the push command to auto-push steps that aren't explicitly exported. */
|
|
174
123
|
_stepDefinitions?: StepDefinitionSpec[];
|
|
175
124
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
};
|
|
186
|
-
export declare function buildPipelineSpec(config: DefinePipelineInput): PipelineDefinitionSpec;
|
|
125
|
+
/**
|
|
126
|
+
* Compiles a flat, ASL-flavored pipeline definition (see
|
|
127
|
+
* docs/research/flat-pipeline-sdk-and-visual-designer.md §4) into the wire
|
|
128
|
+
* `PipelineDefinitionSpec` shape. `states` is a map keyed by node key —
|
|
129
|
+
* there is no `dependsOn`; every node's incoming edge(s) are derived here
|
|
130
|
+
* by walking each state's own forward pointer(s) (`next`/`choices[].next`/
|
|
131
|
+
* `default`/`onExhausted`/branch-completion target).
|
|
132
|
+
*/
|
|
133
|
+
export declare function definePipeline<TInput extends ZodType = z.ZodUnknown>(config: DefinePipelineInput<TInput>): PipelineDefinitionSpec;
|