@magic-marker/nurt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +551 -0
- package/dist/flow-DqIejS_0.d.ts +306 -0
- package/dist/index.d.ts +136 -0
- package/dist/index.js +996 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +123 -0
- package/dist/react/index.js +1234 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
declare class History {
|
|
2
|
+
private readonly store;
|
|
3
|
+
set(key: string, value: unknown): void;
|
|
4
|
+
get<T>(key: string): T | undefined;
|
|
5
|
+
has(key: string): boolean;
|
|
6
|
+
snapshot(): ReadonlyMap<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type StepStatus = "pending" | "running" | "success" | "error" | "skipped";
|
|
10
|
+
type RunStatus = "idle" | "running" | "success" | "error";
|
|
11
|
+
type StepResult<T> = {
|
|
12
|
+
status: "success";
|
|
13
|
+
value: T;
|
|
14
|
+
} | {
|
|
15
|
+
error: string;
|
|
16
|
+
status: "error";
|
|
17
|
+
} | {
|
|
18
|
+
status: "skipped";
|
|
19
|
+
};
|
|
20
|
+
interface RunHandle {
|
|
21
|
+
addGroupMember(groupName: string, member: GroupMember): void;
|
|
22
|
+
provide(path: string, value: unknown): void;
|
|
23
|
+
sealGroup(groupName: string): void;
|
|
24
|
+
spawnGroup(groupName: string, members: readonly GroupMember[]): void;
|
|
25
|
+
}
|
|
26
|
+
interface StepContext {
|
|
27
|
+
readonly history: History;
|
|
28
|
+
provided<T>(): T;
|
|
29
|
+
readonly run: RunHandle;
|
|
30
|
+
readonly runId: string;
|
|
31
|
+
readonly signal: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
interface Executable<TInput, TOutput> {
|
|
34
|
+
execute(input: TInput, ctx: StepContext): Promise<TOutput>;
|
|
35
|
+
}
|
|
36
|
+
type StepHandler<TInput, TOutput> = ((input: TInput, ctx: StepContext) => Promise<TOutput>) | Executable<TInput, TOutput>;
|
|
37
|
+
interface StepOptions<TInput, TOutput> {
|
|
38
|
+
allowFailures?: boolean;
|
|
39
|
+
execute: StepHandler<TInput, TOutput>;
|
|
40
|
+
terminal?: boolean;
|
|
41
|
+
transform?: (parentOutputs: unknown) => TInput;
|
|
42
|
+
}
|
|
43
|
+
interface StepDefinition {
|
|
44
|
+
readonly allowFailures: boolean;
|
|
45
|
+
readonly handler: StepHandler<unknown, unknown>;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly parentNames: readonly string[];
|
|
48
|
+
readonly terminal: boolean;
|
|
49
|
+
readonly transform?: (parentOutputs: unknown) => unknown;
|
|
50
|
+
}
|
|
51
|
+
interface GroupDefinition {
|
|
52
|
+
readonly dependsOn: readonly string[];
|
|
53
|
+
readonly name: string;
|
|
54
|
+
}
|
|
55
|
+
interface StepRecord {
|
|
56
|
+
completedAt?: number;
|
|
57
|
+
durationMs?: number;
|
|
58
|
+
error?: string;
|
|
59
|
+
readonly name: string;
|
|
60
|
+
output?: unknown;
|
|
61
|
+
readonly parentNames: readonly string[];
|
|
62
|
+
startedAt?: number;
|
|
63
|
+
status: StepStatus;
|
|
64
|
+
}
|
|
65
|
+
interface FlowRunResult {
|
|
66
|
+
readonly completedAt: number;
|
|
67
|
+
readonly history: ReadonlyMap<string, unknown>;
|
|
68
|
+
readonly runId: string;
|
|
69
|
+
readonly startedAt: number;
|
|
70
|
+
readonly status: RunStatus;
|
|
71
|
+
readonly steps: readonly StepRecord[];
|
|
72
|
+
}
|
|
73
|
+
interface FlowHooks {
|
|
74
|
+
onChange?: () => void;
|
|
75
|
+
onRunComplete?: (result: FlowRunResult) => void;
|
|
76
|
+
onStepAdded?: (step: StepRecord) => void;
|
|
77
|
+
onStepComplete?: (step: StepRecord) => void;
|
|
78
|
+
onStepError?: (step: StepRecord) => void;
|
|
79
|
+
onStepStart?: (step: StepRecord) => void;
|
|
80
|
+
}
|
|
81
|
+
interface RunOptions {
|
|
82
|
+
failFast?: boolean;
|
|
83
|
+
hooks?: FlowHooks;
|
|
84
|
+
injectedSteps?: Map<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
declare const GROUP_REF_BRAND: unique symbol;
|
|
87
|
+
interface GroupRef<K extends string> {
|
|
88
|
+
readonly [GROUP_REF_BRAND]: true;
|
|
89
|
+
readonly groupName: K;
|
|
90
|
+
}
|
|
91
|
+
declare function group<K extends string>(name: K): GroupRef<K>;
|
|
92
|
+
declare function isGroupRef(value: unknown): value is GroupRef<string>;
|
|
93
|
+
type ParentOutputs<TRegistry extends Record<string, unknown>, TParents extends readonly (keyof TRegistry & string)[]> = {
|
|
94
|
+
[K in TParents[number]]: TRegistry[K];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Resolves a mixed dependency array (step names + group refs) to their types.
|
|
98
|
+
*/
|
|
99
|
+
type ResolveInput<TRegistry extends Record<string, unknown>, TDeps extends readonly unknown[]> = {
|
|
100
|
+
[K in TDeps[number] as K extends string ? K : K extends GroupRef<infer G> ? G : never]: K extends string ? TRegistry[K] : K extends GroupRef<infer G> ? TRegistry[G] : never;
|
|
101
|
+
};
|
|
102
|
+
interface SingleMember<TInput, TOutput> {
|
|
103
|
+
readonly execute: StepHandler<TInput, TOutput>;
|
|
104
|
+
readonly name: string;
|
|
105
|
+
}
|
|
106
|
+
interface SubgraphMember {
|
|
107
|
+
readonly externalDeps?: Record<string, string>;
|
|
108
|
+
readonly flow: Flow;
|
|
109
|
+
readonly name: string;
|
|
110
|
+
}
|
|
111
|
+
type GroupMember = SingleMember<unknown, unknown> | SubgraphMember;
|
|
112
|
+
declare function isSubgraphMember(member: GroupMember): member is SubgraphMember;
|
|
113
|
+
declare function isExecutable(value: unknown): value is Executable<unknown, unknown>;
|
|
114
|
+
declare function invokeHandler<TInput, TOutput>(handler: StepHandler<TInput, TOutput>, input: TInput, ctx: StepContext): Promise<TOutput>;
|
|
115
|
+
|
|
116
|
+
interface GroupRuntime {
|
|
117
|
+
readonly dependsOn: readonly string[];
|
|
118
|
+
readonly members: GroupMemberRuntime[];
|
|
119
|
+
readonly name: string;
|
|
120
|
+
sealed: boolean;
|
|
121
|
+
}
|
|
122
|
+
interface GroupMemberRuntime {
|
|
123
|
+
childRun?: FlowRun;
|
|
124
|
+
completedAt?: number;
|
|
125
|
+
error?: string;
|
|
126
|
+
readonly member: GroupMember;
|
|
127
|
+
readonly name: string;
|
|
128
|
+
output?: unknown;
|
|
129
|
+
startedAt?: number;
|
|
130
|
+
status: "pending" | "running" | "success" | "error";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface FlowSnapshot {
|
|
134
|
+
flow: {
|
|
135
|
+
groups: FlowSnapshotGroup[];
|
|
136
|
+
name: string;
|
|
137
|
+
steps: FlowSnapshotStep[];
|
|
138
|
+
};
|
|
139
|
+
run: {
|
|
140
|
+
completedAt?: number;
|
|
141
|
+
runId: string;
|
|
142
|
+
startedAt: number;
|
|
143
|
+
status: RunStatus;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
interface FlowSnapshotStep {
|
|
147
|
+
allowFailures: boolean;
|
|
148
|
+
completedAt?: number;
|
|
149
|
+
durationMs?: number;
|
|
150
|
+
error?: string;
|
|
151
|
+
name: string;
|
|
152
|
+
output?: unknown;
|
|
153
|
+
parentNames: string[];
|
|
154
|
+
startedAt?: number;
|
|
155
|
+
status: StepStatus;
|
|
156
|
+
terminal: boolean;
|
|
157
|
+
}
|
|
158
|
+
interface FlowSnapshotGroup {
|
|
159
|
+
dependsOn: string[];
|
|
160
|
+
members: FlowSnapshotGroupMember[];
|
|
161
|
+
name: string;
|
|
162
|
+
sealed: boolean;
|
|
163
|
+
}
|
|
164
|
+
interface FlowSnapshotGroupMember {
|
|
165
|
+
completedAt?: number;
|
|
166
|
+
durationMs?: number;
|
|
167
|
+
error?: string;
|
|
168
|
+
externalDeps?: Record<string, string>;
|
|
169
|
+
name: string;
|
|
170
|
+
output?: unknown;
|
|
171
|
+
startedAt?: number;
|
|
172
|
+
status: "pending" | "running" | "success" | "error";
|
|
173
|
+
subgraph?: FlowSnapshot;
|
|
174
|
+
type: "single" | "subgraph";
|
|
175
|
+
}
|
|
176
|
+
interface SnapshotInput {
|
|
177
|
+
flow: {
|
|
178
|
+
groups: ReadonlyArray<{
|
|
179
|
+
dependsOn: readonly string[];
|
|
180
|
+
name: string;
|
|
181
|
+
}>;
|
|
182
|
+
name: string;
|
|
183
|
+
steps: ReadonlyArray<{
|
|
184
|
+
allowFailures: boolean;
|
|
185
|
+
name: string;
|
|
186
|
+
parentNames: readonly string[];
|
|
187
|
+
terminal: boolean;
|
|
188
|
+
}>;
|
|
189
|
+
};
|
|
190
|
+
groupRuntimes: ReadonlyMap<string, GroupRuntime>;
|
|
191
|
+
run: {
|
|
192
|
+
completedAt?: number;
|
|
193
|
+
runId: string;
|
|
194
|
+
startedAt: number;
|
|
195
|
+
status: RunStatus;
|
|
196
|
+
};
|
|
197
|
+
stepRecords: ReadonlyMap<string, {
|
|
198
|
+
completedAt?: number;
|
|
199
|
+
durationMs?: number;
|
|
200
|
+
error?: string;
|
|
201
|
+
name: string;
|
|
202
|
+
output?: unknown;
|
|
203
|
+
parentNames: readonly string[];
|
|
204
|
+
startedAt?: number;
|
|
205
|
+
status: StepStatus;
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
declare function createSnapshot(input: SnapshotInput): FlowSnapshot;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Runtime execution engine for a single flow run.
|
|
212
|
+
* Uses wave-based scheduling: collect ready steps, launch concurrently,
|
|
213
|
+
* await all, find newly ready steps, repeat.
|
|
214
|
+
*/
|
|
215
|
+
declare class FlowRun<TRegistry extends Record<string, unknown> = Record<string, unknown>> {
|
|
216
|
+
readonly runId: string;
|
|
217
|
+
private readonly flow;
|
|
218
|
+
private readonly hooks;
|
|
219
|
+
private readonly failFast;
|
|
220
|
+
private readonly abortController;
|
|
221
|
+
private readonly history;
|
|
222
|
+
private readonly stepDefs;
|
|
223
|
+
private readonly stepRecords;
|
|
224
|
+
private readonly stepOutputs;
|
|
225
|
+
private readonly groupRuntimes;
|
|
226
|
+
private readonly providedSlots;
|
|
227
|
+
private readonly providedData;
|
|
228
|
+
private status;
|
|
229
|
+
private startedAt;
|
|
230
|
+
private resolveResult;
|
|
231
|
+
readonly result: Promise<FlowRunResult>;
|
|
232
|
+
private loopRunning;
|
|
233
|
+
private readonly pendingGroupStarts;
|
|
234
|
+
private dynamicStepsAdded;
|
|
235
|
+
constructor(flow: Flow<TRegistry>, options?: RunOptions);
|
|
236
|
+
/**
|
|
237
|
+
* Read-only snapshot of current step records.
|
|
238
|
+
*/
|
|
239
|
+
get steps(): readonly StepRecord[];
|
|
240
|
+
/**
|
|
241
|
+
* JSON-serializable snapshot of the current flow + run state.
|
|
242
|
+
*/
|
|
243
|
+
snapshot(): FlowSnapshot;
|
|
244
|
+
/**
|
|
245
|
+
* Abort the run — signals all in-progress steps.
|
|
246
|
+
*/
|
|
247
|
+
abort(): void;
|
|
248
|
+
/**
|
|
249
|
+
* Add a step dynamically during execution.
|
|
250
|
+
*/
|
|
251
|
+
addStep(def: StepDefinition): void;
|
|
252
|
+
/**
|
|
253
|
+
* Spawn members into a group and auto-seal it.
|
|
254
|
+
*/
|
|
255
|
+
spawnGroup(groupName: string, members: readonly GroupMember[]): void;
|
|
256
|
+
/**
|
|
257
|
+
* Add a single member to a group (without sealing).
|
|
258
|
+
*/
|
|
259
|
+
addGroupMember(groupName: string, member: GroupMember): void;
|
|
260
|
+
/**
|
|
261
|
+
* Seal a group — no more members can be added.
|
|
262
|
+
*/
|
|
263
|
+
sealGroup(groupName: string): void;
|
|
264
|
+
/**
|
|
265
|
+
* Provide a step implementation (slot fill) or external data.
|
|
266
|
+
*/
|
|
267
|
+
provide(path: string, value: StepHandler<unknown, unknown> | Record<string, unknown> | unknown): void;
|
|
268
|
+
private createContext;
|
|
269
|
+
private startExecution;
|
|
270
|
+
private executionLoop;
|
|
271
|
+
/**
|
|
272
|
+
* Check for and launch any newly ready steps without waiting for the full wave.
|
|
273
|
+
* Called after each individual step completion.
|
|
274
|
+
*/
|
|
275
|
+
private scheduleReadySteps;
|
|
276
|
+
private executeStep;
|
|
277
|
+
private buildInput;
|
|
278
|
+
private markSkippableSteps;
|
|
279
|
+
private getStatusMap;
|
|
280
|
+
private hasAnyError;
|
|
281
|
+
private areGroupDependenciesMet;
|
|
282
|
+
private startOrDeferGroup;
|
|
283
|
+
private flushPendingGroups;
|
|
284
|
+
private startGroupMembers;
|
|
285
|
+
private checkGroupCompletion;
|
|
286
|
+
private completeRun;
|
|
287
|
+
private fireHook;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Immutable DAG blueprint produced by FlowBuilder.build().
|
|
292
|
+
* Call .run() to create execution instances.
|
|
293
|
+
*/
|
|
294
|
+
declare class Flow<TRegistry extends Record<string, unknown> = Record<string, unknown>> {
|
|
295
|
+
readonly name: string;
|
|
296
|
+
readonly steps: readonly StepDefinition[];
|
|
297
|
+
readonly groups: readonly GroupDefinition[];
|
|
298
|
+
constructor(name: string, steps: StepDefinition[], groups: GroupDefinition[]);
|
|
299
|
+
/**
|
|
300
|
+
* Creates a new FlowRun instance.
|
|
301
|
+
* Multiple runs can execute concurrently from the same Flow.
|
|
302
|
+
*/
|
|
303
|
+
run(options?: RunOptions): FlowRun<TRegistry>;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export { isGroupRef as A, isSubgraphMember as B, type Executable as E, Flow as F, type GroupDefinition as G, History as H, type ParentOutputs as P, type ResolveInput as R, type StepDefinition as S, type StepHandler as a, type StepOptions as b, type GroupRef as c, type SubgraphMember as d, type StepStatus as e, type FlowHooks as f, FlowRun as g, type FlowRunResult as h, type FlowSnapshot as i, type FlowSnapshotGroup as j, type FlowSnapshotGroupMember as k, type FlowSnapshotStep as l, type GroupMember as m, type GroupMemberRuntime as n, type GroupRuntime as o, type RunHandle as p, type RunOptions as q, type RunStatus as r, type SingleMember as s, type StepContext as t, type StepRecord as u, type StepResult as v, createSnapshot as w, group as x, invokeHandler as y, isExecutable as z };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { S as StepDefinition, G as GroupDefinition, a as StepHandler, b as StepOptions, c as GroupRef, F as Flow, d as SubgraphMember, e as StepStatus } from './flow-DqIejS_0.js';
|
|
2
|
+
export { E as Executable, f as FlowHooks, g as FlowRun, h as FlowRunResult, i as FlowSnapshot, j as FlowSnapshotGroup, k as FlowSnapshotGroupMember, l as FlowSnapshotStep, m as GroupMember, n as GroupMemberRuntime, o as GroupRuntime, H as History, P as ParentOutputs, R as ResolveInput, p as RunHandle, q as RunOptions, r as RunStatus, s as SingleMember, t as StepContext, u as StepRecord, v as StepResult, w as createSnapshot, x as group, y as invokeHandler, z as isExecutable, A as isGroupRef, B as isSubgraphMember } from './flow-DqIejS_0.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Chainable builder for constructing type-safe flow graphs.
|
|
6
|
+
*
|
|
7
|
+
* Each `.step()` call returns a new FlowBuilder with an expanded registry.
|
|
8
|
+
* Positional arguments allow TypeScript to infer literal string types
|
|
9
|
+
* without needing `as const`.
|
|
10
|
+
*/
|
|
11
|
+
declare class FlowBuilder<TRegistry extends Record<string, unknown> = {}> {
|
|
12
|
+
private readonly flowName;
|
|
13
|
+
private readonly steps;
|
|
14
|
+
private readonly groups;
|
|
15
|
+
private readonly knownNames;
|
|
16
|
+
constructor(flowName: string, steps?: StepDefinition[], groups?: GroupDefinition[], knownNames?: Set<string>);
|
|
17
|
+
/**
|
|
18
|
+
* Root step — no parents.
|
|
19
|
+
* .step("name", executeFn)
|
|
20
|
+
* .step("name", executableInstance)
|
|
21
|
+
*/
|
|
22
|
+
step<TName extends string, TOutput>(name: TName, handler: StepHandler<Record<string, unknown>, TOutput>): FlowBuilder<TRegistry & Record<TName, TOutput>>;
|
|
23
|
+
/**
|
|
24
|
+
* Step with parents — input auto-derived from parent outputs.
|
|
25
|
+
* .step("name", ["parent1", "parent2"], executeFn)
|
|
26
|
+
*/
|
|
27
|
+
step<TName extends string, TParents extends readonly (keyof TRegistry & string)[], TOutput>(name: TName, parents: [...TParents], handler: StepHandler<{
|
|
28
|
+
[K in TParents[number]]: TRegistry[K];
|
|
29
|
+
}, TOutput>): FlowBuilder<TRegistry & Record<TName, TOutput>>;
|
|
30
|
+
/**
|
|
31
|
+
* Step with parents + options object.
|
|
32
|
+
* .step("name", ["parent1"], { execute, transform?, allowFailures?, terminal? })
|
|
33
|
+
*/
|
|
34
|
+
step<TName extends string, TParents extends readonly (keyof TRegistry & string)[], TOutput>(name: TName, parents: [...TParents], options: StepOptions<{
|
|
35
|
+
[K in TParents[number]]: TRegistry[K];
|
|
36
|
+
}, TOutput>): FlowBuilder<TRegistry & Record<TName, TOutput>>;
|
|
37
|
+
/**
|
|
38
|
+
* Step with group ref dependencies.
|
|
39
|
+
* .step("name", [group("reviews")], executeFn)
|
|
40
|
+
*/
|
|
41
|
+
step<TName extends string, TDeps extends readonly unknown[], TOutput>(name: TName, deps: [...TDeps], handler: StepHandler<{
|
|
42
|
+
[K in TDeps[number] as K extends string ? K : K extends GroupRef<infer G> ? G : never]: K extends string ? TRegistry[K & keyof TRegistry] : K extends GroupRef<infer G> ? TRegistry[G & keyof TRegistry] : never;
|
|
43
|
+
}, TOutput> | StepOptions<{
|
|
44
|
+
[K in TDeps[number] as K extends string ? K : K extends GroupRef<infer G> ? G : never]: K extends string ? TRegistry[K & keyof TRegistry] : K extends GroupRef<infer G> ? TRegistry[G & keyof TRegistry] : never;
|
|
45
|
+
}, TOutput>): FlowBuilder<TRegistry & Record<TName, TOutput>>;
|
|
46
|
+
/**
|
|
47
|
+
* Declare a typed group for dynamic fan-in.
|
|
48
|
+
* .group<TOut>("reviews", { dependsOn: ["arbiter"] })
|
|
49
|
+
*/
|
|
50
|
+
group<TOut, TName extends string = string>(name: TName, options?: {
|
|
51
|
+
dependsOn?: (keyof TRegistry & string)[];
|
|
52
|
+
}): FlowBuilder<TRegistry & Record<TName, TOut[]>>;
|
|
53
|
+
/**
|
|
54
|
+
* Validates the DAG and returns an immutable Flow.
|
|
55
|
+
*/
|
|
56
|
+
build(): Flow<TRegistry>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Entry point: creates a new FlowBuilder.
|
|
60
|
+
*/
|
|
61
|
+
declare function flow(name: string): FlowBuilder;
|
|
62
|
+
|
|
63
|
+
interface PipelineStepDef {
|
|
64
|
+
execute?: StepHandler<unknown, unknown>;
|
|
65
|
+
name: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Convenience builder that creates a SubgraphMember with a linear DAG.
|
|
69
|
+
* Each step depends on the previous one, forming a sequential pipeline.
|
|
70
|
+
*
|
|
71
|
+
* ```typescript
|
|
72
|
+
* pipeline("tone-analysis", [
|
|
73
|
+
* { name: "detect", execute: detectFn },
|
|
74
|
+
* { name: "classify", execute: classifyFn },
|
|
75
|
+
* { name: "score", execute: scoreFn },
|
|
76
|
+
* ])
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* is equivalent to building a flow:
|
|
80
|
+
* detect → classify → score (terminal)
|
|
81
|
+
*/
|
|
82
|
+
declare function pipeline(name: string, steps: PipelineStepDef[]): SubgraphMember;
|
|
83
|
+
|
|
84
|
+
declare class CycleDetectedError extends Error {
|
|
85
|
+
constructor(cycle: string[]);
|
|
86
|
+
}
|
|
87
|
+
declare class DuplicateStepError extends Error {
|
|
88
|
+
constructor(name: string);
|
|
89
|
+
}
|
|
90
|
+
declare class UnknownParentError extends Error {
|
|
91
|
+
constructor(stepName: string, parentName: string);
|
|
92
|
+
}
|
|
93
|
+
declare class UnsealedGroupError extends Error {
|
|
94
|
+
constructor(groupName: string);
|
|
95
|
+
}
|
|
96
|
+
declare class UnfilledSlotError extends Error {
|
|
97
|
+
constructor(slotPath: string);
|
|
98
|
+
}
|
|
99
|
+
declare class StepExecutionError extends Error {
|
|
100
|
+
readonly stepName: string;
|
|
101
|
+
readonly cause: unknown;
|
|
102
|
+
constructor(stepName: string, cause: unknown);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface GraphNode {
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly parentNames: readonly string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Validates that the graph has no cycles using Kahn's algorithm.
|
|
111
|
+
* Throws CycleDetectedError if a cycle is found.
|
|
112
|
+
*/
|
|
113
|
+
declare function validateAcyclic(nodes: readonly GraphNode[]): void;
|
|
114
|
+
/**
|
|
115
|
+
* Returns a valid topological ordering of the nodes.
|
|
116
|
+
* Assumes the graph is acyclic (call validateAcyclic first).
|
|
117
|
+
*/
|
|
118
|
+
declare function topologicalSort(nodes: readonly GraphNode[]): string[];
|
|
119
|
+
/**
|
|
120
|
+
* Returns names of steps that are ready to execute:
|
|
121
|
+
* all parents have completed with "success" status.
|
|
122
|
+
*/
|
|
123
|
+
declare function getReadySteps(steps: readonly GraphNode[], statuses: ReadonlyMap<string, StepStatus>): string[];
|
|
124
|
+
/**
|
|
125
|
+
* Returns names of steps that should be skipped because
|
|
126
|
+
* at least one parent has "error" or "skipped" status
|
|
127
|
+
* and the step does NOT have allowFailures set.
|
|
128
|
+
*/
|
|
129
|
+
declare function getSkippableSteps(steps: readonly StepDefinition[], statuses: ReadonlyMap<string, StepStatus>): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Returns names of steps with allowFailures that are ready to execute:
|
|
132
|
+
* all parents have completed (success, error, or skipped).
|
|
133
|
+
*/
|
|
134
|
+
declare function getReadyWithFailures(steps: readonly StepDefinition[], statuses: ReadonlyMap<string, StepStatus>): string[];
|
|
135
|
+
|
|
136
|
+
export { CycleDetectedError, DuplicateStepError, Flow, FlowBuilder, GroupRef, type PipelineStepDef, StepDefinition, StepExecutionError, StepHandler, StepOptions, StepStatus, SubgraphMember, UnfilledSlotError, UnknownParentError, UnsealedGroupError, flow, getReadySteps, getReadyWithFailures, getSkippableSteps, pipeline, topologicalSort, validateAcyclic };
|