@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
@@ -159,6 +159,36 @@ interface ContextSpec {
159
159
  tenantDecision: Decision;
160
160
  nowUnix: number;
161
161
  enforcementMode: EnforcementMode;
162
+ /**
163
+ * Engine-default behaviour knobs. Omit, or pass `{}`, to take the
164
+ * customer-onboarding-safe defaults (Tier-3 in Monitor mode —
165
+ * tenant policy is the arbiter). See [`EngineConfig`].
166
+ */
167
+ config?: EngineConfig;
162
168
  }
169
+ /**
170
+ * Engine-default behaviour knobs the host can opt into. Mirrors the
171
+ * Rust `kya_os_engine::EngineConfig` shape; deserialised by the WASM
172
+ * glue with `#[serde(default)]` so an absent / empty `config` resolves
173
+ * to the safe defaults.
174
+ */
175
+ interface EngineConfig {
176
+ /**
177
+ * Tier-3 (UA-only pattern match) engine-default action. Defaults to
178
+ * `'monitor'` — Stage 1 classification flows through to the tenant
179
+ * policy evaluator, but the engine does NOT short-circuit with its
180
+ * own `Block { Tier3UAMatch }`. Set to `'block'` when the host
181
+ * wants the engine to emit an engine-default block for known-agent
182
+ * UAs before the tenant policy seam (e.g., the bench harness or
183
+ * customers who've reviewed their traffic and want the calibrated
184
+ * block without writing a tenant-policy rule).
185
+ */
186
+ tier3Action?: Tier3Action;
187
+ }
188
+ /**
189
+ * Tier-3 default action — `'monitor'` (default) lets tenant policy
190
+ * decide; `'block'` opts into the engine-default short-circuit.
191
+ */
192
+ type Tier3Action = 'monitor' | 'block';
163
193
 
164
- export type { AgentRequest as A, BlockReason as B, ContextSpec as C, Decision as D, EnforcementMode as E, HttpSignedRequest as H, InstructPayload as I, KeyType as K, McpIRequest as M, PlainHttpRequest as P, RedirectTarget as R, SuggestedAction as S, VerifyResult as V, A2ARequest as a, A2PRequest as b, ChallengeParams as c, DidDocument as d, EngineInfo as e, VerificationMethod as f };
194
+ export type { AgentRequest as A, BlockReason as B, ContextSpec as C, Decision as D, EnforcementMode as E, HttpSignedRequest as H, InstructPayload as I, KeyType as K, McpIRequest as M, PlainHttpRequest as P, RedirectTarget as R, SuggestedAction as S, Tier3Action as T, VerifyResult as V, A2ARequest as a, A2PRequest as b, ChallengeParams as c, DidDocument as d, EngineConfig as e, EngineInfo as f, VerificationMethod as g };
@@ -159,6 +159,36 @@ interface ContextSpec {
159
159
  tenantDecision: Decision;
160
160
  nowUnix: number;
161
161
  enforcementMode: EnforcementMode;
162
+ /**
163
+ * Engine-default behaviour knobs. Omit, or pass `{}`, to take the
164
+ * customer-onboarding-safe defaults (Tier-3 in Monitor mode —
165
+ * tenant policy is the arbiter). See [`EngineConfig`].
166
+ */
167
+ config?: EngineConfig;
162
168
  }
169
+ /**
170
+ * Engine-default behaviour knobs the host can opt into. Mirrors the
171
+ * Rust `kya_os_engine::EngineConfig` shape; deserialised by the WASM
172
+ * glue with `#[serde(default)]` so an absent / empty `config` resolves
173
+ * to the safe defaults.
174
+ */
175
+ interface EngineConfig {
176
+ /**
177
+ * Tier-3 (UA-only pattern match) engine-default action. Defaults to
178
+ * `'monitor'` — Stage 1 classification flows through to the tenant
179
+ * policy evaluator, but the engine does NOT short-circuit with its
180
+ * own `Block { Tier3UAMatch }`. Set to `'block'` when the host
181
+ * wants the engine to emit an engine-default block for known-agent
182
+ * UAs before the tenant policy seam (e.g., the bench harness or
183
+ * customers who've reviewed their traffic and want the calibrated
184
+ * block without writing a tenant-policy rule).
185
+ */
186
+ tier3Action?: Tier3Action;
187
+ }
188
+ /**
189
+ * Tier-3 default action — `'monitor'` (default) lets tenant policy
190
+ * decide; `'block'` opts into the engine-default short-circuit.
191
+ */
192
+ type Tier3Action = 'monitor' | 'block';
163
193
 
164
- export type { AgentRequest as A, BlockReason as B, ContextSpec as C, Decision as D, EnforcementMode as E, HttpSignedRequest as H, InstructPayload as I, KeyType as K, McpIRequest as M, PlainHttpRequest as P, RedirectTarget as R, SuggestedAction as S, VerifyResult as V, A2ARequest as a, A2PRequest as b, ChallengeParams as c, DidDocument as d, EngineInfo as e, VerificationMethod as f };
194
+ export type { AgentRequest as A, BlockReason as B, ContextSpec as C, Decision as D, EnforcementMode as E, HttpSignedRequest as H, InstructPayload as I, KeyType as K, McpIRequest as M, PlainHttpRequest as P, RedirectTarget as R, SuggestedAction as S, Tier3Action as T, VerifyResult as V, A2ARequest as a, A2PRequest as b, ChallengeParams as c, DidDocument as d, EngineConfig as e, EngineInfo as f, VerificationMethod as g };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/checkpoint-wasm-runtime",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Checkpoint WASM runtime for AI agent detection across all environments (formerly @kya-os/agentshield-wasm-runtime)",
5
5
  "keywords": [
6
6
  "ai",
@@ -66,6 +66,11 @@
66
66
  "import": "./dist/engine-edge.mjs",
67
67
  "require": "./dist/engine-edge.js"
68
68
  },
69
+ "./engine/node": {
70
+ "types": "./dist/engine-node.d.ts",
71
+ "import": "./dist/engine-node.mjs",
72
+ "require": "./dist/engine-node.js"
73
+ },
69
74
  "./orchestrator": {
70
75
  "edge-runtime": {
71
76
  "types": "./dist/orchestrator-edge.d.ts",
@@ -104,6 +109,8 @@
104
109
  "./wasm/agentshield_wasm_bg.wasm": "./wasm/agentshield_wasm_bg.wasm",
105
110
  "./wasm/kya-os-engine/kya_os_engine_bg.wasm": "./wasm/kya-os-engine/kya_os_engine_bg.wasm",
106
111
  "./wasm/kya-os-engine-web/kya_os_engine_bg.wasm": "./wasm/kya-os-engine-web/kya_os_engine_bg.wasm",
112
+ "./wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm": "./wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm",
113
+ "./wasm/*": "./wasm/*",
107
114
  "./package.json": "./package.json"
108
115
  },
109
116
  "files": [
@@ -125,6 +132,8 @@
125
132
  "rimraf": "^5.0.5",
126
133
  "tsup": "^8.0.2",
127
134
  "typescript": "^5.4.2",
135
+ "vite-plugin-top-level-await": "^1.6.0",
136
+ "vite-plugin-wasm": "^3.6.0",
128
137
  "vitest": "^1.3.1"
129
138
  },
130
139
  "publishConfig": {
@@ -148,6 +157,8 @@
148
157
  "format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
149
158
  "copy-wasm": "mkdir -p ./wasm && cp ../../rust/crates/agentshield-wasm/pkg/agentshield_wasm_bg.wasm ./wasm/",
150
159
  "copy-engine-wasm": "mkdir -p ./wasm/kya-os-engine && cp ../../rust/crates/kya-os-engine/pkg/kya_os_engine_bg.wasm ../../rust/crates/kya-os-engine/pkg/kya_os_engine_bg.wasm.d.ts ../../rust/crates/kya-os-engine/pkg/kya_os_engine.d.ts ../../rust/crates/kya-os-engine/pkg/kya_os_engine.js ./wasm/kya-os-engine/",
151
- "copy-engine-wasm-web": "mkdir -p ./wasm/kya-os-engine-web && cp ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine_bg.wasm ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine_bg.wasm.d.ts ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine.d.ts ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine.js ./wasm/kya-os-engine-web/"
160
+ "copy-engine-wasm-web": "mkdir -p ./wasm/kya-os-engine-web && cp ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine_bg.wasm ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine_bg.wasm.d.ts ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine.d.ts ../../rust/crates/kya-os-engine/pkg-web/kya_os_engine.js ./wasm/kya-os-engine-web/",
161
+ "copy-engine-wasm-bundler": "mkdir -p ./wasm/kya-os-engine-bundler && cp ../../rust/crates/kya-os-engine/pkg-bundler/kya_os_engine_bg.wasm ../../rust/crates/kya-os-engine/pkg-bundler/kya_os_engine_bg.wasm.d.ts ../../rust/crates/kya-os-engine/pkg-bundler/kya_os_engine_bg.js ../../rust/crates/kya-os-engine/pkg-bundler/kya_os_engine.d.ts ../../rust/crates/kya-os-engine/pkg-bundler/kya_os_engine.js ./wasm/kya-os-engine-bundler/",
162
+ "wasm:rebuild": "bash ../../rust/scripts/build-engine-wasm.sh"
152
163
  }
153
164
  }
Binary file
@@ -1,7 +1,27 @@
1
1
  {
2
- "name": "kya-os-engine-nodejs-wasm-glue",
3
- "type": "commonjs",
2
+ "name": "kya-os-engine",
3
+ "collaborators": [
4
+ "KnowThat.ai Team"
5
+ ],
6
+ "description": "Verification engine for the KYA-OS ecosystem. The single source of truth for detection, identity, scope, revocation, policy, and reputation across every host runtime. See ADR-001.",
7
+ "version": "0.1.0",
8
+ "license": "MIT OR Apache-2.0",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/knowthat-ai/agentshield"
12
+ },
13
+ "files": [
14
+ "kya_os_engine_bg.wasm",
15
+ "kya_os_engine.js"
16
+ ],
4
17
  "main": "kya_os_engine.js",
5
- "types": "kya_os_engine.d.ts",
6
- "_note": "wasm-bindgen --target nodejs output: uses `module.exports` + `require('fs')` at module load. The parent wasm/package.json says type:module (for the OLDER agentshield_wasm.js ESM file), which would make Node mis-classify this CJS file and throw ERR_REQUIRE_ESM. This nested package.json overrides per Node's nearest-package.json resolution algorithm. See SDK-WASM-Bundler-Loader-1 follow-up in @kya-os/checkpoint-wasm-runtime@1.1.1 CHANGELOG."
18
+ "keywords": [
19
+ "kya-os",
20
+ "verification",
21
+ "mcp-i",
22
+ "agent",
23
+ "did"
24
+ ],
25
+ "type": "commonjs",
26
+ "_note": "wasm-bindgen --target nodejs output: uses module.exports + require('fs') at module load. The parent wasm/package.json says type:module (for the older agentshield_wasm.js ESM file), which would make Node mis-classify this CJS file and throw ERR_REQUIRE_ESM. This nested package.json overrides per Node's nearest-package.json resolution algorithm. See SDK-WASM-Bundler-Loader-1 (#2613) for the original incident; AIVF-1 Path B (#2639) re-instated this override after a wasm-pack regen silently dropped it, plus a regen-pipeline patcher (rust/scripts/build-engine-wasm.sh) + an integrity test (packages/checkpoint-wasm-runtime/src/__tests__/wasm-artifact-integrity.test.ts) so the next regen can't silently break Node consumers again."
7
27
  }
@@ -0,0 +1,24 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Cross-boundary `verify` wrapper. The JS host calls `engine.verify(input,
5
+ * ctxSpec)`; on success it gets a [`VerifyResult`] JSON object; on
6
+ * infrastructure failure (or malformed input) it gets a thrown JS error
7
+ * whose message names the failure mode.
8
+ *
9
+ * **Error semantics**:
10
+ *
11
+ * - Verification *verdicts* (Block/Challenge/etc.) surface inside the
12
+ * returned `VerifyResult` — they are not thrown.
13
+ * - Engine [`VerifyError`][crate::error::VerifyError] (resolver / cache /
14
+ * reputation / policy infra failures) surface as thrown JS errors.
15
+ * - Serde deserialisation failures (malformed JS input) surface as thrown
16
+ * JS errors too, mirroring the typed-vs-thrown split.
17
+ *
18
+ * # JS signature
19
+ *
20
+ * ```ts
21
+ * function verify(input: AgentRequest, ctx: ContextSpec): VerifyResult;
22
+ * ```
23
+ */
24
+ export function verify(input_js: any, ctx_js: any): any;
@@ -0,0 +1,4 @@
1
+ import * as wasm from "./kya_os_engine_bg.wasm";
2
+ export * from "./kya_os_engine_bg.js";
3
+ import { __wbg_set_wasm } from "./kya_os_engine_bg.js";
4
+ __wbg_set_wasm(wasm);