@kya-os/checkpoint-nextjs 1.10.0 → 1.12.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.
Files changed (214) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/README.md +217 -35
  3. package/dist/{adapt.mjs → adapt-BvqYgrAk.mjs} +15 -4
  4. package/dist/adapt-BvqYgrAk.mjs.map +1 -0
  5. package/dist/{adapt.js → adapt-DUEIfZnx.js} +34 -13
  6. package/dist/api-client-JHOrRUA_.d.mts +222 -0
  7. package/dist/api-client-JHOrRUA_.d.mts.map +1 -0
  8. package/dist/api-client-JHOrRUA_.d.ts +222 -0
  9. package/dist/api-client-JHOrRUA_.d.ts.map +1 -0
  10. package/dist/api-client.d.mts +2 -204
  11. package/dist/api-client.d.ts +2 -204
  12. package/dist/api-client.js +19 -18
  13. package/dist/api-client.mjs +20 -16
  14. package/dist/api-client.mjs.map +1 -1
  15. package/dist/api-middleware-BtsYJU5u.d.mts +131 -0
  16. package/dist/api-middleware-BtsYJU5u.d.mts.map +1 -0
  17. package/dist/{api-middleware-CMDRoQik.mjs → api-middleware-DvmkJ_Li.mjs} +68 -38
  18. package/dist/api-middleware-DvmkJ_Li.mjs.map +1 -0
  19. package/dist/api-middleware-DyLDqOYF.d.ts +131 -0
  20. package/dist/api-middleware-DyLDqOYF.d.ts.map +1 -0
  21. package/dist/{api-middleware-CDSh3TSE.js → api-middleware-beNlXd5P.js} +75 -63
  22. package/dist/api-middleware.d.mts +2 -152
  23. package/dist/api-middleware.d.ts +2 -152
  24. package/dist/api-middleware.js +1 -5
  25. package/dist/api-middleware.mjs +2 -3
  26. package/dist/cedar-wasm.d.mts +20 -0
  27. package/dist/cedar-wasm.d.mts.map +1 -0
  28. package/dist/cedar-wasm.d.ts +19 -0
  29. package/dist/cedar-wasm.d.ts.map +1 -0
  30. package/dist/cedar-wasm.js +24 -0
  31. package/dist/cedar-wasm.mjs +23 -0
  32. package/dist/cedar-wasm.mjs.map +1 -0
  33. package/dist/config-D7h2w_it.d.mts +89 -0
  34. package/dist/config-D7h2w_it.d.mts.map +1 -0
  35. package/dist/config-DkXvl4nH.d.ts +89 -0
  36. package/dist/config-DkXvl4nH.d.ts.map +1 -0
  37. package/dist/engine-wasm.d.mts +20 -0
  38. package/dist/engine-wasm.d.mts.map +1 -0
  39. package/dist/engine-wasm.d.ts +19 -0
  40. package/dist/engine-wasm.d.ts.map +1 -0
  41. package/dist/engine-wasm.js +24 -0
  42. package/dist/engine-wasm.mjs +23 -0
  43. package/dist/engine-wasm.mjs.map +1 -0
  44. package/dist/index-edge.d.mts +8 -0
  45. package/dist/index-edge.d.ts +8 -0
  46. package/dist/index-edge.js +14 -0
  47. package/dist/index-edge.mjs +7 -0
  48. package/dist/index.d.mts +8 -10
  49. package/dist/index.d.ts +8 -10
  50. package/dist/index.js +20 -49
  51. package/dist/index.mjs +21 -8
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/middleware-bundler.d.mts +1 -1
  54. package/dist/middleware-bundler.d.mts.map +1 -1
  55. package/dist/middleware-bundler.d.ts +1 -1
  56. package/dist/middleware-bundler.d.ts.map +1 -1
  57. package/dist/middleware-bundler.js +5 -5
  58. package/dist/middleware-bundler.mjs +5 -5
  59. package/dist/middleware-bundler.mjs.map +1 -1
  60. package/dist/middleware-core-B1GuspOY.js +169 -0
  61. package/dist/middleware-core-BmW2kH8J.d.ts +14 -0
  62. package/dist/middleware-core-BmW2kH8J.d.ts.map +1 -0
  63. package/dist/middleware-core-CnPUoD2v.d.mts +14 -0
  64. package/dist/middleware-core-CnPUoD2v.d.mts.map +1 -0
  65. package/dist/middleware-core-WZeMSRqx.mjs +159 -0
  66. package/dist/middleware-core-WZeMSRqx.mjs.map +1 -0
  67. package/dist/middleware-edge.d.mts +11 -3
  68. package/dist/middleware-edge.d.mts.map +1 -1
  69. package/dist/middleware-edge.d.ts +11 -3
  70. package/dist/middleware-edge.d.ts.map +1 -1
  71. package/dist/middleware-edge.js +68 -29
  72. package/dist/middleware-edge.mjs +68 -31
  73. package/dist/middleware-edge.mjs.map +1 -1
  74. package/dist/middleware-node-context-BvqrL2Ra.mjs +16 -0
  75. package/dist/middleware-node-context-BvqrL2Ra.mjs.map +1 -0
  76. package/dist/middleware-node-context-TRMTgp3y.js +20 -0
  77. package/dist/middleware-node.d.mts +12 -3
  78. package/dist/middleware-node.d.mts.map +1 -0
  79. package/dist/middleware-node.d.ts +12 -3
  80. package/dist/middleware-node.d.ts.map +1 -0
  81. package/dist/middleware-node.js +14 -6
  82. package/dist/middleware-node.mjs +14 -6
  83. package/dist/middleware-node.mjs.map +1 -1
  84. package/dist/posture-outcome-Ccujx_9V.d.mts +14 -0
  85. package/dist/posture-outcome-Ccujx_9V.d.mts.map +1 -0
  86. package/dist/posture-outcome-Ccujx_9V.d.ts +14 -0
  87. package/dist/posture-outcome-Ccujx_9V.d.ts.map +1 -0
  88. package/dist/posture-outcome-DQ4fdMfq.mjs +21 -0
  89. package/dist/posture-outcome-DQ4fdMfq.mjs.map +1 -0
  90. package/dist/posture-outcome-DddsJtL8.js +25 -0
  91. package/dist/public-api-Cw7Zj290.d.ts +5 -0
  92. package/dist/public-api-DgCw1uo6.d.mts +5 -0
  93. package/dist/rolldown-runtime-C24Yb2bl.js +33 -0
  94. package/dist/utils-Cnwg0VrY.mjs +88 -0
  95. package/dist/utils-Cnwg0VrY.mjs.map +1 -0
  96. package/dist/utils-dyFxqlFI.js +104 -0
  97. package/package.json +27 -62
  98. package/EDGE_RUNTIME_WASM_SETUP.md +0 -342
  99. package/bin/setup-edge-wasm.js +0 -513
  100. package/dist/adapt.d.mts +0 -11
  101. package/dist/adapt.d.mts.map +0 -1
  102. package/dist/adapt.d.ts +0 -11
  103. package/dist/adapt.d.ts.map +0 -1
  104. package/dist/adapt.mjs.map +0 -1
  105. package/dist/api-client.d.mts.map +0 -1
  106. package/dist/api-client.d.ts.map +0 -1
  107. package/dist/api-middleware-CMDRoQik.mjs.map +0 -1
  108. package/dist/api-middleware.d.mts.map +0 -1
  109. package/dist/api-middleware.d.ts.map +0 -1
  110. package/dist/composed-policy-BCaNiVHv.d.mts +0 -98
  111. package/dist/composed-policy-BCaNiVHv.d.mts.map +0 -1
  112. package/dist/composed-policy-zzJYNFTb.d.ts +0 -98
  113. package/dist/composed-policy-zzJYNFTb.d.ts.map +0 -1
  114. package/dist/composed-policy.d.mts +0 -2
  115. package/dist/composed-policy.d.ts +0 -2
  116. package/dist/composed-policy.js +0 -136
  117. package/dist/composed-policy.mjs +0 -132
  118. package/dist/composed-policy.mjs.map +0 -1
  119. package/dist/config-CbAg2mze.d.ts +0 -255
  120. package/dist/config-CbAg2mze.d.ts.map +0 -1
  121. package/dist/config-Doe0Tn53.d.mts +0 -255
  122. package/dist/config-Doe0Tn53.d.mts.map +0 -1
  123. package/dist/create-middleware.d.mts +0 -11
  124. package/dist/create-middleware.d.mts.map +0 -1
  125. package/dist/create-middleware.d.ts +0 -11
  126. package/dist/create-middleware.d.ts.map +0 -1
  127. package/dist/create-middleware.js +0 -39
  128. package/dist/create-middleware.mjs +0 -38
  129. package/dist/create-middleware.mjs.map +0 -1
  130. package/dist/edge/index.d.mts +0 -88
  131. package/dist/edge/index.d.mts.map +0 -1
  132. package/dist/edge/index.d.ts +0 -88
  133. package/dist/edge/index.d.ts.map +0 -1
  134. package/dist/edge/index.js +0 -362
  135. package/dist/edge/index.mjs +0 -362
  136. package/dist/edge/index.mjs.map +0 -1
  137. package/dist/edge-runtime-loader.d.mts +0 -49
  138. package/dist/edge-runtime-loader.d.mts.map +0 -1
  139. package/dist/edge-runtime-loader.d.ts +0 -49
  140. package/dist/edge-runtime-loader.d.ts.map +0 -1
  141. package/dist/edge-runtime-loader.js +0 -297
  142. package/dist/edge-runtime-loader.mjs +0 -292
  143. package/dist/edge-runtime-loader.mjs.map +0 -1
  144. package/dist/edge-wasm-middleware.d.mts +0 -43
  145. package/dist/edge-wasm-middleware.d.mts.map +0 -1
  146. package/dist/edge-wasm-middleware.d.ts +0 -43
  147. package/dist/edge-wasm-middleware.d.ts.map +0 -1
  148. package/dist/edge-wasm-middleware.js +0 -37
  149. package/dist/edge-wasm-middleware.mjs +0 -35
  150. package/dist/edge-wasm-middleware.mjs.map +0 -1
  151. package/dist/middleware-core-BYQP9FND.mjs +0 -165
  152. package/dist/middleware-core-BYQP9FND.mjs.map +0 -1
  153. package/dist/middleware-core-D6TijE6P.js +0 -175
  154. package/dist/middleware-node-CE4GevYs.d.ts +0 -20
  155. package/dist/middleware-node-CE4GevYs.d.ts.map +0 -1
  156. package/dist/middleware-node-DtyOuPta.d.mts +0 -20
  157. package/dist/middleware-node-DtyOuPta.d.mts.map +0 -1
  158. package/dist/middleware-node-context-BqPbf-fI.mjs +0 -34
  159. package/dist/middleware-node-context-BqPbf-fI.mjs.map +0 -1
  160. package/dist/middleware-node-context-rgnc7UNR.js +0 -38
  161. package/dist/middleware.d.mts +0 -25
  162. package/dist/middleware.d.mts.map +0 -1
  163. package/dist/middleware.d.ts +0 -25
  164. package/dist/middleware.d.ts.map +0 -1
  165. package/dist/middleware.js +0 -53
  166. package/dist/middleware.mjs +0 -51
  167. package/dist/middleware.mjs.map +0 -1
  168. package/dist/nodejs-wasm-loader.d.mts +0 -42
  169. package/dist/nodejs-wasm-loader.d.mts.map +0 -1
  170. package/dist/nodejs-wasm-loader.d.ts +0 -42
  171. package/dist/nodejs-wasm-loader.d.ts.map +0 -1
  172. package/dist/nodejs-wasm-loader.js +0 -70
  173. package/dist/nodejs-wasm-loader.mjs +0 -66
  174. package/dist/nodejs-wasm-loader.mjs.map +0 -1
  175. package/dist/policy.d.mts +0 -138
  176. package/dist/policy.d.mts.map +0 -1
  177. package/dist/policy.d.ts +0 -138
  178. package/dist/policy.d.ts.map +0 -1
  179. package/dist/policy.js +0 -236
  180. package/dist/policy.mjs +0 -205
  181. package/dist/policy.mjs.map +0 -1
  182. package/dist/session-tracker.d.mts +0 -50
  183. package/dist/session-tracker.d.mts.map +0 -1
  184. package/dist/session-tracker.d.ts +0 -50
  185. package/dist/session-tracker.d.ts.map +0 -1
  186. package/dist/session-tracker.js +0 -148
  187. package/dist/session-tracker.mjs +0 -147
  188. package/dist/session-tracker.mjs.map +0 -1
  189. package/dist/translate.d.mts +0 -48
  190. package/dist/translate.d.mts.map +0 -1
  191. package/dist/translate.d.ts +0 -48
  192. package/dist/translate.d.ts.map +0 -1
  193. package/dist/translate.js +0 -79
  194. package/dist/translate.mjs +0 -79
  195. package/dist/translate.mjs.map +0 -1
  196. package/dist/types-C0SkqLMM.d.mts +0 -102
  197. package/dist/types-C0SkqLMM.d.mts.map +0 -1
  198. package/dist/types-C7DNSCTO.d.ts +0 -102
  199. package/dist/types-C7DNSCTO.d.ts.map +0 -1
  200. package/dist/utils-Cj4XNhIY.mjs +0 -35
  201. package/dist/utils-Cj4XNhIY.mjs.map +0 -1
  202. package/dist/utils-DAisnYnI.js +0 -45
  203. package/dist/wasm-setup.d.mts +0 -47
  204. package/dist/wasm-setup.d.mts.map +0 -1
  205. package/dist/wasm-setup.d.ts +0 -47
  206. package/dist/wasm-setup.d.ts.map +0 -1
  207. package/dist/wasm-setup.js +0 -91
  208. package/dist/wasm-setup.mjs +0 -95
  209. package/dist/wasm-setup.mjs.map +0 -1
  210. package/wasm/agentshield_wasm.d.ts +0 -479
  211. package/wasm/agentshield_wasm.js +0 -1536
  212. package/wasm/agentshield_wasm_bg.wasm +0 -0
  213. package/wasm/package.json +0 -30
  214. package/wasm.d.ts +0 -21
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cedar-wasm.mjs","names":[],"sources":["../src/cedar-wasm.ts"],"sourcesContent":["/**\n * The Cedar build's compiled `WebAssembly.Module`: the engine plus the Cedar\n * policy evaluator. Pass it as `withCheckpoint`'s `engineWasmModule` on the\n * Edge runtime, in place of `./engine-wasm`, and one module runs detection and\n * the project's Cedar policy:\n *\n * ```ts\n * import engineWasmModule from '@kya-os/checkpoint-nextjs/cedar-wasm';\n * export default withCheckpoint({ projectId, engineWasmModule });\n * ```\n *\n * Opt-in because it is larger than the engine-only build; a project whose\n * Cedar policy is enforcing needs it on the Edge runtime. Imported through\n * this package, the binary always matches the glue this package loads.\n */\n\nimport compiled from '@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm?module';\n\n// Typed here so the published declaration names no `?module` specifier.\nconst cedarWasmModule: WebAssembly.Module = compiled;\nexport default cedarWasmModule;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,kBAAsC"}
@@ -0,0 +1,89 @@
1
+ import { CheckpointHostConfig } from "@kya-os/checkpoint-wasm-runtime/pipeline";
2
+ import { NextRequest } from "next/server.js";
3
+ import { ClientIpTrustPolicy } from "@kya-os/checkpoint-shared";
4
+ //#region src/config.d.ts
5
+ /**
6
+ * Configuration for `withCheckpoint`. Every field is optional; on the Edge
7
+ * runtime `withCheckpoint` also needs a compiled engine module
8
+ * (`CheckpointEdgeConfig`).
9
+ */
10
+ interface CheckpointConfig extends CheckpointHostConfig<NextRequest> {
11
+ /**
12
+ * Selects the infrastructure allowed to vouch for observed client addresses.
13
+ * Vercel headers are honored only inside its managed runtime (`VERCEL=1`).
14
+ * NextRequest exposes no socket peer, so generic proxy and Cloudflare origin
15
+ * profiles cannot authenticate that boundary and return no address. Use a
16
+ * transport-aware ingress, such as the Express adapter, for those profiles.
17
+ */
18
+ clientIpPolicy?: ClientIpTrustPolicy;
19
+ /**
20
+ * Read the request body when `content-type` is `application/json` so
21
+ * the orchestrator can extract a KYA-OS envelope from
22
+ * `_meta.proof.jws`. Default `true`.
23
+ *
24
+ * **When to disable** — streaming middlewares that can't tolerate
25
+ * the `req.clone()` memory overhead (one full-body copy is buffered
26
+ * during the read). For those, set `false` and route KYA-OS
27
+ * envelopes through the `KYA-Delegation` header transport instead
28
+ * (requires `legacyEnvelopeFallback: true`).
29
+ *
30
+ * The clone preserves `req.body` for downstream handlers — disabling
31
+ * is a performance optimization, not a correctness fix.
32
+ *
33
+ * SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
34
+ *
35
+ * @default true
36
+ */
37
+ drainJsonBody?: boolean;
38
+ /**
39
+ * EDGE runtime only. The Cedar build's `WebAssembly.Module`. Prefer passing
40
+ * it as `engineWasmModule` (see there); this field is kept so existing
41
+ * configs work. Passed alone it serves both roles, detection and policy, on
42
+ * one instance. Passed next to the engine-only build it runs as a second
43
+ * instance, and the Edge bundle carries the engine twice (`debug` logs a
44
+ * hint).
45
+ *
46
+ * Without a Cedar module the project's policy is still fetched and never
47
+ * skipped: with no Cedar policy nothing changes, a policy in shadow mode
48
+ * keeps the structured decision, and an enforcing policy answers every
49
+ * request 503 and logs which module is missing. The Node runtime ignores
50
+ * this field (it loads Cedar through `createPolicyEvaluator`).
51
+ *
52
+ * Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
53
+ */
54
+ cedarWasmModule?: WebAssembly.Module;
55
+ /**
56
+ * EDGE runtime only, and required there unless `cedarWasmModule` is set.
57
+ * The module the engine runs on, statically imported by the host:
58
+ *
59
+ * ```ts
60
+ * // Detection only:
61
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
62
+ * // Detection and the project's Cedar policy, on one module:
63
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/cedar-wasm';
64
+ *
65
+ * export default withCheckpoint({ projectId, engineWasmModule });
66
+ * ```
67
+ *
68
+ * The Cedar build is the engine plus Cedar, so it replaces the engine-only
69
+ * build rather than adding to it; it is larger, which is why it is opt-in.
70
+ * A project whose Cedar policy is enforcing needs it on the Edge runtime.
71
+ *
72
+ * The Edge runtime does not let code compile WebAssembly from bytes, so the
73
+ * engine cannot fetch and compile its own binary there; the bundler has to
74
+ * hand it over as a compiled module. The Node runtime ignores this field.
75
+ */
76
+ engineWasmModule?: WebAssembly.Module;
77
+ }
78
+ /**
79
+ * `withCheckpoint` configuration for the Edge runtime (`./edge`): the engine
80
+ * needs a module, `engineWasmModule` or, on its own, `cedarWasmModule`.
81
+ */
82
+ type CheckpointEdgeConfig = CheckpointConfig & ({
83
+ engineWasmModule: WebAssembly.Module;
84
+ } | {
85
+ cedarWasmModule: WebAssembly.Module;
86
+ });
87
+ //#endregion
88
+ export { CheckpointEdgeConfig as n, CheckpointConfig as t };
89
+ //# sourceMappingURL=config-D7h2w_it.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-D7h2w_it.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;UAkBiB,yBAAyB,qBAAqB;;;;;;;;EAQ7D,iBAAiB;;;;;;;;;;;;;;;;;;;EAoBjB;;;;;;;;;;;;;;;;;EAkBA,kBAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;EAuB9B,mBAAmB,YAAY;;;;;;KAOrB,uBAAuB;EAC9B,kBAAkB,YAAY;;EAAa,iBAAiB,YAAY"}
@@ -0,0 +1,89 @@
1
+ import { ClientIpTrustPolicy } from "@kya-os/checkpoint-shared";
2
+ import { NextRequest } from "next/server.js";
3
+ import { CheckpointHostConfig } from "@kya-os/checkpoint-wasm-runtime/pipeline";
4
+ //#region src/config.d.ts
5
+ /**
6
+ * Configuration for `withCheckpoint`. Every field is optional; on the Edge
7
+ * runtime `withCheckpoint` also needs a compiled engine module
8
+ * (`CheckpointEdgeConfig`).
9
+ */
10
+ interface CheckpointConfig extends CheckpointHostConfig<NextRequest> {
11
+ /**
12
+ * Selects the infrastructure allowed to vouch for observed client addresses.
13
+ * Vercel headers are honored only inside its managed runtime (`VERCEL=1`).
14
+ * NextRequest exposes no socket peer, so generic proxy and Cloudflare origin
15
+ * profiles cannot authenticate that boundary and return no address. Use a
16
+ * transport-aware ingress, such as the Express adapter, for those profiles.
17
+ */
18
+ clientIpPolicy?: ClientIpTrustPolicy;
19
+ /**
20
+ * Read the request body when `content-type` is `application/json` so
21
+ * the orchestrator can extract a KYA-OS envelope from
22
+ * `_meta.proof.jws`. Default `true`.
23
+ *
24
+ * **When to disable** — streaming middlewares that can't tolerate
25
+ * the `req.clone()` memory overhead (one full-body copy is buffered
26
+ * during the read). For those, set `false` and route KYA-OS
27
+ * envelopes through the `KYA-Delegation` header transport instead
28
+ * (requires `legacyEnvelopeFallback: true`).
29
+ *
30
+ * The clone preserves `req.body` for downstream handlers — disabling
31
+ * is a performance optimization, not a correctness fix.
32
+ *
33
+ * SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
34
+ *
35
+ * @default true
36
+ */
37
+ drainJsonBody?: boolean;
38
+ /**
39
+ * EDGE runtime only. The Cedar build's `WebAssembly.Module`. Prefer passing
40
+ * it as `engineWasmModule` (see there); this field is kept so existing
41
+ * configs work. Passed alone it serves both roles, detection and policy, on
42
+ * one instance. Passed next to the engine-only build it runs as a second
43
+ * instance, and the Edge bundle carries the engine twice (`debug` logs a
44
+ * hint).
45
+ *
46
+ * Without a Cedar module the project's policy is still fetched and never
47
+ * skipped: with no Cedar policy nothing changes, a policy in shadow mode
48
+ * keeps the structured decision, and an enforcing policy answers every
49
+ * request 503 and logs which module is missing. The Node runtime ignores
50
+ * this field (it loads Cedar through `createPolicyEvaluator`).
51
+ *
52
+ * Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
53
+ */
54
+ cedarWasmModule?: WebAssembly.Module;
55
+ /**
56
+ * EDGE runtime only, and required there unless `cedarWasmModule` is set.
57
+ * The module the engine runs on, statically imported by the host:
58
+ *
59
+ * ```ts
60
+ * // Detection only:
61
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
62
+ * // Detection and the project's Cedar policy, on one module:
63
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/cedar-wasm';
64
+ *
65
+ * export default withCheckpoint({ projectId, engineWasmModule });
66
+ * ```
67
+ *
68
+ * The Cedar build is the engine plus Cedar, so it replaces the engine-only
69
+ * build rather than adding to it; it is larger, which is why it is opt-in.
70
+ * A project whose Cedar policy is enforcing needs it on the Edge runtime.
71
+ *
72
+ * The Edge runtime does not let code compile WebAssembly from bytes, so the
73
+ * engine cannot fetch and compile its own binary there; the bundler has to
74
+ * hand it over as a compiled module. The Node runtime ignores this field.
75
+ */
76
+ engineWasmModule?: WebAssembly.Module;
77
+ }
78
+ /**
79
+ * `withCheckpoint` configuration for the Edge runtime (`./edge`): the engine
80
+ * needs a module, `engineWasmModule` or, on its own, `cedarWasmModule`.
81
+ */
82
+ type CheckpointEdgeConfig = CheckpointConfig & ({
83
+ engineWasmModule: WebAssembly.Module;
84
+ } | {
85
+ cedarWasmModule: WebAssembly.Module;
86
+ });
87
+ //#endregion
88
+ export { CheckpointEdgeConfig as n, CheckpointConfig as t };
89
+ //# sourceMappingURL=config-DkXvl4nH.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-DkXvl4nH.d.ts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;UAkBiB,yBAAyB,qBAAqB;;;;;;;;EAQ7D,iBAAiB;;;;;;;;;;;;;;;;;;;EAoBjB;;;;;;;;;;;;;;;;;EAkBA,kBAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;EAuB9B,mBAAmB,YAAY;;;;;;KAOrB,uBAAuB;EAC9B,kBAAkB,YAAY;;EAAa,iBAAiB,YAAY"}
@@ -0,0 +1,20 @@
1
+ //#region src/engine-wasm.d.ts
2
+ /**
3
+ * The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
4
+ * `engineWasmModule` on the Edge runtime:
5
+ *
6
+ * ```ts
7
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
8
+ * export default withCheckpoint({ engineWasmModule });
9
+ * ```
10
+ *
11
+ * `?module` is how Next.js imports a `.wasm` file as a compiled module, which
12
+ * the Edge runtime needs because it does not let code compile WebAssembly from
13
+ * bytes. Importing it through this package keeps the binary the same version
14
+ * as the engine glue this package loads, and works without a direct
15
+ * dependency on `@kya-os/checkpoint-wasm-runtime`.
16
+ */
17
+ declare const engineWasmModule: WebAssembly.Module;
18
+ //#endregion
19
+ export { engineWasmModule as default };
20
+ //# sourceMappingURL=engine-wasm.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-wasm.d.mts","names":[],"sources":["../src/engine-wasm.ts"],"mappings":";;;;;;;;;;;;;;;;cAmBM,kBAAkB,YAAY"}
@@ -0,0 +1,19 @@
1
+ //#region src/engine-wasm.d.ts
2
+ /**
3
+ * The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
4
+ * `engineWasmModule` on the Edge runtime:
5
+ *
6
+ * ```ts
7
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
8
+ * export default withCheckpoint({ engineWasmModule });
9
+ * ```
10
+ *
11
+ * `?module` is how Next.js imports a `.wasm` file as a compiled module, which
12
+ * the Edge runtime needs because it does not let code compile WebAssembly from
13
+ * bytes. Importing it through this package keeps the binary the same version
14
+ * as the engine glue this package loads, and works without a direct
15
+ * dependency on `@kya-os/checkpoint-wasm-runtime`.
16
+ */
17
+ declare const engineWasmModule: WebAssembly.Module;
18
+ export = engineWasmModule;
19
+ //# sourceMappingURL=engine-wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-wasm.d.ts","names":[],"sources":["../src/engine-wasm.ts"],"mappings":";;;;;;;;;;;;;;;;cAmBM,kBAAkB,YAAY"}
@@ -0,0 +1,24 @@
1
+ const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.js');
2
+ let _kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module = require("@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-web/kya_os_engine_bg.wasm?module");
3
+ _kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module = require_rolldown_runtime.__toESM(_kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module);
4
+
5
+ //#region src/engine-wasm.ts
6
+ /**
7
+ * The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
8
+ * `engineWasmModule` on the Edge runtime:
9
+ *
10
+ * ```ts
11
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
12
+ * export default withCheckpoint({ engineWasmModule });
13
+ * ```
14
+ *
15
+ * `?module` is how Next.js imports a `.wasm` file as a compiled module, which
16
+ * the Edge runtime needs because it does not let code compile WebAssembly from
17
+ * bytes. Importing it through this package keeps the binary the same version
18
+ * as the engine glue this package loads, and works without a direct
19
+ * dependency on `@kya-os/checkpoint-wasm-runtime`.
20
+ */
21
+ const engineWasmModule = _kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module.default;
22
+
23
+ //#endregion
24
+ module.exports = engineWasmModule;
@@ -0,0 +1,23 @@
1
+ import compiled from "@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-web/kya_os_engine_bg.wasm?module";
2
+
3
+ //#region src/engine-wasm.ts
4
+ /**
5
+ * The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
6
+ * `engineWasmModule` on the Edge runtime:
7
+ *
8
+ * ```ts
9
+ * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
10
+ * export default withCheckpoint({ engineWasmModule });
11
+ * ```
12
+ *
13
+ * `?module` is how Next.js imports a `.wasm` file as a compiled module, which
14
+ * the Edge runtime needs because it does not let code compile WebAssembly from
15
+ * bytes. Importing it through this package keeps the binary the same version
16
+ * as the engine glue this package loads, and works without a direct
17
+ * dependency on `@kya-os/checkpoint-wasm-runtime`.
18
+ */
19
+ const engineWasmModule = compiled;
20
+
21
+ //#endregion
22
+ export { engineWasmModule as default };
23
+ //# sourceMappingURL=engine-wasm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-wasm.mjs","names":[],"sources":["../src/engine-wasm.ts"],"sourcesContent":["/**\n * The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s\n * `engineWasmModule` on the Edge runtime:\n *\n * ```ts\n * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';\n * export default withCheckpoint({ engineWasmModule });\n * ```\n *\n * `?module` is how Next.js imports a `.wasm` file as a compiled module, which\n * the Edge runtime needs because it does not let code compile WebAssembly from\n * bytes. Importing it through this package keeps the binary the same version\n * as the engine glue this package loads, and works without a direct\n * dependency on `@kya-os/checkpoint-wasm-runtime`.\n */\n\nimport compiled from '@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-web/kya_os_engine_bg.wasm?module';\n\n// Typed here so the published declaration names no `?module` specifier.\nconst engineWasmModule: WebAssembly.Module = compiled;\nexport default engineWasmModule;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAuC"}
@@ -0,0 +1,8 @@
1
+ import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.mjs";
2
+ import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-BtsYJU5u.mjs";
3
+ import { t as CheckpointConfig } from "./config-D7h2w_it.mjs";
4
+ import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.mjs";
5
+ import { withCheckpoint } from "./middleware-edge.mjs";
6
+ import { t as VERSION } from "./middleware-core-CnPUoD2v.mjs";
7
+ import "./public-api-DgCw1uo6.mjs";
8
+ export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
@@ -0,0 +1,8 @@
1
+ import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.js";
2
+ import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-DyLDqOYF.js";
3
+ import { t as CheckpointConfig } from "./config-DkXvl4nH.js";
4
+ import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.js";
5
+ import { withCheckpoint } from "./middleware-edge.js";
6
+ import { t as VERSION } from "./middleware-core-BmW2kH8J.js";
7
+ import "./public-api-Cw7Zj290.js";
8
+ export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
@@ -0,0 +1,14 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_middleware_core = require('./middleware-core-B1GuspOY.js');
3
+ const require_posture_outcome = require('./posture-outcome-DddsJtL8.js');
4
+ const require_api_client = require('./api-client.js');
5
+ const require_api_middleware = require('./api-middleware-beNlXd5P.js');
6
+ const require_middleware_edge = require('./middleware-edge.js');
7
+
8
+ exports.CheckpointApiClient = require_api_client.CheckpointApiClient;
9
+ exports.VERSION = require_middleware_core.VERSION;
10
+ exports.getCheckpointApiClient = require_api_client.getCheckpointApiClient;
11
+ exports.getCheckpointPostureOutcome = require_posture_outcome.getCheckpointPostureOutcome;
12
+ exports.resetCheckpointApiClient = require_api_client.resetCheckpointApiClient;
13
+ exports.withCheckpoint = require_middleware_edge.withCheckpoint;
14
+ exports.withCheckpointApi = require_api_middleware.withCheckpointApi;
@@ -0,0 +1,7 @@
1
+ import { t as VERSION } from "./middleware-core-WZeMSRqx.mjs";
2
+ import { t as getCheckpointPostureOutcome } from "./posture-outcome-DQ4fdMfq.mjs";
3
+ import { CheckpointApiClient, getCheckpointApiClient, resetCheckpointApiClient } from "./api-client.mjs";
4
+ import { t as withCheckpointApi } from "./api-middleware-DvmkJ_Li.mjs";
5
+ import { withCheckpoint } from "./middleware-edge.mjs";
6
+
7
+ export { CheckpointApiClient, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,8 @@
1
- import { AgentShieldClient, AgentShieldClientConfig, CheckpointApiClient, CheckpointApiClientConfig, EnforceInput, EnforceResponse, EnforcementAction, EnforcementDecision, LogDetectionInput, getAgentShieldClient, getCheckpointApiClient, resetAgentShieldClient, resetCheckpointApiClient } from "./api-client.mjs";
2
- import { AgentDetectionEvent, AgentSession, AgentShieldMiddlewareConfig, CheckpointApiMiddlewareConfig, EnhancedMiddlewareConfig, StorageAdapter, StorageConfig, agentShieldMiddleware, createEnhancedAgentShieldMiddleware, withAgentShield, withCheckpointApi } from "./api-middleware.mjs";
3
- import { n as DetectionContext, r as NextJSMiddlewareConfig, t as AgentShieldRequest } from "./types-C0SkqLMM.mjs";
4
- import { createAgentShieldMiddleware } from "./create-middleware.mjs";
5
- import { t as CheckpointConfig } from "./config-Doe0Tn53.mjs";
6
- import { n as VERSION, t as withCheckpoint } from "./middleware-node-DtyOuPta.mjs";
7
- import { createAgentShieldMiddleware as createAgentShieldMiddleware$1 } from "./middleware.mjs";
8
- import { EdgeSessionTracker, SessionData, SessionTrackingConfig, StatelessSessionChecker } from "./session-tracker.mjs";
9
- import { DEFAULT_POLICY, ENFORCEMENT_ACTIONS, NextJSPolicyMiddlewareConfig, PolicyConfig, PolicyEvaluationContext, PolicyEvaluationResult, PolicyMiddlewareConfig, applyPolicy, buildBlockedResponse, buildRedirectResponse, createContextFromDetection, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getPolicy, handlePolicyDecision } from "./policy.mjs";
10
- export { type AgentDetectionEvent, type AgentSession, AgentShieldClient, type AgentShieldClientConfig, type AgentShieldMiddlewareConfig, AgentShieldRequest, CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, DEFAULT_POLICY, DetectionContext, ENFORCEMENT_ACTIONS, EdgeSessionTracker, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type EnhancedMiddlewareConfig, type LogDetectionInput, NextJSMiddlewareConfig, type NextJSPolicyMiddlewareConfig, type PolicyConfig, type PolicyEvaluationContext, type PolicyEvaluationResult, type PolicyMiddlewareConfig, type SessionData, type SessionTrackingConfig, StatelessSessionChecker, type StorageAdapter, type StorageConfig, VERSION, agentShieldMiddleware, applyPolicy, buildBlockedResponse as buildPolicyBlockedResponse, buildRedirectResponse as buildPolicyRedirectResponse, createAgentShieldMiddleware, createAgentShieldMiddleware as createMiddleware, createAgentShieldMiddleware$1 as createAgentShieldMiddlewareBase, createContextFromDetection, createEnhancedAgentShieldMiddleware, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getAgentShieldClient, getCheckpointApiClient, getPolicy, handlePolicyDecision, resetAgentShieldClient, resetCheckpointApiClient, withAgentShield, withCheckpoint, withCheckpointApi };
1
+ import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.mjs";
2
+ import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-BtsYJU5u.mjs";
3
+ import { t as CheckpointConfig } from "./config-D7h2w_it.mjs";
4
+ import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.mjs";
5
+ import { t as VERSION } from "./middleware-core-CnPUoD2v.mjs";
6
+ import "./public-api-DgCw1uo6.mjs";
7
+ import { withCheckpoint } from "./middleware-node.mjs";
8
+ export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
- import { AgentShieldClient, AgentShieldClientConfig, CheckpointApiClient, CheckpointApiClientConfig, EnforceInput, EnforceResponse, EnforcementAction, EnforcementDecision, LogDetectionInput, getAgentShieldClient, getCheckpointApiClient, resetAgentShieldClient, resetCheckpointApiClient } from "./api-client.js";
2
- import { AgentDetectionEvent, AgentSession, AgentShieldMiddlewareConfig, CheckpointApiMiddlewareConfig, EnhancedMiddlewareConfig, StorageAdapter, StorageConfig, agentShieldMiddleware, createEnhancedAgentShieldMiddleware, withAgentShield, withCheckpointApi } from "./api-middleware.js";
3
- import { n as DetectionContext, r as NextJSMiddlewareConfig, t as AgentShieldRequest } from "./types-C7DNSCTO.js";
4
- import { createAgentShieldMiddleware } from "./create-middleware.js";
5
- import { t as CheckpointConfig } from "./config-CbAg2mze.js";
6
- import { n as VERSION, t as withCheckpoint } from "./middleware-node-CE4GevYs.js";
7
- import { createAgentShieldMiddleware as createAgentShieldMiddleware$1 } from "./middleware.js";
8
- import { EdgeSessionTracker, SessionData, SessionTrackingConfig, StatelessSessionChecker } from "./session-tracker.js";
9
- import { DEFAULT_POLICY, ENFORCEMENT_ACTIONS, NextJSPolicyMiddlewareConfig, PolicyConfig, PolicyEvaluationContext, PolicyEvaluationResult, PolicyMiddlewareConfig, applyPolicy, buildBlockedResponse, buildRedirectResponse, createContextFromDetection, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getPolicy, handlePolicyDecision } from "./policy.js";
10
- export { type AgentDetectionEvent, type AgentSession, AgentShieldClient, type AgentShieldClientConfig, type AgentShieldMiddlewareConfig, AgentShieldRequest, CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, DEFAULT_POLICY, DetectionContext, ENFORCEMENT_ACTIONS, EdgeSessionTracker, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type EnhancedMiddlewareConfig, type LogDetectionInput, NextJSMiddlewareConfig, type NextJSPolicyMiddlewareConfig, type PolicyConfig, type PolicyEvaluationContext, type PolicyEvaluationResult, type PolicyMiddlewareConfig, type SessionData, type SessionTrackingConfig, StatelessSessionChecker, type StorageAdapter, type StorageConfig, VERSION, agentShieldMiddleware, applyPolicy, buildBlockedResponse as buildPolicyBlockedResponse, buildRedirectResponse as buildPolicyRedirectResponse, createAgentShieldMiddleware, createAgentShieldMiddleware as createMiddleware, createAgentShieldMiddleware$1 as createAgentShieldMiddlewareBase, createContextFromDetection, createEnhancedAgentShieldMiddleware, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getAgentShieldClient, getCheckpointApiClient, getPolicy, handlePolicyDecision, resetAgentShieldClient, resetCheckpointApiClient, withAgentShield, withCheckpoint, withCheckpointApi };
1
+ import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.js";
2
+ import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-DyLDqOYF.js";
3
+ import { t as CheckpointConfig } from "./config-DkXvl4nH.js";
4
+ import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.js";
5
+ import { t as VERSION } from "./middleware-core-BmW2kH8J.js";
6
+ import "./public-api-Cw7Zj290.js";
7
+ import { withCheckpoint } from "./middleware-node.js";
8
+ export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
package/dist/index.js CHANGED
@@ -1,66 +1,37 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_middleware_core = require('./middleware-core-D6TijE6P.js');
2
+ const require_middleware_core = require('./middleware-core-B1GuspOY.js');
3
3
  const require_middleware_node = require('./middleware-node.js');
4
- const require_middleware = require('./middleware.js');
5
- const require_create_middleware = require('./create-middleware.js');
4
+ const require_posture_outcome = require('./posture-outcome-DddsJtL8.js');
6
5
  const require_api_client = require('./api-client.js');
7
- const require_api_middleware = require('./api-middleware-CDSh3TSE.js');
8
- const require_session_tracker = require('./session-tracker.js');
9
- const require_policy = require('./policy.js');
10
- let _kya_os_checkpoint_shared = require("@kya-os/checkpoint-shared");
6
+ const require_api_middleware = require('./api-middleware-beNlXd5P.js');
11
7
 
12
8
  //#region src/index.ts
13
9
  /**
14
10
  * @fileoverview Checkpoint Next.js Integration
15
11
  * @license MIT OR Apache-2.0
12
+ *
13
+ * Two deployment shapes ship from this package:
14
+ *
15
+ * 1. `withCheckpoint` runs `kya-os-engine` in-process through WebAssembly:
16
+ * no network round trip per request, and every verdict comes from the
17
+ * engine.
18
+ * 2. `withCheckpointApi` sends each request to the hosted gateway instead. It
19
+ * is opt-in, for runtimes that cannot run WebAssembly.
20
+ *
21
+ * This is the `.` entry outside the Edge runtime, the same as `./node`: the
22
+ * engine's Node build, which loads its `.wasm` through `new URL(...,
23
+ * import.meta.url)`, so it works unbundled and when Next.js bundles `proxy.ts`
24
+ * or `middleware.ts` (the bundler copies the file it names). `index-edge.ts` is
25
+ * the `.` entry on the Edge runtime.
26
+ *
27
+ * See `README.md` ("Two deployment shapes").
16
28
  */
17
29
 
18
30
  //#endregion
19
- exports.AgentShieldClient = require_api_client.AgentShieldClient;
20
31
  exports.CheckpointApiClient = require_api_client.CheckpointApiClient;
21
- Object.defineProperty(exports, 'DEFAULT_POLICY', {
22
- enumerable: true,
23
- get: function () {
24
- return _kya_os_checkpoint_shared.DEFAULT_POLICY;
25
- }
26
- });
27
- Object.defineProperty(exports, 'ENFORCEMENT_ACTIONS', {
28
- enumerable: true,
29
- get: function () {
30
- return _kya_os_checkpoint_shared.ENFORCEMENT_ACTIONS;
31
- }
32
- });
33
- exports.EdgeSessionTracker = require_session_tracker.EdgeSessionTracker;
34
- exports.StatelessSessionChecker = require_session_tracker.StatelessSessionChecker;
35
32
  exports.VERSION = require_middleware_core.VERSION;
36
- exports.agentShieldMiddleware = require_api_middleware.agentShieldMiddleware;
37
- exports.applyPolicy = require_policy.applyPolicy;
38
- exports.buildPolicyBlockedResponse = require_policy.buildBlockedResponse;
39
- exports.buildPolicyRedirectResponse = require_policy.buildRedirectResponse;
40
- exports.createAgentShieldMiddleware = require_create_middleware.createAgentShieldMiddleware;
41
- exports.createAgentShieldMiddlewareBase = require_middleware.createAgentShieldMiddleware;
42
- exports.createContextFromDetection = require_policy.createContextFromDetection;
43
- exports.createEnhancedAgentShieldMiddleware = require_api_middleware.createEnhancedAgentShieldMiddleware;
44
- Object.defineProperty(exports, 'createEvaluationContext', {
45
- enumerable: true,
46
- get: function () {
47
- return _kya_os_checkpoint_shared.createEvaluationContext;
48
- }
49
- });
50
- exports.createMiddleware = require_create_middleware.createAgentShieldMiddleware;
51
- Object.defineProperty(exports, 'evaluatePolicy', {
52
- enumerable: true,
53
- get: function () {
54
- return _kya_os_checkpoint_shared.evaluatePolicy;
55
- }
56
- });
57
- exports.evaluatePolicyForDetection = require_policy.evaluatePolicyForDetection;
58
- exports.getAgentShieldClient = require_api_client.getAgentShieldClient;
59
33
  exports.getCheckpointApiClient = require_api_client.getCheckpointApiClient;
60
- exports.getPolicy = require_policy.getPolicy;
61
- exports.handlePolicyDecision = require_policy.handlePolicyDecision;
62
- exports.resetAgentShieldClient = require_api_client.resetAgentShieldClient;
34
+ exports.getCheckpointPostureOutcome = require_posture_outcome.getCheckpointPostureOutcome;
63
35
  exports.resetCheckpointApiClient = require_api_client.resetCheckpointApiClient;
64
- exports.withAgentShield = require_api_middleware.withAgentShield;
65
36
  exports.withCheckpoint = require_middleware_node.withCheckpoint;
66
37
  exports.withCheckpointApi = require_api_middleware.withCheckpointApi;
package/dist/index.mjs CHANGED
@@ -1,18 +1,31 @@
1
- import { t as VERSION } from "./middleware-core-BYQP9FND.mjs";
1
+ import { t as VERSION } from "./middleware-core-WZeMSRqx.mjs";
2
2
  import { withCheckpoint } from "./middleware-node.mjs";
3
- import { createAgentShieldMiddleware as createAgentShieldMiddleware$1 } from "./middleware.mjs";
4
- import { createAgentShieldMiddleware } from "./create-middleware.mjs";
5
- import { AgentShieldClient, CheckpointApiClient, getAgentShieldClient, getCheckpointApiClient, resetAgentShieldClient, resetCheckpointApiClient } from "./api-client.mjs";
6
- import { i as withCheckpointApi, n as createEnhancedAgentShieldMiddleware, r as withAgentShield, t as agentShieldMiddleware } from "./api-middleware-CMDRoQik.mjs";
7
- import { EdgeSessionTracker, StatelessSessionChecker } from "./session-tracker.mjs";
8
- import { DEFAULT_POLICY, ENFORCEMENT_ACTIONS, applyPolicy, buildBlockedResponse, buildRedirectResponse, createContextFromDetection, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getPolicy, handlePolicyDecision } from "./policy.mjs";
3
+ import { t as getCheckpointPostureOutcome } from "./posture-outcome-DQ4fdMfq.mjs";
4
+ import { CheckpointApiClient, getCheckpointApiClient, resetCheckpointApiClient } from "./api-client.mjs";
5
+ import { t as withCheckpointApi } from "./api-middleware-DvmkJ_Li.mjs";
9
6
 
10
7
  //#region src/index.ts
11
8
  /**
12
9
  * @fileoverview Checkpoint Next.js Integration
13
10
  * @license MIT OR Apache-2.0
11
+ *
12
+ * Two deployment shapes ship from this package:
13
+ *
14
+ * 1. `withCheckpoint` runs `kya-os-engine` in-process through WebAssembly:
15
+ * no network round trip per request, and every verdict comes from the
16
+ * engine.
17
+ * 2. `withCheckpointApi` sends each request to the hosted gateway instead. It
18
+ * is opt-in, for runtimes that cannot run WebAssembly.
19
+ *
20
+ * This is the `.` entry outside the Edge runtime, the same as `./node`: the
21
+ * engine's Node build, which loads its `.wasm` through `new URL(...,
22
+ * import.meta.url)`, so it works unbundled and when Next.js bundles `proxy.ts`
23
+ * or `middleware.ts` (the bundler copies the file it names). `index-edge.ts` is
24
+ * the `.` entry on the Edge runtime.
25
+ *
26
+ * See `README.md` ("Two deployment shapes").
14
27
  */
15
28
 
16
29
  //#endregion
17
- export { AgentShieldClient, CheckpointApiClient, DEFAULT_POLICY, ENFORCEMENT_ACTIONS, EdgeSessionTracker, StatelessSessionChecker, VERSION, agentShieldMiddleware, applyPolicy, buildBlockedResponse as buildPolicyBlockedResponse, buildRedirectResponse as buildPolicyRedirectResponse, createAgentShieldMiddleware, createAgentShieldMiddleware as createMiddleware, createAgentShieldMiddleware$1 as createAgentShieldMiddlewareBase, createContextFromDetection, createEnhancedAgentShieldMiddleware, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getAgentShieldClient, getCheckpointApiClient, getPolicy, handlePolicyDecision, resetAgentShieldClient, resetCheckpointApiClient, withAgentShield, withCheckpoint, withCheckpointApi };
30
+ export { CheckpointApiClient, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
18
31
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @fileoverview Checkpoint Next.js Integration\n * @license MIT OR Apache-2.0\n */\n\n// =============================================================================\n// Two deployment shapes — pick the one that fits your runtime.\n//\n// 1. `withCheckpoint` (local-engine):\n// Runs the Rust `kya-os-engine` in-process via WASM. Lowest latency,\n// no network round-trip per request, deterministic verdicts. Requires\n// the WASM artifact to load — works under Node and Vercel Edge by\n// default; bare-Edge / browser embedders need a polyfill story.\n//\n// 2. `withCheckpointApi` (SaaS-gateway):\n// Dispatches detection + enforcement to the Cloudflare DNS gateway\n// (`https://detect.checkpoint-gateway.ai`). Trades ~30-50ms of edge\n// latency for centralized policy management + dashboard rules + works\n// in any environment that can fetch HTTPS. No WASM needed.\n//\n// Both ship from the same package; mix and match per route if you want.\n// See `README.md` § \"Two deployment shapes\" for the decision matrix.\n// =============================================================================\n\n// Shape 1 — local-engine. `.` export auto-routes via package.json\n// conditions (`edge-runtime`, `browser`, default); explicit `./edge`\n// and `./node` subpaths also exported.\nexport { withCheckpoint } from './middleware-node';\nexport type { CheckpointConfig } from './middleware-node';\n\n// Export the enhanced middleware that handles initialization internally\nexport { createAgentShieldMiddleware, createMiddleware } from './create-middleware';\n\n// Legacy throw-stubs — the enhanced-middleware path was retired in\n// Phase D and the type aliases ship as `Record<string, unknown>` to\n// keep the compile-time surface stable. The shapes were moved off\n// `./enhanced-middleware` so the public API has zero static refs to\n// the three D.4-deferred files\n// (`enhanced-middleware.ts`, `edge-detector-with-wasm.ts`,\n// `edge-safe-detector.ts`); see\n// `__tests__/phase-d-orphan-deferred-files.test.ts` for the gate.\nexport {\n createEnhancedAgentShieldMiddleware,\n type EnhancedMiddlewareConfig,\n type StorageAdapter,\n type StorageConfig,\n type AgentDetectionEvent,\n type AgentSession,\n} from './api-middleware';\n\n// Legacy `createAgentShieldMiddleware` from middleware.ts is now a\n// deprecation stub — see middleware.ts header. Re-export preserved\n// for surface-stability; calls throw a migration error pointing at\n// `withCheckpoint`.\nexport { createAgentShieldMiddleware as createAgentShieldMiddlewareBase } from './middleware';\n\n// Export session tracking utilities\nexport { EdgeSessionTracker, StatelessSessionChecker } from './session-tracker';\nexport type { SessionData, SessionTrackingConfig } from './session-tracker';\n\n// Shape 2 — SaaS-gateway. Talks to the Cloudflare DNS gateway over\n// HTTPS; no local WASM. The function name was `withAgentShield` pre-\n// Phase D; the old name is kept as a `@deprecated` alias for one\n// release. The behaviour is identical.\nexport { withCheckpointApi } from './api-middleware';\nexport type { CheckpointApiMiddlewareConfig } from './api-middleware';\nexport {\n CheckpointApiClient,\n getCheckpointApiClient,\n resetCheckpointApiClient,\n} from './api-client';\nexport type {\n CheckpointApiClientConfig,\n EnforcementAction,\n EnforcementDecision,\n EnforceResponse,\n EnforceInput,\n LogDetectionInput,\n} from './api-client';\n\n// Deprecated aliases for the pre-Phase-D names. New code should import\n// the `Checkpoint*` names directly.\nexport {\n withAgentShield,\n agentShieldMiddleware,\n type AgentShieldMiddlewareConfig,\n} from './api-middleware';\nexport {\n AgentShieldClient,\n getAgentShieldClient,\n resetAgentShieldClient,\n type AgentShieldClientConfig,\n} from './api-client';\n\nexport * from './types';\n// Hooks are not exported from main entry - they're client-only\n// If someone needs hooks, they should import from '@kya-os/checkpoint-nextjs/hooks'\n\n// Export policy utilities for local policy evaluation\nexport {\n applyPolicy,\n evaluatePolicyForDetection,\n createContextFromDetection,\n handlePolicyDecision,\n getPolicy,\n buildBlockedResponse as buildPolicyBlockedResponse,\n buildRedirectResponse as buildPolicyRedirectResponse,\n // Re-exports from shared\n evaluatePolicy,\n createEvaluationContext,\n ENFORCEMENT_ACTIONS,\n DEFAULT_POLICY,\n} from './policy';\nexport type {\n PolicyMiddlewareConfig,\n NextJSPolicyMiddlewareConfig,\n PolicyConfig,\n PolicyEvaluationContext,\n PolicyEvaluationResult,\n} from './policy';\n\n/**\n * Library version (single-sourced from middleware-node; the old hardcoded\n * '0.1.0' had drifted from package.json).\n */\nexport { VERSION } from './middleware-node';\n"],"mappings":""}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @fileoverview Checkpoint Next.js Integration\n * @license MIT OR Apache-2.0\n *\n * Two deployment shapes ship from this package:\n *\n * 1. `withCheckpoint` runs `kya-os-engine` in-process through WebAssembly:\n * no network round trip per request, and every verdict comes from the\n * engine.\n * 2. `withCheckpointApi` sends each request to the hosted gateway instead. It\n * is opt-in, for runtimes that cannot run WebAssembly.\n *\n * This is the `.` entry outside the Edge runtime, the same as `./node`: the\n * engine's Node build, which loads its `.wasm` through `new URL(...,\n * import.meta.url)`, so it works unbundled and when Next.js bundles `proxy.ts`\n * or `middleware.ts` (the bundler copies the file it names). `index-edge.ts` is\n * the `.` entry on the Edge runtime.\n *\n * See `README.md` (\"Two deployment shapes\").\n */\n\nexport { withCheckpoint } from './middleware-node';\nexport * from './public-api';\n"],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { t as CheckpointConfig } from "./config-Doe0Tn53.mjs";
1
+ import { t as CheckpointConfig } from "./config-D7h2w_it.mjs";
2
2
  //#region src/middleware-bundler.d.ts
3
3
  /** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
4
4
  export declare function withCheckpoint(config: CheckpointConfig): (req: import("next/server").NextRequest, event?: Pick<import("next/server").NextFetchEvent, "waitUntil">) => Promise<import("next/server").NextResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"middleware-bundler.d.mts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;wBAUgB,eAAe,QAAQ,oBAAgB,2BAAA,aAAA,QAAA,2BAAA,iCAAA,8BAAA"}
1
+ {"version":3,"file":"middleware-bundler.d.mts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;wBAMgB,eAAe,QAAQ,oBAAgB,2BAAA,aAAA,QAAA,2BAAA,iCAAA,8BAAA"}
@@ -1,4 +1,4 @@
1
- import { t as CheckpointConfig } from "./config-CbAg2mze.js";
1
+ import { t as CheckpointConfig } from "./config-DkXvl4nH.js";
2
2
  //#region src/middleware-bundler.d.ts
3
3
  /** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
4
4
  export declare function withCheckpoint(config: CheckpointConfig): (req: import("next/server").NextRequest, event?: Pick<import("next/server").NextFetchEvent, "waitUntil">) => Promise<import("next/server").NextResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"middleware-bundler.d.ts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;wBAUgB,eAAe,QAAQ,oBAAgB,2BAAA,aAAA,QAAA,2BAAA,iCAAA,8BAAA"}
1
+ {"version":3,"file":"middleware-bundler.d.ts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;wBAMgB,eAAe,QAAQ,oBAAgB,2BAAA,aAAA,QAAA,2BAAA,iCAAA,8BAAA"}
@@ -1,14 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_middleware_core = require('./middleware-core-D6TijE6P.js');
3
- const require_middleware_node_context = require('./middleware-node-context-rgnc7UNR.js');
4
- let _kya_os_checkpoint_wasm_runtime_orchestrator_bundler = require("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler");
2
+ const require_middleware_core = require('./middleware-core-B1GuspOY.js');
3
+ const require_middleware_node_context = require('./middleware-node-context-TRMTgp3y.js');
5
4
 
6
5
  //#region src/middleware-bundler.ts
7
6
  /** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
8
7
  function withCheckpoint(config) {
9
- return require_middleware_core.makeNextMiddleware(_kya_os_checkpoint_wasm_runtime_orchestrator_bundler.verifyRequest, _kya_os_checkpoint_wasm_runtime_orchestrator_bundler.renderDecisionAsResponse, config, {
8
+ return require_middleware_core.makeNextMiddleware(config, {
10
9
  runtime: "node",
11
- buildComposedContext: require_middleware_node_context.buildComposedContext
10
+ loadEngine: () => import("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler"),
11
+ policyCompiler: require_middleware_node_context.nodePolicyCompiler
12
12
  });
13
13
  }
14
14
 
@@ -1,13 +1,13 @@
1
- import { n as makeNextMiddleware } from "./middleware-core-BYQP9FND.mjs";
2
- import { t as buildComposedContext } from "./middleware-node-context-BqPbf-fI.mjs";
3
- import { renderDecisionAsResponse, verifyRequest } from "@kya-os/checkpoint-wasm-runtime/orchestrator/bundler";
1
+ import { n as makeNextMiddleware } from "./middleware-core-WZeMSRqx.mjs";
2
+ import { t as nodePolicyCompiler } from "./middleware-node-context-BvqrL2Ra.mjs";
4
3
 
5
4
  //#region src/middleware-bundler.ts
6
5
  /** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
7
6
  function withCheckpoint(config) {
8
- return makeNextMiddleware(verifyRequest, renderDecisionAsResponse, config, {
7
+ return makeNextMiddleware(config, {
9
8
  runtime: "node",
10
- buildComposedContext
9
+ loadEngine: () => import("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler"),
10
+ policyCompiler: nodePolicyCompiler
11
11
  });
12
12
  }
13
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"middleware-bundler.mjs","names":[],"sources":["../src/middleware-bundler.ts"],"sourcesContent":["import {\n verifyRequest,\n renderDecisionAsResponse,\n} from '@kya-os/checkpoint-wasm-runtime/orchestrator/bundler';\nimport { makeNextMiddleware } from './middleware-core';\nimport { buildComposedContext } from './middleware-node-context';\nimport type { CheckpointConfig } from './config';\nexport type { CheckpointConfig } from './config';\n\n/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */\nexport function withCheckpoint(config: CheckpointConfig) {\n return makeNextMiddleware(verifyRequest, renderDecisionAsResponse, config, {\n runtime: 'node',\n buildComposedContext,\n });\n}\n"],"mappings":";;;;;;AAUA,SAAgB,eAAe,QAA0B;CACvD,OAAO,mBAAmB,eAAe,0BAA0B,QAAQ;EACzE,SAAS;EACT;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"middleware-bundler.mjs","names":[],"sources":["../src/middleware-bundler.ts"],"sourcesContent":["import { makeNextMiddleware } from './middleware-core';\nimport { nodePolicyCompiler } from './middleware-node-context';\nimport type { CheckpointConfig } from './config';\nexport type { CheckpointConfig } from './config';\n\n/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */\nexport function withCheckpoint(config: CheckpointConfig) {\n return makeNextMiddleware(config, {\n runtime: 'node',\n // Imported on first use: a failure to load the engine is then answered 503\n // per request instead of failing this module.\n loadEngine: () => import('@kya-os/checkpoint-wasm-runtime/orchestrator/bundler'),\n policyCompiler: nodePolicyCompiler,\n });\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAe,QAA0B;CACvD,OAAO,mBAAmB,QAAQ;EAChC,SAAS;EAGT,kBAAkB,OAAO;EACzB,gBAAgB;CAClB,CAAC;AACH"}