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