@deepstrike/wasm-kernel 0.2.6 → 0.2.8

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.
@@ -1,5 +1,46 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * A single loop stop predicate. `kind` is `\"noNewFindings\"` | `\"noErrors\"` | `\"maxRounds\"`;
5
+ * `maxRounds` is required only when `kind === \"maxRounds\"`.
6
+ */
7
+ export interface StopConditionSpec {
8
+ kind: string;
9
+ maxRounds?: number;
10
+ }
11
+
12
+ /**
13
+ * Discriminated action returned by `LoopUntilDone`. Inspect `kind`:
14
+ * `\"spawn\"` → `round`; `\"done\"` → `roundsUsed`, `reason`.
15
+ */
16
+ export interface LoopAction {
17
+ kind: string;
18
+ round?: number;
19
+ roundsUsed?: number;
20
+ reason?: string;
21
+ }
22
+
23
+ /**
24
+ * Discriminated action returned by `Tournament`. Inspect `kind`:
25
+ * `\"judgeRound\"` → `round`, `matches`; `\"done\"` → `winner`, `roundsUsed`.
26
+ */
27
+ export interface TournamentAction {
28
+ kind: string;
29
+ round?: number;
30
+ matches?: TournamentMatch[];
31
+ winner?: string;
32
+ roundsUsed?: number;
33
+ }
34
+
35
+ /**
36
+ * One pairwise match-up in a tournament round.
37
+ */
38
+ export interface TournamentMatch {
39
+ id: number;
40
+ left: string;
41
+ right: string;
42
+ }
43
+
3
44
  /**
4
45
  * Structured context for a provider call — emitted with `kind === \"call_llm\"`.
5
46
  */
@@ -10,6 +51,14 @@ export interface RenderedContext {
10
51
  turns: Message[];
11
52
  }
12
53
 
54
+ /**
55
+ * What the SDK reports after running a loop round\'s worker.
56
+ */
57
+ export interface RoundReport {
58
+ newFindings: number;
59
+ errors: number;
60
+ }
61
+
13
62
  export interface ContentPartObj {
14
63
  type: string;
15
64
  text?: string;
@@ -185,6 +234,18 @@ export class KernelRuntime {
185
234
  turn(): number;
186
235
  }
187
236
 
237
+ /**
238
+ * Loop-until-done state machine; a `maxRounds` backstop is injected if none is given.
239
+ */
240
+ export class LoopUntilDone {
241
+ free(): void;
242
+ [Symbol.dispose](): void;
243
+ feed(report: RoundReport): LoopAction;
244
+ isDone(): boolean;
245
+ constructor(conditions: StopConditionSpec[]);
246
+ start(): LoopAction;
247
+ }
248
+
188
249
  export class SignalRouter {
189
250
  free(): void;
190
251
  [Symbol.dispose](): void;
@@ -200,3 +261,15 @@ export class SignalRouter {
200
261
  */
201
262
  next(): RuntimeSignal | undefined;
202
263
  }
264
+
265
+ /**
266
+ * Single-elimination tournament with pairwise comparative judging.
267
+ */
268
+ export class Tournament {
269
+ free(): void;
270
+ [Symbol.dispose](): void;
271
+ feedRound(winners: string[]): TournamentAction;
272
+ isDone(): boolean;
273
+ constructor(entrants: string[]);
274
+ start(): TournamentAction;
275
+ }
@@ -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
+ EvalPipeline, Governance, KernelRuntime, LoopUntilDone, SignalRouter, Tournament
9
9
  } from "./deepstrike_wasm_bg.js";
@@ -294,6 +294,67 @@ export class KernelRuntime {
294
294
  }
295
295
  if (Symbol.dispose) KernelRuntime.prototype[Symbol.dispose] = KernelRuntime.prototype.free;
296
296
 
297
+ /**
298
+ * Loop-until-done state machine; a `maxRounds` backstop is injected if none is given.
299
+ */
300
+ export class LoopUntilDone {
301
+ __destroy_into_raw() {
302
+ const ptr = this.__wbg_ptr;
303
+ this.__wbg_ptr = 0;
304
+ LoopUntilDoneFinalization.unregister(this);
305
+ return ptr;
306
+ }
307
+ free() {
308
+ const ptr = this.__destroy_into_raw();
309
+ wasm.__wbg_loopuntildone_free(ptr, 0);
310
+ }
311
+ /**
312
+ * @param {RoundReport} report
313
+ * @returns {LoopAction}
314
+ */
315
+ feed(report) {
316
+ const ret = wasm.loopuntildone_feed(this.__wbg_ptr, addHeapObject(report));
317
+ return takeObject(ret);
318
+ }
319
+ /**
320
+ * @returns {boolean}
321
+ */
322
+ isDone() {
323
+ const ret = wasm.loopuntildone_isDone(this.__wbg_ptr);
324
+ return ret !== 0;
325
+ }
326
+ /**
327
+ * @param {StopConditionSpec[]} conditions
328
+ */
329
+ constructor(conditions) {
330
+ try {
331
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
332
+ const ptr0 = passArrayJsValueToWasm0(conditions, wasm.__wbindgen_export);
333
+ const len0 = WASM_VECTOR_LEN;
334
+ wasm.loopuntildone_new(retptr, ptr0, len0);
335
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
336
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
337
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
338
+ if (r2) {
339
+ throw takeObject(r1);
340
+ }
341
+ this.__wbg_ptr = r0;
342
+ LoopUntilDoneFinalization.register(this, this.__wbg_ptr, this);
343
+ return this;
344
+ } finally {
345
+ wasm.__wbindgen_add_to_stack_pointer(16);
346
+ }
347
+ }
348
+ /**
349
+ * @returns {LoopAction}
350
+ */
351
+ start() {
352
+ const ret = wasm.loopuntildone_start(this.__wbg_ptr);
353
+ return takeObject(ret);
354
+ }
355
+ }
356
+ if (Symbol.dispose) LoopUntilDone.prototype[Symbol.dispose] = LoopUntilDone.prototype.free;
357
+
297
358
  export class SignalRouter {
298
359
  __destroy_into_raw() {
299
360
  const ptr = this.__wbg_ptr;
@@ -356,6 +417,80 @@ export class SignalRouter {
356
417
  }
357
418
  }
358
419
  if (Symbol.dispose) SignalRouter.prototype[Symbol.dispose] = SignalRouter.prototype.free;
420
+
421
+ /**
422
+ * Single-elimination tournament with pairwise comparative judging.
423
+ */
424
+ export class Tournament {
425
+ __destroy_into_raw() {
426
+ const ptr = this.__wbg_ptr;
427
+ this.__wbg_ptr = 0;
428
+ TournamentFinalization.unregister(this);
429
+ return ptr;
430
+ }
431
+ free() {
432
+ const ptr = this.__destroy_into_raw();
433
+ wasm.__wbg_tournament_free(ptr, 0);
434
+ }
435
+ /**
436
+ * @param {string[]} winners
437
+ * @returns {TournamentAction}
438
+ */
439
+ feedRound(winners) {
440
+ try {
441
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
442
+ const ptr0 = passArrayJsValueToWasm0(winners, wasm.__wbindgen_export);
443
+ const len0 = WASM_VECTOR_LEN;
444
+ wasm.tournament_feedRound(retptr, this.__wbg_ptr, ptr0, len0);
445
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
446
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
447
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
448
+ if (r2) {
449
+ throw takeObject(r1);
450
+ }
451
+ return takeObject(r0);
452
+ } finally {
453
+ wasm.__wbindgen_add_to_stack_pointer(16);
454
+ }
455
+ }
456
+ /**
457
+ * @returns {boolean}
458
+ */
459
+ isDone() {
460
+ const ret = wasm.tournament_isDone(this.__wbg_ptr);
461
+ return ret !== 0;
462
+ }
463
+ /**
464
+ * @param {string[]} entrants
465
+ */
466
+ constructor(entrants) {
467
+ try {
468
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
469
+ const ptr0 = passArrayJsValueToWasm0(entrants, wasm.__wbindgen_export);
470
+ const len0 = WASM_VECTOR_LEN;
471
+ wasm.tournament_new(retptr, ptr0, len0);
472
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
473
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
474
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
475
+ if (r2) {
476
+ throw takeObject(r1);
477
+ }
478
+ this.__wbg_ptr = r0;
479
+ TournamentFinalization.register(this, this.__wbg_ptr, this);
480
+ return this;
481
+ } finally {
482
+ wasm.__wbindgen_add_to_stack_pointer(16);
483
+ }
484
+ }
485
+ /**
486
+ * @returns {TournamentAction}
487
+ */
488
+ start() {
489
+ const ret = wasm.tournament_start(this.__wbg_ptr);
490
+ return takeObject(ret);
491
+ }
492
+ }
493
+ if (Symbol.dispose) Tournament.prototype[Symbol.dispose] = Tournament.prototype.free;
359
494
  export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
360
495
  const ret = Error(getStringFromWasm0(arg0, arg1));
361
496
  return addHeapObject(ret);
@@ -499,9 +634,15 @@ const GovernanceFinalization = (typeof FinalizationRegistry === 'undefined')
499
634
  const KernelRuntimeFinalization = (typeof FinalizationRegistry === 'undefined')
500
635
  ? { register: () => {}, unregister: () => {} }
501
636
  : new FinalizationRegistry(ptr => wasm.__wbg_kernelruntime_free(ptr, 1));
637
+ const LoopUntilDoneFinalization = (typeof FinalizationRegistry === 'undefined')
638
+ ? { register: () => {}, unregister: () => {} }
639
+ : new FinalizationRegistry(ptr => wasm.__wbg_loopuntildone_free(ptr, 1));
502
640
  const SignalRouterFinalization = (typeof FinalizationRegistry === 'undefined')
503
641
  ? { register: () => {}, unregister: () => {} }
504
642
  : new FinalizationRegistry(ptr => wasm.__wbg_signalrouter_free(ptr, 1));
643
+ const TournamentFinalization = (typeof FinalizationRegistry === 'undefined')
644
+ ? { register: () => {}, unregister: () => {} }
645
+ : new FinalizationRegistry(ptr => wasm.__wbg_tournament_free(ptr, 1));
505
646
 
506
647
  function addHeapObject(obj) {
507
648
  if (heap_next === heap.length) heap.push(heap.length + 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.6",
5
+ "version": "0.2.8",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "deepstrike_wasm_bg.wasm",