briefcase-wasm 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,97 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * JavaScript-friendly wrapper for DecisionSnapshot
6
+ */
7
+ export class JsDecisionSnapshot {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ add_input(name: string, value: any, data_type: string): JsDecisionSnapshot;
11
+ add_output(name: string, value: any, data_type: string): JsDecisionSnapshot;
12
+ add_tag(key: string, value: string): JsDecisionSnapshot;
13
+ constructor(function_name: string);
14
+ to_json(): any;
15
+ with_module(module_name: string): JsDecisionSnapshot;
16
+ }
17
+
18
+ /**
19
+ * Simple in-memory storage for demo purposes
20
+ */
21
+ export class JsMemoryStorage {
22
+ free(): void;
23
+ [Symbol.dispose](): void;
24
+ health_check(): boolean;
25
+ load_decision(decision_id: string): JsDecisionSnapshot;
26
+ constructor();
27
+ save_decision(decision: JsDecisionSnapshot): string;
28
+ }
29
+
30
+ /**
31
+ * Initialize the Briefcase AI WASM module
32
+ */
33
+ export function init(): void;
34
+
35
+ export function main(): void;
36
+
37
+ /**
38
+ * Utility function for testing WASM functionality
39
+ */
40
+ export function test_functionality(): any;
41
+
42
+ /**
43
+ * Utility function to get the version of the WASM module
44
+ */
45
+ export function version(): string;
46
+
47
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
48
+
49
+ export interface InitOutput {
50
+ readonly memory: WebAssembly.Memory;
51
+ readonly __wbg_jsdecisionsnapshot_free: (a: number, b: number) => void;
52
+ readonly __wbg_jsmemorystorage_free: (a: number, b: number) => void;
53
+ readonly init: () => void;
54
+ readonly jsdecisionsnapshot_add_input: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
55
+ readonly jsdecisionsnapshot_add_output: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
56
+ readonly jsdecisionsnapshot_add_tag: (a: number, b: number, c: number, d: number, e: number) => number;
57
+ readonly jsdecisionsnapshot_new: (a: number, b: number) => number;
58
+ readonly jsdecisionsnapshot_to_json: (a: number) => [number, number, number];
59
+ readonly jsdecisionsnapshot_with_module: (a: number, b: number, c: number) => number;
60
+ readonly jsmemorystorage_health_check: (a: number) => number;
61
+ readonly jsmemorystorage_load_decision: (a: number, b: number, c: number) => [number, number, number];
62
+ readonly jsmemorystorage_new: () => number;
63
+ readonly jsmemorystorage_save_decision: (a: number, b: number) => [number, number];
64
+ readonly main: () => void;
65
+ readonly test_functionality: () => [number, number, number];
66
+ readonly version: () => [number, number];
67
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
68
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
69
+ readonly __wbindgen_exn_store: (a: number) => void;
70
+ readonly __externref_table_alloc: () => number;
71
+ readonly __wbindgen_externrefs: WebAssembly.Table;
72
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
73
+ readonly __externref_table_dealloc: (a: number) => void;
74
+ readonly __wbindgen_start: () => void;
75
+ }
76
+
77
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
78
+
79
+ /**
80
+ * Instantiates the given `module`, which can either be bytes or
81
+ * a precompiled `WebAssembly.Module`.
82
+ *
83
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
84
+ *
85
+ * @returns {InitOutput}
86
+ */
87
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
88
+
89
+ /**
90
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
91
+ * for everything else, calls `WebAssembly.instantiate` directly.
92
+ *
93
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
94
+ *
95
+ * @returns {Promise<InitOutput>}
96
+ */
97
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,756 @@
1
+ /* @ts-self-types="./briefcase_wasm.d.ts" */
2
+
3
+ /**
4
+ * JavaScript-friendly wrapper for DecisionSnapshot
5
+ */
6
+ export class JsDecisionSnapshot {
7
+ static __wrap(ptr) {
8
+ ptr = ptr >>> 0;
9
+ const obj = Object.create(JsDecisionSnapshot.prototype);
10
+ obj.__wbg_ptr = ptr;
11
+ JsDecisionSnapshotFinalization.register(obj, obj.__wbg_ptr, obj);
12
+ return obj;
13
+ }
14
+ __destroy_into_raw() {
15
+ const ptr = this.__wbg_ptr;
16
+ this.__wbg_ptr = 0;
17
+ JsDecisionSnapshotFinalization.unregister(this);
18
+ return ptr;
19
+ }
20
+ free() {
21
+ const ptr = this.__destroy_into_raw();
22
+ wasm.__wbg_jsdecisionsnapshot_free(ptr, 0);
23
+ }
24
+ /**
25
+ * @param {string} name
26
+ * @param {any} value
27
+ * @param {string} data_type
28
+ * @returns {JsDecisionSnapshot}
29
+ */
30
+ add_input(name, value, data_type) {
31
+ const ptr = this.__destroy_into_raw();
32
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
33
+ const len0 = WASM_VECTOR_LEN;
34
+ const ptr1 = passStringToWasm0(data_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
35
+ const len1 = WASM_VECTOR_LEN;
36
+ const ret = wasm.jsdecisionsnapshot_add_input(ptr, ptr0, len0, value, ptr1, len1);
37
+ if (ret[2]) {
38
+ throw takeFromExternrefTable0(ret[1]);
39
+ }
40
+ return JsDecisionSnapshot.__wrap(ret[0]);
41
+ }
42
+ /**
43
+ * @param {string} name
44
+ * @param {any} value
45
+ * @param {string} data_type
46
+ * @returns {JsDecisionSnapshot}
47
+ */
48
+ add_output(name, value, data_type) {
49
+ const ptr = this.__destroy_into_raw();
50
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
51
+ const len0 = WASM_VECTOR_LEN;
52
+ const ptr1 = passStringToWasm0(data_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
53
+ const len1 = WASM_VECTOR_LEN;
54
+ const ret = wasm.jsdecisionsnapshot_add_output(ptr, ptr0, len0, value, ptr1, len1);
55
+ if (ret[2]) {
56
+ throw takeFromExternrefTable0(ret[1]);
57
+ }
58
+ return JsDecisionSnapshot.__wrap(ret[0]);
59
+ }
60
+ /**
61
+ * @param {string} key
62
+ * @param {string} value
63
+ * @returns {JsDecisionSnapshot}
64
+ */
65
+ add_tag(key, value) {
66
+ const ptr = this.__destroy_into_raw();
67
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
68
+ const len0 = WASM_VECTOR_LEN;
69
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
70
+ const len1 = WASM_VECTOR_LEN;
71
+ const ret = wasm.jsdecisionsnapshot_add_tag(ptr, ptr0, len0, ptr1, len1);
72
+ return JsDecisionSnapshot.__wrap(ret);
73
+ }
74
+ /**
75
+ * @param {string} function_name
76
+ */
77
+ constructor(function_name) {
78
+ const ptr0 = passStringToWasm0(function_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
79
+ const len0 = WASM_VECTOR_LEN;
80
+ const ret = wasm.jsdecisionsnapshot_new(ptr0, len0);
81
+ this.__wbg_ptr = ret >>> 0;
82
+ JsDecisionSnapshotFinalization.register(this, this.__wbg_ptr, this);
83
+ return this;
84
+ }
85
+ /**
86
+ * @returns {any}
87
+ */
88
+ to_json() {
89
+ const ret = wasm.jsdecisionsnapshot_to_json(this.__wbg_ptr);
90
+ if (ret[2]) {
91
+ throw takeFromExternrefTable0(ret[1]);
92
+ }
93
+ return takeFromExternrefTable0(ret[0]);
94
+ }
95
+ /**
96
+ * @param {string} module_name
97
+ * @returns {JsDecisionSnapshot}
98
+ */
99
+ with_module(module_name) {
100
+ const ptr = this.__destroy_into_raw();
101
+ const ptr0 = passStringToWasm0(module_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
102
+ const len0 = WASM_VECTOR_LEN;
103
+ const ret = wasm.jsdecisionsnapshot_with_module(ptr, ptr0, len0);
104
+ return JsDecisionSnapshot.__wrap(ret);
105
+ }
106
+ }
107
+ if (Symbol.dispose) JsDecisionSnapshot.prototype[Symbol.dispose] = JsDecisionSnapshot.prototype.free;
108
+
109
+ /**
110
+ * Simple in-memory storage for demo purposes
111
+ */
112
+ export class JsMemoryStorage {
113
+ __destroy_into_raw() {
114
+ const ptr = this.__wbg_ptr;
115
+ this.__wbg_ptr = 0;
116
+ JsMemoryStorageFinalization.unregister(this);
117
+ return ptr;
118
+ }
119
+ free() {
120
+ const ptr = this.__destroy_into_raw();
121
+ wasm.__wbg_jsmemorystorage_free(ptr, 0);
122
+ }
123
+ /**
124
+ * @returns {boolean}
125
+ */
126
+ health_check() {
127
+ const ret = wasm.jsmemorystorage_health_check(this.__wbg_ptr);
128
+ return ret !== 0;
129
+ }
130
+ /**
131
+ * @param {string} decision_id
132
+ * @returns {JsDecisionSnapshot}
133
+ */
134
+ load_decision(decision_id) {
135
+ const ptr0 = passStringToWasm0(decision_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ const len0 = WASM_VECTOR_LEN;
137
+ const ret = wasm.jsmemorystorage_load_decision(this.__wbg_ptr, ptr0, len0);
138
+ if (ret[2]) {
139
+ throw takeFromExternrefTable0(ret[1]);
140
+ }
141
+ return JsDecisionSnapshot.__wrap(ret[0]);
142
+ }
143
+ constructor() {
144
+ const ret = wasm.jsmemorystorage_new();
145
+ this.__wbg_ptr = ret >>> 0;
146
+ JsMemoryStorageFinalization.register(this, this.__wbg_ptr, this);
147
+ return this;
148
+ }
149
+ /**
150
+ * @param {JsDecisionSnapshot} decision
151
+ * @returns {string}
152
+ */
153
+ save_decision(decision) {
154
+ let deferred1_0;
155
+ let deferred1_1;
156
+ try {
157
+ _assertClass(decision, JsDecisionSnapshot);
158
+ const ret = wasm.jsmemorystorage_save_decision(this.__wbg_ptr, decision.__wbg_ptr);
159
+ deferred1_0 = ret[0];
160
+ deferred1_1 = ret[1];
161
+ return getStringFromWasm0(ret[0], ret[1]);
162
+ } finally {
163
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
164
+ }
165
+ }
166
+ }
167
+ if (Symbol.dispose) JsMemoryStorage.prototype[Symbol.dispose] = JsMemoryStorage.prototype.free;
168
+
169
+ /**
170
+ * Initialize the Briefcase AI WASM module
171
+ */
172
+ export function init() {
173
+ wasm.init();
174
+ }
175
+
176
+ export function main() {
177
+ wasm.main();
178
+ }
179
+
180
+ /**
181
+ * Utility function for testing WASM functionality
182
+ * @returns {any}
183
+ */
184
+ export function test_functionality() {
185
+ const ret = wasm.test_functionality();
186
+ if (ret[2]) {
187
+ throw takeFromExternrefTable0(ret[1]);
188
+ }
189
+ return takeFromExternrefTable0(ret[0]);
190
+ }
191
+
192
+ /**
193
+ * Utility function to get the version of the WASM module
194
+ * @returns {string}
195
+ */
196
+ export function version() {
197
+ let deferred1_0;
198
+ let deferred1_1;
199
+ try {
200
+ const ret = wasm.version();
201
+ deferred1_0 = ret[0];
202
+ deferred1_1 = ret[1];
203
+ return getStringFromWasm0(ret[0], ret[1]);
204
+ } finally {
205
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
206
+ }
207
+ }
208
+
209
+ function __wbg_get_imports() {
210
+ const import0 = {
211
+ __proto__: null,
212
+ __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
213
+ const ret = Error(getStringFromWasm0(arg0, arg1));
214
+ return ret;
215
+ },
216
+ __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
217
+ const ret = String(arg1);
218
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
219
+ const len1 = WASM_VECTOR_LEN;
220
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
221
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
222
+ },
223
+ __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {
224
+ const v = arg1;
225
+ const ret = typeof(v) === 'bigint' ? v : undefined;
226
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
227
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
228
+ },
229
+ __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {
230
+ const v = arg0;
231
+ const ret = typeof(v) === 'boolean' ? v : undefined;
232
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
233
+ },
234
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
235
+ const ret = debugString(arg1);
236
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
237
+ const len1 = WASM_VECTOR_LEN;
238
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
239
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
240
+ },
241
+ __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {
242
+ const ret = arg0 in arg1;
243
+ return ret;
244
+ },
245
+ __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {
246
+ const ret = typeof(arg0) === 'bigint';
247
+ return ret;
248
+ },
249
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
250
+ const ret = typeof(arg0) === 'function';
251
+ return ret;
252
+ },
253
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
254
+ const val = arg0;
255
+ const ret = typeof(val) === 'object' && val !== null;
256
+ return ret;
257
+ },
258
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
259
+ const ret = typeof(arg0) === 'string';
260
+ return ret;
261
+ },
262
+ __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {
263
+ const ret = arg0 === arg1;
264
+ return ret;
265
+ },
266
+ __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {
267
+ const ret = arg0 == arg1;
268
+ return ret;
269
+ },
270
+ __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {
271
+ const obj = arg1;
272
+ const ret = typeof(obj) === 'number' ? obj : undefined;
273
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
274
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
275
+ },
276
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
277
+ const obj = arg1;
278
+ const ret = typeof(obj) === 'string' ? obj : undefined;
279
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
280
+ var len1 = WASM_VECTOR_LEN;
281
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
282
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
283
+ },
284
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
285
+ throw new Error(getStringFromWasm0(arg0, arg1));
286
+ },
287
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
288
+ const ret = arg0.call(arg1);
289
+ return ret;
290
+ }, arguments); },
291
+ __wbg_done_57b39ecd9addfe81: function(arg0) {
292
+ const ret = arg0.done;
293
+ return ret;
294
+ },
295
+ __wbg_entries_58c7934c745daac7: function(arg0) {
296
+ const ret = Object.entries(arg0);
297
+ return ret;
298
+ },
299
+ __wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
300
+ let deferred0_0;
301
+ let deferred0_1;
302
+ try {
303
+ deferred0_0 = arg0;
304
+ deferred0_1 = arg1;
305
+ console.error(getStringFromWasm0(arg0, arg1));
306
+ } finally {
307
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
308
+ }
309
+ },
310
+ __wbg_getRandomValues_9c5c1b115e142bb8: function() { return handleError(function (arg0, arg1) {
311
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
312
+ }, arguments); },
313
+ __wbg_getTime_1e3cd1391c5c3995: function(arg0) {
314
+ const ret = arg0.getTime();
315
+ return ret;
316
+ },
317
+ __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {
318
+ const ret = arg0[arg1 >>> 0];
319
+ return ret;
320
+ },
321
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
322
+ const ret = Reflect.get(arg0, arg1);
323
+ return ret;
324
+ }, arguments); },
325
+ __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {
326
+ let result;
327
+ try {
328
+ result = arg0 instanceof ArrayBuffer;
329
+ } catch (_) {
330
+ result = false;
331
+ }
332
+ const ret = result;
333
+ return ret;
334
+ },
335
+ __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {
336
+ let result;
337
+ try {
338
+ result = arg0 instanceof Map;
339
+ } catch (_) {
340
+ result = false;
341
+ }
342
+ const ret = result;
343
+ return ret;
344
+ },
345
+ __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {
346
+ let result;
347
+ try {
348
+ result = arg0 instanceof Uint8Array;
349
+ } catch (_) {
350
+ result = false;
351
+ }
352
+ const ret = result;
353
+ return ret;
354
+ },
355
+ __wbg_isArray_d314bb98fcf08331: function(arg0) {
356
+ const ret = Array.isArray(arg0);
357
+ return ret;
358
+ },
359
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
360
+ const ret = Number.isSafeInteger(arg0);
361
+ return ret;
362
+ },
363
+ __wbg_iterator_6ff6560ca1568e55: function() {
364
+ const ret = Symbol.iterator;
365
+ return ret;
366
+ },
367
+ __wbg_length_32ed9a279acd054c: function(arg0) {
368
+ const ret = arg0.length;
369
+ return ret;
370
+ },
371
+ __wbg_length_35a7bace40f36eac: function(arg0) {
372
+ const ret = arg0.length;
373
+ return ret;
374
+ },
375
+ __wbg_log_6b5ca2e6124b2808: function(arg0) {
376
+ console.log(arg0);
377
+ },
378
+ __wbg_new_0_73afc35eb544e539: function() {
379
+ const ret = new Date();
380
+ return ret;
381
+ },
382
+ __wbg_new_361308b2356cecd0: function() {
383
+ const ret = new Object();
384
+ return ret;
385
+ },
386
+ __wbg_new_3eb36ae241fe6f44: function() {
387
+ const ret = new Array();
388
+ return ret;
389
+ },
390
+ __wbg_new_8a6f238a6ece86ea: function() {
391
+ const ret = new Error();
392
+ return ret;
393
+ },
394
+ __wbg_new_dca287b076112a51: function() {
395
+ const ret = new Map();
396
+ return ret;
397
+ },
398
+ __wbg_new_dd2b680c8bf6ae29: function(arg0) {
399
+ const ret = new Uint8Array(arg0);
400
+ return ret;
401
+ },
402
+ __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {
403
+ const ret = arg0.next();
404
+ return ret;
405
+ }, arguments); },
406
+ __wbg_next_418f80d8f5303233: function(arg0) {
407
+ const ret = arg0.next;
408
+ return ret;
409
+ },
410
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
411
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
412
+ },
413
+ __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {
414
+ const ret = arg0.set(arg1, arg2);
415
+ return ret;
416
+ },
417
+ __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
418
+ arg0[arg1] = arg2;
419
+ },
420
+ __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
421
+ arg0[arg1 >>> 0] = arg2;
422
+ },
423
+ __wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
424
+ const ret = arg1.stack;
425
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
426
+ const len1 = WASM_VECTOR_LEN;
427
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
428
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
429
+ },
430
+ __wbg_value_0546255b415e96c1: function(arg0) {
431
+ const ret = arg0.value;
432
+ return ret;
433
+ },
434
+ __wbindgen_cast_0000000000000001: function(arg0) {
435
+ // Cast intrinsic for `F64 -> Externref`.
436
+ const ret = arg0;
437
+ return ret;
438
+ },
439
+ __wbindgen_cast_0000000000000002: function(arg0) {
440
+ // Cast intrinsic for `I64 -> Externref`.
441
+ const ret = arg0;
442
+ return ret;
443
+ },
444
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
445
+ // Cast intrinsic for `Ref(String) -> Externref`.
446
+ const ret = getStringFromWasm0(arg0, arg1);
447
+ return ret;
448
+ },
449
+ __wbindgen_cast_0000000000000004: function(arg0) {
450
+ // Cast intrinsic for `U64 -> Externref`.
451
+ const ret = BigInt.asUintN(64, arg0);
452
+ return ret;
453
+ },
454
+ __wbindgen_init_externref_table: function() {
455
+ const table = wasm.__wbindgen_externrefs;
456
+ const offset = table.grow(4);
457
+ table.set(0, undefined);
458
+ table.set(offset + 0, undefined);
459
+ table.set(offset + 1, null);
460
+ table.set(offset + 2, true);
461
+ table.set(offset + 3, false);
462
+ },
463
+ };
464
+ return {
465
+ __proto__: null,
466
+ "./briefcase_wasm_bg.js": import0,
467
+ };
468
+ }
469
+
470
+ const JsDecisionSnapshotFinalization = (typeof FinalizationRegistry === 'undefined')
471
+ ? { register: () => {}, unregister: () => {} }
472
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsdecisionsnapshot_free(ptr >>> 0, 1));
473
+ const JsMemoryStorageFinalization = (typeof FinalizationRegistry === 'undefined')
474
+ ? { register: () => {}, unregister: () => {} }
475
+ : new FinalizationRegistry(ptr => wasm.__wbg_jsmemorystorage_free(ptr >>> 0, 1));
476
+
477
+ function addToExternrefTable0(obj) {
478
+ const idx = wasm.__externref_table_alloc();
479
+ wasm.__wbindgen_externrefs.set(idx, obj);
480
+ return idx;
481
+ }
482
+
483
+ function _assertClass(instance, klass) {
484
+ if (!(instance instanceof klass)) {
485
+ throw new Error(`expected instance of ${klass.name}`);
486
+ }
487
+ }
488
+
489
+ function debugString(val) {
490
+ // primitive types
491
+ const type = typeof val;
492
+ if (type == 'number' || type == 'boolean' || val == null) {
493
+ return `${val}`;
494
+ }
495
+ if (type == 'string') {
496
+ return `"${val}"`;
497
+ }
498
+ if (type == 'symbol') {
499
+ const description = val.description;
500
+ if (description == null) {
501
+ return 'Symbol';
502
+ } else {
503
+ return `Symbol(${description})`;
504
+ }
505
+ }
506
+ if (type == 'function') {
507
+ const name = val.name;
508
+ if (typeof name == 'string' && name.length > 0) {
509
+ return `Function(${name})`;
510
+ } else {
511
+ return 'Function';
512
+ }
513
+ }
514
+ // objects
515
+ if (Array.isArray(val)) {
516
+ const length = val.length;
517
+ let debug = '[';
518
+ if (length > 0) {
519
+ debug += debugString(val[0]);
520
+ }
521
+ for(let i = 1; i < length; i++) {
522
+ debug += ', ' + debugString(val[i]);
523
+ }
524
+ debug += ']';
525
+ return debug;
526
+ }
527
+ // Test for built-in
528
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
529
+ let className;
530
+ if (builtInMatches && builtInMatches.length > 1) {
531
+ className = builtInMatches[1];
532
+ } else {
533
+ // Failed to match the standard '[object ClassName]'
534
+ return toString.call(val);
535
+ }
536
+ if (className == 'Object') {
537
+ // we're a user defined class or Object
538
+ // JSON.stringify avoids problems with cycles, and is generally much
539
+ // easier than looping through ownProperties of `val`.
540
+ try {
541
+ return 'Object(' + JSON.stringify(val) + ')';
542
+ } catch (_) {
543
+ return 'Object';
544
+ }
545
+ }
546
+ // errors
547
+ if (val instanceof Error) {
548
+ return `${val.name}: ${val.message}\n${val.stack}`;
549
+ }
550
+ // TODO we could test for more things here, like `Set`s and `Map`s.
551
+ return className;
552
+ }
553
+
554
+ function getArrayU8FromWasm0(ptr, len) {
555
+ ptr = ptr >>> 0;
556
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
557
+ }
558
+
559
+ let cachedDataViewMemory0 = null;
560
+ function getDataViewMemory0() {
561
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
562
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
563
+ }
564
+ return cachedDataViewMemory0;
565
+ }
566
+
567
+ function getStringFromWasm0(ptr, len) {
568
+ ptr = ptr >>> 0;
569
+ return decodeText(ptr, len);
570
+ }
571
+
572
+ let cachedUint8ArrayMemory0 = null;
573
+ function getUint8ArrayMemory0() {
574
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
575
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
576
+ }
577
+ return cachedUint8ArrayMemory0;
578
+ }
579
+
580
+ function handleError(f, args) {
581
+ try {
582
+ return f.apply(this, args);
583
+ } catch (e) {
584
+ const idx = addToExternrefTable0(e);
585
+ wasm.__wbindgen_exn_store(idx);
586
+ }
587
+ }
588
+
589
+ function isLikeNone(x) {
590
+ return x === undefined || x === null;
591
+ }
592
+
593
+ function passStringToWasm0(arg, malloc, realloc) {
594
+ if (realloc === undefined) {
595
+ const buf = cachedTextEncoder.encode(arg);
596
+ const ptr = malloc(buf.length, 1) >>> 0;
597
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
598
+ WASM_VECTOR_LEN = buf.length;
599
+ return ptr;
600
+ }
601
+
602
+ let len = arg.length;
603
+ let ptr = malloc(len, 1) >>> 0;
604
+
605
+ const mem = getUint8ArrayMemory0();
606
+
607
+ let offset = 0;
608
+
609
+ for (; offset < len; offset++) {
610
+ const code = arg.charCodeAt(offset);
611
+ if (code > 0x7F) break;
612
+ mem[ptr + offset] = code;
613
+ }
614
+ if (offset !== len) {
615
+ if (offset !== 0) {
616
+ arg = arg.slice(offset);
617
+ }
618
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
619
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
620
+ const ret = cachedTextEncoder.encodeInto(arg, view);
621
+
622
+ offset += ret.written;
623
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
624
+ }
625
+
626
+ WASM_VECTOR_LEN = offset;
627
+ return ptr;
628
+ }
629
+
630
+ function takeFromExternrefTable0(idx) {
631
+ const value = wasm.__wbindgen_externrefs.get(idx);
632
+ wasm.__externref_table_dealloc(idx);
633
+ return value;
634
+ }
635
+
636
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
637
+ cachedTextDecoder.decode();
638
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
639
+ let numBytesDecoded = 0;
640
+ function decodeText(ptr, len) {
641
+ numBytesDecoded += len;
642
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
643
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
644
+ cachedTextDecoder.decode();
645
+ numBytesDecoded = len;
646
+ }
647
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
648
+ }
649
+
650
+ const cachedTextEncoder = new TextEncoder();
651
+
652
+ if (!('encodeInto' in cachedTextEncoder)) {
653
+ cachedTextEncoder.encodeInto = function (arg, view) {
654
+ const buf = cachedTextEncoder.encode(arg);
655
+ view.set(buf);
656
+ return {
657
+ read: arg.length,
658
+ written: buf.length
659
+ };
660
+ };
661
+ }
662
+
663
+ let WASM_VECTOR_LEN = 0;
664
+
665
+ let wasmModule, wasm;
666
+ function __wbg_finalize_init(instance, module) {
667
+ wasm = instance.exports;
668
+ wasmModule = module;
669
+ cachedDataViewMemory0 = null;
670
+ cachedUint8ArrayMemory0 = null;
671
+ wasm.__wbindgen_start();
672
+ return wasm;
673
+ }
674
+
675
+ async function __wbg_load(module, imports) {
676
+ if (typeof Response === 'function' && module instanceof Response) {
677
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
678
+ try {
679
+ return await WebAssembly.instantiateStreaming(module, imports);
680
+ } catch (e) {
681
+ const validResponse = module.ok && expectedResponseType(module.type);
682
+
683
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
684
+ 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);
685
+
686
+ } else { throw e; }
687
+ }
688
+ }
689
+
690
+ const bytes = await module.arrayBuffer();
691
+ return await WebAssembly.instantiate(bytes, imports);
692
+ } else {
693
+ const instance = await WebAssembly.instantiate(module, imports);
694
+
695
+ if (instance instanceof WebAssembly.Instance) {
696
+ return { instance, module };
697
+ } else {
698
+ return instance;
699
+ }
700
+ }
701
+
702
+ function expectedResponseType(type) {
703
+ switch (type) {
704
+ case 'basic': case 'cors': case 'default': return true;
705
+ }
706
+ return false;
707
+ }
708
+ }
709
+
710
+ function initSync(module) {
711
+ if (wasm !== undefined) return wasm;
712
+
713
+
714
+ if (module !== undefined) {
715
+ if (Object.getPrototypeOf(module) === Object.prototype) {
716
+ ({module} = module)
717
+ } else {
718
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
719
+ }
720
+ }
721
+
722
+ const imports = __wbg_get_imports();
723
+ if (!(module instanceof WebAssembly.Module)) {
724
+ module = new WebAssembly.Module(module);
725
+ }
726
+ const instance = new WebAssembly.Instance(module, imports);
727
+ return __wbg_finalize_init(instance, module);
728
+ }
729
+
730
+ async function __wbg_init(module_or_path) {
731
+ if (wasm !== undefined) return wasm;
732
+
733
+
734
+ if (module_or_path !== undefined) {
735
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
736
+ ({module_or_path} = module_or_path)
737
+ } else {
738
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
739
+ }
740
+ }
741
+
742
+ if (module_or_path === undefined) {
743
+ module_or_path = new URL('briefcase_wasm_bg.wasm', import.meta.url);
744
+ }
745
+ const imports = __wbg_get_imports();
746
+
747
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
748
+ module_or_path = fetch(module_or_path);
749
+ }
750
+
751
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
752
+
753
+ return __wbg_finalize_init(instance, module);
754
+ }
755
+
756
+ export { initSync, __wbg_init as default };
Binary file
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "briefcase-wasm",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "Briefcase AI Team"
6
+ ],
7
+ "description": "WebAssembly bindings for Briefcase AI",
8
+ "version": "2.0.0",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/briefcasebrain/briefcase-ai-core"
13
+ },
14
+ "files": [
15
+ "briefcase_wasm_bg.wasm",
16
+ "briefcase_wasm.js",
17
+ "briefcase_wasm.d.ts"
18
+ ],
19
+ "main": "briefcase_wasm.js",
20
+ "types": "briefcase_wasm.d.ts",
21
+ "sideEffects": [
22
+ "./snippets/*"
23
+ ]
24
+ }