@kya-os/checkpoint-wasm-runtime 1.4.2 → 1.4.4

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,93 @@
1
1
  # @kya-os/checkpoint-wasm-runtime
2
2
 
3
+ ## 1.4.4 — 2026-05-18
4
+
5
+ **Third recovery release. Do NOT use 1.4.3 — the published manifest
6
+ shipped `@kya-os/checkpoint-shared: "workspace:*"` instead of the
7
+ resolved version. Consumers can't install with any package manager
8
+ (pnpm errors with `ERR_PNPM_WORKSPACE_PKG_NOT_FOUND`; npm/yarn try to
9
+ fetch `workspace:*` from the registry and fail).**
10
+
11
+ ### What 1.4.3 got wrong (and 1.4.4 fixes)
12
+
13
+ The new publish workflow (#2675/#2676) uses `npm pack --ignore-scripts`
14
+ so it can skip `prepublishOnly` (which would re-introduce the wasm-pack
15
+ `.gitignore` poison that broke 1.4.1/1.4.2). The trade-off we missed:
16
+ `pnpm publish` and `pnpm pack` rewrite the `workspace:` protocol to
17
+ concrete versions at pack-time; `npm pack` does NOT. So the new
18
+ workflow shipped a manifest that no package manager outside the source
19
+ workspace could resolve.
20
+
21
+ Fix in this release:
22
+
23
+ 1. **Pre-pack substitution step** in `pack-and-verify-tarball`: reads
24
+ `@kya-os/checkpoint-shared`'s actual version from the workspace and
25
+ rewrites `workspace:*` → `1.1.0` (or whatever the workspace publishes)
26
+ in the wasm-runtime manifest before `npm pack` runs.
27
+ 2. **New `MANIFEST GATE`** in the same job: extracts the packed
28
+ `package.json` from the tarball and asserts zero `workspace:`
29
+ substrings in any dependency field. The 1.4.3 publish would have
30
+ failed at this gate.
31
+
32
+ Two artifact-shape gates (1.4.1/1.4.2 failure) + two manifest gates
33
+ (1.4.3 failure) + a post-publish re-fetch gate now stand between any
34
+ future publish and a broken registry entry.
35
+
36
+ ## 1.4.3 — 2026-05-18 — DEPRECATED (workspace:\* leak)
37
+
38
+ **Second recovery release. Do NOT use 1.4.1 OR 1.4.2 — both shipped
39
+ broken tarballs missing `wasm/kya-os-engine/*` (nodejs target) and
40
+ `wasm/kya-os-engine-web/*` (web target). Consumers crash on import
41
+ with `ERR_MODULE_NOT_FOUND` (or `FUNCTION_INVOCATION_FAILED` on
42
+ Vercel).**
43
+
44
+ ### What 1.4.2 got wrong (and 1.4.3 fixes)
45
+
46
+ The 1.4.2 recovery was supposed to fix the missing-artifact bug from
47
+ 1.4.1 by building all three wasm targets before publish. The local
48
+ build DID produce all the artifact files on disk — but the tarball
49
+ still shipped only `README.md` in those subdirs.
50
+
51
+ Root cause: **`wasm-pack build` writes a `.gitignore` containing `*`
52
+ into every `--out-dir`.** `pnpm pack` (and `npm pack`) honour nested
53
+ `.gitignore` patterns when filtering tarball contents, so every just-
54
+ built `.wasm` + `.js` + `.d.ts` gets filtered OUT of the tarball at
55
+ pack time. Only `README.md` survives because npm has a hardcoded rule
56
+ to always include READMEs. The 1.4.2 publish flow had no gate that
57
+ inspected tarball contents post-pack, so the broken state shipped
58
+ silently for a second time.
59
+
60
+ ### What 1.4.3 ships
61
+
62
+ Same TS + Rust changes as 1.4.1/1.4.2 (no code regression). New
63
+ defenses:
64
+
65
+ - `rust/scripts/build-engine-wasm.sh` now `rm -f`s the wasm-pack-
66
+ generated `.gitignore` from each `--out-dir` post-build. The poison
67
+ files can't reach `pnpm pack` from a clean local-dev publish.
68
+ - `packages/checkpoint-wasm-runtime` `copy-engine-wasm-bundler` npm
69
+ script chains a matching `rm -f` for the bundler target.
70
+ - New CI workflow `.github/workflows/publish-wasm-runtime.yml`:
71
+ builds all three targets in-runner, defuses the `.gitignore` poison
72
+ before pack, packs the tarball, **asserts the required `.wasm` +
73
+ `.js` paths are inside the tarball before publish**, and **re-
74
+ fetches the published tarball from npm post-publish and re-runs the
75
+ same assertions** to catch registry-side mutations. After a
76
+ successful publish, the workflow dispatches a `repository_dispatch`
77
+ event to `checkpoint-customers` so its bench fixture's lockfile can
78
+ be auto-bumped.
79
+
80
+ This is the gate 1.4.1 + 1.4.2 would have failed. Future broken
81
+ tarballs can't reach the registry.
82
+
83
+ ### Migration
84
+
85
+ Upgrade `@kya-os/checkpoint-wasm-runtime` from `1.4.1` or `1.4.2` to
86
+ `1.4.3`. Both poisoned versions will be deprecated on npm with a
87
+ "Broken tarball — upgrade to 1.4.3" message after this release lands.
88
+
89
+ ---
90
+
3
91
  ## 1.4.2 — 2026-05-18
4
92
 
5
93
  **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.4",
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": "1.1.0",
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;