@workglow/task-graph 0.2.6 → 0.2.8

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 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 });
@@ -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 {
@@ -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() {
@@ -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 = {}) {
@@ -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");
@@ -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=1664425925BB4C1264756E2164756E21
8243
+ //# debugId=6CFDC763FC3FCCDA64756E2164756E21