@workglow/task-graph 0.2.2 → 0.2.4
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 +87 -14
- package/dist/browser.js.map +7 -7
- package/dist/bun.js +87 -14
- package/dist/bun.js.map +7 -7
- package/dist/node.js +87 -14
- package/dist/node.js.map +7 -7
- package/dist/task/EntitlementProfiles.d.ts +7 -0
- package/dist/task/EntitlementProfiles.d.ts.map +1 -1
- package/dist/task/GraphAsTask.d.ts +16 -0
- package/dist/task/GraphAsTask.d.ts.map +1 -1
- package/dist/task/TaskEntitlements.d.ts +7 -4
- package/dist/task/TaskEntitlements.d.ts.map +1 -1
- package/dist/task/TaskRunner.d.ts +1 -1
- package/dist/task/TaskRunner.d.ts.map +1 -1
- package/dist/task-graph/TaskGraphRunner.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/bun.js
CHANGED
|
@@ -295,16 +295,32 @@ function entitlementCovers(granted, required) {
|
|
|
295
295
|
function resourcePatternMatches(grantPattern, requiredResource) {
|
|
296
296
|
if (grantPattern === requiredResource)
|
|
297
297
|
return true;
|
|
298
|
-
|
|
299
|
-
if (starIdx === -1)
|
|
298
|
+
if (!grantPattern.includes("*"))
|
|
300
299
|
return false;
|
|
301
|
-
const
|
|
302
|
-
const
|
|
303
|
-
|
|
300
|
+
const parts = grantPattern.split("*");
|
|
301
|
+
const first = parts[0];
|
|
302
|
+
const last = parts[parts.length - 1];
|
|
303
|
+
if (!requiredResource.startsWith(first))
|
|
304
304
|
return false;
|
|
305
|
-
if (!requiredResource.endsWith(
|
|
305
|
+
if (!requiredResource.endsWith(last))
|
|
306
306
|
return false;
|
|
307
|
-
|
|
307
|
+
let fixedLength = 0;
|
|
308
|
+
for (const p of parts)
|
|
309
|
+
fixedLength += p.length;
|
|
310
|
+
if (requiredResource.length < fixedLength)
|
|
311
|
+
return false;
|
|
312
|
+
let searchStart = first.length;
|
|
313
|
+
const searchEnd = requiredResource.length - last.length;
|
|
314
|
+
for (let i = 1;i < parts.length - 1; i++) {
|
|
315
|
+
const part = parts[i];
|
|
316
|
+
if (part.length === 0)
|
|
317
|
+
continue;
|
|
318
|
+
const idx = requiredResource.indexOf(part, searchStart);
|
|
319
|
+
if (idx === -1 || idx + part.length > searchEnd)
|
|
320
|
+
return false;
|
|
321
|
+
searchStart = idx + part.length;
|
|
322
|
+
}
|
|
323
|
+
return true;
|
|
308
324
|
}
|
|
309
325
|
function grantCoversResources(grant, required) {
|
|
310
326
|
if (grant.resources === undefined)
|
|
@@ -1372,6 +1388,9 @@ class TaskRunner {
|
|
|
1372
1388
|
signal: this.abortController?.signal
|
|
1373
1389
|
});
|
|
1374
1390
|
}
|
|
1391
|
+
if (this.task.constructor.hasDynamicEntitlements) {
|
|
1392
|
+
this.task.emit("entitlementChange", this.task.entitlements());
|
|
1393
|
+
}
|
|
1375
1394
|
return i;
|
|
1376
1395
|
}
|
|
1377
1396
|
async executeTask(input) {
|
|
@@ -2838,11 +2857,6 @@ class TaskGraphRunner {
|
|
|
2838
2857
|
const dataflows = this.graph.getTargetDataflows(node.id);
|
|
2839
2858
|
for (const dataflow of dataflows) {
|
|
2840
2859
|
const compatibility = dataflow.semanticallyCompatible(this.graph, dataflow);
|
|
2841
|
-
getLogger3().debug("pushOutputFromNodeToEdges", {
|
|
2842
|
-
dataflowId: dataflow.id,
|
|
2843
|
-
compatibility,
|
|
2844
|
-
resultsKeys: Object.keys(results)
|
|
2845
|
-
});
|
|
2846
2860
|
if (compatibility === "static") {
|
|
2847
2861
|
dataflow.setPortData(results);
|
|
2848
2862
|
} else if (compatibility === "runtime") {
|
|
@@ -3557,6 +3571,64 @@ class GraphAsTask extends Task {
|
|
|
3557
3571
|
this.events.emit("regenerate");
|
|
3558
3572
|
this.emitEntitlementChange();
|
|
3559
3573
|
}
|
|
3574
|
+
_entitlementUnsub;
|
|
3575
|
+
_subscribeToSubGraphEntitlements(graph) {
|
|
3576
|
+
this._entitlementUnsub?.();
|
|
3577
|
+
this._entitlementUnsub = graph.subscribeToTaskEntitlements(() => {
|
|
3578
|
+
this.emitEntitlementChange();
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
_syncSubGraphEntitlementSubscription(graph = this._subGraph) {
|
|
3582
|
+
if ((this._events?.listenerCount("entitlementChange") ?? 0) === 0) {
|
|
3583
|
+
this._entitlementUnsub?.();
|
|
3584
|
+
this._entitlementUnsub = undefined;
|
|
3585
|
+
return;
|
|
3586
|
+
}
|
|
3587
|
+
if (!graph || this._entitlementUnsub) {
|
|
3588
|
+
return;
|
|
3589
|
+
}
|
|
3590
|
+
this._subscribeToSubGraphEntitlements(graph);
|
|
3591
|
+
}
|
|
3592
|
+
subscribe(name, fn) {
|
|
3593
|
+
const unsub = super.subscribe(name, fn);
|
|
3594
|
+
if (name !== "entitlementChange") {
|
|
3595
|
+
return unsub;
|
|
3596
|
+
}
|
|
3597
|
+
this._syncSubGraphEntitlementSubscription();
|
|
3598
|
+
return () => {
|
|
3599
|
+
unsub();
|
|
3600
|
+
this._syncSubGraphEntitlementSubscription();
|
|
3601
|
+
};
|
|
3602
|
+
}
|
|
3603
|
+
on(name, fn) {
|
|
3604
|
+
super.on(name, fn);
|
|
3605
|
+
if (name === "entitlementChange") {
|
|
3606
|
+
this._syncSubGraphEntitlementSubscription();
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3609
|
+
off(name, fn) {
|
|
3610
|
+
super.off(name, fn);
|
|
3611
|
+
if (name === "entitlementChange") {
|
|
3612
|
+
this._syncSubGraphEntitlementSubscription();
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
once(name, fn) {
|
|
3616
|
+
super.once(name, fn);
|
|
3617
|
+
if (name === "entitlementChange") {
|
|
3618
|
+
this._syncSubGraphEntitlementSubscription();
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
set subGraph(subGraph) {
|
|
3622
|
+
this._entitlementUnsub?.();
|
|
3623
|
+
this._entitlementUnsub = undefined;
|
|
3624
|
+
super.subGraph = subGraph;
|
|
3625
|
+
this._syncSubGraphEntitlementSubscription(subGraph);
|
|
3626
|
+
}
|
|
3627
|
+
get subGraph() {
|
|
3628
|
+
const graph = super.subGraph;
|
|
3629
|
+
this._syncSubGraphEntitlementSubscription(graph);
|
|
3630
|
+
return graph;
|
|
3631
|
+
}
|
|
3560
3632
|
toJSON(options) {
|
|
3561
3633
|
let json = super.toJSON(options);
|
|
3562
3634
|
const hasChildren = this.hasChildren();
|
|
@@ -5175,7 +5247,8 @@ function resetMethodNameCache() {
|
|
|
5175
5247
|
}
|
|
5176
5248
|
// src/task/EntitlementProfiles.ts
|
|
5177
5249
|
var BROWSER_GRANTS = [
|
|
5178
|
-
{ id: Entitlements.
|
|
5250
|
+
{ id: Entitlements.NETWORK_HTTP },
|
|
5251
|
+
{ id: Entitlements.NETWORK_WEBSOCKET },
|
|
5179
5252
|
{ id: Entitlements.AI },
|
|
5180
5253
|
{ id: Entitlements.MCP_TOOL_CALL },
|
|
5181
5254
|
{ id: Entitlements.MCP_RESOURCE_READ },
|
|
@@ -7490,4 +7563,4 @@ export {
|
|
|
7490
7563
|
BROWSER_GRANTS
|
|
7491
7564
|
};
|
|
7492
7565
|
|
|
7493
|
-
//# debugId=
|
|
7566
|
+
//# debugId=760D1F366E5E570764756E2164756E21
|