@workglow/task-graph 0.2.5 → 0.2.7
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 +52 -20
- package/dist/browser.js.map +14 -14
- package/dist/bun.js +52 -20
- package/dist/bun.js.map +14 -14
- package/dist/node.js +52 -20
- package/dist/node.js.map +14 -14
- package/dist/task/EntitlementEnforcer.d.ts +1 -1
- package/dist/task/EntitlementEnforcer.d.ts.map +1 -1
- package/dist/task/EntitlementProfiles.d.ts +2 -2
- package/dist/task/EntitlementProfiles.d.ts.map +1 -1
- package/dist/task/GraphAsTask.d.ts +7 -3
- package/dist/task/GraphAsTask.d.ts.map +1 -1
- package/dist/task/GraphAsTaskRunner.d.ts.map +1 -1
- package/dist/task/ITask.d.ts +11 -3
- package/dist/task/ITask.d.ts.map +1 -1
- package/dist/task/IteratorTaskRunner.d.ts.map +1 -1
- package/dist/task/TaskEntitlements.d.ts +6 -0
- package/dist/task/TaskEntitlements.d.ts.map +1 -1
- package/dist/task/TaskRunner.d.ts +5 -1
- package/dist/task/TaskRunner.d.ts.map +1 -1
- package/dist/task-graph/GraphToWorkflowCode.d.ts.map +1 -1
- package/dist/task-graph/IWorkflow.d.ts +3 -1
- package/dist/task-graph/IWorkflow.d.ts.map +1 -1
- package/dist/task-graph/TaskGraph.d.ts +6 -0
- package/dist/task-graph/TaskGraph.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphRunner.d.ts +7 -2
- package/dist/task-graph/TaskGraphRunner.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphScheduler.d.ts +2 -2
- package/dist/task-graph/TaskGraphScheduler.d.ts.map +1 -1
- package/dist/task-graph/Workflow.d.ts +1 -1
- package/dist/task-graph/Workflow.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/browser.js
CHANGED
|
@@ -283,7 +283,13 @@ var Entitlements = {
|
|
|
283
283
|
MCP_STDIO: "mcp:stdio",
|
|
284
284
|
STORAGE: "storage",
|
|
285
285
|
STORAGE_READ: "storage:read",
|
|
286
|
-
STORAGE_WRITE: "storage:write"
|
|
286
|
+
STORAGE_WRITE: "storage:write",
|
|
287
|
+
BROWSER_CONTROL: "browser",
|
|
288
|
+
BROWSER_CONTROL_LOCAL: "browser:local",
|
|
289
|
+
BROWSER_CONTROL_CLOUD: "browser:cloud",
|
|
290
|
+
BROWSER_CONTROL_NAVIGATE: "browser:navigate",
|
|
291
|
+
BROWSER_CONTROL_EVALUATE: "browser:evaluate",
|
|
292
|
+
BROWSER_CONTROL_CREDENTIAL: "browser:credential"
|
|
287
293
|
};
|
|
288
294
|
var EMPTY_ENTITLEMENTS = Object.freeze({
|
|
289
295
|
entitlements: Object.freeze([])
|
|
@@ -1271,6 +1277,7 @@ class TaskRunner {
|
|
|
1271
1277
|
abortController;
|
|
1272
1278
|
outputCache;
|
|
1273
1279
|
registry = globalServiceRegistry;
|
|
1280
|
+
resourceScope;
|
|
1274
1281
|
inputStreams;
|
|
1275
1282
|
timeoutTimer;
|
|
1276
1283
|
pendingTimeoutError;
|
|
@@ -1384,7 +1391,8 @@ class TaskRunner {
|
|
|
1384
1391
|
if (hasRunConfig(i)) {
|
|
1385
1392
|
Object.assign(i.runConfig, {
|
|
1386
1393
|
registry: this.registry,
|
|
1387
|
-
signal: this.abortController?.signal
|
|
1394
|
+
signal: this.abortController?.signal,
|
|
1395
|
+
resourceScope: this.resourceScope
|
|
1388
1396
|
});
|
|
1389
1397
|
}
|
|
1390
1398
|
if (this.task.constructor.hasDynamicEntitlements) {
|
|
@@ -1397,7 +1405,8 @@ class TaskRunner {
|
|
|
1397
1405
|
signal: this.abortController.signal,
|
|
1398
1406
|
updateProgress: this.handleProgress.bind(this),
|
|
1399
1407
|
own: this.own,
|
|
1400
|
-
registry: this.registry
|
|
1408
|
+
registry: this.registry,
|
|
1409
|
+
resourceScope: this.resourceScope
|
|
1401
1410
|
});
|
|
1402
1411
|
return await this.executeTaskReactive(input, result || {});
|
|
1403
1412
|
}
|
|
@@ -1429,6 +1438,7 @@ class TaskRunner {
|
|
|
1429
1438
|
updateProgress: this.handleProgress.bind(this),
|
|
1430
1439
|
own: this.own,
|
|
1431
1440
|
registry: this.registry,
|
|
1441
|
+
resourceScope: this.resourceScope,
|
|
1432
1442
|
inputStreams: this.inputStreams
|
|
1433
1443
|
});
|
|
1434
1444
|
for await (const event of stream) {
|
|
@@ -1551,6 +1561,9 @@ class TaskRunner {
|
|
|
1551
1561
|
if (config.registry) {
|
|
1552
1562
|
this.registry = config.registry;
|
|
1553
1563
|
}
|
|
1564
|
+
if (config.resourceScope) {
|
|
1565
|
+
this.resourceScope = config.resourceScope;
|
|
1566
|
+
}
|
|
1554
1567
|
if (config.signal) {
|
|
1555
1568
|
const onAbort = () => this.abortController.abort();
|
|
1556
1569
|
config.signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -2540,8 +2553,8 @@ class TopologicalScheduler {
|
|
|
2540
2553
|
yield this.sortedNodes[this.currentIndex++];
|
|
2541
2554
|
}
|
|
2542
2555
|
}
|
|
2543
|
-
onTaskCompleted(
|
|
2544
|
-
onTaskStreaming(
|
|
2556
|
+
onTaskCompleted(_taskId) {}
|
|
2557
|
+
onTaskStreaming(_taskId) {}
|
|
2545
2558
|
reset() {
|
|
2546
2559
|
this.sortedNodes = this.dag.topologicallySortedNodes();
|
|
2547
2560
|
this.currentIndex = 0;
|
|
@@ -2685,6 +2698,7 @@ class TaskGraphRunner {
|
|
|
2685
2698
|
outputCache;
|
|
2686
2699
|
accumulateLeafOutputs = true;
|
|
2687
2700
|
registry = globalServiceRegistry2;
|
|
2701
|
+
resourceScope;
|
|
2688
2702
|
abortController;
|
|
2689
2703
|
inProgressTasks = new Map;
|
|
2690
2704
|
inProgressFunctions = new Map;
|
|
@@ -3014,7 +3028,8 @@ class TaskGraphRunner {
|
|
|
3014
3028
|
const results = await task.runner.run(input, {
|
|
3015
3029
|
outputCache: this.outputCache ?? false,
|
|
3016
3030
|
updateProgress: async (task2, progress, message, ...args) => await this.handleProgress(task2, progress, message, ...args),
|
|
3017
|
-
registry: this.registry
|
|
3031
|
+
registry: this.registry,
|
|
3032
|
+
resourceScope: this.resourceScope
|
|
3018
3033
|
});
|
|
3019
3034
|
await this.pushOutputFromNodeToEdges(task, results);
|
|
3020
3035
|
return {
|
|
@@ -3060,7 +3075,8 @@ class TaskGraphRunner {
|
|
|
3060
3075
|
outputCache: this.outputCache ?? false,
|
|
3061
3076
|
shouldAccumulate,
|
|
3062
3077
|
updateProgress: async (task2, progress, message, ...args) => await this.handleProgress(task2, progress, message, ...args),
|
|
3063
|
-
registry: this.registry
|
|
3078
|
+
registry: this.registry,
|
|
3079
|
+
resourceScope: this.resourceScope
|
|
3064
3080
|
});
|
|
3065
3081
|
await this.pushOutputFromNodeToEdges(task, results);
|
|
3066
3082
|
return {
|
|
@@ -3101,7 +3117,7 @@ class TaskGraphRunner {
|
|
|
3101
3117
|
}
|
|
3102
3118
|
});
|
|
3103
3119
|
}
|
|
3104
|
-
pushStreamToEdges(task,
|
|
3120
|
+
pushStreamToEdges(task, _streamMode) {
|
|
3105
3121
|
const targetDataflows = this.graph.getTargetDataflows(task.id);
|
|
3106
3122
|
if (targetDataflows.length === 0)
|
|
3107
3123
|
return;
|
|
@@ -3164,6 +3180,9 @@ class TaskGraphRunner {
|
|
|
3164
3180
|
} else if (this.registry === undefined) {
|
|
3165
3181
|
this.registry = new ServiceRegistry2(globalServiceRegistry2.container.createChildContainer());
|
|
3166
3182
|
}
|
|
3183
|
+
if (config?.resourceScope !== undefined) {
|
|
3184
|
+
this.resourceScope = config.resourceScope;
|
|
3185
|
+
}
|
|
3167
3186
|
this.accumulateLeafOutputs = config?.accumulateLeafOutputs !== false;
|
|
3168
3187
|
if (config?.outputCache !== undefined) {
|
|
3169
3188
|
if (typeof config.outputCache === "boolean") {
|
|
@@ -3362,14 +3381,16 @@ class GraphAsTaskRunner extends TaskRunner {
|
|
|
3362
3381
|
const results = await this.task.subGraph.run(input, {
|
|
3363
3382
|
parentSignal: this.abortController?.signal,
|
|
3364
3383
|
outputCache: this.outputCache,
|
|
3365
|
-
registry: this.registry
|
|
3384
|
+
registry: this.registry,
|
|
3385
|
+
resourceScope: this.resourceScope
|
|
3366
3386
|
});
|
|
3367
3387
|
unsubscribe();
|
|
3368
3388
|
return results;
|
|
3369
3389
|
}
|
|
3370
3390
|
async executeTaskChildrenReactive() {
|
|
3371
3391
|
return this.task.subGraph.runReactive(this.task.runInputData, {
|
|
3372
|
-
registry: this.registry
|
|
3392
|
+
registry: this.registry,
|
|
3393
|
+
resourceScope: this.resourceScope
|
|
3373
3394
|
});
|
|
3374
3395
|
}
|
|
3375
3396
|
async handleDisable() {
|
|
@@ -3418,9 +3439,9 @@ class GraphAsTask extends Task {
|
|
|
3418
3439
|
static compoundMerge = PROPERTY_ARRAY;
|
|
3419
3440
|
static hasDynamicSchemas = true;
|
|
3420
3441
|
static hasDynamicEntitlements = true;
|
|
3421
|
-
constructor(config = {}) {
|
|
3442
|
+
constructor(config = {}, runConfig = {}) {
|
|
3422
3443
|
const { subGraph, ...rest } = config;
|
|
3423
|
-
super(rest);
|
|
3444
|
+
super(rest, runConfig);
|
|
3424
3445
|
if (subGraph) {
|
|
3425
3446
|
this.subGraph = subGraph;
|
|
3426
3447
|
}
|
|
@@ -3808,7 +3829,8 @@ class TaskGraph {
|
|
|
3808
3829
|
accumulateLeafOutputs: config?.accumulateLeafOutputs,
|
|
3809
3830
|
registry: config?.registry,
|
|
3810
3831
|
timeout: config?.timeout,
|
|
3811
|
-
maxTasks: config?.maxTasks
|
|
3832
|
+
maxTasks: config?.maxTasks,
|
|
3833
|
+
resourceScope: config?.resourceScope
|
|
3812
3834
|
});
|
|
3813
3835
|
}
|
|
3814
3836
|
runReactive(input = {}, config = {}) {
|
|
@@ -4131,7 +4153,7 @@ function parallel(args, mergeFn = PROPERTY_ARRAY, workflow = new Workflow) {
|
|
|
4131
4153
|
const config = {
|
|
4132
4154
|
compoundMerge: mergeFn
|
|
4133
4155
|
};
|
|
4134
|
-
const name = `‖${args.map((
|
|
4156
|
+
const name = `‖${args.map((_arg) => "\uD835\uDC53").join("‖")}‖`;
|
|
4135
4157
|
|
|
4136
4158
|
class ParallelTask extends GraphAsTask {
|
|
4137
4159
|
static type = name;
|
|
@@ -4349,7 +4371,8 @@ class Workflow {
|
|
|
4349
4371
|
const output = await this.graph.run(input, {
|
|
4350
4372
|
parentSignal: this._abortController.signal,
|
|
4351
4373
|
outputCache: this._outputCache,
|
|
4352
|
-
registry: config?.registry ?? this._registry
|
|
4374
|
+
registry: config?.registry ?? this._registry,
|
|
4375
|
+
resourceScope: config?.resourceScope
|
|
4353
4376
|
});
|
|
4354
4377
|
const results = this.graph.mergeExecuteOutputsToRunOutput(output, PROPERTY_ARRAY);
|
|
4355
4378
|
this.events.emit("complete");
|
|
@@ -5012,7 +5035,7 @@ function generateRegularTask(task, chainIndent, lines) {
|
|
|
5012
5035
|
lines.push(`${chainIndent}.addTask(${args})`);
|
|
5013
5036
|
}
|
|
5014
5037
|
}
|
|
5015
|
-
function generateLoopTask(task, loopInfo,
|
|
5038
|
+
function generateLoopTask(task, loopInfo, _incomingDataflows, _taskOrder, indent, depth, lines) {
|
|
5016
5039
|
const chainIndent = indent.repeat(depth + 1);
|
|
5017
5040
|
const config = extractLoopConfig(task);
|
|
5018
5041
|
const loopColOffset = chainIndent.length + `.${loopInfo.method}(`.length;
|
|
@@ -5268,9 +5291,17 @@ var DESKTOP_GRANTS = [
|
|
|
5268
5291
|
...BROWSER_GRANTS,
|
|
5269
5292
|
{ id: Entitlements.FILESYSTEM },
|
|
5270
5293
|
{ id: Entitlements.CODE_EXECUTION },
|
|
5271
|
-
{ id: Entitlements.MCP_STDIO }
|
|
5294
|
+
{ id: Entitlements.MCP_STDIO },
|
|
5295
|
+
{ id: Entitlements.BROWSER_CONTROL },
|
|
5296
|
+
{ id: Entitlements.BROWSER_CONTROL_LOCAL },
|
|
5297
|
+
{ id: Entitlements.BROWSER_CONTROL_NAVIGATE },
|
|
5298
|
+
{ id: Entitlements.BROWSER_CONTROL_EVALUATE },
|
|
5299
|
+
{ id: Entitlements.BROWSER_CONTROL_CREDENTIAL }
|
|
5300
|
+
];
|
|
5301
|
+
var SERVER_GRANTS = [
|
|
5302
|
+
...DESKTOP_GRANTS,
|
|
5303
|
+
{ id: Entitlements.BROWSER_CONTROL_CLOUD }
|
|
5272
5304
|
];
|
|
5273
|
-
var SERVER_GRANTS = [...DESKTOP_GRANTS];
|
|
5274
5305
|
var PROFILE_GRANTS = {
|
|
5275
5306
|
browser: BROWSER_GRANTS,
|
|
5276
5307
|
desktop: DESKTOP_GRANTS,
|
|
@@ -5712,7 +5743,8 @@ class IteratorTaskRunner extends GraphAsTaskRunner {
|
|
|
5712
5743
|
const results = await graphClone.run(input, {
|
|
5713
5744
|
parentSignal: this.abortController?.signal,
|
|
5714
5745
|
outputCache: this.outputCache,
|
|
5715
|
-
registry: this.registry
|
|
5746
|
+
registry: this.registry,
|
|
5747
|
+
resourceScope: this.resourceScope
|
|
5716
5748
|
});
|
|
5717
5749
|
if (results.length === 0) {
|
|
5718
5750
|
return;
|
|
@@ -8208,4 +8240,4 @@ export {
|
|
|
8208
8240
|
BROWSER_GRANTS
|
|
8209
8241
|
};
|
|
8210
8242
|
|
|
8211
|
-
//# debugId=
|
|
8243
|
+
//# debugId=6CFDC763FC3FCCDA64756E2164756E21
|