@elizaos/rust 2.0.0-alpha.10 → 2.0.0-alpha.106

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