@deepstrike/sdk 0.2.14 → 0.2.16

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.
@@ -192,12 +192,19 @@ function kernelMessageToSdk(raw) {
192
192
  return message;
193
193
  }
194
194
  function renderedContextToSdk(raw) {
195
- return {
195
+ const rawStateTurn = (raw.state_turn ?? raw.stateTurn);
196
+ const frozenLen = (raw.frozen_prefix_len ?? raw.frozenPrefixLen);
197
+ const ctx = {
196
198
  systemText: String(raw.system_text ?? raw.systemText ?? ""),
197
199
  systemStable: String(raw.system_stable ?? raw.systemStable ?? ""),
198
200
  systemKnowledge: String(raw.system_knowledge ?? raw.systemKnowledge ?? ""),
199
201
  turns: (raw.turns ?? []).map(kernelMessageToSdk),
200
202
  };
203
+ if (rawStateTurn)
204
+ ctx.stateTurn = kernelMessageToSdk(rawStateTurn);
205
+ if (typeof frozenLen === "number")
206
+ ctx.frozenPrefixLen = frozenLen;
207
+ return ctx;
201
208
  }
202
209
  function mapKernelAction(raw) {
203
210
  switch (raw.kind) {
@@ -14,11 +14,25 @@ function terminationFromStatus(status) {
14
14
  }
15
15
  return status;
16
16
  }
17
+ /** Derive which meta-tools a child runner should expose based on permitted IDs and available sources. */
18
+ function deriveMetaTools(permitted, opts) {
19
+ const metaTools = new Set();
20
+ if (permitted.has("skill") && opts.skillDir)
21
+ metaTools.add("skill");
22
+ if (permitted.has("memory") && opts.dreamStore)
23
+ metaTools.add("memory");
24
+ if (permitted.has("knowledge") && opts.knowledgeSource)
25
+ metaTools.add("knowledge");
26
+ if (permitted.has("update_plan") && opts.enablePlanTool)
27
+ metaTools.add("update_plan");
28
+ return metaTools;
29
+ }
17
30
  /** Host-side driver for kernel-isolated sub-agent runs. */
18
31
  export class SubAgentOrchestrator {
19
32
  async *stream(ctx) {
20
33
  const permitted = new Set(ctx.manifest.permitted_capability_ids ?? []);
21
- const filteredPlane = new FilteredExecutionPlane(ctx.parentOpts.executionPlane, permitted);
34
+ const metaTools = deriveMetaTools(permitted, ctx.parentOpts);
35
+ const filteredPlane = new FilteredExecutionPlane(ctx.parentOpts.executionPlane, permitted, metaTools);
22
36
  let systemPrompt = ctx.parentOpts.systemPrompt;
23
37
  let inheritEvents;
24
38
  if (ctx.manifest.context_inheritance === "full") {
@@ -38,6 +52,10 @@ export class SubAgentOrchestrator {
38
52
  agentId: ctx.spec.identity.agentId,
39
53
  systemPrompt,
40
54
  sessionLog: ctx.sessionLog,
55
+ skillDir: metaTools.has("skill") ? ctx.parentOpts.skillDir : undefined,
56
+ dreamStore: metaTools.has("memory") ? ctx.parentOpts.dreamStore : undefined,
57
+ knowledgeSource: metaTools.has("knowledge") ? ctx.parentOpts.knowledgeSource : undefined,
58
+ enablePlanTool: metaTools.has("update_plan") ? ctx.parentOpts.enablePlanTool : undefined,
41
59
  });
42
60
  yield* childRunner.run({
43
61
  sessionId: ctx.spec.identity.sessionId,
@@ -50,12 +68,17 @@ export class SubAgentOrchestrator {
50
68
  const { RuntimeRunner } = await import("./runner.js");
51
69
  const { HarnessLoop } = await import("../harness/harness.js");
52
70
  const permitted = new Set(ctx.manifest.permitted_capability_ids ?? []);
53
- const filteredPlane = new FilteredExecutionPlane(ctx.parentOpts.executionPlane, permitted);
71
+ const metaTools = deriveMetaTools(permitted, ctx.parentOpts);
72
+ const filteredPlane = new FilteredExecutionPlane(ctx.parentOpts.executionPlane, permitted, metaTools);
54
73
  const childRunner = new RuntimeRunner({
55
74
  ...ctx.parentOpts,
56
75
  executionPlane: filteredPlane,
57
76
  agentId: ctx.spec.identity.agentId,
58
77
  sessionLog: ctx.sessionLog,
78
+ skillDir: metaTools.has("skill") ? ctx.parentOpts.skillDir : undefined,
79
+ dreamStore: metaTools.has("memory") ? ctx.parentOpts.dreamStore : undefined,
80
+ knowledgeSource: metaTools.has("knowledge") ? ctx.parentOpts.knowledgeSource : undefined,
81
+ enablePlanTool: metaTools.has("update_plan") ? ctx.parentOpts.enablePlanTool : undefined,
59
82
  });
60
83
  const loop = new HarnessLoop(childRunner, ctx.harness.evalProvider, {
61
84
  maxAttempts: ctx.harness.maxAttempts ?? 3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/sdk",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "description": "DeepStrike Node.js SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@anthropic-ai/sdk": "^0.99.0",
23
- "@deepstrike/core": "0.2.14",
23
+ "@deepstrike/core": "0.2.16",
24
24
  "@google/generative-ai": "^0.24.1",
25
25
  "openai": "^5.23.2"
26
26
  },