@kya-os/checkpoint-wasm-runtime 1.4.1 → 1.4.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,114 @@
1
1
  # @kya-os/checkpoint-wasm-runtime
2
2
 
3
+ ## 1.4.3 — 2026-05-18
4
+
5
+ **Second recovery release. Do NOT use 1.4.1 OR 1.4.2 — both shipped
6
+ broken tarballs missing `wasm/kya-os-engine/*` (nodejs target) and
7
+ `wasm/kya-os-engine-web/*` (web target). Consumers crash on import
8
+ with `ERR_MODULE_NOT_FOUND` (or `FUNCTION_INVOCATION_FAILED` on
9
+ Vercel).**
10
+
11
+ ### What 1.4.2 got wrong (and 1.4.3 fixes)
12
+
13
+ The 1.4.2 recovery was supposed to fix the missing-artifact bug from
14
+ 1.4.1 by building all three wasm targets before publish. The local
15
+ build DID produce all the artifact files on disk — but the tarball
16
+ still shipped only `README.md` in those subdirs.
17
+
18
+ Root cause: **`wasm-pack build` writes a `.gitignore` containing `*`
19
+ into every `--out-dir`.** `pnpm pack` (and `npm pack`) honour nested
20
+ `.gitignore` patterns when filtering tarball contents, so every just-
21
+ built `.wasm` + `.js` + `.d.ts` gets filtered OUT of the tarball at
22
+ pack time. Only `README.md` survives because npm has a hardcoded rule
23
+ to always include READMEs. The 1.4.2 publish flow had no gate that
24
+ inspected tarball contents post-pack, so the broken state shipped
25
+ silently for a second time.
26
+
27
+ ### What 1.4.3 ships
28
+
29
+ Same TS + Rust changes as 1.4.1/1.4.2 (no code regression). New
30
+ defenses:
31
+
32
+ - `rust/scripts/build-engine-wasm.sh` now `rm -f`s the wasm-pack-
33
+ generated `.gitignore` from each `--out-dir` post-build. The poison
34
+ files can't reach `pnpm pack` from a clean local-dev publish.
35
+ - `packages/checkpoint-wasm-runtime` `copy-engine-wasm-bundler` npm
36
+ script chains a matching `rm -f` for the bundler target.
37
+ - New CI workflow `.github/workflows/publish-wasm-runtime.yml`:
38
+ builds all three targets in-runner, defuses the `.gitignore` poison
39
+ before pack, packs the tarball, **asserts the required `.wasm` +
40
+ `.js` paths are inside the tarball before publish**, and **re-
41
+ fetches the published tarball from npm post-publish and re-runs the
42
+ same assertions** to catch registry-side mutations. After a
43
+ successful publish, the workflow dispatches a `repository_dispatch`
44
+ event to `checkpoint-customers` so its bench fixture's lockfile can
45
+ be auto-bumped.
46
+
47
+ This is the gate 1.4.1 + 1.4.2 would have failed. Future broken
48
+ tarballs can't reach the registry.
49
+
50
+ ### Migration
51
+
52
+ Upgrade `@kya-os/checkpoint-wasm-runtime` from `1.4.1` or `1.4.2` to
53
+ `1.4.3`. Both poisoned versions will be deprecated on npm with a
54
+ "Broken tarball — upgrade to 1.4.3" message after this release lands.
55
+
56
+ ---
57
+
58
+ ## 1.4.2 — 2026-05-18
59
+
60
+ **Recovery release. Do NOT use 1.4.1 — it was published with a broken
61
+ tarball that ships only `wasm/kya-os-engine-bundler/*` and is missing
62
+ `wasm/kya-os-engine/*` (nodejs target) + `wasm/kya-os-engine-web/*`
63
+ (web target) entirely. Consumers using the `./engine`,
64
+ `./engine/node`, `./orchestrator`, or `./orchestrator/node` subpaths
65
+ crash on import with `ERR_MODULE_NOT_FOUND` (or
66
+ `FUNCTION_INVOCATION_FAILED` on Vercel).**
67
+
68
+ ### What 1.4.1 should have shipped
69
+
70
+ 1.4.1 was a patch release bundling two fixes on top of 1.4.0:
71
+
72
+ - **#2659** — split anthropic vendor pattern into 3 per-bot entries
73
+ (`anthropic_claude_user`, `anthropic_claudebot`,
74
+ `anthropic_claude_web`). Updates the Tier-3 ruleset hash.
75
+ - **#2663** — `httpStatusForBlockReason` + `blockResponseBody`
76
+ switches gained `Tier3UAMatch` and `AgentAttribution` cases (were
77
+ falling through to `undefined` status → Express default 500
78
+ error page). Adds the matching variants to the TS `BlockReason`
79
+ union (with snake_case `pattern_id` / `pattern_kind` matching the
80
+ Rust serde wire format).
81
+
82
+ ### Root cause of the broken 1.4.1 tarball
83
+
84
+ `prepublishOnly` chains `copy-engine-wasm` (nodejs target) +
85
+ `copy-engine-wasm-web` (web target) + `copy-engine-wasm-bundler`
86
+ (bundler target). Each script `cp`s from `rust/crates/kya-os-engine/
87
+ pkg{,-web,-bundler}/` into `packages/checkpoint-wasm-runtime/wasm/`.
88
+ The publish was invoked from a fresh `git reset --hard origin/main`
89
+ state with **only `wasm-pack build --target bundler`** run before
90
+ publish — `pkg/` (nodejs) and `pkg-web/` (web) were empty. The cp
91
+ commands silently produced empty target dirs (`wasm/kya-os-engine/`
92
+
93
+ - `wasm/kya-os-engine-web/`) populated only with the git-committed
94
+ `README.md` placeholders, and the tarball shipped that state.
95
+
96
+ ### What 1.4.2 ships
97
+
98
+ Identical TS + Rust changes to 1.4.1 (no code regression) but with
99
+ the full wasm artifact set (`wasm/kya-os-engine/`,
100
+ `wasm/kya-os-engine-web/`, `wasm/kya-os-engine-bundler/`) verified
101
+ present before publish.
102
+
103
+ ### Hardening (separate dylan-todo to follow)
104
+
105
+ `prepublishOnly` should fail-fast when any of the three artifact
106
+ dirs is missing rather than producing an empty-but-existing dir.
107
+ Filing as `Engine-WASM-Publish-Sanity-Gate-1` so the next regen
108
+ can't ship the same shape of partial tarball silently.
109
+
110
+ ---
111
+
3
112
  ## 1.4.0 — 2026-05-18
4
113
 
5
114
  **Minor release** consolidating SDK-Next.js-Integration-Audit-1
package/dist/engine.d.mts CHANGED
@@ -35,9 +35,9 @@ export { DetectionDetail, McpIPayload } from '@kya-os/checkpoint-shared';
35
35
  * detection probes — bundler entry runs the same JS in every
36
36
  * runtime; no detection needed.
37
37
  *
38
- * Consumers that don't use a bundler (raw Node + ESM, no transpile)
39
- * should use the explicit `./node` subpath which keeps the
40
- * `--target nodejs` artifact and its band-aids.
38
+ * Node consumers are routed to the Node-safe bridge via the package
39
+ * exports `"node"` condition on `./engine`; the generic bundler bridge
40
+ * remains the default for bundlers that do not request Node resolution.
41
41
  */
42
42
 
43
43
  /**
package/dist/engine.d.ts CHANGED
@@ -35,9 +35,9 @@ export { DetectionDetail, McpIPayload } from '@kya-os/checkpoint-shared';
35
35
  * detection probes — bundler entry runs the same JS in every
36
36
  * runtime; no detection needed.
37
37
  *
38
- * Consumers that don't use a bundler (raw Node + ESM, no transpile)
39
- * should use the explicit `./node` subpath which keeps the
40
- * `--target nodejs` artifact and its band-aids.
38
+ * Node consumers are routed to the Node-safe bridge via the package
39
+ * exports `"node"` condition on `./engine`; the generic bundler bridge
40
+ * remains the default for bundlers that do not request Node resolution.
41
41
  */
42
42
 
43
43
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kya-os/checkpoint-wasm-runtime",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
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",
@@ -55,6 +55,11 @@
55
55
  "types": "./dist/engine-edge.d.ts",
56
56
  "import": "./dist/engine-edge.mjs"
57
57
  },
58
+ "node": {
59
+ "types": "./dist/engine-node.d.ts",
60
+ "import": "./dist/engine-node.mjs",
61
+ "require": "./dist/engine-node.js"
62
+ },
58
63
  "types": "./dist/engine.d.ts",
59
64
  "import": "./dist/engine.mjs",
60
65
  "require": "./dist/engine.js"
@@ -122,26 +127,6 @@
122
127
  "engines": {
123
128
  "node": ">=18.0.0"
124
129
  },
125
- "dependencies": {
126
- "multiformats": "^13",
127
- "@kya-os/checkpoint-shared": "1.1.0"
128
- },
129
- "devDependencies": {
130
- "@types/node": "^20.11.24",
131
- "@vitest/coverage-v8": "^1.3.1",
132
- "rimraf": "^5.0.5",
133
- "tsup": "^8.0.2",
134
- "typescript": "^5.4.2",
135
- "vite-plugin-top-level-await": "^1.6.0",
136
- "vite-plugin-wasm": "^3.6.0",
137
- "vitest": "^1.3.1"
138
- },
139
- "publishConfig": {
140
- "access": "public"
141
- },
142
- "sideEffects": [
143
- "./wasm/**/*.js"
144
- ],
145
130
  "scripts": {
146
131
  "build": "tsup",
147
132
  "build:watch": "tsup --watch",
@@ -155,10 +140,31 @@
155
140
  "lint:fix": "eslint src --ext .ts,.tsx --fix",
156
141
  "format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
157
142
  "format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
143
+ "prepublishOnly": "pnpm copy-wasm && pnpm copy-engine-wasm && pnpm copy-engine-wasm-web && pnpm copy-engine-wasm-bundler && pnpm build && pnpm test",
158
144
  "copy-wasm": "mkdir -p ./wasm && cp ../../rust/crates/agentshield-wasm/pkg/agentshield_wasm_bg.wasm ./wasm/",
159
145
  "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/",
160
146
  "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/",
147
+ "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/ && rm -f ./wasm/kya-os-engine-bundler/.gitignore",
162
148
  "wasm:rebuild": "bash ../../rust/scripts/build-engine-wasm.sh"
163
- }
164
- }
149
+ },
150
+ "dependencies": {
151
+ "@kya-os/checkpoint-shared": "workspace:*",
152
+ "multiformats": "^13"
153
+ },
154
+ "devDependencies": {
155
+ "@types/node": "^20.11.24",
156
+ "@vitest/coverage-v8": "^1.3.1",
157
+ "rimraf": "^5.0.5",
158
+ "tsup": "^8.0.2",
159
+ "typescript": "^5.4.2",
160
+ "vite-plugin-top-level-await": "^1.6.0",
161
+ "vite-plugin-wasm": "^3.6.0",
162
+ "vitest": "^1.3.1"
163
+ },
164
+ "publishConfig": {
165
+ "access": "public"
166
+ },
167
+ "sideEffects": [
168
+ "./wasm/**/*.js"
169
+ ]
170
+ }
@@ -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;