@kya-os/checkpoint-wasm-runtime 1.1.1 → 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.
@@ -12,6 +12,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  if (typeof require !== "undefined") return require.apply(this, arguments);
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
+ var __esm = (fn, res) => function __init() {
16
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
17
+ };
15
18
  var __commonJS = (cb, mod) => function __require2() {
16
19
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
20
  };
@@ -32,9 +35,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
35
  mod
33
36
  ));
34
37
 
38
+ // ../../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
39
+ var init_cjs_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/cjs_shims.js"() {
41
+ }
42
+ });
43
+
35
44
  // wasm/kya-os-engine/kya_os_engine.js
36
45
  var require_kya_os_engine = __commonJS({
37
46
  "wasm/kya-os-engine/kya_os_engine.js"(exports$1, module) {
47
+ init_cjs_shims();
38
48
  var imports = {};
39
49
  imports["__wbindgen_placeholder__"] = module.exports;
40
50
  var cachedUint8ArrayMemory0 = null;
@@ -444,7 +454,14 @@ ${val.stack}`;
444
454
  }
445
455
  });
446
456
 
457
+ // src/engine/orchestrator/node.ts
458
+ init_cjs_shims();
459
+
460
+ // src/engine/orchestrator/verify-request.ts
461
+ init_cjs_shims();
462
+
447
463
  // src/engine/adapters/outbound-url-policy.ts
464
+ init_cjs_shims();
448
465
  var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "metadata", "metadata.google.internal"]);
449
466
  var UnsafeOutboundUrl = class extends Error {
450
467
  kind = "UnsafeOutboundUrl";
@@ -520,13 +537,18 @@ function isBlockedIpv6(hostname) {
520
537
  }
521
538
 
522
539
  // src/engine/index.ts
540
+ init_cjs_shims();
523
541
  var wasmModule = __toESM(require_kya_os_engine());
524
542
  function engineVerify(input, ctx) {
525
543
  const verify2 = wasmModule.verify;
526
544
  return verify2(input, ctx);
527
545
  }
528
546
 
547
+ // src/engine/orchestrator/build-agent-request.ts
548
+ init_cjs_shims();
549
+
529
550
  // src/engine/adapters/util.ts
551
+ init_cjs_shims();
530
552
  function base64UrlDecode(input) {
531
553
  const padded = input.replace(/-/g, "+").replace(/_/g, "/");
532
554
  const padding = padded.length % 4 === 0 ? "" : "=".repeat(4 - padded.length % 4);
@@ -821,6 +843,7 @@ function defaultLogger(msg) {
821
843
  }
822
844
 
823
845
  // src/engine/orchestrator/render-decision.ts
846
+ init_cjs_shims();
824
847
  function renderDecisionAsResponse(result) {
825
848
  const baseHeaders = buildBaseHeaders(result);
826
849
  if (result.enforcementMode === "observe") {
@@ -1,3 +1,6 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+
1
4
  var __create = Object.create;
2
5
  var __defProp = Object.defineProperty;
3
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -10,6 +13,9 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
10
13
  if (typeof require !== "undefined") return require.apply(this, arguments);
11
14
  throw Error('Dynamic require of "' + x + '" is not supported');
12
15
  });
16
+ var __esm = (fn, res) => function __init() {
17
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
+ };
13
19
  var __commonJS = (cb, mod) => function __require2() {
14
20
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
21
  };
@@ -29,10 +35,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
35
  !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
36
  mod
31
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
+ });
32
46
 
33
47
  // wasm/kya-os-engine/kya_os_engine.js
34
48
  var require_kya_os_engine = __commonJS({
35
49
  "wasm/kya-os-engine/kya_os_engine.js"(exports$1, module) {
50
+ init_esm_shims();
36
51
  var imports = {};
37
52
  imports["__wbindgen_placeholder__"] = module.exports;
38
53
  var cachedUint8ArrayMemory0 = null;
@@ -435,14 +450,21 @@ ${val.stack}`;
435
450
  exports$1.__wbindgen_object_drop_ref = function(arg0) {
436
451
  takeObject(arg0);
437
452
  };
438
- var wasmPath = `${__dirname}/kya_os_engine_bg.wasm`;
453
+ var wasmPath = `${__dirname$1}/kya_os_engine_bg.wasm`;
439
454
  var wasmBytes = __require("fs").readFileSync(wasmPath);
440
455
  var wasmModule2 = new WebAssembly.Module(wasmBytes);
441
456
  var wasm = exports$1.__wasm = new WebAssembly.Instance(wasmModule2, imports).exports;
442
457
  }
443
458
  });
444
459
 
460
+ // src/engine/orchestrator/node.ts
461
+ init_esm_shims();
462
+
463
+ // src/engine/orchestrator/verify-request.ts
464
+ init_esm_shims();
465
+
445
466
  // src/engine/adapters/outbound-url-policy.ts
467
+ init_esm_shims();
446
468
  var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "metadata", "metadata.google.internal"]);
447
469
  var UnsafeOutboundUrl = class extends Error {
448
470
  kind = "UnsafeOutboundUrl";
@@ -518,13 +540,18 @@ function isBlockedIpv6(hostname) {
518
540
  }
519
541
 
520
542
  // src/engine/index.ts
543
+ init_esm_shims();
521
544
  var wasmModule = __toESM(require_kya_os_engine());
522
545
  function engineVerify(input, ctx) {
523
546
  const verify2 = wasmModule.verify;
524
547
  return verify2(input, ctx);
525
548
  }
526
549
 
550
+ // src/engine/orchestrator/build-agent-request.ts
551
+ init_esm_shims();
552
+
527
553
  // src/engine/adapters/util.ts
554
+ init_esm_shims();
528
555
  function base64UrlDecode(input) {
529
556
  const padded = input.replace(/-/g, "+").replace(/_/g, "/");
530
557
  const padding = padded.length % 4 === 0 ? "" : "=".repeat(4 - padded.length % 4);
@@ -819,6 +846,7 @@ function defaultLogger(msg) {
819
846
  }
820
847
 
821
848
  // src/engine/orchestrator/render-decision.ts
849
+ init_esm_shims();
822
850
  function renderDecisionAsResponse(result) {
823
851
  const baseHeaders = buildBaseHeaders(result);
824
852
  if (result.enforcementMode === "observe") {
@@ -1,7 +1,87 @@
1
- export { makeVerifyRequest, verifyRequest } from './orchestrator-node.mjs';
2
- export { makeVerifyRequestEdge, verifyRequestEdge } from './orchestrator-edge.mjs';
3
- export { B as BuildAgentRequestOpts, I as IncomingHttpLike, R as RenderedResponse, V as VerifyRequestOpts, b as buildAgentRequest, e as extractAgentDid, a as extractCredentialStatusUrl, c as extractIssuer, h as hasMalformedJwsBody, r as renderDecisionAsResponse } from './render-decision-C1a-iuiW.mjs';
4
- export { initEngineEdge } from './engine-edge.mjs';
5
- import './types-D0j85fF0.mjs';
1
+ import { VerifyRequestOpts, IncomingHttpLike } from './orchestrator-node.mjs';
2
+ export { BuildAgentRequestOpts, RenderedResponse, buildAgentRequest, extractAgentDid, extractCredentialStatusUrl, extractIssuer, hasMalformedJwsBody, makeVerifyRequest, renderDecisionAsResponse, verifyRequest } from './orchestrator-node.mjs';
3
+ import { V as VerifyResult } from './types-D0j85fF0.mjs';
6
4
  import '@kya-os/checkpoint-shared';
7
- import './adapters.mjs';
5
+
6
+ /**
7
+ * `kya-os-engine` WASM bridge for edge runtimes — Edge-WASM-1.
8
+ *
9
+ * The Node target (`./index.ts`) uses `fs.readFileSync` at module
10
+ * load and exposes a sync `engineVerify`. That's incompatible with
11
+ * Vercel Edge / Cloudflare Workers / browser embedding (no `fs`,
12
+ * no sync wasm load).
13
+ *
14
+ * This module loads the `wasm-pack --target web` artifact via the
15
+ * async `__wbg_init` default export, then exposes the same typed
16
+ * `engineVerifyEdge(input, ctx) → Promise<VerifyResult>` shape with
17
+ * a small lazy-init wrapper. First call awaits initialisation;
18
+ * subsequent calls resolve synchronously on the JS side (the
19
+ * underlying wasm `verify` is sync).
20
+ *
21
+ * **Why this matters for the consolidation narrative.** Phase A
22
+ * shipped Node-only. Without an edge build, the first Vercel-edge
23
+ * or Cloudflare-Workers deployment after Phase D would hit the
24
+ * same wasm-bindgen-on-edge wall the Sites-1 F3 workaround was
25
+ * created to dodge — and someone would re-introduce the
26
+ * inline-TS detector that Q10 ratified deleting. Shipping the
27
+ * edge target alongside the Node target keeps Phase D's
28
+ * deletion narrative durable.
29
+ */
30
+
31
+ /**
32
+ * Initialise the edge wasm module. Idempotent — subsequent calls
33
+ * return the same in-flight or resolved promise. Host wrappers can
34
+ * call this at startup to eagerly load the wasm and avoid first-
35
+ * request latency, but it's not required: `engineVerifyEdge`
36
+ * lazily initialises on first call.
37
+ *
38
+ * @param moduleOrPath Optional pre-fetched `WebAssembly.Module` or
39
+ * a URL / Request the wasm-bindgen loader will
40
+ * fetch. Defaults to the bundled artifact via
41
+ * `import.meta.url`. Cloudflare Workers / Vercel
42
+ * Edge typically pass a pre-bundled `Module`.
43
+ */
44
+ declare function initEngineEdge(moduleOrPath?: WebAssembly.Module | URL | string | Request | BufferSource): Promise<void>;
45
+
46
+ /**
47
+ * `verifyRequestEdge` async-init orchestrator — Edge-WASM-2 (folded into
48
+ * Phase D's PR).
49
+ *
50
+ * Mirror of [[./verify-request.ts]] for edge runtimes. Differs in only
51
+ * three places:
52
+ *
53
+ * 1. Imports `engineVerifyEdge` + `initEngineEdge` from `../edge`
54
+ * instead of `engineVerify` from `../index` (Node target).
55
+ * 2. Awaits `initEngineEdge()` before the engine call — async-init
56
+ * pattern required by the `--target web` wasm-bindgen build.
57
+ * 3. The final engine call is `await engineVerifyEdge(...)` rather
58
+ * than the synchronous `engineVerify(...)`.
59
+ *
60
+ * **The two files MUST stay in sync.** Any change to verify-request.ts
61
+ * (new adapter, new error-classification rule, new ContextSpec field)
62
+ * MUST be mirrored here. The cross-target parity test in
63
+ * [[__tests__/verify-request-parity.test.ts]] guards the verdict-shape
64
+ * invariant — both orchestrators must produce identical
65
+ * `VerifyResult.decision` / `engineInfo.name` on identical inputs.
66
+ *
67
+ * Cedar-1 forward-compat: same seam as the Node variant — step (5)
68
+ * (tenant policy eval) is the only place the PolicyEvaluator
69
+ * interface gets exercised. When Cedar-1 swaps implementations, this
70
+ * orchestrator does not change.
71
+ */
72
+
73
+ /**
74
+ * Factory — constructs a `verifyRequestEdge` closure that remembers the
75
+ * one-shot Argus-not-configured warning state. Use this when the
76
+ * host wrapper wants the startup log; call `verifyRequestEdge` directly
77
+ * (the loose function below) if you don't.
78
+ */
79
+ declare function makeVerifyRequestEdge(opts: VerifyRequestOpts): (req: IncomingHttpLike) => Promise<VerifyResult>;
80
+ /**
81
+ * Single-shot async entry. Use [`makeVerifyRequestEdge`] in long-lived
82
+ * hosts (so the Argus warning is one-shot per process); use this
83
+ * loose form in tests + one-off invocations.
84
+ */
85
+ declare function verifyRequestEdge(req: IncomingHttpLike, opts: VerifyRequestOpts): Promise<VerifyResult>;
86
+
87
+ export { IncomingHttpLike, VerifyRequestOpts, initEngineEdge, makeVerifyRequestEdge, verifyRequestEdge };
@@ -1,7 +1,87 @@
1
- export { makeVerifyRequest, verifyRequest } from './orchestrator-node.js';
2
- export { makeVerifyRequestEdge, verifyRequestEdge } from './orchestrator-edge.js';
3
- export { B as BuildAgentRequestOpts, I as IncomingHttpLike, R as RenderedResponse, V as VerifyRequestOpts, b as buildAgentRequest, e as extractAgentDid, a as extractCredentialStatusUrl, c as extractIssuer, h as hasMalformedJwsBody, r as renderDecisionAsResponse } from './render-decision-Dsjwt96g.js';
4
- export { initEngineEdge } from './engine-edge.js';
5
- import './types-D0j85fF0.js';
1
+ import { VerifyRequestOpts, IncomingHttpLike } from './orchestrator-node.js';
2
+ export { BuildAgentRequestOpts, RenderedResponse, buildAgentRequest, extractAgentDid, extractCredentialStatusUrl, extractIssuer, hasMalformedJwsBody, makeVerifyRequest, renderDecisionAsResponse, verifyRequest } from './orchestrator-node.js';
3
+ import { V as VerifyResult } from './types-D0j85fF0.js';
6
4
  import '@kya-os/checkpoint-shared';
7
- import './adapters.js';
5
+
6
+ /**
7
+ * `kya-os-engine` WASM bridge for edge runtimes — Edge-WASM-1.
8
+ *
9
+ * The Node target (`./index.ts`) uses `fs.readFileSync` at module
10
+ * load and exposes a sync `engineVerify`. That's incompatible with
11
+ * Vercel Edge / Cloudflare Workers / browser embedding (no `fs`,
12
+ * no sync wasm load).
13
+ *
14
+ * This module loads the `wasm-pack --target web` artifact via the
15
+ * async `__wbg_init` default export, then exposes the same typed
16
+ * `engineVerifyEdge(input, ctx) → Promise<VerifyResult>` shape with
17
+ * a small lazy-init wrapper. First call awaits initialisation;
18
+ * subsequent calls resolve synchronously on the JS side (the
19
+ * underlying wasm `verify` is sync).
20
+ *
21
+ * **Why this matters for the consolidation narrative.** Phase A
22
+ * shipped Node-only. Without an edge build, the first Vercel-edge
23
+ * or Cloudflare-Workers deployment after Phase D would hit the
24
+ * same wasm-bindgen-on-edge wall the Sites-1 F3 workaround was
25
+ * created to dodge — and someone would re-introduce the
26
+ * inline-TS detector that Q10 ratified deleting. Shipping the
27
+ * edge target alongside the Node target keeps Phase D's
28
+ * deletion narrative durable.
29
+ */
30
+
31
+ /**
32
+ * Initialise the edge wasm module. Idempotent — subsequent calls
33
+ * return the same in-flight or resolved promise. Host wrappers can
34
+ * call this at startup to eagerly load the wasm and avoid first-
35
+ * request latency, but it's not required: `engineVerifyEdge`
36
+ * lazily initialises on first call.
37
+ *
38
+ * @param moduleOrPath Optional pre-fetched `WebAssembly.Module` or
39
+ * a URL / Request the wasm-bindgen loader will
40
+ * fetch. Defaults to the bundled artifact via
41
+ * `import.meta.url`. Cloudflare Workers / Vercel
42
+ * Edge typically pass a pre-bundled `Module`.
43
+ */
44
+ declare function initEngineEdge(moduleOrPath?: WebAssembly.Module | URL | string | Request | BufferSource): Promise<void>;
45
+
46
+ /**
47
+ * `verifyRequestEdge` async-init orchestrator — Edge-WASM-2 (folded into
48
+ * Phase D's PR).
49
+ *
50
+ * Mirror of [[./verify-request.ts]] for edge runtimes. Differs in only
51
+ * three places:
52
+ *
53
+ * 1. Imports `engineVerifyEdge` + `initEngineEdge` from `../edge`
54
+ * instead of `engineVerify` from `../index` (Node target).
55
+ * 2. Awaits `initEngineEdge()` before the engine call — async-init
56
+ * pattern required by the `--target web` wasm-bindgen build.
57
+ * 3. The final engine call is `await engineVerifyEdge(...)` rather
58
+ * than the synchronous `engineVerify(...)`.
59
+ *
60
+ * **The two files MUST stay in sync.** Any change to verify-request.ts
61
+ * (new adapter, new error-classification rule, new ContextSpec field)
62
+ * MUST be mirrored here. The cross-target parity test in
63
+ * [[__tests__/verify-request-parity.test.ts]] guards the verdict-shape
64
+ * invariant — both orchestrators must produce identical
65
+ * `VerifyResult.decision` / `engineInfo.name` on identical inputs.
66
+ *
67
+ * Cedar-1 forward-compat: same seam as the Node variant — step (5)
68
+ * (tenant policy eval) is the only place the PolicyEvaluator
69
+ * interface gets exercised. When Cedar-1 swaps implementations, this
70
+ * orchestrator does not change.
71
+ */
72
+
73
+ /**
74
+ * Factory — constructs a `verifyRequestEdge` closure that remembers the
75
+ * one-shot Argus-not-configured warning state. Use this when the
76
+ * host wrapper wants the startup log; call `verifyRequestEdge` directly
77
+ * (the loose function below) if you don't.
78
+ */
79
+ declare function makeVerifyRequestEdge(opts: VerifyRequestOpts): (req: IncomingHttpLike) => Promise<VerifyResult>;
80
+ /**
81
+ * Single-shot async entry. Use [`makeVerifyRequestEdge`] in long-lived
82
+ * hosts (so the Argus warning is one-shot per process); use this
83
+ * loose form in tests + one-off invocations.
84
+ */
85
+ declare function verifyRequestEdge(req: IncomingHttpLike, opts: VerifyRequestOpts): Promise<VerifyResult>;
86
+
87
+ export { IncomingHttpLike, VerifyRequestOpts, initEngineEdge, makeVerifyRequestEdge, verifyRequestEdge };
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -40,9 +39,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
39
  mod
41
40
  ));
42
41
 
42
+ // ../../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
43
+ var getImportMetaUrl, importMetaUrl;
44
+ var init_cjs_shims = __esm({
45
+ "../../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"() {
46
+ getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
47
+ importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
48
+ }
49
+ });
50
+
43
51
  // wasm/kya-os-engine/kya_os_engine.js
44
52
  var require_kya_os_engine = __commonJS({
45
53
  "wasm/kya-os-engine/kya_os_engine.js"(exports$1, module) {
54
+ init_cjs_shims();
46
55
  var imports = {};
47
56
  imports["__wbindgen_placeholder__"] = module.exports;
48
57
  var cachedUint8ArrayMemory02 = null;
@@ -909,7 +918,7 @@ async function __wbg_init(module_or_path) {
909
918
  }
910
919
  }
911
920
  if (typeof module_or_path === "undefined") {
912
- module_or_path = new URL("kya_os_engine_bg.wasm", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('orchestrator.js', document.baseURI).href)));
921
+ module_or_path = new URL("kya_os_engine_bg.wasm", importMetaUrl);
913
922
  }
914
923
  const imports = __wbg_get_imports();
915
924
  if (typeof module_or_path === "string" || typeof Request === "function" && module_or_path instanceof Request || typeof URL === "function" && module_or_path instanceof URL) {
@@ -921,6 +930,7 @@ async function __wbg_init(module_or_path) {
921
930
  var wasm, cachedUint8ArrayMemory0, cachedTextDecoder, MAX_SAFARI_DECODE_BYTES, numBytesDecoded, heap, heap_next, WASM_VECTOR_LEN, cachedTextEncoder, cachedDataViewMemory0, EXPECTED_RESPONSE_TYPES, kya_os_engine_default;
922
931
  var init_kya_os_engine = __esm({
923
932
  "wasm/kya-os-engine-web/kya_os_engine.js"() {
933
+ init_cjs_shims();
924
934
  cachedUint8ArrayMemory0 = null;
925
935
  cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
926
936
  cachedTextDecoder.decode();
@@ -947,7 +957,14 @@ var init_kya_os_engine = __esm({
947
957
  }
948
958
  });
949
959
 
960
+ // src/engine/orchestrator/index.ts
961
+ init_cjs_shims();
962
+
963
+ // src/engine/orchestrator/verify-request.ts
964
+ init_cjs_shims();
965
+
950
966
  // src/engine/adapters/outbound-url-policy.ts
967
+ init_cjs_shims();
951
968
  var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "metadata", "metadata.google.internal"]);
952
969
  var UnsafeOutboundUrl = class extends Error {
953
970
  kind = "UnsafeOutboundUrl";
@@ -1023,13 +1040,18 @@ function isBlockedIpv6(hostname) {
1023
1040
  }
1024
1041
 
1025
1042
  // src/engine/index.ts
1043
+ init_cjs_shims();
1026
1044
  var wasmModule = __toESM(require_kya_os_engine());
1027
1045
  function engineVerify(input, ctx) {
1028
1046
  const verify3 = wasmModule.verify;
1029
1047
  return verify3(input, ctx);
1030
1048
  }
1031
1049
 
1050
+ // src/engine/orchestrator/build-agent-request.ts
1051
+ init_cjs_shims();
1052
+
1032
1053
  // src/engine/adapters/util.ts
1054
+ init_cjs_shims();
1033
1055
  function base64UrlDecode(input) {
1034
1056
  const padded = input.replace(/-/g, "+").replace(/_/g, "/");
1035
1057
  const padding = padded.length % 4 === 0 ? "" : "=".repeat(4 - padded.length % 4);
@@ -1323,7 +1345,11 @@ function defaultLogger(msg) {
1323
1345
  console.warn(msg);
1324
1346
  }
1325
1347
 
1348
+ // src/engine/orchestrator/verify-request-edge.ts
1349
+ init_cjs_shims();
1350
+
1326
1351
  // src/engine/edge.ts
1352
+ init_cjs_shims();
1327
1353
  var initialised = null;
1328
1354
  function initEngineEdge(moduleOrPath) {
1329
1355
  return ensureReady(moduleOrPath).then(() => void 0);
@@ -1349,6 +1375,7 @@ async function engineVerifyEdge(input, ctx) {
1349
1375
  }
1350
1376
 
1351
1377
  // src/engine/orchestrator/render-decision.ts
1378
+ init_cjs_shims();
1352
1379
  function renderDecisionAsResponse(result) {
1353
1380
  const baseHeaders = buildBaseHeaders(result);
1354
1381
  if (result.enforcementMode === "observe") {
@@ -1,3 +1,6 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+
1
4
  var __create = Object.create;
2
5
  var __defProp = Object.defineProperty;
3
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -36,10 +39,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
36
39
  !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
40
  mod
38
41
  ));
42
+ var getFilename, getDirname, __dirname$1;
43
+ var init_esm_shims = __esm({
44
+ "../../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"() {
45
+ getFilename = () => fileURLToPath(import.meta.url);
46
+ getDirname = () => path.dirname(getFilename());
47
+ __dirname$1 = /* @__PURE__ */ getDirname();
48
+ }
49
+ });
39
50
 
40
51
  // wasm/kya-os-engine/kya_os_engine.js
41
52
  var require_kya_os_engine = __commonJS({
42
53
  "wasm/kya-os-engine/kya_os_engine.js"(exports$1, module) {
54
+ init_esm_shims();
43
55
  var imports = {};
44
56
  imports["__wbindgen_placeholder__"] = module.exports;
45
57
  var cachedUint8ArrayMemory02 = null;
@@ -442,7 +454,7 @@ ${val.stack}`;
442
454
  exports$1.__wbindgen_object_drop_ref = function(arg0) {
443
455
  takeObject2(arg0);
444
456
  };
445
- var wasmPath = `${__dirname}/kya_os_engine_bg.wasm`;
457
+ var wasmPath = `${__dirname$1}/kya_os_engine_bg.wasm`;
446
458
  var wasmBytes = __require("fs").readFileSync(wasmPath);
447
459
  var wasmModule2 = new WebAssembly.Module(wasmBytes);
448
460
  var wasm2 = exports$1.__wasm = new WebAssembly.Instance(wasmModule2, imports).exports;
@@ -918,6 +930,7 @@ async function __wbg_init(module_or_path) {
918
930
  var wasm, cachedUint8ArrayMemory0, cachedTextDecoder, MAX_SAFARI_DECODE_BYTES, numBytesDecoded, heap, heap_next, WASM_VECTOR_LEN, cachedTextEncoder, cachedDataViewMemory0, EXPECTED_RESPONSE_TYPES, kya_os_engine_default;
919
931
  var init_kya_os_engine = __esm({
920
932
  "wasm/kya-os-engine-web/kya_os_engine.js"() {
933
+ init_esm_shims();
921
934
  cachedUint8ArrayMemory0 = null;
922
935
  cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
923
936
  cachedTextDecoder.decode();
@@ -944,7 +957,14 @@ var init_kya_os_engine = __esm({
944
957
  }
945
958
  });
946
959
 
960
+ // src/engine/orchestrator/index.ts
961
+ init_esm_shims();
962
+
963
+ // src/engine/orchestrator/verify-request.ts
964
+ init_esm_shims();
965
+
947
966
  // src/engine/adapters/outbound-url-policy.ts
967
+ init_esm_shims();
948
968
  var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "metadata", "metadata.google.internal"]);
949
969
  var UnsafeOutboundUrl = class extends Error {
950
970
  kind = "UnsafeOutboundUrl";
@@ -1020,13 +1040,18 @@ function isBlockedIpv6(hostname) {
1020
1040
  }
1021
1041
 
1022
1042
  // src/engine/index.ts
1043
+ init_esm_shims();
1023
1044
  var wasmModule = __toESM(require_kya_os_engine());
1024
1045
  function engineVerify(input, ctx) {
1025
1046
  const verify3 = wasmModule.verify;
1026
1047
  return verify3(input, ctx);
1027
1048
  }
1028
1049
 
1050
+ // src/engine/orchestrator/build-agent-request.ts
1051
+ init_esm_shims();
1052
+
1029
1053
  // src/engine/adapters/util.ts
1054
+ init_esm_shims();
1030
1055
  function base64UrlDecode(input) {
1031
1056
  const padded = input.replace(/-/g, "+").replace(/_/g, "/");
1032
1057
  const padding = padded.length % 4 === 0 ? "" : "=".repeat(4 - padded.length % 4);
@@ -1320,7 +1345,11 @@ function defaultLogger(msg) {
1320
1345
  console.warn(msg);
1321
1346
  }
1322
1347
 
1348
+ // src/engine/orchestrator/verify-request-edge.ts
1349
+ init_esm_shims();
1350
+
1323
1351
  // src/engine/edge.ts
1352
+ init_esm_shims();
1324
1353
  var initialised = null;
1325
1354
  function initEngineEdge(moduleOrPath) {
1326
1355
  return ensureReady(moduleOrPath).then(() => void 0);
@@ -1346,6 +1375,7 @@ async function engineVerifyEdge(input, ctx) {
1346
1375
  }
1347
1376
 
1348
1377
  // src/engine/orchestrator/render-decision.ts
1378
+ init_esm_shims();
1349
1379
  function renderDecisionAsResponse(result) {
1350
1380
  const baseHeaders = buildBaseHeaders(result);
1351
1381
  if (result.enforcementMode === "observe") {
@@ -315,6 +315,68 @@ declare class WasmDetector implements IDetector {
315
315
  private createDefaultResult;
316
316
  }
317
317
 
318
+ /**
319
+ * Dynamic WASM Loader for Node.js
320
+ *
321
+ * This loader dynamically loads and compiles WASM at runtime,
322
+ * which is supported in Node.js but NOT in Edge Runtime.
323
+ *
324
+ * Usage:
325
+ * ```typescript
326
+ * import { DynamicWasmLoader, WasmDetector } from '@kya-os/checkpoint-wasm-runtime/node';
327
+ *
328
+ * const loader = new DynamicWasmLoader();
329
+ * const detector = new WasmDetector(loader);
330
+ * ```
331
+ */
332
+
333
+ /**
334
+ * Dynamic WASM Loader
335
+ *
336
+ * For Node.js environments that support dynamic WASM compilation.
337
+ * Automatically finds and loads the WASM module.
338
+ */
339
+ declare class DynamicWasmLoader implements IWasmLoader {
340
+ private readonly wasmPath?;
341
+ private bindings;
342
+ private instance;
343
+ private loadPromise;
344
+ /**
345
+ * Create a new DynamicWasmLoader
346
+ * @param wasmPath - Optional custom path to WASM file
347
+ */
348
+ constructor(wasmPath?: string | undefined);
349
+ /**
350
+ * Load and compile the WASM module
351
+ */
352
+ load(): Promise<void>;
353
+ private doLoad;
354
+ /**
355
+ * Get the WASM bindings after loading
356
+ */
357
+ getBindings(): IWasmBindings;
358
+ /**
359
+ * Check if WASM is loaded
360
+ */
361
+ isLoaded(): boolean;
362
+ /**
363
+ * Get the loading strategy name
364
+ */
365
+ getStrategy(): string;
366
+ /**
367
+ * Create wasm-bindgen required imports
368
+ */
369
+ private createWasmBindgenImports;
370
+ /**
371
+ * Create bindings wrapper from WASM exports
372
+ */
373
+ private createBindings;
374
+ }
375
+ /**
376
+ * Create a dynamic loader
377
+ */
378
+ declare function createDynamicLoader(wasmPath?: string): DynamicWasmLoader;
379
+
318
380
  /**
319
381
  * Policy Loader
320
382
  *
@@ -467,4 +529,4 @@ declare class RulesDetector implements IDetector {
467
529
  */
468
530
  declare function createRulesDetector(): RulesDetector;
469
531
 
470
- export { CONFIDENCE as C, type DetectionClass as D, type ForgeabilityRisk as F, type IDetectorOptions as I, PolicyLoadError as P, RulesDetector as R, type VerificationMethod as V, WasmDetector as W, type IDetector as a, type ICustomerPolicy as b, type IDetectedAgent as c, type IDetectionInput as d, type IDetectionResult as e, type IPathRule as f, type IPolicyLoader as g, type IWasmBindings as h, type IWasmLoader as i, PolicyLoader as j, type PolicyLoaderConfig as k, createPolicyLoader as l, createRulesDetector as m };
532
+ export { CONFIDENCE as C, type DetectionClass as D, type ForgeabilityRisk as F, type IDetector as I, PolicyLoader as P, RulesDetector as R, type VerificationMethod as V, WasmDetector as W, type IDetectorOptions as a, type IDetectionInput as b, DynamicWasmLoader as c, type ICustomerPolicy as d, type IDetectedAgent as e, type IDetectionResult as f, type IPolicyLoader as g, type IWasmLoader as h, createDynamicLoader as i, createPolicyLoader as j, createRulesDetector as k, type IWasmBindings as l, type IPathRule as m, PolicyLoadError as n, type PolicyLoaderConfig as o };