renkin 0.28.0 → 0.30.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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ Use RENKIN as an independent audit layer for retrosynthesis routes generated by
36
36
  ```bash
37
37
  pip install renkin # Python
38
38
  cargo add renkin # Rust
39
- npm install renkin # JavaScript / Node.js
39
+ npm install renkin # JavaScript (browser / bundler -- see docs/api/wasm.md)
40
40
  ```
41
41
 
42
42
  ---
@@ -346,7 +346,7 @@ for the full acceptance criteria and licensing split.
346
346
  | **Ring-context safety guard** | `--ring-context-policy conservative --ring-context-sidecar <path>` — opt-in match-level filter that rejects an extracted template's ring-opening/closing disconnection when its historical training data never observed that bond as ring-forming/-breaking; default `disabled` (unchanged legacy behavior) — see [Issue #72](https://github.com/kent-tokyo/renkin/issues/72) |
347
347
  | **LightGBM candidate reranker** | `--reranker-model`/`--reranker-freq-table` (CLI) or `reranker_model_path`/`reranker_freq_table_path` (Python) — opt-in, ordering-only re-ranking via a frozen LightGBM model; never changes which candidates are generated, only their order, and reproduces legacy ordering byte-for-byte when off. Paired 100-target route-search gate: `route_to_configured_stock` 16→20 (+4/-0). `python3 scripts/fetch_reranker_model.py` fetches the frozen model (SHA-256-verified, not bundled in any package — see [Roadmap](#roadmap)) |
348
348
  | **Coverage mode** (opt-in) | `--search-mode coverage --coverage-templates <path>` (CLI) or `search_mode="coverage"`, `coverage_templates_path=...` (Python) — if the default template set finds no route, automatically escalates to a larger, separately loaded template set, cooperatively cancellable via `--coverage-timeout-secs`. Standard-mode output is byte-for-byte unchanged when not used. `python3 scripts/fetch_coverage_templates.py` fetches the frozen 2,000-template Stage-2 set (SHA-256-verified, not bundled in any package, same reasoning as the reranker model — see [Roadmap](#roadmap)) |
349
- | **RENKIN Bridge / `audit-route`** | `renkin audit-route route.json [--format auto\|renkin\|aizynthfinder] [--stock stock.smi] [--output human\|json]` — tool-neutral route audit: structural integrity, stock, and declared-reaction forward-replay validation, each reported independently as `pass`/`fail`/`not_evaluable`, rolled up into a route-level `pass`/`fail`/`partial` verdict. Reads RENKIN-native route JSON (v0.25.0) and real AiZynthFinder route JSON — single-target and gzip-compressed batch output, verified against AiZynthFinder v4.4.1 specifically, not claimed for every version (v0.26.0); `--format auto` detects the input shape and hard-errors rather than guessing on anything ambiguous. [5-minute walkthrough with real output →](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) |
349
+ | **RENKIN Bridge / `audit-route`** | `renkin audit-route route.json [--format auto\|renkin\|aizynthfinder\|syntheseus] [--stock stock.smi] [--output human\|json]` — tool-neutral route audit: structural integrity, stock, and declared-reaction forward-replay validation, each reported independently as `pass`/`fail`/`not_evaluable`, rolled up into a route-level `pass`/`fail`/`partial` verdict. Reads RENKIN-native route JSON (v0.25.0), real AiZynthFinder route JSON — single-target and gzip-compressed batch output, verified against AiZynthFinder v4.4.1 specifically, not claimed for every version (v0.26.0) — and Syntheseus routes via the optional `renkin.syntheseus_exporter`'s `syntheseus-route-v1` interchange schema, since Syntheseus itself has no native route export (v0.30.0); `--format auto` detects the input shape and hard-errors rather than guessing on anything ambiguous. [AiZynthFinder walkthrough →](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) · [Syntheseus walkthrough →](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/) |
350
350
  | **Route scoring** | `confidence`, `step_confidence`, `success_probability` (Retro-prob style), `convergency`, `atom_economy`, `route_cost` (`Σ BB cost + steps×0.5`, or actual prices via `--bb-prices`/`--stock`) per step/route — see caveat below the table |
351
351
  | **Step metadata provenance** | Each step reports `metadata_source`/`metadata_scope` so it's machine-readable whether `conditions`/`reaction_family` came from a rule-author default vs. something more grounded; absent (not fabricated) for extracted templates |
352
352
  | **Pareto multi-objective search** | `--format pareto` returns a Pareto front across `route_cost`/`success_probability`/`steps`; objectives configurable via `--objectives` |
@@ -622,6 +622,8 @@ see "Earlier milestones" below for older shipped work.
622
622
 
623
623
  ### Recently shipped
624
624
 
625
+ - [x] **Syntheseus Bridge** (`--format syntheseus`, shipped v0.30.0) — *Syntheseus has no route export. RENKIN built one — and audits it exactly like every other adapter.* A third route adapter alongside RENKIN-native and AiZynthFinder: the optional `renkin.syntheseus_exporter` (`pip install renkin[syntheseus]`) turns a real Syntheseus `SynthesisGraph` into the `syntheseus-route-v1` interchange schema, which `renkin audit-route --format syntheseus` (also auto-detected) consumes through the identical audit pipeline every adapter shares. Forward validation honestly reports `not_evaluable` for every real Syntheseus route today — `reaction_smiles` carries no atom mapping, never faked into a pass. The [browser playground](https://kent-tokyo.github.io/renkin/playground/)'s Audit tab gained Syntheseus as a third format option. [5-minute walkthrough with real output →](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/)
626
+ - [x] **Audit Policy Profiles** (`--policy informational|standard|strict`, shipped v0.29.0) — *One set of findings. Three ways to derive the verdict.* Audit the same route under `informational`, `standard`, or `strict` policy without ever hiding or changing the underlying findings — policy only changes how the overall pass/fail/partial verdict is derived from findings already collected, recorded in `audit_manifest.policy`. Consistent across every surface: `renkin audit-route --policy`, the Rust API, the first Python binding for route auditing (`renkin.audit_route()`), and a new WASM `audit_route_v2()` (the existing `audit_route()` stays as a `standard`-policy wrapper). The [browser playground](https://kent-tokyo.github.io/renkin/playground/)'s Audit tab gained a policy selector.
625
627
  - [x] **Audit Playground** (`[ Audit a Route ]` tab, shipped v0.28.0) — *Audit a route in your browser — the same pipeline, the same verdict, zero network calls.* The [browser playground](https://kent-tokyo.github.io/renkin/playground/) now audits a RENKIN or AiZynthFinder route export (single-route or Pandas batch) and an optional stock list entirely client-side, via a new `audit_route` WASM export that calls the identical report-building pipeline `renkin audit-route` uses — the same pass/fail/partial verdict either way, not a separately-maintained copy. Paste or upload, run off the main thread, download the JSON report.
626
628
  - [x] **Reproducible Route Audit** (`audit_manifest` on `renkin audit-route --output json`, shipped v0.27.0) — *Reproduce what was audited, from which input, with which stock and policy.* Every audit report now records RENKIN version, report schema version, source format/version, input/stock content SHA-256 hashes, and audit policy — tested for byte-identical determinism (auditing the same input twice), not just claimed. Adds a shared adapter conformance suite across RENKIN-native and AiZynthFinder route inputs, plus a written [reproducibility/compatibility contract](https://kent-tokyo.github.io/renkin/guides/audit-reproducibility-contract/) (verified-vs-supported versions, unknown-field tolerance, report-schema rules, adapter-fixture runbook). The [browser playground](https://kent-tokyo.github.io/renkin/playground/) also got a safety/UX pass this release: search runs off the main thread with cancel/time-budget support, structure rendering stays local by default (no third-party SMILES transmission), and search settings round-trip exactly through Copy CLI/Python.
627
629
  - [x] **RENKIN Bridge — Cross-Tool Route Audit** (`renkin audit-route`, RENKIN-native adapter shipped v0.25.0, AiZynthFinder adapter shipped v0.26.0) — *Keep AiZynthFinder. Audit its routes with RENKIN.* A tool-neutral route audit model: structural-integrity, stock, and declared-reaction forward-replay validation, each reported independently as `pass`/`fail`/`not_evaluable`, rolled up into a route-level `pass`/`fail`/`partial` verdict — never a silently force-passed boolean. v0.26.0 adds a real AiZynthFinder adapter (single-target and gzip batch JSON, verified against captured v4.4.1 output — see [`PROVENANCE.md`](tests/fixtures/aizynthfinder/v4.4.1/PROVENANCE.md)) plus `--format auto` detection, so both tools' routes run through the exact same audit pipeline; auditing the real fixtures also surfaced and fixed a shared forward-replay bug where precursor ordering, not just chemistry, affected the verdict. `renkin audit-route route.json --stock stock.smi --output json` audits every route in a file and aggregates the results into one machine-readable report, regardless of which tool produced it.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "kent-tokyo <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "Ultra-fast retrosynthesis engine for computer-aided synthesis planning (CASP) — pure Rust, WASM-ready, Python bindings via PyO3",
8
- "version": "0.28.0",
8
+ "version": "0.30.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/renkin.d.ts CHANGED
@@ -25,6 +25,19 @@
25
25
  */
26
26
  export function audit_route(content: string, format: string, stock_text: string): string;
27
27
 
28
+ /**
29
+ * Same as [`audit_route`], plus `policy` (v0.29.0 Audit Policy Profiles):
30
+ * `"informational" | "standard" | "strict"`, same vocabulary as the CLI's
31
+ * `--policy` flag -- controls only how each route's `status` is derived
32
+ * from findings already collected, never which findings are detected or
33
+ * reported. A distinct function name rather than a 4th parameter on
34
+ * `audit_route`, so a caller on a pre-v0.29.0 build gets a real "no such
35
+ * export" `TypeError` instead of a silently-ignored argument -- the same
36
+ * reasoning `find_routes_v2` already established in this codebase.
37
+ * `audit_route` itself is now a thin `"standard"` wrapper around this.
38
+ */
39
+ export function audit_route_v2(content: string, format: string, stock_text: string, policy: string): string;
40
+
28
41
  /**
29
42
  * Static capabilities of this WASM build (browser edition), as a JSON
30
43
  * string -- real counts read from the same compiled-in data `find_routes`
@@ -81,6 +94,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
81
94
  export interface InitOutput {
82
95
  readonly memory: WebAssembly.Memory;
83
96
  readonly audit_route: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
97
+ readonly audit_route_v2: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
84
98
  readonly capabilities: () => [number, number];
85
99
  readonly find_routes: (a: number, b: number, c: number, d: number, e: number) => [number, number];
86
100
  readonly find_routes_v2: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
package/renkin.js CHANGED
@@ -45,6 +45,43 @@ export function audit_route(content, format, stock_text) {
45
45
  }
46
46
  }
47
47
 
48
+ /**
49
+ * Same as [`audit_route`], plus `policy` (v0.29.0 Audit Policy Profiles):
50
+ * `"informational" | "standard" | "strict"`, same vocabulary as the CLI's
51
+ * `--policy` flag -- controls only how each route's `status` is derived
52
+ * from findings already collected, never which findings are detected or
53
+ * reported. A distinct function name rather than a 4th parameter on
54
+ * `audit_route`, so a caller on a pre-v0.29.0 build gets a real "no such
55
+ * export" `TypeError` instead of a silently-ignored argument -- the same
56
+ * reasoning `find_routes_v2` already established in this codebase.
57
+ * `audit_route` itself is now a thin `"standard"` wrapper around this.
58
+ * @param {string} content
59
+ * @param {string} format
60
+ * @param {string} stock_text
61
+ * @param {string} policy
62
+ * @returns {string}
63
+ */
64
+ export function audit_route_v2(content, format, stock_text, policy) {
65
+ let deferred5_0;
66
+ let deferred5_1;
67
+ try {
68
+ const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
69
+ const len0 = WASM_VECTOR_LEN;
70
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
71
+ const len1 = WASM_VECTOR_LEN;
72
+ const ptr2 = passStringToWasm0(stock_text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
73
+ const len2 = WASM_VECTOR_LEN;
74
+ const ptr3 = passStringToWasm0(policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
75
+ const len3 = WASM_VECTOR_LEN;
76
+ const ret = wasm.audit_route_v2(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
77
+ deferred5_0 = ret[0];
78
+ deferred5_1 = ret[1];
79
+ return getStringFromWasm0(ret[0], ret[1]);
80
+ } finally {
81
+ wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
82
+ }
83
+ }
84
+
48
85
  /**
49
86
  * Static capabilities of this WASM build (browser edition), as a JSON
50
87
  * string -- real counts read from the same compiled-in data `find_routes`
package/renkin_bg.wasm CHANGED
Binary file