@workglow/task-graph 0.2.23 → 0.2.25
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/browser.js +1957 -1622
- package/dist/browser.js.map +38 -23
- package/dist/bun.js +1958 -1623
- package/dist/bun.js.map +38 -23
- package/dist/common.d.ts +14 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/node.js +1958 -1623
- package/dist/node.js.map +38 -23
- package/dist/task/CacheCoordinator.d.ts +48 -0
- package/dist/task/CacheCoordinator.d.ts.map +1 -0
- package/dist/task/FallbackTask.d.ts +1 -0
- package/dist/task/FallbackTask.d.ts.map +1 -1
- package/dist/task/FallbackTaskRunner.d.ts +3 -2
- package/dist/task/FallbackTaskRunner.d.ts.map +1 -1
- package/dist/task/GraphAsTask.d.ts +1 -0
- package/dist/task/GraphAsTask.d.ts.map +1 -1
- package/dist/task/GraphAsTaskRunner.d.ts +4 -3
- package/dist/task/GraphAsTaskRunner.d.ts.map +1 -1
- package/dist/task/ITask.d.ts +19 -3
- package/dist/task/ITask.d.ts.map +1 -1
- package/dist/task/IteratorTaskRunner.d.ts +3 -2
- package/dist/task/IteratorTaskRunner.d.ts.map +1 -1
- package/dist/task/JobQueueFactory.d.ts +1 -0
- package/dist/task/JobQueueFactory.d.ts.map +1 -1
- package/dist/task/MapTask.d.ts +1 -0
- package/dist/task/MapTask.d.ts.map +1 -1
- package/dist/task/ReduceTask.d.ts +1 -0
- package/dist/task/ReduceTask.d.ts.map +1 -1
- package/dist/task/StreamProcessor.d.ts +38 -0
- package/dist/task/StreamProcessor.d.ts.map +1 -0
- package/dist/task/TaskRunContext.d.ts +33 -0
- package/dist/task/TaskRunContext.d.ts.map +1 -0
- package/dist/task/TaskRunner.d.ts +31 -47
- package/dist/task/TaskRunner.d.ts.map +1 -1
- package/dist/task/WhileTask.d.ts +1 -0
- package/dist/task/WhileTask.d.ts.map +1 -1
- package/dist/task/WhileTaskRunner.d.ts +3 -2
- package/dist/task/WhileTaskRunner.d.ts.map +1 -1
- package/dist/task-graph/Dataflow.d.ts +1 -1
- package/dist/task-graph/EdgeMaterializer.d.ts +88 -0
- package/dist/task-graph/EdgeMaterializer.d.ts.map +1 -0
- package/dist/task-graph/GraphSchemaUtils.d.ts +19 -0
- package/dist/task-graph/GraphSchemaUtils.d.ts.map +1 -1
- package/dist/task-graph/IWorkflow.d.ts +11 -1
- package/dist/task-graph/IWorkflow.d.ts.map +1 -1
- package/dist/task-graph/LoopBuilderContext.d.ts +60 -0
- package/dist/task-graph/LoopBuilderContext.d.ts.map +1 -0
- package/dist/task-graph/RunContext.d.ts +39 -0
- package/dist/task-graph/RunContext.d.ts.map +1 -0
- package/dist/task-graph/RunScheduler.d.ts +81 -0
- package/dist/task-graph/RunScheduler.d.ts.map +1 -0
- package/dist/task-graph/StreamPump.d.ts +122 -0
- package/dist/task-graph/StreamPump.d.ts.map +1 -0
- package/dist/task-graph/TaskGraph.d.ts +10 -2
- package/dist/task-graph/TaskGraph.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphRunner.d.ts +31 -167
- package/dist/task-graph/TaskGraphRunner.d.ts.map +1 -1
- package/dist/task-graph/Workflow.d.ts +18 -99
- package/dist/task-graph/Workflow.d.ts.map +1 -1
- package/dist/task-graph/WorkflowBuilder.d.ts +93 -0
- package/dist/task-graph/WorkflowBuilder.d.ts.map +1 -0
- package/dist/task-graph/WorkflowCacheAdapter.d.ts +19 -0
- package/dist/task-graph/WorkflowCacheAdapter.d.ts.map +1 -0
- package/dist/task-graph/WorkflowEventBridge.d.ts +41 -0
- package/dist/task-graph/WorkflowEventBridge.d.ts.map +1 -0
- package/dist/task-graph/WorkflowFactories.d.ts +52 -0
- package/dist/task-graph/WorkflowFactories.d.ts.map +1 -0
- package/dist/task-graph/WorkflowPipe.d.ts +32 -0
- package/dist/task-graph/WorkflowPipe.d.ts.map +1 -0
- package/dist/task-graph/WorkflowRunContext.d.ts +27 -0
- package/dist/task-graph/WorkflowRunContext.d.ts.map +1 -0
- package/dist/task-graph/WorkflowTask.d.ts +19 -0
- package/dist/task-graph/WorkflowTask.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/EXECUTION_MODEL.md +13 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { TaskOutputRepository } from "../storage/TaskOutputRepository";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* Owns the workflow's TaskOutputRepository and supplies it to the underlying
|
|
10
|
+
* TaskGraph (at construction) and to graph.run() (per run). Today this is a
|
|
11
|
+
* thin pass-through; it is the growth point for cache key derivation,
|
|
12
|
+
* invalidation, and suspend/resume wiring in later work.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WorkflowCacheAdapter {
|
|
15
|
+
private readonly _outputCache?;
|
|
16
|
+
constructor(cache?: TaskOutputRepository);
|
|
17
|
+
outputCache(): TaskOutputRepository | undefined;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=WorkflowCacheAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowCacheAdapter.d.ts","sourceRoot":"","sources":["../../src/task-graph/WorkflowCacheAdapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE5E;;;;;;GAMG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAuB;IAErD,YAAY,KAAK,CAAC,EAAE,oBAAoB,EAEvC;IAEM,WAAW,IAAI,oBAAoB,GAAG,SAAS,CAErD;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { EventEmitter } from "@workglow/util";
|
|
7
|
+
import type { TaskGraph } from "./TaskGraph";
|
|
8
|
+
import type { WorkflowEventListeners } from "./Workflow";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* Routes TaskGraph mutation events, entitlement updates, and per-run streaming
|
|
12
|
+
* events to a Workflow's EventEmitter. Owns subscription lifecycle:
|
|
13
|
+
* attach(graph) → subscribe to mutation + entitlement events
|
|
14
|
+
* detach() → unsubscribe (called on graph swap and reset)
|
|
15
|
+
* beginRun() → subscribe to streaming events for the current run
|
|
16
|
+
* endRun() → unsubscribe streaming
|
|
17
|
+
*
|
|
18
|
+
* The bridge does NOT own the events emitter — the facade Workflow does. The
|
|
19
|
+
* bridge holds a reference and emits through it.
|
|
20
|
+
*
|
|
21
|
+
* Loop-builder Workflows do NOT receive a bridge (matches today's behavior:
|
|
22
|
+
* Workflow.ts only constructs a bridge when `parent` is undefined).
|
|
23
|
+
*/
|
|
24
|
+
export declare class WorkflowEventBridge {
|
|
25
|
+
private readonly _events;
|
|
26
|
+
private _attachedGraph?;
|
|
27
|
+
private _entitlementUnsub?;
|
|
28
|
+
private readonly _onChanged;
|
|
29
|
+
constructor(events: EventEmitter<WorkflowEventListeners>);
|
|
30
|
+
attach(graph: TaskGraph): void;
|
|
31
|
+
detach(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Subscribes to streaming events on the attached graph for the duration of
|
|
34
|
+
* one run. Returns an unsubscribe token that the caller MUST hold locally
|
|
35
|
+
* and invoke when the run ends. Returning the token (rather than storing
|
|
36
|
+
* it on the bridge) keeps concurrent runs from clobbering each other's
|
|
37
|
+
* subscriptions — pre-refactor behavior.
|
|
38
|
+
*/
|
|
39
|
+
beginRun(): (() => void) | undefined;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=WorkflowEventBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowEventBridge.d.ts","sourceRoot":"","sources":["../../src/task-graph/WorkflowEventBridge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,cAAc,CAAC,CAAY;IACnC,OAAO,CAAC,iBAAiB,CAAC,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAwB;IAEnD,YAAY,MAAM,EAAE,YAAY,CAAC,sBAAsB,CAAC,EAGvD;IAEM,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAYpC;IAEM,MAAM,IAAI,IAAI,CAYpB;IAED;;;;;;OAMG;IACI,QAAQ,IAAI,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAQ1C;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { ITaskConstructor } from "../task/ITask";
|
|
7
|
+
import type { DataPorts, TaskConfig } from "../task/TaskTypes";
|
|
8
|
+
import { Workflow } from "./Workflow";
|
|
9
|
+
export type CreateWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig<I>> = (input?: Partial<I>, config?: Partial<C>) => Workflow<I, O>;
|
|
10
|
+
export declare function CreateWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig<I> = TaskConfig<I>>(taskClass: ITaskConstructor<I, O, C>): CreateWorkflow<I, O, C>;
|
|
11
|
+
/**
|
|
12
|
+
* Type for loop workflow methods (map, while, reduce).
|
|
13
|
+
* Represents the method signature with proper `this` context.
|
|
14
|
+
* Loop methods take only a config parameter - input is not used for loop tasks.
|
|
15
|
+
*/
|
|
16
|
+
export type CreateLoopWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig<I> = TaskConfig<I>> = (this: Workflow<I, O>, config?: Partial<C>) => Workflow<I, O>;
|
|
17
|
+
/**
|
|
18
|
+
* Factory function that creates a loop workflow method for a given task class.
|
|
19
|
+
* Returns a method that can be assigned to Workflow.prototype.
|
|
20
|
+
*
|
|
21
|
+
* @param taskClass - The iterator task class (MapTask, ReduceTask, etc.)
|
|
22
|
+
* @returns A method that creates the task and returns a loop builder workflow
|
|
23
|
+
*/
|
|
24
|
+
export declare function CreateLoopWorkflow<I extends DataPorts, O extends DataPorts, C extends TaskConfig<I> = TaskConfig<I>>(taskClass: ITaskConstructor<I, O, C>): CreateLoopWorkflow<I, O, C>;
|
|
25
|
+
/**
|
|
26
|
+
* Type for end loop workflow methods (endMap, endBatch, etc.).
|
|
27
|
+
*/
|
|
28
|
+
export type EndLoopWorkflow = (this: Workflow) => Workflow;
|
|
29
|
+
/**
|
|
30
|
+
* Factory function that creates an end loop workflow method.
|
|
31
|
+
*
|
|
32
|
+
* @param methodName - The name of the method (for error messages)
|
|
33
|
+
* @returns A method that finalizes the loop and returns to the parent workflow
|
|
34
|
+
*/
|
|
35
|
+
export declare function CreateEndLoopWorkflow(methodName: string): EndLoopWorkflow;
|
|
36
|
+
/**
|
|
37
|
+
* Type for adaptive workflow methods that dispatch to scalar or vector variant
|
|
38
|
+
* based on the previous task's output schema.
|
|
39
|
+
*/
|
|
40
|
+
export type CreateAdaptiveWorkflow<IS extends DataPorts, _OS extends DataPorts, IV extends DataPorts, _OV extends DataPorts, CS extends TaskConfig<IS> = TaskConfig<IS>, CV extends TaskConfig<IV> = TaskConfig<IV>> = (this: Workflow, input?: Partial<IS> & Partial<IV>, config?: Partial<CS> & Partial<CV>) => Workflow;
|
|
41
|
+
/**
|
|
42
|
+
* Factory that creates an adaptive workflow method: when called, inspects the
|
|
43
|
+
* output schema of the last task in the chain and delegates to the vector
|
|
44
|
+
* variant if it has TypedArray output, otherwise to the scalar variant.
|
|
45
|
+
* If there is no previous task, defaults to the scalar variant.
|
|
46
|
+
*
|
|
47
|
+
* @param scalarClass - Task class for scalar path (e.g. ScalarAddTask)
|
|
48
|
+
* @param vectorClass - Task class for vector path (e.g. VectorSumTask)
|
|
49
|
+
* @returns A method suitable for Workflow.prototype
|
|
50
|
+
*/
|
|
51
|
+
export declare function CreateAdaptiveWorkflow<IS extends DataPorts, OS extends DataPorts, IV extends DataPorts, OV extends DataPorts, CS extends TaskConfig<IS> = TaskConfig<IS>, CV extends TaskConfig<IV> = TaskConfig<IV>>(scalarClass: ITaskConstructor<IS, OS, CS>, vectorClass: ITaskConstructor<IV, OV, CV>): CreateAdaptiveWorkflow<IS, OS, IV, OV, CS, CV>;
|
|
52
|
+
//# sourceMappingURL=WorkflowFactories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowFactories.d.ts","sourceRoot":"","sources":["../../src/task-graph/WorkflowFactories.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,IAAI,CAC9F,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,KAChB,QAAQ,CAA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SAAS,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAC1C,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,IACxC,CACF,IAAI,EAAE,QAAQ,EACd,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,EACjC,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,KAC/B,QAAQ,CAAC;AAEd;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,SAAS,SAAS,EACpB,EAAE,SAAS,SAAS,EACpB,EAAE,SAAS,SAAS,EACpB,EAAE,SAAS,SAAS,EACpB,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAC1C,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,EAAE,CAAC,EAE1C,WAAW,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACzC,WAAW,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GACxC,sBAAsB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAiBhD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { ITask } from "../task/ITask";
|
|
7
|
+
import type { DataPorts } from "../task/TaskTypes";
|
|
8
|
+
import type { PipeFunction, Taskish } from "./Conversions";
|
|
9
|
+
import type { ITaskGraph } from "./ITaskGraph";
|
|
10
|
+
import type { IWorkflow } from "./IWorkflow";
|
|
11
|
+
import type { CompoundMergeStrategy } from "./TaskGraphRunner";
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function getLastTask(workflow: IWorkflow): ITask<any, any, any> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function connect(source: ITask<any, any, any>, target: ITask<any, any, any>, workflow: IWorkflow<any, any>): void;
|
|
20
|
+
export declare function pipe<A extends DataPorts, B extends DataPorts>([fn1]: [Taskish<A, B>], workflow?: IWorkflow<A, B>): IWorkflow<A, B>;
|
|
21
|
+
export declare function pipe<A extends DataPorts, B extends DataPorts, C extends DataPorts>([fn1, fn2]: [Taskish<A, B>, Taskish<B, C>], workflow?: IWorkflow<A, C>): IWorkflow<A, C>;
|
|
22
|
+
export declare function pipe<A extends DataPorts, B extends DataPorts, C extends DataPorts, D extends DataPorts>([fn1, fn2, fn3]: [Taskish<A, B>, Taskish<B, C>, Taskish<C, D>], workflow?: IWorkflow<A, D>): IWorkflow<A, D>;
|
|
23
|
+
export declare function pipe<A extends DataPorts, B extends DataPorts, C extends DataPorts, D extends DataPorts, E extends DataPorts>([fn1, fn2, fn3, fn4]: [Taskish<A, B>, Taskish<B, C>, Taskish<C, D>, Taskish<D, E>], workflow?: IWorkflow<A, E>): IWorkflow<A, E>;
|
|
24
|
+
export declare function pipe<A extends DataPorts, B extends DataPorts, C extends DataPorts, D extends DataPorts, E extends DataPorts, F extends DataPorts>([fn1, fn2, fn3, fn4, fn5]: [
|
|
25
|
+
Taskish<A, B>,
|
|
26
|
+
Taskish<B, C>,
|
|
27
|
+
Taskish<C, D>,
|
|
28
|
+
Taskish<D, E>,
|
|
29
|
+
Taskish<E, F>
|
|
30
|
+
], workflow?: IWorkflow<A, F>): IWorkflow<A, F>;
|
|
31
|
+
export declare function parallel<I extends DataPorts = DataPorts, O extends DataPorts = DataPorts>(args: (PipeFunction<I, O> | ITask<I, O> | IWorkflow<I, O> | ITaskGraph)[], mergeFn?: CompoundMergeStrategy, workflow?: IWorkflow<I, O>): IWorkflow<I, O>;
|
|
32
|
+
//# sourceMappingURL=WorkflowPipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowPipe.d.ts","sourceRoot":"","sources":["../../src/task-graph/WorkflowPipe.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAS/D;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAGjF;AAED;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC5B,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC5B,QAAQ,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,GAC5B,IAAI,CAIN;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAC3D,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EACtB,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEnB,wBAAgB,IAA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B,wBAAgB,IAAI,CAClB,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,SAAS,EAEnB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IACzB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACb,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACb,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACb,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACb,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACd,EACD,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACzB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAkBnB,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,EACvF,IAAI,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,EAAE,EACzE,OAAO,GAAE,qBAAsC,EAC/C,QAAQ,GAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAwB,GAC/C,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAiBjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
* Per-run mutable state for a single Workflow.run() invocation. Built at the
|
|
9
|
+
* top of run(), discarded in the run's finally clause. Mirrors RunContext on
|
|
10
|
+
* the TaskGraphRunner side: a small value object so per-run resources have a
|
|
11
|
+
* single owner with a clear disposal point, and so suspend/resume work in the
|
|
12
|
+
* future has an obvious place to grow.
|
|
13
|
+
*
|
|
14
|
+
* Single-field on the facade (last-run-wins for abort), matching the pre-
|
|
15
|
+
* existing abort semantics — concurrent run() calls overwrite the field, and
|
|
16
|
+
* abort() only targets the most-recently-started run. The streaming unsub
|
|
17
|
+
* lives on the context (not the bridge) so concurrent runs do not clobber
|
|
18
|
+
* each other's streaming subscriptions.
|
|
19
|
+
*/
|
|
20
|
+
export declare class WorkflowRunContext {
|
|
21
|
+
readonly abortController: AbortController;
|
|
22
|
+
unsubStreaming?: () => void;
|
|
23
|
+
constructor();
|
|
24
|
+
/** Releases the streaming subscription if one is held. Idempotent. */
|
|
25
|
+
dispose(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=WorkflowRunContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowRunContext.d.ts","sourceRoot":"","sources":["../../src/task-graph/WorkflowRunContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAkB;IAC7B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B,cAEC;IAED,sEAAsE;IACtE,OAAO,IAAI,IAAI,CAGd;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Steven Roussey <sroussey@gmail.com>
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GraphAsTask } from "../task/GraphAsTask";
|
|
7
|
+
import type { DataPorts } from "../task/TaskTypes";
|
|
8
|
+
import type { CompoundMergeStrategy } from "./TaskGraphRunner";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* Workflow's private GraphAsTask subclass — the runtime task instance that
|
|
12
|
+
* carries Workflow's compound-merge strategy. Constructed only by Workflow;
|
|
13
|
+
* not part of the public surface.
|
|
14
|
+
*/
|
|
15
|
+
export declare class WorkflowTask<I extends DataPorts, O extends DataPorts> extends GraphAsTask<I, O> {
|
|
16
|
+
static readonly type = "Workflow";
|
|
17
|
+
static readonly compoundMerge: CompoundMergeStrategy;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=WorkflowTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowTask.d.ts","sourceRoot":"","sources":["../../src/task-graph/WorkflowTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG/D;;;;;GAKG;AACH,qBAAa,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,CAAE,SAAQ,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3F,gBAAgC,IAAI,cAAc;IAClD,gBAAgC,aAAa,EAAqB,qBAAqB,CAAC;CACzF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workglow/task-graph",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.25",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/workglow-dev/workglow.git",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@workglow/job-queue": "0.2.
|
|
55
|
-
"@workglow/storage": "0.2.
|
|
56
|
-
"@workglow/util": "0.2.
|
|
54
|
+
"@workglow/job-queue": "0.2.25",
|
|
55
|
+
"@workglow/storage": "0.2.25",
|
|
56
|
+
"@workglow/util": "0.2.25"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@workglow/job-queue": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@workglow/job-queue": "0.2.
|
|
71
|
-
"@workglow/storage": "0.2.
|
|
72
|
-
"@workglow/util": "0.2.
|
|
70
|
+
"@workglow/job-queue": "0.2.25",
|
|
71
|
+
"@workglow/storage": "0.2.25",
|
|
72
|
+
"@workglow/util": "0.2.25"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/EXECUTION_MODEL.md
CHANGED
|
@@ -93,16 +93,24 @@ Return runOutputData (locked)
|
|
|
93
93
|
```
|
|
94
94
|
TaskGraph.run(input)
|
|
95
95
|
↓
|
|
96
|
-
TaskGraphRunner.runGraph(input)
|
|
96
|
+
TaskGraphRunner.runGraph(input) # facade: lifecycle + terminal precedence
|
|
97
97
|
↓
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
RunScheduler.runLoop(...) # owns the for-await loop
|
|
99
|
+
↓
|
|
100
|
+
For each task (from processScheduler.tasks()):
|
|
101
|
+
1. StreamPump.prepareStreamingInputs(task) # Tee streaming inputs
|
|
102
|
+
2. StreamPump.awaitStreamInputs(task, registry) # Materialize pending streams
|
|
103
|
+
3. EdgeMaterializer.copyInputFromEdgesToNode(task) # Pull data from incoming dataflows
|
|
104
|
+
4. ctx.activeEnforcer?.checkTask(task) # Runtime entitlement
|
|
105
|
+
5. Streaming: StreamPump.runStreamingTask(...)
|
|
106
|
+
Non-streaming: task.runner.run(...) → EdgeMaterializer.pushOutputFromNodeToEdges()
|
|
107
|
+
6. RunScheduler.pushStatusFromNodeToEdges + processScheduler.onTaskCompleted
|
|
102
108
|
↓
|
|
103
109
|
Return results from ending nodes (no outgoing dataflows)
|
|
104
110
|
```
|
|
105
111
|
|
|
112
|
+
`TaskGraphRunner` is a thin facade. The for-await loop lives in `RunScheduler`; per-task choreography lives in the facade's `runTask`; per-run mutable state (abort controller, in-progress maps, timeout timer, telemetry span, entitlement enforcer) lives in a `RunContext` value object built by `handleStart` and discarded by terminal handlers. See `docs/technical/01-task-graph-dag-engine.md` for the full architecture and the `TaskGraphRunConfig` vs `RunContext` distinction.
|
|
113
|
+
|
|
106
114
|
### Runtime guard
|
|
107
115
|
|
|
108
116
|
`TaskRunner.run()` checks at the start of execution whether the task overrides `executePreview()` but not `execute()`. If so, it throws `TaskConfigurationError`. The check fires on `run()`, not on construction. `runPreview()` does not trigger the guard.
|