@deepstrike/wasm 0.2.45 → 0.2.46

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.
@@ -1234,6 +1234,7 @@ export class RuntimeRunner {
1234
1234
  spec,
1235
1235
  manifest,
1236
1236
  sessionLog: this.opts.sessionLog,
1237
+ toolAccess: spec.toolAccess,
1237
1238
  });
1238
1239
  kernelApply(runtime, this.pendingObservations, {
1239
1240
  kind: "sub_agent_completed",
@@ -24,6 +24,16 @@ export interface SubAgentRunContext {
24
24
  /** M1/G3 intelligence routing: resolve the provider for a sub-agent from its spec's `modelHint`.
25
25
  * Falls back to the parent provider when there is no hint or no `providerFor` hook resolves it. */
26
26
  export declare function resolveProvider(opts: RuntimeOptions, modelHint?: string): RuntimeOptions["provider"];
27
+ /** Resolve a child's execution plane + meta-tool set from its spawn context.
28
+ *
29
+ * W-N1: `"inherit"` runs the child on the parent's plane with availability-derived meta-tools
30
+ * (trusted workflow nodes); `"filtered"` (default) filters to the manifest grants, empty ⇒ deny-all
31
+ * (spawn path, quarantined nodes). Extracted as a pure seam (mirrors the Python
32
+ * `_resolve_tool_grants`) so the zero-tool warning is unit-testable without spinning a child loop. */
33
+ export declare function resolveToolGrants(ctx: SubAgentRunContext): {
34
+ plane: RuntimeOptions["executionPlane"];
35
+ metaTools: Set<string>;
36
+ };
27
37
  /** Host-side driver for kernel-isolated sub-agent runs. */
28
38
  export declare class SubAgentOrchestrator {
29
39
  run(ctx: SubAgentRunContext): Promise<SubAgentResult>;
@@ -63,18 +63,34 @@ function availableMetaTools(opts) {
63
63
  metaTools.add("update_plan");
64
64
  return metaTools;
65
65
  }
66
+ /** Resolve a child's execution plane + meta-tool set from its spawn context.
67
+ *
68
+ * W-N1: `"inherit"` runs the child on the parent's plane with availability-derived meta-tools
69
+ * (trusted workflow nodes); `"filtered"` (default) filters to the manifest grants, empty ⇒ deny-all
70
+ * (spawn path, quarantined nodes). Extracted as a pure seam (mirrors the Python
71
+ * `_resolve_tool_grants`) so the zero-tool warning is unit-testable without spinning a child loop. */
72
+ export function resolveToolGrants(ctx) {
73
+ const inherit = ctx.toolAccess === "inherit";
74
+ const permitted = new Set(ctx.manifest.permitted_capability_ids ?? []);
75
+ const metaTools = inherit ? availableMetaTools(ctx.parentOpts) : deriveMetaTools(permitted, ctx.parentOpts);
76
+ // A "filtered" spawn with no capability grants and no meta-tools resolves to a deny-all plane —
77
+ // the child model sees zero tools and reports "no tools available". Warn the host (visible, not
78
+ // fatal) with the fix. Exempt workflow nodes: not-inherit + workflow-node ⇒ quarantined ⇒
79
+ // intentional deny-all, not a misconfiguration.
80
+ if (!inherit && !ctx.isWorkflowNode && permitted.size === 0 && metaTools.size === 0) {
81
+ console.warn(`[deepstrike] spawned sub-agent "${ctx.spec.identity.agentId}" resolved to zero tools ` +
82
+ `(deny-all filter). Mount tools as capabilities and grant via spec.capabilityFilter, or pass ` +
83
+ `spec.toolAccess:'inherit' to run on the parent's plane. If a tool-less child is intentional, ignore this.`);
84
+ }
85
+ const plane = inherit
86
+ ? ctx.parentOpts.executionPlane
87
+ : new FilteredExecutionPlane(ctx.parentOpts.executionPlane, permitted, metaTools);
88
+ return { plane, metaTools };
89
+ }
66
90
  /** Host-side driver for kernel-isolated sub-agent runs. */
67
91
  export class SubAgentOrchestrator {
68
92
  async run(ctx) {
69
- // W-N1: "inherit" runs the child on the parent's plane with availability-derived meta-tools
70
- // (trusted workflow nodes); "filtered" (default) filters to the manifest grants, empty ⇒
71
- // deny-all (spawn path, quarantined nodes).
72
- const inherit = ctx.toolAccess === "inherit";
73
- const permitted = new Set(ctx.manifest.permitted_capability_ids ?? []);
74
- const metaTools = inherit ? availableMetaTools(ctx.parentOpts) : deriveMetaTools(permitted, ctx.parentOpts);
75
- const execPlane = inherit
76
- ? ctx.parentOpts.executionPlane
77
- : new FilteredExecutionPlane(ctx.parentOpts.executionPlane, permitted, metaTools);
93
+ const { plane: execPlane, metaTools } = resolveToolGrants(ctx);
78
94
  let systemPrompt = ctx.parentOpts.systemPrompt;
79
95
  let inheritEvents;
80
96
  if (ctx.manifest.context_inheritance === "full") {
@@ -50,6 +50,13 @@ export interface AgentRunSpec {
50
50
  maxTurns?: number;
51
51
  /** O3: per-child wall-clock cap in ms (sets the child runner's `timeoutMs`; falls back to the parent's). */
52
52
  maxWallMs?: number;
53
+ /** Tool surface for a spawned sub-agent. Host-side only (like `modelHint`) — NOT sent to the kernel
54
+ * (`agentRunSpecToKernel` maps fields explicitly and omits it). Default `"filtered"` keeps the spawn
55
+ * path's deny-all-safe default: the child is filtered to its manifest grants, and a grant-less spawn
56
+ * resolves to zero tools. `"inherit"` runs the child on the parent's execution plane with the
57
+ * parent's meta-tool availability (same mechanism trusted workflow nodes use) — the child's surface
58
+ * is a subset of the parent's, never a privilege escalation. */
59
+ toolAccess?: "inherit" | "filtered";
53
60
  }
54
61
  /** Kernel process-table observation (Phase 3 canonical spawn signal). */
55
62
  export interface AgentProcessChangedObservation {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/wasm",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "description": "DeepStrike WASM SDK — browser, Cloudflare Workers, Deno Deploy",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "test": "node --experimental-vm-modules node_modules/.bin/jest"
16
16
  },
17
17
  "dependencies": {
18
- "@deepstrike/wasm-kernel": "0.2.45"
18
+ "@deepstrike/wasm-kernel": "0.2.46"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/jest": "^30.0.0",