@deepstrike/wasm-kernel 0.2.17 → 0.2.19

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.
@@ -15,6 +15,17 @@ export interface RenderedContext {
15
15
  frozenPrefixLen?: number;
16
16
  }
17
17
 
18
+ /**
19
+ * The structured verdict from `parseVerdict`.
20
+ */
21
+ export interface Verdict {
22
+ passed: boolean;
23
+ overallScore: number;
24
+ feedback: string;
25
+ details: CriterionResult[];
26
+ skillCandidate?: SkillCandidate;
27
+ }
28
+
18
29
  export interface ContentPartObj {
19
30
  type: string;
20
31
  text?: string;
@@ -40,20 +51,6 @@ export interface CriterionResult {
40
51
  feedback: string;
41
52
  }
42
53
 
43
- export interface EvalPipelineAction {
44
- kind: string;
45
- messages?: Message[];
46
- passed?: boolean;
47
- overallScore?: number;
48
- feedback?: string;
49
- details?: CriterionResult[];
50
- skillCandidate?: SkillCandidate;
51
- }
52
-
53
- export interface EvalPipelineOptions {
54
- extractSkillOnPass?: boolean;
55
- }
56
-
57
54
  export interface GovernanceVerdict {
58
55
  kind: string;
59
56
  reason?: string;
@@ -149,16 +146,6 @@ export interface ToolSchema {
149
146
  }
150
147
 
151
148
 
152
- export class EvalPipeline {
153
- free(): void;
154
- [Symbol.dispose](): void;
155
- feedEvalResult(content: string): EvalPipelineAction;
156
- feedOutcome(goal: string, criteria: Criterion[], result: string, attempt: number): EvalPipelineAction;
157
- isIdle(): boolean;
158
- constructor(options: EvalPipelineOptions);
159
- reset(): void;
160
- }
161
-
162
149
  export class Governance {
163
150
  free(): void;
164
151
  [Symbol.dispose](): void;
@@ -205,3 +192,20 @@ export class SignalRouter {
205
192
  */
206
193
  next(): RuntimeSignal | undefined;
207
194
  }
195
+
196
+ /**
197
+ * Build the impartial-evaluator messages for one attempt. Call the evaluator LLM with these, then
198
+ * feed the text to `parseVerdict`.
199
+ */
200
+ export function buildEvalMessages(goal: string, criteria: Criterion[], result: string, attempt: number, extract_skill_on_pass: boolean): Message[];
201
+
202
+ /**
203
+ * Parse the evaluator LLM's JSON response into a structured `Verdict`.
204
+ */
205
+ export function parseVerdict(content: string): Verdict;
206
+
207
+ /**
208
+ * JSON Schema (as a JSON string) for the verdict an eval node must produce — used as the
209
+ * `outputSchema` of the eval node in the `gen_eval` workflow template.
210
+ */
211
+ export function verdictOutputSchema(extract_skill_on_pass: boolean): string;
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./deepstrike_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- EvalPipeline, Governance, KernelRuntime, SignalRouter
8
+ Governance, KernelRuntime, SignalRouter, buildEvalMessages, parseVerdict, verdictOutputSchema
9
9
  } from "./deepstrike_wasm_bg.js";
@@ -1,63 +1,3 @@
1
- export class EvalPipeline {
2
- __destroy_into_raw() {
3
- const ptr = this.__wbg_ptr;
4
- this.__wbg_ptr = 0;
5
- EvalPipelineFinalization.unregister(this);
6
- return ptr;
7
- }
8
- free() {
9
- const ptr = this.__destroy_into_raw();
10
- wasm.__wbg_evalpipeline_free(ptr, 0);
11
- }
12
- /**
13
- * @param {string} content
14
- * @returns {EvalPipelineAction}
15
- */
16
- feedEvalResult(content) {
17
- const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
18
- const len0 = WASM_VECTOR_LEN;
19
- const ret = wasm.evalpipeline_feedEvalResult(this.__wbg_ptr, ptr0, len0);
20
- return takeObject(ret);
21
- }
22
- /**
23
- * @param {string} goal
24
- * @param {Criterion[]} criteria
25
- * @param {string} result
26
- * @param {number} attempt
27
- * @returns {EvalPipelineAction}
28
- */
29
- feedOutcome(goal, criteria, result, attempt) {
30
- const ptr0 = passStringToWasm0(goal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
31
- const len0 = WASM_VECTOR_LEN;
32
- const ptr1 = passArrayJsValueToWasm0(criteria, wasm.__wbindgen_export);
33
- const len1 = WASM_VECTOR_LEN;
34
- const ptr2 = passStringToWasm0(result, wasm.__wbindgen_export, wasm.__wbindgen_export2);
35
- const len2 = WASM_VECTOR_LEN;
36
- const ret = wasm.evalpipeline_feedOutcome(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, attempt);
37
- return takeObject(ret);
38
- }
39
- /**
40
- * @returns {boolean}
41
- */
42
- isIdle() {
43
- const ret = wasm.evalpipeline_isIdle(this.__wbg_ptr);
44
- return ret !== 0;
45
- }
46
- /**
47
- * @param {EvalPipelineOptions} options
48
- */
49
- constructor(options) {
50
- const ret = wasm.evalpipeline_new(addHeapObject(options));
51
- this.__wbg_ptr = ret;
52
- EvalPipelineFinalization.register(this, this.__wbg_ptr, this);
53
- return this;
54
- }
55
- reset() {
56
- wasm.evalpipeline_reset(this.__wbg_ptr);
57
- }
58
- }
59
- if (Symbol.dispose) EvalPipeline.prototype[Symbol.dispose] = EvalPipeline.prototype.free;
60
-
61
1
  export class Governance {
62
2
  __destroy_into_raw() {
63
3
  const ptr = this.__wbg_ptr;
@@ -356,6 +296,71 @@ export class SignalRouter {
356
296
  }
357
297
  }
358
298
  if (Symbol.dispose) SignalRouter.prototype[Symbol.dispose] = SignalRouter.prototype.free;
299
+
300
+ /**
301
+ * Build the impartial-evaluator messages for one attempt. Call the evaluator LLM with these, then
302
+ * feed the text to `parseVerdict`.
303
+ * @param {string} goal
304
+ * @param {Criterion[]} criteria
305
+ * @param {string} result
306
+ * @param {number} attempt
307
+ * @param {boolean} extract_skill_on_pass
308
+ * @returns {Message[]}
309
+ */
310
+ export function buildEvalMessages(goal, criteria, result, attempt, extract_skill_on_pass) {
311
+ try {
312
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
313
+ const ptr0 = passStringToWasm0(goal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
314
+ const len0 = WASM_VECTOR_LEN;
315
+ const ptr1 = passArrayJsValueToWasm0(criteria, wasm.__wbindgen_export);
316
+ const len1 = WASM_VECTOR_LEN;
317
+ const ptr2 = passStringToWasm0(result, wasm.__wbindgen_export, wasm.__wbindgen_export2);
318
+ const len2 = WASM_VECTOR_LEN;
319
+ wasm.buildEvalMessages(retptr, ptr0, len0, ptr1, len1, ptr2, len2, attempt, extract_skill_on_pass);
320
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
321
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
322
+ var v4 = getArrayJsValueFromWasm0(r0, r1).slice();
323
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
324
+ return v4;
325
+ } finally {
326
+ wasm.__wbindgen_add_to_stack_pointer(16);
327
+ }
328
+ }
329
+
330
+ /**
331
+ * Parse the evaluator LLM's JSON response into a structured `Verdict`.
332
+ * @param {string} content
333
+ * @returns {Verdict}
334
+ */
335
+ export function parseVerdict(content) {
336
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
337
+ const len0 = WASM_VECTOR_LEN;
338
+ const ret = wasm.parseVerdict(ptr0, len0);
339
+ return takeObject(ret);
340
+ }
341
+
342
+ /**
343
+ * JSON Schema (as a JSON string) for the verdict an eval node must produce — used as the
344
+ * `outputSchema` of the eval node in the `gen_eval` workflow template.
345
+ * @param {boolean} extract_skill_on_pass
346
+ * @returns {string}
347
+ */
348
+ export function verdictOutputSchema(extract_skill_on_pass) {
349
+ let deferred1_0;
350
+ let deferred1_1;
351
+ try {
352
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
353
+ wasm.verdictOutputSchema(retptr, extract_skill_on_pass);
354
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
355
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
356
+ deferred1_0 = r0;
357
+ deferred1_1 = r1;
358
+ return getStringFromWasm0(r0, r1);
359
+ } finally {
360
+ wasm.__wbindgen_add_to_stack_pointer(16);
361
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
362
+ }
363
+ }
359
364
  export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
360
365
  const ret = Error(getStringFromWasm0(arg0, arg1));
361
366
  return addHeapObject(ret);
@@ -490,9 +495,6 @@ export function __wbindgen_object_clone_ref(arg0) {
490
495
  export function __wbindgen_object_drop_ref(arg0) {
491
496
  takeObject(arg0);
492
497
  }
493
- const EvalPipelineFinalization = (typeof FinalizationRegistry === 'undefined')
494
- ? { register: () => {}, unregister: () => {} }
495
- : new FinalizationRegistry(ptr => wasm.__wbg_evalpipeline_free(ptr, 1));
496
498
  const GovernanceFinalization = (typeof FinalizationRegistry === 'undefined')
497
499
  ? { register: () => {}, unregister: () => {} }
498
500
  : new FinalizationRegistry(ptr => wasm.__wbg_governance_free(ptr, 1));
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@deepstrike/wasm-kernel",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for DeepStrike runtime kernel",
5
- "version": "0.2.17",
5
+ "version": "0.2.19",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "deepstrike_wasm_bg.wasm",