@six5536/smllm-wasm 0.4.1 → 0.6.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 +136 -2
- package/dist/node/host.d.ts +1 -1
- package/dist/node/host.js +4 -4
- package/dist/node/storage.js +1 -2
- package/dist/storage.js +1 -2
- package/dist/types.d.ts +96 -4
- package/dist/wrap.d.ts +40 -6
- package/dist/wrap.js +55 -4
- package/package.json +1 -1
- package/wasm/bundler/smllm_wasm.d.ts +30 -5
- package/wasm/bundler/smllm_wasm_bg.js +192 -15
- 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 +35 -5
- package/wasm/web/smllm_wasm.js +192 -15
- 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
|
|
@@ -51,7 +82,7 @@ export class Engine {
|
|
|
51
82
|
}
|
|
52
83
|
/**
|
|
53
84
|
* A tool call: the agent's arguments as JSON, answered as the MCP
|
|
54
|
-
* server answers them (
|
|
85
|
+
* server answers them (WASM-1). A malformed call or an engine error is
|
|
55
86
|
* a reply with `ok: false` and `error: …`, never a throw: the agent
|
|
56
87
|
* sees its mistake as the tool's answer.
|
|
57
88
|
* @param {string} args
|
|
@@ -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
|
|
@@ -226,7 +363,40 @@ export class Engine {
|
|
|
226
363
|
}
|
|
227
364
|
}
|
|
228
365
|
/**
|
|
229
|
-
*
|
|
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
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Where the session is, as the `smllm statusline --json` object (ENG-3).
|
|
230
400
|
* @param {string} key
|
|
231
401
|
* @returns {string}
|
|
232
402
|
*/
|
|
@@ -257,7 +427,7 @@ export class Engine {
|
|
|
257
427
|
}
|
|
258
428
|
}
|
|
259
429
|
/**
|
|
260
|
-
* The stop decision as JSON (
|
|
430
|
+
* The stop decision as JSON (AGT-8..6): `{"decision": "allow"}` = may
|
|
261
431
|
* stop; `{"decision": "block", "text"}` = hold the agent with the events
|
|
262
432
|
* list; `{"decision": "runaway", "text"}` = let it stop, showing the
|
|
263
433
|
* list to the user (the harness was already continuing because of a
|
|
@@ -294,7 +464,7 @@ export class Engine {
|
|
|
294
464
|
}
|
|
295
465
|
/**
|
|
296
466
|
* The agent-facing tool, as JSON `{name, description, inputSchema}`:
|
|
297
|
-
* the core's definition, as the MCP server offers it (
|
|
467
|
+
* the core's definition, as the MCP server offers it (WASM-1).
|
|
298
468
|
* @returns {string}
|
|
299
469
|
*/
|
|
300
470
|
tool() {
|
|
@@ -370,7 +540,7 @@ export function __wbg_Error_30c8987f7c2ed4e2(arg0, arg1) {
|
|
|
370
540
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
371
541
|
return addHeapObject(ret);
|
|
372
542
|
}
|
|
373
|
-
export function
|
|
543
|
+
export function __wbg_String_a5249499d8036ec9(arg0, arg1) {
|
|
374
544
|
const ret = String(getObject(arg1));
|
|
375
545
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
376
546
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -380,46 +550,53 @@ export function __wbg_String_21dd8e4cadac6119(arg0, arg1) {
|
|
|
380
550
|
export function __wbg___wbindgen_throw_41e9ee4f547fc59a(arg0, arg1) {
|
|
381
551
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
382
552
|
}
|
|
383
|
-
export function
|
|
553
|
+
export function __wbg_audit_85f5bb21263e0644() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
554
|
+
getObject(arg0).audit(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
555
|
+
}, arguments); }
|
|
556
|
+
export function __wbg_check_e9ea28c77bd41729() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
|
|
384
557
|
const ret = getObject(arg0).check(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6), getStringFromWasm0(arg7, arg8));
|
|
385
558
|
return ret;
|
|
386
559
|
}, arguments); }
|
|
387
|
-
export function
|
|
560
|
+
export function __wbg_history_ba99161437b60e0e() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
388
561
|
getObject(arg0).history(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
|
|
389
562
|
}, arguments); }
|
|
390
|
-
export function
|
|
563
|
+
export function __wbg_isMatch_57a619cdd9087ba8() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
391
564
|
const ret = getObject(arg0).isMatch(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
392
565
|
return ret;
|
|
393
566
|
}, arguments); }
|
|
394
|
-
export function
|
|
567
|
+
export function __wbg_now_1a669daa685d184d() { return handleError(function (arg0) {
|
|
395
568
|
const ret = getObject(arg0).now();
|
|
396
569
|
return ret;
|
|
397
570
|
}, arguments); }
|
|
398
|
-
export function
|
|
571
|
+
export function __wbg_put_8270908aa8f03c2a() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
399
572
|
getObject(arg0).put(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), getStringFromWasm0(arg5, arg6));
|
|
400
573
|
}, arguments); }
|
|
401
|
-
export function
|
|
574
|
+
export function __wbg_random_a2849827a284f2d5() { return handleError(function (arg0) {
|
|
402
575
|
const ret = getObject(arg0).random();
|
|
403
576
|
return ret;
|
|
404
577
|
}, arguments); }
|
|
405
|
-
export function
|
|
578
|
+
export function __wbg_read_e79d6ea23600ac6f() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
406
579
|
const ret = getObject(arg1).read(getStringFromWasm0(arg2, arg3));
|
|
407
580
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
408
581
|
var len1 = WASM_VECTOR_LEN;
|
|
409
582
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
410
583
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
411
584
|
}, arguments); }
|
|
412
|
-
export function
|
|
585
|
+
export function __wbg_run_e1681363901db5c8() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
|
|
413
586
|
const ret = getObject(arg1).run(getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5), getStringFromWasm0(arg6, arg7), getStringFromWasm0(arg8, arg9));
|
|
414
587
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
415
588
|
const len1 = WASM_VECTOR_LEN;
|
|
416
589
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
417
590
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
418
591
|
}, arguments); }
|
|
419
|
-
export function
|
|
592
|
+
export function __wbg_supports_5e904725127552cf() { return handleError(function (arg0, arg1, arg2) {
|
|
420
593
|
const ret = getObject(arg0).supports(getStringFromWasm0(arg1, arg2));
|
|
421
594
|
return ret;
|
|
422
595
|
}, arguments); }
|
|
596
|
+
export function __wbg_wantsAudit_27e6b386da9d3696() { return handleError(function (arg0) {
|
|
597
|
+
const ret = getObject(arg0).wantsAudit();
|
|
598
|
+
return ret;
|
|
599
|
+
}, arguments); }
|
|
423
600
|
export function __wbindgen_object_drop_ref(arg0) {
|
|
424
601
|
takeObject(arg0);
|
|
425
602
|
}
|
|
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,17 +7,27 @@
|
|
|
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
|
*/
|
|
13
17
|
bind(harness: string, host_session: string | null | undefined, cwd: string): string;
|
|
14
18
|
/**
|
|
15
19
|
* A tool call: the agent's arguments as JSON, answered as the MCP
|
|
16
|
-
* server answers them (
|
|
20
|
+
* server answers them (WASM-1). A malformed call or an engine error is
|
|
17
21
|
* a reply with `ok: false` and `error: …`, never a throw: the agent
|
|
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
|
*/
|
|
@@ -43,11 +63,16 @@ export class Engine {
|
|
|
43
63
|
*/
|
|
44
64
|
promptSubmitted(key: string): void;
|
|
45
65
|
/**
|
|
46
|
-
*
|
|
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;
|
|
70
|
+
/**
|
|
71
|
+
* Where the session is, as the `smllm statusline --json` object (ENG-3).
|
|
47
72
|
*/
|
|
48
73
|
status(key: string): string;
|
|
49
74
|
/**
|
|
50
|
-
* The stop decision as JSON (
|
|
75
|
+
* The stop decision as JSON (AGT-8..6): `{"decision": "allow"}` = may
|
|
51
76
|
* stop; `{"decision": "block", "text"}` = hold the agent with the events
|
|
52
77
|
* list; `{"decision": "runaway", "text"}` = let it stop, showing the
|
|
53
78
|
* list to the user (the harness was already continuing because of a
|
|
@@ -56,7 +81,7 @@ export class Engine {
|
|
|
56
81
|
stop(key: string, stop_hook_active: boolean): string;
|
|
57
82
|
/**
|
|
58
83
|
* The agent-facing tool, as JSON `{name, description, inputSchema}`:
|
|
59
|
-
* the core's definition, as the MCP server offers it (
|
|
84
|
+
* the core's definition, as the MCP server offers it (WASM-1).
|
|
60
85
|
*/
|
|
61
86
|
tool(): string;
|
|
62
87
|
/**
|
|
@@ -74,14 +99,19 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
74
99
|
export interface InitOutput {
|
|
75
100
|
readonly memory: WebAssembly.Memory;
|
|
76
101
|
readonly __wbg_engine_free: (a: number, b: number) => void;
|
|
102
|
+
readonly engine_answerSchema: (a: number, b: number, c: number, d: number) => void;
|
|
77
103
|
readonly engine_bind: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
78
104
|
readonly engine_callTool: (a: number, b: number, c: number, d: number) => void;
|
|
105
|
+
readonly engine_checkAnswer: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
79
106
|
readonly engine_events: (a: number, b: number, c: number, d: number) => void;
|
|
80
107
|
readonly engine_exportState: (a: number, b: number) => void;
|
|
81
108
|
readonly engine_fire: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
109
|
+
readonly engine_fireAsHost: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
110
|
+
readonly engine_hostView: (a: number, b: number, c: number, d: number) => void;
|
|
82
111
|
readonly engine_importState: (a: number, b: number, c: number, d: number) => void;
|
|
83
112
|
readonly engine_new: (a: number, b: number, c: number, d: number) => void;
|
|
84
113
|
readonly engine_promptSubmitted: (a: number, b: number, c: number, d: number) => void;
|
|
114
|
+
readonly engine_stateText: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
85
115
|
readonly engine_status: (a: number, b: number, c: number, d: number) => void;
|
|
86
116
|
readonly engine_stop: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
87
117
|
readonly engine_tool: (a: number, b: number) => void;
|