agentic-flow 2.0.5 → 2.0.7

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,135 +1,287 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
1
+ /**
2
+ * WASM wrapper for ReasoningBank
3
+ */
4
+ export class ReasoningBankWasm {
5
+ static __wrap(ptr) {
6
+ ptr = ptr >>> 0;
7
+ const obj = Object.create(ReasoningBankWasm.prototype);
8
+ obj.__wbg_ptr = ptr;
9
+ ReasoningBankWasmFinalization.register(obj, obj.__wbg_ptr, obj);
10
+ return obj;
11
+ }
12
+ __destroy_into_raw() {
13
+ const ptr = this.__wbg_ptr;
14
+ this.__wbg_ptr = 0;
15
+ ReasoningBankWasmFinalization.unregister(this);
16
+ return ptr;
17
+ }
18
+ free() {
19
+ const ptr = this.__destroy_into_raw();
20
+ wasm.__wbg_reasoningbankwasm_free(ptr, 0);
21
+ }
22
+ /**
23
+ * Find similar patterns
24
+ * @param {string} task_description
25
+ * @param {string} task_category
26
+ * @param {number} top_k
27
+ * @returns {Promise<string>}
28
+ */
29
+ findSimilar(task_description, task_category, top_k) {
30
+ const ptr0 = passStringToWasm0(task_description, wasm.__wbindgen_export, wasm.__wbindgen_export2);
31
+ const len0 = WASM_VECTOR_LEN;
32
+ const ptr1 = passStringToWasm0(task_category, wasm.__wbindgen_export, wasm.__wbindgen_export2);
33
+ const len1 = WASM_VECTOR_LEN;
34
+ const ret = wasm.reasoningbankwasm_findSimilar(this.__wbg_ptr, ptr0, len0, ptr1, len1, top_k);
35
+ return takeObject(ret);
36
+ }
37
+ /**
38
+ * Retrieve a pattern by ID
39
+ * @param {string} id
40
+ * @returns {Promise<string>}
41
+ */
42
+ getPattern(id) {
43
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
44
+ const len0 = WASM_VECTOR_LEN;
45
+ const ret = wasm.reasoningbankwasm_getPattern(this.__wbg_ptr, ptr0, len0);
46
+ return takeObject(ret);
47
+ }
48
+ /**
49
+ * Get storage statistics
50
+ * @returns {Promise<string>}
51
+ */
52
+ getStats() {
53
+ const ret = wasm.reasoningbankwasm_getStats(this.__wbg_ptr);
54
+ return takeObject(ret);
55
+ }
56
+ /**
57
+ * Create a new ReasoningBank instance
58
+ * @param {string | null} [db_name]
59
+ */
60
+ constructor(db_name) {
61
+ var ptr0 = isLikeNone(db_name) ? 0 : passStringToWasm0(db_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
62
+ var len0 = WASM_VECTOR_LEN;
63
+ const ret = wasm.reasoningbankwasm_new(ptr0, len0);
64
+ return takeObject(ret);
65
+ }
66
+ /**
67
+ * Search patterns by category
68
+ * @param {string} category
69
+ * @param {number} limit
70
+ * @returns {Promise<string>}
71
+ */
72
+ searchByCategory(category, limit) {
73
+ const ptr0 = passStringToWasm0(category, wasm.__wbindgen_export, wasm.__wbindgen_export2);
74
+ const len0 = WASM_VECTOR_LEN;
75
+ const ret = wasm.reasoningbankwasm_searchByCategory(this.__wbg_ptr, ptr0, len0, limit);
76
+ return takeObject(ret);
77
+ }
78
+ /**
79
+ * Store a reasoning pattern
80
+ * @param {string} pattern_json
81
+ * @returns {Promise<string>}
82
+ */
83
+ storePattern(pattern_json) {
84
+ const ptr0 = passStringToWasm0(pattern_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
85
+ const len0 = WASM_VECTOR_LEN;
86
+ const ret = wasm.reasoningbankwasm_storePattern(this.__wbg_ptr, ptr0, len0);
87
+ return takeObject(ret);
88
+ }
4
89
  }
90
+ if (Symbol.dispose) ReasoningBankWasm.prototype[Symbol.dispose] = ReasoningBankWasm.prototype.free;
5
91
 
6
-
7
- let heap = new Array(128).fill(undefined);
8
-
9
- heap.push(undefined, null, true, false);
10
-
11
- function getObject(idx) { return heap[idx]; }
12
-
13
- let heap_next = heap.length;
14
-
15
- function addHeapObject(obj) {
16
- if (heap_next === heap.length) heap.push(heap.length + 1);
17
- const idx = heap_next;
18
- heap_next = heap[idx];
19
-
20
- heap[idx] = obj;
21
- return idx;
92
+ /**
93
+ * Initialize logging for WASM
94
+ */
95
+ export function init() {
96
+ wasm.init();
22
97
  }
23
98
 
24
- function handleError(f, args) {
99
+ /**
100
+ * Log a message to the browser console
101
+ * @param {string} message
102
+ */
103
+ export function log(message) {
104
+ const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export, wasm.__wbindgen_export2);
105
+ const len0 = WASM_VECTOR_LEN;
106
+ wasm.log(ptr0, len0);
107
+ }
108
+ export function __wbg___wbindgen_debug_string_0bc8482c6e3508ae(arg0, arg1) {
109
+ const ret = debugString(getObject(arg1));
110
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
111
+ const len1 = WASM_VECTOR_LEN;
112
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
113
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
114
+ }
115
+ export function __wbg___wbindgen_is_function_0095a73b8b156f76(arg0) {
116
+ const ret = typeof(getObject(arg0)) === 'function';
117
+ return ret;
118
+ }
119
+ export function __wbg___wbindgen_is_undefined_9e4d92534c42d778(arg0) {
120
+ const ret = getObject(arg0) === undefined;
121
+ return ret;
122
+ }
123
+ export function __wbg___wbindgen_throw_be289d5034ed271b(arg0, arg1) {
124
+ throw new Error(getStringFromWasm0(arg0, arg1));
125
+ }
126
+ export function __wbg__wbg_cb_unref_d9b87ff7982e3b21(arg0) {
127
+ getObject(arg0)._wbg_cb_unref();
128
+ }
129
+ export function __wbg_call_389efe28435a9388() { return handleError(function (arg0, arg1) {
130
+ const ret = getObject(arg0).call(getObject(arg1));
131
+ return addHeapObject(ret);
132
+ }, arguments); }
133
+ export function __wbg_call_4708e0c13bdc8e95() { return handleError(function (arg0, arg1, arg2) {
134
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
135
+ return addHeapObject(ret);
136
+ }, arguments); }
137
+ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
138
+ let deferred0_0;
139
+ let deferred0_1;
25
140
  try {
26
- return f.apply(this, args);
27
- } catch (e) {
28
- wasm.__wbindgen_export_0(addHeapObject(e));
141
+ deferred0_0 = arg0;
142
+ deferred0_1 = arg1;
143
+ console.error(getStringFromWasm0(arg0, arg1));
144
+ } finally {
145
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
29
146
  }
30
147
  }
31
-
32
- let cachedUint8ArrayMemory0 = null;
33
-
34
- function getUint8ArrayMemory0() {
35
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
36
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
148
+ export function __wbg_getRandomValues_9b655bdd369112f2() { return handleError(function (arg0, arg1) {
149
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
150
+ }, arguments); }
151
+ export function __wbg_get_b3ed3ad4be2bc8ac() { return handleError(function (arg0, arg1) {
152
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
153
+ return addHeapObject(ret);
154
+ }, arguments); }
155
+ export function __wbg_indexedDB_782f0610ea9fb144() { return handleError(function (arg0) {
156
+ const ret = getObject(arg0).indexedDB;
157
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
158
+ }, arguments); }
159
+ export function __wbg_instanceof_Window_ed49b2db8df90359(arg0) {
160
+ let result;
161
+ try {
162
+ result = getObject(arg0) instanceof Window;
163
+ } catch (_) {
164
+ result = false;
37
165
  }
38
- return cachedUint8ArrayMemory0;
166
+ const ret = result;
167
+ return ret;
39
168
  }
40
-
41
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
42
-
43
- cachedTextDecoder.decode();
44
-
45
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
46
- let numBytesDecoded = 0;
47
- function decodeText(ptr, len) {
48
- numBytesDecoded += len;
49
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
50
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
51
- cachedTextDecoder.decode();
52
- numBytesDecoded = len;
169
+ export function __wbg_log_6b5ca2e6124b2808(arg0) {
170
+ console.log(getObject(arg0));
171
+ }
172
+ export function __wbg_new_8a6f238a6ece86ea() {
173
+ const ret = new Error();
174
+ return addHeapObject(ret);
175
+ }
176
+ export function __wbg_new_b5d9e2fb389fef91(arg0, arg1) {
177
+ try {
178
+ var state0 = {a: arg0, b: arg1};
179
+ var cb0 = (arg0, arg1) => {
180
+ const a = state0.a;
181
+ state0.a = 0;
182
+ try {
183
+ return __wasm_bindgen_func_elem_363(a, state0.b, arg0, arg1);
184
+ } finally {
185
+ state0.a = a;
186
+ }
187
+ };
188
+ const ret = new Promise(cb0);
189
+ return addHeapObject(ret);
190
+ } finally {
191
+ state0.a = state0.b = 0;
53
192
  }
54
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
55
193
  }
56
-
57
- function getStringFromWasm0(ptr, len) {
58
- ptr = ptr >>> 0;
59
- return decodeText(ptr, len);
194
+ export function __wbg_new_no_args_1c7c842f08d00ebb(arg0, arg1) {
195
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
196
+ return addHeapObject(ret);
60
197
  }
61
-
62
- function getArrayU8FromWasm0(ptr, len) {
63
- ptr = ptr >>> 0;
64
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
198
+ export function __wbg_open_82db86fd5b087109() { return handleError(function (arg0, arg1, arg2, arg3) {
199
+ const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
200
+ return addHeapObject(ret);
201
+ }, arguments); }
202
+ export function __wbg_queueMicrotask_0aa0a927f78f5d98(arg0) {
203
+ const ret = getObject(arg0).queueMicrotask;
204
+ return addHeapObject(ret);
65
205
  }
66
-
67
- function isLikeNone(x) {
68
- return x === undefined || x === null;
206
+ export function __wbg_queueMicrotask_5bb536982f78a56f(arg0) {
207
+ queueMicrotask(getObject(arg0));
69
208
  }
70
-
71
- let WASM_VECTOR_LEN = 0;
72
-
73
- const cachedTextEncoder = new TextEncoder();
74
-
75
- if (!('encodeInto' in cachedTextEncoder)) {
76
- cachedTextEncoder.encodeInto = function (arg, view) {
77
- const buf = cachedTextEncoder.encode(arg);
78
- view.set(buf);
79
- return {
80
- read: arg.length,
81
- written: buf.length
82
- };
83
- }
209
+ export function __wbg_reasoningbankwasm_new(arg0) {
210
+ const ret = ReasoningBankWasm.__wrap(arg0);
211
+ return addHeapObject(ret);
212
+ }
213
+ export function __wbg_resolve_002c4b7d9d8f6b64(arg0) {
214
+ const ret = Promise.resolve(getObject(arg0));
215
+ return addHeapObject(ret);
216
+ }
217
+ export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
218
+ const ret = getObject(arg1).stack;
219
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
220
+ const len1 = WASM_VECTOR_LEN;
221
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
222
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
223
+ }
224
+ export function __wbg_static_accessor_GLOBAL_12837167ad935116() {
225
+ const ret = typeof global === 'undefined' ? null : global;
226
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
227
+ }
228
+ export function __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f() {
229
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
230
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
231
+ }
232
+ export function __wbg_static_accessor_SELF_a621d3dfbb60d0ce() {
233
+ const ret = typeof self === 'undefined' ? null : self;
234
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
235
+ }
236
+ export function __wbg_static_accessor_WINDOW_f8727f0cf888e0bd() {
237
+ const ret = typeof window === 'undefined' ? null : window;
238
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
239
+ }
240
+ export function __wbg_then_b9e7b3b5f1a9e1b5(arg0, arg1) {
241
+ const ret = getObject(arg0).then(getObject(arg1));
242
+ return addHeapObject(ret);
243
+ }
244
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
245
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 62, function: Function { arguments: [Externref], shim_idx: 63, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
246
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_148, __wasm_bindgen_func_elem_149);
247
+ return addHeapObject(ret);
248
+ }
249
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
250
+ // Cast intrinsic for `Ref(String) -> Externref`.
251
+ const ret = getStringFromWasm0(arg0, arg1);
252
+ return addHeapObject(ret);
253
+ }
254
+ export function __wbindgen_object_clone_ref(arg0) {
255
+ const ret = getObject(arg0);
256
+ return addHeapObject(ret);
257
+ }
258
+ export function __wbindgen_object_drop_ref(arg0) {
259
+ takeObject(arg0);
260
+ }
261
+ function __wasm_bindgen_func_elem_149(arg0, arg1, arg2) {
262
+ wasm.__wasm_bindgen_func_elem_149(arg0, arg1, addHeapObject(arg2));
84
263
  }
85
264
 
86
- function passStringToWasm0(arg, malloc, realloc) {
87
-
88
- if (realloc === undefined) {
89
- const buf = cachedTextEncoder.encode(arg);
90
- const ptr = malloc(buf.length, 1) >>> 0;
91
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
92
- WASM_VECTOR_LEN = buf.length;
93
- return ptr;
94
- }
95
-
96
- let len = arg.length;
97
- let ptr = malloc(len, 1) >>> 0;
98
-
99
- const mem = getUint8ArrayMemory0();
100
-
101
- let offset = 0;
102
-
103
- for (; offset < len; offset++) {
104
- const code = arg.charCodeAt(offset);
105
- if (code > 0x7F) break;
106
- mem[ptr + offset] = code;
107
- }
265
+ function __wasm_bindgen_func_elem_363(arg0, arg1, arg2, arg3) {
266
+ wasm.__wasm_bindgen_func_elem_363(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
267
+ }
108
268
 
109
- if (offset !== len) {
110
- if (offset !== 0) {
111
- arg = arg.slice(offset);
112
- }
113
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
114
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
115
- const ret = cachedTextEncoder.encodeInto(arg, view);
269
+ const ReasoningBankWasmFinalization = (typeof FinalizationRegistry === 'undefined')
270
+ ? { register: () => {}, unregister: () => {} }
271
+ : new FinalizationRegistry(ptr => wasm.__wbg_reasoningbankwasm_free(ptr >>> 0, 1));
116
272
 
117
- offset += ret.written;
118
- ptr = realloc(ptr, len, offset, 1) >>> 0;
119
- }
273
+ function addHeapObject(obj) {
274
+ if (heap_next === heap.length) heap.push(heap.length + 1);
275
+ const idx = heap_next;
276
+ heap_next = heap[idx];
120
277
 
121
- WASM_VECTOR_LEN = offset;
122
- return ptr;
278
+ heap[idx] = obj;
279
+ return idx;
123
280
  }
124
281
 
125
- let cachedDataViewMemory0 = null;
126
-
127
- function getDataViewMemory0() {
128
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
129
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
130
- }
131
- return cachedDataViewMemory0;
132
- }
282
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
283
+ ? { register: () => {}, unregister: () => {} }
284
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
133
285
 
134
286
  function debugString(val) {
135
287
  // primitive types
@@ -165,391 +317,190 @@ function debugString(val) {
165
317
  }
166
318
  for(let i = 1; i < length; i++) {
167
319
  debug += ', ' + debugString(val[i]);
168
- }
169
- debug += ']';
170
- return debug;
171
- }
172
- // Test for built-in
173
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
174
- let className;
175
- if (builtInMatches && builtInMatches.length > 1) {
176
- className = builtInMatches[1];
177
- } else {
178
- // Failed to match the standard '[object ClassName]'
179
- return toString.call(val);
180
- }
181
- if (className == 'Object') {
182
- // we're a user defined class or Object
183
- // JSON.stringify avoids problems with cycles, and is generally much
184
- // easier than looping through ownProperties of `val`.
185
- try {
186
- return 'Object(' + JSON.stringify(val) + ')';
187
- } catch (_) {
188
- return 'Object';
189
- }
190
- }
191
- // errors
192
- if (val instanceof Error) {
193
- return `${val.name}: ${val.message}\n${val.stack}`;
194
- }
195
- // TODO we could test for more things here, like `Set`s and `Map`s.
196
- return className;
197
- }
198
-
199
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
200
- ? { register: () => {}, unregister: () => {} }
201
- : new FinalizationRegistry(
202
- state => {
203
- wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b);
204
- }
205
- );
206
-
207
- function makeMutClosure(arg0, arg1, dtor, f) {
208
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
209
- const real = (...args) => {
210
-
211
- // First up with a closure we increment the internal reference
212
- // count. This ensures that the Rust closure environment won't
213
- // be deallocated while we're invoking it.
214
- state.cnt++;
215
- const a = state.a;
216
- state.a = 0;
217
- try {
218
- return f(a, state.b, ...args);
219
- } finally {
220
- if (--state.cnt === 0) {
221
- wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
222
- CLOSURE_DTORS.unregister(state);
223
- } else {
224
- state.a = a;
225
- }
226
- }
227
- };
228
- real.original = state;
229
- CLOSURE_DTORS.register(real, state, state);
230
- return real;
231
- }
232
-
233
- function dropObject(idx) {
234
- if (idx < 132) return;
235
- heap[idx] = heap_next;
236
- heap_next = idx;
237
- }
238
-
239
- function takeObject(idx) {
240
- const ret = getObject(idx);
241
- dropObject(idx);
242
- return ret;
243
- }
244
- /**
245
- * Initialize logging for WASM
246
- */
247
- export function init() {
248
- wasm.init();
249
- }
250
-
251
- /**
252
- * Log a message to the browser console
253
- * @param {string} message
254
- */
255
- export function log(message) {
256
- const ptr0 = passStringToWasm0(message, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
257
- const len0 = WASM_VECTOR_LEN;
258
- wasm.log(ptr0, len0);
259
- }
260
-
261
- function __wbg_adapter_4(arg0, arg1, arg2) {
262
- wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2));
263
- }
264
-
265
- function __wbg_adapter_45(arg0, arg1, arg2, arg3) {
266
- wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
267
- }
268
-
269
- const ReasoningBankWasmFinalization = (typeof FinalizationRegistry === 'undefined')
270
- ? { register: () => {}, unregister: () => {} }
271
- : new FinalizationRegistry(ptr => wasm.__wbg_reasoningbankwasm_free(ptr >>> 0, 1));
272
- /**
273
- * WASM wrapper for ReasoningBank
274
- */
275
- export class ReasoningBankWasm {
276
-
277
- static __wrap(ptr) {
278
- ptr = ptr >>> 0;
279
- const obj = Object.create(ReasoningBankWasm.prototype);
280
- obj.__wbg_ptr = ptr;
281
- ReasoningBankWasmFinalization.register(obj, obj.__wbg_ptr, obj);
282
- return obj;
283
- }
284
-
285
- __destroy_into_raw() {
286
- const ptr = this.__wbg_ptr;
287
- this.__wbg_ptr = 0;
288
- ReasoningBankWasmFinalization.unregister(this);
289
- return ptr;
290
- }
291
-
292
- free() {
293
- const ptr = this.__destroy_into_raw();
294
- wasm.__wbg_reasoningbankwasm_free(ptr, 0);
295
- }
296
- /**
297
- * Create a new ReasoningBank instance
298
- * @param {string | null} [db_name]
299
- */
300
- constructor(db_name) {
301
- var ptr0 = isLikeNone(db_name) ? 0 : passStringToWasm0(db_name, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
302
- var len0 = WASM_VECTOR_LEN;
303
- const ret = wasm.reasoningbankwasm_new(ptr0, len0);
304
- return takeObject(ret);
305
- }
306
- /**
307
- * Store a reasoning pattern
308
- * @param {string} pattern_json
309
- * @returns {Promise<string>}
310
- */
311
- storePattern(pattern_json) {
312
- const ptr0 = passStringToWasm0(pattern_json, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
313
- const len0 = WASM_VECTOR_LEN;
314
- const ret = wasm.reasoningbankwasm_storePattern(this.__wbg_ptr, ptr0, len0);
315
- return takeObject(ret);
316
- }
317
- /**
318
- * Retrieve a pattern by ID
319
- * @param {string} id
320
- * @returns {Promise<string>}
321
- */
322
- getPattern(id) {
323
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
324
- const len0 = WASM_VECTOR_LEN;
325
- const ret = wasm.reasoningbankwasm_getPattern(this.__wbg_ptr, ptr0, len0);
326
- return takeObject(ret);
327
- }
328
- /**
329
- * Search patterns by category
330
- * @param {string} category
331
- * @param {number} limit
332
- * @returns {Promise<string>}
333
- */
334
- searchByCategory(category, limit) {
335
- const ptr0 = passStringToWasm0(category, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
336
- const len0 = WASM_VECTOR_LEN;
337
- const ret = wasm.reasoningbankwasm_searchByCategory(this.__wbg_ptr, ptr0, len0, limit);
338
- return takeObject(ret);
320
+ }
321
+ debug += ']';
322
+ return debug;
339
323
  }
340
- /**
341
- * Find similar patterns
342
- * @param {string} task_description
343
- * @param {string} task_category
344
- * @param {number} top_k
345
- * @returns {Promise<string>}
346
- */
347
- findSimilar(task_description, task_category, top_k) {
348
- const ptr0 = passStringToWasm0(task_description, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
349
- const len0 = WASM_VECTOR_LEN;
350
- const ptr1 = passStringToWasm0(task_category, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
351
- const len1 = WASM_VECTOR_LEN;
352
- const ret = wasm.reasoningbankwasm_findSimilar(this.__wbg_ptr, ptr0, len0, ptr1, len1, top_k);
353
- return takeObject(ret);
324
+ // Test for built-in
325
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
326
+ let className;
327
+ if (builtInMatches && builtInMatches.length > 1) {
328
+ className = builtInMatches[1];
329
+ } else {
330
+ // Failed to match the standard '[object ClassName]'
331
+ return toString.call(val);
354
332
  }
355
- /**
356
- * Get storage statistics
357
- * @returns {Promise<string>}
358
- */
359
- getStats() {
360
- const ret = wasm.reasoningbankwasm_getStats(this.__wbg_ptr);
361
- return takeObject(ret);
333
+ if (className == 'Object') {
334
+ // we're a user defined class or Object
335
+ // JSON.stringify avoids problems with cycles, and is generally much
336
+ // easier than looping through ownProperties of `val`.
337
+ try {
338
+ return 'Object(' + JSON.stringify(val) + ')';
339
+ } catch (_) {
340
+ return 'Object';
341
+ }
342
+ }
343
+ // errors
344
+ if (val instanceof Error) {
345
+ return `${val.name}: ${val.message}\n${val.stack}`;
362
346
  }
347
+ // TODO we could test for more things here, like `Set`s and `Map`s.
348
+ return className;
363
349
  }
364
- if (Symbol.dispose) ReasoningBankWasm.prototype[Symbol.dispose] = ReasoningBankWasm.prototype.free;
365
350
 
366
- export function __wbg_call_13410aac570ffff7() { return handleError(function (arg0, arg1) {
367
- const ret = getObject(arg0).call(getObject(arg1));
368
- return addHeapObject(ret);
369
- }, arguments) };
351
+ function dropObject(idx) {
352
+ if (idx < 132) return;
353
+ heap[idx] = heap_next;
354
+ heap_next = idx;
355
+ }
370
356
 
371
- export function __wbg_call_a5400b25a865cfd8() { return handleError(function (arg0, arg1, arg2) {
372
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
373
- return addHeapObject(ret);
374
- }, arguments) };
357
+ function getArrayU8FromWasm0(ptr, len) {
358
+ ptr = ptr >>> 0;
359
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
360
+ }
375
361
 
376
- export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
377
- let deferred0_0;
378
- let deferred0_1;
379
- try {
380
- deferred0_0 = arg0;
381
- deferred0_1 = arg1;
382
- console.error(getStringFromWasm0(arg0, arg1));
383
- } finally {
384
- wasm.__wbindgen_export_1(deferred0_0, deferred0_1, 1);
362
+ let cachedDataViewMemory0 = null;
363
+ function getDataViewMemory0() {
364
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
365
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
385
366
  }
386
- };
387
-
388
- export function __wbg_getRandomValues_38a1ff1ea09f6cc7() { return handleError(function (arg0, arg1) {
389
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
390
- }, arguments) };
391
-
392
- export function __wbg_get_458e874b43b18b25() { return handleError(function (arg0, arg1) {
393
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
394
- return addHeapObject(ret);
395
- }, arguments) };
367
+ return cachedDataViewMemory0;
368
+ }
396
369
 
397
- export function __wbg_indexedDB_1956995e4297311c() { return handleError(function (arg0) {
398
- const ret = getObject(arg0).indexedDB;
399
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
400
- }, arguments) };
370
+ function getStringFromWasm0(ptr, len) {
371
+ ptr = ptr >>> 0;
372
+ return decodeText(ptr, len);
373
+ }
401
374
 
402
- export function __wbg_instanceof_Window_12d20d558ef92592(arg0) {
403
- let result;
404
- try {
405
- result = getObject(arg0) instanceof Window;
406
- } catch (_) {
407
- result = false;
375
+ let cachedUint8ArrayMemory0 = null;
376
+ function getUint8ArrayMemory0() {
377
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
378
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
408
379
  }
409
- const ret = result;
410
- return ret;
411
- };
380
+ return cachedUint8ArrayMemory0;
381
+ }
412
382
 
413
- export function __wbg_log_6c7b5f4f00b8ce3f(arg0) {
414
- console.log(getObject(arg0));
415
- };
383
+ function getObject(idx) { return heap[idx]; }
416
384
 
417
- export function __wbg_new_2e3c58a15f39f5f9(arg0, arg1) {
385
+ function handleError(f, args) {
418
386
  try {
419
- var state0 = {a: arg0, b: arg1};
420
- var cb0 = (arg0, arg1) => {
421
- const a = state0.a;
422
- state0.a = 0;
423
- try {
424
- return __wbg_adapter_45(a, state0.b, arg0, arg1);
425
- } finally {
426
- state0.a = a;
427
- }
428
- };
429
- const ret = new Promise(cb0);
430
- return addHeapObject(ret);
431
- } finally {
432
- state0.a = state0.b = 0;
387
+ return f.apply(this, args);
388
+ } catch (e) {
389
+ wasm.__wbindgen_export3(addHeapObject(e));
433
390
  }
434
- };
435
-
436
- export function __wbg_new_8a6f238a6ece86ea() {
437
- const ret = new Error();
438
- return addHeapObject(ret);
439
- };
440
-
441
- export function __wbg_newnoargs_254190557c45b4ec(arg0, arg1) {
442
- const ret = new Function(getStringFromWasm0(arg0, arg1));
443
- return addHeapObject(ret);
444
- };
445
-
446
- export function __wbg_open_7281831ed8ff7bd2() { return handleError(function (arg0, arg1, arg2, arg3) {
447
- const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
448
- return addHeapObject(ret);
449
- }, arguments) };
450
-
451
- export function __wbg_queueMicrotask_25d0739ac89e8c88(arg0) {
452
- queueMicrotask(getObject(arg0));
453
- };
391
+ }
454
392
 
455
- export function __wbg_queueMicrotask_4488407636f5bf24(arg0) {
456
- const ret = getObject(arg0).queueMicrotask;
457
- return addHeapObject(ret);
458
- };
393
+ let heap = new Array(128).fill(undefined);
394
+ heap.push(undefined, null, true, false);
459
395
 
460
- export function __wbg_reasoningbankwasm_new(arg0) {
461
- const ret = ReasoningBankWasm.__wrap(arg0);
462
- return addHeapObject(ret);
463
- };
396
+ let heap_next = heap.length;
464
397
 
465
- export function __wbg_resolve_4055c623acdd6a1b(arg0) {
466
- const ret = Promise.resolve(getObject(arg0));
467
- return addHeapObject(ret);
468
- };
398
+ function isLikeNone(x) {
399
+ return x === undefined || x === null;
400
+ }
469
401
 
470
- export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
471
- const ret = getObject(arg1).stack;
472
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
473
- const len1 = WASM_VECTOR_LEN;
474
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
475
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
476
- };
402
+ function makeMutClosure(arg0, arg1, dtor, f) {
403
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
404
+ const real = (...args) => {
477
405
 
478
- export function __wbg_static_accessor_GLOBAL_8921f820c2ce3f12() {
479
- const ret = typeof global === 'undefined' ? null : global;
480
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
481
- };
406
+ // First up with a closure we increment the internal reference
407
+ // count. This ensures that the Rust closure environment won't
408
+ // be deallocated while we're invoking it.
409
+ state.cnt++;
410
+ const a = state.a;
411
+ state.a = 0;
412
+ try {
413
+ return f(a, state.b, ...args);
414
+ } finally {
415
+ state.a = a;
416
+ real._wbg_cb_unref();
417
+ }
418
+ };
419
+ real._wbg_cb_unref = () => {
420
+ if (--state.cnt === 0) {
421
+ state.dtor(state.a, state.b);
422
+ state.a = 0;
423
+ CLOSURE_DTORS.unregister(state);
424
+ }
425
+ };
426
+ CLOSURE_DTORS.register(real, state, state);
427
+ return real;
428
+ }
482
429
 
483
- export function __wbg_static_accessor_GLOBAL_THIS_f0a4409105898184() {
484
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
485
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
486
- };
430
+ function passStringToWasm0(arg, malloc, realloc) {
431
+ if (realloc === undefined) {
432
+ const buf = cachedTextEncoder.encode(arg);
433
+ const ptr = malloc(buf.length, 1) >>> 0;
434
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
435
+ WASM_VECTOR_LEN = buf.length;
436
+ return ptr;
437
+ }
487
438
 
488
- export function __wbg_static_accessor_SELF_995b214ae681ff99() {
489
- const ret = typeof self === 'undefined' ? null : self;
490
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
491
- };
439
+ let len = arg.length;
440
+ let ptr = malloc(len, 1) >>> 0;
492
441
 
493
- export function __wbg_static_accessor_WINDOW_cde3890479c675ea() {
494
- const ret = typeof window === 'undefined' ? null : window;
495
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
496
- };
442
+ const mem = getUint8ArrayMemory0();
497
443
 
498
- export function __wbg_then_e22500defe16819f(arg0, arg1) {
499
- const ret = getObject(arg0).then(getObject(arg1));
500
- return addHeapObject(ret);
501
- };
444
+ let offset = 0;
502
445
 
503
- export function __wbg_wbindgencbdrop_eb10308566512b88(arg0) {
504
- const obj = getObject(arg0).original;
505
- if (obj.cnt-- == 1) {
506
- obj.a = 0;
507
- return true;
446
+ for (; offset < len; offset++) {
447
+ const code = arg.charCodeAt(offset);
448
+ if (code > 0x7F) break;
449
+ mem[ptr + offset] = code;
508
450
  }
509
- const ret = false;
510
- return ret;
511
- };
451
+ if (offset !== len) {
452
+ if (offset !== 0) {
453
+ arg = arg.slice(offset);
454
+ }
455
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
456
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
457
+ const ret = cachedTextEncoder.encodeInto(arg, view);
512
458
 
513
- export function __wbg_wbindgendebugstring_99ef257a3ddda34d(arg0, arg1) {
514
- const ret = debugString(getObject(arg1));
515
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_2, wasm.__wbindgen_export_3);
516
- const len1 = WASM_VECTOR_LEN;
517
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
518
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
519
- };
459
+ offset += ret.written;
460
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
461
+ }
520
462
 
521
- export function __wbg_wbindgenisfunction_8cee7dce3725ae74(arg0) {
522
- const ret = typeof(getObject(arg0)) === 'function';
523
- return ret;
524
- };
463
+ WASM_VECTOR_LEN = offset;
464
+ return ptr;
465
+ }
525
466
 
526
- export function __wbg_wbindgenisundefined_c4b71d073b92f3c5(arg0) {
527
- const ret = getObject(arg0) === undefined;
467
+ function takeObject(idx) {
468
+ const ret = getObject(idx);
469
+ dropObject(idx);
528
470
  return ret;
529
- };
471
+ }
530
472
 
531
- export function __wbg_wbindgenthrow_451ec1a8469d7eb6(arg0, arg1) {
532
- throw new Error(getStringFromWasm0(arg0, arg1));
533
- };
473
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
474
+ cachedTextDecoder.decode();
475
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
476
+ let numBytesDecoded = 0;
477
+ function decodeText(ptr, len) {
478
+ numBytesDecoded += len;
479
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
480
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
481
+ cachedTextDecoder.decode();
482
+ numBytesDecoded = len;
483
+ }
484
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
485
+ }
534
486
 
535
- export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
536
- // Cast intrinsic for `Ref(String) -> Externref`.
537
- const ret = getStringFromWasm0(arg0, arg1);
538
- return addHeapObject(ret);
539
- };
487
+ const cachedTextEncoder = new TextEncoder();
540
488
 
541
- export function __wbindgen_cast_8eb6fd44e7238d11(arg0, arg1) {
542
- // Cast intrinsic for `Closure(Closure { dtor_idx: 62, function: Function { arguments: [Externref], shim_idx: 63, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
543
- const ret = makeMutClosure(arg0, arg1, 62, __wbg_adapter_4);
544
- return addHeapObject(ret);
545
- };
489
+ if (!('encodeInto' in cachedTextEncoder)) {
490
+ cachedTextEncoder.encodeInto = function (arg, view) {
491
+ const buf = cachedTextEncoder.encode(arg);
492
+ view.set(buf);
493
+ return {
494
+ read: arg.length,
495
+ written: buf.length
496
+ };
497
+ };
498
+ }
546
499
 
547
- export function __wbindgen_object_clone_ref(arg0) {
548
- const ret = getObject(arg0);
549
- return addHeapObject(ret);
550
- };
500
+ let WASM_VECTOR_LEN = 0;
551
501
 
552
- export function __wbindgen_object_drop_ref(arg0) {
553
- takeObject(arg0);
554
- };
555
502
 
503
+ let wasm;
504
+ export function __wbg_set_wasm(val) {
505
+ wasm = val;
506
+ }