@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,181 @@
1
1
  # @kya-os/checkpoint-wasm-runtime
2
2
 
3
+ ## 1.4.0 — 2026-05-18
4
+
5
+ **Minor release** consolidating SDK-Next.js-Integration-Audit-1
6
+ ([#2640](https://github.com/Know-That-Ai/agent-shield/pull/2640)) and
7
+ Engine-Tier3-Monitor-Default
8
+ ([#2653](https://github.com/Know-That-Ai/agent-shield/pull/2653)).
9
+
10
+ ### Behavioral defaults — Tier-3 now Monitor by default
11
+
12
+ **`EngineConfig.tier3_action` defaults to `'monitor'`.** Engine emits
13
+ Stage 1 classification signals but does NOT short-circuit known-agent
14
+ UAs with `Block { Tier3UAMatch }` of its own — the tenant
15
+ `PolicyEvaluator` is the arbiter. Preserves the 1.3.0 behaviour
16
+ (tenant policy decides). Prevents the day-1 customer-onboarding
17
+ regression a 1.3.1-style hard-coded Block would have caused.
18
+
19
+ **Opt into Block via `tier3_action: 'block'`** when the host wants
20
+ the engine-default block before the tenant policy seam (the bench
21
+ harness + customers who've reviewed their traffic):
22
+
23
+ ```ts
24
+ import { engineVerify } from '@kya-os/checkpoint-wasm-runtime/engine';
25
+
26
+ const result = engineVerify(input, {
27
+ ...ctxSpec,
28
+ config: { tier3Action: 'block' },
29
+ });
30
+ ```
31
+
32
+ **No breaking change from 1.3.0.** The new `BlockReason::Tier3UAMatch`
33
+ variant + the `EngineConfig` / `Tier3Action` API are additive. The
34
+ 1.3.1 patch shipped the Block-default behaviour; 1.4.0 replaces that
35
+ default with Monitor + adds the explicit opt-in. **Do not use 1.3.0
36
+ or 1.3.1; upgrade to 1.4.0.**
37
+
38
+ ### Added
39
+
40
+ - wasm-bindgen `--target bundler` artifact at
41
+ `wasm/kya-os-engine-bundler/` for Turbopack / Vite / esbuild
42
+ consumers. Exposed via `./engine` (default) + `./orchestrator`.
43
+ - `./engine/node` subpath — explicit nodejs-target safety net for
44
+ Webpack-without-`asyncWebAssembly` consumers. Companion to the
45
+ existing `./orchestrator/node`.
46
+ - `EngineConfig` + `Tier3Action` TS types exported from `./engine`.
47
+ - `wasm:rebuild` npm script that runs the canonical
48
+ `rust/scripts/build-engine-wasm.sh` regen flow.
49
+
50
+ ### Changed
51
+
52
+ - `verify-request.ts` is engine-agnostic — exports
53
+ `createVerifyRequestApi(defaultEngine)` factory; the two entry
54
+ barrels (`./orchestrator/index.ts`, `./orchestrator/node.ts`)
55
+ inject their own engine bridges so `orchestrator-node.mjs` no
56
+ longer transitively imports the bundler artifact's `.wasm`.
57
+ - WASM artifacts (nodejs + web + bundler) rebuilt from post-#2653
58
+ engine source.
59
+
60
+ ### Removed
61
+
62
+ - Dead `onSuccess` wasm-copy in `tsup.config.ts`'s
63
+ `nodeFallbackEntries` — the nodejs glue is now an external import.
64
+ - `dynamic-loader.ts` `eval()` runtime-detection probes — the
65
+ bundler-target artifact handles runtime detection natively.
66
+
67
+ ---
68
+
69
+ ## 1.3.1 — 2026-05-18
70
+
71
+ **Patch release on top of 1.3.0** — do NOT use 1.3.0; it was published
72
+ during Engine-Tier3-Ruleset-Wiring-1 review and shipped with three
73
+ issues caught in CI:
74
+
75
+ 1. **Hash format pre-coordination.** 1.3.0 shipped a 2-slot
76
+ `sha256:<t2-data-version>:<t3-pattern-sha256>` placeholder
77
+ convention. Engineer A's [#2639](https://github.com/Know-That-Ai/agent-shield/pull/2639)
78
+ merged on main with the canonical 4-slot
79
+ `sha256:t1:<slot>:t2:<slot>:t3:<slot>:t4:<slot>` format. 1.3.1 is
80
+ rebased on that merge — drops this PR's own `TIER3_PATTERN_SHA256`
81
+ const + `tier3_pattern_sha_matches_file` test and consumes
82
+ Engineer A's `build.rs`-emitted `AIVF1_TIER3_PATTERNS_SHA256` env
83
+ var via `TIER3_RULESET_HASH = env!(...)`. Today's value (1.3.1):
84
+ `sha256:t1:unset:t2:<yaml-sha>:t3:<patterns-sha>:t4:unset`.
85
+
86
+ 2. **`sfv = "0.14"` leaked into `kya-os-engine`'s `[dependencies]`**
87
+ (literally with a "Temporary measurement dep — DO NOT COMMIT"
88
+ comment), carried in from an unrelated HTTP-Sig-Verifier-1 work
89
+ tree via a stash apply. The crate is not referenced in source, so
90
+ the WASM binary is unaffected, but it adds an unused transitive
91
+ to the dependency graph. Removed in 1.3.1.
92
+ 3. **`BlockReason::Tier3UAMatch.confidence` was `f32`**, which round-
93
+ trips through JS `Number` (always f64) with rounding error —
94
+ Rust serialized `0.95` while WASM serialized `0.949999988079071`.
95
+ The cross-runtime parity gate caught this as JSON-string
96
+ divergence even though the underlying f32 bit pattern was
97
+ identical. Fixed in 1.3.1 by quantizing to `u32` percent (0–100)
98
+ at the engine boundary, matching the existing
99
+ `DetectionDetail.confidence` convention.
100
+
101
+ **Wire-format change between 1.3.0 and 1.3.1:**
102
+
103
+ ```diff
104
+ - { "kind": "Tier3UAMatch", "confidence": 0.95 }
105
+ + { "kind": "Tier3UAMatch", "confidence": 95 }
106
+ ```
107
+
108
+ Any consumer that pinned 1.3.0 must update — `confidence` is now a
109
+ percent integer, not a float. The cross-runtime stability is the
110
+ load-bearing reason; see the Tier3UAMatch docstring.
111
+
112
+ ## 1.3.0 — 2026-05-18 (DEPRECATED — see 1.3.1)
113
+
114
+ **Engine-Tier3-Ruleset-Wiring-1.** Replaces the
115
+ `phase-1-d-impl-placeholder` ruleset hash with a real Tier 3 UA
116
+ pattern table, wired into the engine's Stage 1b default policy. The
117
+ engine now Blocks known agent UAs even with an empty tenant policy.
118
+
119
+ Conforms to `dylan-todos/Engine-Tier-Ordering-1.md` contract:
120
+ `Tier 1 (signed) > Tier 2 (IP+UA) > Tier 3 (UA only) > Tier 4 (IP only)`.
121
+ This release ships Tier 3.
122
+
123
+ ### Added
124
+
125
+ - `BlockReason::Tier3UAMatch { pattern_id, pattern_kind, confidence }`
126
+ — additive variant, priority 8 (lowest). Fires only on the PlainHttp
127
+ path when Stage 1 classifies the request as a known agent.
128
+ - Stage 1b default policy in `verify_plain_http`: if Stage 1 classifies
129
+ the request as `KnownAiAgent`, `AiCrawler`, or `HeadlessBrowser`,
130
+ the engine short-circuits with `Decision::Block { Tier3UAMatch }`
131
+ BEFORE handing off to tenant policy. Calibrated defaults that don't
132
+ expose customers to the threshold-knob footgun.
133
+ - `SearchBot` is **exempted** from Tier 3 default per architect
134
+ precedent (`tests/cross_runtime_baselines.rs` line 175-178: "search-
135
+ engine indexing is generally permitted by tenant policy"). Googlebot
136
+ / Bingbot / Applebot / DuckDuckBot still flow through to tenant
137
+ policy.
138
+
139
+ ### Changed
140
+
141
+ - `EngineInfo.ruleset_hash` is now `sha256:<t2>:<t3_sha256>` where
142
+ `<t3_sha256>` is the SHA-256 of `patterns_generated.rs` (real
143
+ identity, not placeholder). `<t2>` is `t2-unset` until Engineer A's
144
+ reputation/IP-feed schema commits its own identity hash.
145
+ - Drift gate: unit test `tier3_pattern_sha_matches_file` recomputes
146
+ the SHA at test time and fails with a copy-paste-ready new SHA if
147
+ `patterns_generated.rs` drifts.
148
+
149
+ ### Breaking change in default behavior
150
+
151
+ Consumers who deployed the engine with an **empty tenant policy** and
152
+ expected permit-by-default for unsigned traffic now get Block on any
153
+ known agent UA. This is the architectural intent — calibrated defaults
154
+ that don't require every customer to write their own bot-blocking
155
+ policy. Mitigation: deploy a tenant policy that explicitly permits the
156
+ agent classes you want to allow.
157
+
158
+ ### Test coverage added
159
+
160
+ - 5 new tests in `stage1_classification.rs` covering each blocking
161
+ class + SearchBot allowlist + real-human permit.
162
+ - Existing baseline tests in `cross_runtime_baselines.rs` updated to
163
+ assert `Tier3UAMatch` instead of the supplanted `PolicyDenied` path.
164
+ - 173/173 TS tests (including cross-runtime parity) still green.
165
+
166
+ ### Followups
167
+
168
+ - **Engine-Pattern-Codegen-Retirement-1** (filed): replace
169
+ `patterns_generated.rs` (legacy YAML codegen) with a build-time JSON
170
+ export of `KNOWN_AGENT_PATTERNS` from `@kya-os/checkpoint-shared`,
171
+ with the same drift-prevention pattern as #2599. Current PR uses
172
+ the existing `patterns_generated.rs` data as the Tier 3 source; the
173
+ followup makes the TS-side `KNOWN_AGENT_PATTERNS` the engine's SSOT.
174
+ - **Tier 2 data version coordination** (Engineer A): substitute
175
+ `t2-unset` once the reputation/IP-feed schema commits its identity.
176
+
177
+ ---
178
+
3
179
  ## 1.2.0 — 2026-05-18
4
180
 
5
181
  Phase-D.8b engine-surface expansion.
@@ -1,4 +1,4 @@
1
- import { d as DidDocument, D as Decision } from './types-ByrdPLL2.mjs';
1
+ import { d as DidDocument, D as Decision } from './types-KPEcVvac.mjs';
2
2
  import '@kya-os/checkpoint-shared';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { d as DidDocument, D as Decision } from './types-ByrdPLL2.js';
1
+ import { d as DidDocument, D as Decision } from './types-KPEcVvac.js';
2
2
  import '@kya-os/checkpoint-shared';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { A as AgentRequest, C as ContextSpec, V as VerifyResult } from './types-ByrdPLL2.mjs';
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-ByrdPLL2.mjs';
1
+ import { A as AgentRequest, C as ContextSpec, V as VerifyResult } from './types-KPEcVvac.mjs';
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 EngineConfig, f as EngineInfo, H as HttpSignedRequest, I as InstructPayload, K as KeyType, M as McpIRequest, P as PlainHttpRequest, R as RedirectTarget, S as SuggestedAction, T as Tier3Action, g as VerificationMethod } from './types-KPEcVvac.mjs';
3
3
  export { DetectionDetail, McpIPayload } from '@kya-os/checkpoint-shared';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { A as AgentRequest, C as ContextSpec, V as VerifyResult } from './types-ByrdPLL2.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-ByrdPLL2.js';
1
+ import { A as AgentRequest, C as ContextSpec, V as VerifyResult } from './types-KPEcVvac.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 EngineConfig, f as EngineInfo, H as HttpSignedRequest, I as InstructPayload, K as KeyType, M as McpIRequest, P as PlainHttpRequest, R as RedirectTarget, S as SuggestedAction, T as Tier3Action, g as VerificationMethod } from './types-KPEcVvac.js';
3
3
  export { DetectionDetail, McpIPayload } from '@kya-os/checkpoint-shared';
4
4
 
5
5
  /**