@kya-os/checkpoint-wasm-runtime 1.0.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 (71) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/adapters.d.mts +257 -0
  3. package/dist/adapters.d.ts +257 -0
  4. package/dist/adapters.js +603 -0
  5. package/dist/adapters.js.map +1 -0
  6. package/dist/adapters.mjs +586 -0
  7. package/dist/adapters.mjs.map +1 -0
  8. package/dist/dynamic-loader-cS-pUisw.d.ts +65 -0
  9. package/dist/dynamic-loader-qGJacfEC.d.mts +65 -0
  10. package/dist/edge.d.mts +22 -0
  11. package/dist/edge.d.ts +22 -0
  12. package/dist/edge.js +1403 -0
  13. package/dist/edge.js.map +1 -0
  14. package/dist/edge.mjs +1391 -0
  15. package/dist/edge.mjs.map +1 -0
  16. package/dist/engine-edge.d.mts +58 -0
  17. package/dist/engine-edge.d.ts +58 -0
  18. package/dist/engine-edge.js +537 -0
  19. package/dist/engine-edge.js.map +1 -0
  20. package/dist/engine-edge.mjs +533 -0
  21. package/dist/engine-edge.mjs.map +1 -0
  22. package/dist/engine.d.mts +34 -0
  23. package/dist/engine.d.ts +34 -0
  24. package/dist/engine.js +11 -0
  25. package/dist/engine.js.map +1 -0
  26. package/dist/engine.mjs +9 -0
  27. package/dist/engine.mjs.map +1 -0
  28. package/dist/index.d.mts +58 -0
  29. package/dist/index.d.ts +58 -0
  30. package/dist/index.js +1652 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/index.mjs +1637 -0
  33. package/dist/index.mjs.map +1 -0
  34. package/dist/node.d.mts +26 -0
  35. package/dist/node.d.ts +26 -0
  36. package/dist/node.js +972 -0
  37. package/dist/node.js.map +1 -0
  38. package/dist/node.mjs +960 -0
  39. package/dist/node.mjs.map +1 -0
  40. package/dist/orchestrator-edge.d.mts +243 -0
  41. package/dist/orchestrator-edge.d.ts +243 -0
  42. package/dist/orchestrator-edge.js +1076 -0
  43. package/dist/orchestrator-edge.js.map +1 -0
  44. package/dist/orchestrator-edge.mjs +1065 -0
  45. package/dist/orchestrator-edge.mjs.map +1 -0
  46. package/dist/orchestrator.d.mts +50 -0
  47. package/dist/orchestrator.d.ts +50 -0
  48. package/dist/orchestrator.js +1185 -0
  49. package/dist/orchestrator.js.map +1 -0
  50. package/dist/orchestrator.mjs +1172 -0
  51. package/dist/orchestrator.mjs.map +1 -0
  52. package/dist/rules-detector-DjbTJ1-Q.d.mts +470 -0
  53. package/dist/rules-detector-DjbTJ1-Q.d.ts +470 -0
  54. package/dist/static-loader-C1hUlksK.d.ts +72 -0
  55. package/dist/static-loader-Ds4iNw7c.d.mts +72 -0
  56. package/dist/types-D0j85fF0.d.mts +163 -0
  57. package/dist/types-D0j85fF0.d.ts +163 -0
  58. package/package.json +141 -0
  59. package/wasm/agentshield_wasm.d.ts +485 -0
  60. package/wasm/agentshield_wasm.js +1551 -0
  61. package/wasm/agentshield_wasm_bg.wasm +0 -0
  62. package/wasm/agentshield_wasm_bg.wasm.d.ts +97 -0
  63. package/wasm/kya-os-engine/kya_os_engine.d.ts +24 -0
  64. package/wasm/kya-os-engine/kya_os_engine.js +517 -0
  65. package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
  66. package/wasm/kya-os-engine/kya_os_engine_bg.wasm.d.ts +8 -0
  67. package/wasm/kya-os-engine-web/kya_os_engine.d.ts +56 -0
  68. package/wasm/kya-os-engine-web/kya_os_engine.js +574 -0
  69. package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
  70. package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm.d.ts +8 -0
  71. package/wasm/package.json +30 -0
@@ -0,0 +1,34 @@
1
+ import { A as AgentRequest, C as ContextSpec, V as VerifyResult } from './types-D0j85fF0.js';
2
+ export { a as A2ARequest, b as A2PRequest, B as BlockReason, c as ChallengeParams, D as Decision, d as DidDocument, E as EnforcementMode, e as EngineInfo, H as HttpSignedRequest, I as InstructPayload, K as KeyType, M as McpIRequest, P as PlainHttpRequest, R as RedirectTarget, S as SuggestedAction, f as VerificationMethod } from './types-D0j85fF0.js';
3
+ export { McpIPayload } from '@kya-os/checkpoint-shared';
4
+
5
+ /**
6
+ * `kya-os-engine` WASM bridge — E-1 (#2486 follow-up).
7
+ *
8
+ * Loads the Rust `kya-os-engine` WASM artifact and surfaces a typed
9
+ * `engineVerify(input, ctx)` wrapper around its single `verify` export.
10
+ *
11
+ * The engine is **synchronous** by contract. Host wrappers pre-fetch
12
+ * every async dependency (DID document, status list, reputation,
13
+ * tenant policy) and ship the results as a plain-data
14
+ * [`ContextSpec`] (see `./types`). The WASM glue on the Rust side
15
+ * builds in-memory lookup-table adapters that satisfy the engine's
16
+ * five sync DI traits — no JS callbacks cross the boundary.
17
+ *
18
+ * Subsequent E-2 / E-3 phases consume this module to verify HTTP
19
+ * requests inside the Next.js + Express middlewares.
20
+ */
21
+
22
+ /**
23
+ * Verify an AgentRequest synchronously against a pre-fetched
24
+ * [`ContextSpec`].
25
+ *
26
+ * @throws {Error} if the WASM glue rejects the input (deserialisation
27
+ * failure) or the engine returns a `VerifyError` (resolver /
28
+ * status-list / reputation / policy infrastructure failure). Engine
29
+ * *verdicts* (Block / Challenge / etc.) DO NOT throw — they surface
30
+ * inside the returned [`VerifyResult`].
31
+ */
32
+ declare function engineVerify(input: AgentRequest, ctx: ContextSpec): VerifyResult;
33
+
34
+ export { AgentRequest, ContextSpec, VerifyResult, engineVerify };
package/dist/engine.js ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ // src/engine/index.ts
4
+ function engineVerify(input, ctx) {
5
+ const result = (void 0)(input, ctx);
6
+ return result;
7
+ }
8
+
9
+ exports.engineVerify = engineVerify;
10
+ //# sourceMappingURL=engine.js.map
11
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engine/index.ts"],"names":[],"mappings":";;;AAoCO,SAAS,YAAA,CAAa,OAAqB,GAAA,EAAgC;AAChF,EAAA,MAAM,MAAA,GAAS,CAAA,MAAA,EAAW,KAAA,EAAO,GAAG,CAAA;AACpC,EAAA,OAAO,MAAA;AACT","file":"engine.js","sourcesContent":["/**\n * `kya-os-engine` WASM bridge — E-1 (#2486 follow-up).\n *\n * Loads the Rust `kya-os-engine` WASM artifact and surfaces a typed\n * `engineVerify(input, ctx)` wrapper around its single `verify` export.\n *\n * The engine is **synchronous** by contract. Host wrappers pre-fetch\n * every async dependency (DID document, status list, reputation,\n * tenant policy) and ship the results as a plain-data\n * [`ContextSpec`] (see `./types`). The WASM glue on the Rust side\n * builds in-memory lookup-table adapters that satisfy the engine's\n * five sync DI traits — no JS callbacks cross the boundary.\n *\n * Subsequent E-2 / E-3 phases consume this module to verify HTTP\n * requests inside the Next.js + Express middlewares.\n */\n\nimport type { AgentRequest, ContextSpec, VerifyResult } from './types';\n\n// wasm-bindgen ships a Node.js entry that calls\n// `fs.readFileSync(__dirname + '/<name>_bg.wasm')` synchronously when\n// the module is imported. The auto-generated `.d.ts` types the export\n// loosely (`any`); we re-type at this wrapper boundary so callers see\n// the contract from `./types`.\nimport { verify as wasmVerify } from '../../wasm/kya-os-engine/kya_os_engine.js';\n\n/**\n * Verify an AgentRequest synchronously against a pre-fetched\n * [`ContextSpec`].\n *\n * @throws {Error} if the WASM glue rejects the input (deserialisation\n * failure) or the engine returns a `VerifyError` (resolver /\n * status-list / reputation / policy infrastructure failure). Engine\n * *verdicts* (Block / Challenge / etc.) DO NOT throw — they surface\n * inside the returned [`VerifyResult`].\n */\nexport function engineVerify(input: AgentRequest, ctx: ContextSpec): VerifyResult {\n const result = wasmVerify(input, ctx);\n return result as VerifyResult;\n}\n\nexport type {\n AgentRequest,\n A2ARequest,\n A2PRequest,\n BlockReason,\n ChallengeParams,\n ContextSpec,\n Decision,\n DidDocument,\n EngineInfo,\n EnforcementMode,\n HttpSignedRequest,\n InstructPayload,\n KeyType,\n McpIPayload,\n McpIRequest,\n PlainHttpRequest,\n RedirectTarget,\n SuggestedAction,\n VerificationMethod,\n VerifyResult,\n} from './types';\n"]}
@@ -0,0 +1,9 @@
1
+ // src/engine/index.ts
2
+ function engineVerify(input, ctx) {
3
+ const result = (void 0)(input, ctx);
4
+ return result;
5
+ }
6
+
7
+ export { engineVerify };
8
+ //# sourceMappingURL=engine.mjs.map
9
+ //# sourceMappingURL=engine.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engine/index.ts"],"names":[],"mappings":";AAoCO,SAAS,YAAA,CAAa,OAAqB,GAAA,EAAgC;AAChF,EAAA,MAAM,MAAA,GAAS,CAAA,MAAA,EAAW,KAAA,EAAO,GAAG,CAAA;AACpC,EAAA,OAAO,MAAA;AACT","file":"engine.mjs","sourcesContent":["/**\n * `kya-os-engine` WASM bridge — E-1 (#2486 follow-up).\n *\n * Loads the Rust `kya-os-engine` WASM artifact and surfaces a typed\n * `engineVerify(input, ctx)` wrapper around its single `verify` export.\n *\n * The engine is **synchronous** by contract. Host wrappers pre-fetch\n * every async dependency (DID document, status list, reputation,\n * tenant policy) and ship the results as a plain-data\n * [`ContextSpec`] (see `./types`). The WASM glue on the Rust side\n * builds in-memory lookup-table adapters that satisfy the engine's\n * five sync DI traits — no JS callbacks cross the boundary.\n *\n * Subsequent E-2 / E-3 phases consume this module to verify HTTP\n * requests inside the Next.js + Express middlewares.\n */\n\nimport type { AgentRequest, ContextSpec, VerifyResult } from './types';\n\n// wasm-bindgen ships a Node.js entry that calls\n// `fs.readFileSync(__dirname + '/<name>_bg.wasm')` synchronously when\n// the module is imported. The auto-generated `.d.ts` types the export\n// loosely (`any`); we re-type at this wrapper boundary so callers see\n// the contract from `./types`.\nimport { verify as wasmVerify } from '../../wasm/kya-os-engine/kya_os_engine.js';\n\n/**\n * Verify an AgentRequest synchronously against a pre-fetched\n * [`ContextSpec`].\n *\n * @throws {Error} if the WASM glue rejects the input (deserialisation\n * failure) or the engine returns a `VerifyError` (resolver /\n * status-list / reputation / policy infrastructure failure). Engine\n * *verdicts* (Block / Challenge / etc.) DO NOT throw — they surface\n * inside the returned [`VerifyResult`].\n */\nexport function engineVerify(input: AgentRequest, ctx: ContextSpec): VerifyResult {\n const result = wasmVerify(input, ctx);\n return result as VerifyResult;\n}\n\nexport type {\n AgentRequest,\n A2ARequest,\n A2PRequest,\n BlockReason,\n ChallengeParams,\n ContextSpec,\n Decision,\n DidDocument,\n EngineInfo,\n EnforcementMode,\n HttpSignedRequest,\n InstructPayload,\n KeyType,\n McpIPayload,\n McpIRequest,\n PlainHttpRequest,\n RedirectTarget,\n SuggestedAction,\n VerificationMethod,\n VerifyResult,\n} from './types';\n"]}
@@ -0,0 +1,58 @@
1
+ import { I as IDetectorOptions, a as IDetector } from './rules-detector-DjbTJ1-Q.mjs';
2
+ export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, d as IDetectionInput, e as IDetectionResult, f as IPathRule, g as IPolicyLoader, h as IWasmBindings, i as IWasmLoader, P as PolicyLoadError, j as PolicyLoader, k as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.mjs';
3
+ export { S as StaticWasmLoader, c as createStaticLoader } from './static-loader-Ds4iNw7c.mjs';
4
+ export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-qGJacfEC.mjs';
5
+
6
+ /**
7
+ * Create a detector with automatic runtime selection
8
+ *
9
+ * @param options - Detector configuration
10
+ * @returns A configured detector instance
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Basic usage
15
+ * const detector = createDetector();
16
+ *
17
+ * // With API key for policy loading
18
+ * const detector = createDetector({
19
+ * apiKey: 'your-api-key',
20
+ * });
21
+ *
22
+ * // With custom WASM loader (for Edge Runtime)
23
+ * import wasmModule from './wasm.wasm?module';
24
+ * const detector = createDetector({
25
+ * wasmLoader: new StaticWasmLoader(wasmModule),
26
+ * });
27
+ * ```
28
+ */
29
+ declare function createDetector(options?: IDetectorOptions): IDetector;
30
+ /**
31
+ * Create a detector for Edge Runtime with static WASM import
32
+ *
33
+ * @param wasmModule - Pre-compiled WebAssembly.Module from static import
34
+ * @param options - Detector configuration
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // In your middleware.ts:
39
+ * import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
40
+ * import { createEdgeDetector } from '@kya-os/checkpoint-wasm-runtime';
41
+ *
42
+ * const detector = createEdgeDetector(wasmModule, {
43
+ * apiKey: process.env.AGENTSHIELD_API_KEY,
44
+ * });
45
+ * ```
46
+ */
47
+ declare function createEdgeDetector(wasmModule: WebAssembly.Module, options?: IDetectorOptions): IDetector;
48
+ /**
49
+ * Create a fallback detector using JavaScript rules
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const detector = createFallbackDetector();
54
+ * ```
55
+ */
56
+ declare function createFallbackDetector(): IDetector;
57
+
58
+ export { IDetector, IDetectorOptions, createDetector, createEdgeDetector, createFallbackDetector };
@@ -0,0 +1,58 @@
1
+ import { I as IDetectorOptions, a as IDetector } from './rules-detector-DjbTJ1-Q.js';
2
+ export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, d as IDetectionInput, e as IDetectionResult, f as IPathRule, g as IPolicyLoader, h as IWasmBindings, i as IWasmLoader, P as PolicyLoadError, j as PolicyLoader, k as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.js';
3
+ export { S as StaticWasmLoader, c as createStaticLoader } from './static-loader-C1hUlksK.js';
4
+ export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-cS-pUisw.js';
5
+
6
+ /**
7
+ * Create a detector with automatic runtime selection
8
+ *
9
+ * @param options - Detector configuration
10
+ * @returns A configured detector instance
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Basic usage
15
+ * const detector = createDetector();
16
+ *
17
+ * // With API key for policy loading
18
+ * const detector = createDetector({
19
+ * apiKey: 'your-api-key',
20
+ * });
21
+ *
22
+ * // With custom WASM loader (for Edge Runtime)
23
+ * import wasmModule from './wasm.wasm?module';
24
+ * const detector = createDetector({
25
+ * wasmLoader: new StaticWasmLoader(wasmModule),
26
+ * });
27
+ * ```
28
+ */
29
+ declare function createDetector(options?: IDetectorOptions): IDetector;
30
+ /**
31
+ * Create a detector for Edge Runtime with static WASM import
32
+ *
33
+ * @param wasmModule - Pre-compiled WebAssembly.Module from static import
34
+ * @param options - Detector configuration
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * // In your middleware.ts:
39
+ * import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
40
+ * import { createEdgeDetector } from '@kya-os/checkpoint-wasm-runtime';
41
+ *
42
+ * const detector = createEdgeDetector(wasmModule, {
43
+ * apiKey: process.env.AGENTSHIELD_API_KEY,
44
+ * });
45
+ * ```
46
+ */
47
+ declare function createEdgeDetector(wasmModule: WebAssembly.Module, options?: IDetectorOptions): IDetector;
48
+ /**
49
+ * Create a fallback detector using JavaScript rules
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const detector = createFallbackDetector();
54
+ * ```
55
+ */
56
+ declare function createFallbackDetector(): IDetector;
57
+
58
+ export { IDetector, IDetectorOptions, createDetector, createEdgeDetector, createFallbackDetector };