@six5536/smllm-wasm 0.5.0 → 0.7.0

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.
@@ -14,6 +14,37 @@ export class Engine {
14
14
  const ptr = this.__destroy_into_raw();
15
15
  wasm.__wbg_engine_free(ptr, 0);
16
16
  }
17
+ /**
18
+ * The JSON Schema of a valid answer, as JSON (ENG-8).
19
+ * @param {string} key
20
+ * @returns {string}
21
+ */
22
+ answerSchema(key) {
23
+ let deferred3_0;
24
+ let deferred3_1;
25
+ try {
26
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
27
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
28
+ const len0 = WASM_VECTOR_LEN;
29
+ wasm.engine_answerSchema(retptr, this.__wbg_ptr, ptr0, len0);
30
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
31
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
32
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
33
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
34
+ var ptr2 = r0;
35
+ var len2 = r1;
36
+ if (r3) {
37
+ ptr2 = 0; len2 = 0;
38
+ throw takeObject(r2);
39
+ }
40
+ deferred3_0 = ptr2;
41
+ deferred3_1 = len2;
42
+ return getStringFromWasm0(ptr2, len2);
43
+ } finally {
44
+ wasm.__wbindgen_add_to_stack_pointer(16);
45
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
46
+ }
47
+ }
17
48
  /**
18
49
  * Bind a session; returns the reply JSON (its `session` is the key).
19
50
  * @param {string} harness
@@ -77,6 +108,42 @@ export class Engine {
77
108
  wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
78
109
  }
79
110
  }
111
+ /**
112
+ * A model's answer checked (ENG-9), as JSON: `{"ok": true, "event",
113
+ * "params"}`, whose params are JSON values ready for `fire`, or
114
+ * `{"ok": false, "error"}`.
115
+ * @param {string} key
116
+ * @param {string} text
117
+ * @returns {string}
118
+ */
119
+ checkAnswer(key, text) {
120
+ let deferred4_0;
121
+ let deferred4_1;
122
+ try {
123
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
124
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
125
+ const len0 = WASM_VECTOR_LEN;
126
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
127
+ const len1 = WASM_VECTOR_LEN;
128
+ wasm.engine_checkAnswer(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
129
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
130
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
131
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
132
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
133
+ var ptr3 = r0;
134
+ var len3 = r1;
135
+ if (r3) {
136
+ ptr3 = 0; len3 = 0;
137
+ throw takeObject(r2);
138
+ }
139
+ deferred4_0 = ptr3;
140
+ deferred4_1 = len3;
141
+ return getStringFromWasm0(ptr3, len3);
142
+ } finally {
143
+ wasm.__wbindgen_add_to_stack_pointer(16);
144
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
145
+ }
146
+ }
80
147
  /**
81
148
  * The events list.
82
149
  * @param {string} key
@@ -129,7 +196,45 @@ export class Engine {
129
196
  }
130
197
  }
131
198
  /**
132
- * Fire an event; `params` is a JSON object of strings.
199
+ * Fire an event as the host, host-only events included (ENG-6).
200
+ * @param {string | null | undefined} key
201
+ * @param {string} event
202
+ * @param {string} params
203
+ * @returns {string}
204
+ */
205
+ fireAsHost(key, event, params) {
206
+ let deferred5_0;
207
+ let deferred5_1;
208
+ try {
209
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
210
+ var ptr0 = isLikeNone(key) ? 0 : passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
211
+ var len0 = WASM_VECTOR_LEN;
212
+ const ptr1 = passStringToWasm0(event, wasm.__wbindgen_export, wasm.__wbindgen_export2);
213
+ const len1 = WASM_VECTOR_LEN;
214
+ const ptr2 = passStringToWasm0(params, wasm.__wbindgen_export, wasm.__wbindgen_export2);
215
+ const len2 = WASM_VECTOR_LEN;
216
+ wasm.engine_fireAsHost(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
217
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
218
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
219
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
220
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
221
+ var ptr4 = r0;
222
+ var len4 = r1;
223
+ if (r3) {
224
+ ptr4 = 0; len4 = 0;
225
+ throw takeObject(r2);
226
+ }
227
+ deferred5_0 = ptr4;
228
+ deferred5_1 = len4;
229
+ return getStringFromWasm0(ptr4, len4);
230
+ } finally {
231
+ wasm.__wbindgen_add_to_stack_pointer(16);
232
+ wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
233
+ }
234
+ }
235
+ /**
236
+ * Fire an event for the agent; `params` is a JSON object, of strings
237
+ * except for a JSON param's value.
133
238
  * @param {string | null | undefined} key
134
239
  * @param {string} event
135
240
  * @param {string} params
@@ -165,6 +270,38 @@ export class Engine {
165
270
  wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
166
271
  }
167
272
  }
273
+ /**
274
+ * The state's offered events in two lists, the model's and the
275
+ * host's, with where the session is, as JSON (ENG-10).
276
+ * @param {string} key
277
+ * @returns {string}
278
+ */
279
+ hostView(key) {
280
+ let deferred3_0;
281
+ let deferred3_1;
282
+ try {
283
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
284
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
285
+ const len0 = WASM_VECTOR_LEN;
286
+ wasm.engine_hostView(retptr, this.__wbg_ptr, ptr0, len0);
287
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
288
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
289
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
290
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
291
+ var ptr2 = r0;
292
+ var len2 = r1;
293
+ if (r3) {
294
+ ptr2 = 0; len2 = 0;
295
+ throw takeObject(r2);
296
+ }
297
+ deferred3_0 = ptr2;
298
+ deferred3_1 = len2;
299
+ return getStringFromWasm0(ptr2, len2);
300
+ } finally {
301
+ wasm.__wbindgen_add_to_stack_pointer(16);
302
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
303
+ }
304
+ }
168
305
  /**
169
306
  * Replace the store from [`Engine::export_state`] JSON.
170
307
  * @param {string} state
@@ -227,6 +364,39 @@ export class Engine {
227
364
  wasm.__wbindgen_add_to_stack_pointer(16);
228
365
  }
229
366
  }
367
+ /**
368
+ * The state's text for a model without tools; `schemas` shows each
369
+ * JSON param's schema (ENG-7).
370
+ * @param {string} key
371
+ * @param {boolean} schemas
372
+ * @returns {string}
373
+ */
374
+ stateText(key, schemas) {
375
+ let deferred3_0;
376
+ let deferred3_1;
377
+ try {
378
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
379
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
380
+ const len0 = WASM_VECTOR_LEN;
381
+ wasm.engine_stateText(retptr, this.__wbg_ptr, ptr0, len0, schemas);
382
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
383
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
384
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
385
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
386
+ var ptr2 = r0;
387
+ var len2 = r1;
388
+ if (r3) {
389
+ ptr2 = 0; len2 = 0;
390
+ throw takeObject(r2);
391
+ }
392
+ deferred3_0 = ptr2;
393
+ deferred3_1 = len2;
394
+ return getStringFromWasm0(ptr2, len2);
395
+ } finally {
396
+ wasm.__wbindgen_add_to_stack_pointer(16);
397
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
398
+ }
399
+ }
230
400
  /**
231
401
  * Where the session is, as the `smllm statusline --json` object (ENG-3).
232
402
  * @param {string} key
@@ -316,7 +486,8 @@ export class Engine {
316
486
  }
317
487
  }
318
488
  /**
319
- * Guard and action kinds this host cannot run, as a JSON array.
489
+ * Guard and action kinds this host cannot run, and the `json` params
490
+ * whose schema it can't check, as a JSON array.
320
491
  * @returns {string}
321
492
  */
322
493
  unsupported() {
@@ -375,7 +546,7 @@ function __wbg_get_imports() {
375
546
  const ret = Error(getStringFromWasm0(arg0, arg1));
376
547
  return addHeapObject(ret);
377
548
  },
378
- __wbg_String_bbd7b99db50d2c72: function(arg0, arg1) {
549
+ __wbg_String_cecff35e2c01b558: function(arg0, arg1) {
379
550
  const ret = String(getObject(arg1));
380
551
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
381
552
  const len1 = WASM_VECTOR_LEN;
@@ -385,46 +556,64 @@ function __wbg_get_imports() {
385
556
  __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
386
557
  throw new Error(getStringFromWasm0(arg0, arg1));
387
558
  },
388
- __wbg_check_6dfc683de5752eb9: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
559
+ __wbg_audit_74e1db6cf5830646: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
560
+ getObject(arg0).audit(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
561
+ }, arguments); },
562
+ __wbg_checkJson_c347a4633ef4d106: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
563
+ const ret = getObject(arg1).checkJson(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
564
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
565
+ const len1 = WASM_VECTOR_LEN;
566
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
567
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
568
+ }, arguments); },
569
+ __wbg_check_74d9bb5986e4c1a9: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
389
570
  const ret = getObject(arg0).check(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6), getStringFromWasm0(arg7, arg8));
390
571
  return ret;
391
572
  }, arguments); },
392
- __wbg_history_ed6a3249cdbf6fba: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
573
+ __wbg_checksJson_071fcacbc23698af: function() { return handleError(function (arg0) {
574
+ const ret = getObject(arg0).checksJson();
575
+ return ret;
576
+ }, arguments); },
577
+ __wbg_history_9012f84a8f46c83e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
393
578
  getObject(arg0).history(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
394
579
  }, arguments); },
395
- __wbg_isMatch_b6fb6fb03924405a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
580
+ __wbg_isMatch_b1e6bbf6ef4ec3ce: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
396
581
  const ret = getObject(arg0).isMatch(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
397
582
  return ret;
398
583
  }, arguments); },
399
- __wbg_now_976fd88331086448: function() { return handleError(function (arg0) {
584
+ __wbg_now_0d9ea04a799ba8a3: function() { return handleError(function (arg0) {
400
585
  const ret = getObject(arg0).now();
401
586
  return ret;
402
587
  }, arguments); },
403
- __wbg_put_9cd5b2a059778929: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
588
+ __wbg_put_ba72b914046f9b1a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
404
589
  getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
405
590
  }, arguments); },
406
- __wbg_random_5e704a8263f19bfe: function() { return handleError(function (arg0) {
591
+ __wbg_random_ec8c8b37b8f3fa25: function() { return handleError(function (arg0) {
407
592
  const ret = getObject(arg0).random();
408
593
  return ret;
409
594
  }, arguments); },
410
- __wbg_read_3a7eb14b88f4a798: function() { return handleError(function (arg0, arg1, arg2, arg3) {
595
+ __wbg_read_cf7e62e7d878815d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
411
596
  const ret = getObject(arg1).read(getStringFromWasm0(arg2, arg3));
412
597
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
413
598
  var len1 = WASM_VECTOR_LEN;
414
599
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
415
600
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
416
601
  }, arguments); },
417
- __wbg_run_9856da75a23eb26d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
602
+ __wbg_run_2af5a6bf612a4f65: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
418
603
  const ret = getObject(arg1).run(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7), getStringFromWasm0(arg8, arg9));
419
604
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
420
605
  const len1 = WASM_VECTOR_LEN;
421
606
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
422
607
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
423
608
  }, arguments); },
424
- __wbg_supports_ecfa18db153d083b: function() { return handleError(function (arg0, arg1, arg2) {
609
+ __wbg_supports_0949a8c83c0fdd6d: function() { return handleError(function (arg0, arg1, arg2) {
425
610
  const ret = getObject(arg0).supports(getStringFromWasm0(arg1, arg2));
426
611
  return ret;
427
612
  }, arguments); },
613
+ __wbg_wantsAudit_0cc52731beef3c65: function() { return handleError(function (arg0) {
614
+ const ret = getObject(arg0).wantsAudit();
615
+ return ret;
616
+ }, arguments); },
428
617
  __wbindgen_object_drop_ref: function(arg0) {
429
618
  takeObject(arg0);
430
619
  },
Binary file
@@ -2,14 +2,19 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_engine_free: (a: number, b: number) => void;
5
+ export const engine_answerSchema: (a: number, b: number, c: number, d: number) => void;
5
6
  export const engine_bind: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
6
7
  export const engine_callTool: (a: number, b: number, c: number, d: number) => void;
8
+ export const engine_checkAnswer: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
7
9
  export const engine_events: (a: number, b: number, c: number, d: number) => void;
8
10
  export const engine_exportState: (a: number, b: number) => void;
9
11
  export const engine_fire: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
12
+ export const engine_fireAsHost: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
13
+ export const engine_hostView: (a: number, b: number, c: number, d: number) => void;
10
14
  export const engine_importState: (a: number, b: number, c: number, d: number) => void;
11
15
  export const engine_new: (a: number, b: number, c: number, d: number) => void;
12
16
  export const engine_promptSubmitted: (a: number, b: number, c: number, d: number) => void;
17
+ export const engine_stateText: (a: number, b: number, c: number, d: number, e: number) => void;
13
18
  export const engine_status: (a: number, b: number, c: number, d: number) => void;
14
19
  export const engine_stop: (a: number, b: number, c: number, d: number, e: number) => void;
15
20
  export const engine_tool: (a: number, b: number) => void;