@kya-os/checkpoint-nextjs 1.10.0 → 1.11.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 (210) hide show
  1. package/CHANGELOG.md +245 -0
  2. package/README.md +205 -31
  3. package/dist/{adapt.mjs → adapt-BdQ9R7Iw.mjs} +15 -4
  4. package/dist/adapt-BdQ9R7Iw.mjs.map +1 -0
  5. package/dist/{adapt.js → adapt-CCSKGjVH.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-BWjokNis.d.mts +131 -0
  16. package/dist/api-middleware-BWjokNis.d.mts.map +1 -0
  17. package/dist/{api-middleware-CDSh3TSE.js → api-middleware-Bf3xmM9W.js} +75 -63
  18. package/dist/{api-middleware-CMDRoQik.mjs → api-middleware-C-ngFX_8.mjs} +68 -38
  19. package/dist/api-middleware-C-ngFX_8.mjs.map +1 -0
  20. package/dist/api-middleware-DyLDqOYF.d.ts +131 -0
  21. package/dist/api-middleware-DyLDqOYF.d.ts.map +1 -0
  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-Doe0Tn53.d.mts → config-CPP1RV0f.d.mts} +65 -29
  34. package/dist/config-CPP1RV0f.d.mts.map +1 -0
  35. package/dist/{config-CbAg2mze.d.ts → config-DVgOFxJs.d.ts} +66 -30
  36. package/dist/config-DVgOFxJs.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 +4 -4
  58. package/dist/middleware-bundler.mjs +4 -4
  59. package/dist/middleware-bundler.mjs.map +1 -1
  60. package/dist/middleware-core-B0jf5_Hm.mjs +264 -0
  61. package/dist/middleware-core-B0jf5_Hm.mjs.map +1 -0
  62. package/dist/middleware-core-Bol44X9C.d.ts +17 -0
  63. package/dist/middleware-core-Bol44X9C.d.ts.map +1 -0
  64. package/dist/middleware-core-CMc-2QkU.js +274 -0
  65. package/dist/middleware-core-DycsbHUd.d.mts +17 -0
  66. package/dist/middleware-core-DycsbHUd.d.mts.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 +77 -24
  72. package/dist/middleware-edge.mjs +74 -23
  73. package/dist/middleware-edge.mjs.map +1 -1
  74. package/dist/{middleware-node-context-rgnc7UNR.js → middleware-node-context-591KsiYg.js} +8 -7
  75. package/dist/{middleware-node-context-BqPbf-fI.mjs → middleware-node-context-D_ZyUEcA.mjs} +6 -5
  76. package/dist/middleware-node-context-D_ZyUEcA.mjs.map +1 -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 +13 -5
  82. package/dist/middleware-node.mjs +13 -5
  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-CYsHrTQI.d.ts +5 -0
  92. package/dist/public-api-DkG7pRE0.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.map +0 -1
  120. package/dist/config-Doe0Tn53.d.mts.map +0 -1
  121. package/dist/create-middleware.d.mts +0 -11
  122. package/dist/create-middleware.d.mts.map +0 -1
  123. package/dist/create-middleware.d.ts +0 -11
  124. package/dist/create-middleware.d.ts.map +0 -1
  125. package/dist/create-middleware.js +0 -39
  126. package/dist/create-middleware.mjs +0 -38
  127. package/dist/create-middleware.mjs.map +0 -1
  128. package/dist/edge/index.d.mts +0 -88
  129. package/dist/edge/index.d.mts.map +0 -1
  130. package/dist/edge/index.d.ts +0 -88
  131. package/dist/edge/index.d.ts.map +0 -1
  132. package/dist/edge/index.js +0 -362
  133. package/dist/edge/index.mjs +0 -362
  134. package/dist/edge/index.mjs.map +0 -1
  135. package/dist/edge-runtime-loader.d.mts +0 -49
  136. package/dist/edge-runtime-loader.d.mts.map +0 -1
  137. package/dist/edge-runtime-loader.d.ts +0 -49
  138. package/dist/edge-runtime-loader.d.ts.map +0 -1
  139. package/dist/edge-runtime-loader.js +0 -297
  140. package/dist/edge-runtime-loader.mjs +0 -292
  141. package/dist/edge-runtime-loader.mjs.map +0 -1
  142. package/dist/edge-wasm-middleware.d.mts +0 -43
  143. package/dist/edge-wasm-middleware.d.mts.map +0 -1
  144. package/dist/edge-wasm-middleware.d.ts +0 -43
  145. package/dist/edge-wasm-middleware.d.ts.map +0 -1
  146. package/dist/edge-wasm-middleware.js +0 -37
  147. package/dist/edge-wasm-middleware.mjs +0 -35
  148. package/dist/edge-wasm-middleware.mjs.map +0 -1
  149. package/dist/middleware-core-BYQP9FND.mjs +0 -165
  150. package/dist/middleware-core-BYQP9FND.mjs.map +0 -1
  151. package/dist/middleware-core-D6TijE6P.js +0 -175
  152. package/dist/middleware-node-CE4GevYs.d.ts +0 -20
  153. package/dist/middleware-node-CE4GevYs.d.ts.map +0 -1
  154. package/dist/middleware-node-DtyOuPta.d.mts +0 -20
  155. package/dist/middleware-node-DtyOuPta.d.mts.map +0 -1
  156. package/dist/middleware-node-context-BqPbf-fI.mjs.map +0 -1
  157. package/dist/middleware.d.mts +0 -25
  158. package/dist/middleware.d.mts.map +0 -1
  159. package/dist/middleware.d.ts +0 -25
  160. package/dist/middleware.d.ts.map +0 -1
  161. package/dist/middleware.js +0 -53
  162. package/dist/middleware.mjs +0 -51
  163. package/dist/middleware.mjs.map +0 -1
  164. package/dist/nodejs-wasm-loader.d.mts +0 -42
  165. package/dist/nodejs-wasm-loader.d.mts.map +0 -1
  166. package/dist/nodejs-wasm-loader.d.ts +0 -42
  167. package/dist/nodejs-wasm-loader.d.ts.map +0 -1
  168. package/dist/nodejs-wasm-loader.js +0 -70
  169. package/dist/nodejs-wasm-loader.mjs +0 -66
  170. package/dist/nodejs-wasm-loader.mjs.map +0 -1
  171. package/dist/policy.d.mts +0 -138
  172. package/dist/policy.d.mts.map +0 -1
  173. package/dist/policy.d.ts +0 -138
  174. package/dist/policy.d.ts.map +0 -1
  175. package/dist/policy.js +0 -236
  176. package/dist/policy.mjs +0 -205
  177. package/dist/policy.mjs.map +0 -1
  178. package/dist/session-tracker.d.mts +0 -50
  179. package/dist/session-tracker.d.mts.map +0 -1
  180. package/dist/session-tracker.d.ts +0 -50
  181. package/dist/session-tracker.d.ts.map +0 -1
  182. package/dist/session-tracker.js +0 -148
  183. package/dist/session-tracker.mjs +0 -147
  184. package/dist/session-tracker.mjs.map +0 -1
  185. package/dist/translate.d.mts +0 -48
  186. package/dist/translate.d.mts.map +0 -1
  187. package/dist/translate.d.ts +0 -48
  188. package/dist/translate.d.ts.map +0 -1
  189. package/dist/translate.js +0 -79
  190. package/dist/translate.mjs +0 -79
  191. package/dist/translate.mjs.map +0 -1
  192. package/dist/types-C0SkqLMM.d.mts +0 -102
  193. package/dist/types-C0SkqLMM.d.mts.map +0 -1
  194. package/dist/types-C7DNSCTO.d.ts +0 -102
  195. package/dist/types-C7DNSCTO.d.ts.map +0 -1
  196. package/dist/utils-Cj4XNhIY.mjs +0 -35
  197. package/dist/utils-Cj4XNhIY.mjs.map +0 -1
  198. package/dist/utils-DAisnYnI.js +0 -45
  199. package/dist/wasm-setup.d.mts +0 -47
  200. package/dist/wasm-setup.d.mts.map +0 -1
  201. package/dist/wasm-setup.d.ts +0 -47
  202. package/dist/wasm-setup.d.ts.map +0 -1
  203. package/dist/wasm-setup.js +0 -91
  204. package/dist/wasm-setup.mjs +0 -95
  205. package/dist/wasm-setup.mjs.map +0 -1
  206. package/wasm/agentshield_wasm.d.ts +0 -479
  207. package/wasm/agentshield_wasm.js +0 -1536
  208. package/wasm/agentshield_wasm_bg.wasm +0 -0
  209. package/wasm/package.json +0 -30
  210. package/wasm.d.ts +0 -21
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-B0jf5_Hm.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-C-ngFX_8.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-CPP1RV0f.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-DVgOFxJs.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,13 +1,13 @@
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-CMc-2QkU.js');
3
+ const require_middleware_node_context = require('./middleware-node-context-591KsiYg.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",
10
+ loadEngine: () => import("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler"),
11
11
  buildComposedContext: require_middleware_node_context.buildComposedContext
12
12
  });
13
13
  }
@@ -1,12 +1,12 @@
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-B0jf5_Hm.mjs";
2
+ import { t as buildComposedContext } from "./middleware-node-context-D_ZyUEcA.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",
9
+ loadEngine: () => import("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler"),
10
10
  buildComposedContext
11
11
  });
12
12
  }
@@ -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 { 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(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 buildComposedContext,\n });\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAe,QAA0B;CACvD,OAAO,mBAAmB,QAAQ;EAChC,SAAS;EAGT,kBAAkB,OAAO;EACzB;CACF,CAAC;AACH"}
@@ -0,0 +1,264 @@
1
+ import { n as failClosedResponse, t as adaptToNextResponse } from "./adapt-BdQ9R7Iw.mjs";
2
+ import { t as getClientIp } from "./utils-Cnwg0VrY.mjs";
3
+ import { postureRequestFromHeaders, validateBrowserPostureConfig } from "@kya-os/checkpoint-shared/browser-posture";
4
+ import { DEFAULT_DASHBOARD_URL, applyBrowserIntegrityStepUp, applyBrowserPosture, applyComposedPolicy, applyRequestClaim, createLocalRequestClaimStore, createPlatformRequestClaimStore, isConsentRemediableBlock, resolveTrustedDelegationRootsForRequest, validateBrowserIntegrityChallenge } from "@kya-os/checkpoint-wasm-runtime/composed-policy";
5
+ import { makeEngineDefaults } from "@kya-os/checkpoint-wasm-runtime/adapters";
6
+ import { makeDetectionReporter } from "@kya-os/checkpoint-wasm-runtime/reporter";
7
+ import { PolicyFetcher } from "@kya-os/checkpoint-shared/policy/fetcher";
8
+ import { resolveChallengeContext, selectBodyReadable200 } from "@kya-os/checkpoint-shared/host-adapter";
9
+ import { waitUntil } from "@vercel/functions";
10
+
11
+ //#region src/translate.ts
12
+ /**
13
+ * Translate a Next.js `NextRequest` into the orchestrator's
14
+ * `IncomingHttpLike` shape.
15
+ *
16
+ * When `opts.drainJsonBody !== false` and the request is JSON, the
17
+ * translator clones the request and reads the body into a string so
18
+ * the orchestrator's `buildAgentRequest` can extract a
19
+ * `_meta.proof.jws` envelope. The original `req.body` stream is
20
+ * preserved for downstream handlers via `req.clone()`.
21
+ *
22
+ * When the body can't be read (drain disabled, non-JSON, or a stream
23
+ * error) we pass `body: null` and the orchestrator routes to
24
+ * PlainHttp — same behavior as the pre-1.1.0 default.
25
+ */
26
+ async function nextRequestToHttpLike(req, opts = {}) {
27
+ const url = new URL(req.url);
28
+ const body = await tryDrainJsonBody(req, opts);
29
+ return {
30
+ method: req.method,
31
+ url: url.pathname + url.search,
32
+ headers: headersToRecord(req.headers),
33
+ body,
34
+ remoteAddress: getClientIp(req, opts.clientIpPolicy)
35
+ };
36
+ }
37
+ /**
38
+ * Read the request body as a UTF-8 string when JSON and the caller
39
+ * has opted in (default). Returns `null` on any failure — the
40
+ * orchestrator handles `null` as "no body present" (→ PlainHttp).
41
+ *
42
+ * Clone-first means the original `req.body` ReadableStream stays
43
+ * unconsumed and downstream handlers can re-read it. Without the
44
+ * clone, calling `req.text()` in middleware would block any route
45
+ * handler that needs the body.
46
+ */
47
+ async function tryDrainJsonBody(req, opts) {
48
+ if (opts.drainJsonBody === false) return null;
49
+ if (!(req.headers.get("content-type") ?? "").toLowerCase().includes("application/json")) return null;
50
+ try {
51
+ return await req.clone().text();
52
+ } catch {
53
+ return null;
54
+ }
55
+ }
56
+ /**
57
+ * Convert a `Headers` instance into a lowercase-keyed plain object.
58
+ * HTTP header names are case-insensitive (RFC 9110 § 5.1); the
59
+ * orchestrator does case-sensitive lookups, so we normalise to
60
+ * lowercase here. Multi-value headers (Set-Cookie, Accept) are
61
+ * surfaced as their `Headers.get()` view — a single string with
62
+ * comma-joined values, matching what other host adapters produce.
63
+ */
64
+ function headersToRecord(headers) {
65
+ const out = {};
66
+ headers.forEach((value, key) => {
67
+ out[key.toLowerCase()] = value;
68
+ });
69
+ return out;
70
+ }
71
+
72
+ //#endregion
73
+ //#region src/middleware-core.ts
74
+ /**
75
+ * Shared Next.js request pipeline. Node, bundler and Edge hosts inject their
76
+ * engine and policy-context factories; runtime-specific WASM initialization
77
+ * stays in each host entry. Public withCheckpoint exports live there too.
78
+ */
79
+ /**
80
+ * Build the Checkpoint middleware. Returns a function `(req) => NextResponse`
81
+ * suitable for `export default withCheckpoint({...})` in `middleware.ts`.
82
+ *
83
+ * Every verification decision flows through the Rust `kya-os-engine`
84
+ * via WASM. The TS layer translates request shape, calls
85
+ * `verifyRequest`, and translates the verdict to `NextResponse`. No
86
+ * verification logic lives in this file.
87
+ *
88
+ * It never throws. An error in the configuration or in loading the engine
89
+ * would otherwise fail the middleware module, and a Next.js middleware that
90
+ * fails to load can let requests through unchecked. Every such error is
91
+ * answered 503 instead (fail closed) and logged.
92
+ */
93
+ let warnedLocalClaimStore = false;
94
+ /**
95
+ * Where accepted signed requests are claimed: the caller's store, else the
96
+ * dashboard's shared ledger when the project is configured, else this
97
+ * process (or isolate), with a one-time warning that several instances need
98
+ * a shared store.
99
+ */
100
+ function buildRequestClaimStore(config) {
101
+ if (config.requestClaimStore) return config.requestClaimStore;
102
+ if (config.apiKey && config.projectId) return createPlatformRequestClaimStore({
103
+ baseUrl: config.dashboardUrl ?? config.baseUrl ?? DEFAULT_DASHBOARD_URL,
104
+ apiKey: config.apiKey
105
+ });
106
+ if (!warnedLocalClaimStore) {
107
+ warnedLocalClaimStore = true;
108
+ console.warn("[checkpoint] signed requests are claimed in this process only; a deployment with several instances needs apiKey and projectId, or a shared requestClaimStore");
109
+ }
110
+ return createLocalRequestClaimStore();
111
+ }
112
+ function makeNextMiddleware(config, host) {
113
+ try {
114
+ return makePipeline(config, host);
115
+ } catch (error) {
116
+ return async function misconfiguredCheckpointMiddleware() {
117
+ console.error("[checkpoint] withCheckpoint is misconfigured; responding 503:", error);
118
+ return failClosedResponse();
119
+ };
120
+ }
121
+ }
122
+ function makePipeline(config, host) {
123
+ if (config.browserPosture) validateBrowserPostureConfig(config.browserPosture, config.projectId);
124
+ if (config.browserPosture?.protectedRoutes?.length && !config.resolveDelegationChallenge) throw new Error("browserPosture.protectedRoutes requires resolveDelegationChallenge (see createBrowserIntegrityChallengeResolver)");
125
+ host.start?.(config);
126
+ const engine = memoizeEngine(host.loadEngine);
127
+ engine().catch(() => void 0);
128
+ const opts = buildVerifyOpts(config);
129
+ const reporter = buildReporter(config, host.runtime);
130
+ const composed = host.buildComposedContext(config);
131
+ const requestClaimStore = buildRequestClaimStore(config);
132
+ const trustedRootsResolver = buildTrustedRootsResolver(config, composed);
133
+ const translateOpts = {
134
+ drainJsonBody: config.drainJsonBody,
135
+ clientIpPolicy: config.clientIpPolicy
136
+ };
137
+ return async function checkpointMiddleware(req, event) {
138
+ const waitUntil$1 = event ? (promise) => event.waitUntil(promise) : waitUntil;
139
+ try {
140
+ const { verifyRequest, renderDecisionAsResponse } = await engine().catch((error) => {
141
+ console.error("[checkpoint] kya-os-engine failed to load; responding 503:", error);
142
+ throw error;
143
+ });
144
+ const httpLike = await nextRequestToHttpLike(req, translateOpts);
145
+ const trustedDelegationRoots = await resolveTrustedDelegationRootsForRequest(trustedRootsResolver, req.headers);
146
+ const result = await verifyRequest(httpLike, {
147
+ ...opts,
148
+ ...trustedDelegationRoots ? { trustedDelegationRoots } : {},
149
+ waitUntil: waitUntil$1
150
+ });
151
+ await applyBrowserPosture(result, postureRequestFromHeaders((name) => req.headers.get(name)), config.browserPosture, config.projectId);
152
+ await applyComposedPolicy(composed, result, req.nextUrl.pathname);
153
+ applyBrowserIntegrityStepUp(result, config.browserPosture, req.nextUrl.pathname);
154
+ await applyRequestClaim(result, requestClaimStore, { sourceIp: getClientIp(req, config.clientIpPolicy) ?? void 0 });
155
+ if (reporter) waitUntil$1(reporter(result, extractReporterContext(req, config.clientIpPolicy)));
156
+ await dispatchOnResult(config, result, req);
157
+ const bodyReadable200 = selectBodyReadable200(config.delegationChallengeMode ?? "negotiated", req.headers, result.detectionDetail.detectionClass, result.detectionDetail.isAgent);
158
+ const challengeContextRequested = result.enforcementMode === "enforce" && (result.decision.kind === "Challenge" || isConsentRemediableBlock(result)) && config.resolveDelegationChallenge !== void 0;
159
+ const delegationChallenge = challengeContextRequested ? await resolveChallengeContext(config.resolveDelegationChallenge, {
160
+ result,
161
+ request: req
162
+ }, {
163
+ timeoutMs: config.delegationChallengeTimeoutMs,
164
+ onFailure: config.onDelegationChallengeFailure
165
+ }) : void 0;
166
+ const rendered = renderDecisionAsResponse(result, {
167
+ bodyReadable200,
168
+ delegationChallenge: validateBrowserIntegrityChallenge(result, delegationChallenge),
169
+ challengeContextRequested
170
+ });
171
+ return adaptToNextResponse(rendered, req);
172
+ } catch (err) {
173
+ if (config.debug) console.error("[checkpoint] verification pipeline failed; responding 503:", err);
174
+ return failClosedResponse();
175
+ }
176
+ };
177
+ }
178
+ /** Load the engine once; a failed load is retried by the next request. */
179
+ function memoizeEngine(load) {
180
+ let loading;
181
+ return () => loading ??= load().catch((error) => {
182
+ loading = void 0;
183
+ throw error;
184
+ });
185
+ }
186
+ /**
187
+ * Build a fire-and-forget detection reporter from the host config. Returns
188
+ * `null` when `apiKey` is not set — that case is the documented opt-out
189
+ * (engine still runs locally, dashboard just sees no detections).
190
+ */
191
+ /** npm package name this SDK self-reports to the detection reporter. */
192
+ const SDK_NAME = "@kya-os/checkpoint-nextjs";
193
+ /**
194
+ * Installed SDK version, self-reported to the detection reporter so the
195
+ * dashboard can version-gate "composed policy enforces here". MUST equal
196
+ * `package.json` version — pinned by a unit test (the old hardcoded `0.1.0` had
197
+ * drifted). Re-exported as `VERSION` from the package index.
198
+ */
199
+ const VERSION = "1.11.0";
200
+ function buildReporter(config, runtime = "node") {
201
+ if (!config.apiKey) return null;
202
+ return makeDetectionReporter({
203
+ apiKey: config.apiKey,
204
+ baseUrl: config.baseUrl,
205
+ debug: config.debug,
206
+ sdk: {
207
+ name: SDK_NAME,
208
+ version: VERSION,
209
+ runtime
210
+ }
211
+ });
212
+ }
213
+ /**
214
+ * Build the per-factory trusted-delegation-roots resolver (P2 / DR-1). Root
215
+ * pinning is a security concern INDEPENDENT of composed Cedar enforcement, so it
216
+ * must resolve wherever a `projectId` exists — including Edge setups that never
217
+ * wire `cedarWasmModule` (where `buildComposedContext` returns null). Prefers the
218
+ * composed context's accessor (reuses its cached fetcher / honors an injected
219
+ * enforcer); otherwise falls back to a `projectId`-only policy fetch. Returns
220
+ * `null` when no source is configured (no roots → the engine rejects delegation).
221
+ * An origin outage rejects with `PolicyUnavailableError`, which the middleware
222
+ * answers as a retryable 503.
223
+ */
224
+ function buildTrustedRootsResolver(config, composed) {
225
+ if (config.trustedDelegationRoots) return () => Promise.resolve(config.trustedDelegationRoots);
226
+ if (composed?.trustedDelegationRoots) return () => composed.trustedDelegationRoots();
227
+ if (!config.projectId) return null;
228
+ const fetcher = new PolicyFetcher({
229
+ apiBaseUrl: config.dashboardUrl ?? config.baseUrl ?? DEFAULT_DASHBOARD_URL,
230
+ apiKey: config.apiKey,
231
+ cacheTtlSeconds: config.policyCacheTtlSeconds,
232
+ throwOnUnavailable: true
233
+ });
234
+ const projectId = config.projectId;
235
+ return async () => (await fetcher.getPolicy(projectId)).trustedDelegationRoots ?? [];
236
+ }
237
+ /**
238
+ * Pull the request context the dashboard's `/api/v1/log-detection`
239
+ * endpoint expects out of a `NextRequest`. Works under both Node and
240
+ * Edge runtimes — no runtime-specific APIs.
241
+ */
242
+ function extractReporterContext(req, policy) {
243
+ return {
244
+ userAgent: req.headers.get("user-agent") ?? void 0,
245
+ ipAddress: getClientIp(req, policy),
246
+ path: req.nextUrl.pathname,
247
+ url: req.nextUrl.href,
248
+ method: req.method
249
+ };
250
+ }
251
+ /** The engine's default options for this config; per-request fields go on top. */
252
+ function buildVerifyOpts(config) {
253
+ return makeEngineDefaults(config);
254
+ }
255
+ async function dispatchOnResult(config, result, req) {
256
+ if (!config.onResult) return;
257
+ try {
258
+ await config.onResult(result, req);
259
+ } catch {}
260
+ }
261
+
262
+ //#endregion
263
+ export { makeNextMiddleware as n, VERSION as t };
264
+ //# sourceMappingURL=middleware-core-B0jf5_Hm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-core-B0jf5_Hm.mjs","names":["waitUntil","vercelWaitUntil"],"sources":["../src/translate.ts","../src/middleware-core.ts"],"sourcesContent":["/**\n * D.2 — `NextRequest` → `IncomingHttpLike` translator.\n *\n * The host wrapper's *only* job on the inbound path: take Next.js's\n * native request shape and produce the transport-agnostic\n * `IncomingHttpLike` Phase C's orchestrator consumes. Zero verification\n * logic, zero adapter calls, zero engine I/O.\n *\n * Shared between the Node-runtime and Edge-runtime entries. Next.js\n * `NextRequest` is the same shape in both runtimes — `req.headers` is\n * a `Headers` instance, `req.body` is a `ReadableStream`, `req.ip` is\n * a getter (only present in some deployment surfaces; forwarding headers\n * are considered only when the caller selects a matching trust policy).\n */\n\nimport type { NextRequest } from 'next/server.js';\n\nimport type { IncomingHttpLike } from '@kya-os/checkpoint-wasm-runtime/orchestrator';\nimport type { ClientIpTrustPolicy } from '@kya-os/checkpoint-shared';\n\nimport { getClientIp } from './utils';\n\n/**\n * Options controlling translator side effects.\n *\n * `drainJsonBody` (default `true`) controls whether the translator\n * reads the request body so the orchestrator can extract a KYA-OS\n * envelope from `_meta.proof.jws` (the canonical spec-form transport).\n *\n * Trade-off — body draining consumes the request stream. We use\n * `req.clone().text()` so the original `req.body` stream is preserved\n * for downstream Next.js handlers. Cloning has memory overhead\n * proportional to the body size; for large request bodies (>1 MB) or\n * streaming-sensitive routes, set `drainJsonBody: false` and verify\n * envelopes via the `KYA-Delegation` header transport instead (the\n * legacy form, requires `legacyEnvelopeFallback: true` on\n * `withCheckpoint`).\n */\nexport interface NextRequestToHttpLikeOpts {\n /**\n * Read the request body when `content-type` is `application/json` so\n * the orchestrator can extract a KYA-OS envelope from\n * `_meta.proof.jws`. Default `true`. Set `false` for streaming\n * middlewares that can't tolerate the clone/read overhead.\n */\n drainJsonBody?: boolean;\n /** Deployment trust profile. Defaults to direct/peer-only fail-closed behavior. */\n clientIpPolicy?: ClientIpTrustPolicy;\n}\n\n/**\n * Translate a Next.js `NextRequest` into the orchestrator's\n * `IncomingHttpLike` shape.\n *\n * When `opts.drainJsonBody !== false` and the request is JSON, the\n * translator clones the request and reads the body into a string so\n * the orchestrator's `buildAgentRequest` can extract a\n * `_meta.proof.jws` envelope. The original `req.body` stream is\n * preserved for downstream handlers via `req.clone()`.\n *\n * When the body can't be read (drain disabled, non-JSON, or a stream\n * error) we pass `body: null` and the orchestrator routes to\n * PlainHttp — same behavior as the pre-1.1.0 default.\n */\nexport async function nextRequestToHttpLike(\n req: NextRequest,\n opts: NextRequestToHttpLikeOpts = {}\n): Promise<IncomingHttpLike> {\n const url = new URL(req.url);\n const body = await tryDrainJsonBody(req, opts);\n return {\n method: req.method,\n // Path + query only — orchestrator's URL parsing expects no scheme/host.\n url: url.pathname + url.search,\n headers: headersToRecord(req.headers),\n body,\n remoteAddress: getClientIp(req, opts.clientIpPolicy),\n };\n}\n\n/**\n * Read the request body as a UTF-8 string when JSON and the caller\n * has opted in (default). Returns `null` on any failure — the\n * orchestrator handles `null` as \"no body present\" (→ PlainHttp).\n *\n * Clone-first means the original `req.body` ReadableStream stays\n * unconsumed and downstream handlers can re-read it. Without the\n * clone, calling `req.text()` in middleware would block any route\n * handler that needs the body.\n */\nasync function tryDrainJsonBody(\n req: NextRequest,\n opts: NextRequestToHttpLikeOpts\n): Promise<string | null> {\n if (opts.drainJsonBody === false) return null;\n const contentType = req.headers.get('content-type') ?? '';\n if (!contentType.toLowerCase().includes('application/json')) return null;\n try {\n return await req.clone().text();\n } catch {\n // Body unreadable (stream errored, content-length mismatch, etc.).\n // Falling through to null routes the request as PlainHttp —\n // identical behavior to the pre-1.1.0 default.\n return null;\n }\n}\n\n/**\n * Convert a `Headers` instance into a lowercase-keyed plain object.\n * HTTP header names are case-insensitive (RFC 9110 § 5.1); the\n * orchestrator does case-sensitive lookups, so we normalise to\n * lowercase here. Multi-value headers (Set-Cookie, Accept) are\n * surfaced as their `Headers.get()` view — a single string with\n * comma-joined values, matching what other host adapters produce.\n */\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {};\n headers.forEach((value, key) => {\n out[key.toLowerCase()] = value;\n });\n return out;\n}\n","/**\n * Shared Next.js request pipeline. Node, bundler and Edge hosts inject their\n * engine and policy-context factories; runtime-specific WASM initialization\n * stays in each host entry. Public withCheckpoint exports live there too.\n */\n\nimport {\n postureRequestFromHeaders,\n validateBrowserPostureConfig,\n} from '@kya-os/checkpoint-shared/browser-posture';\nimport {\n applyBrowserPosture,\n applyBrowserIntegrityStepUp,\n applyComposedPolicy,\n applyRequestClaim,\n createLocalRequestClaimStore,\n createPlatformRequestClaimStore,\n isConsentRemediableBlock,\n resolveTrustedDelegationRootsForRequest,\n validateBrowserIntegrityChallenge,\n DEFAULT_DASHBOARD_URL,\n type ComposedPolicyContext,\n type TrustedDelegationRootsResolver,\n type RequestClaimStore,\n} from '@kya-os/checkpoint-wasm-runtime/composed-policy';\n\nimport { type NextFetchEvent, type NextRequest, type NextResponse } from 'next/server.js';\n\nimport type {\n renderDecisionAsResponse as RenderDecision,\n IncomingHttpLike,\n} from '@kya-os/checkpoint-wasm-runtime/orchestrator';\nimport type { VerifyRequestEdgeOpts } from '@kya-os/checkpoint-wasm-runtime/orchestrator/edge';\nimport { makeEngineDefaults } from '@kya-os/checkpoint-wasm-runtime/adapters';\nimport {\n makeDetectionReporter,\n type DetectionReporter,\n type ReporterContext,\n} from '@kya-os/checkpoint-wasm-runtime/reporter';\nimport type { VerifyResult } from '@kya-os/checkpoint-wasm-runtime/engine';\nimport { PolicyFetcher } from '@kya-os/checkpoint-shared/policy/fetcher';\nimport {\n resolveChallengeContext,\n selectBodyReadable200,\n} from '@kya-os/checkpoint-shared/host-adapter';\n\nimport { waitUntil as vercelWaitUntil } from '@vercel/functions';\n\nimport { adaptToNextResponse, failClosedResponse } from './adapt';\nimport type { CheckpointConfig } from './config';\nimport { nextRequestToHttpLike } from './translate';\nimport { getClientIp } from './utils';\n\n// `CheckpointConfig` lives in `./config` (a 190-line documented contract); the\n// public import paths (`.`, `/node`, `/edge`) stay stable via this re-export.\nexport type { CheckpointConfig } from './config';\n\n/** The engine a host runs: one `./orchestrator` build of wasm-runtime. */\nexport interface EngineEntry {\n // Typed with the Edge options, which add `waitUntil`; the Node and bundler\n // builds take the same call and ignore it.\n verifyRequest: (req: IncomingHttpLike, opts: VerifyRequestEdgeOpts) => Promise<VerifyResult>;\n renderDecisionAsResponse: typeof RenderDecision;\n}\n\nexport interface NextMiddlewareHost {\n runtime: 'node' | 'edge';\n /**\n * Loads the engine. Hosts import it lazily, so a failure to load the engine\n * (a missing or unreadable `.wasm`) rejects here, inside the request\n * pipeline, and is answered 503 instead of failing the middleware module.\n */\n loadEngine: () => Promise<EngineEntry>;\n buildComposedContext: (config: CheckpointConfig) => ComposedPolicyContext | null;\n /** Host-specific setup, run once with the rest; it may throw. */\n start?: (config: CheckpointConfig) => void;\n}\n\ntype CheckpointMiddleware = (\n req: NextRequest,\n event?: Pick<NextFetchEvent, 'waitUntil'>\n) => Promise<NextResponse>;\n\n/**\n * Build the Checkpoint middleware. Returns a function `(req) => NextResponse`\n * suitable for `export default withCheckpoint({...})` in `middleware.ts`.\n *\n * Every verification decision flows through the Rust `kya-os-engine`\n * via WASM. The TS layer translates request shape, calls\n * `verifyRequest`, and translates the verdict to `NextResponse`. No\n * verification logic lives in this file.\n *\n * It never throws. An error in the configuration or in loading the engine\n * would otherwise fail the middleware module, and a Next.js middleware that\n * fails to load can let requests through unchecked. Every such error is\n * answered 503 instead (fail closed) and logged.\n */\nlet warnedLocalClaimStore = false;\n\n/**\n * Where accepted signed requests are claimed: the caller's store, else the\n * dashboard's shared ledger when the project is configured, else this\n * process (or isolate), with a one-time warning that several instances need\n * a shared store.\n */\nfunction buildRequestClaimStore(config: CheckpointConfig): RequestClaimStore {\n if (config.requestClaimStore) return config.requestClaimStore;\n if (config.apiKey && config.projectId) {\n return createPlatformRequestClaimStore({\n baseUrl: config.dashboardUrl ?? config.baseUrl ?? DEFAULT_DASHBOARD_URL,\n apiKey: config.apiKey,\n });\n }\n if (!warnedLocalClaimStore) {\n warnedLocalClaimStore = true;\n console.warn(\n '[checkpoint] signed requests are claimed in this process only; a deployment with several instances needs apiKey and projectId, or a shared requestClaimStore'\n );\n }\n return createLocalRequestClaimStore();\n}\n\nexport function makeNextMiddleware(\n config: CheckpointConfig,\n host: NextMiddlewareHost\n): CheckpointMiddleware {\n try {\n return makePipeline(config, host);\n } catch (error) {\n return async function misconfiguredCheckpointMiddleware() {\n console.error('[checkpoint] withCheckpoint is misconfigured; responding 503:', error);\n return failClosedResponse();\n };\n }\n}\n\nfunction makePipeline(config: CheckpointConfig, host: NextMiddlewareHost): CheckpointMiddleware {\n if (config.browserPosture) validateBrowserPostureConfig(config.browserPosture, config.projectId);\n if (config.browserPosture?.protectedRoutes?.length && !config.resolveDelegationChallenge) {\n throw new Error(\n 'browserPosture.protectedRoutes requires resolveDelegationChallenge (see createBrowserIntegrityChallengeResolver)'\n );\n }\n host.start?.(config);\n const engine = memoizeEngine(host.loadEngine);\n // Start loading now; a failure is answered by the first request that needs it.\n engine().catch(() => undefined);\n const opts = buildVerifyOpts(config);\n const reporter = buildReporter(config, host.runtime);\n // Null deliberately disables composed policy on Edge without a Cedar module;\n // it must never fall back to a Node policy compiler.\n const composed = host.buildComposedContext(config);\n const requestClaimStore = buildRequestClaimStore(config);\n const trustedRootsResolver = buildTrustedRootsResolver(config, composed);\n const translateOpts = {\n drainJsonBody: config.drainJsonBody,\n clientIpPolicy: config.clientIpPolicy,\n };\n return async function checkpointMiddleware(\n req: NextRequest,\n event?: Pick<NextFetchEvent, 'waitUntil'>\n ): Promise<NextResponse> {\n // Work that outlives the response (the engine's vendor key feed round, the\n // detection report) must be registered, or Vercel and Workers cancel it\n // once the response is sent. Next.js passes the event to middleware; a\n // wrapper that drops it falls back to Vercel's request context.\n const waitUntil = event\n ? (promise: Promise<unknown>) => event.waitUntil(promise)\n : vercelWaitUntil;\n try {\n const { verifyRequest, renderDecisionAsResponse } = await engine().catch((error) => {\n console.error('[checkpoint] kya-os-engine failed to load; responding 503:', error);\n throw error;\n });\n const httpLike = await nextRequestToHttpLike(req, translateOpts);\n // P2 / DR-1: on a credential-bearing request, pin the engine's L2 delegation chains\n // to the org's trusted roots (resolved from the same cached policy payload).\n // Omitted on the hot path → opts unchanged (byte-identical to pre-P2).\n const trustedDelegationRoots = await resolveTrustedDelegationRootsForRequest(\n trustedRootsResolver,\n req.headers\n );\n const result = await verifyRequest(httpLike, {\n ...opts,\n ...(trustedDelegationRoots ? { trustedDelegationRoots } : {}),\n waitUntil,\n });\n // Composed (kya-os-engine) policy seam — swaps result.decision in place when\n // the project's deployed Cedar bundle acts. MUST run BEFORE the reporter so\n // the dashboard records the enforced decision (parity with Express + the\n // shadow→enforce telemetry). `req.nextUrl.pathname` is the query-free path\n // verification saw. A fault on an enforcing project throws → 503.\n await applyBrowserPosture(\n result,\n postureRequestFromHeaders((name) => req.headers.get(name)),\n config.browserPosture,\n config.projectId\n );\n await applyComposedPolicy(composed, result, req.nextUrl.pathname);\n applyBrowserIntegrityStepUp(result, config.browserPosture, req.nextUrl.pathname);\n // The final decision is known: claim an accepted signed request before\n // anything acts on it, so it is used once.\n await applyRequestClaim(result, requestClaimStore, {\n sourceIp: getClientIp(req, config.clientIpPolicy) ?? undefined,\n });\n if (reporter) {\n waitUntil(reporter(result, extractReporterContext(req, config.clientIpPolicy)));\n }\n await dispatchOnResult(config, result, req);\n // Dual envelope: body-readable 200 step-up for cooperative agents under\n // negotiated mode; else the spec 401/422. Shared selector (drift-proof).\n const bodyReadable200 = selectBodyReadable200(\n config.delegationChallengeMode ?? 'negotiated',\n req.headers,\n result.detectionDetail.detectionClass,\n result.detectionDetail.isAgent\n );\n const challengeContextRequested =\n result.enforcementMode === 'enforce' &&\n (result.decision.kind === 'Challenge' || isConsentRemediableBlock(result)) &&\n config.resolveDelegationChallenge !== undefined;\n const delegationChallenge = challengeContextRequested\n ? await resolveChallengeContext(\n config.resolveDelegationChallenge,\n { result, request: req },\n {\n timeoutMs: config.delegationChallengeTimeoutMs,\n onFailure: config.onDelegationChallengeFailure,\n }\n )\n : undefined;\n const rendered = renderDecisionAsResponse(result, {\n bodyReadable200,\n delegationChallenge: validateBrowserIntegrityChallenge(result, delegationChallenge),\n challengeContextRequested,\n });\n return adaptToNextResponse(rendered, req);\n } catch (err) {\n if (config.debug) {\n console.error('[checkpoint] verification pipeline failed; responding 503:', err);\n }\n return failClosedResponse();\n }\n };\n}\n\n/** Load the engine once; a failed load is retried by the next request. */\nfunction memoizeEngine(load: () => Promise<EngineEntry>): () => Promise<EngineEntry> {\n let loading: Promise<EngineEntry> | undefined;\n return () =>\n (loading ??= load().catch((error: unknown) => {\n loading = undefined;\n throw error;\n }));\n}\n\n/**\n * Build a fire-and-forget detection reporter from the host config. Returns\n * `null` when `apiKey` is not set — that case is the documented opt-out\n * (engine still runs locally, dashboard just sees no detections).\n */\n/** npm package name this SDK self-reports to the detection reporter. */\nconst SDK_NAME = '@kya-os/checkpoint-nextjs';\n\n/**\n * Installed SDK version, self-reported to the detection reporter so the\n * dashboard can version-gate \"composed policy enforces here\". MUST equal\n * `package.json` version — pinned by a unit test (the old hardcoded `0.1.0` had\n * drifted). Re-exported as `VERSION` from the package index.\n */\nexport const VERSION = '1.11.0';\n\nfunction buildReporter(\n config: CheckpointConfig,\n runtime: 'node' | 'edge' = 'node'\n): DetectionReporter | null {\n if (!config.apiKey) return null;\n return makeDetectionReporter({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl,\n debug: config.debug,\n // Self-identify (incl. node-vs-edge) so the dashboard can version-gate\n // enforcement. Next.js EDGE composed enforcement is opt-in (needs\n // `cedarWasmModule`), so the dashboard shows it as opt-in, never \"Enforcing\".\n sdk: { name: SDK_NAME, version: VERSION, runtime },\n });\n}\n\n/**\n * Build the per-factory trusted-delegation-roots resolver (P2 / DR-1). Root\n * pinning is a security concern INDEPENDENT of composed Cedar enforcement, so it\n * must resolve wherever a `projectId` exists — including Edge setups that never\n * wire `cedarWasmModule` (where `buildComposedContext` returns null). Prefers the\n * composed context's accessor (reuses its cached fetcher / honors an injected\n * enforcer); otherwise falls back to a `projectId`-only policy fetch. Returns\n * `null` when no source is configured (no roots → the engine rejects delegation).\n * An origin outage rejects with `PolicyUnavailableError`, which the middleware\n * answers as a retryable 503.\n */\nfunction buildTrustedRootsResolver(\n config: CheckpointConfig,\n composed: ComposedPolicyContext | null\n): TrustedDelegationRootsResolver | null {\n if (config.trustedDelegationRoots) return () => Promise.resolve(config.trustedDelegationRoots!);\n if (composed?.trustedDelegationRoots) {\n return () => composed.trustedDelegationRoots!();\n }\n if (!config.projectId) return null;\n const fetcher = new PolicyFetcher({\n apiBaseUrl: config.dashboardUrl ?? config.baseUrl ?? DEFAULT_DASHBOARD_URL,\n apiKey: config.apiKey,\n cacheTtlSeconds: config.policyCacheTtlSeconds,\n throwOnUnavailable: true,\n });\n const projectId = config.projectId;\n return async () => (await fetcher.getPolicy(projectId)).trustedDelegationRoots ?? [];\n}\n\n/**\n * Pull the request context the dashboard's `/api/v1/log-detection`\n * endpoint expects out of a `NextRequest`. Works under both Node and\n * Edge runtimes — no runtime-specific APIs.\n */\nfunction extractReporterContext(\n req: NextRequest,\n policy: import('@kya-os/checkpoint-shared').ClientIpTrustPolicy | undefined\n): ReporterContext {\n return {\n userAgent: req.headers.get('user-agent') ?? undefined,\n ipAddress: getClientIp(req, policy),\n path: req.nextUrl.pathname,\n url: req.nextUrl.href,\n method: req.method,\n };\n}\n\n/** The engine's default options for this config; per-request fields go on top. */\nfunction buildVerifyOpts(config: CheckpointConfig) {\n return makeEngineDefaults(config);\n}\n\nasync function dispatchOnResult(\n config: CheckpointConfig,\n result: VerifyResult,\n req: NextRequest\n): Promise<void> {\n if (!config.onResult) return;\n try {\n await config.onResult(result, req);\n } catch {\n // Swallow — onResult is observability, not verdict-critical.\n // Verdict already computed; let the response proceed.\n }\n}\n"],"mappings":"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"}
@@ -0,0 +1,17 @@
1
+ import "./config-DVgOFxJs.js";
2
+ import { NextRequest, NextResponse } from "next/server.js";
3
+ import "@kya-os/checkpoint-wasm-runtime/orchestrator/edge";
4
+ import { ComposedPolicyContext } from "@kya-os/checkpoint-wasm-runtime/composed-policy";
5
+ import { VerifyResult } from "@kya-os/checkpoint-wasm-runtime/engine";
6
+ import "@kya-os/checkpoint-wasm-runtime/orchestrator";
7
+ //#region src/middleware-core.d.ts
8
+ /**
9
+ * Installed SDK version, self-reported to the detection reporter so the
10
+ * dashboard can version-gate "composed policy enforces here". MUST equal
11
+ * `package.json` version — pinned by a unit test (the old hardcoded `0.1.0` had
12
+ * drifted). Re-exported as `VERSION` from the package index.
13
+ */
14
+ declare const VERSION = "1.11.0";
15
+ //#endregion
16
+ export { VERSION as t };
17
+ //# sourceMappingURL=middleware-core-Bol44X9C.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-core-Bol44X9C.d.ts","names":[],"sources":["../src/middleware-core.ts"],"mappings":";;;;;;;;;;;;;cA8Qa"}