@elizaos/rust 2.0.0-alpha.10 → 2.0.0-alpha.105
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/package.json +4 -4
- package/pkg/node/LICENSE +0 -26
- package/pkg/node/README.md +0 -151
- package/pkg/node/elizaos.d.ts +0 -304
- package/pkg/node/elizaos.js +0 -1602
- package/pkg/node/elizaos_bg.wasm +0 -0
- package/pkg/node/elizaos_bg.wasm.d.ts +0 -82
- package/pkg/node/package.json +0 -26
- package/pkg/web/LICENSE +0 -26
- package/pkg/web/README.md +0 -151
- package/pkg/web/elizaos.d.ts +0 -411
- package/pkg/web/elizaos.js +0 -1648
- package/pkg/web/elizaos_bg.wasm +0 -0
- package/pkg/web/elizaos_bg.wasm.d.ts +0 -82
- package/pkg/web/package.json +0 -30
package/pkg/node/elizaos.js
DELETED
|
@@ -1,1602 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
let imports = {};
|
|
3
|
-
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
|
-
|
|
5
|
-
function addToExternrefTable0(obj) {
|
|
6
|
-
const idx = wasm.__externref_table_alloc();
|
|
7
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
8
|
-
return idx;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _assertClass(instance, klass) {
|
|
12
|
-
if (!(instance instanceof klass)) {
|
|
13
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
18
|
-
? { register: () => {}, unregister: () => {} }
|
|
19
|
-
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
20
|
-
|
|
21
|
-
function debugString(val) {
|
|
22
|
-
// primitive types
|
|
23
|
-
const type = typeof val;
|
|
24
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
25
|
-
return `${val}`;
|
|
26
|
-
}
|
|
27
|
-
if (type == 'string') {
|
|
28
|
-
return `"${val}"`;
|
|
29
|
-
}
|
|
30
|
-
if (type == 'symbol') {
|
|
31
|
-
const description = val.description;
|
|
32
|
-
if (description == null) {
|
|
33
|
-
return 'Symbol';
|
|
34
|
-
} else {
|
|
35
|
-
return `Symbol(${description})`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (type == 'function') {
|
|
39
|
-
const name = val.name;
|
|
40
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
41
|
-
return `Function(${name})`;
|
|
42
|
-
} else {
|
|
43
|
-
return 'Function';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// objects
|
|
47
|
-
if (Array.isArray(val)) {
|
|
48
|
-
const length = val.length;
|
|
49
|
-
let debug = '[';
|
|
50
|
-
if (length > 0) {
|
|
51
|
-
debug += debugString(val[0]);
|
|
52
|
-
}
|
|
53
|
-
for(let i = 1; i < length; i++) {
|
|
54
|
-
debug += ', ' + debugString(val[i]);
|
|
55
|
-
}
|
|
56
|
-
debug += ']';
|
|
57
|
-
return debug;
|
|
58
|
-
}
|
|
59
|
-
// Test for built-in
|
|
60
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
61
|
-
let className;
|
|
62
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
63
|
-
className = builtInMatches[1];
|
|
64
|
-
} else {
|
|
65
|
-
// Failed to match the standard '[object ClassName]'
|
|
66
|
-
return toString.call(val);
|
|
67
|
-
}
|
|
68
|
-
if (className == 'Object') {
|
|
69
|
-
// we're a user defined class or Object
|
|
70
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
71
|
-
// easier than looping through ownProperties of `val`.
|
|
72
|
-
try {
|
|
73
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
74
|
-
} catch (_) {
|
|
75
|
-
return 'Object';
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// errors
|
|
79
|
-
if (val instanceof Error) {
|
|
80
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
81
|
-
}
|
|
82
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
83
|
-
return className;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
87
|
-
ptr = ptr >>> 0;
|
|
88
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
let cachedDataViewMemory0 = null;
|
|
92
|
-
function getDataViewMemory0() {
|
|
93
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
94
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
95
|
-
}
|
|
96
|
-
return cachedDataViewMemory0;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function getStringFromWasm0(ptr, len) {
|
|
100
|
-
ptr = ptr >>> 0;
|
|
101
|
-
return decodeText(ptr, len);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
let cachedUint8ArrayMemory0 = null;
|
|
105
|
-
function getUint8ArrayMemory0() {
|
|
106
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
107
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
108
|
-
}
|
|
109
|
-
return cachedUint8ArrayMemory0;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function handleError(f, args) {
|
|
113
|
-
try {
|
|
114
|
-
return f.apply(this, args);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
const idx = addToExternrefTable0(e);
|
|
117
|
-
wasm.__wbindgen_exn_store(idx);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function isLikeNone(x) {
|
|
122
|
-
return x === undefined || x === null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
126
|
-
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
127
|
-
const real = (...args) => {
|
|
128
|
-
|
|
129
|
-
// First up with a closure we increment the internal reference
|
|
130
|
-
// count. This ensures that the Rust closure environment won't
|
|
131
|
-
// be deallocated while we're invoking it.
|
|
132
|
-
state.cnt++;
|
|
133
|
-
const a = state.a;
|
|
134
|
-
state.a = 0;
|
|
135
|
-
try {
|
|
136
|
-
return f(a, state.b, ...args);
|
|
137
|
-
} finally {
|
|
138
|
-
state.a = a;
|
|
139
|
-
real._wbg_cb_unref();
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
real._wbg_cb_unref = () => {
|
|
143
|
-
if (--state.cnt === 0) {
|
|
144
|
-
state.dtor(state.a, state.b);
|
|
145
|
-
state.a = 0;
|
|
146
|
-
CLOSURE_DTORS.unregister(state);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
CLOSURE_DTORS.register(real, state, state);
|
|
150
|
-
return real;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
154
|
-
if (realloc === undefined) {
|
|
155
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
156
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
157
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
158
|
-
WASM_VECTOR_LEN = buf.length;
|
|
159
|
-
return ptr;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
let len = arg.length;
|
|
163
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
164
|
-
|
|
165
|
-
const mem = getUint8ArrayMemory0();
|
|
166
|
-
|
|
167
|
-
let offset = 0;
|
|
168
|
-
|
|
169
|
-
for (; offset < len; offset++) {
|
|
170
|
-
const code = arg.charCodeAt(offset);
|
|
171
|
-
if (code > 0x7F) break;
|
|
172
|
-
mem[ptr + offset] = code;
|
|
173
|
-
}
|
|
174
|
-
if (offset !== len) {
|
|
175
|
-
if (offset !== 0) {
|
|
176
|
-
arg = arg.slice(offset);
|
|
177
|
-
}
|
|
178
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
179
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
180
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
181
|
-
|
|
182
|
-
offset += ret.written;
|
|
183
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
WASM_VECTOR_LEN = offset;
|
|
187
|
-
return ptr;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function takeFromExternrefTable0(idx) {
|
|
191
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
192
|
-
wasm.__externref_table_dealloc(idx);
|
|
193
|
-
return value;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
197
|
-
cachedTextDecoder.decode();
|
|
198
|
-
function decodeText(ptr, len) {
|
|
199
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const cachedTextEncoder = new TextEncoder();
|
|
203
|
-
|
|
204
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
205
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
206
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
207
|
-
view.set(buf);
|
|
208
|
-
return {
|
|
209
|
-
read: arg.length,
|
|
210
|
-
written: buf.length
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
let WASM_VECTOR_LEN = 0;
|
|
216
|
-
|
|
217
|
-
function wasm_bindgen__convert__closures_____invoke__he8569e00d9589556(arg0, arg1, arg2) {
|
|
218
|
-
wasm.wasm_bindgen__convert__closures_____invoke__he8569e00d9589556(arg0, arg1, arg2);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function wasm_bindgen__convert__closures_____invoke__h04ef24186ff3529f(arg0, arg1, arg2, arg3) {
|
|
222
|
-
wasm.wasm_bindgen__convert__closures_____invoke__h04ef24186ff3529f(arg0, arg1, arg2, arg3);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const JsModelHandlerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
226
|
-
? { register: () => {}, unregister: () => {} }
|
|
227
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_jsmodelhandler_free(ptr >>> 0, 1));
|
|
228
|
-
|
|
229
|
-
const WasmAgentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
230
|
-
? { register: () => {}, unregister: () => {} }
|
|
231
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmagent_free(ptr >>> 0, 1));
|
|
232
|
-
|
|
233
|
-
const WasmAgentRuntimeFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
234
|
-
? { register: () => {}, unregister: () => {} }
|
|
235
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmagentruntime_free(ptr >>> 0, 1));
|
|
236
|
-
|
|
237
|
-
const WasmCharacterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
238
|
-
? { register: () => {}, unregister: () => {} }
|
|
239
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmcharacter_free(ptr >>> 0, 1));
|
|
240
|
-
|
|
241
|
-
const WasmEntityFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
242
|
-
? { register: () => {}, unregister: () => {} }
|
|
243
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmentity_free(ptr >>> 0, 1));
|
|
244
|
-
|
|
245
|
-
const WasmErrorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
246
|
-
? { register: () => {}, unregister: () => {} }
|
|
247
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmerror_free(ptr >>> 0, 1));
|
|
248
|
-
|
|
249
|
-
const WasmMemoryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
250
|
-
? { register: () => {}, unregister: () => {} }
|
|
251
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmemory_free(ptr >>> 0, 1));
|
|
252
|
-
|
|
253
|
-
const WasmPluginFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
254
|
-
? { register: () => {}, unregister: () => {} }
|
|
255
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmplugin_free(ptr >>> 0, 1));
|
|
256
|
-
|
|
257
|
-
const WasmRoomFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
258
|
-
? { register: () => {}, unregister: () => {} }
|
|
259
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmroom_free(ptr >>> 0, 1));
|
|
260
|
-
|
|
261
|
-
const WasmUUIDFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
262
|
-
? { register: () => {}, unregister: () => {} }
|
|
263
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmuuid_free(ptr >>> 0, 1));
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* A shim that wraps a JavaScript object implementing a model handler.
|
|
267
|
-
*
|
|
268
|
-
* The JavaScript object must have a `handle(params: string): Promise<string>` method
|
|
269
|
-
* that returns the generated text response as a string.
|
|
270
|
-
*/
|
|
271
|
-
class JsModelHandler {
|
|
272
|
-
__destroy_into_raw() {
|
|
273
|
-
const ptr = this.__wbg_ptr;
|
|
274
|
-
this.__wbg_ptr = 0;
|
|
275
|
-
JsModelHandlerFinalization.unregister(this);
|
|
276
|
-
return ptr;
|
|
277
|
-
}
|
|
278
|
-
free() {
|
|
279
|
-
const ptr = this.__destroy_into_raw();
|
|
280
|
-
wasm.__wbg_jsmodelhandler_free(ptr, 0);
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Creates a new JsModelHandler from a JavaScript object.
|
|
284
|
-
* @param {object} js_object
|
|
285
|
-
*/
|
|
286
|
-
constructor(js_object) {
|
|
287
|
-
const ret = wasm.jsmodelhandler_new(js_object);
|
|
288
|
-
if (ret[2]) {
|
|
289
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
290
|
-
}
|
|
291
|
-
this.__wbg_ptr = ret[0] >>> 0;
|
|
292
|
-
JsModelHandlerFinalization.register(this, this.__wbg_ptr, this);
|
|
293
|
-
return this;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Calls the handler with the given parameters.
|
|
297
|
-
* @param {string} params_json
|
|
298
|
-
* @returns {Promise<any>}
|
|
299
|
-
*/
|
|
300
|
-
handle(params_json) {
|
|
301
|
-
const ptr0 = passStringToWasm0(params_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
302
|
-
const len0 = WASM_VECTOR_LEN;
|
|
303
|
-
const ret = wasm.jsmodelhandler_handle(this.__wbg_ptr, ptr0, len0);
|
|
304
|
-
if (ret[2]) {
|
|
305
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
306
|
-
}
|
|
307
|
-
return takeFromExternrefTable0(ret[0]);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Returns the underlying JavaScript object.
|
|
311
|
-
* @returns {object}
|
|
312
|
-
*/
|
|
313
|
-
get jsObject() {
|
|
314
|
-
const ret = wasm.jsmodelhandler_jsObject(this.__wbg_ptr);
|
|
315
|
-
return ret;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
if (Symbol.dispose) JsModelHandler.prototype[Symbol.dispose] = JsModelHandler.prototype.free;
|
|
319
|
-
exports.JsModelHandler = JsModelHandler;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* WASM-compatible Agent wrapper
|
|
323
|
-
*/
|
|
324
|
-
class WasmAgent {
|
|
325
|
-
static __wrap(ptr) {
|
|
326
|
-
ptr = ptr >>> 0;
|
|
327
|
-
const obj = Object.create(WasmAgent.prototype);
|
|
328
|
-
obj.__wbg_ptr = ptr;
|
|
329
|
-
WasmAgentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
330
|
-
return obj;
|
|
331
|
-
}
|
|
332
|
-
__destroy_into_raw() {
|
|
333
|
-
const ptr = this.__wbg_ptr;
|
|
334
|
-
this.__wbg_ptr = 0;
|
|
335
|
-
WasmAgentFinalization.unregister(this);
|
|
336
|
-
return ptr;
|
|
337
|
-
}
|
|
338
|
-
free() {
|
|
339
|
-
const ptr = this.__destroy_into_raw();
|
|
340
|
-
wasm.__wbg_wasmagent_free(ptr, 0);
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Get the agent ID
|
|
344
|
-
* @returns {string | undefined}
|
|
345
|
-
*/
|
|
346
|
-
get id() {
|
|
347
|
-
const ret = wasm.wasmagent_id(this.__wbg_ptr);
|
|
348
|
-
let v1;
|
|
349
|
-
if (ret[0] !== 0) {
|
|
350
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
351
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
352
|
-
}
|
|
353
|
-
return v1;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Get the agent name
|
|
357
|
-
* @returns {string}
|
|
358
|
-
*/
|
|
359
|
-
get name() {
|
|
360
|
-
let deferred1_0;
|
|
361
|
-
let deferred1_1;
|
|
362
|
-
try {
|
|
363
|
-
const ret = wasm.wasmagent_name(this.__wbg_ptr);
|
|
364
|
-
deferred1_0 = ret[0];
|
|
365
|
-
deferred1_1 = ret[1];
|
|
366
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
367
|
-
} finally {
|
|
368
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Convert to JSON
|
|
373
|
-
* @returns {string}
|
|
374
|
-
*/
|
|
375
|
-
toJson() {
|
|
376
|
-
let deferred2_0;
|
|
377
|
-
let deferred2_1;
|
|
378
|
-
try {
|
|
379
|
-
const ret = wasm.wasmagent_toJson(this.__wbg_ptr);
|
|
380
|
-
var ptr1 = ret[0];
|
|
381
|
-
var len1 = ret[1];
|
|
382
|
-
if (ret[3]) {
|
|
383
|
-
ptr1 = 0; len1 = 0;
|
|
384
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
385
|
-
}
|
|
386
|
-
deferred2_0 = ptr1;
|
|
387
|
-
deferred2_1 = len1;
|
|
388
|
-
return getStringFromWasm0(ptr1, len1);
|
|
389
|
-
} finally {
|
|
390
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Create a new agent from JSON
|
|
395
|
-
* @param {string} json
|
|
396
|
-
* @returns {WasmAgent}
|
|
397
|
-
*/
|
|
398
|
-
static fromJson(json) {
|
|
399
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
400
|
-
const len0 = WASM_VECTOR_LEN;
|
|
401
|
-
const ret = wasm.wasmagent_fromJson(ptr0, len0);
|
|
402
|
-
if (ret[2]) {
|
|
403
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
404
|
-
}
|
|
405
|
-
return WasmAgent.__wrap(ret[0]);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
if (Symbol.dispose) WasmAgent.prototype[Symbol.dispose] = WasmAgent.prototype.free;
|
|
409
|
-
exports.WasmAgent = WasmAgent;
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* WASM-compatible AgentRuntime
|
|
413
|
-
*
|
|
414
|
-
* This is a standalone WASM runtime that doesn't depend on the native AgentRuntime.
|
|
415
|
-
* It provides basic message handling by delegating to JavaScript model handlers.
|
|
416
|
-
*/
|
|
417
|
-
class WasmAgentRuntime {
|
|
418
|
-
static __wrap(ptr) {
|
|
419
|
-
ptr = ptr >>> 0;
|
|
420
|
-
const obj = Object.create(WasmAgentRuntime.prototype);
|
|
421
|
-
obj.__wbg_ptr = ptr;
|
|
422
|
-
WasmAgentRuntimeFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
423
|
-
return obj;
|
|
424
|
-
}
|
|
425
|
-
__destroy_into_raw() {
|
|
426
|
-
const ptr = this.__wbg_ptr;
|
|
427
|
-
this.__wbg_ptr = 0;
|
|
428
|
-
WasmAgentRuntimeFinalization.unregister(this);
|
|
429
|
-
return ptr;
|
|
430
|
-
}
|
|
431
|
-
free() {
|
|
432
|
-
const ptr = this.__destroy_into_raw();
|
|
433
|
-
wasm.__wbg_wasmagentruntime_free(ptr, 0);
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Initialize the runtime.
|
|
437
|
-
*/
|
|
438
|
-
initialize() {
|
|
439
|
-
const ret = wasm.wasmagentruntime_initialize(this.__wbg_ptr);
|
|
440
|
-
if (ret[1]) {
|
|
441
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Get the character name
|
|
446
|
-
* @returns {string}
|
|
447
|
-
*/
|
|
448
|
-
get characterName() {
|
|
449
|
-
let deferred1_0;
|
|
450
|
-
let deferred1_1;
|
|
451
|
-
try {
|
|
452
|
-
const ret = wasm.wasmagentruntime_characterName(this.__wbg_ptr);
|
|
453
|
-
deferred1_0 = ret[0];
|
|
454
|
-
deferred1_1 = ret[1];
|
|
455
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
456
|
-
} finally {
|
|
457
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Handle an incoming message
|
|
462
|
-
* @param {string} message_json
|
|
463
|
-
* @returns {Promise<any>}
|
|
464
|
-
*/
|
|
465
|
-
handleMessage(message_json) {
|
|
466
|
-
const ptr0 = passStringToWasm0(message_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
467
|
-
const len0 = WASM_VECTOR_LEN;
|
|
468
|
-
const ret = wasm.wasmagentruntime_handleMessage(this.__wbg_ptr, ptr0, len0);
|
|
469
|
-
return ret;
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Check if the runtime has been initialized.
|
|
473
|
-
* @returns {boolean}
|
|
474
|
-
*/
|
|
475
|
-
get isInitialized() {
|
|
476
|
-
const ret = wasm.wasmagentruntime_isInitialized(this.__wbg_ptr);
|
|
477
|
-
return ret !== 0;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Register a model handler using the shim.
|
|
481
|
-
* @param {string} model_type
|
|
482
|
-
* @param {JsModelHandler} handler
|
|
483
|
-
*/
|
|
484
|
-
registerModelHandler(model_type, handler) {
|
|
485
|
-
const ptr0 = passStringToWasm0(model_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
486
|
-
const len0 = WASM_VECTOR_LEN;
|
|
487
|
-
_assertClass(handler, JsModelHandler);
|
|
488
|
-
var ptr1 = handler.__destroy_into_raw();
|
|
489
|
-
wasm.wasmagentruntime_registerModelHandler(this.__wbg_ptr, ptr0, len0, ptr1);
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Register a model handler from a raw JavaScript function.
|
|
493
|
-
* @param {string} model_type
|
|
494
|
-
* @param {Function} handler
|
|
495
|
-
*/
|
|
496
|
-
registerModelHandlerFn(model_type, handler) {
|
|
497
|
-
const ptr0 = passStringToWasm0(model_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
498
|
-
const len0 = WASM_VECTOR_LEN;
|
|
499
|
-
const ret = wasm.wasmagentruntime_registerModelHandlerFn(this.__wbg_ptr, ptr0, len0, handler);
|
|
500
|
-
if (ret[1]) {
|
|
501
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Stop the runtime
|
|
506
|
-
*/
|
|
507
|
-
stop() {
|
|
508
|
-
wasm.wasmagentruntime_stop(this.__wbg_ptr);
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Create a new WasmAgentRuntime from a character JSON string
|
|
512
|
-
*
|
|
513
|
-
* This creates the runtime wrapper but does not initialize it.
|
|
514
|
-
* @param {string} character_json
|
|
515
|
-
* @returns {WasmAgentRuntime}
|
|
516
|
-
*/
|
|
517
|
-
static create(character_json) {
|
|
518
|
-
const ptr0 = passStringToWasm0(character_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
519
|
-
const len0 = WASM_VECTOR_LEN;
|
|
520
|
-
const ret = wasm.wasmagentruntime_create(ptr0, len0);
|
|
521
|
-
if (ret[2]) {
|
|
522
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
523
|
-
}
|
|
524
|
-
return WasmAgentRuntime.__wrap(ret[0]);
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* Get the agent ID
|
|
528
|
-
* @returns {string}
|
|
529
|
-
*/
|
|
530
|
-
get agentId() {
|
|
531
|
-
let deferred1_0;
|
|
532
|
-
let deferred1_1;
|
|
533
|
-
try {
|
|
534
|
-
const ret = wasm.wasmagentruntime_agentId(this.__wbg_ptr);
|
|
535
|
-
deferred1_0 = ret[0];
|
|
536
|
-
deferred1_1 = ret[1];
|
|
537
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
538
|
-
} finally {
|
|
539
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* Get the character as JSON
|
|
544
|
-
* @returns {string}
|
|
545
|
-
*/
|
|
546
|
-
get character() {
|
|
547
|
-
let deferred2_0;
|
|
548
|
-
let deferred2_1;
|
|
549
|
-
try {
|
|
550
|
-
const ret = wasm.wasmagentruntime_character(this.__wbg_ptr);
|
|
551
|
-
var ptr1 = ret[0];
|
|
552
|
-
var len1 = ret[1];
|
|
553
|
-
if (ret[3]) {
|
|
554
|
-
ptr1 = 0; len1 = 0;
|
|
555
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
556
|
-
}
|
|
557
|
-
deferred2_0 = ptr1;
|
|
558
|
-
deferred2_1 = len1;
|
|
559
|
-
return getStringFromWasm0(ptr1, len1);
|
|
560
|
-
} finally {
|
|
561
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
if (Symbol.dispose) WasmAgentRuntime.prototype[Symbol.dispose] = WasmAgentRuntime.prototype.free;
|
|
566
|
-
exports.WasmAgentRuntime = WasmAgentRuntime;
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* WASM-compatible Character wrapper
|
|
570
|
-
*/
|
|
571
|
-
class WasmCharacter {
|
|
572
|
-
static __wrap(ptr) {
|
|
573
|
-
ptr = ptr >>> 0;
|
|
574
|
-
const obj = Object.create(WasmCharacter.prototype);
|
|
575
|
-
obj.__wbg_ptr = ptr;
|
|
576
|
-
WasmCharacterFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
577
|
-
return obj;
|
|
578
|
-
}
|
|
579
|
-
__destroy_into_raw() {
|
|
580
|
-
const ptr = this.__wbg_ptr;
|
|
581
|
-
this.__wbg_ptr = 0;
|
|
582
|
-
WasmCharacterFinalization.unregister(this);
|
|
583
|
-
return ptr;
|
|
584
|
-
}
|
|
585
|
-
free() {
|
|
586
|
-
const ptr = this.__destroy_into_raw();
|
|
587
|
-
wasm.__wbg_wasmcharacter_free(ptr, 0);
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* Get the bio
|
|
591
|
-
* @returns {string}
|
|
592
|
-
*/
|
|
593
|
-
get bio() {
|
|
594
|
-
let deferred2_0;
|
|
595
|
-
let deferred2_1;
|
|
596
|
-
try {
|
|
597
|
-
const ret = wasm.wasmcharacter_bio(this.__wbg_ptr);
|
|
598
|
-
var ptr1 = ret[0];
|
|
599
|
-
var len1 = ret[1];
|
|
600
|
-
if (ret[3]) {
|
|
601
|
-
ptr1 = 0; len1 = 0;
|
|
602
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
603
|
-
}
|
|
604
|
-
deferred2_0 = ptr1;
|
|
605
|
-
deferred2_1 = len1;
|
|
606
|
-
return getStringFromWasm0(ptr1, len1);
|
|
607
|
-
} finally {
|
|
608
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
/**
|
|
612
|
-
* Get the character name
|
|
613
|
-
* @returns {string}
|
|
614
|
-
*/
|
|
615
|
-
get name() {
|
|
616
|
-
let deferred1_0;
|
|
617
|
-
let deferred1_1;
|
|
618
|
-
try {
|
|
619
|
-
const ret = wasm.wasmcharacter_name(this.__wbg_ptr);
|
|
620
|
-
deferred1_0 = ret[0];
|
|
621
|
-
deferred1_1 = ret[1];
|
|
622
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
623
|
-
} finally {
|
|
624
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Get the system prompt
|
|
629
|
-
* @returns {string | undefined}
|
|
630
|
-
*/
|
|
631
|
-
get system() {
|
|
632
|
-
const ret = wasm.wasmcharacter_system(this.__wbg_ptr);
|
|
633
|
-
let v1;
|
|
634
|
-
if (ret[0] !== 0) {
|
|
635
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
636
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
637
|
-
}
|
|
638
|
-
return v1;
|
|
639
|
-
}
|
|
640
|
-
/**
|
|
641
|
-
* Get topics as JSON array
|
|
642
|
-
* @returns {string}
|
|
643
|
-
*/
|
|
644
|
-
get topics() {
|
|
645
|
-
let deferred2_0;
|
|
646
|
-
let deferred2_1;
|
|
647
|
-
try {
|
|
648
|
-
const ret = wasm.wasmcharacter_topics(this.__wbg_ptr);
|
|
649
|
-
var ptr1 = ret[0];
|
|
650
|
-
var len1 = ret[1];
|
|
651
|
-
if (ret[3]) {
|
|
652
|
-
ptr1 = 0; len1 = 0;
|
|
653
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
654
|
-
}
|
|
655
|
-
deferred2_0 = ptr1;
|
|
656
|
-
deferred2_1 = len1;
|
|
657
|
-
return getStringFromWasm0(ptr1, len1);
|
|
658
|
-
} finally {
|
|
659
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Convert to JSON
|
|
664
|
-
* @returns {string}
|
|
665
|
-
*/
|
|
666
|
-
toJson() {
|
|
667
|
-
let deferred2_0;
|
|
668
|
-
let deferred2_1;
|
|
669
|
-
try {
|
|
670
|
-
const ret = wasm.wasmcharacter_toJson(this.__wbg_ptr);
|
|
671
|
-
var ptr1 = ret[0];
|
|
672
|
-
var len1 = ret[1];
|
|
673
|
-
if (ret[3]) {
|
|
674
|
-
ptr1 = 0; len1 = 0;
|
|
675
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
676
|
-
}
|
|
677
|
-
deferred2_0 = ptr1;
|
|
678
|
-
deferred2_1 = len1;
|
|
679
|
-
return getStringFromWasm0(ptr1, len1);
|
|
680
|
-
} finally {
|
|
681
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* Create a new character from JSON
|
|
686
|
-
* @param {string} json
|
|
687
|
-
* @returns {WasmCharacter}
|
|
688
|
-
*/
|
|
689
|
-
static fromJson(json) {
|
|
690
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
691
|
-
const len0 = WASM_VECTOR_LEN;
|
|
692
|
-
const ret = wasm.wasmcharacter_fromJson(ptr0, len0);
|
|
693
|
-
if (ret[2]) {
|
|
694
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
695
|
-
}
|
|
696
|
-
return WasmCharacter.__wrap(ret[0]);
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
if (Symbol.dispose) WasmCharacter.prototype[Symbol.dispose] = WasmCharacter.prototype.free;
|
|
700
|
-
exports.WasmCharacter = WasmCharacter;
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* WASM-compatible Entity wrapper
|
|
704
|
-
*/
|
|
705
|
-
class WasmEntity {
|
|
706
|
-
static __wrap(ptr) {
|
|
707
|
-
ptr = ptr >>> 0;
|
|
708
|
-
const obj = Object.create(WasmEntity.prototype);
|
|
709
|
-
obj.__wbg_ptr = ptr;
|
|
710
|
-
WasmEntityFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
711
|
-
return obj;
|
|
712
|
-
}
|
|
713
|
-
__destroy_into_raw() {
|
|
714
|
-
const ptr = this.__wbg_ptr;
|
|
715
|
-
this.__wbg_ptr = 0;
|
|
716
|
-
WasmEntityFinalization.unregister(this);
|
|
717
|
-
return ptr;
|
|
718
|
-
}
|
|
719
|
-
free() {
|
|
720
|
-
const ptr = this.__destroy_into_raw();
|
|
721
|
-
wasm.__wbg_wasmentity_free(ptr, 0);
|
|
722
|
-
}
|
|
723
|
-
/**
|
|
724
|
-
* Get the entity ID
|
|
725
|
-
* @returns {string | undefined}
|
|
726
|
-
*/
|
|
727
|
-
get id() {
|
|
728
|
-
const ret = wasm.wasmentity_id(this.__wbg_ptr);
|
|
729
|
-
let v1;
|
|
730
|
-
if (ret[0] !== 0) {
|
|
731
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
732
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
733
|
-
}
|
|
734
|
-
return v1;
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Convert to JSON
|
|
738
|
-
* @returns {string}
|
|
739
|
-
*/
|
|
740
|
-
toJson() {
|
|
741
|
-
let deferred2_0;
|
|
742
|
-
let deferred2_1;
|
|
743
|
-
try {
|
|
744
|
-
const ret = wasm.wasmentity_toJson(this.__wbg_ptr);
|
|
745
|
-
var ptr1 = ret[0];
|
|
746
|
-
var len1 = ret[1];
|
|
747
|
-
if (ret[3]) {
|
|
748
|
-
ptr1 = 0; len1 = 0;
|
|
749
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
750
|
-
}
|
|
751
|
-
deferred2_0 = ptr1;
|
|
752
|
-
deferred2_1 = len1;
|
|
753
|
-
return getStringFromWasm0(ptr1, len1);
|
|
754
|
-
} finally {
|
|
755
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Create a new entity from JSON
|
|
760
|
-
* @param {string} json
|
|
761
|
-
* @returns {WasmEntity}
|
|
762
|
-
*/
|
|
763
|
-
static fromJson(json) {
|
|
764
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
765
|
-
const len0 = WASM_VECTOR_LEN;
|
|
766
|
-
const ret = wasm.wasmentity_fromJson(ptr0, len0);
|
|
767
|
-
if (ret[2]) {
|
|
768
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
769
|
-
}
|
|
770
|
-
return WasmEntity.__wrap(ret[0]);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
if (Symbol.dispose) WasmEntity.prototype[Symbol.dispose] = WasmEntity.prototype.free;
|
|
774
|
-
exports.WasmEntity = WasmEntity;
|
|
775
|
-
|
|
776
|
-
/**
|
|
777
|
-
* Structured error type for WASM bindings.
|
|
778
|
-
*
|
|
779
|
-
* Provides a JavaScript-friendly error object with a code, message, and source.
|
|
780
|
-
*/
|
|
781
|
-
class WasmError {
|
|
782
|
-
static __wrap(ptr) {
|
|
783
|
-
ptr = ptr >>> 0;
|
|
784
|
-
const obj = Object.create(WasmError.prototype);
|
|
785
|
-
obj.__wbg_ptr = ptr;
|
|
786
|
-
WasmErrorFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
787
|
-
return obj;
|
|
788
|
-
}
|
|
789
|
-
__destroy_into_raw() {
|
|
790
|
-
const ptr = this.__wbg_ptr;
|
|
791
|
-
this.__wbg_ptr = 0;
|
|
792
|
-
WasmErrorFinalization.unregister(this);
|
|
793
|
-
return ptr;
|
|
794
|
-
}
|
|
795
|
-
free() {
|
|
796
|
-
const ptr = this.__destroy_into_raw();
|
|
797
|
-
wasm.__wbg_wasmerror_free(ptr, 0);
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Returns a formatted string representation of the error.
|
|
801
|
-
* @returns {string}
|
|
802
|
-
*/
|
|
803
|
-
toString() {
|
|
804
|
-
let deferred1_0;
|
|
805
|
-
let deferred1_1;
|
|
806
|
-
try {
|
|
807
|
-
const ret = wasm.wasmerror_toString(this.__wbg_ptr);
|
|
808
|
-
deferred1_0 = ret[0];
|
|
809
|
-
deferred1_1 = ret[1];
|
|
810
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
811
|
-
} finally {
|
|
812
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* Returns the error code for programmatic error handling.
|
|
817
|
-
* @returns {string}
|
|
818
|
-
*/
|
|
819
|
-
get code() {
|
|
820
|
-
let deferred1_0;
|
|
821
|
-
let deferred1_1;
|
|
822
|
-
try {
|
|
823
|
-
const ret = wasm.wasmerror_code(this.__wbg_ptr);
|
|
824
|
-
deferred1_0 = ret[0];
|
|
825
|
-
deferred1_1 = ret[1];
|
|
826
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
827
|
-
} finally {
|
|
828
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
/**
|
|
832
|
-
* Returns the source of the error (parameter name, field, etc.), if available.
|
|
833
|
-
* @returns {string | undefined}
|
|
834
|
-
*/
|
|
835
|
-
get source() {
|
|
836
|
-
const ret = wasm.wasmerror_source(this.__wbg_ptr);
|
|
837
|
-
let v1;
|
|
838
|
-
if (ret[0] !== 0) {
|
|
839
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
840
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
841
|
-
}
|
|
842
|
-
return v1;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Returns the human-readable error message.
|
|
846
|
-
* @returns {string}
|
|
847
|
-
*/
|
|
848
|
-
get message() {
|
|
849
|
-
let deferred1_0;
|
|
850
|
-
let deferred1_1;
|
|
851
|
-
try {
|
|
852
|
-
const ret = wasm.wasmerror_message(this.__wbg_ptr);
|
|
853
|
-
deferred1_0 = ret[0];
|
|
854
|
-
deferred1_1 = ret[1];
|
|
855
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
856
|
-
} finally {
|
|
857
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
if (Symbol.dispose) WasmError.prototype[Symbol.dispose] = WasmError.prototype.free;
|
|
862
|
-
exports.WasmError = WasmError;
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
* WASM-compatible Memory wrapper
|
|
866
|
-
*/
|
|
867
|
-
class WasmMemory {
|
|
868
|
-
static __wrap(ptr) {
|
|
869
|
-
ptr = ptr >>> 0;
|
|
870
|
-
const obj = Object.create(WasmMemory.prototype);
|
|
871
|
-
obj.__wbg_ptr = ptr;
|
|
872
|
-
WasmMemoryFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
873
|
-
return obj;
|
|
874
|
-
}
|
|
875
|
-
__destroy_into_raw() {
|
|
876
|
-
const ptr = this.__wbg_ptr;
|
|
877
|
-
this.__wbg_ptr = 0;
|
|
878
|
-
WasmMemoryFinalization.unregister(this);
|
|
879
|
-
return ptr;
|
|
880
|
-
}
|
|
881
|
-
free() {
|
|
882
|
-
const ptr = this.__destroy_into_raw();
|
|
883
|
-
wasm.__wbg_wasmmemory_free(ptr, 0);
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
* Get created_at timestamp
|
|
887
|
-
* @returns {number | undefined}
|
|
888
|
-
*/
|
|
889
|
-
get createdAt() {
|
|
890
|
-
const ret = wasm.wasmmemory_createdAt(this.__wbg_ptr);
|
|
891
|
-
return ret[0] === 0 ? undefined : ret[1];
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* Get the memory ID
|
|
895
|
-
* @returns {string | undefined}
|
|
896
|
-
*/
|
|
897
|
-
get id() {
|
|
898
|
-
const ret = wasm.wasmmemory_id(this.__wbg_ptr);
|
|
899
|
-
let v1;
|
|
900
|
-
if (ret[0] !== 0) {
|
|
901
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
902
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
903
|
-
}
|
|
904
|
-
return v1;
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* Check if memory is unique
|
|
908
|
-
* @returns {boolean}
|
|
909
|
-
*/
|
|
910
|
-
get unique() {
|
|
911
|
-
const ret = wasm.wasmmemory_unique(this.__wbg_ptr);
|
|
912
|
-
return ret !== 0;
|
|
913
|
-
}
|
|
914
|
-
/**
|
|
915
|
-
* Get the content as JSON
|
|
916
|
-
* @returns {string}
|
|
917
|
-
*/
|
|
918
|
-
get content() {
|
|
919
|
-
let deferred2_0;
|
|
920
|
-
let deferred2_1;
|
|
921
|
-
try {
|
|
922
|
-
const ret = wasm.wasmmemory_content(this.__wbg_ptr);
|
|
923
|
-
var ptr1 = ret[0];
|
|
924
|
-
var len1 = ret[1];
|
|
925
|
-
if (ret[3]) {
|
|
926
|
-
ptr1 = 0; len1 = 0;
|
|
927
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
928
|
-
}
|
|
929
|
-
deferred2_0 = ptr1;
|
|
930
|
-
deferred2_1 = len1;
|
|
931
|
-
return getStringFromWasm0(ptr1, len1);
|
|
932
|
-
} finally {
|
|
933
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
/**
|
|
937
|
-
* Get the room ID
|
|
938
|
-
* @returns {string}
|
|
939
|
-
*/
|
|
940
|
-
get roomId() {
|
|
941
|
-
let deferred1_0;
|
|
942
|
-
let deferred1_1;
|
|
943
|
-
try {
|
|
944
|
-
const ret = wasm.wasmmemory_roomId(this.__wbg_ptr);
|
|
945
|
-
deferred1_0 = ret[0];
|
|
946
|
-
deferred1_1 = ret[1];
|
|
947
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
948
|
-
} finally {
|
|
949
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
/**
|
|
953
|
-
* Convert to JSON
|
|
954
|
-
* @returns {string}
|
|
955
|
-
*/
|
|
956
|
-
toJson() {
|
|
957
|
-
let deferred2_0;
|
|
958
|
-
let deferred2_1;
|
|
959
|
-
try {
|
|
960
|
-
const ret = wasm.wasmmemory_toJson(this.__wbg_ptr);
|
|
961
|
-
var ptr1 = ret[0];
|
|
962
|
-
var len1 = ret[1];
|
|
963
|
-
if (ret[3]) {
|
|
964
|
-
ptr1 = 0; len1 = 0;
|
|
965
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
966
|
-
}
|
|
967
|
-
deferred2_0 = ptr1;
|
|
968
|
-
deferred2_1 = len1;
|
|
969
|
-
return getStringFromWasm0(ptr1, len1);
|
|
970
|
-
} finally {
|
|
971
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* Get the entity ID
|
|
976
|
-
* @returns {string}
|
|
977
|
-
*/
|
|
978
|
-
get entityId() {
|
|
979
|
-
let deferred1_0;
|
|
980
|
-
let deferred1_1;
|
|
981
|
-
try {
|
|
982
|
-
const ret = wasm.wasmmemory_entityId(this.__wbg_ptr);
|
|
983
|
-
deferred1_0 = ret[0];
|
|
984
|
-
deferred1_1 = ret[1];
|
|
985
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
986
|
-
} finally {
|
|
987
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* Create a new memory from JSON
|
|
992
|
-
* @param {string} json
|
|
993
|
-
* @returns {WasmMemory}
|
|
994
|
-
*/
|
|
995
|
-
static fromJson(json) {
|
|
996
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
997
|
-
const len0 = WASM_VECTOR_LEN;
|
|
998
|
-
const ret = wasm.wasmmemory_fromJson(ptr0, len0);
|
|
999
|
-
if (ret[2]) {
|
|
1000
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1001
|
-
}
|
|
1002
|
-
return WasmMemory.__wrap(ret[0]);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
if (Symbol.dispose) WasmMemory.prototype[Symbol.dispose] = WasmMemory.prototype.free;
|
|
1006
|
-
exports.WasmMemory = WasmMemory;
|
|
1007
|
-
|
|
1008
|
-
/**
|
|
1009
|
-
* WASM-compatible Plugin wrapper
|
|
1010
|
-
*/
|
|
1011
|
-
class WasmPlugin {
|
|
1012
|
-
static __wrap(ptr) {
|
|
1013
|
-
ptr = ptr >>> 0;
|
|
1014
|
-
const obj = Object.create(WasmPlugin.prototype);
|
|
1015
|
-
obj.__wbg_ptr = ptr;
|
|
1016
|
-
WasmPluginFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1017
|
-
return obj;
|
|
1018
|
-
}
|
|
1019
|
-
__destroy_into_raw() {
|
|
1020
|
-
const ptr = this.__wbg_ptr;
|
|
1021
|
-
this.__wbg_ptr = 0;
|
|
1022
|
-
WasmPluginFinalization.unregister(this);
|
|
1023
|
-
return ptr;
|
|
1024
|
-
}
|
|
1025
|
-
free() {
|
|
1026
|
-
const ptr = this.__destroy_into_raw();
|
|
1027
|
-
wasm.__wbg_wasmplugin_free(ptr, 0);
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* Get the plugin description
|
|
1031
|
-
* @returns {string | undefined}
|
|
1032
|
-
*/
|
|
1033
|
-
get description() {
|
|
1034
|
-
const ret = wasm.wasmplugin_description(this.__wbg_ptr);
|
|
1035
|
-
let v1;
|
|
1036
|
-
if (ret[0] !== 0) {
|
|
1037
|
-
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
1038
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1039
|
-
}
|
|
1040
|
-
return v1;
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* Get the plugin name
|
|
1044
|
-
* @returns {string}
|
|
1045
|
-
*/
|
|
1046
|
-
get name() {
|
|
1047
|
-
let deferred1_0;
|
|
1048
|
-
let deferred1_1;
|
|
1049
|
-
try {
|
|
1050
|
-
const ret = wasm.wasmplugin_name(this.__wbg_ptr);
|
|
1051
|
-
deferred1_0 = ret[0];
|
|
1052
|
-
deferred1_1 = ret[1];
|
|
1053
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1054
|
-
} finally {
|
|
1055
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Convert to JSON (only definition is serialized)
|
|
1060
|
-
* @returns {string}
|
|
1061
|
-
*/
|
|
1062
|
-
toJson() {
|
|
1063
|
-
let deferred2_0;
|
|
1064
|
-
let deferred2_1;
|
|
1065
|
-
try {
|
|
1066
|
-
const ret = wasm.wasmplugin_toJson(this.__wbg_ptr);
|
|
1067
|
-
var ptr1 = ret[0];
|
|
1068
|
-
var len1 = ret[1];
|
|
1069
|
-
if (ret[3]) {
|
|
1070
|
-
ptr1 = 0; len1 = 0;
|
|
1071
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
1072
|
-
}
|
|
1073
|
-
deferred2_0 = ptr1;
|
|
1074
|
-
deferred2_1 = len1;
|
|
1075
|
-
return getStringFromWasm0(ptr1, len1);
|
|
1076
|
-
} finally {
|
|
1077
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Create a new plugin from JSON (only definition is serialized)
|
|
1082
|
-
* @param {string} json
|
|
1083
|
-
* @returns {WasmPlugin}
|
|
1084
|
-
*/
|
|
1085
|
-
static fromJson(json) {
|
|
1086
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1087
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1088
|
-
const ret = wasm.wasmplugin_fromJson(ptr0, len0);
|
|
1089
|
-
if (ret[2]) {
|
|
1090
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1091
|
-
}
|
|
1092
|
-
return WasmPlugin.__wrap(ret[0]);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
if (Symbol.dispose) WasmPlugin.prototype[Symbol.dispose] = WasmPlugin.prototype.free;
|
|
1096
|
-
exports.WasmPlugin = WasmPlugin;
|
|
1097
|
-
|
|
1098
|
-
/**
|
|
1099
|
-
* WASM-compatible Room wrapper
|
|
1100
|
-
*/
|
|
1101
|
-
class WasmRoom {
|
|
1102
|
-
static __wrap(ptr) {
|
|
1103
|
-
ptr = ptr >>> 0;
|
|
1104
|
-
const obj = Object.create(WasmRoom.prototype);
|
|
1105
|
-
obj.__wbg_ptr = ptr;
|
|
1106
|
-
WasmRoomFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1107
|
-
return obj;
|
|
1108
|
-
}
|
|
1109
|
-
__destroy_into_raw() {
|
|
1110
|
-
const ptr = this.__wbg_ptr;
|
|
1111
|
-
this.__wbg_ptr = 0;
|
|
1112
|
-
WasmRoomFinalization.unregister(this);
|
|
1113
|
-
return ptr;
|
|
1114
|
-
}
|
|
1115
|
-
free() {
|
|
1116
|
-
const ptr = this.__destroy_into_raw();
|
|
1117
|
-
wasm.__wbg_wasmroom_free(ptr, 0);
|
|
1118
|
-
}
|
|
1119
|
-
/**
|
|
1120
|
-
* Get the room ID
|
|
1121
|
-
* @returns {string}
|
|
1122
|
-
*/
|
|
1123
|
-
get id() {
|
|
1124
|
-
let deferred1_0;
|
|
1125
|
-
let deferred1_1;
|
|
1126
|
-
try {
|
|
1127
|
-
const ret = wasm.wasmroom_id(this.__wbg_ptr);
|
|
1128
|
-
deferred1_0 = ret[0];
|
|
1129
|
-
deferred1_1 = ret[1];
|
|
1130
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1131
|
-
} finally {
|
|
1132
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Convert to JSON
|
|
1137
|
-
* @returns {string}
|
|
1138
|
-
*/
|
|
1139
|
-
toJson() {
|
|
1140
|
-
let deferred2_0;
|
|
1141
|
-
let deferred2_1;
|
|
1142
|
-
try {
|
|
1143
|
-
const ret = wasm.wasmroom_toJson(this.__wbg_ptr);
|
|
1144
|
-
var ptr1 = ret[0];
|
|
1145
|
-
var len1 = ret[1];
|
|
1146
|
-
if (ret[3]) {
|
|
1147
|
-
ptr1 = 0; len1 = 0;
|
|
1148
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
1149
|
-
}
|
|
1150
|
-
deferred2_0 = ptr1;
|
|
1151
|
-
deferred2_1 = len1;
|
|
1152
|
-
return getStringFromWasm0(ptr1, len1);
|
|
1153
|
-
} finally {
|
|
1154
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Create a new room from JSON
|
|
1159
|
-
* @param {string} json
|
|
1160
|
-
* @returns {WasmRoom}
|
|
1161
|
-
*/
|
|
1162
|
-
static fromJson(json) {
|
|
1163
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1164
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1165
|
-
const ret = wasm.wasmroom_fromJson(ptr0, len0);
|
|
1166
|
-
if (ret[2]) {
|
|
1167
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1168
|
-
}
|
|
1169
|
-
return WasmRoom.__wrap(ret[0]);
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
if (Symbol.dispose) WasmRoom.prototype[Symbol.dispose] = WasmRoom.prototype.free;
|
|
1173
|
-
exports.WasmRoom = WasmRoom;
|
|
1174
|
-
|
|
1175
|
-
/**
|
|
1176
|
-
* WASM-compatible UUID type wrapper
|
|
1177
|
-
*/
|
|
1178
|
-
class WasmUUID {
|
|
1179
|
-
static __wrap(ptr) {
|
|
1180
|
-
ptr = ptr >>> 0;
|
|
1181
|
-
const obj = Object.create(WasmUUID.prototype);
|
|
1182
|
-
obj.__wbg_ptr = ptr;
|
|
1183
|
-
WasmUUIDFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1184
|
-
return obj;
|
|
1185
|
-
}
|
|
1186
|
-
__destroy_into_raw() {
|
|
1187
|
-
const ptr = this.__wbg_ptr;
|
|
1188
|
-
this.__wbg_ptr = 0;
|
|
1189
|
-
WasmUUIDFinalization.unregister(this);
|
|
1190
|
-
return ptr;
|
|
1191
|
-
}
|
|
1192
|
-
free() {
|
|
1193
|
-
const ptr = this.__destroy_into_raw();
|
|
1194
|
-
wasm.__wbg_wasmuuid_free(ptr, 0);
|
|
1195
|
-
}
|
|
1196
|
-
/**
|
|
1197
|
-
* Create a UUID from a string
|
|
1198
|
-
* @param {string} s
|
|
1199
|
-
* @returns {WasmUUID}
|
|
1200
|
-
*/
|
|
1201
|
-
static fromString(s) {
|
|
1202
|
-
const ptr0 = passStringToWasm0(s, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1203
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1204
|
-
const ret = wasm.wasmuuid_fromString(ptr0, len0);
|
|
1205
|
-
if (ret[2]) {
|
|
1206
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1207
|
-
}
|
|
1208
|
-
return WasmUUID.__wrap(ret[0]);
|
|
1209
|
-
}
|
|
1210
|
-
/**
|
|
1211
|
-
* Convert to string
|
|
1212
|
-
* @returns {string}
|
|
1213
|
-
*/
|
|
1214
|
-
toString() {
|
|
1215
|
-
let deferred1_0;
|
|
1216
|
-
let deferred1_1;
|
|
1217
|
-
try {
|
|
1218
|
-
const ret = wasm.wasmuuid_toString(this.__wbg_ptr);
|
|
1219
|
-
deferred1_0 = ret[0];
|
|
1220
|
-
deferred1_1 = ret[1];
|
|
1221
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1222
|
-
} finally {
|
|
1223
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
/**
|
|
1227
|
-
* Create a new random UUID
|
|
1228
|
-
*/
|
|
1229
|
-
constructor() {
|
|
1230
|
-
const ret = wasm.wasmuuid_new();
|
|
1231
|
-
this.__wbg_ptr = ret >>> 0;
|
|
1232
|
-
WasmUUIDFinalization.register(this, this.__wbg_ptr, this);
|
|
1233
|
-
return this;
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
if (Symbol.dispose) WasmUUID.prototype[Symbol.dispose] = WasmUUID.prototype.free;
|
|
1237
|
-
exports.WasmUUID = WasmUUID;
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
1240
|
-
* Generate a new UUID
|
|
1241
|
-
* @returns {string}
|
|
1242
|
-
*/
|
|
1243
|
-
function generateUUID() {
|
|
1244
|
-
let deferred1_0;
|
|
1245
|
-
let deferred1_1;
|
|
1246
|
-
try {
|
|
1247
|
-
const ret = wasm.generateUUID();
|
|
1248
|
-
deferred1_0 = ret[0];
|
|
1249
|
-
deferred1_1 = ret[1];
|
|
1250
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1251
|
-
} finally {
|
|
1252
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1255
|
-
exports.generateUUID = generateUUID;
|
|
1256
|
-
|
|
1257
|
-
/**
|
|
1258
|
-
* Get the version of the elizaOS core
|
|
1259
|
-
* @returns {string}
|
|
1260
|
-
*/
|
|
1261
|
-
function getVersion() {
|
|
1262
|
-
let deferred1_0;
|
|
1263
|
-
let deferred1_1;
|
|
1264
|
-
try {
|
|
1265
|
-
const ret = wasm.getVersion();
|
|
1266
|
-
deferred1_0 = ret[0];
|
|
1267
|
-
deferred1_1 = ret[1];
|
|
1268
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1269
|
-
} finally {
|
|
1270
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
exports.getVersion = getVersion;
|
|
1274
|
-
|
|
1275
|
-
/**
|
|
1276
|
-
* Initialize the WASM module with panic hook for better error messages
|
|
1277
|
-
*/
|
|
1278
|
-
function init_wasm() {
|
|
1279
|
-
wasm.init_wasm();
|
|
1280
|
-
}
|
|
1281
|
-
exports.init_wasm = init_wasm;
|
|
1282
|
-
|
|
1283
|
-
/**
|
|
1284
|
-
* Parse a character JSON string and validate it
|
|
1285
|
-
* @param {string} json
|
|
1286
|
-
* @returns {WasmCharacter}
|
|
1287
|
-
*/
|
|
1288
|
-
function parseCharacter(json) {
|
|
1289
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1290
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1291
|
-
const ret = wasm.parseCharacter(ptr0, len0);
|
|
1292
|
-
if (ret[2]) {
|
|
1293
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1294
|
-
}
|
|
1295
|
-
return WasmCharacter.__wrap(ret[0]);
|
|
1296
|
-
}
|
|
1297
|
-
exports.parseCharacter = parseCharacter;
|
|
1298
|
-
|
|
1299
|
-
/**
|
|
1300
|
-
* Parse a memory JSON string
|
|
1301
|
-
* @param {string} json
|
|
1302
|
-
* @returns {WasmMemory}
|
|
1303
|
-
*/
|
|
1304
|
-
function parseMemory(json) {
|
|
1305
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1306
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1307
|
-
const ret = wasm.parseMemory(ptr0, len0);
|
|
1308
|
-
if (ret[2]) {
|
|
1309
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1310
|
-
}
|
|
1311
|
-
return WasmMemory.__wrap(ret[0]);
|
|
1312
|
-
}
|
|
1313
|
-
exports.parseMemory = parseMemory;
|
|
1314
|
-
|
|
1315
|
-
/**
|
|
1316
|
-
* Convert a string to a deterministic UUID (similar to stringToUuid in TS)
|
|
1317
|
-
* @param {string} input
|
|
1318
|
-
* @returns {string}
|
|
1319
|
-
*/
|
|
1320
|
-
function stringToUuid(input) {
|
|
1321
|
-
let deferred2_0;
|
|
1322
|
-
let deferred2_1;
|
|
1323
|
-
try {
|
|
1324
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1325
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1326
|
-
const ret = wasm.stringToUuid(ptr0, len0);
|
|
1327
|
-
deferred2_0 = ret[0];
|
|
1328
|
-
deferred2_1 = ret[1];
|
|
1329
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
1330
|
-
} finally {
|
|
1331
|
-
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1332
|
-
}
|
|
1333
|
-
}
|
|
1334
|
-
exports.stringToUuid = stringToUuid;
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Test serialization round-trip for Agent
|
|
1338
|
-
* @param {string} json
|
|
1339
|
-
* @returns {boolean}
|
|
1340
|
-
*/
|
|
1341
|
-
function testAgentRoundTrip(json) {
|
|
1342
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1343
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1344
|
-
const ret = wasm.testAgentRoundTrip(ptr0, len0);
|
|
1345
|
-
if (ret[2]) {
|
|
1346
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1347
|
-
}
|
|
1348
|
-
return ret[0] !== 0;
|
|
1349
|
-
}
|
|
1350
|
-
exports.testAgentRoundTrip = testAgentRoundTrip;
|
|
1351
|
-
|
|
1352
|
-
/**
|
|
1353
|
-
* Test serialization round-trip for Character
|
|
1354
|
-
* @param {string} json
|
|
1355
|
-
* @returns {boolean}
|
|
1356
|
-
*/
|
|
1357
|
-
function testCharacterRoundTrip(json) {
|
|
1358
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1359
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1360
|
-
const ret = wasm.testCharacterRoundTrip(ptr0, len0);
|
|
1361
|
-
if (ret[2]) {
|
|
1362
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1363
|
-
}
|
|
1364
|
-
return ret[0] !== 0;
|
|
1365
|
-
}
|
|
1366
|
-
exports.testCharacterRoundTrip = testCharacterRoundTrip;
|
|
1367
|
-
|
|
1368
|
-
/**
|
|
1369
|
-
* Test serialization round-trip for Memory
|
|
1370
|
-
* @param {string} json
|
|
1371
|
-
* @returns {boolean}
|
|
1372
|
-
*/
|
|
1373
|
-
function testMemoryRoundTrip(json) {
|
|
1374
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1375
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1376
|
-
const ret = wasm.testMemoryRoundTrip(ptr0, len0);
|
|
1377
|
-
if (ret[2]) {
|
|
1378
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1379
|
-
}
|
|
1380
|
-
return ret[0] !== 0;
|
|
1381
|
-
}
|
|
1382
|
-
exports.testMemoryRoundTrip = testMemoryRoundTrip;
|
|
1383
|
-
|
|
1384
|
-
/**
|
|
1385
|
-
* Validate a UUID string
|
|
1386
|
-
* @param {string} uuid_str
|
|
1387
|
-
* @returns {boolean}
|
|
1388
|
-
*/
|
|
1389
|
-
function validateUUID(uuid_str) {
|
|
1390
|
-
const ptr0 = passStringToWasm0(uuid_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1391
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1392
|
-
const ret = wasm.validateUUID(ptr0, len0);
|
|
1393
|
-
return ret !== 0;
|
|
1394
|
-
}
|
|
1395
|
-
exports.validateUUID = validateUUID;
|
|
1396
|
-
|
|
1397
|
-
exports.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
|
|
1398
|
-
const ret = debugString(arg1);
|
|
1399
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1400
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1401
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1402
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1403
|
-
};
|
|
1404
|
-
|
|
1405
|
-
exports.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
|
|
1406
|
-
const ret = typeof(arg0) === 'function';
|
|
1407
|
-
return ret;
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
exports.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
|
|
1411
|
-
const ret = arg0 === undefined;
|
|
1412
|
-
return ret;
|
|
1413
|
-
};
|
|
1414
|
-
|
|
1415
|
-
exports.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
|
|
1416
|
-
const obj = arg1;
|
|
1417
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1418
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1419
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1420
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1421
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1422
|
-
};
|
|
1423
|
-
|
|
1424
|
-
exports.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
|
|
1425
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
exports.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
|
|
1429
|
-
arg0._wbg_cb_unref();
|
|
1430
|
-
};
|
|
1431
|
-
|
|
1432
|
-
exports.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1433
|
-
const ret = arg0.call(arg1, arg2);
|
|
1434
|
-
return ret;
|
|
1435
|
-
}, arguments) };
|
|
1436
|
-
|
|
1437
|
-
exports.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
|
|
1438
|
-
const ret = arg0.call(arg1);
|
|
1439
|
-
return ret;
|
|
1440
|
-
}, arguments) };
|
|
1441
|
-
|
|
1442
|
-
exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
1443
|
-
let deferred0_0;
|
|
1444
|
-
let deferred0_1;
|
|
1445
|
-
try {
|
|
1446
|
-
deferred0_0 = arg0;
|
|
1447
|
-
deferred0_1 = arg1;
|
|
1448
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
1449
|
-
} finally {
|
|
1450
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1451
|
-
}
|
|
1452
|
-
};
|
|
1453
|
-
|
|
1454
|
-
exports.__wbg_getRandomValues_9b655bdd369112f2 = function() { return handleError(function (arg0, arg1) {
|
|
1455
|
-
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1456
|
-
}, arguments) };
|
|
1457
|
-
|
|
1458
|
-
exports.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
|
|
1459
|
-
const ret = Reflect.get(arg0, arg1);
|
|
1460
|
-
return ret;
|
|
1461
|
-
}, arguments) };
|
|
1462
|
-
|
|
1463
|
-
exports.__wbg_instanceof_Promise_eca6c43a2610558d = function(arg0) {
|
|
1464
|
-
let result;
|
|
1465
|
-
try {
|
|
1466
|
-
result = arg0 instanceof Promise;
|
|
1467
|
-
} catch (_) {
|
|
1468
|
-
result = false;
|
|
1469
|
-
}
|
|
1470
|
-
const ret = result;
|
|
1471
|
-
return ret;
|
|
1472
|
-
};
|
|
1473
|
-
|
|
1474
|
-
exports.__wbg_new_1ba21ce319a06297 = function() {
|
|
1475
|
-
const ret = new Object();
|
|
1476
|
-
return ret;
|
|
1477
|
-
};
|
|
1478
|
-
|
|
1479
|
-
exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
1480
|
-
const ret = new Error();
|
|
1481
|
-
return ret;
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
exports.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
|
|
1485
|
-
try {
|
|
1486
|
-
var state0 = {a: arg0, b: arg1};
|
|
1487
|
-
var cb0 = (arg0, arg1) => {
|
|
1488
|
-
const a = state0.a;
|
|
1489
|
-
state0.a = 0;
|
|
1490
|
-
try {
|
|
1491
|
-
return wasm_bindgen__convert__closures_____invoke__h04ef24186ff3529f(a, state0.b, arg0, arg1);
|
|
1492
|
-
} finally {
|
|
1493
|
-
state0.a = a;
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
const ret = new Promise(cb0);
|
|
1497
|
-
return ret;
|
|
1498
|
-
} finally {
|
|
1499
|
-
state0.a = state0.b = 0;
|
|
1500
|
-
}
|
|
1501
|
-
};
|
|
1502
|
-
|
|
1503
|
-
exports.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
|
|
1504
|
-
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
1505
|
-
return ret;
|
|
1506
|
-
};
|
|
1507
|
-
|
|
1508
|
-
exports.__wbg_now_69d776cd24f5215b = function() {
|
|
1509
|
-
const ret = Date.now();
|
|
1510
|
-
return ret;
|
|
1511
|
-
};
|
|
1512
|
-
|
|
1513
|
-
exports.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
|
|
1514
|
-
const ret = arg0.queueMicrotask;
|
|
1515
|
-
return ret;
|
|
1516
|
-
};
|
|
1517
|
-
|
|
1518
|
-
exports.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
|
|
1519
|
-
queueMicrotask(arg0);
|
|
1520
|
-
};
|
|
1521
|
-
|
|
1522
|
-
exports.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
|
|
1523
|
-
const ret = Promise.resolve(arg0);
|
|
1524
|
-
return ret;
|
|
1525
|
-
};
|
|
1526
|
-
|
|
1527
|
-
exports.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
1528
|
-
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1529
|
-
return ret;
|
|
1530
|
-
}, arguments) };
|
|
1531
|
-
|
|
1532
|
-
exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
|
|
1533
|
-
const ret = arg1.stack;
|
|
1534
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1535
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1536
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1537
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1538
|
-
};
|
|
1539
|
-
|
|
1540
|
-
exports.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
|
|
1541
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
1542
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
exports.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
|
|
1546
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1547
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1548
|
-
};
|
|
1549
|
-
|
|
1550
|
-
exports.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
|
|
1551
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
1552
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1553
|
-
};
|
|
1554
|
-
|
|
1555
|
-
exports.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
|
|
1556
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
1557
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1558
|
-
};
|
|
1559
|
-
|
|
1560
|
-
exports.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
|
|
1561
|
-
const ret = arg0.then(arg1, arg2);
|
|
1562
|
-
return ret;
|
|
1563
|
-
};
|
|
1564
|
-
|
|
1565
|
-
exports.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
|
|
1566
|
-
const ret = arg0.then(arg1);
|
|
1567
|
-
return ret;
|
|
1568
|
-
};
|
|
1569
|
-
|
|
1570
|
-
exports.__wbg_wasmerror_new = function(arg0) {
|
|
1571
|
-
const ret = WasmError.__wrap(arg0);
|
|
1572
|
-
return ret;
|
|
1573
|
-
};
|
|
1574
|
-
|
|
1575
|
-
exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
1576
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1577
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
1578
|
-
return ret;
|
|
1579
|
-
};
|
|
1580
|
-
|
|
1581
|
-
exports.__wbindgen_cast_9d58885f229d7092 = function(arg0, arg1) {
|
|
1582
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 107, function: Function { arguments: [Externref], shim_idx: 108, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1583
|
-
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb6035a82b1213eee, wasm_bindgen__convert__closures_____invoke__he8569e00d9589556);
|
|
1584
|
-
return ret;
|
|
1585
|
-
};
|
|
1586
|
-
|
|
1587
|
-
exports.__wbindgen_init_externref_table = function() {
|
|
1588
|
-
const table = wasm.__wbindgen_externrefs;
|
|
1589
|
-
const offset = table.grow(4);
|
|
1590
|
-
table.set(0, undefined);
|
|
1591
|
-
table.set(offset + 0, undefined);
|
|
1592
|
-
table.set(offset + 1, null);
|
|
1593
|
-
table.set(offset + 2, true);
|
|
1594
|
-
table.set(offset + 3, false);
|
|
1595
|
-
};
|
|
1596
|
-
|
|
1597
|
-
const wasmPath = `${__dirname}/elizaos_bg.wasm`;
|
|
1598
|
-
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
1599
|
-
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
1600
|
-
const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
1601
|
-
|
|
1602
|
-
wasm.__wbindgen_start();
|