@kya-os/checkpoint-wasm-runtime 1.2.0 → 1.4.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 (51) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/dist/adapters.d.mts +1 -1
  3. package/dist/adapters.d.ts +1 -1
  4. package/dist/engine-edge.d.mts +2 -2
  5. package/dist/engine-edge.d.ts +2 -2
  6. package/dist/engine-edge.js +3 -509
  7. package/dist/engine-edge.mjs +3 -508
  8. package/dist/engine-node.d.mts +46 -0
  9. package/dist/engine-node.d.ts +46 -0
  10. package/dist/engine-node.js +31 -0
  11. package/dist/engine-node.mjs +10 -0
  12. package/dist/engine.d.mts +25 -4
  13. package/dist/engine.d.ts +25 -4
  14. package/dist/engine.js +2 -457
  15. package/dist/engine.mjs +2 -464
  16. package/dist/index.d.mts +531 -3
  17. package/dist/index.d.ts +531 -3
  18. package/dist/index.js +2 -28
  19. package/dist/index.mjs +2 -29
  20. package/dist/node.d.mts +524 -3
  21. package/dist/node.d.ts +524 -3
  22. package/dist/node.js +2 -26
  23. package/dist/node.mjs +2 -26
  24. package/dist/orchestrator-edge.d.mts +24 -10
  25. package/dist/orchestrator-edge.d.ts +24 -10
  26. package/dist/orchestrator-edge.js +5 -510
  27. package/dist/orchestrator-edge.mjs +5 -509
  28. package/dist/orchestrator-node.d.mts +60 -52
  29. package/dist/orchestrator-node.d.ts +60 -52
  30. package/dist/orchestrator-node.js +50 -487
  31. package/dist/orchestrator-node.mjs +34 -497
  32. package/dist/orchestrator.d.mts +356 -4
  33. package/dist/orchestrator.d.ts +356 -4
  34. package/dist/orchestrator.js +37 -1001
  35. package/dist/orchestrator.mjs +37 -1005
  36. package/dist/{types-ByrdPLL2.d.ts → types-KPEcVvac.d.mts} +31 -1
  37. package/dist/{types-ByrdPLL2.d.mts → types-KPEcVvac.d.ts} +31 -1
  38. package/package.json +13 -2
  39. package/wasm/agentshield_wasm_bg.wasm +0 -0
  40. package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
  41. package/wasm/kya-os-engine/package.json +24 -4
  42. package/wasm/kya-os-engine-bundler/kya_os_engine.d.ts +24 -0
  43. package/wasm/kya-os-engine-bundler/kya_os_engine.js +4 -0
  44. package/wasm/kya-os-engine-bundler/kya_os_engine_bg.js +522 -0
  45. package/wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm +0 -0
  46. package/wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm.d.ts +8 -0
  47. package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
  48. package/wasm/kya-os-engine-web/package.json +25 -3
  49. package/dist/kya_os_engine_bg.wasm +0 -0
  50. package/dist/rules-detector-ZIKHN-_y.d.mts +0 -532
  51. package/dist/rules-detector-ZIKHN-_y.d.ts +0 -532
@@ -1,4 +1,4 @@
1
- import { d as DidDocument, D as Decision, E as EnforcementMode, V as VerifyResult, A as AgentRequest } from './types-ByrdPLL2.js';
1
+ import { d as DidDocument, D as Decision, E as EnforcementMode, A as AgentRequest, C as ContextSpec, V as VerifyResult, e as EngineConfig } from './types-KPEcVvac.js';
2
2
  import '@kya-os/checkpoint-shared';
3
3
 
4
4
  /**
@@ -116,15 +116,6 @@ interface ClockAdapter {
116
116
  nowUnix(): number;
117
117
  }
118
118
 
119
- /**
120
- * Orchestrator-layer types — Phase C, host-side only.
121
- *
122
- * Nothing here crosses the WASM boundary. The engine ABI types live
123
- * in `../types.ts`; the adapter interfaces live in
124
- * `../adapters/index.ts`. This file is the host-wrapper-facing
125
- * surface — what Phase D (Next.js) and Phase E (Express) import.
126
- */
127
-
128
119
  /**
129
120
  * Framework-agnostic HTTP request shape.
130
121
  *
@@ -181,6 +172,29 @@ interface VerifyRequestOpts {
181
172
  argusUrl?: string;
182
173
  /** Injectable for the once-only Argus configuration warning. */
183
174
  logger?: (msg: string) => void;
175
+ /**
176
+ * Override the engine WASM-bridge function used during the sync
177
+ * `verify()` call. Defaults to the wasm-bindgen `--target bundler`
178
+ * variant imported by `./verify-request.ts` from `'../index'`.
179
+ *
180
+ * The `./orchestrator/node` subpath (SDK-Next.js-Integration-Audit-1
181
+ * / #2618 safety net) injects the `--target nodejs` variant here so
182
+ * Webpack-without-asyncWebAssembly consumers don't transitively pull
183
+ * the bundler artifact through the orchestrator's verify call.
184
+ */
185
+ engineVerifyFn?: (input: AgentRequest, ctx: ContextSpec) => VerifyResult;
186
+ /**
187
+ * Engine-default behaviour knobs forwarded onto every composed
188
+ * `ContextSpec`. Defaults to `{ tier3Action: 'monitor' }` so a host
189
+ * installing `@kya-os/checkpoint-*` with minimal config preserves
190
+ * 1.3.0 behaviour — tenant policy is the arbiter, the engine does
191
+ * not short-circuit known-agent UAs with an engine-default Block.
192
+ *
193
+ * Host wrappers that want the calibrated engine-default block opt
194
+ * into `{ tier3Action: 'block' }`. The bench harness is the
195
+ * canonical opt-in consumer. See the wasm-runtime 1.4.0 CHANGELOG.
196
+ */
197
+ engineConfig?: EngineConfig;
184
198
  }
185
199
  /**
186
200
  * Transport-agnostic response shape `renderDecisionAsResponse`
@@ -199,48 +213,6 @@ interface RenderedResponse {
199
213
  body?: string | object;
200
214
  }
201
215
 
202
- /**
203
- * `verifyRequest` async orchestrator — Phase C.2.
204
- *
205
- * The single entry point Phase D (Next.js) and Phase E (Express)
206
- * compose. Async pre-fetch on the host side; one sync `engineVerify`
207
- * call across the WASM boundary. Sync-engine / async-host invariant
208
- * (H-1 § 4.5) preserved.
209
- *
210
- * Orchestration:
211
- * 1. Translate HTTP → AgentRequest (no engine I/O).
212
- * 2. Extract identifiers (issuer DID, agent DID, status-list URL).
213
- * 3. Conditional Promise.all over the *applicable* adapters —
214
- * anonymous PlainHttp gets no network calls; signed MCP-I gets
215
- * DID + status-list + reputation in parallel.
216
- * 4. Translate adapter errors to verdicts where the architect-
217
- * ratified posture says so:
218
- * - DidResolver throw → Block(ParseError) verdict
219
- * - StatusListCache throw → re-throw (host renders 503)
220
- * - Reputation throw → impossible (Phase B § 4.5)
221
- * 5. Compute the tenant Decision via PolicyEvaluator over the
222
- * resolved reputation.
223
- * 6. Build ContextSpec, call `engineVerify`, return VerifyResult.
224
- *
225
- * Cedar-1 forward-compat: step (5) is the only place the
226
- * PolicyEvaluator interface gets exercised. When Cedar-1 swaps
227
- * implementations, this orchestrator does not change.
228
- */
229
-
230
- /**
231
- * Factory — constructs a `verifyRequest` closure that remembers the
232
- * one-shot Argus-not-configured warning state. Use this when the
233
- * host wrapper wants the startup log; call `verifyRequest` directly
234
- * (the loose function below) if you don't.
235
- */
236
- declare function makeVerifyRequest(opts: VerifyRequestOpts): (req: IncomingHttpLike) => Promise<VerifyResult>;
237
- /**
238
- * Single-shot async entry. Use [`makeVerifyRequest`] in long-lived
239
- * hosts (so the Argus warning is one-shot per process); use this
240
- * loose form in tests + one-off invocations.
241
- */
242
- declare function verifyRequest(req: IncomingHttpLike, opts: VerifyRequestOpts): Promise<VerifyResult>;
243
-
244
216
  /**
245
217
  * HTTP-to-`AgentRequest` translator — Phase C.1.
246
218
  *
@@ -354,4 +326,40 @@ declare function extractCredentialStatusUrl(request: AgentRequest): string | nul
354
326
 
355
327
  declare function renderDecisionAsResponse(result: VerifyResult): RenderedResponse;
356
328
 
329
+ /**
330
+ * Node-runtime orchestrator entry — SDK-Next.js-Integration-Audit-1
331
+ * (#2618) safety net.
332
+ *
333
+ * Bundler-safe variant of `./index.ts` (the runtime-agnostic barrel)
334
+ * for consumers running Webpack-class bundlers WITHOUT the
335
+ * `experiments.asyncWebAssembly` flag — or raw Node ESM without any
336
+ * bundler.
337
+ *
338
+ * **Why this exists:** `./index.ts` binds `verifyRequest` /
339
+ * `makeVerifyRequest` to the wasm-bindgen `--target bundler`
340
+ * `engineVerify`. The bundler artifact's `.wasm` entry uses
341
+ * `import * as wasm from "./*.wasm"` which Turbopack, Vite, esbuild,
342
+ * and Webpack-with-asyncWebAssembly handle natively — but legacy
343
+ * Webpack setups parse the static `.wasm` import as JavaScript and
344
+ * fail with `Unexpected character`. This entry binds the
345
+ * `--target nodejs` `engineVerify` instead (CJS `fs.readFileSync`
346
+ * inside the glue, no bundler involvement) so legacy Webpack
347
+ * consumers + raw Node ESM both work.
348
+ *
349
+ * **Routing:** the package's `exports` map's `"node"` condition on
350
+ * `./orchestrator` routes here for any bundler that respects the
351
+ * standard Node export condition (Next.js + Turbopack ≥16, webpack
352
+ * ≥5, esbuild, Vite, Bun). Consumers under the `"edge-runtime"` /
353
+ * `"browser"` conditions continue to route to `orchestrator-edge.mjs`
354
+ * (unchanged).
355
+ *
356
+ * **Public surface preserved.** Every export Node consumers actually
357
+ * use is re-exported here. The Edge-only exports (`verifyRequestEdge`,
358
+ * `makeVerifyRequestEdge`, `initEngineEdge`) are NOT included — Node
359
+ * consumers that explicitly need the Edge variant should import from
360
+ * `@kya-os/checkpoint-wasm-runtime/orchestrator/edge` directly.
361
+ */
362
+ declare const verifyRequest: (req: IncomingHttpLike, opts: VerifyRequestOpts) => Promise<VerifyResult>;
363
+ declare const makeVerifyRequest: (opts: VerifyRequestOpts) => (req: IncomingHttpLike) => Promise<VerifyResult>;
364
+
357
365
  export { type BuildAgentRequestOpts, type IncomingHttpLike, type RenderedResponse, type VerifyRequestOpts, buildAgentRequest, extractAgentDid, extractCredentialStatusUrl, extractIssuer, hasMalformedJwsBody, makeVerifyRequest, renderDecisionAsResponse, verifyRequest };