@visiq/core-wasm 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -7,28 +7,38 @@ of a parallel TS implementation that can drift.
7
7
 
8
8
  ```js
9
9
  const { evaluate } = require('@visiq/core-wasm');
10
- const decisionJson = evaluate(JSON.stringify(event), JSON.stringify(bundle));
10
+ // PLAIN OBJECTS IN, PLAIN OBJECT OUT — `evaluate` does the JSON marshalling
11
+ // itself. Do NOT pre-stringify: `evaluate(JSON.stringify(event), …)` double-
12
+ // encodes, the core sees a JSON *string* where an object belongs, and the
13
+ // decision comes back with `allowed: true` for an event policy DENIES.
14
+ const decision = evaluate(event, bundle);
15
+ if (!decision.allowed) {
16
+ // blocked by policy — do not execute the tool call
17
+ }
11
18
  ```
12
19
 
13
20
  - **Synchronous, no async init.** `--target nodejs` glue instantiates the wasm from bytes
14
21
  at `require` time (`new WebAssembly.Module`/`Instance`) — a drop-in for a sync call.
15
22
  (Node/server only; a browser build would need `--target web` + async init.)
16
- - **`evaluate(eventJson, bundleJson) → decisionJson`** is the language-neutral seam
17
- (`evaluate_json` in the core). Fail-closed (G001) on malformed input never throws.
23
+ - **`evaluate(event, bundle) → decision`** takes and returns plain objects; the
24
+ language-neutral seam underneath is `evaluate_json` (JSON string in, JSON string out),
25
+ and this package's wrapper is what stringifies/parses around it. Fail-closed (G001) on
26
+ malformed input — never throws.
18
27
  - **Faithful.** `node conformance.mjs` proves it reproduces the frozen golden corpus
19
28
  (`sdk-corpus/GOLDEN-oracle-vectors.json`) — the same vectors every other binding
20
- reproduces. **85/85, 0 diverge.**
29
+ reproduces. **118/118, 0 diverge.**
21
30
 
22
31
  ## Rebuild
23
32
 
24
33
  `./build.sh` (needs rustup + `wasm32-unknown-unknown` + `wasm-bindgen-cli` **=0.2.100**;
25
34
  the crate pins `wasm-bindgen = "=0.2.100"` so CLI/schema versions match).
26
35
 
27
- ## Scope / what this is NOT
36
+ ## Scope
28
37
 
29
- This emits the **decision tuple** `{decision, allowed, action:{decision,argRedactionRules},
30
- retrieval:{action,redactionRules}}`. It does **not** emit rule attribution (`ruleCode`,
31
- `reason` prose, `decisionId`) — those are out-of-core (#25) and still computed in TS. A
32
- full `@visiq/harness` cutover to this core therefore needs the core extended to return
33
- matched-rule attribution; until then this package is the proven, corpus-gated binding.
34
- See `experiments/matrix-v2/visiq-core-rs/PARITY-GAPS.md`.
38
+ `evaluate` returns the full decision object `{decision, allowed, reason, ruleId,
39
+ ruleCode, enforced, agentMode, action:{decision,argRedactionRules},
40
+ retrieval:{action,redactionRules}}`. Matched-rule attribution (`reason` prose,
41
+ `ruleId`, `ruleCode`) IS emitted in-core; `decisionId` is not it is minted by the
42
+ caller. `@visiq/runtime` declares this package a REQUIRED dependency and calls it the
43
+ sole decision engine, so the harness cutover is done, not pending. Remaining seams are
44
+ tracked in `experiments/matrix-v2/visiq-core-rs/PARITY-GAPS.md`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@visiq/core-wasm",
3
- "version": "0.1.5",
4
- "description": "VisIQ governance core (visiq-core-rs) compiled to WASM — the ONE Rust evaluation core, bound to JS. Same core the Go/Java/Ruby/Python SDKs use. evaluate(eventJson, bundleJson) -> decisionJson.",
3
+ "version": "0.1.7",
4
+ "description": "VisIQ governance core for Node.js — the one compiled Rust rule engine behind every VisIQ SDK, prebuilt to WebAssembly; evaluate(event, bundle) takes plain objects and synchronously returns a decision object.",
5
5
  "type": "commonjs",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
Binary file