@h1r-ai/croche 0.0.0-stage → 0.5.1
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/LICENSE +32 -0
- package/README.md +1184 -2
- package/THIRD-PARTY-NOTICES +5824 -0
- package/dist/archive.d.ts +47 -0
- package/dist/archive.js +217 -0
- package/dist/atomic-replace.d.ts +18 -0
- package/dist/atomic-replace.js +39 -0
- package/dist/commands.d.ts +56 -0
- package/dist/commands.js +1 -0
- package/dist/control.d.ts +62 -0
- package/dist/control.js +269 -0
- package/dist/core-abi.d.ts +110 -0
- package/dist/core-abi.js +1 -0
- package/dist/core-bindgen.d.ts +413 -0
- package/dist/core-bindgen.js +1533 -0
- package/dist/core-runtime.d.ts +214 -0
- package/dist/core-runtime.js +837 -0
- package/dist/core-wasm-bytes.d.ts +4 -0
- package/dist/core-wasm-bytes.js +5 -0
- package/dist/core-wasm.d.ts +16 -0
- package/dist/core-wasm.js +63 -0
- package/dist/debug.d.ts +26 -0
- package/dist/debug.js +171 -0
- package/dist/file-lock.d.ts +46 -0
- package/dist/file-lock.js +300 -0
- package/dist/images.d.ts +53 -0
- package/dist/images.js +179 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/markers.d.ts +1 -0
- package/dist/markers.js +1 -0
- package/dist/node.d.ts +46 -0
- package/dist/node.js +281 -0
- package/dist/project-core.d.ts +79 -0
- package/dist/project-core.js +261 -0
- package/dist/project-session.d.ts +44 -0
- package/dist/project-session.js +143 -0
- package/dist/project-types.d.ts +97 -0
- package/dist/project-types.js +1 -0
- package/dist/project-wire.d.ts +19 -0
- package/dist/project-wire.js +39 -0
- package/dist/sse.d.ts +19 -0
- package/dist/sse.js +53 -0
- package/dist/storage.d.ts +24 -0
- package/dist/storage.js +32 -0
- package/dist/stream-branch.d.ts +47 -0
- package/dist/stream-branch.js +107 -0
- package/dist/stream-hub.d.ts +207 -0
- package/dist/stream-hub.js +210 -0
- package/dist/stream.d.ts +3 -0
- package/dist/stream.js +5 -0
- package/dist/types.d.ts +928 -0
- package/dist/types.js +8 -0
- package/dist/wiki.d.ts +15 -0
- package/dist/wiki.js +25 -0
- package/docs/CODING-AGENT.md +96 -0
- package/docs/DEBUGGER.md +230 -0
- package/docs/S2-IMPLEMENTATION.md +585 -0
- package/docs/SKILL.md +337 -0
- package/docs/skills/croche/agents/openai.yaml +4 -0
- package/docs/skills/croche/references/agents.md +78 -0
- package/docs/skills/croche/references/first-turn.md +74 -0
- package/docs/skills/croche/references/tools.md +43 -0
- package/docs/skills/croche-cli/SKILL.md +158 -0
- package/docs/skills/croche-cli/agents/openai.yaml +4 -0
- package/docs/skills/croche-cli/references/powershell.md +47 -0
- package/docs/skills/croche-config/SKILL.md +152 -0
- package/docs/skills/croche-config/agents/openai.yaml +4 -0
- package/docs/skills/croche-config/references/models.md +12 -0
- package/docs/skills/croche-platforms/SKILL.md +55 -0
- package/docs/skills/croche-platforms/agents/openai.yaml +4 -0
- package/docs/skills/croche-platforms/references/android.md +185 -0
- package/docs/skills/croche-platforms/references/ios.md +165 -0
- package/docs/skills/croche-platforms/references/react-native.md +50 -0
- package/docs/skills/croche-platforms/references/web-backend.md +58 -0
- package/docs/skills/croche-troubleshoot/SKILL.md +72 -0
- package/docs/skills/croche-troubleshoot/agents/openai.yaml +4 -0
- package/docs/skills/croche-troubleshoot/references/recovery.md +31 -0
- package/package.json +52 -4
- package/src/archive.ts +188 -0
- package/src/atomic-replace.ts +43 -0
- package/src/commands.ts +62 -0
- package/src/control.ts +179 -0
- package/src/core-abi.ts +52 -0
- package/src/core-bindgen.ts +1557 -0
- package/src/core-runtime.ts +750 -0
- package/src/core-wasm-bytes.ts +5 -0
- package/src/core-wasm.ts +57 -0
- package/src/debug.ts +160 -0
- package/src/file-lock.ts +269 -0
- package/src/images.ts +174 -0
- package/src/index.ts +15 -0
- package/src/markers.ts +1 -0
- package/src/node.ts +194 -0
- package/src/project-core.ts +231 -0
- package/src/project-session.ts +118 -0
- package/src/project-types.ts +77 -0
- package/src/project-wire.ts +39 -0
- package/src/sse.ts +57 -0
- package/src/storage.ts +30 -0
- package/src/stream-branch.ts +112 -0
- package/src/stream-hub.ts +249 -0
- package/src/stream.ts +7 -0
- package/src/types.ts +838 -0
- package/src/wiki.ts +25 -0
|
@@ -0,0 +1,1533 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Generated by scripts/build-core.ts (wasm-bindgen) from crates/croche-web. Do not edit.
|
|
3
|
+
let wasm;
|
|
4
|
+
function addToExternrefTable0(obj) {
|
|
5
|
+
const idx = wasm.__externref_table_alloc();
|
|
6
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
7
|
+
return idx;
|
|
8
|
+
}
|
|
9
|
+
function handleError(f, args) {
|
|
10
|
+
try {
|
|
11
|
+
return f.apply(this, args);
|
|
12
|
+
}
|
|
13
|
+
catch (e) {
|
|
14
|
+
const idx = addToExternrefTable0(e);
|
|
15
|
+
wasm.__wbindgen_exn_store(idx);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
let cachedUint8ArrayMemory0 = null;
|
|
19
|
+
function getUint8ArrayMemory0() {
|
|
20
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
21
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
22
|
+
}
|
|
23
|
+
return cachedUint8ArrayMemory0;
|
|
24
|
+
}
|
|
25
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
28
|
+
let numBytesDecoded = 0;
|
|
29
|
+
function decodeText(ptr, len) {
|
|
30
|
+
numBytesDecoded += len;
|
|
31
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
32
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
33
|
+
cachedTextDecoder.decode();
|
|
34
|
+
numBytesDecoded = len;
|
|
35
|
+
}
|
|
36
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
37
|
+
}
|
|
38
|
+
function getStringFromWasm0(ptr, len) {
|
|
39
|
+
ptr = ptr >>> 0;
|
|
40
|
+
return decodeText(ptr, len);
|
|
41
|
+
}
|
|
42
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
43
|
+
ptr = ptr >>> 0;
|
|
44
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
45
|
+
}
|
|
46
|
+
let WASM_VECTOR_LEN = 0;
|
|
47
|
+
const cachedTextEncoder = new TextEncoder();
|
|
48
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
49
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
50
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
51
|
+
view.set(buf);
|
|
52
|
+
return {
|
|
53
|
+
read: arg.length,
|
|
54
|
+
written: buf.length
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
59
|
+
if (realloc === undefined) {
|
|
60
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
61
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
62
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
63
|
+
WASM_VECTOR_LEN = buf.length;
|
|
64
|
+
return ptr;
|
|
65
|
+
}
|
|
66
|
+
let len = arg.length;
|
|
67
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
68
|
+
const mem = getUint8ArrayMemory0();
|
|
69
|
+
let offset = 0;
|
|
70
|
+
for (; offset < len; offset++) {
|
|
71
|
+
const code = arg.charCodeAt(offset);
|
|
72
|
+
if (code > 0x7F)
|
|
73
|
+
break;
|
|
74
|
+
mem[ptr + offset] = code;
|
|
75
|
+
}
|
|
76
|
+
if (offset !== len) {
|
|
77
|
+
if (offset !== 0) {
|
|
78
|
+
arg = arg.slice(offset);
|
|
79
|
+
}
|
|
80
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
81
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
82
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
83
|
+
offset += ret.written;
|
|
84
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
85
|
+
}
|
|
86
|
+
WASM_VECTOR_LEN = offset;
|
|
87
|
+
return ptr;
|
|
88
|
+
}
|
|
89
|
+
let cachedDataViewMemory0 = null;
|
|
90
|
+
function getDataViewMemory0() {
|
|
91
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
92
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
93
|
+
}
|
|
94
|
+
return cachedDataViewMemory0;
|
|
95
|
+
}
|
|
96
|
+
function isLikeNone(x) {
|
|
97
|
+
return x === undefined || x === null;
|
|
98
|
+
}
|
|
99
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
100
|
+
? { register: () => { }, unregister: () => { } }
|
|
101
|
+
: new FinalizationRegistry(state => {
|
|
102
|
+
wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);
|
|
103
|
+
});
|
|
104
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
105
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
106
|
+
const real = (...args) => {
|
|
107
|
+
// First up with a closure we increment the internal reference
|
|
108
|
+
// count. This ensures that the Rust closure environment won't
|
|
109
|
+
// be deallocated while we're invoking it.
|
|
110
|
+
state.cnt++;
|
|
111
|
+
const a = state.a;
|
|
112
|
+
state.a = 0;
|
|
113
|
+
try {
|
|
114
|
+
return f(a, state.b, ...args);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
if (--state.cnt === 0) {
|
|
118
|
+
wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
|
|
119
|
+
CLOSURE_DTORS.unregister(state);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
state.a = a;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
real.original = state;
|
|
127
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
128
|
+
return real;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The JSON transition ABI (`croche_step`) for tools that still drive the Core step by step.
|
|
132
|
+
* @param {string} input
|
|
133
|
+
* @returns {string}
|
|
134
|
+
*/
|
|
135
|
+
export function step(input) {
|
|
136
|
+
let deferred2_0;
|
|
137
|
+
let deferred2_1;
|
|
138
|
+
try {
|
|
139
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
141
|
+
const ret = wasm.step(ptr0, len0);
|
|
142
|
+
deferred2_0 = ret[0];
|
|
143
|
+
deferred2_1 = ret[1];
|
|
144
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
145
|
+
}
|
|
146
|
+
finally {
|
|
147
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function takeFromExternrefTable0(idx) {
|
|
151
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
152
|
+
wasm.__externref_table_dealloc(idx);
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
function _assertClass(instance, klass) {
|
|
156
|
+
if (!(instance instanceof klass)) {
|
|
157
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function __wbg_adapter_10(arg0, arg1, arg2) {
|
|
161
|
+
wasm.closure216_externref_shim(arg0, arg1, arg2);
|
|
162
|
+
}
|
|
163
|
+
function __wbg_adapter_135(arg0, arg1, arg2, arg3) {
|
|
164
|
+
wasm.closure231_externref_shim(arg0, arg1, arg2, arg3);
|
|
165
|
+
}
|
|
166
|
+
const WasmCancelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
167
|
+
? { register: () => { }, unregister: () => { } }
|
|
168
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmcancel_free(ptr >>> 0, 1));
|
|
169
|
+
/**
|
|
170
|
+
* Cancellation of one operation.
|
|
171
|
+
*/
|
|
172
|
+
export class WasmCancel {
|
|
173
|
+
static __wrap(ptr) {
|
|
174
|
+
ptr = ptr >>> 0;
|
|
175
|
+
const obj = Object.create(WasmCancel.prototype);
|
|
176
|
+
obj.__wbg_ptr = ptr;
|
|
177
|
+
WasmCancelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
178
|
+
return obj;
|
|
179
|
+
}
|
|
180
|
+
__destroy_into_raw() {
|
|
181
|
+
const ptr = this.__wbg_ptr;
|
|
182
|
+
this.__wbg_ptr = 0;
|
|
183
|
+
WasmCancelFinalization.unregister(this);
|
|
184
|
+
return ptr;
|
|
185
|
+
}
|
|
186
|
+
free() {
|
|
187
|
+
const ptr = this.__destroy_into_raw();
|
|
188
|
+
wasm.__wbg_wasmcancel_free(ptr, 0);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* @returns {boolean}
|
|
192
|
+
*/
|
|
193
|
+
isCancelled() {
|
|
194
|
+
const ret = wasm.wasmcancel_isCancelled(this.__wbg_ptr);
|
|
195
|
+
return ret !== 0;
|
|
196
|
+
}
|
|
197
|
+
constructor() {
|
|
198
|
+
const ret = wasm.wasmcancel_new();
|
|
199
|
+
this.__wbg_ptr = ret >>> 0;
|
|
200
|
+
WasmCancelFinalization.register(this, this.__wbg_ptr, this);
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
cancel() {
|
|
204
|
+
wasm.wasmcancel_cancel(this.__wbg_ptr);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Calls `callback` once on cancellation (at once if already cancelled).
|
|
208
|
+
* @param {Function} callback
|
|
209
|
+
*/
|
|
210
|
+
onCancel(callback) {
|
|
211
|
+
wasm.wasmcancel_onCancel(this.__wbg_ptr, callback);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (Symbol.dispose)
|
|
215
|
+
WasmCancel.prototype[Symbol.dispose] = WasmCancel.prototype.free;
|
|
216
|
+
const WasmProjectFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
217
|
+
? { register: () => { }, unregister: () => { } }
|
|
218
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmproject_free(ptr >>> 0, 1));
|
|
219
|
+
/**
|
|
220
|
+
* `Croche`: the project, open (#377 6078466532). Its agents are `WasmRuntime`s.
|
|
221
|
+
*/
|
|
222
|
+
export class WasmProject {
|
|
223
|
+
static __wrap(ptr) {
|
|
224
|
+
ptr = ptr >>> 0;
|
|
225
|
+
const obj = Object.create(WasmProject.prototype);
|
|
226
|
+
obj.__wbg_ptr = ptr;
|
|
227
|
+
WasmProjectFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
228
|
+
return obj;
|
|
229
|
+
}
|
|
230
|
+
__destroy_into_raw() {
|
|
231
|
+
const ptr = this.__wbg_ptr;
|
|
232
|
+
this.__wbg_ptr = 0;
|
|
233
|
+
WasmProjectFinalization.unregister(this);
|
|
234
|
+
return ptr;
|
|
235
|
+
}
|
|
236
|
+
free() {
|
|
237
|
+
const ptr = this.__destroy_into_raw();
|
|
238
|
+
wasm.__wbg_wasmproject_free(ptr, 0);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* `Croche.deleteStore` (R8). `pals` as `open` takes it; `options`: JSON `{host, user?,
|
|
242
|
+
* config, agent?}`, `config` the bundled config (its declared agents). Resolves once every
|
|
243
|
+
* delete has returned; nothing was deleted when it rejects with `store_busy`.
|
|
244
|
+
* @param {Function} pals
|
|
245
|
+
* @param {string} options
|
|
246
|
+
* @returns {Promise<any>}
|
|
247
|
+
*/
|
|
248
|
+
static deleteStore(pals, options) {
|
|
249
|
+
const ptr0 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
251
|
+
const ret = wasm.wasmproject_deleteStore(pals, ptr0, len0);
|
|
252
|
+
if (ret[2]) {
|
|
253
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
254
|
+
}
|
|
255
|
+
return takeFromExternrefTable0(ret[0]);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* The Croche user id (`usr_…`): null until an open agent has registered.
|
|
259
|
+
* @returns {string | undefined}
|
|
260
|
+
*/
|
|
261
|
+
crocheUserId() {
|
|
262
|
+
const ret = wasm.wasmproject_crocheUserId(this.__wbg_ptr);
|
|
263
|
+
let v1;
|
|
264
|
+
if (ret[0] !== 0) {
|
|
265
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
266
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
267
|
+
}
|
|
268
|
+
return v1;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @returns {string | undefined}
|
|
272
|
+
*/
|
|
273
|
+
installationId() {
|
|
274
|
+
const ret = wasm.wasmproject_installationId(this.__wbg_ptr);
|
|
275
|
+
let v1;
|
|
276
|
+
if (ret[0] !== 0) {
|
|
277
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
278
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
279
|
+
}
|
|
280
|
+
return v1;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* JSON `{instance?, fresh?, config?}`. Core validates admission, including not-built paths.
|
|
284
|
+
* @param {string | null | undefined} id
|
|
285
|
+
* @param {string} options
|
|
286
|
+
* @returns {Promise<any>}
|
|
287
|
+
*/
|
|
288
|
+
agentWithOptions(id, options) {
|
|
289
|
+
var ptr0 = isLikeNone(id) ? 0 : passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
290
|
+
var len0 = WASM_VECTOR_LEN;
|
|
291
|
+
const ptr1 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
292
|
+
const len1 = WASM_VECTOR_LEN;
|
|
293
|
+
const ret = wasm.wasmproject_agentWithOptions(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
294
|
+
if (ret[2]) {
|
|
295
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
296
|
+
}
|
|
297
|
+
return takeFromExternrefTable0(ret[0]);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* `pals`: `(agentId: string) => CrocheHost`, the host `WasmRuntime.open` takes, one per
|
|
301
|
+
* agent store. `options`: JSON `{host, user?, config, handlers, language? (the host passes the device's preferred one when the app
|
|
302
|
+
* gives none), runtime?:
|
|
303
|
+
* {streaming?, backgroundSync?, maintenanceIntervalMs?}}`. `debug` and `usage` observe
|
|
304
|
+
* every agent from its open.
|
|
305
|
+
* @param {Function} pals
|
|
306
|
+
* @param {string} options
|
|
307
|
+
* @param {Function | null} [debug]
|
|
308
|
+
* @param {Function | null} [usage]
|
|
309
|
+
* @returns {Promise<any>}
|
|
310
|
+
*/
|
|
311
|
+
static open(pals, options, debug, usage) {
|
|
312
|
+
const ptr0 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
313
|
+
const len0 = WASM_VECTOR_LEN;
|
|
314
|
+
const ret = wasm.wasmproject_open(pals, ptr0, len0, isLikeNone(debug) ? 0 : addToExternrefTable0(debug), isLikeNone(usage) ? 0 : addToExternrefTable0(usage));
|
|
315
|
+
if (ret[2]) {
|
|
316
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
317
|
+
}
|
|
318
|
+
return takeFromExternrefTable0(ret[0]);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* @returns {string | undefined}
|
|
322
|
+
*/
|
|
323
|
+
user() {
|
|
324
|
+
const ret = wasm.wasmproject_user(this.__wbg_ptr);
|
|
325
|
+
let v1;
|
|
326
|
+
if (ret[0] !== 0) {
|
|
327
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
328
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
329
|
+
}
|
|
330
|
+
return v1;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Resolves to that agent's `WasmRuntime`; `config` is the code override as JSON.
|
|
334
|
+
* @param {string | null} [id]
|
|
335
|
+
* @param {string | null} [config]
|
|
336
|
+
* @returns {Promise<any>}
|
|
337
|
+
*/
|
|
338
|
+
agent(id, config) {
|
|
339
|
+
var ptr0 = isLikeNone(id) ? 0 : passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
340
|
+
var len0 = WASM_VECTOR_LEN;
|
|
341
|
+
var ptr1 = isLikeNone(config) ? 0 : passStringToWasm0(config, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
var len1 = WASM_VECTOR_LEN;
|
|
343
|
+
const ret = wasm.wasmproject_agent(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
344
|
+
if (ret[2]) {
|
|
345
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
346
|
+
}
|
|
347
|
+
return takeFromExternrefTable0(ret[0]);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Closes every agent, then the project.
|
|
351
|
+
* @returns {Promise<any>}
|
|
352
|
+
*/
|
|
353
|
+
close() {
|
|
354
|
+
const ret = wasm.wasmproject_close(this.__wbg_ptr);
|
|
355
|
+
return ret;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* JSON `app_config_applied` without overrides: which base the agents take.
|
|
359
|
+
* @returns {string}
|
|
360
|
+
*/
|
|
361
|
+
applied() {
|
|
362
|
+
let deferred1_0;
|
|
363
|
+
let deferred1_1;
|
|
364
|
+
try {
|
|
365
|
+
const ret = wasm.wasmproject_applied(this.__wbg_ptr);
|
|
366
|
+
deferred1_0 = ret[0];
|
|
367
|
+
deferred1_1 = ret[1];
|
|
368
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
369
|
+
}
|
|
370
|
+
finally {
|
|
371
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* JSON array of the declared agent ids.
|
|
376
|
+
* @returns {string}
|
|
377
|
+
*/
|
|
378
|
+
agentIds() {
|
|
379
|
+
let deferred1_0;
|
|
380
|
+
let deferred1_1;
|
|
381
|
+
try {
|
|
382
|
+
const ret = wasm.wasmproject_agentIds(this.__wbg_ptr);
|
|
383
|
+
deferred1_0 = ret[0];
|
|
384
|
+
deferred1_1 = ret[1];
|
|
385
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
386
|
+
}
|
|
387
|
+
finally {
|
|
388
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (Symbol.dispose)
|
|
393
|
+
WasmProject.prototype[Symbol.dispose] = WasmProject.prototype.free;
|
|
394
|
+
const WasmRuntimeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
395
|
+
? { register: () => { }, unregister: () => { } }
|
|
396
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmruntime_free(ptr >>> 0, 1));
|
|
397
|
+
/**
|
|
398
|
+
* One Croche Runtime. Results and events are JSON strings.
|
|
399
|
+
*/
|
|
400
|
+
export class WasmRuntime {
|
|
401
|
+
static __wrap(ptr) {
|
|
402
|
+
ptr = ptr >>> 0;
|
|
403
|
+
const obj = Object.create(WasmRuntime.prototype);
|
|
404
|
+
obj.__wbg_ptr = ptr;
|
|
405
|
+
WasmRuntimeFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
406
|
+
return obj;
|
|
407
|
+
}
|
|
408
|
+
__destroy_into_raw() {
|
|
409
|
+
const ptr = this.__wbg_ptr;
|
|
410
|
+
this.__wbg_ptr = 0;
|
|
411
|
+
WasmRuntimeFinalization.unregister(this);
|
|
412
|
+
return ptr;
|
|
413
|
+
}
|
|
414
|
+
free() {
|
|
415
|
+
const ptr = this.__destroy_into_raw();
|
|
416
|
+
wasm.__wbg_wasmruntime_free(ptr, 0);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Throws when the Runtime is closed or its storage failed.
|
|
420
|
+
*/
|
|
421
|
+
checkOpen() {
|
|
422
|
+
const ret = wasm.wasmruntime_checkOpen(this.__wbg_ptr);
|
|
423
|
+
if (ret[1]) {
|
|
424
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Stops the running turn only; sends held behind it run, together, as the next turn. It
|
|
429
|
+
* stops at the call; the promise resolves once the stop is durable.
|
|
430
|
+
* @returns {Promise<any>}
|
|
431
|
+
*/
|
|
432
|
+
cancelTurn() {
|
|
433
|
+
const ret = wasm.wasmruntime_cancelTurn(this.__wbg_ptr);
|
|
434
|
+
return ret;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Delivers the agent's scheduled notes that are due, as one turn (JSON result).
|
|
438
|
+
* @returns {Promise<any>}
|
|
439
|
+
*/
|
|
440
|
+
deliverDue() {
|
|
441
|
+
const ret = wasm.wasmruntime_deliverDue(this.__wbg_ptr);
|
|
442
|
+
return ret;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* `list` or `export` (JSON).
|
|
446
|
+
* @param {string} op
|
|
447
|
+
* @returns {string}
|
|
448
|
+
*/
|
|
449
|
+
memoryRead(op) {
|
|
450
|
+
let deferred3_0;
|
|
451
|
+
let deferred3_1;
|
|
452
|
+
try {
|
|
453
|
+
const ptr0 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
454
|
+
const len0 = WASM_VECTOR_LEN;
|
|
455
|
+
const ret = wasm.wasmruntime_memoryRead(this.__wbg_ptr, ptr0, len0);
|
|
456
|
+
var ptr2 = ret[0];
|
|
457
|
+
var len2 = ret[1];
|
|
458
|
+
if (ret[3]) {
|
|
459
|
+
ptr2 = 0;
|
|
460
|
+
len2 = 0;
|
|
461
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
462
|
+
}
|
|
463
|
+
deferred3_0 = ptr2;
|
|
464
|
+
deferred3_1 = len2;
|
|
465
|
+
return getStringFromWasm0(ptr2, len2);
|
|
466
|
+
}
|
|
467
|
+
finally {
|
|
468
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* @param {string} path
|
|
473
|
+
* @returns {boolean}
|
|
474
|
+
*/
|
|
475
|
+
wikiRemove(path) {
|
|
476
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
477
|
+
const len0 = WASM_VECTOR_LEN;
|
|
478
|
+
const ret = wasm.wasmruntime_wikiRemove(this.__wbg_ptr, ptr0, len0);
|
|
479
|
+
if (ret[2]) {
|
|
480
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
481
|
+
}
|
|
482
|
+
return ret[0] !== 0;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* JSON `[{path, title, snippet, score}]`, best first.
|
|
486
|
+
* @param {string} query
|
|
487
|
+
* @param {number} limit
|
|
488
|
+
* @returns {string}
|
|
489
|
+
*/
|
|
490
|
+
wikiSearch(query, limit) {
|
|
491
|
+
let deferred3_0;
|
|
492
|
+
let deferred3_1;
|
|
493
|
+
try {
|
|
494
|
+
const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
495
|
+
const len0 = WASM_VECTOR_LEN;
|
|
496
|
+
const ret = wasm.wasmruntime_wikiSearch(this.__wbg_ptr, ptr0, len0, limit);
|
|
497
|
+
var ptr2 = ret[0];
|
|
498
|
+
var len2 = ret[1];
|
|
499
|
+
if (ret[3]) {
|
|
500
|
+
ptr2 = 0;
|
|
501
|
+
len2 = 0;
|
|
502
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
503
|
+
}
|
|
504
|
+
deferred3_0 = ptr2;
|
|
505
|
+
deferred3_1 = len2;
|
|
506
|
+
return getStringFromWasm0(ptr2, len2);
|
|
507
|
+
}
|
|
508
|
+
finally {
|
|
509
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* The turn archive's records of `from..=to` (F20), as `{records}`. Internal: the SDK does
|
|
514
|
+
* not expose it; `memory history` (B3) reads through the same effect.
|
|
515
|
+
* @param {number} from
|
|
516
|
+
* @param {number} to
|
|
517
|
+
* @returns {Promise<any>}
|
|
518
|
+
*/
|
|
519
|
+
archiveRead(from, to) {
|
|
520
|
+
const ret = wasm.wasmruntime_archiveRead(this.__wbg_ptr, from, to);
|
|
521
|
+
return ret;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Drops the sends held behind the running turn (each ends `cancelled`); resolves how many,
|
|
525
|
+
* once the held record no longer lists them.
|
|
526
|
+
* @returns {Promise<any>}
|
|
527
|
+
*/
|
|
528
|
+
clearQueued() {
|
|
529
|
+
const ret = wasm.wasmruntime_clearQueued(this.__wbg_ptr);
|
|
530
|
+
return ret;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* @returns {Promise<any>}
|
|
534
|
+
*/
|
|
535
|
+
memoryClear() {
|
|
536
|
+
const ret = wasm.wasmruntime_memoryClear(this.__wbg_ptr);
|
|
537
|
+
return ret;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* @param {string} id
|
|
541
|
+
* @param {number} from_seq
|
|
542
|
+
* @param {Function} captured
|
|
543
|
+
* @returns {Promise<any>}
|
|
544
|
+
*/
|
|
545
|
+
readOutcome(id, from_seq, captured) {
|
|
546
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
547
|
+
const len0 = WASM_VECTOR_LEN;
|
|
548
|
+
const ret = wasm.wasmruntime_readOutcome(this.__wbg_ptr, ptr0, len0, from_seq, captured);
|
|
549
|
+
if (ret[2]) {
|
|
550
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
551
|
+
}
|
|
552
|
+
return takeFromExternrefTable0(ret[0]);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* @param {number} amount
|
|
556
|
+
* @param {boolean} absolute
|
|
557
|
+
* @param {string | null} [id]
|
|
558
|
+
* @returns {Promise<any>}
|
|
559
|
+
*/
|
|
560
|
+
adjustBudget(amount, absolute, id) {
|
|
561
|
+
var ptr0 = isLikeNone(id) ? 0 : passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
562
|
+
var len0 = WASM_VECTOR_LEN;
|
|
563
|
+
const ret = wasm.wasmruntime_adjustBudget(this.__wbg_ptr, amount, absolute, ptr0, len0);
|
|
564
|
+
return ret;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Deletes archived turns for real: all, or `from..=to`. Internal (B3 forget-scrubbing).
|
|
568
|
+
* @param {number | null} [from]
|
|
569
|
+
* @param {number | null} [to]
|
|
570
|
+
* @returns {Promise<any>}
|
|
571
|
+
*/
|
|
572
|
+
archiveClear(from, to) {
|
|
573
|
+
const ret = wasm.wasmruntime_archiveClear(this.__wbg_ptr, isLikeNone(from) ? 0x100000001 : (from) >>> 0, isLikeNone(to) ? 0x100000001 : (to) >>> 0);
|
|
574
|
+
return ret;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* @param {string} id
|
|
578
|
+
* @returns {Promise<any>}
|
|
579
|
+
*/
|
|
580
|
+
memoryDelete(id) {
|
|
581
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
582
|
+
const len0 = WASM_VECTOR_LEN;
|
|
583
|
+
const ret = wasm.wasmruntime_memoryDelete(this.__wbg_ptr, ptr0, len0);
|
|
584
|
+
return ret;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* JSON array of names, or null.
|
|
588
|
+
* @returns {string | undefined}
|
|
589
|
+
*/
|
|
590
|
+
visibleTools() {
|
|
591
|
+
const ret = wasm.wasmruntime_visibleTools(this.__wbg_ptr);
|
|
592
|
+
let v1;
|
|
593
|
+
if (ret[0] !== 0) {
|
|
594
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
595
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
596
|
+
}
|
|
597
|
+
return v1;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* This user's own documents (stored with their state): resolves to JSON
|
|
601
|
+
* `{documents, bytes}` once durable.
|
|
602
|
+
* @param {string} docs
|
|
603
|
+
* @returns {Promise<any>}
|
|
604
|
+
*/
|
|
605
|
+
wikiPutUser(docs) {
|
|
606
|
+
const ptr0 = passStringToWasm0(docs, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
607
|
+
const len0 = WASM_VECTOR_LEN;
|
|
608
|
+
const ret = wasm.wasmruntime_wikiPutUser(this.__wbg_ptr, ptr0, len0);
|
|
609
|
+
if (ret[2]) {
|
|
610
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
611
|
+
}
|
|
612
|
+
return takeFromExternrefTable0(ret[0]);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Transitional (Keel, #354): today's turn-result send, until the TS SDK moves to the
|
|
616
|
+
* receipt `send` (S2). Not public API: absent from the SDK's types.
|
|
617
|
+
* @param {string} input
|
|
618
|
+
* @param {Function | null | undefined} on_event
|
|
619
|
+
* @param {WasmCancel} cancel
|
|
620
|
+
* @param {string | null} [response_format]
|
|
621
|
+
* @returns {Promise<any>}
|
|
622
|
+
*/
|
|
623
|
+
sendForResult(input, on_event, cancel, response_format) {
|
|
624
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
625
|
+
const len0 = WASM_VECTOR_LEN;
|
|
626
|
+
_assertClass(cancel, WasmCancel);
|
|
627
|
+
var ptr1 = isLikeNone(response_format) ? 0 : passStringToWasm0(response_format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
628
|
+
var len1 = WASM_VECTOR_LEN;
|
|
629
|
+
const ret = wasm.wasmruntime_sendForResult(this.__wbg_ptr, ptr0, len0, isLikeNone(on_event) ? 0 : addToExternrefTable0(on_event), cancel.__wbg_ptr, ptr1, len1);
|
|
630
|
+
if (ret[2]) {
|
|
631
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
632
|
+
}
|
|
633
|
+
return takeFromExternrefTable0(ret[0]);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* JSON `{cleared}` once durable.
|
|
637
|
+
* @returns {Promise<any>}
|
|
638
|
+
*/
|
|
639
|
+
wikiClearUser() {
|
|
640
|
+
const ret = wasm.wasmruntime_wikiClearUser(this.__wbg_ptr);
|
|
641
|
+
return ret;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* @param {number} id
|
|
645
|
+
*/
|
|
646
|
+
closeProjection(id) {
|
|
647
|
+
const ret = wasm.wasmruntime_closeProjection(this.__wbg_ptr, id);
|
|
648
|
+
if (ret[1]) {
|
|
649
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* JSON `{removed}` once durable.
|
|
654
|
+
* @param {string} path
|
|
655
|
+
* @returns {Promise<any>}
|
|
656
|
+
*/
|
|
657
|
+
wikiRemoveUser(path) {
|
|
658
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
659
|
+
const len0 = WASM_VECTOR_LEN;
|
|
660
|
+
const ret = wasm.wasmruntime_wikiRemoveUser(this.__wbg_ptr, ptr0, len0);
|
|
661
|
+
return ret;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* @param {boolean} enabled
|
|
665
|
+
* @returns {Promise<any>}
|
|
666
|
+
*/
|
|
667
|
+
memorySetEnabled(enabled) {
|
|
668
|
+
const ret = wasm.wasmruntime_memorySetEnabled(this.__wbg_ptr, enabled);
|
|
669
|
+
return ret;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* @param {Function | null | undefined} observer
|
|
673
|
+
* @param {boolean} full
|
|
674
|
+
*/
|
|
675
|
+
setDebugObserver(observer, full) {
|
|
676
|
+
const ret = wasm.wasmruntime_setDebugObserver(this.__wbg_ptr, isLikeNone(observer) ? 0 : addToExternrefTable0(observer), full);
|
|
677
|
+
if (ret[1]) {
|
|
678
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* @param {Function | null} [observer]
|
|
683
|
+
*/
|
|
684
|
+
setUsageObserver(observer) {
|
|
685
|
+
wasm.wasmruntime_setUsageObserver(this.__wbg_ptr, isLikeNone(observer) ? 0 : addToExternrefTable0(observer));
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* @param {Function | null} [observer]
|
|
689
|
+
*/
|
|
690
|
+
setMemoryObserver(observer) {
|
|
691
|
+
wasm.wasmruntime_setMemoryObserver(this.__wbg_ptr, isLikeNone(observer) ? 0 : addToExternrefTable0(observer));
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* ABI only, for the legacy `CrocheRuntime.setTools(declarations)` until the host moves to
|
|
695
|
+
* the factory agent; never in a public type. Refused on a factory agent. Deleted by
|
|
696
|
+
* 2026-10-16 (Keel #381 6079439608, delete-list item 12).
|
|
697
|
+
* @param {string} tools
|
|
698
|
+
*/
|
|
699
|
+
setToolDeclarations(tools) {
|
|
700
|
+
const ptr0 = passStringToWasm0(tools, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
701
|
+
const len0 = WASM_VECTOR_LEN;
|
|
702
|
+
const ret = wasm.wasmruntime_setToolDeclarations(this.__wbg_ptr, ptr0, len0);
|
|
703
|
+
if (ret[1]) {
|
|
704
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Runs a Core command that has no input of its own: sync, flush, clear_history.
|
|
709
|
+
* @param {string} command
|
|
710
|
+
* @returns {Promise<any>}
|
|
711
|
+
*/
|
|
712
|
+
run(command) {
|
|
713
|
+
const ptr0 = passStringToWasm0(command, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
714
|
+
const len0 = WASM_VECTOR_LEN;
|
|
715
|
+
const ret = wasm.wasmruntime_run(this.__wbg_ptr, ptr0, len0);
|
|
716
|
+
return ret;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* @returns {string | undefined}
|
|
720
|
+
*/
|
|
721
|
+
mode() {
|
|
722
|
+
const ret = wasm.wasmruntime_mode(this.__wbg_ptr);
|
|
723
|
+
let v1;
|
|
724
|
+
if (ret[0] !== 0) {
|
|
725
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
726
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
727
|
+
}
|
|
728
|
+
return v1;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* @returns {string | undefined}
|
|
732
|
+
*/
|
|
733
|
+
name() {
|
|
734
|
+
const ret = wasm.wasmruntime_name(this.__wbg_ptr);
|
|
735
|
+
let v1;
|
|
736
|
+
if (ret[0] !== 0) {
|
|
737
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
738
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
739
|
+
}
|
|
740
|
+
return v1;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* `options`: `{storageKey?, streaming?, backgroundSync?, maintenanceIntervalMs?}`.
|
|
744
|
+
* `debug` and `usage` observe from the start, open included.
|
|
745
|
+
* @param {CrocheHost} host
|
|
746
|
+
* @param {string} config
|
|
747
|
+
* @param {string} options
|
|
748
|
+
* @param {Function | null} [debug]
|
|
749
|
+
* @param {Function | null} [usage]
|
|
750
|
+
* @returns {Promise<any>}
|
|
751
|
+
*/
|
|
752
|
+
static open(host, config, options, debug, usage) {
|
|
753
|
+
const ptr0 = passStringToWasm0(config, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
754
|
+
const len0 = WASM_VECTOR_LEN;
|
|
755
|
+
const ptr1 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
756
|
+
const len1 = WASM_VECTOR_LEN;
|
|
757
|
+
const ret = wasm.wasmruntime_open(host, ptr0, len0, ptr1, len1, isLikeNone(debug) ? 0 : addToExternrefTable0(debug), isLikeNone(usage) ? 0 : addToExternrefTable0(usage));
|
|
758
|
+
if (ret[2]) {
|
|
759
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
760
|
+
}
|
|
761
|
+
return takeFromExternrefTable0(ret[0]);
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Accepts the input durably and resolves with its receipt JSON, `{id, status, seq}` (see
|
|
765
|
+
* `Runtime::send`). `cancel` applies only before acceptance. `response_format`: structured
|
|
766
|
+
* output as JSON text (see `SendOptions::response_format`).
|
|
767
|
+
* @param {string} input
|
|
768
|
+
* @param {Function | null | undefined} on_event
|
|
769
|
+
* @param {WasmCancel} cancel
|
|
770
|
+
* @param {string | null} [response_format]
|
|
771
|
+
* @returns {Promise<any>}
|
|
772
|
+
*/
|
|
773
|
+
send(input, on_event, cancel, response_format) {
|
|
774
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
775
|
+
const len0 = WASM_VECTOR_LEN;
|
|
776
|
+
_assertClass(cancel, WasmCancel);
|
|
777
|
+
var ptr1 = isLikeNone(response_format) ? 0 : passStringToWasm0(response_format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
778
|
+
var len1 = WASM_VECTOR_LEN;
|
|
779
|
+
const ret = wasm.wasmruntime_send(this.__wbg_ptr, ptr0, len0, isLikeNone(on_event) ? 0 : addToExternrefTable0(on_event), cancel.__wbg_ptr, ptr1, len1);
|
|
780
|
+
if (ret[2]) {
|
|
781
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
782
|
+
}
|
|
783
|
+
return takeFromExternrefTable0(ret[0]);
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* @returns {Promise<any>}
|
|
787
|
+
*/
|
|
788
|
+
tick() {
|
|
789
|
+
const ret = wasm.wasmruntime_tick(this.__wbg_ptr);
|
|
790
|
+
return ret;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* @returns {Promise<any>}
|
|
794
|
+
*/
|
|
795
|
+
close() {
|
|
796
|
+
const ret = wasm.wasmruntime_close(this.__wbg_ptr);
|
|
797
|
+
return ret;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Cancels input `id` (`Runtime::cancel`); resolves once durable. Rejects `unknown_id` or
|
|
801
|
+
* `closed` with the Core's error.
|
|
802
|
+
* @param {string} id
|
|
803
|
+
* @returns {Promise<any>}
|
|
804
|
+
*/
|
|
805
|
+
cancel(id) {
|
|
806
|
+
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
807
|
+
const len0 = WASM_VECTOR_LEN;
|
|
808
|
+
const ret = wasm.wasmruntime_cancel(this.__wbg_ptr, ptr0, len0);
|
|
809
|
+
return ret;
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* @returns {string}
|
|
813
|
+
*/
|
|
814
|
+
logId() {
|
|
815
|
+
let deferred2_0;
|
|
816
|
+
let deferred2_1;
|
|
817
|
+
try {
|
|
818
|
+
const ret = wasm.wasmruntime_logId(this.__wbg_ptr);
|
|
819
|
+
var ptr1 = ret[0];
|
|
820
|
+
var len1 = ret[1];
|
|
821
|
+
if (ret[3]) {
|
|
822
|
+
ptr1 = 0;
|
|
823
|
+
len1 = 0;
|
|
824
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
825
|
+
}
|
|
826
|
+
deferred2_0 = ptr1;
|
|
827
|
+
deferred2_1 = len1;
|
|
828
|
+
return getStringFromWasm0(ptr1, len1);
|
|
829
|
+
}
|
|
830
|
+
finally {
|
|
831
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Selection and projection filtering belong entirely to Core.
|
|
836
|
+
* @param {string} selection
|
|
837
|
+
* @param {Function} on_event
|
|
838
|
+
* @returns {number}
|
|
839
|
+
*/
|
|
840
|
+
select(selection, on_event) {
|
|
841
|
+
const ptr0 = passStringToWasm0(selection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
842
|
+
const len0 = WASM_VECTOR_LEN;
|
|
843
|
+
const ret = wasm.wasmruntime_select(this.__wbg_ptr, ptr0, len0, on_event);
|
|
844
|
+
if (ret[2]) {
|
|
845
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
846
|
+
}
|
|
847
|
+
return ret[0];
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* @returns {boolean}
|
|
851
|
+
*/
|
|
852
|
+
created() {
|
|
853
|
+
const ret = wasm.wasmruntime_created(this.__wbg_ptr);
|
|
854
|
+
return ret !== 0;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* @param {number} id
|
|
858
|
+
* @param {number | null | undefined} before
|
|
859
|
+
* @param {number} limit
|
|
860
|
+
* @returns {Promise<any>}
|
|
861
|
+
*/
|
|
862
|
+
history(id, before, limit) {
|
|
863
|
+
const ret = wasm.wasmruntime_history(this.__wbg_ptr, id, !isLikeNone(before), isLikeNone(before) ? 0 : before, limit);
|
|
864
|
+
if (ret[2]) {
|
|
865
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
866
|
+
}
|
|
867
|
+
return takeFromExternrefTable0(ret[0]);
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* @returns {string}
|
|
871
|
+
*/
|
|
872
|
+
inspect() {
|
|
873
|
+
let deferred2_0;
|
|
874
|
+
let deferred2_1;
|
|
875
|
+
try {
|
|
876
|
+
const ret = wasm.wasmruntime_inspect(this.__wbg_ptr);
|
|
877
|
+
var ptr1 = ret[0];
|
|
878
|
+
var len1 = ret[1];
|
|
879
|
+
if (ret[3]) {
|
|
880
|
+
ptr1 = 0;
|
|
881
|
+
len1 = 0;
|
|
882
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
883
|
+
}
|
|
884
|
+
deferred2_0 = ptr1;
|
|
885
|
+
deferred2_1 = len1;
|
|
886
|
+
return getStringFromWasm0(ptr1, len1);
|
|
887
|
+
}
|
|
888
|
+
finally {
|
|
889
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* The canonical stream observer, called before the app projection.
|
|
894
|
+
* @param {Function} on_event
|
|
895
|
+
* @param {Function} on_end
|
|
896
|
+
*/
|
|
897
|
+
observe(on_event, on_end) {
|
|
898
|
+
const ret = wasm.wasmruntime_observe(this.__wbg_ptr, on_event, on_end);
|
|
899
|
+
if (ret[1]) {
|
|
900
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* @returns {number | undefined}
|
|
905
|
+
*/
|
|
906
|
+
wakeAt() {
|
|
907
|
+
const ret = wasm.wasmruntime_wakeAt(this.__wbg_ptr);
|
|
908
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* @returns {string}
|
|
912
|
+
*/
|
|
913
|
+
agentId() {
|
|
914
|
+
let deferred1_0;
|
|
915
|
+
let deferred1_1;
|
|
916
|
+
try {
|
|
917
|
+
const ret = wasm.wasmruntime_agentId(this.__wbg_ptr);
|
|
918
|
+
deferred1_0 = ret[0];
|
|
919
|
+
deferred1_1 = ret[1];
|
|
920
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
921
|
+
}
|
|
922
|
+
finally {
|
|
923
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* @returns {string | undefined}
|
|
928
|
+
*/
|
|
929
|
+
instance() {
|
|
930
|
+
const ret = wasm.wasmruntime_instance(this.__wbg_ptr);
|
|
931
|
+
let v1;
|
|
932
|
+
if (ret[0] !== 0) {
|
|
933
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
934
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
935
|
+
}
|
|
936
|
+
return v1;
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* @param {boolean} force
|
|
940
|
+
* @returns {Promise<any>}
|
|
941
|
+
*/
|
|
942
|
+
maintain(force) {
|
|
943
|
+
const ret = wasm.wasmruntime_maintain(this.__wbg_ptr, force);
|
|
944
|
+
return ret;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* @param {string | null} [mode]
|
|
948
|
+
* @returns {Promise<any>}
|
|
949
|
+
*/
|
|
950
|
+
setMode(mode) {
|
|
951
|
+
var ptr0 = isLikeNone(mode) ? 0 : passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
952
|
+
var len0 = WASM_VECTOR_LEN;
|
|
953
|
+
const ret = wasm.wasmruntime_setMode(this.__wbg_ptr, ptr0, len0);
|
|
954
|
+
return ret;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* @param {string} docs
|
|
958
|
+
*/
|
|
959
|
+
wikiPut(docs) {
|
|
960
|
+
const ptr0 = passStringToWasm0(docs, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
961
|
+
const len0 = WASM_VECTOR_LEN;
|
|
962
|
+
const ret = wasm.wasmruntime_wikiPut(this.__wbg_ptr, ptr0, len0);
|
|
963
|
+
if (ret[1]) {
|
|
964
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Replaces every wiki document (`[{path, markdown, agents?}]` as JSON); JSON
|
|
969
|
+
* `{documents, bytes, digest}`.
|
|
970
|
+
* @param {string} docs
|
|
971
|
+
* @returns {string}
|
|
972
|
+
*/
|
|
973
|
+
wikiSet(docs) {
|
|
974
|
+
let deferred3_0;
|
|
975
|
+
let deferred3_1;
|
|
976
|
+
try {
|
|
977
|
+
const ptr0 = passStringToWasm0(docs, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
978
|
+
const len0 = WASM_VECTOR_LEN;
|
|
979
|
+
const ret = wasm.wasmruntime_wikiSet(this.__wbg_ptr, ptr0, len0);
|
|
980
|
+
var ptr2 = ret[0];
|
|
981
|
+
var len2 = ret[1];
|
|
982
|
+
if (ret[3]) {
|
|
983
|
+
ptr2 = 0;
|
|
984
|
+
len2 = 0;
|
|
985
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
986
|
+
}
|
|
987
|
+
deferred3_0 = ptr2;
|
|
988
|
+
deferred3_1 = len2;
|
|
989
|
+
return getStringFromWasm0(ptr2, len2);
|
|
990
|
+
}
|
|
991
|
+
finally {
|
|
992
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* @returns {boolean}
|
|
997
|
+
*/
|
|
998
|
+
isClosed() {
|
|
999
|
+
const ret = wasm.wasmruntime_isClosed(this.__wbg_ptr);
|
|
1000
|
+
return ret !== 0;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* The agent's pending scheduled notes (JSON `{pending: [{id, at, note}], due}`).
|
|
1004
|
+
* @returns {string}
|
|
1005
|
+
*/
|
|
1006
|
+
schedules() {
|
|
1007
|
+
let deferred2_0;
|
|
1008
|
+
let deferred2_1;
|
|
1009
|
+
try {
|
|
1010
|
+
const ret = wasm.wasmruntime_schedules(this.__wbg_ptr);
|
|
1011
|
+
var ptr1 = ret[0];
|
|
1012
|
+
var len1 = ret[1];
|
|
1013
|
+
if (ret[3]) {
|
|
1014
|
+
ptr1 = 0;
|
|
1015
|
+
len1 = 0;
|
|
1016
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1017
|
+
}
|
|
1018
|
+
deferred2_0 = ptr1;
|
|
1019
|
+
deferred2_1 = len1;
|
|
1020
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1021
|
+
}
|
|
1022
|
+
finally {
|
|
1023
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* `visible`: a JSON array of tool names, or null for every tool. Resolves to undefined.
|
|
1028
|
+
* @param {string | null} [visible]
|
|
1029
|
+
* @returns {Promise<any>}
|
|
1030
|
+
*/
|
|
1031
|
+
setTools(visible) {
|
|
1032
|
+
var ptr0 = isLikeNone(visible) ? 0 : passStringToWasm0(visible, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1033
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1034
|
+
const ret = wasm.wasmruntime_setTools(this.__wbg_ptr, ptr0, len0);
|
|
1035
|
+
if (ret[2]) {
|
|
1036
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1037
|
+
}
|
|
1038
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1039
|
+
}
|
|
1040
|
+
unobserve() {
|
|
1041
|
+
wasm.wasmruntime_unobserve(this.__wbg_ptr);
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* JSON `[{path, title, summary?, characters, parts}]`.
|
|
1045
|
+
* @param {string | null} [folder]
|
|
1046
|
+
* @returns {string}
|
|
1047
|
+
*/
|
|
1048
|
+
wikiList(folder) {
|
|
1049
|
+
let deferred3_0;
|
|
1050
|
+
let deferred3_1;
|
|
1051
|
+
try {
|
|
1052
|
+
var ptr0 = isLikeNone(folder) ? 0 : passStringToWasm0(folder, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1053
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1054
|
+
const ret = wasm.wasmruntime_wikiList(this.__wbg_ptr, ptr0, len0);
|
|
1055
|
+
var ptr2 = ret[0];
|
|
1056
|
+
var len2 = ret[1];
|
|
1057
|
+
if (ret[3]) {
|
|
1058
|
+
ptr2 = 0;
|
|
1059
|
+
len2 = 0;
|
|
1060
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1061
|
+
}
|
|
1062
|
+
deferred3_0 = ptr2;
|
|
1063
|
+
deferred3_1 = len2;
|
|
1064
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1065
|
+
}
|
|
1066
|
+
finally {
|
|
1067
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* JSON `{path, title, part, parts, text}`, or `null`.
|
|
1072
|
+
* @param {string} path
|
|
1073
|
+
* @param {number} part
|
|
1074
|
+
* @returns {string}
|
|
1075
|
+
*/
|
|
1076
|
+
wikiRead(path, part) {
|
|
1077
|
+
let deferred3_0;
|
|
1078
|
+
let deferred3_1;
|
|
1079
|
+
try {
|
|
1080
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1081
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1082
|
+
const ret = wasm.wasmruntime_wikiRead(this.__wbg_ptr, ptr0, len0, part);
|
|
1083
|
+
var ptr2 = ret[0];
|
|
1084
|
+
var len2 = ret[1];
|
|
1085
|
+
if (ret[3]) {
|
|
1086
|
+
ptr2 = 0;
|
|
1087
|
+
len2 = 0;
|
|
1088
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1089
|
+
}
|
|
1090
|
+
deferred3_0 = ptr2;
|
|
1091
|
+
deferred3_1 = len2;
|
|
1092
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1093
|
+
}
|
|
1094
|
+
finally {
|
|
1095
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
if (Symbol.dispose)
|
|
1100
|
+
WasmRuntime.prototype[Symbol.dispose] = WasmRuntime.prototype.free;
|
|
1101
|
+
const WasmSinkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1102
|
+
? { register: () => { }, unregister: () => { } }
|
|
1103
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsink_free(ptr >>> 0, 1));
|
|
1104
|
+
/**
|
|
1105
|
+
* Where the host delivers a response: `head` once, then `chunk` per read.
|
|
1106
|
+
*/
|
|
1107
|
+
export class WasmSink {
|
|
1108
|
+
static __wrap(ptr) {
|
|
1109
|
+
ptr = ptr >>> 0;
|
|
1110
|
+
const obj = Object.create(WasmSink.prototype);
|
|
1111
|
+
obj.__wbg_ptr = ptr;
|
|
1112
|
+
WasmSinkFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1113
|
+
return obj;
|
|
1114
|
+
}
|
|
1115
|
+
__destroy_into_raw() {
|
|
1116
|
+
const ptr = this.__wbg_ptr;
|
|
1117
|
+
this.__wbg_ptr = 0;
|
|
1118
|
+
WasmSinkFinalization.unregister(this);
|
|
1119
|
+
return ptr;
|
|
1120
|
+
}
|
|
1121
|
+
free() {
|
|
1122
|
+
const ptr = this.__destroy_into_raw();
|
|
1123
|
+
wasm.__wbg_wasmsink_free(ptr, 0);
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* `headers`: `[name, value]` pairs.
|
|
1127
|
+
* @param {number} status
|
|
1128
|
+
* @param {Array<any>} headers
|
|
1129
|
+
*/
|
|
1130
|
+
head(status, headers) {
|
|
1131
|
+
wasm.wasmsink_head(this.__wbg_ptr, status, headers);
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* One read of the body. False: the Runtime wants no more; stop reading.
|
|
1135
|
+
* @param {Uint8Array} bytes
|
|
1136
|
+
* @returns {boolean}
|
|
1137
|
+
*/
|
|
1138
|
+
chunk(bytes) {
|
|
1139
|
+
const ret = wasm.wasmsink_chunk(this.__wbg_ptr, bytes);
|
|
1140
|
+
return ret !== 0;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
if (Symbol.dispose)
|
|
1144
|
+
WasmSink.prototype[Symbol.dispose] = WasmSink.prototype.free;
|
|
1145
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
1146
|
+
async function __wbg_load(module, imports) {
|
|
1147
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1148
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1149
|
+
try {
|
|
1150
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1151
|
+
}
|
|
1152
|
+
catch (e) {
|
|
1153
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
1154
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1155
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
throw e;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
const bytes = await module.arrayBuffer();
|
|
1163
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1164
|
+
}
|
|
1165
|
+
else {
|
|
1166
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1167
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1168
|
+
return { instance, module };
|
|
1169
|
+
}
|
|
1170
|
+
else {
|
|
1171
|
+
return instance;
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
function __wbg_get_imports() {
|
|
1176
|
+
const imports = {};
|
|
1177
|
+
imports.wbg = {};
|
|
1178
|
+
imports.wbg.__wbg_apply_dc50eb58583d2a57 = function () {
|
|
1179
|
+
return handleError(function (arg0, arg1, arg2) {
|
|
1180
|
+
const ret = arg0.apply(arg1, arg2);
|
|
1181
|
+
return ret;
|
|
1182
|
+
}, arguments);
|
|
1183
|
+
};
|
|
1184
|
+
imports.wbg.__wbg_call_13410aac570ffff7 = function () {
|
|
1185
|
+
return handleError(function (arg0, arg1) {
|
|
1186
|
+
const ret = arg0.call(arg1);
|
|
1187
|
+
return ret;
|
|
1188
|
+
}, arguments);
|
|
1189
|
+
};
|
|
1190
|
+
imports.wbg.__wbg_call_641db1bb5db5a579 = function () {
|
|
1191
|
+
return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1192
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1193
|
+
return ret;
|
|
1194
|
+
}, arguments);
|
|
1195
|
+
};
|
|
1196
|
+
imports.wbg.__wbg_call_a5400b25a865cfd8 = function () {
|
|
1197
|
+
return handleError(function (arg0, arg1, arg2) {
|
|
1198
|
+
const ret = arg0.call(arg1, arg2);
|
|
1199
|
+
return ret;
|
|
1200
|
+
}, arguments);
|
|
1201
|
+
};
|
|
1202
|
+
imports.wbg.__wbg_from_88bc52ce20ba6318 = function (arg0) {
|
|
1203
|
+
const ret = Array.from(arg0);
|
|
1204
|
+
return ret;
|
|
1205
|
+
};
|
|
1206
|
+
imports.wbg.__wbg_get_0da715ceaecea5c8 = function (arg0, arg1) {
|
|
1207
|
+
const ret = arg0[arg1 >>> 0];
|
|
1208
|
+
return ret;
|
|
1209
|
+
};
|
|
1210
|
+
imports.wbg.__wbg_get_458e874b43b18b25 = function () {
|
|
1211
|
+
return handleError(function (arg0, arg1) {
|
|
1212
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1213
|
+
return ret;
|
|
1214
|
+
}, arguments);
|
|
1215
|
+
};
|
|
1216
|
+
imports.wbg.__wbg_http_36f5cf45b54f9a8a = function (arg0, arg1, arg2, arg3) {
|
|
1217
|
+
const ret = arg0.http(arg1, WasmSink.__wrap(arg2), WasmCancel.__wrap(arg3));
|
|
1218
|
+
return ret;
|
|
1219
|
+
};
|
|
1220
|
+
imports.wbg.__wbg_instanceof_Promise_3ec9e849bf41bdb6 = function (arg0) {
|
|
1221
|
+
let result;
|
|
1222
|
+
try {
|
|
1223
|
+
result = arg0 instanceof Promise;
|
|
1224
|
+
}
|
|
1225
|
+
catch (_) {
|
|
1226
|
+
result = false;
|
|
1227
|
+
}
|
|
1228
|
+
const ret = result;
|
|
1229
|
+
return ret;
|
|
1230
|
+
};
|
|
1231
|
+
imports.wbg.__wbg_length_186546c51cd61acd = function (arg0) {
|
|
1232
|
+
const ret = arg0.length;
|
|
1233
|
+
return ret;
|
|
1234
|
+
};
|
|
1235
|
+
imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function (arg0) {
|
|
1236
|
+
const ret = arg0.length;
|
|
1237
|
+
return ret;
|
|
1238
|
+
};
|
|
1239
|
+
imports.wbg.__wbg_lock_ffb73b1af2e996ca = function (arg0, arg1, arg2) {
|
|
1240
|
+
const ret = arg0.lock(getStringFromWasm0(arg1, arg2));
|
|
1241
|
+
return ret;
|
|
1242
|
+
};
|
|
1243
|
+
imports.wbg.__wbg_new_19c25a3f2fa63a02 = function () {
|
|
1244
|
+
const ret = new Object();
|
|
1245
|
+
return ret;
|
|
1246
|
+
};
|
|
1247
|
+
imports.wbg.__wbg_new_1f3a344cf3123716 = function () {
|
|
1248
|
+
const ret = new Array();
|
|
1249
|
+
return ret;
|
|
1250
|
+
};
|
|
1251
|
+
imports.wbg.__wbg_new_2e3c58a15f39f5f9 = function (arg0, arg1) {
|
|
1252
|
+
try {
|
|
1253
|
+
var state0 = { a: arg0, b: arg1 };
|
|
1254
|
+
var cb0 = (arg0, arg1) => {
|
|
1255
|
+
const a = state0.a;
|
|
1256
|
+
state0.a = 0;
|
|
1257
|
+
try {
|
|
1258
|
+
return __wbg_adapter_135(a, state0.b, arg0, arg1);
|
|
1259
|
+
}
|
|
1260
|
+
finally {
|
|
1261
|
+
state0.a = a;
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
const ret = new Promise(cb0);
|
|
1265
|
+
return ret;
|
|
1266
|
+
}
|
|
1267
|
+
finally {
|
|
1268
|
+
state0.a = state0.b = 0;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
imports.wbg.__wbg_newnoargs_254190557c45b4ec = function (arg0, arg1) {
|
|
1272
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1273
|
+
return ret;
|
|
1274
|
+
};
|
|
1275
|
+
imports.wbg.__wbg_nowMs_9aa4f6c3c6b72511 = function (arg0) {
|
|
1276
|
+
const ret = arg0.nowMs();
|
|
1277
|
+
return ret;
|
|
1278
|
+
};
|
|
1279
|
+
imports.wbg.__wbg_of_d0e190785e1ebbb6 = function (arg0, arg1) {
|
|
1280
|
+
const ret = Array.of(arg0, arg1);
|
|
1281
|
+
return ret;
|
|
1282
|
+
};
|
|
1283
|
+
imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function (arg0, arg1, arg2) {
|
|
1284
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1285
|
+
};
|
|
1286
|
+
imports.wbg.__wbg_push_330b2eb93e4e1212 = function (arg0, arg1) {
|
|
1287
|
+
const ret = arg0.push(arg1);
|
|
1288
|
+
return ret;
|
|
1289
|
+
};
|
|
1290
|
+
imports.wbg.__wbg_queueMicrotask_25d0739ac89e8c88 = function (arg0) {
|
|
1291
|
+
queueMicrotask(arg0);
|
|
1292
|
+
};
|
|
1293
|
+
imports.wbg.__wbg_queueMicrotask_4488407636f5bf24 = function (arg0) {
|
|
1294
|
+
const ret = arg0.queueMicrotask;
|
|
1295
|
+
return ret;
|
|
1296
|
+
};
|
|
1297
|
+
imports.wbg.__wbg_random_df7fdc2e3d8ae9d8 = function (arg0, arg1) {
|
|
1298
|
+
const ret = arg1.random();
|
|
1299
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1300
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1301
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1302
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1303
|
+
};
|
|
1304
|
+
imports.wbg.__wbg_readSecret_743a2ddb0168daf4 = function (arg0, arg1, arg2) {
|
|
1305
|
+
const ret = arg0.readSecret(getStringFromWasm0(arg1, arg2));
|
|
1306
|
+
return ret;
|
|
1307
|
+
};
|
|
1308
|
+
imports.wbg.__wbg_read_132d87080ce45fd5 = function (arg0, arg1, arg2) {
|
|
1309
|
+
const ret = arg0.read(getStringFromWasm0(arg1, arg2));
|
|
1310
|
+
return ret;
|
|
1311
|
+
};
|
|
1312
|
+
imports.wbg.__wbg_removeSecret_59aad54cf2b3f780 = function (arg0, arg1, arg2) {
|
|
1313
|
+
const ret = arg0.removeSecret(getStringFromWasm0(arg1, arg2));
|
|
1314
|
+
return ret;
|
|
1315
|
+
};
|
|
1316
|
+
imports.wbg.__wbg_remove_09411f236af05924 = function (arg0, arg1, arg2) {
|
|
1317
|
+
const ret = arg0.remove(getStringFromWasm0(arg1, arg2));
|
|
1318
|
+
return ret;
|
|
1319
|
+
};
|
|
1320
|
+
imports.wbg.__wbg_resolve_4055c623acdd6a1b = function (arg0) {
|
|
1321
|
+
const ret = Promise.resolve(arg0);
|
|
1322
|
+
return ret;
|
|
1323
|
+
};
|
|
1324
|
+
imports.wbg.__wbg_set_453345bcda80b89a = function () {
|
|
1325
|
+
return handleError(function (arg0, arg1, arg2) {
|
|
1326
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1327
|
+
return ret;
|
|
1328
|
+
}, arguments);
|
|
1329
|
+
};
|
|
1330
|
+
imports.wbg.__wbg_sleep_9b720f4c69a09fe3 = function (arg0, arg1) {
|
|
1331
|
+
const ret = arg0.sleep(arg1);
|
|
1332
|
+
return ret;
|
|
1333
|
+
};
|
|
1334
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12 = function () {
|
|
1335
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1336
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1337
|
+
};
|
|
1338
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184 = function () {
|
|
1339
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1340
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1341
|
+
};
|
|
1342
|
+
imports.wbg.__wbg_static_accessor_SELF_995b214ae681ff99 = function () {
|
|
1343
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1344
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1345
|
+
};
|
|
1346
|
+
imports.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea = function () {
|
|
1347
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1348
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1349
|
+
};
|
|
1350
|
+
imports.wbg.__wbg_storeIdentity_ca548355c80bd820 = function (arg0, arg1) {
|
|
1351
|
+
const ret = arg1.storeIdentity();
|
|
1352
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1353
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1354
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1355
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1356
|
+
};
|
|
1357
|
+
imports.wbg.__wbg_stringify_b98c93d0a190446a = function () {
|
|
1358
|
+
return handleError(function (arg0) {
|
|
1359
|
+
const ret = JSON.stringify(arg0);
|
|
1360
|
+
return ret;
|
|
1361
|
+
}, arguments);
|
|
1362
|
+
};
|
|
1363
|
+
imports.wbg.__wbg_then_b33a773d723afa3e = function (arg0, arg1, arg2) {
|
|
1364
|
+
const ret = arg0.then(arg1, arg2);
|
|
1365
|
+
return ret;
|
|
1366
|
+
};
|
|
1367
|
+
imports.wbg.__wbg_then_e22500defe16819f = function (arg0, arg1) {
|
|
1368
|
+
const ret = arg0.then(arg1);
|
|
1369
|
+
return ret;
|
|
1370
|
+
};
|
|
1371
|
+
imports.wbg.__wbg_tool_e17f330fb8f92f1f = function (arg0, arg1, arg2, arg3) {
|
|
1372
|
+
let deferred0_0;
|
|
1373
|
+
let deferred0_1;
|
|
1374
|
+
try {
|
|
1375
|
+
deferred0_0 = arg1;
|
|
1376
|
+
deferred0_1 = arg2;
|
|
1377
|
+
const ret = arg0.tool(getStringFromWasm0(arg1, arg2), WasmCancel.__wrap(arg3));
|
|
1378
|
+
return ret;
|
|
1379
|
+
}
|
|
1380
|
+
finally {
|
|
1381
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
imports.wbg.__wbg_unlock_9cd7d86380527acf = function (arg0, arg1, arg2) {
|
|
1385
|
+
const ret = arg0.unlock(getStringFromWasm0(arg1, arg2));
|
|
1386
|
+
return ret;
|
|
1387
|
+
};
|
|
1388
|
+
imports.wbg.__wbg_utcOffsetMinutes_e75cc28f0dd11b37 = function (arg0, arg1) {
|
|
1389
|
+
const ret = arg0.utcOffsetMinutes(arg1);
|
|
1390
|
+
return ret;
|
|
1391
|
+
};
|
|
1392
|
+
imports.wbg.__wbg_wake_d81543b22f9a2d0d = function (arg0, arg1) {
|
|
1393
|
+
arg0.wake(arg1);
|
|
1394
|
+
};
|
|
1395
|
+
imports.wbg.__wbg_wasmproject_new = function (arg0) {
|
|
1396
|
+
const ret = WasmProject.__wrap(arg0);
|
|
1397
|
+
return ret;
|
|
1398
|
+
};
|
|
1399
|
+
imports.wbg.__wbg_wasmruntime_new = function (arg0) {
|
|
1400
|
+
const ret = WasmRuntime.__wrap(arg0);
|
|
1401
|
+
return ret;
|
|
1402
|
+
};
|
|
1403
|
+
imports.wbg.__wbg_wbindgencbdrop_eb10308566512b88 = function (arg0) {
|
|
1404
|
+
const obj = arg0.original;
|
|
1405
|
+
if (obj.cnt-- == 1) {
|
|
1406
|
+
obj.a = 0;
|
|
1407
|
+
return true;
|
|
1408
|
+
}
|
|
1409
|
+
const ret = false;
|
|
1410
|
+
return ret;
|
|
1411
|
+
};
|
|
1412
|
+
imports.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function (arg0) {
|
|
1413
|
+
const ret = typeof (arg0) === 'function';
|
|
1414
|
+
return ret;
|
|
1415
|
+
};
|
|
1416
|
+
imports.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5 = function (arg0) {
|
|
1417
|
+
const ret = arg0 === undefined;
|
|
1418
|
+
return ret;
|
|
1419
|
+
};
|
|
1420
|
+
imports.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f = function (arg0, arg1) {
|
|
1421
|
+
const obj = arg1;
|
|
1422
|
+
const ret = typeof (obj) === 'string' ? obj : undefined;
|
|
1423
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1424
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1425
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1426
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1427
|
+
};
|
|
1428
|
+
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function (arg0, arg1) {
|
|
1429
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1430
|
+
};
|
|
1431
|
+
imports.wbg.__wbg_writeSecret_680e5076c2c6ce22 = function (arg0, arg1, arg2, arg3, arg4) {
|
|
1432
|
+
let deferred0_0;
|
|
1433
|
+
let deferred0_1;
|
|
1434
|
+
try {
|
|
1435
|
+
deferred0_0 = arg3;
|
|
1436
|
+
deferred0_1 = arg4;
|
|
1437
|
+
const ret = arg0.writeSecret(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1438
|
+
return ret;
|
|
1439
|
+
}
|
|
1440
|
+
finally {
|
|
1441
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
imports.wbg.__wbg_write_41d57f1d7256755f = function (arg0, arg1, arg2, arg3, arg4) {
|
|
1445
|
+
let deferred0_0;
|
|
1446
|
+
let deferred0_1;
|
|
1447
|
+
try {
|
|
1448
|
+
deferred0_0 = arg3;
|
|
1449
|
+
deferred0_1 = arg4;
|
|
1450
|
+
const ret = arg0.write(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1451
|
+
return ret;
|
|
1452
|
+
}
|
|
1453
|
+
finally {
|
|
1454
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
1458
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1459
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1460
|
+
return ret;
|
|
1461
|
+
};
|
|
1462
|
+
imports.wbg.__wbindgen_cast_9bf690dfafdef3b5 = function (arg0, arg1) {
|
|
1463
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 215, function: Function { arguments: [Externref], shim_idx: 216, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1464
|
+
const ret = makeMutClosure(arg0, arg1, 215, __wbg_adapter_10);
|
|
1465
|
+
return ret;
|
|
1466
|
+
};
|
|
1467
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
|
|
1468
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1469
|
+
const ret = arg0;
|
|
1470
|
+
return ret;
|
|
1471
|
+
};
|
|
1472
|
+
imports.wbg.__wbindgen_init_externref_table = function () {
|
|
1473
|
+
const table = wasm.__wbindgen_export_2;
|
|
1474
|
+
const offset = table.grow(4);
|
|
1475
|
+
table.set(0, undefined);
|
|
1476
|
+
table.set(offset + 0, undefined);
|
|
1477
|
+
table.set(offset + 1, null);
|
|
1478
|
+
table.set(offset + 2, true);
|
|
1479
|
+
table.set(offset + 3, false);
|
|
1480
|
+
;
|
|
1481
|
+
};
|
|
1482
|
+
return imports;
|
|
1483
|
+
}
|
|
1484
|
+
function __wbg_init_memory(imports, memory) {
|
|
1485
|
+
}
|
|
1486
|
+
function __wbg_finalize_init(instance, module) {
|
|
1487
|
+
wasm = instance.exports;
|
|
1488
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
1489
|
+
cachedDataViewMemory0 = null;
|
|
1490
|
+
cachedUint8ArrayMemory0 = null;
|
|
1491
|
+
wasm.__wbindgen_start();
|
|
1492
|
+
return wasm;
|
|
1493
|
+
}
|
|
1494
|
+
function initSync(module) {
|
|
1495
|
+
if (wasm !== undefined)
|
|
1496
|
+
return wasm;
|
|
1497
|
+
if (typeof module !== 'undefined') {
|
|
1498
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1499
|
+
({ module } = module);
|
|
1500
|
+
}
|
|
1501
|
+
else {
|
|
1502
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead');
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
const imports = __wbg_get_imports();
|
|
1506
|
+
__wbg_init_memory(imports);
|
|
1507
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1508
|
+
module = new WebAssembly.Module(module);
|
|
1509
|
+
}
|
|
1510
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1511
|
+
return __wbg_finalize_init(instance, module);
|
|
1512
|
+
}
|
|
1513
|
+
async function __wbg_init(module_or_path) {
|
|
1514
|
+
if (wasm !== undefined)
|
|
1515
|
+
return wasm;
|
|
1516
|
+
if (typeof module_or_path !== 'undefined') {
|
|
1517
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1518
|
+
({ module_or_path } = module_or_path);
|
|
1519
|
+
}
|
|
1520
|
+
else {
|
|
1521
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead');
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
const imports = __wbg_get_imports();
|
|
1525
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1526
|
+
module_or_path = fetch(module_or_path);
|
|
1527
|
+
}
|
|
1528
|
+
__wbg_init_memory(imports);
|
|
1529
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1530
|
+
return __wbg_finalize_init(instance, module);
|
|
1531
|
+
}
|
|
1532
|
+
export { initSync };
|
|
1533
|
+
export default __wbg_init;
|