@workglow/task-graph 0.0.118 → 0.0.119
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 +54 -25
- package/dist/browser.js.map +9 -9
- package/dist/bun.js +54 -25
- package/dist/bun.js.map +9 -9
- package/dist/node.js +54 -25
- package/dist/node.js.map +9 -9
- package/dist/task/FallbackTaskRunner.d.ts +1 -1
- package/dist/task/FallbackTaskRunner.d.ts.map +1 -1
- package/dist/task/GraphAsTaskRunner.d.ts.map +1 -1
- package/dist/task/IteratorTaskRunner.d.ts.map +1 -1
- package/dist/task/JobQueueTask.d.ts +1 -1
- package/dist/task/JobQueueTask.d.ts.map +1 -1
- package/dist/task/Task.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphRunner.d.ts.map +1 -1
- package/dist/task-graph/Workflow.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/browser.js
CHANGED
|
@@ -1718,18 +1718,24 @@ class Task {
|
|
|
1718
1718
|
return obj;
|
|
1719
1719
|
}
|
|
1720
1720
|
toJSON(_options) {
|
|
1721
|
-
const
|
|
1721
|
+
const ctor = this.constructor;
|
|
1722
|
+
const { id: _id, ...config } = this.config;
|
|
1723
|
+
if (config.title === ctor.title)
|
|
1724
|
+
delete config.title;
|
|
1725
|
+
if (config.description === ctor.description)
|
|
1726
|
+
delete config.description;
|
|
1727
|
+
const extras = config.extras;
|
|
1728
|
+
if (!extras || Object.keys(extras).length === 0)
|
|
1729
|
+
delete config.extras;
|
|
1730
|
+
for (const key of Object.keys(config)) {
|
|
1731
|
+
if (config[key] === undefined)
|
|
1732
|
+
delete config[key];
|
|
1733
|
+
}
|
|
1722
1734
|
const json = this.stripSymbols({
|
|
1723
1735
|
id: this.id,
|
|
1724
1736
|
type: this.type,
|
|
1725
1737
|
defaults: this.defaults,
|
|
1726
|
-
config
|
|
1727
|
-
...this.config.title && this.config.title !== this.constructor.title ? { title: this.config.title } : {},
|
|
1728
|
-
...this.config.description && this.config.description !== this.constructor.description ? { description: this.config.description } : {},
|
|
1729
|
-
...this.config.inputSchema ? { inputSchema: this.config.inputSchema } : {},
|
|
1730
|
-
...this.config.outputSchema ? { outputSchema: this.config.outputSchema } : {},
|
|
1731
|
-
...extras && Object.keys(extras).length ? { extras } : {}
|
|
1732
|
-
}
|
|
1738
|
+
config
|
|
1733
1739
|
});
|
|
1734
1740
|
return json;
|
|
1735
1741
|
}
|
|
@@ -2394,11 +2400,14 @@ class TaskGraphRunner {
|
|
|
2394
2400
|
const narrowed = await task.narrowInput({ ...results }, this.registry);
|
|
2395
2401
|
dataflow.setPortData(narrowed);
|
|
2396
2402
|
} else {
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2403
|
+
const resultsKeys = Object.keys(results);
|
|
2404
|
+
if (resultsKeys.length > 0) {
|
|
2405
|
+
getLogger2().warn("pushOutputFromNodeToEdge not compatible, not setting port data", {
|
|
2406
|
+
dataflowId: dataflow.id,
|
|
2407
|
+
compatibility,
|
|
2408
|
+
resultsKeys
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2402
2411
|
}
|
|
2403
2412
|
}
|
|
2404
2413
|
}
|
|
@@ -2758,7 +2767,7 @@ class TaskGraphRunner {
|
|
|
2758
2767
|
async handleError(error) {
|
|
2759
2768
|
await Promise.allSettled(this.graph.getTasks().map(async (task) => {
|
|
2760
2769
|
if (task.status === TaskStatus.PROCESSING || task.status === TaskStatus.STREAMING) {
|
|
2761
|
-
task.abort();
|
|
2770
|
+
return task.abort();
|
|
2762
2771
|
}
|
|
2763
2772
|
}));
|
|
2764
2773
|
this.running = false;
|
|
@@ -2774,11 +2783,11 @@ class TaskGraphRunner {
|
|
|
2774
2783
|
this.reactiveRunning = false;
|
|
2775
2784
|
}
|
|
2776
2785
|
async handleAbort() {
|
|
2777
|
-
this.graph.getTasks().map(async (task) => {
|
|
2786
|
+
await Promise.allSettled(this.graph.getTasks().map(async (task) => {
|
|
2778
2787
|
if (task.status === TaskStatus.PROCESSING || task.status === TaskStatus.STREAMING) {
|
|
2779
|
-
task.abort();
|
|
2788
|
+
return task.abort();
|
|
2780
2789
|
}
|
|
2781
|
-
});
|
|
2790
|
+
}));
|
|
2782
2791
|
this.running = false;
|
|
2783
2792
|
if (this.telemetrySpan) {
|
|
2784
2793
|
this.telemetrySpan.setStatus(SpanStatusCode2.ERROR, "aborted");
|
|
@@ -2807,7 +2816,9 @@ class TaskGraphRunner {
|
|
|
2807
2816
|
progress = Math.round(completed / total);
|
|
2808
2817
|
}
|
|
2809
2818
|
this.pushStatusFromNodeToEdges(this.graph, task);
|
|
2810
|
-
|
|
2819
|
+
if (task.runOutputData && Object.keys(task.runOutputData).length > 0) {
|
|
2820
|
+
await this.pushOutputFromNodeToEdges(task, task.runOutputData);
|
|
2821
|
+
}
|
|
2811
2822
|
this.graph.emit("graph_progress", progress, message, args);
|
|
2812
2823
|
}
|
|
2813
2824
|
}
|
|
@@ -2833,13 +2844,16 @@ var init_GraphAsTaskRunner = __esm(() => {
|
|
|
2833
2844
|
});
|
|
2834
2845
|
const results = await this.task.subGraph.run(input, {
|
|
2835
2846
|
parentSignal: this.abortController?.signal,
|
|
2836
|
-
outputCache: this.outputCache
|
|
2847
|
+
outputCache: this.outputCache,
|
|
2848
|
+
registry: this.registry
|
|
2837
2849
|
});
|
|
2838
2850
|
unsubscribe();
|
|
2839
2851
|
return results;
|
|
2840
2852
|
}
|
|
2841
2853
|
async executeTaskChildrenReactive() {
|
|
2842
|
-
return this.task.subGraph.runReactive(this.task.runInputData
|
|
2854
|
+
return this.task.subGraph.runReactive(this.task.runInputData, {
|
|
2855
|
+
registry: this.registry
|
|
2856
|
+
});
|
|
2843
2857
|
}
|
|
2844
2858
|
async handleDisable() {
|
|
2845
2859
|
if (this.task.hasChildren()) {
|
|
@@ -3956,6 +3970,11 @@ class Workflow {
|
|
|
3956
3970
|
const tasks = graph.getTasks();
|
|
3957
3971
|
for (const task of tasks) {
|
|
3958
3972
|
if (task.type === "InputTask") {
|
|
3973
|
+
const existingConfig = task.config;
|
|
3974
|
+
const existingSchema = existingConfig?.inputSchema ?? existingConfig?.outputSchema;
|
|
3975
|
+
if (existingSchema && typeof existingSchema === "object" && existingSchema["x-ui-manual"] === true) {
|
|
3976
|
+
continue;
|
|
3977
|
+
}
|
|
3959
3978
|
const outgoing = graph.getTargetDataflows(task.id);
|
|
3960
3979
|
if (outgoing.length === 0)
|
|
3961
3980
|
continue;
|
|
@@ -4170,9 +4189,15 @@ class Workflow {
|
|
|
4170
4189
|
const earlierTask = earlierTasks[i];
|
|
4171
4190
|
const earlierOutputSchema = earlierTask.outputSchema();
|
|
4172
4191
|
if (earlierTask.type === "InputTask") {
|
|
4192
|
+
const inputConfig = earlierTask.config;
|
|
4193
|
+
const inputSchema = inputConfig?.inputSchema ?? inputConfig?.outputSchema;
|
|
4194
|
+
const isManualSchema = inputSchema && typeof inputSchema === "object" && inputSchema["x-ui-manual"] === true;
|
|
4195
|
+
const inputProperties = isManualSchema && inputSchema && typeof inputSchema === "object" && "properties" in inputSchema && inputSchema.properties && typeof inputSchema.properties === "object" ? new Set(Object.keys(inputSchema.properties)) : undefined;
|
|
4173
4196
|
for (const requiredInputId of [...unmatchedRequired]) {
|
|
4174
4197
|
if (matches.has(requiredInputId))
|
|
4175
4198
|
continue;
|
|
4199
|
+
if (inputProperties && !inputProperties.has(requiredInputId))
|
|
4200
|
+
continue;
|
|
4176
4201
|
matches.set(requiredInputId, requiredInputId);
|
|
4177
4202
|
graph.addDataflow(new Dataflow(earlierTask.id, requiredInputId, targetTask.id, requiredInputId));
|
|
4178
4203
|
}
|
|
@@ -4646,7 +4671,8 @@ class FallbackTaskRunner extends GraphAsTaskRunner {
|
|
|
4646
4671
|
const mergedInput = { ...input, ...alternative };
|
|
4647
4672
|
const results = await this.task.subGraph.run(mergedInput, {
|
|
4648
4673
|
parentSignal: this.abortController?.signal,
|
|
4649
|
-
outputCache: this.outputCache
|
|
4674
|
+
outputCache: this.outputCache,
|
|
4675
|
+
registry: this.registry
|
|
4650
4676
|
});
|
|
4651
4677
|
const mergedOutput = this.task.subGraph.mergeExecuteOutputsToRunOutput(results, this.task.compoundMerge);
|
|
4652
4678
|
await this.handleProgress(100, `Data alternative ${attemptNumber}/${totalAttempts} succeeded`);
|
|
@@ -4914,7 +4940,8 @@ class IteratorTaskRunner extends GraphAsTaskRunner {
|
|
|
4914
4940
|
const graphClone = this.cloneGraph(this.task.subGraph);
|
|
4915
4941
|
const results = await graphClone.run(input, {
|
|
4916
4942
|
parentSignal: this.abortController?.signal,
|
|
4917
|
-
outputCache: this.outputCache
|
|
4943
|
+
outputCache: this.outputCache,
|
|
4944
|
+
registry: this.registry
|
|
4918
4945
|
});
|
|
4919
4946
|
if (results.length === 0) {
|
|
4920
4947
|
return;
|
|
@@ -6238,11 +6265,13 @@ class JobQueueTask extends GraphAsTask {
|
|
|
6238
6265
|
}
|
|
6239
6266
|
return registeredQueue;
|
|
6240
6267
|
}
|
|
6241
|
-
|
|
6268
|
+
abort() {
|
|
6242
6269
|
if (this.currentQueueName && this.currentJobId) {
|
|
6243
6270
|
const registeredQueue = getTaskQueueRegistry().getQueue(this.currentQueueName);
|
|
6244
6271
|
if (registeredQueue) {
|
|
6245
|
-
|
|
6272
|
+
registeredQueue.client.abort(this.currentJobId).catch((err) => {
|
|
6273
|
+
console.warn(`Failed to abort remote job ${this.currentJobId}`, err);
|
|
6274
|
+
});
|
|
6246
6275
|
}
|
|
6247
6276
|
}
|
|
6248
6277
|
super.abort();
|
|
@@ -6833,4 +6862,4 @@ export {
|
|
|
6833
6862
|
ConditionalTask
|
|
6834
6863
|
};
|
|
6835
6864
|
|
|
6836
|
-
//# debugId=
|
|
6865
|
+
//# debugId=63E1C33B6C31C66764756E2164756E21
|