@deepstrike/wasm 0.2.35 → 0.2.37

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.
@@ -6,12 +6,33 @@
6
6
  //! decision from the node's agent and extracts the matching result signal (`loopContinue` /
7
7
  //! `classifyBranch` / `tournamentWinner`) the kernel reads back.
8
8
  import { extractJsonValue } from "./output-schema.js";
9
- /** Instruction appended to a loop node's goal: do the next increment, and signal when done. */
10
- export function loopInstruction(maxIters) {
11
- return (`This task runs as a LOOP (up to ${maxIters} iterations total). Do the next increment of work now. ` +
12
- `When you judge the overall task COMPLETE and no further iterations are needed, end your response ` +
13
- `with a JSON object {"loop_continue": false}. To request another iteration, omit it or return ` +
14
- `{"loop_continue": true}.`);
9
+ /** Instruction appended to a loop iteration's goal. DW-3: the continuation verb is the
10
+ * kernel-adjudicated `pace` meta-tool (armed on every iteration run), not a text blob — one
11
+ * vocabulary shared with the round-level loop agent. Iterations share one session, so "the work
12
+ * so far" is simply the visible transcript. */
13
+ export function loopInstruction(maxIters, iteration = 0) {
14
+ return (`This task runs as a LOOP — this is iteration ${iteration + 1} of up to ${maxIters}. Your prior ` +
15
+ `iterations' work (if any) is visible above; do the NEXT increment now. Then call the \`pace\` tool: ` +
16
+ `\`{"next": "continue"}\` to request another iteration, or \`{"next": "stop"}\` when the overall ` +
17
+ `task is complete. Ending without calling \`pace\` also completes the loop.`);
18
+ }
19
+ /** W-N2: dependency outputs appended to a dependent node's goal — a DAG edge carries data, not
20
+ * just ordering (fan-out→synthesize was an uninformed synthesis without this). Each dependency's
21
+ * output is clipped so a chain of large nodes can't blow the child's context; empty/unknown
22
+ * outputs are skipped. Returns "" when the node has no dependencies. */
23
+ export function dependencyOutputsNote(inputAgentIds, outputs, maxPerDep = 8_000) {
24
+ if (!inputAgentIds?.length || !outputs)
25
+ return "";
26
+ const blocks = inputAgentIds
27
+ .map(id => {
28
+ const out = outputs.get(id) ?? "";
29
+ if (!out)
30
+ return "";
31
+ const clipped = out.length > maxPerDep ? `${out.slice(0, maxPerDep)}\n…[truncated]` : out;
32
+ return `[dependency ${id} output]\n${clipped}`;
33
+ })
34
+ .filter(Boolean);
35
+ return blocks.join("\n\n");
15
36
  }
16
37
  /** Instruction appended to a classify node's goal: pick exactly one of the kernel's branch labels. */
17
38
  export function classifyInstruction(labels) {
package/dist/types.d.ts CHANGED
@@ -105,7 +105,8 @@ export interface DoneEvent extends StreamEvent {
105
105
  iterations: number;
106
106
  totalTokens: number;
107
107
  status: string;
108
- dreamResult?: import("./memory/index.js").DreamResult;
108
+ dreamResult?: import("./memory/index.js").DreamResult; /** ③ loop-agent: the kernel-adjudicated after-round decision (absent on non-loop runs). */
109
+ paceDecision?: import("./runtime/kernel-step.js").PaceDecision;
109
110
  }
110
111
  export interface ErrorEvent extends StreamEvent {
111
112
  type: "error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepstrike/wasm",
3
- "version": "0.2.35",
3
+ "version": "0.2.37",
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.35"
18
+ "@deepstrike/wasm-kernel": "0.2.37"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/jest": "^30.0.0",