@kya-os/checkpoint-wasm-runtime 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/engine.mjs CHANGED
@@ -1,7 +1,468 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
+ }) : x)(function(x) {
13
+ if (typeof require !== "undefined") return require.apply(this, arguments);
14
+ throw Error('Dynamic require of "' + x + '" is not supported');
15
+ });
16
+ var __esm = (fn, res) => function __init() {
17
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
+ };
19
+ var __commonJS = (cb, mod) => function __require2() {
20
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
+ };
22
+ var __copyProps = (to, from, except, desc) => {
23
+ if (from && typeof from === "object" || typeof from === "function") {
24
+ for (let key of __getOwnPropNames(from))
25
+ if (!__hasOwnProp.call(to, key) && key !== except)
26
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
+ // If the importer is in node compatibility mode or this is not an ESM
32
+ // file that has been converted to a CommonJS file using a Babel-
33
+ // compatible transform (i.e. "__esModule" has not been set), then set
34
+ // "default" to the CommonJS "module.exports" for node compatibility.
35
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36
+ mod
37
+ ));
38
+ var getFilename, getDirname, __dirname$1;
39
+ var init_esm_shims = __esm({
40
+ "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.15.32_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/esm_shims.js"() {
41
+ getFilename = () => fileURLToPath(import.meta.url);
42
+ getDirname = () => path.dirname(getFilename());
43
+ __dirname$1 = /* @__PURE__ */ getDirname();
44
+ }
45
+ });
46
+
47
+ // wasm/kya-os-engine/kya_os_engine.js
48
+ var require_kya_os_engine = __commonJS({
49
+ "wasm/kya-os-engine/kya_os_engine.js"(exports$1, module) {
50
+ init_esm_shims();
51
+ var imports = {};
52
+ imports["__wbindgen_placeholder__"] = module.exports;
53
+ var cachedUint8ArrayMemory0 = null;
54
+ function getUint8ArrayMemory0() {
55
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
56
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
57
+ }
58
+ return cachedUint8ArrayMemory0;
59
+ }
60
+ var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
61
+ cachedTextDecoder.decode();
62
+ function decodeText(ptr, len) {
63
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
64
+ }
65
+ function getStringFromWasm0(ptr, len) {
66
+ ptr = ptr >>> 0;
67
+ return decodeText(ptr, len);
68
+ }
69
+ var heap = new Array(128).fill(void 0);
70
+ heap.push(void 0, null, true, false);
71
+ var heap_next = heap.length;
72
+ function addHeapObject(obj) {
73
+ if (heap_next === heap.length) heap.push(heap.length + 1);
74
+ const idx = heap_next;
75
+ heap_next = heap[idx];
76
+ heap[idx] = obj;
77
+ return idx;
78
+ }
79
+ function getObject(idx) {
80
+ return heap[idx];
81
+ }
82
+ var WASM_VECTOR_LEN = 0;
83
+ var cachedTextEncoder = new TextEncoder();
84
+ if (!("encodeInto" in cachedTextEncoder)) {
85
+ cachedTextEncoder.encodeInto = function(arg, view) {
86
+ const buf = cachedTextEncoder.encode(arg);
87
+ view.set(buf);
88
+ return {
89
+ read: arg.length,
90
+ written: buf.length
91
+ };
92
+ };
93
+ }
94
+ function passStringToWasm0(arg, malloc, realloc) {
95
+ if (realloc === void 0) {
96
+ const buf = cachedTextEncoder.encode(arg);
97
+ const ptr2 = malloc(buf.length, 1) >>> 0;
98
+ getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
99
+ WASM_VECTOR_LEN = buf.length;
100
+ return ptr2;
101
+ }
102
+ let len = arg.length;
103
+ let ptr = malloc(len, 1) >>> 0;
104
+ const mem = getUint8ArrayMemory0();
105
+ let offset = 0;
106
+ for (; offset < len; offset++) {
107
+ const code = arg.charCodeAt(offset);
108
+ if (code > 127) break;
109
+ mem[ptr + offset] = code;
110
+ }
111
+ if (offset !== len) {
112
+ if (offset !== 0) {
113
+ arg = arg.slice(offset);
114
+ }
115
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
116
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
117
+ const ret = cachedTextEncoder.encodeInto(arg, view);
118
+ offset += ret.written;
119
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
120
+ }
121
+ WASM_VECTOR_LEN = offset;
122
+ return ptr;
123
+ }
124
+ var cachedDataViewMemory0 = null;
125
+ function getDataViewMemory0() {
126
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
127
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
128
+ }
129
+ return cachedDataViewMemory0;
130
+ }
131
+ function isLikeNone(x) {
132
+ return x === void 0 || x === null;
133
+ }
134
+ function debugString(val) {
135
+ const type = typeof val;
136
+ if (type == "number" || type == "boolean" || val == null) {
137
+ return `${val}`;
138
+ }
139
+ if (type == "string") {
140
+ return `"${val}"`;
141
+ }
142
+ if (type == "symbol") {
143
+ const description = val.description;
144
+ if (description == null) {
145
+ return "Symbol";
146
+ } else {
147
+ return `Symbol(${description})`;
148
+ }
149
+ }
150
+ if (type == "function") {
151
+ const name = val.name;
152
+ if (typeof name == "string" && name.length > 0) {
153
+ return `Function(${name})`;
154
+ } else {
155
+ return "Function";
156
+ }
157
+ }
158
+ if (Array.isArray(val)) {
159
+ const length = val.length;
160
+ let debug = "[";
161
+ if (length > 0) {
162
+ debug += debugString(val[0]);
163
+ }
164
+ for (let i = 1; i < length; i++) {
165
+ debug += ", " + debugString(val[i]);
166
+ }
167
+ debug += "]";
168
+ return debug;
169
+ }
170
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
171
+ let className;
172
+ if (builtInMatches && builtInMatches.length > 1) {
173
+ className = builtInMatches[1];
174
+ } else {
175
+ return toString.call(val);
176
+ }
177
+ if (className == "Object") {
178
+ try {
179
+ return "Object(" + JSON.stringify(val) + ")";
180
+ } catch (_) {
181
+ return "Object";
182
+ }
183
+ }
184
+ if (val instanceof Error) {
185
+ return `${val.name}: ${val.message}
186
+ ${val.stack}`;
187
+ }
188
+ return className;
189
+ }
190
+ function handleError(f, args) {
191
+ try {
192
+ return f.apply(this, args);
193
+ } catch (e) {
194
+ wasm.__wbindgen_export3(addHeapObject(e));
195
+ }
196
+ }
197
+ function getArrayU8FromWasm0(ptr, len) {
198
+ ptr = ptr >>> 0;
199
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
200
+ }
201
+ function dropObject(idx) {
202
+ if (idx < 132) return;
203
+ heap[idx] = heap_next;
204
+ heap_next = idx;
205
+ }
206
+ function takeObject(idx) {
207
+ const ret = getObject(idx);
208
+ dropObject(idx);
209
+ return ret;
210
+ }
211
+ exports$1.verify = function(input_js, ctx_js) {
212
+ try {
213
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
214
+ wasm.verify(retptr, addHeapObject(input_js), addHeapObject(ctx_js));
215
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
216
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
217
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
218
+ if (r2) {
219
+ throw takeObject(r1);
220
+ }
221
+ return takeObject(r0);
222
+ } finally {
223
+ wasm.__wbindgen_add_to_stack_pointer(16);
224
+ }
225
+ };
226
+ exports$1.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
227
+ const ret = Error(getStringFromWasm0(arg0, arg1));
228
+ return addHeapObject(ret);
229
+ };
230
+ exports$1.__wbg_Number_bb48ca12f395cd08 = function(arg0) {
231
+ const ret = Number(getObject(arg0));
232
+ return ret;
233
+ };
234
+ exports$1.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
235
+ const ret = String(getObject(arg1));
236
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
237
+ const len1 = WASM_VECTOR_LEN;
238
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
239
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
240
+ };
241
+ exports$1.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
242
+ const v = getObject(arg1);
243
+ const ret = typeof v === "bigint" ? v : void 0;
244
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
245
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
246
+ };
247
+ exports$1.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
248
+ const v = getObject(arg0);
249
+ const ret = typeof v === "boolean" ? v : void 0;
250
+ return isLikeNone(ret) ? 16777215 : ret ? 1 : 0;
251
+ };
252
+ exports$1.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
253
+ const ret = debugString(getObject(arg1));
254
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
255
+ const len1 = WASM_VECTOR_LEN;
256
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
257
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
258
+ };
259
+ exports$1.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
260
+ const ret = getObject(arg0) in getObject(arg1);
261
+ return ret;
262
+ };
263
+ exports$1.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
264
+ const ret = typeof getObject(arg0) === "bigint";
265
+ return ret;
266
+ };
267
+ exports$1.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
268
+ const ret = typeof getObject(arg0) === "function";
269
+ return ret;
270
+ };
271
+ exports$1.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
272
+ const val = getObject(arg0);
273
+ const ret = typeof val === "object" && val !== null;
274
+ return ret;
275
+ };
276
+ exports$1.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
277
+ const ret = typeof getObject(arg0) === "string";
278
+ return ret;
279
+ };
280
+ exports$1.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
281
+ const ret = getObject(arg0) === void 0;
282
+ return ret;
283
+ };
284
+ exports$1.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
285
+ const ret = getObject(arg0) === getObject(arg1);
286
+ return ret;
287
+ };
288
+ exports$1.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
289
+ const ret = getObject(arg0) == getObject(arg1);
290
+ return ret;
291
+ };
292
+ exports$1.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
293
+ const obj = getObject(arg1);
294
+ const ret = typeof obj === "number" ? obj : void 0;
295
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
296
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
297
+ };
298
+ exports$1.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
299
+ const obj = getObject(arg1);
300
+ const ret = typeof obj === "string" ? obj : void 0;
301
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
302
+ var len1 = WASM_VECTOR_LEN;
303
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
304
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
305
+ };
306
+ exports$1.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
307
+ throw new Error(getStringFromWasm0(arg0, arg1));
308
+ };
309
+ exports$1.__wbg_call_e762c39fa8ea36bf = function() {
310
+ return handleError(function(arg0, arg1) {
311
+ const ret = getObject(arg0).call(getObject(arg1));
312
+ return addHeapObject(ret);
313
+ }, arguments);
314
+ };
315
+ exports$1.__wbg_done_2042aa2670fb1db1 = function(arg0) {
316
+ const ret = getObject(arg0).done;
317
+ return ret;
318
+ };
319
+ exports$1.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
320
+ const ret = Object.entries(getObject(arg0));
321
+ return addHeapObject(ret);
322
+ };
323
+ exports$1.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
324
+ const ret = getObject(arg0)[arg1 >>> 0];
325
+ return addHeapObject(ret);
326
+ };
327
+ exports$1.__wbg_get_efcb449f58ec27c2 = function() {
328
+ return handleError(function(arg0, arg1) {
329
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
330
+ return addHeapObject(ret);
331
+ }, arguments);
332
+ };
333
+ exports$1.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
334
+ const ret = getObject(arg0)[getObject(arg1)];
335
+ return addHeapObject(ret);
336
+ };
337
+ exports$1.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
338
+ let result;
339
+ try {
340
+ result = getObject(arg0) instanceof ArrayBuffer;
341
+ } catch (_) {
342
+ result = false;
343
+ }
344
+ const ret = result;
345
+ return ret;
346
+ };
347
+ exports$1.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
348
+ let result;
349
+ try {
350
+ result = getObject(arg0) instanceof Map;
351
+ } catch (_) {
352
+ result = false;
353
+ }
354
+ const ret = result;
355
+ return ret;
356
+ };
357
+ exports$1.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
358
+ let result;
359
+ try {
360
+ result = getObject(arg0) instanceof Uint8Array;
361
+ } catch (_) {
362
+ result = false;
363
+ }
364
+ const ret = result;
365
+ return ret;
366
+ };
367
+ exports$1.__wbg_isArray_96e0af9891d0945d = function(arg0) {
368
+ const ret = Array.isArray(getObject(arg0));
369
+ return ret;
370
+ };
371
+ exports$1.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
372
+ const ret = Number.isSafeInteger(getObject(arg0));
373
+ return ret;
374
+ };
375
+ exports$1.__wbg_iterator_e5822695327a3c39 = function() {
376
+ const ret = Symbol.iterator;
377
+ return addHeapObject(ret);
378
+ };
379
+ exports$1.__wbg_length_69bca3cb64fc8748 = function(arg0) {
380
+ const ret = getObject(arg0).length;
381
+ return ret;
382
+ };
383
+ exports$1.__wbg_length_cdd215e10d9dd507 = function(arg0) {
384
+ const ret = getObject(arg0).length;
385
+ return ret;
386
+ };
387
+ exports$1.__wbg_new_1acc0b6eea89d040 = function() {
388
+ const ret = new Object();
389
+ return addHeapObject(ret);
390
+ };
391
+ exports$1.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
392
+ const ret = new Uint8Array(getObject(arg0));
393
+ return addHeapObject(ret);
394
+ };
395
+ exports$1.__wbg_new_68651c719dcda04e = function() {
396
+ const ret = /* @__PURE__ */ new Map();
397
+ return addHeapObject(ret);
398
+ };
399
+ exports$1.__wbg_new_e17d9f43105b08be = function() {
400
+ const ret = new Array();
401
+ return addHeapObject(ret);
402
+ };
403
+ exports$1.__wbg_next_020810e0ae8ebcb0 = function() {
404
+ return handleError(function(arg0) {
405
+ const ret = getObject(arg0).next();
406
+ return addHeapObject(ret);
407
+ }, arguments);
408
+ };
409
+ exports$1.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
410
+ const ret = getObject(arg0).next;
411
+ return addHeapObject(ret);
412
+ };
413
+ exports$1.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
414
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
415
+ };
416
+ exports$1.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
417
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
418
+ };
419
+ exports$1.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
420
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
421
+ return addHeapObject(ret);
422
+ };
423
+ exports$1.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
424
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
425
+ };
426
+ exports$1.__wbg_value_692627309814bb8c = function(arg0) {
427
+ const ret = getObject(arg0).value;
428
+ return addHeapObject(ret);
429
+ };
430
+ exports$1.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
431
+ const ret = getStringFromWasm0(arg0, arg1);
432
+ return addHeapObject(ret);
433
+ };
434
+ exports$1.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
435
+ const ret = BigInt.asUintN(64, arg0);
436
+ return addHeapObject(ret);
437
+ };
438
+ exports$1.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
439
+ const ret = arg0;
440
+ return addHeapObject(ret);
441
+ };
442
+ exports$1.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
443
+ const ret = arg0;
444
+ return addHeapObject(ret);
445
+ };
446
+ exports$1.__wbindgen_object_clone_ref = function(arg0) {
447
+ const ret = getObject(arg0);
448
+ return addHeapObject(ret);
449
+ };
450
+ exports$1.__wbindgen_object_drop_ref = function(arg0) {
451
+ takeObject(arg0);
452
+ };
453
+ var wasmPath = `${__dirname$1}/kya_os_engine_bg.wasm`;
454
+ var wasmBytes = __require("fs").readFileSync(wasmPath);
455
+ var wasmModule2 = new WebAssembly.Module(wasmBytes);
456
+ var wasm = exports$1.__wasm = new WebAssembly.Instance(wasmModule2, imports).exports;
457
+ }
458
+ });
459
+
1
460
  // src/engine/index.ts
461
+ init_esm_shims();
462
+ var wasmModule = __toESM(require_kya_os_engine());
2
463
  function engineVerify(input, ctx) {
3
- const result = (void 0)(input, ctx);
4
- return result;
464
+ const verify2 = wasmModule.verify;
465
+ return verify2(input, ctx);
5
466
  }
6
467
 
7
468
  export { engineVerify };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,74 @@
1
- import { I as IDetectorOptions, a as IDetector } from './rules-detector-DjbTJ1-Q.mjs';
2
- export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, d as IDetectionInput, e as IDetectionResult, f as IPathRule, g as IPolicyLoader, h as IWasmBindings, i as IWasmLoader, P as PolicyLoadError, j as PolicyLoader, k as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.mjs';
3
- export { S as StaticWasmLoader, c as createStaticLoader } from './static-loader-Ds4iNw7c.mjs';
4
- export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-qGJacfEC.mjs';
1
+ import { h as IWasmLoader, l as IWasmBindings, a as IDetectorOptions, I as IDetector } from './rules-detector-ZIKHN-_y.mjs';
2
+ export { C as CONFIDENCE, D as DetectionClass, c as DynamicWasmLoader, F as ForgeabilityRisk, d as ICustomerPolicy, e as IDetectedAgent, b as IDetectionInput, f as IDetectionResult, m as IPathRule, g as IPolicyLoader, n as PolicyLoadError, P as PolicyLoader, o as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, i as createDynamicLoader, j as createPolicyLoader, k as createRulesDetector } from './rules-detector-ZIKHN-_y.mjs';
3
+
4
+ /**
5
+ * Static WASM Loader for Edge Runtime
6
+ *
7
+ * This loader is designed for environments that require static WASM imports,
8
+ * such as Vercel Edge Runtime and Cloudflare Workers.
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * // In your middleware.ts:
13
+ * import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
14
+ * import { StaticWasmLoader, WasmDetector } from '@kya-os/checkpoint-wasm-runtime/edge';
15
+ *
16
+ * const loader = new StaticWasmLoader(wasmModule);
17
+ * const detector = new WasmDetector(loader);
18
+ * ```
19
+ *
20
+ * The `?module` suffix tells bundlers (webpack, esbuild) to import the WASM
21
+ * as a pre-compiled WebAssembly.Module, which is required for Edge Runtime.
22
+ */
23
+
24
+ /**
25
+ * Static WASM Loader
26
+ *
27
+ * For Edge Runtime environments that require pre-compiled WASM modules.
28
+ * The consumer must provide the WASM module via a static import with `?module` suffix.
29
+ *
30
+ * This loader uses the wasm-bindgen generated JS glue code to properly
31
+ * initialize the WASM module with all required imports.
32
+ */
33
+ declare class StaticWasmLoader implements IWasmLoader {
34
+ private readonly wasmModule;
35
+ private bindings;
36
+ private loadPromise;
37
+ private wasmExports;
38
+ /**
39
+ * Create a new StaticWasmLoader
40
+ * @param wasmModule - Pre-compiled WebAssembly.Module from static import
41
+ */
42
+ constructor(wasmModule: WebAssembly.Module);
43
+ /**
44
+ * Load and instantiate the WASM module
45
+ */
46
+ load(): Promise<void>;
47
+ /**
48
+ * Internal load implementation using wasm-bindgen initSync
49
+ */
50
+ private doLoad;
51
+ /**
52
+ * Get the WASM bindings after loading
53
+ */
54
+ getBindings(): IWasmBindings;
55
+ /**
56
+ * Check if WASM is loaded
57
+ */
58
+ isLoaded(): boolean;
59
+ /**
60
+ * Get the loading strategy name
61
+ */
62
+ getStrategy(): string;
63
+ /**
64
+ * Create bindings wrapper using wasm-bindgen exports
65
+ */
66
+ private createBindings;
67
+ }
68
+ /**
69
+ * Create a static loader with validation
70
+ */
71
+ declare function createStaticLoader(wasmModule: WebAssembly.Module): StaticWasmLoader;
5
72
 
6
73
  /**
7
74
  * Create a detector with automatic runtime selection
@@ -55,4 +122,4 @@ declare function createEdgeDetector(wasmModule: WebAssembly.Module, options?: ID
55
122
  */
56
123
  declare function createFallbackDetector(): IDetector;
57
124
 
58
- export { IDetector, IDetectorOptions, createDetector, createEdgeDetector, createFallbackDetector };
125
+ export { IDetector, IDetectorOptions, IWasmBindings, IWasmLoader, StaticWasmLoader, createDetector, createEdgeDetector, createFallbackDetector, createStaticLoader };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,74 @@
1
- import { I as IDetectorOptions, a as IDetector } from './rules-detector-DjbTJ1-Q.js';
2
- export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, d as IDetectionInput, e as IDetectionResult, f as IPathRule, g as IPolicyLoader, h as IWasmBindings, i as IWasmLoader, P as PolicyLoadError, j as PolicyLoader, k as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.js';
3
- export { S as StaticWasmLoader, c as createStaticLoader } from './static-loader-C1hUlksK.js';
4
- export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-cS-pUisw.js';
1
+ import { h as IWasmLoader, l as IWasmBindings, a as IDetectorOptions, I as IDetector } from './rules-detector-ZIKHN-_y.js';
2
+ export { C as CONFIDENCE, D as DetectionClass, c as DynamicWasmLoader, F as ForgeabilityRisk, d as ICustomerPolicy, e as IDetectedAgent, b as IDetectionInput, f as IDetectionResult, m as IPathRule, g as IPolicyLoader, n as PolicyLoadError, P as PolicyLoader, o as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, i as createDynamicLoader, j as createPolicyLoader, k as createRulesDetector } from './rules-detector-ZIKHN-_y.js';
3
+
4
+ /**
5
+ * Static WASM Loader for Edge Runtime
6
+ *
7
+ * This loader is designed for environments that require static WASM imports,
8
+ * such as Vercel Edge Runtime and Cloudflare Workers.
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * // In your middleware.ts:
13
+ * import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
14
+ * import { StaticWasmLoader, WasmDetector } from '@kya-os/checkpoint-wasm-runtime/edge';
15
+ *
16
+ * const loader = new StaticWasmLoader(wasmModule);
17
+ * const detector = new WasmDetector(loader);
18
+ * ```
19
+ *
20
+ * The `?module` suffix tells bundlers (webpack, esbuild) to import the WASM
21
+ * as a pre-compiled WebAssembly.Module, which is required for Edge Runtime.
22
+ */
23
+
24
+ /**
25
+ * Static WASM Loader
26
+ *
27
+ * For Edge Runtime environments that require pre-compiled WASM modules.
28
+ * The consumer must provide the WASM module via a static import with `?module` suffix.
29
+ *
30
+ * This loader uses the wasm-bindgen generated JS glue code to properly
31
+ * initialize the WASM module with all required imports.
32
+ */
33
+ declare class StaticWasmLoader implements IWasmLoader {
34
+ private readonly wasmModule;
35
+ private bindings;
36
+ private loadPromise;
37
+ private wasmExports;
38
+ /**
39
+ * Create a new StaticWasmLoader
40
+ * @param wasmModule - Pre-compiled WebAssembly.Module from static import
41
+ */
42
+ constructor(wasmModule: WebAssembly.Module);
43
+ /**
44
+ * Load and instantiate the WASM module
45
+ */
46
+ load(): Promise<void>;
47
+ /**
48
+ * Internal load implementation using wasm-bindgen initSync
49
+ */
50
+ private doLoad;
51
+ /**
52
+ * Get the WASM bindings after loading
53
+ */
54
+ getBindings(): IWasmBindings;
55
+ /**
56
+ * Check if WASM is loaded
57
+ */
58
+ isLoaded(): boolean;
59
+ /**
60
+ * Get the loading strategy name
61
+ */
62
+ getStrategy(): string;
63
+ /**
64
+ * Create bindings wrapper using wasm-bindgen exports
65
+ */
66
+ private createBindings;
67
+ }
68
+ /**
69
+ * Create a static loader with validation
70
+ */
71
+ declare function createStaticLoader(wasmModule: WebAssembly.Module): StaticWasmLoader;
5
72
 
6
73
  /**
7
74
  * Create a detector with automatic runtime selection
@@ -55,4 +122,4 @@ declare function createEdgeDetector(wasmModule: WebAssembly.Module, options?: ID
55
122
  */
56
123
  declare function createFallbackDetector(): IDetector;
57
124
 
58
- export { IDetector, IDetectorOptions, createDetector, createEdgeDetector, createFallbackDetector };
125
+ export { IDetector, IDetectorOptions, IWasmBindings, IWasmLoader, StaticWasmLoader, createDetector, createEdgeDetector, createFallbackDetector, createStaticLoader };
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  var checkpointShared = require('@kya-os/checkpoint-shared');
4
4
 
5
+ // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.15.32_jiti@2.6.1_postcss@8.5.8_tsx@4.21.0_typescript@5.9.3_yaml@2.8.3/node_modules/tsup/assets/cjs_shims.js
6
+
5
7
  // src/types.ts
6
8
  var CONFIDENCE = {
7
9
  /** Minimum confidence for isAgent=true */
Binary file
package/dist/node.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { a as IDetector, I as IDetectorOptions, d as IDetectionInput } from './rules-detector-DjbTJ1-Q.mjs';
2
- export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, e as IDetectionResult, g as IPolicyLoader, i as IWasmLoader, j as PolicyLoader, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.mjs';
3
- export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-qGJacfEC.mjs';
1
+ import { I as IDetector, a as IDetectorOptions, b as IDetectionInput } from './rules-detector-ZIKHN-_y.mjs';
2
+ export { C as CONFIDENCE, D as DetectionClass, c as DynamicWasmLoader, F as ForgeabilityRisk, d as ICustomerPolicy, e as IDetectedAgent, f as IDetectionResult, g as IPolicyLoader, h as IWasmLoader, P as PolicyLoader, R as RulesDetector, V as VerificationMethod, W as WasmDetector, i as createDynamicLoader, j as createPolicyLoader, k as createRulesDetector } from './rules-detector-ZIKHN-_y.mjs';
4
3
 
5
4
  /**
6
5
  * Create a detector for Node.js with dynamic WASM loading
package/dist/node.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { a as IDetector, I as IDetectorOptions, d as IDetectionInput } from './rules-detector-DjbTJ1-Q.js';
2
- export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, e as IDetectionResult, g as IPolicyLoader, i as IWasmLoader, j as PolicyLoader, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.js';
3
- export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-cS-pUisw.js';
1
+ import { I as IDetector, a as IDetectorOptions, b as IDetectionInput } from './rules-detector-ZIKHN-_y.js';
2
+ export { C as CONFIDENCE, D as DetectionClass, c as DynamicWasmLoader, F as ForgeabilityRisk, d as ICustomerPolicy, e as IDetectedAgent, f as IDetectionResult, g as IPolicyLoader, h as IWasmLoader, P as PolicyLoader, R as RulesDetector, V as VerificationMethod, W as WasmDetector, i as createDynamicLoader, j as createPolicyLoader, k as createRulesDetector } from './rules-detector-ZIKHN-_y.js';
4
3
 
5
4
  /**
6
5
  * Create a detector for Node.js with dynamic WASM loading