@kya-os/checkpoint-wasm-runtime 1.4.2 → 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,60 @@
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
+
3
58
  ## 1.4.2 — 2026-05-18
4
59
 
5
60
  **Recovery release. Do NOT use 1.4.1 — it was published with a broken
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.2",
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;