@six5536/smllm-wasm 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -178,26 +178,25 @@ serve it, and none of them changes anything:
178
178
  JavaScript values ready for `fire`, or `{ ok: false, error }`, whose error the host sends back
179
179
  to the model as it stands. Every malformed answer gets the same error.
180
180
 
181
- This loop runs a machine from start to end. The machine is an extractor builder for bank
182
- statements, which is in the `examples/extractor` folder of the smllm repository. The model
183
- answers with an extractor, a JSON value with a schema, or asks for more pages. The host checks
184
- the extractor and fires `checks_passed` or `checks_failed`, and the machine gives up after five
185
- attempts:
181
+ This loop runs a machine from start to end. The machine triages support tickets, and is in the
182
+ `examples/ticket-triage` folder of the smllm repository. The model answers with a triage, a JSON
183
+ value with a schema, or asks for the customer's earlier tickets. The host checks the triage and
184
+ fires `checks_passed` or `checks_failed`, and the machine gives up after five attempts:
186
185
 
187
186
  ```js
188
187
  const engine = new Engine(compiled, {}, memoryStorage());
189
188
  // A keyless `enter` creates the session and starts the machine in one call.
190
- const { session } = engine.fire(undefined, "enter", { stateMachine: "extractor-build" });
189
+ const { session } = engine.fire(undefined, "enter", { stateMachine: "ticket-triage" });
191
190
  for (;;) {
192
191
  const view = engine.hostView(session);
193
192
  if (view.location.machine === null) break; // a final state: the session is idle again
194
193
  if (view.model.length > 0) {
195
- let prompt = `${engine.stateText(session)}\n${statement}`;
194
+ let prompt = `${engine.stateText(session)}\n${ticket}`;
196
195
  for (;;) {
197
196
  const answer = engine.checkAnswer(session, await askModel(prompt)); // your adapter
198
197
  if (answer.ok) {
199
198
  engine.fire(session, answer.event, answer.params); // the model chose the event
200
- if (answer.event === "extractor") extractor = answer.params.json;
199
+ if (answer.event === "triage") triage = answer.params.json;
201
200
  break;
202
201
  }
203
202
  prompt = answer.error; // the refusal, as it stands; count it as an attempt
@@ -216,7 +215,7 @@ for (;;) {
216
215
  ```js
217
216
  const work = {
218
217
  async runChecks(session) {
219
- const errors = await runChecks(extractor); // your checks, which can be async
218
+ const errors = await runChecks(triage, ticket); // your checks, which can be async
220
219
  if (errors.length === 0) engine.fireAsHost(session, "checks_passed");
221
220
  else engine.fireAsHost(session, "checks_failed", { errors: errors.join("\n") });
222
221
  },
@@ -232,7 +231,7 @@ One machine can mix the model's steps, the host's deterministic steps, and a per
232
231
  state that offers the model events is a step of the model. A state whose events are all the
233
232
  host's is a step of the host, such as `CHECKING`, or a person's step, such as an approval for
234
233
  which the host fires the person's decision. A state that offers both lists is a step of the model
235
- that the host can interrupt: the extractor builder's `READ` offers the host `timed_out`, which the
234
+ that the host can interrupt: the ticket triage's `READ` offers the host `timed_out`, which the
236
235
  host fires when the model takes too long.
237
236
 
238
237
  ## Run in Node
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@six5536/smllm-wasm",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "smllm's engine as WebAssembly: run smllm state machines that drive an LLM agent, in a browser or Node.",
5
5
  "homepage": "https://github.com/six5536/smllm#readme",
6
6
  "repository": {
@@ -541,7 +541,7 @@ export function __wbg_Error_30c8987f7c2ed4e2(arg0, arg1) {
541
541
  const ret = Error(getStringFromWasm0(arg0, arg1));
542
542
  return addHeapObject(ret);
543
543
  }
544
- export function __wbg_String_cecff35e2c01b558(arg0, arg1) {
544
+ export function __wbg_String_ec1c3b3c84a9dbf3(arg0, arg1) {
545
545
  const ret = String(getObject(arg1));
546
546
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
547
547
  const len1 = WASM_VECTOR_LEN;
@@ -551,61 +551,61 @@ export function __wbg_String_cecff35e2c01b558(arg0, arg1) {
551
551
  export function __wbg___wbindgen_throw_41e9ee4f547fc59a(arg0, arg1) {
552
552
  throw new Error(getStringFromWasm0(arg0, arg1));
553
553
  }
554
- export function __wbg_audit_74e1db6cf5830646() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
554
+ export function __wbg_audit_3f3d51b1d1e18142() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
555
555
  getObject(arg0).audit(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
556
556
  }, arguments); }
557
- export function __wbg_checkJson_c347a4633ef4d106() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
557
+ export function __wbg_checkJson_db0e073c4512979f() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
558
558
  const ret = getObject(arg1).checkJson(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
559
559
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
560
560
  const len1 = WASM_VECTOR_LEN;
561
561
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
562
562
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
563
563
  }, arguments); }
564
- export function __wbg_check_74d9bb5986e4c1a9() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
564
+ export function __wbg_check_de5a973b91a3d08f() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
565
565
  const ret = getObject(arg0).check(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6), getStringFromWasm0(arg7, arg8));
566
566
  return ret;
567
567
  }, arguments); }
568
- export function __wbg_checksJson_071fcacbc23698af() { return handleError(function (arg0) {
568
+ export function __wbg_checksJson_5ef117e8db8590ab() { return handleError(function (arg0) {
569
569
  const ret = getObject(arg0).checksJson();
570
570
  return ret;
571
571
  }, arguments); }
572
- export function __wbg_history_9012f84a8f46c83e() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
572
+ export function __wbg_history_a61a296671f238eb() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
573
573
  getObject(arg0).history(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
574
574
  }, arguments); }
575
- export function __wbg_isMatch_b1e6bbf6ef4ec3ce() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
575
+ export function __wbg_isMatch_b50cfd3c8781041a() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
576
576
  const ret = getObject(arg0).isMatch(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
577
577
  return ret;
578
578
  }, arguments); }
579
- export function __wbg_now_0d9ea04a799ba8a3() { return handleError(function (arg0) {
579
+ export function __wbg_now_5fc1c6c78f9f39d4() { return handleError(function (arg0) {
580
580
  const ret = getObject(arg0).now();
581
581
  return ret;
582
582
  }, arguments); }
583
- export function __wbg_put_ba72b914046f9b1a() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
583
+ export function __wbg_put_394e26bb364d9b76() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
584
584
  getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
585
585
  }, arguments); }
586
- export function __wbg_random_ec8c8b37b8f3fa25() { return handleError(function (arg0) {
586
+ export function __wbg_random_574ca462424bc88d() { return handleError(function (arg0) {
587
587
  const ret = getObject(arg0).random();
588
588
  return ret;
589
589
  }, arguments); }
590
- export function __wbg_read_cf7e62e7d878815d() { return handleError(function (arg0, arg1, arg2, arg3) {
590
+ export function __wbg_read_6b92e086132ade25() { return handleError(function (arg0, arg1, arg2, arg3) {
591
591
  const ret = getObject(arg1).read(getStringFromWasm0(arg2, arg3));
592
592
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
593
593
  var len1 = WASM_VECTOR_LEN;
594
594
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
595
595
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
596
596
  }, arguments); }
597
- export function __wbg_run_2af5a6bf612a4f65() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
597
+ export function __wbg_run_ee2ccf269a2b9186() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
598
598
  const ret = getObject(arg1).run(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7), getStringFromWasm0(arg8, arg9));
599
599
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
600
600
  const len1 = WASM_VECTOR_LEN;
601
601
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
602
602
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
603
603
  }, arguments); }
604
- export function __wbg_supports_0949a8c83c0fdd6d() { return handleError(function (arg0, arg1, arg2) {
604
+ export function __wbg_supports_7b30783f132799d8() { return handleError(function (arg0, arg1, arg2) {
605
605
  const ret = getObject(arg0).supports(getStringFromWasm0(arg1, arg2));
606
606
  return ret;
607
607
  }, arguments); }
608
- export function __wbg_wantsAudit_0cc52731beef3c65() { return handleError(function (arg0) {
608
+ export function __wbg_wantsAudit_7c79e9f2578983f6() { return handleError(function (arg0) {
609
609
  const ret = getObject(arg0).wantsAudit();
610
610
  return ret;
611
611
  }, arguments); }
Binary file
@@ -546,7 +546,7 @@ function __wbg_get_imports() {
546
546
  const ret = Error(getStringFromWasm0(arg0, arg1));
547
547
  return addHeapObject(ret);
548
548
  },
549
- __wbg_String_cecff35e2c01b558: function(arg0, arg1) {
549
+ __wbg_String_ec1c3b3c84a9dbf3: function(arg0, arg1) {
550
550
  const ret = String(getObject(arg1));
551
551
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
552
552
  const len1 = WASM_VECTOR_LEN;
@@ -556,61 +556,61 @@ function __wbg_get_imports() {
556
556
  __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
557
557
  throw new Error(getStringFromWasm0(arg0, arg1));
558
558
  },
559
- __wbg_audit_74e1db6cf5830646: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
559
+ __wbg_audit_3f3d51b1d1e18142: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
560
560
  getObject(arg0).audit(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
561
561
  }, arguments); },
562
- __wbg_checkJson_c347a4633ef4d106: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
562
+ __wbg_checkJson_db0e073c4512979f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
563
563
  const ret = getObject(arg1).checkJson(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
564
564
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
565
565
  const len1 = WASM_VECTOR_LEN;
566
566
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
567
567
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
568
568
  }, arguments); },
569
- __wbg_check_74d9bb5986e4c1a9: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
569
+ __wbg_check_de5a973b91a3d08f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
570
570
  const ret = getObject(arg0).check(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6), getStringFromWasm0(arg7, arg8));
571
571
  return ret;
572
572
  }, arguments); },
573
- __wbg_checksJson_071fcacbc23698af: function() { return handleError(function (arg0) {
573
+ __wbg_checksJson_5ef117e8db8590ab: function() { return handleError(function (arg0) {
574
574
  const ret = getObject(arg0).checksJson();
575
575
  return ret;
576
576
  }, arguments); },
577
- __wbg_history_9012f84a8f46c83e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
577
+ __wbg_history_a61a296671f238eb: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
578
578
  getObject(arg0).history(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
579
579
  }, arguments); },
580
- __wbg_isMatch_b1e6bbf6ef4ec3ce: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
580
+ __wbg_isMatch_b50cfd3c8781041a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
581
581
  const ret = getObject(arg0).isMatch(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
582
582
  return ret;
583
583
  }, arguments); },
584
- __wbg_now_0d9ea04a799ba8a3: function() { return handleError(function (arg0) {
584
+ __wbg_now_5fc1c6c78f9f39d4: function() { return handleError(function (arg0) {
585
585
  const ret = getObject(arg0).now();
586
586
  return ret;
587
587
  }, arguments); },
588
- __wbg_put_ba72b914046f9b1a: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
588
+ __wbg_put_394e26bb364d9b76: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
589
589
  getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
590
590
  }, arguments); },
591
- __wbg_random_ec8c8b37b8f3fa25: function() { return handleError(function (arg0) {
591
+ __wbg_random_574ca462424bc88d: function() { return handleError(function (arg0) {
592
592
  const ret = getObject(arg0).random();
593
593
  return ret;
594
594
  }, arguments); },
595
- __wbg_read_cf7e62e7d878815d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
595
+ __wbg_read_6b92e086132ade25: function() { return handleError(function (arg0, arg1, arg2, arg3) {
596
596
  const ret = getObject(arg1).read(getStringFromWasm0(arg2, arg3));
597
597
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
598
598
  var len1 = WASM_VECTOR_LEN;
599
599
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
600
600
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
601
601
  }, arguments); },
602
- __wbg_run_2af5a6bf612a4f65: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
602
+ __wbg_run_ee2ccf269a2b9186: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
603
603
  const ret = getObject(arg1).run(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7), getStringFromWasm0(arg8, arg9));
604
604
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
605
605
  const len1 = WASM_VECTOR_LEN;
606
606
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
607
607
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
608
608
  }, arguments); },
609
- __wbg_supports_0949a8c83c0fdd6d: function() { return handleError(function (arg0, arg1, arg2) {
609
+ __wbg_supports_7b30783f132799d8: function() { return handleError(function (arg0, arg1, arg2) {
610
610
  const ret = getObject(arg0).supports(getStringFromWasm0(arg1, arg2));
611
611
  return ret;
612
612
  }, arguments); },
613
- __wbg_wantsAudit_0cc52731beef3c65: function() { return handleError(function (arg0) {
613
+ __wbg_wantsAudit_7c79e9f2578983f6: function() { return handleError(function (arg0) {
614
614
  const ret = getObject(arg0).wantsAudit();
615
615
  return ret;
616
616
  }, arguments); },
Binary file