renkin 0.33.0 → 0.35.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 +18 -5
- package/package.json +1 -1
- package/renkin.d.ts +20 -0
- package/renkin.js +46 -0
- package/renkin_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
-
**Keep your planner. Audit every route.** Audit retrosynthesis routes from AiZynthFinder, Syntheseus, or RENKIN — locally, reproducibly, and without sending molecular structures anywhere.
|
|
24
|
+
**Keep your planner. Audit every route.** Audit retrosynthesis routes from AiZynthFinder, Syntheseus, SynPlanner, or RENKIN — locally, reproducibly, and without sending molecular structures anywhere.
|
|
25
25
|
|
|
26
26
|
[**Audit a route in your browser →**](https://kent-tokyo.github.io/renkin/playground/) · [**Python quick start ↓**](#audit-a-route) · [**Route planning engine ↓**](#quick-start)
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
## What is RENKIN?
|
|
31
31
|
|
|
32
|
-
RENKIN Bridge is a tool-neutral **route auditor**: it checks structural integrity, stock coverage, and declared-reaction forward-replay for routes from **AiZynthFinder**, **Syntheseus**, or RENKIN's own planner — the identical `pass`/`fail`/`partial` pipeline regardless of which tool produced the route, entirely local and reproducible (every audit records a verifiable [`audit_manifest`](https://kent-tokyo.github.io/renkin/guides/audit-reproducibility-contract/)), structures never leaving your machine unless you explicitly ask.
|
|
32
|
+
RENKIN Bridge is a tool-neutral **route auditor**: it checks structural integrity, stock coverage, and declared-reaction forward-replay for routes from **AiZynthFinder**, **Syntheseus**, **SynPlanner**, or RENKIN's own planner — the identical `pass`/`fail`/`partial` pipeline regardless of which tool produced the route, entirely local and reproducible (every audit records a verifiable [`audit_manifest`](https://kent-tokyo.github.io/renkin/guides/audit-reproducibility-contract/)), structures never leaving your machine unless you explicitly ask.
|
|
33
33
|
|
|
34
34
|
RENKIN is also, in its own right, an open-source **retrosynthesis engine** for **computer-aided synthesis planning (CASP)** that automatically discovers chemical reaction routes from a target molecule back to cheap, commercially available starting materials.
|
|
35
35
|
|
|
@@ -85,9 +85,21 @@ report = json.loads(renkin.audit_route(route_json, format="syntheseus"))
|
|
|
85
85
|
print(report["summary"])
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
**SynPlanner**
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import json
|
|
92
|
+
import renkin
|
|
93
|
+
|
|
94
|
+
report = json.loads(
|
|
95
|
+
renkin.audit_route(open("routes.json").read(), format="synplanner")
|
|
96
|
+
)
|
|
97
|
+
print(report["summary"])
|
|
98
|
+
```
|
|
99
|
+
|
|
88
100
|
**In your browser** — no installation, no upload, no server: [**Try the Playground →**](https://kent-tokyo.github.io/renkin/playground/)
|
|
89
101
|
|
|
90
|
-
Full walkthroughs with real output, end to end: [AiZynthFinder](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) · [Syntheseus](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/).
|
|
102
|
+
Full walkthroughs with real output, end to end: [AiZynthFinder](https://kent-tokyo.github.io/renkin/guides/aizynthfinder-audit-demo/) · [Syntheseus](https://kent-tokyo.github.io/renkin/guides/syntheseus-audit-demo/) · [SynPlanner](https://kent-tokyo.github.io/renkin/guides/synplanner-audit-demo/).
|
|
91
103
|
|
|
92
104
|
---
|
|
93
105
|
|
|
@@ -393,7 +405,7 @@ for the full acceptance criteria and licensing split.
|
|
|
393
405
|
| **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) |
|
|
394
406
|
| **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)) |
|
|
395
407
|
| **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)) |
|
|
396
|
-
| **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 4.3.2, 4.4.0, and 4.4.1 specifically, not claimed for every version (v0.26.0, version matrix widened v0.32.0) —
|
|
408
|
+
| **RENKIN Bridge / `audit-route`** | `renkin audit-route route.json [--format auto\|renkin\|aizynthfinder\|syntheseus\|synplanner] [--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 4.3.2, 4.4.0, and 4.4.1 specifically, not claimed for every version (v0.26.0, version matrix widened v0.32.0) — 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) — and real SynPlanner 1.6.0 `write_routes_json` exports directly, no exporter package needed (v0.34.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/) · [SynPlanner walkthrough →](https://kent-tokyo.github.io/renkin/guides/synplanner-audit-demo/) |
|
|
397
409
|
| **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 |
|
|
398
410
|
| **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 |
|
|
399
411
|
| **Pareto multi-objective search** | `--format pareto` returns a Pareto front across `route_cost`/`success_probability`/`steps`; objectives configurable via `--objectives` |
|
|
@@ -551,7 +563,7 @@ The JSON output includes `avg_nodes_expanded`, `avg_confidence`, `avg_convergenc
|
|
|
551
563
|
| `plan_with_constraints` | Constraint-DSL planning (element filters, step limits, confidence thresholds) |
|
|
552
564
|
| `estimate_diversity` | Route diversity and coverage metrics |
|
|
553
565
|
|
|
554
|
-
The server auto-detects `data/building_blocks.smi` and `data/templates_extracted_5000.smi` in the working directory. Falls back to the embedded `DEFAULT_BUILDING_BLOCKS` / `default_rules()` defaults if not found (152 unique building blocks per `ChemEnv::bb_count()`,
|
|
566
|
+
The server auto-detects `data/building_blocks.smi` and `data/templates_extracted_5000.smi` in the working directory. Falls back to the embedded `DEFAULT_BUILDING_BLOCKS` / `default_rules()` defaults if not found (152 unique building blocks per `ChemEnv::bb_count()`, 26 handcrafted rules — verified 2026-08-24, after `buchwald_hartwig_retro`'s removal (issue #77: same ring-fused-nitrogen atom-loss defect as `aryl_amine_retro`, plus a corrupted surviving fragment) dropped the count from 27; a "509-BB / 20-rule" figure was previously documented here without verification).
|
|
555
567
|
|
|
556
568
|
```bash
|
|
557
569
|
cargo build --release
|
|
@@ -669,6 +681,7 @@ see "Earlier milestones" below for older shipped work.
|
|
|
669
681
|
|
|
670
682
|
### Recently shipped
|
|
671
683
|
|
|
684
|
+
- [x] **SynPlanner Bridge** (`--format synplanner`, shipped v0.34.0) — *Keep SynPlanner. Audit its routes with RENKIN.* A fourth route adapter, and the first whose native export carries real, forward-replayable atom mapping: `renkin audit-route --format synplanner` (also auto-detected) reads real SynPlanner 1.6.0 `write_routes_json` exports directly, no exporter package needed. Confirmed against real SynPlanner output twice — hand-constructed reactions through SynPlanner's own exporter, and a real CPU-only MCTS-searched planning run through the real `synplan planning` CLI end to end — every one of 317 real reaction nodes across a 167-route real search carries a structurally valid atom map, and real routes reach a genuine `pass` verdict, not just `not_evaluable`. New 4-way (RENKIN-native/AiZynthFinder/Syntheseus/SynPlanner) structural and policy-verdict parity tests. The [browser playground](https://kent-tokyo.github.io/renkin/playground/)'s Audit tab gained SynPlanner as a fourth format option, with a one-click real-MCTS-output example. [5-minute walkthrough with real output →](https://kent-tokyo.github.io/renkin/guides/synplanner-audit-demo/)
|
|
672
685
|
- [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/)
|
|
673
686
|
- [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.
|
|
674
687
|
- [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.
|
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.
|
|
8
|
+
"version": "0.35.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
package/renkin.d.ts
CHANGED
|
@@ -84,6 +84,25 @@ export function find_routes(target: string, depth: number, max_routes: number, b
|
|
|
84
84
|
*/
|
|
85
85
|
export function find_routes_v2(target: string, depth: number, max_routes: number, beam_width: number, avoid_elements: string, require_elements: string): string;
|
|
86
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Same as [`find_routes_v2`], plus `spectator_bond_policy`
|
|
89
|
+
* (`docs/design/spectator-bond-fail-closed-gating-v0.md`): `"off"`
|
|
90
|
+
* (default) | `"diagnostics_only"` | `"gated"`, same vocabulary as the
|
|
91
|
+
* CLI's `--spectator-bond-policy` flag and the Python binding's
|
|
92
|
+
* `spectator_bond_policy` kwarg. `"gated"` can change which candidates
|
|
93
|
+
* (and therefore which `routes`) come back -- v1 scope only: rules with
|
|
94
|
+
* no `#` in their SMIRKS, others stay diagnostics-only regardless of this
|
|
95
|
+
* setting. A distinct function name rather than a 5th parameter on
|
|
96
|
+
* `find_routes_v2`, matching that function's own stated reasoning (a
|
|
97
|
+
* caller on an older build gets a real "no such export" `TypeError`
|
|
98
|
+
* instead of a silently-ignored argument). Findings/gated-out records
|
|
99
|
+
* themselves aren't surfaced in this output yet -- WASM has no
|
|
100
|
+
* `search_diagnostics`-equivalent block at all today, for any
|
|
101
|
+
* `CrowdOutDiagnostics` field, not just this one; only the policy control
|
|
102
|
+
* itself (and its effect on `routes`) is in scope here.
|
|
103
|
+
*/
|
|
104
|
+
export function find_routes_v3(target: string, depth: number, max_routes: number, beam_width: number, avoid_elements: string, require_elements: string, spectator_bond_policy: string): string;
|
|
105
|
+
|
|
87
106
|
/**
|
|
88
107
|
* Return the crate version string.
|
|
89
108
|
*/
|
|
@@ -98,6 +117,7 @@ export interface InitOutput {
|
|
|
98
117
|
readonly capabilities: () => [number, number];
|
|
99
118
|
readonly find_routes: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
100
119
|
readonly find_routes_v2: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
120
|
+
readonly find_routes_v3: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
|
|
101
121
|
readonly version: () => [number, number];
|
|
102
122
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
103
123
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
package/renkin.js
CHANGED
|
@@ -182,6 +182,52 @@ export function find_routes_v2(target, depth, max_routes, beam_width, avoid_elem
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Same as [`find_routes_v2`], plus `spectator_bond_policy`
|
|
187
|
+
* (`docs/design/spectator-bond-fail-closed-gating-v0.md`): `"off"`
|
|
188
|
+
* (default) | `"diagnostics_only"` | `"gated"`, same vocabulary as the
|
|
189
|
+
* CLI's `--spectator-bond-policy` flag and the Python binding's
|
|
190
|
+
* `spectator_bond_policy` kwarg. `"gated"` can change which candidates
|
|
191
|
+
* (and therefore which `routes`) come back -- v1 scope only: rules with
|
|
192
|
+
* no `#` in their SMIRKS, others stay diagnostics-only regardless of this
|
|
193
|
+
* setting. A distinct function name rather than a 5th parameter on
|
|
194
|
+
* `find_routes_v2`, matching that function's own stated reasoning (a
|
|
195
|
+
* caller on an older build gets a real "no such export" `TypeError`
|
|
196
|
+
* instead of a silently-ignored argument). Findings/gated-out records
|
|
197
|
+
* themselves aren't surfaced in this output yet -- WASM has no
|
|
198
|
+
* `search_diagnostics`-equivalent block at all today, for any
|
|
199
|
+
* `CrowdOutDiagnostics` field, not just this one; only the policy control
|
|
200
|
+
* itself (and its effect on `routes`) is in scope here.
|
|
201
|
+
* @param {string} target
|
|
202
|
+
* @param {number} depth
|
|
203
|
+
* @param {number} max_routes
|
|
204
|
+
* @param {number} beam_width
|
|
205
|
+
* @param {string} avoid_elements
|
|
206
|
+
* @param {string} require_elements
|
|
207
|
+
* @param {string} spectator_bond_policy
|
|
208
|
+
* @returns {string}
|
|
209
|
+
*/
|
|
210
|
+
export function find_routes_v3(target, depth, max_routes, beam_width, avoid_elements, require_elements, spectator_bond_policy) {
|
|
211
|
+
let deferred5_0;
|
|
212
|
+
let deferred5_1;
|
|
213
|
+
try {
|
|
214
|
+
const ptr0 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
215
|
+
const len0 = WASM_VECTOR_LEN;
|
|
216
|
+
const ptr1 = passStringToWasm0(avoid_elements, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
217
|
+
const len1 = WASM_VECTOR_LEN;
|
|
218
|
+
const ptr2 = passStringToWasm0(require_elements, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
219
|
+
const len2 = WASM_VECTOR_LEN;
|
|
220
|
+
const ptr3 = passStringToWasm0(spectator_bond_policy, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
221
|
+
const len3 = WASM_VECTOR_LEN;
|
|
222
|
+
const ret = wasm.find_routes_v3(ptr0, len0, depth, max_routes, beam_width, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
223
|
+
deferred5_0 = ret[0];
|
|
224
|
+
deferred5_1 = ret[1];
|
|
225
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
226
|
+
} finally {
|
|
227
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
185
231
|
/**
|
|
186
232
|
* Return the crate version string.
|
|
187
233
|
* @returns {string}
|
package/renkin_bg.wasm
CHANGED
|
Binary file
|