Babu09 commited on
Commit
7121c51
·
verified ·
1 Parent(s): c4b5e46

Mat2Bot Explorer: results of Mat2Bot 0.1.0 (build 53965be)

Browse files
cases/b1a_kcl_cooling_20C/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:323b4503bc90e9b6dc35e8048f97ce6e4dd3ad2052bbdde2192756b5d0bc24da
3
- size 120335
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf1274105539563a768d3e81ddf48ff4db4908297d60e412799f32855cfeda01
3
+ size 122849
cases/b1a_kcl_cooling_20C/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/b1b_kcl_cooling_25C/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ffe27acee588b9e14ec25b21baf9168c1177c0877e0d3e15502a91ed66c180f5
3
- size 121936
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eed5d3166ebceaa91002196ace9dfc0a27aec98215a400c4793617b362a4c517
3
+ size 124452
cases/b1b_kcl_cooling_25C/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/b1c_kcl_antisolvent_vcw001/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:386a7ae002e16ae33e8e28ded7399a25e8be62f6079db317c7cd0c097450445d
3
- size 101097
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:882a57c4b8744822b260f7c8408a0ab7ebb5cf341f574b32e155367d6191d643
3
+ size 103602
cases/b1c_kcl_antisolvent_vcw001/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/b2_caco3_calcite/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ffc80d293e56f75d43d4ab1a1ba988e1bc97624c67ad120a5844408f0fbd2e2d
3
- size 433154
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b412a49020d808ee4a6d07d5a2d99f0967fb2ac50fb5dec9afef80781ea6c547
3
+ size 435621
cases/b2_caco3_calcite/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/b3_zno_wurtzite/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:395da10ef299dd336bddcb357b81f720216ba010cacfae02df4a98e247ccdc6f
3
- size 336119
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d547a22d426ff7d2ea928d0b07c18cb2f0e83b77d9e89f7e16acffd8c5255ecd
3
+ size 338579
cases/b3_zno_wurtzite/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/b4_zno_rocksalt/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9f357aacd56158c43a80ff07e66638a076ff65dee88cc01df2d4fdfcc6a76a55
3
- size 119415
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c90e4186ebee8ce678db37db57acb177f66867640685efa4975f256368dd6750
3
+ size 121909
cases/b4_zno_rocksalt/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/m1_matter_candidate/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:02505eeb0567c2e04f45a2eac356d0fa1a564082598a8f3d2003bae75ef6d476
3
- size 26720
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ede27487a7982c6c34dec06a2462dfa26c0817e9d4247a23a1b973c33f17f53
3
+ size 29196
cases/m1_matter_candidate/trace.html CHANGED
@@ -86,20 +86,33 @@ svg.tv-edges path.hl{opacity:1;stroke-width:3}
86
  .tv-events li{grid-template-columns:2em 1fr;grid-auto-rows:auto}.tv-events li .msg{grid-column:1/-1}}
87
  @media (prefers-reduced-motion:no-preference){.tv-card,.tv-stage{transition:background .15s,outline-color .15s}}
88
  .tv-audit li{list-style:none;font-size:.84rem}
89
- </style></head><body><script id="trace" type="application/json">{"edges":[],"events":[{"ended":"2026-10-26T00:00:00.000+00:00","message":"BaTiO3: identity known phase, phase cubic BaTiO3; gates G1 PASS, G2 PASS","name":"target intake","seq":1,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"m1"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no synthesis precedent of this composition in the evidence","name":"families and precedents","seq":2,"stage":"M02","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","name":"route candidates","seq":3,"stage":"M04","started":"2026-10-26T00:00:00.000+00:00","status":"refused","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"gate S on the product alone: UNKNOWN; BaTiO3 no classification found","name":"the product's own hazards (handling only)","seq":4,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"feasibility","seq":5,"stage":"M05","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"route cases and ranking","seq":6,"stage":"M07","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"procedure","seq":7,"stage":"M08","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"laboratories","seq":8,"stage":"LAB","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"}],"layout":{"columns":["M01","M02","M04","M05","M07","M08","LAB","AUDIT"],"rows":{"finding:0":0,"gate:G1":1,"gate:G2":2,"gateS:target":3,"hazard:target:BaTiO3":4,"target":0}},"nodes":[{"children":["gate:G1","gate:G2","gateS:target"],"detail":{"checked_against":["the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields)"],"form":"","formula":"BaTiO3","identity":"known_phase","known_phases":[{"ids":["cod:4124842"],"name":"cubic BaTiO3"},{"ids":["cod:2009488"],"name":"hexagonal BaTiO3"},{"ids":["cod:9014492"],"name":"orthorhombic BaTiO3"},{"ids":["cod:9014074"],"name":"rhombohedral BaTiO3"},{"ids":["cod:1513252"],"name":"tetragonal BaTiO3"}],"missing":["Materials Project energies (no key; never decisive for polymorphs)"],"novelty":"found in Perov-5 dataset (18,928 materials) by Matter's check (reduced formula and A|B|X site assignment): material 14809, in the training split","phase":"cubic BaTiO3"},"evidence":"n/a","execution":"completed","kind":"target","lab":null,"label":"BaTiO3, cubic BaTiO3","node_id":"target","presentation_only":false,"ref":"target.json#target","science":"known phase","stage":"M01"},{"children":[],"detail":{"findings":[],"rules":["R-G1-INPUT-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G1: PASS","node_id":"gate:G1","presentation_only":false,"ref":"target.json#gates/G1","science":"PASS","stage":"M01"},{"children":[],"detail":{"findings":[{"code":"POLYMORPH_MISMATCH","message":"cubic BaTiO3 is stable only above about 130 °C (cited); at room temperature the measured structure is tetragonal BaTiO3 (P4mm, cod:1513252)","rule":"R-M01-PHASE-001"},{"code":"STABILITY_UNKNOWN","message":"Matter's ladder stage 1 (Stage 1 · Chemistry checked): the candidate structure is prototype placement, its stability is not assessed","rule":"R-M01-ID-002"},{"code":"KNOWN_COMPOUND","message":"BaTiO3 is a known compound: cubic BaTiO3 is a measured structure (cod:4124842)","rule":"R-M01-ID-002"}],"rules":["R-G2-ID-001","R-M01-ID-001","R-M01-PHASE-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G2: PASS","node_id":"gate:G2","presentation_only":false,"ref":"target.json#gates/G2","science":"PASS","stage":"M01"},{"children":["hazard:target:BaTiO3"],"detail":{"findings":[{"code":"HAZARD_UNKNOWN","message":"BaTiO3 (BaTiO3, product): no classification found; a person decides at G7"},{"code":"HAZARD_UNKNOWN","message":"no reagent of this route is known, so their hazards are unknown; a person decides at G7"}],"what":"what handling the material demands; not a route verdict"},"evidence":"n/a","execution":"completed","kind":"hazard","lab":null,"label":"Handling the product (gate S on it alone): UNKNOWN","node_id":"gateS:target","presentation_only":false,"ref":"safety/target.json#gate","science":"UNKNOWN","stage":"M01"},{"children":[],"detail":{"codes":[],"demands":[],"harmonised":false,"pubchem_cid":null,"url":null},"evidence":"missing","execution":"completed","kind":"hazard","lab":null,"label":"BaTiO3 (BaTiO3): no classification found","node_id":"hazard:target:BaTiO3","presentation_only":false,"ref":"safety/target.json#substances/BaTiO3","science":null,"stage":"M01"},{"children":[],"detail":{"code":"NO_SUPPORTED_FAMILY","message":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","rule":"R-M03-SCOPE-001","severity":"warning","subject":"BaTiO3"},"evidence":"n/a","execution":"refused","kind":"finding","lab":null,"label":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","node_id":"finding:0","presentation_only":false,"ref":"plan.json#findings/0","science":null,"stage":"M04"},{"children":["target","gate:G1","gate:G2","gateS:target","hazard:target:BaTiO3"],"detail":{"events":[1,4],"how":"","message":"BaTiO3: identity known phase, phase cubic BaTiO3; gates G1 PASS, G2 PASS; gate S on the product alone: UNKNOWN; BaTiO3 no classification found"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Target","node_id":"stage:M01","presentation_only":false,"ref":"trace.json#events/M01","science":null,"stage":"M01"},{"children":[],"detail":{"events":[2],"how":"","message":"no synthesis precedent of this composition in the evidence"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Evidence","node_id":"stage:M02","presentation_only":false,"ref":"trace.json#events/M02","science":null,"stage":"M02"},{"children":["finding:0"],"detail":{"events":[3],"how":"","message":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly"},"evidence":"n/a","execution":"refused","kind":"stage","lab":null,"label":"Routes","node_id":"stage:M04","presentation_only":false,"ref":"trace.json#events/M04","science":null,"stage":"M04"},{"children":[],"detail":{"events":[5],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Science","node_id":"stage:M05","presentation_only":false,"ref":"trace.json#events/M05","science":null,"stage":"M05"},{"children":[],"detail":{"events":[6],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"The case","node_id":"stage:M07","presentation_only":false,"ref":"trace.json#events/M07","science":null,"stage":"M07"},{"children":[],"detail":{"events":[7],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Procedure","node_id":"stage:M08","presentation_only":false,"ref":"trace.json#events/M08","science":null,"stage":"M08"},{"children":[],"detail":{"events":[8],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Laboratories","node_id":"stage:LAB","presentation_only":false,"ref":"trace.json#events/LAB","science":null,"stage":"LAB"},{"children":[],"detail":{"events":[],"how":"run `mat2bot audit <package>`; the result never comes from the package itself","message":"the package is audited after it is written: run the auditor, or a live audit fills this column"},"evidence":"n/a","execution":"not_run","kind":"stage","lab":null,"label":"Audit","node_id":"stage:AUDIT","presentation_only":false,"ref":"trace.json#nodes/stage:AUDIT","science":null,"stage":"AUDIT"}],"note":"A projection of the plan's records: every node names the record it shows and every edge a relationship that record holds; nothing here is computed anew. The audit stage is filled only by a live audit.","request_id":"m1","schema":"mat2bot/trace/1","title":"A MEIDNet-Matter candidate (Perov-5 search, run-LtMoP7Wma4gU-002, BaTiO3)"}</script><script id="trace-config" type="application/json">{"audit_url": "audit.json", "links": {"home": "../../index.html", "report": "report.html", "package": "package.zip"}, "mat2bot": "0.1.0"}</script><div id="trace-app" data-title="A MEIDNet-Matter candidate (Perov-5 search, run-LtMoP7Wma4gU-002, BaTiO3)"></div><script>/* Mat2Bot Trace viewer: three levels (overview, component, provenance) over trace.json and nothing else.
90
- Every card is a node of the trace, every drawn line an edge of it; the audit column is filled only from a live
91
- audit the host serves (config.audit_url), otherwise it stays "not run". Plain JS, no library. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  (function () {
93
  "use strict";
94
- const T = JSON.parse(document.getElementById("trace").textContent);
95
- const CFG = JSON.parse(document.getElementById("trace-config").textContent || "{}");
96
- const app = document.getElementById("trace-app");
97
- const NODES = new Map(T.nodes.map((n) => [n.node_id, n]));
98
- const STAGES = T.layout.columns || ["M01", "M02", "M04", "M05", "M07", "M08", "LAB", "AUDIT"];
99
- const STAGE_NODE = {};
100
- T.nodes.forEach((n) => { if (n.kind === "stage") STAGE_NODE[n.stage] = n; });
101
- const OUT = new Map(), IN = new Map();
102
- T.edges.forEach((e) => { (OUT.get(e.source) || OUT.set(e.source, []).get(e.source)).push(e); (IN.get(e.target) || IN.set(e.target, []).get(e.target)).push(e); });
103
  const esc = (s) => String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
104
  const WORDS = {
105
  execution: { completed: ["ran", "ok"], skipped: ["skipped", "off"], refused: ["stopped: refused", "warn"], failed: ["failed", "bad"], not_run: ["not run", "off"] },
@@ -117,233 +130,348 @@ svg.tv-edges path.hl{opacity:1;stroke-width:3}
117
  const KIND_WORDS = { stage: "stage", target: "the target", finding: "finding", route: "route", rival: "rejected route", claim: "claim", inference: "inference",
118
  evidence: "evidence", calculation: "calculation", model_output: "model", assumption: "assumption", doubt: "doubt", step: "step", hazard: "hazard",
119
  laboratory: "laboratory", capability: "equipment", grouping: "group" };
 
120
  function chip(attr, value) {
121
  if (value == null || value === "n/a" || value === "") return "";
122
  const w = (WORDS[attr] || {})[value] || [String(value).replace(/_/g, " "), "acc"];
123
  return `<span class="chip ${w[1]}" title="${esc(attr)}: ${esc(value)}">${esc(w[0])}</span>`;
124
  }
125
- function chips(n) {
126
- return [chip("execution", n.kind === "stage" || n.execution !== "completed" ? n.execution : null), chip("science", n.science),
127
- chip("evidence", n.evidence), chip("lab", n.lab)].join("");
128
- }
129
- // ---------------------------------------------------------------- routing
130
- function state() {
131
- const h = Object.fromEntries(location.hash.slice(1).split("&").filter(Boolean).map((kv) => kv.split("=").map(decodeURIComponent)));
132
- return { stage: h.stage || "", node: h.node || "", cmp: (h.cmp || "").split(",").filter(Boolean) };
133
- }
134
- function go(s) {
135
- const parts = [];
136
- if (s.stage) parts.push("stage=" + encodeURIComponent(s.stage));
137
- if (s.node) parts.push("node=" + encodeURIComponent(s.node));
138
- if (s.cmp && s.cmp.length) parts.push("cmp=" + encodeURIComponent(s.cmp.join(",")));
139
- const next = "#" + parts.join("&");
140
- if (location.hash !== next) location.hash = next; else render();
141
- }
142
- // ---------------------------------------------------------------- the frame
143
- let AUDIT = null;
144
- function frame(s) {
145
- const links = CFG.links || {};
146
- const nav = Object.entries(links).map(([k, v]) => `<a href="${esc(v)}">${esc({ report: "Technical report", package: "Download the package", audit: "Audit it now", home: "Mat2Bot" }[k] || k)}</a>`).join("");
147
- const tabs = [["", "Overview"], ["__comp", "Components"], ["__prov", "Provenance"]];
148
- const cur = s.node ? "__prov" : s.stage ? "__comp" : "";
149
- return `<header class="tv-top"><h1>${esc(app.dataset.title)}: how Mat2Bot got there</h1><nav>${nav}</nav></header>
150
- <p class="tv-sub">${esc(T.note)} Request <code>${esc(T.request_id)}</code>; ${T.nodes.length} records shown, ${T.edges.length} relationships, ${T.events.length} events. Click a stage, then a card, to reach the record behind it; the address bar keeps your place.</p>
151
- <div class="tv-tabs">${tabs.map(([k, l]) => `<button type="button" data-tab="${k}" ${cur === k ? 'aria-current="page"' : ""}>${l}</button>`).join("")}</div>`;
152
- }
153
- // ---------------------------------------------------------------- overview
154
- function summary(stage) {
155
- const kids = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
156
- const count = (f) => kids.filter(f).length;
157
- const items = [];
158
- if (stage === "M01") { const t = kids.find((n) => n.kind === "target"); if (t) items.push(esc(t.label), `identity: ${esc(t.science)}`); kids.filter((n) => n.kind === "claim").forEach((g) => items.push(`${esc(g.label)}`)); }
159
- if (stage === "M02") items.push(`${count((n) => n.kind === "evidence")} records: ${count((n) => n.evidence === "verified")} verified, ${count((n) => n.evidence === "unverified")} not`);
160
- if (stage === "M04") { items.push(`${count((n) => n.kind === "route")} proposed, ${count((n) => n.kind === "rival")} rejected`); kids.filter((n) => n.kind === "finding").forEach((f) => items.push(esc(f.detail.code))); }
161
- if (stage === "M05") items.push(`${count((n) => n.kind === "calculation")} calculations, ${count((n) => n.kind === "model_output" && n.execution === "refused")} model refusals`);
162
- if (stage === "M07") items.push(`${count((n) => n.kind === "claim")} claims; doubts: ${count((n) => n.science === "open")} open, ${count((n) => n.science === "eliminated")} ruled out, ${count((n) => n.science === "sustained")} confirmed`);
163
- if (stage === "M08") items.push(`${count((n) => n.kind === "step")} steps; ${count((n) => n.kind === "step" && n.science)} with unresolved values`);
164
- if (stage === "LAB") kids.filter((n) => n.kind === "laboratory").forEach((l) => items.push(`${esc(l.label)}`));
165
- if (stage === "AUDIT") {
166
- if (AUDIT) items.push(`${esc(AUDIT.verdict)}: ${AUDIT.checks.filter((c) => c.verdict === "PASS").length} checks passed${AUDIT.checks.some((c) => c.verdict === "FAIL") ? ", " + AUDIT.checks.filter((c) => c.verdict === "FAIL").length + " failed" : ""}`, esc(AUDIT.when || ""));
167
- else items.push("not filled by this package", CFG.audit_url ? "loading the live audit…" : "run the auditor on the package");
168
  }
169
- return items.map((x) => `<li>${x}</li>`).join("");
170
- }
171
- function overview(s) {
172
- const cards = STAGES.map((st) => {
173
- const n = STAGE_NODE[st] || { label: st, execution: "not_run", children: [] };
174
- const ex = st === "AUDIT" && AUDIT ? (AUDIT.verdict === "PASS" ? "completed" : "failed") : n.execution;
175
- return `<button type="button" class="tv-stage" data-stage="${st}"><span class="n">${esc(st)}</span><b>${esc(n.label)}</b>${chip("execution", ex)}<ul class="sum">${summary(st)}</ul></button>`;
176
- }).join("");
177
- const ev = T.events.map((e) => `<li class="${e.status}"><span class="seq">${e.seq}</span><span>${esc(e.stage)}</span><span>${esc(e.name)}${e.subject ? ` <small>(${esc(e.subject)})</small>` : ""}<span class="msg">${esc(e.message)}</span></span>${chip("execution", e.status)}</li>`).join("");
178
- return `<div class="tv-stages">${cards}</div>
179
- <p class="tv-legend"><span>Execution, science, evidence and laboratory are four separate marks; a card shows only those its record has.</span></p>
180
- <section class="tv-timeline"><h2>What ran, in order</h2><ol class="tv-events">${ev || '<li><span class="tv-empty">no events recorded</span></li>'}</ol>
181
- <p class="tv-sub">Times are the run's own clock (a fixed clock in a reproducible package). A skipped stage was not reached; a refused one stopped on purpose.</p></section>`;
182
- }
183
- // ---------------------------------------------------------------- component view
184
- function groupsOf(stage) {
185
- const all = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
186
- const nested = new Set(); // shown inside their parent's card, not again at the top level
187
- all.forEach((n) => { if (["target", "route", "rival", "grouping", "hazard", "laboratory"].includes(n.kind)) n.children.forEach((c) => nested.add(c)); });
188
- const kids = all.filter((n) => !nested.has(n.node_id));
189
- const byRoute = new Map();
190
- kids.forEach((n) => { const r = n.detail && n.detail.route; const key = r ? "route " + r : ""; (byRoute.get(key) || byRoute.set(key, []).get(key)).push(n); });
191
- return [...byRoute.entries()];
192
- }
193
- function relChips(n, visible) {
194
- const out = [];
195
- (OUT.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.target)) out.push(`<a href="#node=${encodeURIComponent(e.target)}">${esc(EDGE_WORDS[e.kind])}: ${esc(short(NODES.get(e.target)))}</a>`); });
196
- (IN.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.source) && e.kind !== "cites") out.push(`<a href="#node=${encodeURIComponent(e.source)}">${esc(short(NODES.get(e.source)))} ${esc(EDGE_WORDS[e.kind])} this</a>`); });
197
- return out.length ? `<div class="rel">${out.slice(0, 6).join(" · ")}${out.length > 6 ? ` · +${out.length - 6}` : ""}</div>` : "";
198
- }
199
- function short(n) { return n ? (n.label.length > 48 ? n.label.slice(0, 46) + "…" : n.label) : "?"; }
200
- function card(n, visible, s, depth) {
201
- const kidsShown = depth < 1 && n.children.length && (n.kind === "route" || n.kind === "rival" || n.kind === "grouping" || n.kind === "hazard" || n.kind === "laboratory" || n.kind === "target") ? n.children : [];
202
- const acts = [];
203
- if (n.kind === "rival") acts.push(`<button type="button" data-why="${esc(n.node_id)}">Why was it rejected?</button>`);
204
- if (n.kind === "route") acts.push(`<button type="button" data-cmp="${esc(n.node_id)}">${(s.cmp || []).includes(n.node_id) ? "Comparing ✓" : "Compare"}</button>`);
205
- if (n.children.length && !kidsShown.length) acts.push(`<button type="button" data-open="${esc(n.node_id)}">Show ${n.children.length} inside</button>`);
206
- acts.push(`<a href="#node=${encodeURIComponent(n.node_id)}">Details</a>`);
207
- return `<div class="tv-card" data-id="${esc(n.node_id)}"><span class="k">${esc(KIND_WORDS[n.kind] || n.kind)}</span>
208
- <button type="button" class="lbl" data-node="${esc(n.node_id)}">${esc(n.label)}</button><div class="chips">${chips(n)}</div>${relChips(n, visible)}
209
- <div class="acts">${acts.join("")}</div>${kidsShown.length ? `<div class="tv-kids">${kidsShown.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, visible, s, depth + 1)).join("")}</div>` : ""}</div>`;
210
- }
211
- function component(s) {
212
- const st = s.stage;
213
- const groups = groupsOf(st);
214
- const visible = new Set();
215
- groups.forEach(([, ns]) => ns.forEach((n) => { visible.add(n.node_id); n.children.forEach((c) => visible.add(c)); }));
216
- const stn = STAGE_NODE[st];
217
- const head = `<p class="tv-crumb"><a href="#">Overview</a> › ${esc(stn ? stn.label : st)} ${chip("execution", stn ? stn.execution : "not_run")}${stn && stn.detail.message ? `<br><small>${esc(stn.detail.message)}</small>` : ""}</p>`;
218
- if (st === "AUDIT") return head + auditView();
219
- if (!groups.length) return head + `<p class="tv-empty">Nothing was recorded for this stage${stn && stn.execution === "skipped" ? ": it was skipped" : ""}.</p>`;
220
- const body = groups.map(([g, ns]) => `<div class="tv-group">${g ? `<h3>${esc(g)}</h3>` : ""}<div class="tv-cards">${ns.map((n) => card(n, visible, s, 0)).join("")}</div></div>`).join("");
221
- return head + legend() + `<div class="tv-comp"><svg class="tv-edges" aria-hidden="true"></svg><div class="tv-groups">${body}</div></div>` + compare(s);
222
- }
223
- function legend() {
224
- return `<p class="tv-legend"><span><i></i> rests on / cites / computed from</span><span><i class="bad dash"></i> doubted by</span><span><i class="ok dot"></i> settled by</span>
225
- <span><i class="bad"></i> rejected because</span><span><i class="muted"></i> comes after</span><span><i class="muted dot"></i> done with</span><span><i class="bad dash"></i> needs equipment</span></p>`;
226
- }
227
- function auditView() {
228
- if (!AUDIT) return `<p class="tv-empty">The package does not carry an audit of itself. ${CFG.audit_url ? "The live audit is loading…" : "Run <code>mat2bot audit &lt;package&gt;</code> to re-derive every claim from the files alone."}</p>`;
229
- return `<p>${esc(AUDIT.when || "")}: <b>${esc(AUDIT.verdict)}</b>${CFG.links && CFG.links.audit ? ` · <a href="${esc(CFG.links.audit)}">the full audit page</a>` : ""}</p>
230
- <ul class="tv-audit">${AUDIT.checks.map((c) => `<li>${chip("science", c.verdict === "UNKNOWN" ? "UNKNOWN" : c.verdict)} ${esc(c.name)}${c.detail ? ` <small>— ${esc(c.detail)}</small>` : ""}</li>`).join("")}</ul>`;
231
  }
232
- function drawEdges() {
233
- const svg = app.querySelector("svg.tv-edges");
234
- if (!svg) return;
235
- const box = svg.parentElement.getBoundingClientRect();
236
- const at = (id) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(id)}"]`); if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.left - box.left + r.width / 2, y: r.top - box.top + r.height / 2 }; };
237
- const paths = [];
238
- T.edges.forEach((e) => {
239
- const a = at(e.source), b = at(e.target);
240
- if (!a || !b) return;
241
- const mx = (a.x + b.x) / 2;
242
- paths.push(`<path class="${e.kind}" data-s="${esc(e.source)}" data-t="${esc(e.target)}" d="M${a.x},${a.y} C${mx},${a.y} ${mx},${b.y} ${b.x},${b.y}"><title>${esc(EDGE_WORDS[e.kind])}${e.label ? ": " + esc(e.label) : ""}</title></path>`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  });
244
- svg.setAttribute("viewBox", `0 0 ${box.width} ${box.height}`);
245
- svg.innerHTML = paths.join("");
246
- }
247
- function highlight(id, on) {
248
- app.querySelectorAll("svg.tv-edges path").forEach((p) => { if (p.dataset.s === id || p.dataset.t === id) p.classList.toggle("hl", on); });
249
- }
250
- function why(id) {
251
- app.querySelectorAll(".tv-card.hl").forEach((c) => c.classList.remove("hl"));
252
- const targets = (OUT.get(id) || []).filter((e) => e.kind === "rejected_for").map((e) => e.target);
253
- let first = null;
254
- targets.forEach((t) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(t)}"]`); if (el) { el.classList.add("hl"); first = first || el; } });
255
- highlight(id, true);
256
- if (first) first.scrollIntoView({ block: "center", behavior: "smooth" });
257
- else if (targets.length) go({ node: targets[0] });
258
- }
259
- function compare(s) {
260
- const ids = (s.cmp || []).slice(0, 2).map((id) => NODES.get(id)).filter(Boolean);
261
- if (ids.length < 2) return ids.length === 1 ? `<p class="tv-sub">Pick a second route to compare with ${esc(short(ids[0]))}.</p>` : "";
262
- const row = (name, f) => `<tr><th>${name}</th>${ids.map((n) => `<td>${f(n)}</td>`).join("")}</tr>`;
263
- const doubts = (n) => T.nodes.filter((d) => d.kind === "doubt" && d.detail.route === n.detail.route && d.science === "open").map((d) => esc(d.label)).join("<br>") || "none open";
264
- const labs = (n) => T.nodes.filter((l) => l.kind === "laboratory" && l.detail.route === n.detail.route).map((l) => esc(l.label)).join("<br>") || "–";
265
- return `<div class="tv-compare"><h3>Side by side</h3><table><thead><tr><th></th>${ids.map((n) => `<th>${esc(short(n))}</th>`).join("")}</tr></thead><tbody>
266
- ${row("Support", (n) => chip("science", n.science) + ` <small>${esc(n.detail.row)}</small>`)}
267
- ${row("Precedent", (n) => esc(n.detail.precedent))}
268
- ${row("Reagents", (n) => (n.detail.precursors || []).map(esc).join("<br>"))}
269
- ${row("Conditions", (n) => Object.entries(n.detail.parameters || {}).map(([k, v]) => `${esc(k)} = ${esc(v)}`).join("<br>") || "none stated")}
270
- ${row("Equipment", (n) => (n.detail.equipment || []).map(esc).join("<br>"))}
271
- ${row("Open doubts", doubts)}${row("Laboratories", labs)}</tbody></table>
272
- <p><button type="button" data-cmp-clear="1">Clear</button></p></div>`;
273
- }
274
- // ---------------------------------------------------------------- provenance panel
275
- function link(url, text) { return url && /^https?:\/\//.test(url) ? `<a href="${esc(url)}" rel="noopener" target="_blank">${esc(text || url)}</a>` : esc(text || url || ""); }
276
- function value(d) {
277
- if (d.value == null && !("unit" in d)) return "";
278
- const u = d.uncertainty;
279
- return `<p class="num">${d.value == null ? "unresolved" : esc(Number(d.value).toPrecision(5).replace(/\.?0+$/, ""))} ${esc(d.unit || "")}${u ? ` ± ${esc(Number(u.expanded).toPrecision(2))} (k = ${esc(u.k)})` : ""}</p>
280
- <dl>${d.method ? `<dt>method</dt><dd><code>${esc(d.method)}</code></dd>` : ""}${d.basis ? `<dt>basis</dt><dd>${esc(d.basis)}</dd>` : ""}<dt>provenance</dt><dd>${esc(d.provenance)}</dd>
281
- ${u ? `<dt>uncertainty</dt><dd>u = ${esc(Number(u.u).toPrecision(3))}, type ${esc(u.type)}; ${esc(u.basis)}</dd>` : ""}${d.domain ? `<dt>valid for</dt><dd><code>${esc(JSON.stringify(d.domain))}</code></dd>` : ""}
282
- ${d.note ? `<dt>note</dt><dd>${esc(d.note)}</dd>` : ""}</dl>${(d.sources || []).length ? `<h3>Sources</h3><ul>${d.sources.map((s) => `<li>${esc(s.citation || s.id)}${s.id && s.kind === "doi" ? " · " + link("https://doi.org/" + s.id, "doi:" + s.id) : s.url ? " · " + link(s.url, "source") : ""}${s.quote ? `<blockquote>${esc(s.quote)}</blockquote>` : ""}</li>`).join("")}</ul>` : ""}`;
283
- }
284
- function generic(d, skip) {
285
- const rows = Object.entries(d).filter(([k, v]) => !skip.includes(k) && v != null && v !== "" && !(Array.isArray(v) && !v.length) && !(typeof v === "object" && !Array.isArray(v) && !Object.keys(v).length));
286
- if (!rows.length) return "";
287
- return `<dl>${rows.map(([k, v]) => `<dt>${esc(k.replace(/_/g, " "))}</dt><dd>${fmt(v)}</dd>`).join("")}</dl>`;
288
- }
289
- function fmt(v) {
290
- if (Array.isArray(v)) return `<ul>${v.map((x) => `<li>${typeof x === "object" ? fmt(x) : esc(x)}</li>`).join("")}</ul>`;
291
- if (typeof v === "object") return `<dl>${Object.entries(v).map(([k, x]) => `<dt>${esc(k)}</dt><dd>${fmt(x)}</dd>`).join("")}</dl>`;
292
- if (typeof v === "string" && /^https?:\/\//.test(v)) return link(v);
293
- if (typeof v === "string" && /^R-[A-Z0-9-]+-\d{3}$/.test(v)) return `<code>${esc(v)}</code>`;
294
- return esc(v);
295
- }
296
- function panel(id) {
297
- const n = NODES.get(id);
298
- if (!n) return `<aside class="tv-panel"><button type="button" class="close" data-close="1">Close</button><h2>No such record</h2><p>${esc(id)} is not in this trace.</p></aside>`;
299
- const d = n.detail || {};
300
- let body = "";
301
- if (n.kind === "calculation" && "value" in d) body = value(d);
302
- else if (n.kind === "evidence") body = `${d.claim ? `<p>${esc(d.claim)}</p>` : ""}<dl>${d.citation ? `<dt>citation</dt><dd>${esc(d.citation)}</dd>` : ""}${d.doi ? `<dt>doi</dt><dd>${link("https://doi.org/" + d.doi, d.doi)}</dd>` : d.url ? `<dt>source</dt><dd>${link(d.url)}</dd>` : ""}${d.licence ? `<dt>licence</dt><dd>${esc(d.licence)}</dd>` : ""}${d.locator ? `<dt>where</dt><dd>${esc(d.locator)}</dd>` : ""}</dl>${d.quote ? `<h3>Quoted</h3><blockquote>${esc(d.quote)}</blockquote>` : ""}${generic(d, ["claim", "citation", "doi", "url", "licence", "locator", "quote", "kind", "evidence_id"])}`;
303
- else if (n.kind === "doubt") body = `<p>${esc(d.statement)}</p><dl><dt>kind</dt><dd>${esc(d.kind)} doubt</dd><dt>status</dt><dd>${chip("science", d.status)}</dd><dt>rule</dt><dd><code>${esc(d.rule)}</code></dd>${d.closable_by ? `<dt>closed only by</dt><dd>${esc(d.closable_by)}</dd>` : ""}<dt>critical</dt><dd>${d.critical ? "yes" : "no"}</dd></dl>`;
304
- else body = generic(d, ["route"]);
305
- const rel = (edges, dir) => edges.map((e) => { const o = NODES.get(dir === "out" ? e.target : e.source); return o ? `<li><a href="#node=${encodeURIComponent(o.node_id)}">${esc(short(o))}</a> <small>(${esc(EDGE_WORDS[e.kind])}${e.label ? ", " + esc(e.label) : ""})</small></li>` : ""; }).join("");
306
- const outs = OUT.get(id) || [], ins = IN.get(id) || [];
307
- const q = [["What it rests on", outs.filter((e) => ["supported_by", "computed_from", "cites", "resolved_by", "depends_on", "mapped_to", "requires_equipment", "rejected_for"].includes(e.kind)), "out"],
308
- ["What rests on it, or questions it", ins, "in"]];
309
- return `<aside class="tv-panel" role="dialog" aria-label="record"><button type="button" class="close" data-close="1">Close</button>
310
- <span class="k">${esc(KIND_WORDS[n.kind] || n.kind)} · stage ${esc(n.stage)}${d.route ? ` · route ${esc(d.route)}` : ""}</span><h2>${esc(n.label)}</h2><div class="chips">${chips(n)}</div>
311
- ${body}${q.map(([t, es, dir]) => es.length ? `<h3>${t}</h3><ul>${rel(es, dir)}</ul>` : "").join("")}
312
- ${n.children.length ? `<h3>Inside</h3><ul>${n.children.map((c) => NODES.get(c)).filter(Boolean).map((c) => `<li><a href="#node=${encodeURIComponent(c.node_id)}">${esc(short(c))}</a> ${chips(c)}</li>`).join("")}</ul>` : ""}
313
- <h3>Where it is recorded</h3><p><code>${esc(n.ref || "a presentation-only group")}</code>${n.presentation_only ? " (a grouping, not a record)" : ""}</p></aside>`;
314
- }
315
- // ---------------------------------------------------------------- render
316
- function render() {
317
- const s = state();
318
- const node = s.node ? NODES.get(s.node) : null;
319
- if (node && !s.stage) s.stage = node.stage;
320
- app.innerHTML = frame(s) + (s.stage ? component(s) : overview(s)) + (s.node ? panel(s.node) : "");
321
- if (s.stage) requestAnimationFrame(drawEdges);
322
- if (s.node) { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(s.node)}"]`); if (el) { el.classList.add("sel"); highlight(s.node, true); } }
323
  }
324
- app.addEventListener("click", (ev) => {
325
- const b = ev.target.closest("button, a");
326
- if (!b || !app.contains(b)) return;
327
- const s = state();
328
- if (b.dataset.tab != null) { ev.preventDefault(); if (b.dataset.tab === "") go({}); else if (b.dataset.tab === "__comp") go({ stage: s.stage || STAGES[0], cmp: s.cmp }); else go({ stage: s.stage || (s.node ? NODES.get(s.node).stage : STAGES[0]), node: s.node || ((STAGE_NODE[s.stage || STAGES[0]] || { children: [] }).children[0] || "target"), cmp: s.cmp }); return; }
329
- if (b.dataset.stage) { go({ stage: b.dataset.stage }); return; }
330
- if (b.dataset.node) { go({ stage: s.stage, node: b.dataset.node, cmp: s.cmp }); return; }
331
- if (b.dataset.why) { why(b.dataset.why); return; }
332
- if (b.dataset.open) { b.outerHTML = `<div class="tv-kids">${NODES.get(b.dataset.open).children.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, new Set(T.nodes.map((n) => n.node_id)), s, 1)).join("")}</div>`; requestAnimationFrame(drawEdges); return; }
333
- if (b.dataset.cmp) { const c = s.cmp.includes(b.dataset.cmp) ? s.cmp.filter((x) => x !== b.dataset.cmp) : [...s.cmp, b.dataset.cmp].slice(-2); go({ stage: s.stage, node: s.node, cmp: c }); return; }
334
- if (b.dataset.cmpClear) { go({ stage: s.stage, node: s.node, cmp: [] }); return; }
335
- if (b.dataset.close) { go({ stage: s.stage, cmp: s.cmp }); }
336
- });
337
- app.addEventListener("mouseover", (ev) => { const c = ev.target.closest(".tv-card"); if (c) highlight(c.dataset.id, true); });
338
- app.addEventListener("mouseout", (ev) => { const c = ev.target.closest(".tv-card"); if (c && c.dataset.id !== state().node) highlight(c.dataset.id, false); });
339
- window.addEventListener("hashchange", render);
340
- window.addEventListener("resize", () => requestAnimationFrame(drawEdges));
341
- document.addEventListener("keydown", (ev) => { if (ev.key === "Escape" && state().node) { const s = state(); go({ stage: s.stage, cmp: s.cmp }); } });
342
- render();
343
- if (CFG.audit_url) {
344
- fetch(CFG.audit_url, { cache: "no-store" }).then((r) => (r.ok ? r.json() : null)).then((a) => {
345
- if (a && a.verdict && Array.isArray(a.checks)) { AUDIT = a; render(); }
346
- }).catch(() => {});
347
  }
348
  })();
349
  </script></body></html>
 
86
  .tv-events li{grid-template-columns:2em 1fr;grid-auto-rows:auto}.tv-events li .msg{grid-column:1/-1}}
87
  @media (prefers-reduced-motion:no-preference){.tv-card,.tv-stage{transition:background .15s,outline-color .15s}}
88
  .tv-audit li{list-style:none;font-size:.84rem}
89
+ /* the map: a spine of stages with their branches (SVG) */
90
+ .tv-map{overflow-x:auto;margin:.2em 0 .4em;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);padding:10px}
91
+ .tv-map svg{display:block;max-width:none;font:13px/1.2 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
92
+ .tv-map .mnode{cursor:pointer}.tv-map .mnode:focus{outline:none}
93
+ .tv-map .mnode rect{fill:var(--bg);stroke:var(--line);stroke-width:1.4}
94
+ .tv-map .mnode.stage rect{fill:var(--head);stroke-width:2}
95
+ .tv-map .mnode:hover rect,.tv-map .mnode:focus rect{stroke:var(--accent);stroke-width:2.4}
96
+ .tv-map .mnode text{fill:var(--fg);font-weight:600;pointer-events:none}
97
+ .tv-map .mnode text.sub{font-size:11.5px;font-weight:400;fill:var(--muted)}
98
+ .tv-map .mnode text.sub2{font-size:11px;font-weight:400;fill:var(--muted)}
99
+ .tv-map .mnode.kid text{font-weight:500;font-size:12.5px}
100
+ .tv-map .mnode.more rect{stroke-dasharray:4 3}.tv-map .mnode.more text{fill:var(--accent)}
101
+ .tv-map .tone-ok rect{stroke:var(--ok)}.tv-map .tone-warn rect{stroke:var(--warn)}.tv-map .tone-bad rect{stroke:var(--bad)}.tv-map .tone-off rect{stroke:var(--off);stroke-dasharray:4 3}
102
+ .tv-map .tone-off text{fill:var(--muted)}
103
+ .tv-map path.spine{fill:none;stroke:var(--accent);stroke-width:2}.tv-map marker path{fill:var(--accent)}
104
+ .tv-map path.branch{fill:none;stroke:var(--line);stroke-width:1.5}
105
+ .tv-legend i.box{width:14px;height:14px;border:2px solid var(--accent);border-radius:4px;border-top-width:2px}
106
+ .tv-legend i.box.ok{border-color:var(--ok)}.tv-legend i.box.warn{border-color:var(--warn)}.tv-legend i.box.bad{border-color:var(--bad)}.tv-legend i.box.off{border-color:var(--off);border-style:dashed}
107
+ details.tv-timeline summary{cursor:pointer;color:var(--accent);font-size:.95rem;margin:.6em 0 .3em}
108
+ .tv-map .mnode.sel rect{stroke:var(--accent);stroke-width:3}
109
+ </style></head><body><script id="trace" type="application/json">{"edges":[],"events":[{"ended":"2026-10-26T00:00:00.000+00:00","message":"BaTiO3: identity known phase, phase cubic BaTiO3; gates G1 PASS, G2 PASS","name":"target intake","seq":1,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"m1"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no synthesis precedent of this composition in the evidence","name":"families and precedents","seq":2,"stage":"M02","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","name":"route candidates","seq":3,"stage":"M04","started":"2026-10-26T00:00:00.000+00:00","status":"refused","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"gate S on the product alone: UNKNOWN; BaTiO3 no classification found","name":"the product's own hazards (handling only)","seq":4,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"feasibility","seq":5,"stage":"M05","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"route cases and ranking","seq":6,"stage":"M07","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"procedure","seq":7,"stage":"M08","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"laboratories","seq":8,"stage":"LAB","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"BaTiO3"}],"layout":{"columns":["M01","M02","M04","M05","M07","M08","LAB","AUDIT"],"rows":{"finding:0":0,"gate:G1":1,"gate:G2":2,"gateS:target":3,"hazard:target:BaTiO3":4,"target":0}},"nodes":[{"children":["gate:G1","gate:G2","gateS:target"],"detail":{"checked_against":["the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields)"],"form":"","formula":"BaTiO3","identity":"known_phase","known_phases":[{"ids":["cod:4124842"],"name":"cubic BaTiO3"},{"ids":["cod:2009488"],"name":"hexagonal BaTiO3"},{"ids":["cod:9014492"],"name":"orthorhombic BaTiO3"},{"ids":["cod:9014074"],"name":"rhombohedral BaTiO3"},{"ids":["cod:1513252"],"name":"tetragonal BaTiO3"}],"missing":["Materials Project energies (no key; never decisive for polymorphs)"],"novelty":"found in Perov-5 dataset (18,928 materials) by Matter's check (reduced formula and A|B|X site assignment): material 14809, in the training split","phase":"cubic BaTiO3"},"evidence":"n/a","execution":"completed","kind":"target","lab":null,"label":"BaTiO3, cubic BaTiO3","node_id":"target","presentation_only":false,"ref":"target.json#target","science":"known phase","stage":"M01"},{"children":[],"detail":{"findings":[],"rules":["R-G1-INPUT-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G1: PASS","node_id":"gate:G1","presentation_only":false,"ref":"target.json#gates/G1","science":"PASS","stage":"M01"},{"children":[],"detail":{"findings":[{"code":"POLYMORPH_MISMATCH","message":"cubic BaTiO3 is stable only above about 130 °C (cited); at room temperature the measured structure is tetragonal BaTiO3 (P4mm, cod:1513252)","rule":"R-M01-PHASE-001"},{"code":"STABILITY_UNKNOWN","message":"Matter's ladder stage 1 (Stage 1 · Chemistry checked): the candidate structure is prototype placement, its stability is not assessed","rule":"R-M01-ID-002"},{"code":"KNOWN_COMPOUND","message":"BaTiO3 is a known compound: cubic BaTiO3 is a measured structure (cod:4124842)","rule":"R-M01-ID-002"}],"rules":["R-G2-ID-001","R-M01-ID-001","R-M01-PHASE-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G2: PASS","node_id":"gate:G2","presentation_only":false,"ref":"target.json#gates/G2","science":"PASS","stage":"M01"},{"children":["hazard:target:BaTiO3"],"detail":{"findings":[{"code":"HAZARD_UNKNOWN","message":"BaTiO3 (BaTiO3, product): no classification found; a person decides at G7"},{"code":"HAZARD_UNKNOWN","message":"no reagent of this route is known, so their hazards are unknown; a person decides at G7"}],"what":"what handling the material demands; not a route verdict"},"evidence":"n/a","execution":"completed","kind":"hazard","lab":null,"label":"Handling the product (gate S on it alone): UNKNOWN","node_id":"gateS:target","presentation_only":false,"ref":"safety/target.json#gate","science":"UNKNOWN","stage":"M01"},{"children":[],"detail":{"codes":[],"demands":[],"harmonised":false,"pubchem_cid":null,"url":null},"evidence":"missing","execution":"completed","kind":"hazard","lab":null,"label":"BaTiO3 (BaTiO3): no classification found","node_id":"hazard:target:BaTiO3","presentation_only":false,"ref":"safety/target.json#substances/BaTiO3","science":null,"stage":"M01"},{"children":[],"detail":{"code":"NO_SUPPORTED_FAMILY","message":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","rule":"R-M03-SCOPE-001","severity":"warning","subject":"BaTiO3"},"evidence":"n/a","execution":"refused","kind":"finding","lab":null,"label":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","node_id":"finding:0","presentation_only":false,"ref":"plan.json#findings/0","science":null,"stage":"M04"},{"children":["target","gate:G1","gate:G2","gateS:target","hazard:target:BaTiO3"],"detail":{"events":[1,4],"how":"","message":"BaTiO3: identity known phase, phase cubic BaTiO3; gates G1 PASS, G2 PASS; gate S on the product alone: UNKNOWN; BaTiO3 no classification found"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Target","node_id":"stage:M01","presentation_only":false,"ref":"trace.json#events/M01","science":null,"stage":"M01"},{"children":[],"detail":{"events":[2],"how":"","message":"no synthesis precedent of this composition in the evidence"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Evidence","node_id":"stage:M02","presentation_only":false,"ref":"trace.json#events/M02","science":null,"stage":"M02"},{"children":["finding:0"],"detail":{"events":[3],"how":"","message":"no route for BaTiO3 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly"},"evidence":"n/a","execution":"refused","kind":"stage","lab":null,"label":"Routes","node_id":"stage:M04","presentation_only":false,"ref":"trace.json#events/M04","science":null,"stage":"M04"},{"children":[],"detail":{"events":[5],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Science","node_id":"stage:M05","presentation_only":false,"ref":"trace.json#events/M05","science":null,"stage":"M05"},{"children":[],"detail":{"events":[6],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"The case","node_id":"stage:M07","presentation_only":false,"ref":"trace.json#events/M07","science":null,"stage":"M07"},{"children":[],"detail":{"events":[7],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Procedure","node_id":"stage:M08","presentation_only":false,"ref":"trace.json#events/M08","science":null,"stage":"M08"},{"children":[],"detail":{"events":[8],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Laboratories","node_id":"stage:LAB","presentation_only":false,"ref":"trace.json#events/LAB","science":null,"stage":"LAB"},{"children":[],"detail":{"events":[],"how":"run `mat2bot audit <package>`; the result never comes from the package itself","message":"the package is audited after it is written: run the auditor, or a live audit fills this column"},"evidence":"n/a","execution":"not_run","kind":"stage","lab":null,"label":"Audit","node_id":"stage:AUDIT","presentation_only":false,"ref":"trace.json#nodes/stage:AUDIT","science":null,"stage":"AUDIT"}],"note":"A projection of the plan's records: every node names the record it shows and every edge a relationship that record holds; nothing here is computed anew. The audit stage is filled only by a live audit.","request_id":"m1","schema":"mat2bot/trace/1","title":"A MEIDNet-Matter candidate (Perov-5 search, run-LtMoP7Wma4gU-002, BaTiO3)"}</script><script id="trace-config" type="application/json">{"audit_url": "audit.json", "links": {"home": "../../index.html", "report": "report.html", "package": "package.zip"}, "mat2bot": "0.1.0"}</script><div id="trace-app" data-title="A MEIDNet-Matter candidate (Perov-5 search, run-LtMoP7Wma4gU-002, BaTiO3)"></div><script>/* Mat2Bot Trace viewer: a connected map of the plan's records (the stages with arrows, each stage's branches under
110
+ it), a components view (a stage's records as cards with their typed edges) and a provenance panel (one record),
111
+ over trace.json and nothing else. Every drawn node is a node of the trace and every drawn line an edge of it; the
112
+ audit column is filled only from a live audit the host gives (config.audit_url or config.audit). Plain JS, no library.
113
+ Standalone (trace.html) it keeps its place in the address bar; embedded (the one-box page) it keeps it in memory. */
114
  (function () {
115
  "use strict";
 
 
 
 
 
 
 
 
 
116
  const esc = (s) => String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
117
  const WORDS = {
118
  execution: { completed: ["ran", "ok"], skipped: ["skipped", "off"], refused: ["stopped: refused", "warn"], failed: ["failed", "bad"], not_run: ["not run", "off"] },
 
130
  const KIND_WORDS = { stage: "stage", target: "the target", finding: "finding", route: "route", rival: "rejected route", claim: "claim", inference: "inference",
131
  evidence: "evidence", calculation: "calculation", model_output: "model", assumption: "assumption", doubt: "doubt", step: "step", hazard: "hazard",
132
  laboratory: "laboratory", capability: "equipment", grouping: "group" };
133
+ const STAGE_WORDS = { M01: "Target", M02: "Evidence", M04: "Routes", M05: "Science", M07: "The case", M08: "Procedure", LAB: "Laboratories", AUDIT: "Audit" };
134
  function chip(attr, value) {
135
  if (value == null || value === "n/a" || value === "") return "";
136
  const w = (WORDS[attr] || {})[value] || [String(value).replace(/_/g, " "), "acc"];
137
  return `<span class="chip ${w[1]}" title="${esc(attr)}: ${esc(value)}">${esc(w[0])}</span>`;
138
  }
139
+ function tone(n) {
140
+ if (n.execution === "refused" || n.execution === "failed") return "bad";
141
+ if (n.execution === "skipped" || n.execution === "not_run") return "off";
142
+ const s = n.science;
143
+ if (s) {
144
+ if (["FAIL", "BLOCKED", "sustained"].includes(s)) return "bad";
145
+ if (["UNKNOWN", "PARTIALLY_SUPPORTED", "HYPOTHETICAL", "open", "refused", "unresolved values"].includes(s)) return "warn";
146
+ if (["PASS", "STRONGLY_SUPPORTED", "eliminated"].includes(s)) return "ok";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
+ if (n.lab) { if (n.lab === "BLOCKED" || n.lab === "missing") return "bad"; if (n.lab === "INCOMPLETE") return "warn"; if (["FULLY_SUPPORTED", "HYBRID"].includes(n.lab)) return "ok"; }
149
+ if (n.evidence === "missing") return "bad";
150
+ if (n.evidence === "unverified") return "warn";
151
+ if (n.evidence === "verified") return "ok";
152
+ return "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
154
+
155
+ function mount(app, T, CFG) {
156
+ CFG = CFG || {};
157
+ const EMBEDDED = !!CFG.embedded;
158
+ const NODES = new Map(T.nodes.map((n) => [n.node_id, n]));
159
+ const STAGES = (T.layout && T.layout.columns) || ["M01", "M02", "M04", "M05", "M07", "M08", "LAB", "AUDIT"];
160
+ const STAGE_NODE = {};
161
+ T.nodes.forEach((n) => { if (n.kind === "stage") STAGE_NODE[n.stage] = n; });
162
+ const OUT = new Map(), IN = new Map();
163
+ T.edges.forEach((e) => { (OUT.get(e.source) || OUT.set(e.source, []).get(e.source)).push(e); (IN.get(e.target) || IN.set(e.target, []).get(e.target)).push(e); });
164
+ const chips = (n) => [chip("execution", n.kind === "stage" || n.execution !== "completed" ? n.execution : null), chip("science", n.science), chip("evidence", n.evidence), chip("lab", n.lab)].join("");
165
+ let AUDIT = CFG.audit && CFG.audit.verdict ? CFG.audit : null;
166
+ // ---------------------------------------------------------------- state: the address bar (standalone) or memory (embedded)
167
+ let S = { stage: "", node: "", cmp: [] };
168
+ function parse(h) {
169
+ const o = Object.fromEntries(h.replace(/^#/, "").split("&").filter(Boolean).map((kv) => kv.split("=").map(decodeURIComponent)));
170
+ return { stage: o.stage || "", node: o.node || "", cmp: (o.cmp || "").split(",").filter(Boolean) };
171
+ }
172
+ function state() { return EMBEDDED ? { ...S, cmp: [...S.cmp] } : parse(location.hash); }
173
+ function go(s) {
174
+ s = { stage: s.stage || "", node: s.node || "", cmp: s.cmp || [] };
175
+ if (EMBEDDED) { S = s; render(); return; }
176
+ const parts = [];
177
+ if (s.stage) parts.push("stage=" + encodeURIComponent(s.stage));
178
+ if (s.node) parts.push("node=" + encodeURIComponent(s.node));
179
+ if (s.cmp.length) parts.push("cmp=" + encodeURIComponent(s.cmp.join(",")));
180
+ const next = "#" + parts.join("&");
181
+ if (location.hash !== next) location.hash = next; else render();
182
+ }
183
+ // ---------------------------------------------------------------- the frame
184
+ function frame(s) {
185
+ const links = CFG.links || {};
186
+ const nav = Object.entries(links).map(([k, v]) => `<a href="${esc(v)}">${esc({ report: "Technical report", package: "Download the package", audit: "Audit it now", home: "Mat2Bot" }[k] || k)}</a>`).join("");
187
+ const tabs = [["", "Map"], ["__comp", "Components"], ["__prov", "Provenance"]];
188
+ const cur = s.node ? "__prov" : s.stage ? "__comp" : "";
189
+ const head = EMBEDDED ? "" : `<header class="tv-top"><h1>${esc(app.dataset.title || T.title || T.request_id)}: how Mat2Bot got there</h1><nav>${nav}</nav></header>
190
+ <p class="tv-sub">${esc(T.note)} Request <code>${esc(T.request_id)}</code>; ${T.nodes.length} records shown, ${T.edges.length} relationships, ${T.events.length} events.</p>`;
191
+ return head + `<div class="tv-tabs">${tabs.map(([k, l]) => `<button type="button" data-tab="${k}" ${cur === k ? 'aria-current="page"' : ""}>${l}</button>`).join("")}</div>`;
192
+ }
193
+ // ---------------------------------------------------------------- the map: a spine of stages with their branches
194
+ const NESTING = ["target", "route", "rival", "grouping", "hazard", "laboratory"];
195
+ function topLevel(stage) {
196
+ const all = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
197
+ const nested = new Set();
198
+ all.forEach((n) => { if (NESTING.includes(n.kind)) n.children.forEach((c) => nested.add(c)); });
199
+ return all.filter((n) => !nested.has(n.node_id));
200
+ }
201
+ const ORDER = { route: 0, rival: 1, target: 0, finding: 1, claim: 0, doubt: 1, assumption: 2, laboratory: 0, capability: 1, hazard: 2, calculation: 0, model_output: 1, grouping: 0, evidence: 0, step: 1 };
202
+ const DOUBT_ORDER = { sustained: 0, open: 1, eliminated: 2 };
203
+ function branches(stage) {
204
+ let ns = topLevel(stage);
205
+ if (stage === "M01") ns = [NODES.get("target"), ...(NODES.get("target") || { children: [] }).children.map((id) => NODES.get(id))].filter(Boolean);
206
+ if (stage === "M07") ns = ns.filter((n) => n.kind !== "claim" || !(n.detail && n.detail.template === "conditions-supported"));
207
+ return ns.slice().sort((a, b) => (ORDER[a.kind] ?? 5) - (ORDER[b.kind] ?? 5) || ((DOUBT_ORDER[a.science] ?? 3) - (DOUBT_ORDER[b.science] ?? 3)));
208
+ }
209
+ function shortLabel(n, max) {
210
+ let t = n.label;
211
+ if (n.kind === "route" || n.kind === "rival") t = ((n.detail && n.detail.precursors) || []).map((p) => p.split(" (")[0]).join(" + ") || t.replace(/^(Route \d+|Rejected): /, "");
212
+ if (n.kind === "laboratory") t = n.label;
213
+ if (n.kind === "doubt") t = t.replace(/ \(here:.*$/, "");
214
+ if (n.kind === "grouping") t = t.replace(/^Procedure of [^:]+: /, "Recipe: ");
215
+ t = t.replace(/^(Route \d+|Rejected): /, "");
216
+ return t.length > max ? t.slice(0, max - 1) + "…" : t;
217
+ }
218
+ function stageSummary(stage) {
219
+ const kids = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
220
+ const count = (f) => kids.filter(f).length;
221
+ if (stage === "M01") { const t = NODES.get("target"); return t ? shortLabel(t, 24) : ""; }
222
+ if (stage === "M02") return `${count((n) => n.kind === "evidence")} records`;
223
+ if (stage === "M04") return `${count((n) => n.kind === "route")} proposed, ${count((n) => n.kind === "rival")} set aside`;
224
+ if (stage === "M05") return `${count((n) => n.kind === "calculation")} numbers, ${count((n) => n.kind === "model_output" && n.execution === "refused")} refusals`;
225
+ if (stage === "M07") return `doubts: ${count((n) => n.science === "open")} open, ${count((n) => n.science === "eliminated")} ruled out`;
226
+ if (stage === "M08") return `${count((n) => n.kind === "step")} steps`;
227
+ if (stage === "LAB") return kids.filter((n) => n.kind === "laboratory").map((l) => l.label.split(":")[0]).join(", ") || "none asked";
228
+ if (stage === "AUDIT") return AUDIT ? `${AUDIT.verdict}: ${AUDIT.checks.filter((c) => c.verdict === "PASS").length} checks passed` : "not run";
229
+ return "";
230
+ }
231
+ function mapView() {
232
+ const narrow = app.clientWidth < 720;
233
+ const maxKids = narrow ? 4 : 6;
234
+ const colW = 156, boxH = 60, kidH = 34, gapY = 12, gapX = 18, top = 8;
235
+ const cols = STAGES.map((st) => {
236
+ const n = STAGE_NODE[st] || { label: STAGE_WORDS[st] || st, execution: "not_run", children: [] };
237
+ const kids = st === "AUDIT" ? [] : branches(st);
238
+ return { st, n, kids: kids.slice(0, maxKids), more: Math.max(0, kids.length - maxKids), total: kids.length };
239
+ });
240
+ const parts = [];
241
+ const node = (x, y, w, h, cls, attrs, title, lines, sub) => `<g class="mnode ${cls}" ${attrs} tabindex="0" role="button"><title>${esc(title)}</title>
242
+ <rect x="${x}" y="${y}" width="${w}" height="${h}" rx="9"></rect>
243
+ <text x="${x + 9}" y="${y + 20}">${esc(lines[0])}</text>${lines[1] ? `<text class="sub" x="${x + 9}" y="${y + 38}">${esc(lines[1])}</text>` : ""}${sub ? `<text class="sub2" x="${x + 9}" y="${y + h - 8}">${esc(sub)}</text>` : ""}</g>`;
244
+ let W, H;
245
+ if (!narrow) {
246
+ W = STAGES.length * colW + (STAGES.length - 1) * gapX;
247
+ const rows = Math.max(...cols.map((c) => c.kids.length + (c.more ? 1 : 0)), 1);
248
+ H = top + boxH + 26 + rows * (kidH + gapY) + 8;
249
+ cols.forEach((c, i) => {
250
+ const x = i * (colW + gapX);
251
+ const ex = c.st === "AUDIT" && AUDIT ? (AUDIT.verdict === "PASS" ? "completed" : "failed") : c.n.execution;
252
+ const w = (WORDS.execution[ex] || [ex, "off"]);
253
+ parts.push(node(x, top, colW, boxH, `stage tone-${w[1]}`, `data-stage="${esc(c.st)}"`, `${c.n.label}: ${c.n.detail && c.n.detail.message || ""}`, [STAGE_WORDS[c.st] || c.st, w[0]], stageSummary(c.st)));
254
+ if (i < cols.length - 1) parts.push(`<path class="spine" d="M${x + colW},${top + boxH / 2} L${x + colW + gapX - 4},${top + boxH / 2}" marker-end="url(#arrow)"></path>`);
255
+ let y = top + boxH + 26;
256
+ c.kids.forEach((k) => {
257
+ parts.push(`<path class="branch" d="M${x + 18},${top + boxH} L${x + 18},${y + kidH / 2} L${x + 30},${y + kidH / 2}"></path>`);
258
+ parts.push(node(x + 30, y, colW - 30, kidH, `kid tone-${tone(k)}`, `data-node="${esc(k.node_id)}"`, k.label, [shortLabel(k, 17)], ""));
259
+ y += kidH + gapY;
260
+ });
261
+ if (c.more) {
262
+ parts.push(`<path class="branch" d="M${x + 18},${top + boxH} L${x + 18},${y + kidH / 2} L${x + 30},${y + kidH / 2}"></path>`);
263
+ parts.push(node(x + 30, y, colW - 30, kidH, "kid more", `data-stage="${esc(c.st)}"`, `${c.total} in this stage`, [`+${c.more} more…`], ""));
264
+ }
265
+ });
266
+ } else {
267
+ W = Math.max(app.clientWidth - 24, 300); // inside the box's padding
268
+ const sx = 12, bx = 34, kx = 56; // the spine at the left edge, the branches beside it, the boxes after
269
+ const kidW = W - kx;
270
+ let y = top;
271
+ cols.forEach((c, i) => {
272
+ const ex = c.st === "AUDIT" && AUDIT ? (AUDIT.verdict === "PASS" ? "completed" : "failed") : c.n.execution;
273
+ const w = (WORDS.execution[ex] || [ex, "off"]);
274
+ parts.push(node(bx - 10, y, W - (bx - 10), boxH, `stage tone-${w[1]}`, `data-stage="${esc(c.st)}"`, `${c.n.label}: ${c.n.detail && c.n.detail.message || ""}`, [`${STAGE_WORDS[c.st] || c.st}: ${w[0]}`], stageSummary(c.st)));
275
+ let ky = y + boxH + gapY;
276
+ c.kids.forEach((k) => {
277
+ parts.push(`<path class="branch" d="M${bx},${y + boxH} L${bx},${ky + kidH / 2} L${kx},${ky + kidH / 2}"></path>`);
278
+ parts.push(node(kx, ky, kidW, kidH, `kid tone-${tone(k)}`, `data-node="${esc(k.node_id)}"`, k.label, [shortLabel(k, 40)], ""));
279
+ ky += kidH + gapY;
280
+ });
281
+ if (c.more) {
282
+ parts.push(`<path class="branch" d="M${bx},${y + boxH} L${bx},${ky + kidH / 2} L${kx},${ky + kidH / 2}"></path>`);
283
+ parts.push(node(kx, ky, kidW, kidH, "kid more", `data-stage="${esc(c.st)}"`, `${c.total} in this stage`, [`+${c.more} more…`], ""));
284
+ ky += kidH + gapY;
285
+ }
286
+ if (i < cols.length - 1) parts.push(`<path class="spine" d="M${sx},${y + boxH / 2} L${sx},${ky + 8}" marker-end="url(#arrow)"></path>`);
287
+ y = ky + 18;
288
+ });
289
+ H = y;
290
+ }
291
+ const legend = `<p class="tv-legend"><span><i class="box ok"></i> holds / verified / can run</span><span><i class="box warn"></i> open, caveat, not ready</span><span><i class="box bad"></i> fails, rejected, confirmed doubt, missing</span><span><i class="box off"></i> skipped or not run</span><span>Click a box to open it.</span></p>`;
292
+ return `<div class="tv-map"><svg viewBox="0 0 ${W} ${H}" width="${W}" height="${H}" role="img" aria-label="the stages Mat2Bot ran, with each stage's records"><defs><marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z"></path></marker></defs>${parts.join("")}</svg></div>` + legend;
293
+ }
294
+ function overview() {
295
+ const ev = T.events.map((e) => `<li class="${e.status}"><span class="seq">${e.seq}</span><span>${esc(e.stage)}</span><span>${esc(e.name)}${e.subject ? ` <small>(${esc(e.subject)})</small>` : ""}<span class="msg">${esc(e.message)}</span></span>${chip("execution", e.status)}</li>`).join("");
296
+ return mapView() + `<details class="tv-timeline"><summary>What ran, in order (${T.events.length} events)</summary><ol class="tv-events">${ev || '<li><span class="tv-empty">no events recorded</span></li>'}</ol>
297
+ <p class="tv-sub">Times are the run's own clock (a fixed clock in a reproducible package). A skipped stage was not reached; a refused one stopped on purpose.</p></details>`;
298
+ }
299
+ // ---------------------------------------------------------------- component view
300
+ function groupsOf(stage) {
301
+ const kids = topLevel(stage);
302
+ const byRoute = new Map();
303
+ kids.forEach((n) => { const r = n.detail && n.detail.route; const key = r ? "route " + r : ""; (byRoute.get(key) || byRoute.set(key, []).get(key)).push(n); });
304
+ return [...byRoute.entries()];
305
+ }
306
+ function short(n) { return n ? (n.label.length > 48 ? n.label.slice(0, 46) + "…" : n.label) : "?"; }
307
+ function relChips(n, visible) {
308
+ const out = [];
309
+ (OUT.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.target)) out.push(`<a href="#node=${encodeURIComponent(e.target)}">${esc(EDGE_WORDS[e.kind])}: ${esc(short(NODES.get(e.target)))}</a>`); });
310
+ (IN.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.source) && e.kind !== "cites") out.push(`<a href="#node=${encodeURIComponent(e.source)}">${esc(short(NODES.get(e.source)))} ${esc(EDGE_WORDS[e.kind])} this</a>`); });
311
+ return out.length ? `<div class="rel">${out.slice(0, 6).join(" · ")}${out.length > 6 ? ` · +${out.length - 6}` : ""}</div>` : "";
312
+ }
313
+ function card(n, visible, s, depth) {
314
+ const kidsShown = depth < 1 && n.children.length && NESTING.includes(n.kind) ? n.children : [];
315
+ const acts = [];
316
+ if (n.kind === "rival") acts.push(`<button type="button" data-why="${esc(n.node_id)}">Why was it rejected?</button>`);
317
+ if (n.kind === "route") acts.push(`<button type="button" data-cmp="${esc(n.node_id)}">${(s.cmp || []).includes(n.node_id) ? "Comparing ✓" : "Compare"}</button>`);
318
+ if (n.children.length && !kidsShown.length) acts.push(`<button type="button" data-open="${esc(n.node_id)}">Show ${n.children.length} inside</button>`);
319
+ acts.push(`<a href="#node=${encodeURIComponent(n.node_id)}">Details</a>`);
320
+ return `<div class="tv-card" data-id="${esc(n.node_id)}"><span class="k">${esc(KIND_WORDS[n.kind] || n.kind)}</span>
321
+ <button type="button" class="lbl" data-node="${esc(n.node_id)}">${esc(n.label)}</button><div class="chips">${chips(n)}</div>${relChips(n, visible)}
322
+ <div class="acts">${acts.join("")}</div>${kidsShown.length ? `<div class="tv-kids">${kidsShown.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, visible, s, depth + 1)).join("")}</div>` : ""}</div>`;
323
+ }
324
+ function component(s) {
325
+ const st = s.stage;
326
+ const groups = groupsOf(st);
327
+ const visible = new Set();
328
+ groups.forEach(([, ns]) => ns.forEach((n) => { visible.add(n.node_id); n.children.forEach((c) => visible.add(c)); }));
329
+ const stn = STAGE_NODE[st];
330
+ const head = `<p class="tv-crumb"><a href="#">Map</a> › ${esc(stn ? stn.label : st)} ${chip("execution", stn ? stn.execution : "not_run")}${stn && stn.detail.message ? `<br><small>${esc(stn.detail.message)}</small>` : ""}</p>`;
331
+ if (st === "AUDIT") return head + auditView();
332
+ if (!groups.length) return head + `<p class="tv-empty">Nothing was recorded for this stage${stn && stn.execution === "skipped" ? ": it was skipped" : ""}.</p>`;
333
+ const body = groups.map(([g, ns]) => `<div class="tv-group">${g ? `<h3>${esc(g)}</h3>` : ""}<div class="tv-cards">${ns.map((n) => card(n, visible, s, 0)).join("")}</div></div>`).join("");
334
+ return head + legend() + `<div class="tv-comp"><svg class="tv-edges" aria-hidden="true"></svg><div class="tv-groups">${body}</div></div>` + compare(s);
335
+ }
336
+ function legend() {
337
+ return `<p class="tv-legend"><span><i></i> rests on / cites / computed from</span><span><i class="bad dash"></i> doubted by</span><span><i class="ok dot"></i> settled by</span>
338
+ <span><i class="bad"></i> rejected because</span><span><i class="muted"></i> comes after</span><span><i class="muted dot"></i> done with</span><span><i class="bad dash"></i> needs equipment</span></p>`;
339
+ }
340
+ function auditView() {
341
+ if (!AUDIT) return `<p class="tv-empty">The package does not carry an audit of itself. ${CFG.audit_url ? "The live audit is loading…" : "Run <code>mat2bot audit &lt;package&gt;</code> to re-derive every claim from the files alone."}</p>`;
342
+ return `<p>${esc(AUDIT.when || "")}: <b>${esc(AUDIT.verdict)}</b>${CFG.links && CFG.links.audit ? ` · <a href="${esc(CFG.links.audit)}">the full audit page</a>` : ""}</p>
343
+ <ul class="tv-audit">${AUDIT.checks.map((c) => `<li>${chip("science", c.verdict === "UNKNOWN" ? "UNKNOWN" : c.verdict)} ${esc(c.name)}${c.detail ? ` <small>— ${esc(c.detail)}</small>` : ""}</li>`).join("")}</ul>`;
344
+ }
345
+ function drawEdges() {
346
+ const svg = app.querySelector("svg.tv-edges");
347
+ if (!svg) return;
348
+ const box = svg.parentElement.getBoundingClientRect();
349
+ const at = (id) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(id)}"]`); if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.left - box.left + r.width / 2, y: r.top - box.top + r.height / 2 }; };
350
+ const paths = [];
351
+ T.edges.forEach((e) => {
352
+ const a = at(e.source), b = at(e.target);
353
+ if (!a || !b) return;
354
+ const mx = (a.x + b.x) / 2;
355
+ paths.push(`<path class="${e.kind}" data-s="${esc(e.source)}" data-t="${esc(e.target)}" d="M${a.x},${a.y} C${mx},${a.y} ${mx},${b.y} ${b.x},${b.y}"><title>${esc(EDGE_WORDS[e.kind])}${e.label ? ": " + esc(e.label) : ""}</title></path>`);
356
+ });
357
+ svg.setAttribute("viewBox", `0 0 ${box.width} ${box.height}`);
358
+ svg.innerHTML = paths.join("");
359
+ }
360
+ function highlight(id, on) {
361
+ app.querySelectorAll("svg.tv-edges path").forEach((p) => { if (p.dataset.s === id || p.dataset.t === id) p.classList.toggle("hl", on); });
362
+ }
363
+ function why(id) {
364
+ app.querySelectorAll(".tv-card.hl").forEach((c) => c.classList.remove("hl"));
365
+ const targets = (OUT.get(id) || []).filter((e) => e.kind === "rejected_for").map((e) => e.target);
366
+ let first = null;
367
+ targets.forEach((t) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(t)}"]`); if (el) { el.classList.add("hl"); first = first || el; } });
368
+ highlight(id, true);
369
+ if (first) first.scrollIntoView({ block: "center", behavior: "smooth" });
370
+ else if (targets.length) go({ stage: state().stage, node: targets[0] });
371
+ }
372
+ function compare(s) {
373
+ const ids = (s.cmp || []).slice(0, 2).map((id) => NODES.get(id)).filter(Boolean);
374
+ if (ids.length < 2) return ids.length === 1 ? `<p class="tv-sub">Pick a second route to compare with ${esc(short(ids[0]))}.</p>` : "";
375
+ const row = (name, f) => `<tr><th>${name}</th>${ids.map((n) => `<td>${f(n)}</td>`).join("")}</tr>`;
376
+ const doubts = (n) => T.nodes.filter((d) => d.kind === "doubt" && d.detail.route === n.detail.route && d.science === "open").map((d) => esc(d.label)).join("<br>") || "none open";
377
+ const labs = (n) => T.nodes.filter((l) => l.kind === "laboratory" && l.detail.route === n.detail.route).map((l) => esc(l.label)).join("<br>") || "–";
378
+ return `<div class="tv-compare"><h3>Side by side</h3><table><thead><tr><th></th>${ids.map((n) => `<th>${esc(short(n))}</th>`).join("")}</tr></thead><tbody>
379
+ ${row("Support", (n) => chip("science", n.science) + ` <small>${esc(n.detail.row)}</small>`)}
380
+ ${row("Precedent", (n) => esc(n.detail.precedent))}
381
+ ${row("Reagents", (n) => (n.detail.precursors || []).map(esc).join("<br>"))}
382
+ ${row("Conditions", (n) => Object.entries(n.detail.parameters || {}).map(([k, v]) => `${esc(k)} = ${esc(v)}`).join("<br>") || "none stated")}
383
+ ${row("Equipment", (n) => (n.detail.equipment || []).map(esc).join("<br>"))}
384
+ ${row("Open doubts", doubts)}${row("Laboratories", labs)}</tbody></table>
385
+ <p><button type="button" data-cmp-clear="1">Clear</button></p></div>`;
386
+ }
387
+ // ---------------------------------------------------------------- provenance panel
388
+ function link(url, text) { return url && /^https?:\/\//.test(url) ? `<a href="${esc(url)}" rel="noopener" target="_blank">${esc(text || url)}</a>` : esc(text || url || ""); }
389
+ function value(d) {
390
+ if (d.value == null && !("unit" in d)) return "";
391
+ const u = d.uncertainty;
392
+ return `<p class="num">${d.value == null ? "unresolved" : esc(Number(d.value).toPrecision(5).replace(/\.?0+$/, ""))} ${esc(d.unit || "")}${u ? ` ± ${esc(Number(u.expanded).toPrecision(2))} (k = ${esc(u.k)})` : ""}</p>
393
+ <dl>${d.method ? `<dt>method</dt><dd><code>${esc(d.method)}</code></dd>` : ""}${d.basis ? `<dt>basis</dt><dd>${esc(d.basis)}</dd>` : ""}<dt>provenance</dt><dd>${esc(d.provenance)}</dd>
394
+ ${u ? `<dt>uncertainty</dt><dd>u = ${esc(Number(u.u).toPrecision(3))}, type ${esc(u.type)}; ${esc(u.basis)}</dd>` : ""}${d.domain ? `<dt>valid for</dt><dd><code>${esc(JSON.stringify(d.domain))}</code></dd>` : ""}
395
+ ${d.note ? `<dt>note</dt><dd>${esc(d.note)}</dd>` : ""}</dl>${(d.sources || []).length ? `<h3>Sources</h3><ul>${d.sources.map((s) => `<li>${esc(s.citation || s.id)}${s.id && s.kind === "doi" ? " · " + link("https://doi.org/" + s.id, "doi:" + s.id) : s.url ? " · " + link(s.url, "source") : ""}${s.quote ? `<blockquote>${esc(s.quote)}</blockquote>` : ""}</li>`).join("")}</ul>` : ""}`;
396
+ }
397
+ function generic(d, skip) {
398
+ const rows = Object.entries(d).filter(([k, v]) => !skip.includes(k) && v != null && v !== "" && !(Array.isArray(v) && !v.length) && !(typeof v === "object" && !Array.isArray(v) && !Object.keys(v).length));
399
+ if (!rows.length) return "";
400
+ return `<dl>${rows.map(([k, v]) => `<dt>${esc(k.replace(/_/g, " "))}</dt><dd>${fmt(v)}</dd>`).join("")}</dl>`;
401
+ }
402
+ function fmt(v) {
403
+ if (Array.isArray(v)) return `<ul>${v.map((x) => `<li>${typeof x === "object" ? fmt(x) : esc(x)}</li>`).join("")}</ul>`;
404
+ if (typeof v === "object") return `<dl>${Object.entries(v).map(([k, x]) => `<dt>${esc(k)}</dt><dd>${fmt(x)}</dd>`).join("")}</dl>`;
405
+ if (typeof v === "string" && /^https?:\/\//.test(v)) return link(v);
406
+ if (typeof v === "string" && /^R-[A-Z0-9-]+-\d{3}$/.test(v)) return `<code>${esc(v)}</code>`;
407
+ return esc(v);
408
+ }
409
+ function panel(id) {
410
+ const n = NODES.get(id);
411
+ if (!n) return `<aside class="tv-panel"><button type="button" class="close" data-close="1">Close</button><h2>No such record</h2><p>${esc(id)} is not in this trace.</p></aside>`;
412
+ const d = n.detail || {};
413
+ let body = "";
414
+ if (n.kind === "calculation" && "value" in d) body = value(d);
415
+ else if (n.kind === "evidence") body = `${d.claim ? `<p>${esc(d.claim)}</p>` : ""}<dl>${d.citation ? `<dt>citation</dt><dd>${esc(d.citation)}</dd>` : ""}${d.doi ? `<dt>doi</dt><dd>${link("https://doi.org/" + d.doi, d.doi)}</dd>` : d.url ? `<dt>source</dt><dd>${link(d.url)}</dd>` : ""}${d.licence ? `<dt>licence</dt><dd>${esc(d.licence)}</dd>` : ""}${d.locator ? `<dt>where</dt><dd>${esc(d.locator)}</dd>` : ""}</dl>${d.quote ? `<h3>Quoted</h3><blockquote>${esc(d.quote)}</blockquote>` : ""}${generic(d, ["claim", "citation", "doi", "url", "licence", "locator", "quote", "kind", "evidence_id"])}`;
416
+ else if (n.kind === "doubt") body = `<p>${esc(d.statement)}</p><dl><dt>kind</dt><dd>${esc(d.kind)} doubt</dd><dt>status</dt><dd>${chip("science", d.status)}</dd><dt>rule</dt><dd><code>${esc(d.rule)}</code></dd>${d.closable_by ? `<dt>closed only by</dt><dd>${esc(d.closable_by)}</dd>` : ""}<dt>critical</dt><dd>${d.critical ? "yes" : "no"}</dd></dl>`;
417
+ else body = generic(d, ["route"]);
418
+ const rel = (edges, dir) => edges.map((e) => { const o = NODES.get(dir === "out" ? e.target : e.source); return o ? `<li><a href="#node=${encodeURIComponent(o.node_id)}">${esc(short(o))}</a> <small>(${esc(EDGE_WORDS[e.kind])}${e.label ? ", " + esc(e.label) : ""})</small></li>` : ""; }).join("");
419
+ const outs = OUT.get(id) || [], ins = IN.get(id) || [];
420
+ const q = [["What it rests on", outs.filter((e) => ["supported_by", "computed_from", "cites", "resolved_by", "depends_on", "mapped_to", "requires_equipment", "rejected_for"].includes(e.kind)), "out"],
421
+ ["What rests on it, or questions it", ins, "in"]];
422
+ return `<aside class="tv-panel" role="dialog" aria-label="record"><button type="button" class="close" data-close="1">Close</button>
423
+ <span class="k">${esc(KIND_WORDS[n.kind] || n.kind)} · stage ${esc(n.stage)}${d.route ? ` · route ${esc(d.route)}` : ""}</span><h2>${esc(n.label)}</h2><div class="chips">${chips(n)}</div>
424
+ ${body}${q.map(([t, es, dir]) => es.length ? `<h3>${t}</h3><ul>${rel(es, dir)}</ul>` : "").join("")}
425
+ ${n.children.length ? `<h3>Inside</h3><ul>${n.children.map((c) => NODES.get(c)).filter(Boolean).map((c) => `<li><a href="#node=${encodeURIComponent(c.node_id)}">${esc(short(c))}</a> ${chips(c)}</li>`).join("")}</ul>` : ""}
426
+ <h3>Where it is recorded</h3><p><code>${esc(n.ref || "a presentation-only group")}</code>${n.presentation_only ? " (a grouping, not a record)" : ""}</p></aside>`;
427
+ }
428
+ // ---------------------------------------------------------------- render and events
429
+ function render() {
430
+ const s = state();
431
+ app.innerHTML = frame(s) + (s.stage ? component(s) : overview(s)) + (s.node ? panel(s.node) : "");
432
+ if (s.stage) requestAnimationFrame(drawEdges);
433
+ if (s.node) {
434
+ const el = app.querySelector(`.tv-card[data-id="${CSS.escape(s.node)}"]`);
435
+ if (el) { el.classList.add("sel"); highlight(s.node, true); }
436
+ const g = app.querySelector(`g.mnode[data-node="${CSS.escape(s.node)}"]`);
437
+ if (g) g.classList.add("sel");
438
+ }
439
+ }
440
+ app.addEventListener("click", (ev) => {
441
+ const b = ev.target.closest("[data-tab],[data-stage],[data-node],[data-why],[data-open],[data-cmp],[data-cmp-clear],[data-close],a[href^='#']");
442
+ if (!b || !app.contains(b)) return;
443
+ const s = state();
444
+ if (b.dataset.tab != null) { ev.preventDefault(); if (b.dataset.tab === "") go({}); else if (b.dataset.tab === "__comp") go({ stage: s.stage || STAGES[0], cmp: s.cmp }); else go({ stage: s.stage || (s.node ? NODES.get(s.node).stage : STAGES[0]), node: s.node || ((STAGE_NODE[s.stage || STAGES[0]] || { children: [] }).children[0] || "target"), cmp: s.cmp }); return; }
445
+ if (b.dataset.stage) { ev.preventDefault(); go({ stage: b.dataset.stage }); return; }
446
+ if (b.dataset.node) { ev.preventDefault(); go({ stage: s.stage, node: b.dataset.node, cmp: s.cmp }); return; }
447
+ if (b.dataset.why) { why(b.dataset.why); return; }
448
+ if (b.dataset.open) { b.outerHTML = `<div class="tv-kids">${NODES.get(b.dataset.open).children.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, new Set(T.nodes.map((n) => n.node_id)), s, 1)).join("")}</div>`; requestAnimationFrame(drawEdges); return; }
449
+ if (b.dataset.cmp) { const c = s.cmp.includes(b.dataset.cmp) ? s.cmp.filter((x) => x !== b.dataset.cmp) : [...s.cmp, b.dataset.cmp].slice(-2); go({ stage: s.stage, node: s.node, cmp: c }); return; }
450
+ if (b.dataset.cmpClear) { go({ stage: s.stage, node: s.node, cmp: [] }); return; }
451
+ if (b.dataset.close) { go({ stage: s.stage, cmp: s.cmp }); return; }
452
+ if (b.tagName === "A" && b.getAttribute("href").startsWith("#")) { ev.preventDefault(); const h = b.getAttribute("href"); const t = parse(h); go({ ...t, stage: t.stage || s.stage, cmp: t.cmp.length ? t.cmp : s.cmp }); }
453
  });
454
+ app.addEventListener("keydown", (ev) => { if ((ev.key === "Enter" || ev.key === " ") && ev.target.closest("g.mnode")) { ev.preventDefault(); ev.target.closest("g.mnode").dispatchEvent(new MouseEvent("click", { bubbles: true })); } });
455
+ app.addEventListener("mouseover", (ev) => { const c = ev.target.closest(".tv-card"); if (c) highlight(c.dataset.id, true); });
456
+ app.addEventListener("mouseout", (ev) => { const c = ev.target.closest(".tv-card"); if (c && c.dataset.id !== state().node) highlight(c.dataset.id, false); });
457
+ if (!EMBEDDED) window.addEventListener("hashchange", render);
458
+ window.addEventListener("resize", () => requestAnimationFrame(() => { if (state().stage) drawEdges(); else render(); }));
459
+ document.addEventListener("keydown", (ev) => { if (ev.key === "Escape" && state().node) { const s = state(); go({ stage: s.stage, cmp: s.cmp }); } });
460
+ render();
461
+ if (CFG.audit_url && !AUDIT) {
462
+ fetch(CFG.audit_url, { cache: "no-store" }).then((r) => (r.ok ? r.json() : null)).then((a) => {
463
+ if (a && a.verdict && Array.isArray(a.checks)) { AUDIT = a; render(); }
464
+ }).catch(() => {});
465
+ }
466
+ return { render, go, setAudit(a) { AUDIT = a; render(); } };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
468
+
469
+ window.Mat2BotTrace = { mount };
470
+ const el = document.getElementById("trace-app");
471
+ const data = document.getElementById("trace");
472
+ if (el && data) {
473
+ const cfgEl = document.getElementById("trace-config");
474
+ mount(el, JSON.parse(data.textContent), JSON.parse((cfgEl && cfgEl.textContent) || "{}"));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  }
476
  })();
477
  </script></body></html>
cases/x1_na2o2_scope/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6c0e51c9631ceee4c993bcdc51f2b96d8c793a5ffa186450434e6756e6dc8919
3
- size 24341
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9cf8dd9995f811ed78eaab4ebda6c01bc801f978ea96523a457902c4e814ce02
3
+ size 26812
cases/x1_na2o2_scope/trace.html CHANGED
@@ -86,20 +86,33 @@ svg.tv-edges path.hl{opacity:1;stroke-width:3}
86
  .tv-events li{grid-template-columns:2em 1fr;grid-auto-rows:auto}.tv-events li .msg{grid-column:1/-1}}
87
  @media (prefers-reduced-motion:no-preference){.tv-card,.tv-stage{transition:background .15s,outline-color .15s}}
88
  .tv-audit li{list-style:none;font-size:.84rem}
89
- </style></head><body><script id="trace" type="application/json">{"edges":[],"events":[{"ended":"2026-10-26T00:00:00.000+00:00","message":"Na2O2: identity unresolved, phase unresolved; gates G1 PASS, G2 UNKNOWN","name":"target intake","seq":1,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"x1"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no synthesis precedent of this composition in the evidence","name":"families and precedents","seq":2,"stage":"M02","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","name":"route candidates","seq":3,"stage":"M04","started":"2026-10-26T00:00:00.000+00:00","status":"refused","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"gate S on the product alone: UNKNOWN; Na2O2 H271, H314 (hard_fail/human_only)","name":"the product's own hazards (handling only)","seq":4,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"feasibility","seq":5,"stage":"M05","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"route cases and ranking","seq":6,"stage":"M07","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"procedure","seq":7,"stage":"M08","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"laboratories","seq":8,"stage":"LAB","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"}],"layout":{"columns":["M01","M02","M04","M05","M07","M08","LAB","AUDIT"],"rows":{"finding:0":0,"gate:G1":1,"gate:G2":2,"gateS:target":3,"hazard:target:Na2O2":4,"target":0}},"nodes":[{"children":["gate:G1","gate:G2","gateS:target"],"detail":{"checked_against":["the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields)"],"form":"powder","formula":"Na2O2","identity":"unresolved","known_phases":[],"missing":["known phases of the composition (outside the registry; Materials Project not consulted)","Materials Project energies (no key; never decisive for polymorphs)"],"novelty":"not found in the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields); no other database consulted","phase":null},"evidence":"n/a","execution":"completed","kind":"target","lab":null,"label":"Na2O2","node_id":"target","presentation_only":false,"ref":"target.json#target","science":"unresolved","stage":"M01"},{"children":[],"detail":{"findings":[],"rules":["R-G1-INPUT-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G1: PASS","node_id":"gate:G1","presentation_only":false,"ref":"target.json#gates/G1","science":"PASS","stage":"M01"},{"children":[],"detail":{"findings":[{"code":"IDENTITY_UNRESOLVED","message":"Na2O2 is outside the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields)","rule":"R-G2-ID-001"}],"rules":["R-G2-ID-001","R-M01-ID-001","R-M01-PHASE-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G2: UNKNOWN","node_id":"gate:G2","presentation_only":false,"ref":"target.json#gates/G2","science":"UNKNOWN","stage":"M01"},{"children":["hazard:target:Na2O2"],"detail":{"findings":[{"code":"HAZARD_HARD_FAIL","message":"sodium peroxide (Na2O2, product): H271 (harmonised): no unattended automated step may handle it; a person may, after G7"},{"code":"HAZARD_HUMAN_ONLY","message":"sodium peroxide (Na2O2, product): H314 (harmonised): a person handles it; G7 records it"},{"code":"HAZARD_UNKNOWN","message":"no reagent of this route is known, so their hazards are unknown; a person decides at G7"}],"what":"what handling the material demands; not a route verdict"},"evidence":"n/a","execution":"completed","kind":"hazard","lab":null,"label":"Handling the product (gate S on it alone): UNKNOWN","node_id":"gateS:target","presentation_only":false,"ref":"safety/target.json#gate","science":"UNKNOWN","stage":"M01"},{"children":[],"detail":{"codes":["H271","H314"],"demands":["hard_fail","human_only"],"harmonised":true,"pubchem_cid":14803,"url":"https://pubchem.ncbi.nlm.nih.gov/compound/14803#section=GHS-Classification"},"evidence":"verified","execution":"completed","kind":"hazard","lab":null,"label":"sodium peroxide (Na2O2): hard_fail, human_only","node_id":"hazard:target:Na2O2","presentation_only":false,"ref":"safety/target.json#substances/Na2O2","science":null,"stage":"M01"},{"children":[],"detail":{"code":"NO_SUPPORTED_FAMILY","message":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","rule":"R-M03-SCOPE-001","severity":"warning","subject":"Na2O2"},"evidence":"n/a","execution":"refused","kind":"finding","lab":null,"label":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","node_id":"finding:0","presentation_only":false,"ref":"plan.json#findings/0","science":null,"stage":"M04"},{"children":["target","gate:G1","gate:G2","gateS:target","hazard:target:Na2O2"],"detail":{"events":[1,4],"how":"","message":"Na2O2: identity unresolved, phase unresolved; gates G1 PASS, G2 UNKNOWN; gate S on the product alone: UNKNOWN; Na2O2 H271, H314 (hard_fail/human_only)"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Target","node_id":"stage:M01","presentation_only":false,"ref":"trace.json#events/M01","science":null,"stage":"M01"},{"children":[],"detail":{"events":[2],"how":"","message":"no synthesis precedent of this composition in the evidence"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Evidence","node_id":"stage:M02","presentation_only":false,"ref":"trace.json#events/M02","science":null,"stage":"M02"},{"children":["finding:0"],"detail":{"events":[3],"how":"","message":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly"},"evidence":"n/a","execution":"refused","kind":"stage","lab":null,"label":"Routes","node_id":"stage:M04","presentation_only":false,"ref":"trace.json#events/M04","science":null,"stage":"M04"},{"children":[],"detail":{"events":[5],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Science","node_id":"stage:M05","presentation_only":false,"ref":"trace.json#events/M05","science":null,"stage":"M05"},{"children":[],"detail":{"events":[6],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"The case","node_id":"stage:M07","presentation_only":false,"ref":"trace.json#events/M07","science":null,"stage":"M07"},{"children":[],"detail":{"events":[7],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Procedure","node_id":"stage:M08","presentation_only":false,"ref":"trace.json#events/M08","science":null,"stage":"M08"},{"children":[],"detail":{"events":[8],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Laboratories","node_id":"stage:LAB","presentation_only":false,"ref":"trace.json#events/LAB","science":null,"stage":"LAB"},{"children":[],"detail":{"events":[],"how":"run `mat2bot audit <package>`; the result never comes from the package itself","message":"the package is audited after it is written: run the auditor, or a live audit fills this column"},"evidence":"n/a","execution":"not_run","kind":"stage","lab":null,"label":"Audit","node_id":"stage:AUDIT","presentation_only":false,"ref":"trace.json#nodes/stage:AUDIT","science":null,"stage":"AUDIT"}],"note":"A projection of the plan's records: every node names the record it shows and every edge a relationship that record holds; nothing here is computed anew. The audit stage is filled only by a live audit.","request_id":"x1","schema":"mat2bot/trace/1","title":"Sodium peroxide (Na2O2)"}</script><script id="trace-config" type="application/json">{"audit_url": "audit.json", "links": {"home": "../../index.html", "report": "report.html", "package": "package.zip"}, "mat2bot": "0.1.0"}</script><div id="trace-app" data-title="Sodium peroxide (Na2O2)"></div><script>/* Mat2Bot Trace viewer: three levels (overview, component, provenance) over trace.json and nothing else.
90
- Every card is a node of the trace, every drawn line an edge of it; the audit column is filled only from a live
91
- audit the host serves (config.audit_url), otherwise it stays "not run". Plain JS, no library. */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  (function () {
93
  "use strict";
94
- const T = JSON.parse(document.getElementById("trace").textContent);
95
- const CFG = JSON.parse(document.getElementById("trace-config").textContent || "{}");
96
- const app = document.getElementById("trace-app");
97
- const NODES = new Map(T.nodes.map((n) => [n.node_id, n]));
98
- const STAGES = T.layout.columns || ["M01", "M02", "M04", "M05", "M07", "M08", "LAB", "AUDIT"];
99
- const STAGE_NODE = {};
100
- T.nodes.forEach((n) => { if (n.kind === "stage") STAGE_NODE[n.stage] = n; });
101
- const OUT = new Map(), IN = new Map();
102
- T.edges.forEach((e) => { (OUT.get(e.source) || OUT.set(e.source, []).get(e.source)).push(e); (IN.get(e.target) || IN.set(e.target, []).get(e.target)).push(e); });
103
  const esc = (s) => String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
104
  const WORDS = {
105
  execution: { completed: ["ran", "ok"], skipped: ["skipped", "off"], refused: ["stopped: refused", "warn"], failed: ["failed", "bad"], not_run: ["not run", "off"] },
@@ -117,233 +130,348 @@ svg.tv-edges path.hl{opacity:1;stroke-width:3}
117
  const KIND_WORDS = { stage: "stage", target: "the target", finding: "finding", route: "route", rival: "rejected route", claim: "claim", inference: "inference",
118
  evidence: "evidence", calculation: "calculation", model_output: "model", assumption: "assumption", doubt: "doubt", step: "step", hazard: "hazard",
119
  laboratory: "laboratory", capability: "equipment", grouping: "group" };
 
120
  function chip(attr, value) {
121
  if (value == null || value === "n/a" || value === "") return "";
122
  const w = (WORDS[attr] || {})[value] || [String(value).replace(/_/g, " "), "acc"];
123
  return `<span class="chip ${w[1]}" title="${esc(attr)}: ${esc(value)}">${esc(w[0])}</span>`;
124
  }
125
- function chips(n) {
126
- return [chip("execution", n.kind === "stage" || n.execution !== "completed" ? n.execution : null), chip("science", n.science),
127
- chip("evidence", n.evidence), chip("lab", n.lab)].join("");
128
- }
129
- // ---------------------------------------------------------------- routing
130
- function state() {
131
- const h = Object.fromEntries(location.hash.slice(1).split("&").filter(Boolean).map((kv) => kv.split("=").map(decodeURIComponent)));
132
- return { stage: h.stage || "", node: h.node || "", cmp: (h.cmp || "").split(",").filter(Boolean) };
133
- }
134
- function go(s) {
135
- const parts = [];
136
- if (s.stage) parts.push("stage=" + encodeURIComponent(s.stage));
137
- if (s.node) parts.push("node=" + encodeURIComponent(s.node));
138
- if (s.cmp && s.cmp.length) parts.push("cmp=" + encodeURIComponent(s.cmp.join(",")));
139
- const next = "#" + parts.join("&");
140
- if (location.hash !== next) location.hash = next; else render();
141
- }
142
- // ---------------------------------------------------------------- the frame
143
- let AUDIT = null;
144
- function frame(s) {
145
- const links = CFG.links || {};
146
- const nav = Object.entries(links).map(([k, v]) => `<a href="${esc(v)}">${esc({ report: "Technical report", package: "Download the package", audit: "Audit it now", home: "Mat2Bot" }[k] || k)}</a>`).join("");
147
- const tabs = [["", "Overview"], ["__comp", "Components"], ["__prov", "Provenance"]];
148
- const cur = s.node ? "__prov" : s.stage ? "__comp" : "";
149
- return `<header class="tv-top"><h1>${esc(app.dataset.title)}: how Mat2Bot got there</h1><nav>${nav}</nav></header>
150
- <p class="tv-sub">${esc(T.note)} Request <code>${esc(T.request_id)}</code>; ${T.nodes.length} records shown, ${T.edges.length} relationships, ${T.events.length} events. Click a stage, then a card, to reach the record behind it; the address bar keeps your place.</p>
151
- <div class="tv-tabs">${tabs.map(([k, l]) => `<button type="button" data-tab="${k}" ${cur === k ? 'aria-current="page"' : ""}>${l}</button>`).join("")}</div>`;
152
- }
153
- // ---------------------------------------------------------------- overview
154
- function summary(stage) {
155
- const kids = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
156
- const count = (f) => kids.filter(f).length;
157
- const items = [];
158
- if (stage === "M01") { const t = kids.find((n) => n.kind === "target"); if (t) items.push(esc(t.label), `identity: ${esc(t.science)}`); kids.filter((n) => n.kind === "claim").forEach((g) => items.push(`${esc(g.label)}`)); }
159
- if (stage === "M02") items.push(`${count((n) => n.kind === "evidence")} records: ${count((n) => n.evidence === "verified")} verified, ${count((n) => n.evidence === "unverified")} not`);
160
- if (stage === "M04") { items.push(`${count((n) => n.kind === "route")} proposed, ${count((n) => n.kind === "rival")} rejected`); kids.filter((n) => n.kind === "finding").forEach((f) => items.push(esc(f.detail.code))); }
161
- if (stage === "M05") items.push(`${count((n) => n.kind === "calculation")} calculations, ${count((n) => n.kind === "model_output" && n.execution === "refused")} model refusals`);
162
- if (stage === "M07") items.push(`${count((n) => n.kind === "claim")} claims; doubts: ${count((n) => n.science === "open")} open, ${count((n) => n.science === "eliminated")} ruled out, ${count((n) => n.science === "sustained")} confirmed`);
163
- if (stage === "M08") items.push(`${count((n) => n.kind === "step")} steps; ${count((n) => n.kind === "step" && n.science)} with unresolved values`);
164
- if (stage === "LAB") kids.filter((n) => n.kind === "laboratory").forEach((l) => items.push(`${esc(l.label)}`));
165
- if (stage === "AUDIT") {
166
- if (AUDIT) items.push(`${esc(AUDIT.verdict)}: ${AUDIT.checks.filter((c) => c.verdict === "PASS").length} checks passed${AUDIT.checks.some((c) => c.verdict === "FAIL") ? ", " + AUDIT.checks.filter((c) => c.verdict === "FAIL").length + " failed" : ""}`, esc(AUDIT.when || ""));
167
- else items.push("not filled by this package", CFG.audit_url ? "loading the live audit…" : "run the auditor on the package");
168
  }
169
- return items.map((x) => `<li>${x}</li>`).join("");
170
- }
171
- function overview(s) {
172
- const cards = STAGES.map((st) => {
173
- const n = STAGE_NODE[st] || { label: st, execution: "not_run", children: [] };
174
- const ex = st === "AUDIT" && AUDIT ? (AUDIT.verdict === "PASS" ? "completed" : "failed") : n.execution;
175
- return `<button type="button" class="tv-stage" data-stage="${st}"><span class="n">${esc(st)}</span><b>${esc(n.label)}</b>${chip("execution", ex)}<ul class="sum">${summary(st)}</ul></button>`;
176
- }).join("");
177
- const ev = T.events.map((e) => `<li class="${e.status}"><span class="seq">${e.seq}</span><span>${esc(e.stage)}</span><span>${esc(e.name)}${e.subject ? ` <small>(${esc(e.subject)})</small>` : ""}<span class="msg">${esc(e.message)}</span></span>${chip("execution", e.status)}</li>`).join("");
178
- return `<div class="tv-stages">${cards}</div>
179
- <p class="tv-legend"><span>Execution, science, evidence and laboratory are four separate marks; a card shows only those its record has.</span></p>
180
- <section class="tv-timeline"><h2>What ran, in order</h2><ol class="tv-events">${ev || '<li><span class="tv-empty">no events recorded</span></li>'}</ol>
181
- <p class="tv-sub">Times are the run's own clock (a fixed clock in a reproducible package). A skipped stage was not reached; a refused one stopped on purpose.</p></section>`;
182
- }
183
- // ---------------------------------------------------------------- component view
184
- function groupsOf(stage) {
185
- const all = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
186
- const nested = new Set(); // shown inside their parent's card, not again at the top level
187
- all.forEach((n) => { if (["target", "route", "rival", "grouping", "hazard", "laboratory"].includes(n.kind)) n.children.forEach((c) => nested.add(c)); });
188
- const kids = all.filter((n) => !nested.has(n.node_id));
189
- const byRoute = new Map();
190
- kids.forEach((n) => { const r = n.detail && n.detail.route; const key = r ? "route " + r : ""; (byRoute.get(key) || byRoute.set(key, []).get(key)).push(n); });
191
- return [...byRoute.entries()];
192
- }
193
- function relChips(n, visible) {
194
- const out = [];
195
- (OUT.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.target)) out.push(`<a href="#node=${encodeURIComponent(e.target)}">${esc(EDGE_WORDS[e.kind])}: ${esc(short(NODES.get(e.target)))}</a>`); });
196
- (IN.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.source) && e.kind !== "cites") out.push(`<a href="#node=${encodeURIComponent(e.source)}">${esc(short(NODES.get(e.source)))} ${esc(EDGE_WORDS[e.kind])} this</a>`); });
197
- return out.length ? `<div class="rel">${out.slice(0, 6).join(" · ")}${out.length > 6 ? ` · +${out.length - 6}` : ""}</div>` : "";
198
- }
199
- function short(n) { return n ? (n.label.length > 48 ? n.label.slice(0, 46) + "…" : n.label) : "?"; }
200
- function card(n, visible, s, depth) {
201
- const kidsShown = depth < 1 && n.children.length && (n.kind === "route" || n.kind === "rival" || n.kind === "grouping" || n.kind === "hazard" || n.kind === "laboratory" || n.kind === "target") ? n.children : [];
202
- const acts = [];
203
- if (n.kind === "rival") acts.push(`<button type="button" data-why="${esc(n.node_id)}">Why was it rejected?</button>`);
204
- if (n.kind === "route") acts.push(`<button type="button" data-cmp="${esc(n.node_id)}">${(s.cmp || []).includes(n.node_id) ? "Comparing ✓" : "Compare"}</button>`);
205
- if (n.children.length && !kidsShown.length) acts.push(`<button type="button" data-open="${esc(n.node_id)}">Show ${n.children.length} inside</button>`);
206
- acts.push(`<a href="#node=${encodeURIComponent(n.node_id)}">Details</a>`);
207
- return `<div class="tv-card" data-id="${esc(n.node_id)}"><span class="k">${esc(KIND_WORDS[n.kind] || n.kind)}</span>
208
- <button type="button" class="lbl" data-node="${esc(n.node_id)}">${esc(n.label)}</button><div class="chips">${chips(n)}</div>${relChips(n, visible)}
209
- <div class="acts">${acts.join("")}</div>${kidsShown.length ? `<div class="tv-kids">${kidsShown.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, visible, s, depth + 1)).join("")}</div>` : ""}</div>`;
210
- }
211
- function component(s) {
212
- const st = s.stage;
213
- const groups = groupsOf(st);
214
- const visible = new Set();
215
- groups.forEach(([, ns]) => ns.forEach((n) => { visible.add(n.node_id); n.children.forEach((c) => visible.add(c)); }));
216
- const stn = STAGE_NODE[st];
217
- const head = `<p class="tv-crumb"><a href="#">Overview</a> › ${esc(stn ? stn.label : st)} ${chip("execution", stn ? stn.execution : "not_run")}${stn && stn.detail.message ? `<br><small>${esc(stn.detail.message)}</small>` : ""}</p>`;
218
- if (st === "AUDIT") return head + auditView();
219
- if (!groups.length) return head + `<p class="tv-empty">Nothing was recorded for this stage${stn && stn.execution === "skipped" ? ": it was skipped" : ""}.</p>`;
220
- const body = groups.map(([g, ns]) => `<div class="tv-group">${g ? `<h3>${esc(g)}</h3>` : ""}<div class="tv-cards">${ns.map((n) => card(n, visible, s, 0)).join("")}</div></div>`).join("");
221
- return head + legend() + `<div class="tv-comp"><svg class="tv-edges" aria-hidden="true"></svg><div class="tv-groups">${body}</div></div>` + compare(s);
222
- }
223
- function legend() {
224
- return `<p class="tv-legend"><span><i></i> rests on / cites / computed from</span><span><i class="bad dash"></i> doubted by</span><span><i class="ok dot"></i> settled by</span>
225
- <span><i class="bad"></i> rejected because</span><span><i class="muted"></i> comes after</span><span><i class="muted dot"></i> done with</span><span><i class="bad dash"></i> needs equipment</span></p>`;
226
- }
227
- function auditView() {
228
- if (!AUDIT) return `<p class="tv-empty">The package does not carry an audit of itself. ${CFG.audit_url ? "The live audit is loading…" : "Run <code>mat2bot audit &lt;package&gt;</code> to re-derive every claim from the files alone."}</p>`;
229
- return `<p>${esc(AUDIT.when || "")}: <b>${esc(AUDIT.verdict)}</b>${CFG.links && CFG.links.audit ? ` · <a href="${esc(CFG.links.audit)}">the full audit page</a>` : ""}</p>
230
- <ul class="tv-audit">${AUDIT.checks.map((c) => `<li>${chip("science", c.verdict === "UNKNOWN" ? "UNKNOWN" : c.verdict)} ${esc(c.name)}${c.detail ? ` <small>— ${esc(c.detail)}</small>` : ""}</li>`).join("")}</ul>`;
231
  }
232
- function drawEdges() {
233
- const svg = app.querySelector("svg.tv-edges");
234
- if (!svg) return;
235
- const box = svg.parentElement.getBoundingClientRect();
236
- const at = (id) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(id)}"]`); if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.left - box.left + r.width / 2, y: r.top - box.top + r.height / 2 }; };
237
- const paths = [];
238
- T.edges.forEach((e) => {
239
- const a = at(e.source), b = at(e.target);
240
- if (!a || !b) return;
241
- const mx = (a.x + b.x) / 2;
242
- paths.push(`<path class="${e.kind}" data-s="${esc(e.source)}" data-t="${esc(e.target)}" d="M${a.x},${a.y} C${mx},${a.y} ${mx},${b.y} ${b.x},${b.y}"><title>${esc(EDGE_WORDS[e.kind])}${e.label ? ": " + esc(e.label) : ""}</title></path>`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  });
244
- svg.setAttribute("viewBox", `0 0 ${box.width} ${box.height}`);
245
- svg.innerHTML = paths.join("");
246
- }
247
- function highlight(id, on) {
248
- app.querySelectorAll("svg.tv-edges path").forEach((p) => { if (p.dataset.s === id || p.dataset.t === id) p.classList.toggle("hl", on); });
249
- }
250
- function why(id) {
251
- app.querySelectorAll(".tv-card.hl").forEach((c) => c.classList.remove("hl"));
252
- const targets = (OUT.get(id) || []).filter((e) => e.kind === "rejected_for").map((e) => e.target);
253
- let first = null;
254
- targets.forEach((t) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(t)}"]`); if (el) { el.classList.add("hl"); first = first || el; } });
255
- highlight(id, true);
256
- if (first) first.scrollIntoView({ block: "center", behavior: "smooth" });
257
- else if (targets.length) go({ node: targets[0] });
258
- }
259
- function compare(s) {
260
- const ids = (s.cmp || []).slice(0, 2).map((id) => NODES.get(id)).filter(Boolean);
261
- if (ids.length < 2) return ids.length === 1 ? `<p class="tv-sub">Pick a second route to compare with ${esc(short(ids[0]))}.</p>` : "";
262
- const row = (name, f) => `<tr><th>${name}</th>${ids.map((n) => `<td>${f(n)}</td>`).join("")}</tr>`;
263
- const doubts = (n) => T.nodes.filter((d) => d.kind === "doubt" && d.detail.route === n.detail.route && d.science === "open").map((d) => esc(d.label)).join("<br>") || "none open";
264
- const labs = (n) => T.nodes.filter((l) => l.kind === "laboratory" && l.detail.route === n.detail.route).map((l) => esc(l.label)).join("<br>") || "–";
265
- return `<div class="tv-compare"><h3>Side by side</h3><table><thead><tr><th></th>${ids.map((n) => `<th>${esc(short(n))}</th>`).join("")}</tr></thead><tbody>
266
- ${row("Support", (n) => chip("science", n.science) + ` <small>${esc(n.detail.row)}</small>`)}
267
- ${row("Precedent", (n) => esc(n.detail.precedent))}
268
- ${row("Reagents", (n) => (n.detail.precursors || []).map(esc).join("<br>"))}
269
- ${row("Conditions", (n) => Object.entries(n.detail.parameters || {}).map(([k, v]) => `${esc(k)} = ${esc(v)}`).join("<br>") || "none stated")}
270
- ${row("Equipment", (n) => (n.detail.equipment || []).map(esc).join("<br>"))}
271
- ${row("Open doubts", doubts)}${row("Laboratories", labs)}</tbody></table>
272
- <p><button type="button" data-cmp-clear="1">Clear</button></p></div>`;
273
- }
274
- // ---------------------------------------------------------------- provenance panel
275
- function link(url, text) { return url && /^https?:\/\//.test(url) ? `<a href="${esc(url)}" rel="noopener" target="_blank">${esc(text || url)}</a>` : esc(text || url || ""); }
276
- function value(d) {
277
- if (d.value == null && !("unit" in d)) return "";
278
- const u = d.uncertainty;
279
- return `<p class="num">${d.value == null ? "unresolved" : esc(Number(d.value).toPrecision(5).replace(/\.?0+$/, ""))} ${esc(d.unit || "")}${u ? ` ± ${esc(Number(u.expanded).toPrecision(2))} (k = ${esc(u.k)})` : ""}</p>
280
- <dl>${d.method ? `<dt>method</dt><dd><code>${esc(d.method)}</code></dd>` : ""}${d.basis ? `<dt>basis</dt><dd>${esc(d.basis)}</dd>` : ""}<dt>provenance</dt><dd>${esc(d.provenance)}</dd>
281
- ${u ? `<dt>uncertainty</dt><dd>u = ${esc(Number(u.u).toPrecision(3))}, type ${esc(u.type)}; ${esc(u.basis)}</dd>` : ""}${d.domain ? `<dt>valid for</dt><dd><code>${esc(JSON.stringify(d.domain))}</code></dd>` : ""}
282
- ${d.note ? `<dt>note</dt><dd>${esc(d.note)}</dd>` : ""}</dl>${(d.sources || []).length ? `<h3>Sources</h3><ul>${d.sources.map((s) => `<li>${esc(s.citation || s.id)}${s.id && s.kind === "doi" ? " · " + link("https://doi.org/" + s.id, "doi:" + s.id) : s.url ? " · " + link(s.url, "source") : ""}${s.quote ? `<blockquote>${esc(s.quote)}</blockquote>` : ""}</li>`).join("")}</ul>` : ""}`;
283
- }
284
- function generic(d, skip) {
285
- const rows = Object.entries(d).filter(([k, v]) => !skip.includes(k) && v != null && v !== "" && !(Array.isArray(v) && !v.length) && !(typeof v === "object" && !Array.isArray(v) && !Object.keys(v).length));
286
- if (!rows.length) return "";
287
- return `<dl>${rows.map(([k, v]) => `<dt>${esc(k.replace(/_/g, " "))}</dt><dd>${fmt(v)}</dd>`).join("")}</dl>`;
288
- }
289
- function fmt(v) {
290
- if (Array.isArray(v)) return `<ul>${v.map((x) => `<li>${typeof x === "object" ? fmt(x) : esc(x)}</li>`).join("")}</ul>`;
291
- if (typeof v === "object") return `<dl>${Object.entries(v).map(([k, x]) => `<dt>${esc(k)}</dt><dd>${fmt(x)}</dd>`).join("")}</dl>`;
292
- if (typeof v === "string" && /^https?:\/\//.test(v)) return link(v);
293
- if (typeof v === "string" && /^R-[A-Z0-9-]+-\d{3}$/.test(v)) return `<code>${esc(v)}</code>`;
294
- return esc(v);
295
- }
296
- function panel(id) {
297
- const n = NODES.get(id);
298
- if (!n) return `<aside class="tv-panel"><button type="button" class="close" data-close="1">Close</button><h2>No such record</h2><p>${esc(id)} is not in this trace.</p></aside>`;
299
- const d = n.detail || {};
300
- let body = "";
301
- if (n.kind === "calculation" && "value" in d) body = value(d);
302
- else if (n.kind === "evidence") body = `${d.claim ? `<p>${esc(d.claim)}</p>` : ""}<dl>${d.citation ? `<dt>citation</dt><dd>${esc(d.citation)}</dd>` : ""}${d.doi ? `<dt>doi</dt><dd>${link("https://doi.org/" + d.doi, d.doi)}</dd>` : d.url ? `<dt>source</dt><dd>${link(d.url)}</dd>` : ""}${d.licence ? `<dt>licence</dt><dd>${esc(d.licence)}</dd>` : ""}${d.locator ? `<dt>where</dt><dd>${esc(d.locator)}</dd>` : ""}</dl>${d.quote ? `<h3>Quoted</h3><blockquote>${esc(d.quote)}</blockquote>` : ""}${generic(d, ["claim", "citation", "doi", "url", "licence", "locator", "quote", "kind", "evidence_id"])}`;
303
- else if (n.kind === "doubt") body = `<p>${esc(d.statement)}</p><dl><dt>kind</dt><dd>${esc(d.kind)} doubt</dd><dt>status</dt><dd>${chip("science", d.status)}</dd><dt>rule</dt><dd><code>${esc(d.rule)}</code></dd>${d.closable_by ? `<dt>closed only by</dt><dd>${esc(d.closable_by)}</dd>` : ""}<dt>critical</dt><dd>${d.critical ? "yes" : "no"}</dd></dl>`;
304
- else body = generic(d, ["route"]);
305
- const rel = (edges, dir) => edges.map((e) => { const o = NODES.get(dir === "out" ? e.target : e.source); return o ? `<li><a href="#node=${encodeURIComponent(o.node_id)}">${esc(short(o))}</a> <small>(${esc(EDGE_WORDS[e.kind])}${e.label ? ", " + esc(e.label) : ""})</small></li>` : ""; }).join("");
306
- const outs = OUT.get(id) || [], ins = IN.get(id) || [];
307
- const q = [["What it rests on", outs.filter((e) => ["supported_by", "computed_from", "cites", "resolved_by", "depends_on", "mapped_to", "requires_equipment", "rejected_for"].includes(e.kind)), "out"],
308
- ["What rests on it, or questions it", ins, "in"]];
309
- return `<aside class="tv-panel" role="dialog" aria-label="record"><button type="button" class="close" data-close="1">Close</button>
310
- <span class="k">${esc(KIND_WORDS[n.kind] || n.kind)} · stage ${esc(n.stage)}${d.route ? ` · route ${esc(d.route)}` : ""}</span><h2>${esc(n.label)}</h2><div class="chips">${chips(n)}</div>
311
- ${body}${q.map(([t, es, dir]) => es.length ? `<h3>${t}</h3><ul>${rel(es, dir)}</ul>` : "").join("")}
312
- ${n.children.length ? `<h3>Inside</h3><ul>${n.children.map((c) => NODES.get(c)).filter(Boolean).map((c) => `<li><a href="#node=${encodeURIComponent(c.node_id)}">${esc(short(c))}</a> ${chips(c)}</li>`).join("")}</ul>` : ""}
313
- <h3>Where it is recorded</h3><p><code>${esc(n.ref || "a presentation-only group")}</code>${n.presentation_only ? " (a grouping, not a record)" : ""}</p></aside>`;
314
- }
315
- // ---------------------------------------------------------------- render
316
- function render() {
317
- const s = state();
318
- const node = s.node ? NODES.get(s.node) : null;
319
- if (node && !s.stage) s.stage = node.stage;
320
- app.innerHTML = frame(s) + (s.stage ? component(s) : overview(s)) + (s.node ? panel(s.node) : "");
321
- if (s.stage) requestAnimationFrame(drawEdges);
322
- if (s.node) { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(s.node)}"]`); if (el) { el.classList.add("sel"); highlight(s.node, true); } }
323
  }
324
- app.addEventListener("click", (ev) => {
325
- const b = ev.target.closest("button, a");
326
- if (!b || !app.contains(b)) return;
327
- const s = state();
328
- if (b.dataset.tab != null) { ev.preventDefault(); if (b.dataset.tab === "") go({}); else if (b.dataset.tab === "__comp") go({ stage: s.stage || STAGES[0], cmp: s.cmp }); else go({ stage: s.stage || (s.node ? NODES.get(s.node).stage : STAGES[0]), node: s.node || ((STAGE_NODE[s.stage || STAGES[0]] || { children: [] }).children[0] || "target"), cmp: s.cmp }); return; }
329
- if (b.dataset.stage) { go({ stage: b.dataset.stage }); return; }
330
- if (b.dataset.node) { go({ stage: s.stage, node: b.dataset.node, cmp: s.cmp }); return; }
331
- if (b.dataset.why) { why(b.dataset.why); return; }
332
- if (b.dataset.open) { b.outerHTML = `<div class="tv-kids">${NODES.get(b.dataset.open).children.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, new Set(T.nodes.map((n) => n.node_id)), s, 1)).join("")}</div>`; requestAnimationFrame(drawEdges); return; }
333
- if (b.dataset.cmp) { const c = s.cmp.includes(b.dataset.cmp) ? s.cmp.filter((x) => x !== b.dataset.cmp) : [...s.cmp, b.dataset.cmp].slice(-2); go({ stage: s.stage, node: s.node, cmp: c }); return; }
334
- if (b.dataset.cmpClear) { go({ stage: s.stage, node: s.node, cmp: [] }); return; }
335
- if (b.dataset.close) { go({ stage: s.stage, cmp: s.cmp }); }
336
- });
337
- app.addEventListener("mouseover", (ev) => { const c = ev.target.closest(".tv-card"); if (c) highlight(c.dataset.id, true); });
338
- app.addEventListener("mouseout", (ev) => { const c = ev.target.closest(".tv-card"); if (c && c.dataset.id !== state().node) highlight(c.dataset.id, false); });
339
- window.addEventListener("hashchange", render);
340
- window.addEventListener("resize", () => requestAnimationFrame(drawEdges));
341
- document.addEventListener("keydown", (ev) => { if (ev.key === "Escape" && state().node) { const s = state(); go({ stage: s.stage, cmp: s.cmp }); } });
342
- render();
343
- if (CFG.audit_url) {
344
- fetch(CFG.audit_url, { cache: "no-store" }).then((r) => (r.ok ? r.json() : null)).then((a) => {
345
- if (a && a.verdict && Array.isArray(a.checks)) { AUDIT = a; render(); }
346
- }).catch(() => {});
347
  }
348
  })();
349
  </script></body></html>
 
86
  .tv-events li{grid-template-columns:2em 1fr;grid-auto-rows:auto}.tv-events li .msg{grid-column:1/-1}}
87
  @media (prefers-reduced-motion:no-preference){.tv-card,.tv-stage{transition:background .15s,outline-color .15s}}
88
  .tv-audit li{list-style:none;font-size:.84rem}
89
+ /* the map: a spine of stages with their branches (SVG) */
90
+ .tv-map{overflow-x:auto;margin:.2em 0 .4em;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);padding:10px}
91
+ .tv-map svg{display:block;max-width:none;font:13px/1.2 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
92
+ .tv-map .mnode{cursor:pointer}.tv-map .mnode:focus{outline:none}
93
+ .tv-map .mnode rect{fill:var(--bg);stroke:var(--line);stroke-width:1.4}
94
+ .tv-map .mnode.stage rect{fill:var(--head);stroke-width:2}
95
+ .tv-map .mnode:hover rect,.tv-map .mnode:focus rect{stroke:var(--accent);stroke-width:2.4}
96
+ .tv-map .mnode text{fill:var(--fg);font-weight:600;pointer-events:none}
97
+ .tv-map .mnode text.sub{font-size:11.5px;font-weight:400;fill:var(--muted)}
98
+ .tv-map .mnode text.sub2{font-size:11px;font-weight:400;fill:var(--muted)}
99
+ .tv-map .mnode.kid text{font-weight:500;font-size:12.5px}
100
+ .tv-map .mnode.more rect{stroke-dasharray:4 3}.tv-map .mnode.more text{fill:var(--accent)}
101
+ .tv-map .tone-ok rect{stroke:var(--ok)}.tv-map .tone-warn rect{stroke:var(--warn)}.tv-map .tone-bad rect{stroke:var(--bad)}.tv-map .tone-off rect{stroke:var(--off);stroke-dasharray:4 3}
102
+ .tv-map .tone-off text{fill:var(--muted)}
103
+ .tv-map path.spine{fill:none;stroke:var(--accent);stroke-width:2}.tv-map marker path{fill:var(--accent)}
104
+ .tv-map path.branch{fill:none;stroke:var(--line);stroke-width:1.5}
105
+ .tv-legend i.box{width:14px;height:14px;border:2px solid var(--accent);border-radius:4px;border-top-width:2px}
106
+ .tv-legend i.box.ok{border-color:var(--ok)}.tv-legend i.box.warn{border-color:var(--warn)}.tv-legend i.box.bad{border-color:var(--bad)}.tv-legend i.box.off{border-color:var(--off);border-style:dashed}
107
+ details.tv-timeline summary{cursor:pointer;color:var(--accent);font-size:.95rem;margin:.6em 0 .3em}
108
+ .tv-map .mnode.sel rect{stroke:var(--accent);stroke-width:3}
109
+ </style></head><body><script id="trace" type="application/json">{"edges":[],"events":[{"ended":"2026-10-26T00:00:00.000+00:00","message":"Na2O2: identity unresolved, phase unresolved; gates G1 PASS, G2 UNKNOWN","name":"target intake","seq":1,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"x1"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no synthesis precedent of this composition in the evidence","name":"families and precedents","seq":2,"stage":"M02","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","name":"route candidates","seq":3,"stage":"M04","started":"2026-10-26T00:00:00.000+00:00","status":"refused","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"gate S on the product alone: UNKNOWN; Na2O2 H271, H314 (hard_fail/human_only)","name":"the product's own hazards (handling only)","seq":4,"stage":"M01","started":"2026-10-26T00:00:00.000+00:00","status":"completed","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"feasibility","seq":5,"stage":"M05","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"route cases and ranking","seq":6,"stage":"M07","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"procedure","seq":7,"stage":"M08","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"},{"ended":"2026-10-26T00:00:00.000+00:00","message":"not reached: no route candidate in Mat2Bot's planned families","name":"laboratories","seq":8,"stage":"LAB","started":"2026-10-26T00:00:00.000+00:00","status":"skipped","subject":"Na2O2"}],"layout":{"columns":["M01","M02","M04","M05","M07","M08","LAB","AUDIT"],"rows":{"finding:0":0,"gate:G1":1,"gate:G2":2,"gateS:target":3,"hazard:target:Na2O2":4,"target":0}},"nodes":[{"children":["gate:G1","gate:G2","gateS:target"],"detail":{"checked_against":["the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields)"],"form":"powder","formula":"Na2O2","identity":"unresolved","known_phases":[],"missing":["known phases of the composition (outside the registry; Materials Project not consulted)","Materials Project energies (no key; never decisive for polymorphs)"],"novelty":"not found in the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields); no other database consulted","phase":null},"evidence":"n/a","execution":"completed","kind":"target","lab":null,"label":"Na2O2","node_id":"target","presentation_only":false,"ref":"target.json#target","science":"unresolved","stage":"M01"},{"children":[],"detail":{"findings":[],"rules":["R-G1-INPUT-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G1: PASS","node_id":"gate:G1","presentation_only":false,"ref":"target.json#gates/G1","science":"PASS","stage":"M01"},{"children":[],"detail":{"findings":[{"code":"IDENTITY_UNRESOLVED","message":"Na2O2 is outside the Mat2Bot v0.1 polymorph registry (KCl, CaCO3, ZnO, BaTiO3, and the ZnO competitors Zn(OH)2 and Zn5(OH)8(NO3)2(H2O)2; COD structures and cited stability fields)","rule":"R-G2-ID-001"}],"rules":["R-G2-ID-001","R-M01-ID-001","R-M01-PHASE-001"]},"evidence":"n/a","execution":"completed","kind":"claim","lab":null,"label":"Gate G2: UNKNOWN","node_id":"gate:G2","presentation_only":false,"ref":"target.json#gates/G2","science":"UNKNOWN","stage":"M01"},{"children":["hazard:target:Na2O2"],"detail":{"findings":[{"code":"HAZARD_HARD_FAIL","message":"sodium peroxide (Na2O2, product): H271 (harmonised): no unattended automated step may handle it; a person may, after G7"},{"code":"HAZARD_HUMAN_ONLY","message":"sodium peroxide (Na2O2, product): H314 (harmonised): a person handles it; G7 records it"},{"code":"HAZARD_UNKNOWN","message":"no reagent of this route is known, so their hazards are unknown; a person decides at G7"}],"what":"what handling the material demands; not a route verdict"},"evidence":"n/a","execution":"completed","kind":"hazard","lab":null,"label":"Handling the product (gate S on it alone): UNKNOWN","node_id":"gateS:target","presentation_only":false,"ref":"safety/target.json#gate","science":"UNKNOWN","stage":"M01"},{"children":[],"detail":{"codes":["H271","H314"],"demands":["hard_fail","human_only"],"harmonised":true,"pubchem_cid":14803,"url":"https://pubchem.ncbi.nlm.nih.gov/compound/14803#section=GHS-Classification"},"evidence":"verified","execution":"completed","kind":"hazard","lab":null,"label":"sodium peroxide (Na2O2): hard_fail, human_only","node_id":"hazard:target:Na2O2","presentation_only":false,"ref":"safety/target.json#substances/Na2O2","science":null,"stage":"M01"},{"children":[],"detail":{"code":"NO_SUPPORTED_FAMILY","message":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","rule":"R-M03-SCOPE-001","severity":"warning","subject":"Na2O2"},"evidence":"n/a","execution":"refused","kind":"finding","lab":null,"label":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly","node_id":"finding:0","presentation_only":false,"ref":"plan.json#findings/0","science":null,"stage":"M04"},{"children":["target","gate:G1","gate:G2","gateS:target","hazard:target:Na2O2"],"detail":{"events":[1,4],"how":"","message":"Na2O2: identity unresolved, phase unresolved; gates G1 PASS, G2 UNKNOWN; gate S on the product alone: UNKNOWN; Na2O2 H271, H314 (hard_fail/human_only)"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Target","node_id":"stage:M01","presentation_only":false,"ref":"trace.json#events/M01","science":null,"stage":"M01"},{"children":[],"detail":{"events":[2],"how":"","message":"no synthesis precedent of this composition in the evidence"},"evidence":"n/a","execution":"completed","kind":"stage","lab":null,"label":"Evidence","node_id":"stage:M02","presentation_only":false,"ref":"trace.json#events/M02","science":null,"stage":"M02"},{"children":["finding:0"],"detail":{"events":[3],"how":"","message":"no route for Na2O2 in the families Mat2Bot (milestone 1) plans (documented here: none in the evidence set); not planned rather than planned weakly"},"evidence":"n/a","execution":"refused","kind":"stage","lab":null,"label":"Routes","node_id":"stage:M04","presentation_only":false,"ref":"trace.json#events/M04","science":null,"stage":"M04"},{"children":[],"detail":{"events":[5],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Science","node_id":"stage:M05","presentation_only":false,"ref":"trace.json#events/M05","science":null,"stage":"M05"},{"children":[],"detail":{"events":[6],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"The case","node_id":"stage:M07","presentation_only":false,"ref":"trace.json#events/M07","science":null,"stage":"M07"},{"children":[],"detail":{"events":[7],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Procedure","node_id":"stage:M08","presentation_only":false,"ref":"trace.json#events/M08","science":null,"stage":"M08"},{"children":[],"detail":{"events":[8],"how":"","message":"not reached: no route candidate in Mat2Bot's planned families"},"evidence":"n/a","execution":"skipped","kind":"stage","lab":null,"label":"Laboratories","node_id":"stage:LAB","presentation_only":false,"ref":"trace.json#events/LAB","science":null,"stage":"LAB"},{"children":[],"detail":{"events":[],"how":"run `mat2bot audit <package>`; the result never comes from the package itself","message":"the package is audited after it is written: run the auditor, or a live audit fills this column"},"evidence":"n/a","execution":"not_run","kind":"stage","lab":null,"label":"Audit","node_id":"stage:AUDIT","presentation_only":false,"ref":"trace.json#nodes/stage:AUDIT","science":null,"stage":"AUDIT"}],"note":"A projection of the plan's records: every node names the record it shows and every edge a relationship that record holds; nothing here is computed anew. The audit stage is filled only by a live audit.","request_id":"x1","schema":"mat2bot/trace/1","title":"Sodium peroxide (Na2O2)"}</script><script id="trace-config" type="application/json">{"audit_url": "audit.json", "links": {"home": "../../index.html", "report": "report.html", "package": "package.zip"}, "mat2bot": "0.1.0"}</script><div id="trace-app" data-title="Sodium peroxide (Na2O2)"></div><script>/* Mat2Bot Trace viewer: a connected map of the plan's records (the stages with arrows, each stage's branches under
110
+ it), a components view (a stage's records as cards with their typed edges) and a provenance panel (one record),
111
+ over trace.json and nothing else. Every drawn node is a node of the trace and every drawn line an edge of it; the
112
+ audit column is filled only from a live audit the host gives (config.audit_url or config.audit). Plain JS, no library.
113
+ Standalone (trace.html) it keeps its place in the address bar; embedded (the one-box page) it keeps it in memory. */
114
  (function () {
115
  "use strict";
 
 
 
 
 
 
 
 
 
116
  const esc = (s) => String(s == null ? "" : s).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
117
  const WORDS = {
118
  execution: { completed: ["ran", "ok"], skipped: ["skipped", "off"], refused: ["stopped: refused", "warn"], failed: ["failed", "bad"], not_run: ["not run", "off"] },
 
130
  const KIND_WORDS = { stage: "stage", target: "the target", finding: "finding", route: "route", rival: "rejected route", claim: "claim", inference: "inference",
131
  evidence: "evidence", calculation: "calculation", model_output: "model", assumption: "assumption", doubt: "doubt", step: "step", hazard: "hazard",
132
  laboratory: "laboratory", capability: "equipment", grouping: "group" };
133
+ const STAGE_WORDS = { M01: "Target", M02: "Evidence", M04: "Routes", M05: "Science", M07: "The case", M08: "Procedure", LAB: "Laboratories", AUDIT: "Audit" };
134
  function chip(attr, value) {
135
  if (value == null || value === "n/a" || value === "") return "";
136
  const w = (WORDS[attr] || {})[value] || [String(value).replace(/_/g, " "), "acc"];
137
  return `<span class="chip ${w[1]}" title="${esc(attr)}: ${esc(value)}">${esc(w[0])}</span>`;
138
  }
139
+ function tone(n) {
140
+ if (n.execution === "refused" || n.execution === "failed") return "bad";
141
+ if (n.execution === "skipped" || n.execution === "not_run") return "off";
142
+ const s = n.science;
143
+ if (s) {
144
+ if (["FAIL", "BLOCKED", "sustained"].includes(s)) return "bad";
145
+ if (["UNKNOWN", "PARTIALLY_SUPPORTED", "HYPOTHETICAL", "open", "refused", "unresolved values"].includes(s)) return "warn";
146
+ if (["PASS", "STRONGLY_SUPPORTED", "eliminated"].includes(s)) return "ok";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
+ if (n.lab) { if (n.lab === "BLOCKED" || n.lab === "missing") return "bad"; if (n.lab === "INCOMPLETE") return "warn"; if (["FULLY_SUPPORTED", "HYBRID"].includes(n.lab)) return "ok"; }
149
+ if (n.evidence === "missing") return "bad";
150
+ if (n.evidence === "unverified") return "warn";
151
+ if (n.evidence === "verified") return "ok";
152
+ return "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  }
154
+
155
+ function mount(app, T, CFG) {
156
+ CFG = CFG || {};
157
+ const EMBEDDED = !!CFG.embedded;
158
+ const NODES = new Map(T.nodes.map((n) => [n.node_id, n]));
159
+ const STAGES = (T.layout && T.layout.columns) || ["M01", "M02", "M04", "M05", "M07", "M08", "LAB", "AUDIT"];
160
+ const STAGE_NODE = {};
161
+ T.nodes.forEach((n) => { if (n.kind === "stage") STAGE_NODE[n.stage] = n; });
162
+ const OUT = new Map(), IN = new Map();
163
+ T.edges.forEach((e) => { (OUT.get(e.source) || OUT.set(e.source, []).get(e.source)).push(e); (IN.get(e.target) || IN.set(e.target, []).get(e.target)).push(e); });
164
+ const chips = (n) => [chip("execution", n.kind === "stage" || n.execution !== "completed" ? n.execution : null), chip("science", n.science), chip("evidence", n.evidence), chip("lab", n.lab)].join("");
165
+ let AUDIT = CFG.audit && CFG.audit.verdict ? CFG.audit : null;
166
+ // ---------------------------------------------------------------- state: the address bar (standalone) or memory (embedded)
167
+ let S = { stage: "", node: "", cmp: [] };
168
+ function parse(h) {
169
+ const o = Object.fromEntries(h.replace(/^#/, "").split("&").filter(Boolean).map((kv) => kv.split("=").map(decodeURIComponent)));
170
+ return { stage: o.stage || "", node: o.node || "", cmp: (o.cmp || "").split(",").filter(Boolean) };
171
+ }
172
+ function state() { return EMBEDDED ? { ...S, cmp: [...S.cmp] } : parse(location.hash); }
173
+ function go(s) {
174
+ s = { stage: s.stage || "", node: s.node || "", cmp: s.cmp || [] };
175
+ if (EMBEDDED) { S = s; render(); return; }
176
+ const parts = [];
177
+ if (s.stage) parts.push("stage=" + encodeURIComponent(s.stage));
178
+ if (s.node) parts.push("node=" + encodeURIComponent(s.node));
179
+ if (s.cmp.length) parts.push("cmp=" + encodeURIComponent(s.cmp.join(",")));
180
+ const next = "#" + parts.join("&");
181
+ if (location.hash !== next) location.hash = next; else render();
182
+ }
183
+ // ---------------------------------------------------------------- the frame
184
+ function frame(s) {
185
+ const links = CFG.links || {};
186
+ const nav = Object.entries(links).map(([k, v]) => `<a href="${esc(v)}">${esc({ report: "Technical report", package: "Download the package", audit: "Audit it now", home: "Mat2Bot" }[k] || k)}</a>`).join("");
187
+ const tabs = [["", "Map"], ["__comp", "Components"], ["__prov", "Provenance"]];
188
+ const cur = s.node ? "__prov" : s.stage ? "__comp" : "";
189
+ const head = EMBEDDED ? "" : `<header class="tv-top"><h1>${esc(app.dataset.title || T.title || T.request_id)}: how Mat2Bot got there</h1><nav>${nav}</nav></header>
190
+ <p class="tv-sub">${esc(T.note)} Request <code>${esc(T.request_id)}</code>; ${T.nodes.length} records shown, ${T.edges.length} relationships, ${T.events.length} events.</p>`;
191
+ return head + `<div class="tv-tabs">${tabs.map(([k, l]) => `<button type="button" data-tab="${k}" ${cur === k ? 'aria-current="page"' : ""}>${l}</button>`).join("")}</div>`;
192
+ }
193
+ // ---------------------------------------------------------------- the map: a spine of stages with their branches
194
+ const NESTING = ["target", "route", "rival", "grouping", "hazard", "laboratory"];
195
+ function topLevel(stage) {
196
+ const all = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
197
+ const nested = new Set();
198
+ all.forEach((n) => { if (NESTING.includes(n.kind)) n.children.forEach((c) => nested.add(c)); });
199
+ return all.filter((n) => !nested.has(n.node_id));
200
+ }
201
+ const ORDER = { route: 0, rival: 1, target: 0, finding: 1, claim: 0, doubt: 1, assumption: 2, laboratory: 0, capability: 1, hazard: 2, calculation: 0, model_output: 1, grouping: 0, evidence: 0, step: 1 };
202
+ const DOUBT_ORDER = { sustained: 0, open: 1, eliminated: 2 };
203
+ function branches(stage) {
204
+ let ns = topLevel(stage);
205
+ if (stage === "M01") ns = [NODES.get("target"), ...(NODES.get("target") || { children: [] }).children.map((id) => NODES.get(id))].filter(Boolean);
206
+ if (stage === "M07") ns = ns.filter((n) => n.kind !== "claim" || !(n.detail && n.detail.template === "conditions-supported"));
207
+ return ns.slice().sort((a, b) => (ORDER[a.kind] ?? 5) - (ORDER[b.kind] ?? 5) || ((DOUBT_ORDER[a.science] ?? 3) - (DOUBT_ORDER[b.science] ?? 3)));
208
+ }
209
+ function shortLabel(n, max) {
210
+ let t = n.label;
211
+ if (n.kind === "route" || n.kind === "rival") t = ((n.detail && n.detail.precursors) || []).map((p) => p.split(" (")[0]).join(" + ") || t.replace(/^(Route \d+|Rejected): /, "");
212
+ if (n.kind === "laboratory") t = n.label;
213
+ if (n.kind === "doubt") t = t.replace(/ \(here:.*$/, "");
214
+ if (n.kind === "grouping") t = t.replace(/^Procedure of [^:]+: /, "Recipe: ");
215
+ t = t.replace(/^(Route \d+|Rejected): /, "");
216
+ return t.length > max ? t.slice(0, max - 1) + "…" : t;
217
+ }
218
+ function stageSummary(stage) {
219
+ const kids = (STAGE_NODE[stage] || { children: [] }).children.map((id) => NODES.get(id)).filter(Boolean);
220
+ const count = (f) => kids.filter(f).length;
221
+ if (stage === "M01") { const t = NODES.get("target"); return t ? shortLabel(t, 24) : ""; }
222
+ if (stage === "M02") return `${count((n) => n.kind === "evidence")} records`;
223
+ if (stage === "M04") return `${count((n) => n.kind === "route")} proposed, ${count((n) => n.kind === "rival")} set aside`;
224
+ if (stage === "M05") return `${count((n) => n.kind === "calculation")} numbers, ${count((n) => n.kind === "model_output" && n.execution === "refused")} refusals`;
225
+ if (stage === "M07") return `doubts: ${count((n) => n.science === "open")} open, ${count((n) => n.science === "eliminated")} ruled out`;
226
+ if (stage === "M08") return `${count((n) => n.kind === "step")} steps`;
227
+ if (stage === "LAB") return kids.filter((n) => n.kind === "laboratory").map((l) => l.label.split(":")[0]).join(", ") || "none asked";
228
+ if (stage === "AUDIT") return AUDIT ? `${AUDIT.verdict}: ${AUDIT.checks.filter((c) => c.verdict === "PASS").length} checks passed` : "not run";
229
+ return "";
230
+ }
231
+ function mapView() {
232
+ const narrow = app.clientWidth < 720;
233
+ const maxKids = narrow ? 4 : 6;
234
+ const colW = 156, boxH = 60, kidH = 34, gapY = 12, gapX = 18, top = 8;
235
+ const cols = STAGES.map((st) => {
236
+ const n = STAGE_NODE[st] || { label: STAGE_WORDS[st] || st, execution: "not_run", children: [] };
237
+ const kids = st === "AUDIT" ? [] : branches(st);
238
+ return { st, n, kids: kids.slice(0, maxKids), more: Math.max(0, kids.length - maxKids), total: kids.length };
239
+ });
240
+ const parts = [];
241
+ const node = (x, y, w, h, cls, attrs, title, lines, sub) => `<g class="mnode ${cls}" ${attrs} tabindex="0" role="button"><title>${esc(title)}</title>
242
+ <rect x="${x}" y="${y}" width="${w}" height="${h}" rx="9"></rect>
243
+ <text x="${x + 9}" y="${y + 20}">${esc(lines[0])}</text>${lines[1] ? `<text class="sub" x="${x + 9}" y="${y + 38}">${esc(lines[1])}</text>` : ""}${sub ? `<text class="sub2" x="${x + 9}" y="${y + h - 8}">${esc(sub)}</text>` : ""}</g>`;
244
+ let W, H;
245
+ if (!narrow) {
246
+ W = STAGES.length * colW + (STAGES.length - 1) * gapX;
247
+ const rows = Math.max(...cols.map((c) => c.kids.length + (c.more ? 1 : 0)), 1);
248
+ H = top + boxH + 26 + rows * (kidH + gapY) + 8;
249
+ cols.forEach((c, i) => {
250
+ const x = i * (colW + gapX);
251
+ const ex = c.st === "AUDIT" && AUDIT ? (AUDIT.verdict === "PASS" ? "completed" : "failed") : c.n.execution;
252
+ const w = (WORDS.execution[ex] || [ex, "off"]);
253
+ parts.push(node(x, top, colW, boxH, `stage tone-${w[1]}`, `data-stage="${esc(c.st)}"`, `${c.n.label}: ${c.n.detail && c.n.detail.message || ""}`, [STAGE_WORDS[c.st] || c.st, w[0]], stageSummary(c.st)));
254
+ if (i < cols.length - 1) parts.push(`<path class="spine" d="M${x + colW},${top + boxH / 2} L${x + colW + gapX - 4},${top + boxH / 2}" marker-end="url(#arrow)"></path>`);
255
+ let y = top + boxH + 26;
256
+ c.kids.forEach((k) => {
257
+ parts.push(`<path class="branch" d="M${x + 18},${top + boxH} L${x + 18},${y + kidH / 2} L${x + 30},${y + kidH / 2}"></path>`);
258
+ parts.push(node(x + 30, y, colW - 30, kidH, `kid tone-${tone(k)}`, `data-node="${esc(k.node_id)}"`, k.label, [shortLabel(k, 17)], ""));
259
+ y += kidH + gapY;
260
+ });
261
+ if (c.more) {
262
+ parts.push(`<path class="branch" d="M${x + 18},${top + boxH} L${x + 18},${y + kidH / 2} L${x + 30},${y + kidH / 2}"></path>`);
263
+ parts.push(node(x + 30, y, colW - 30, kidH, "kid more", `data-stage="${esc(c.st)}"`, `${c.total} in this stage`, [`+${c.more} more…`], ""));
264
+ }
265
+ });
266
+ } else {
267
+ W = Math.max(app.clientWidth - 24, 300); // inside the box's padding
268
+ const sx = 12, bx = 34, kx = 56; // the spine at the left edge, the branches beside it, the boxes after
269
+ const kidW = W - kx;
270
+ let y = top;
271
+ cols.forEach((c, i) => {
272
+ const ex = c.st === "AUDIT" && AUDIT ? (AUDIT.verdict === "PASS" ? "completed" : "failed") : c.n.execution;
273
+ const w = (WORDS.execution[ex] || [ex, "off"]);
274
+ parts.push(node(bx - 10, y, W - (bx - 10), boxH, `stage tone-${w[1]}`, `data-stage="${esc(c.st)}"`, `${c.n.label}: ${c.n.detail && c.n.detail.message || ""}`, [`${STAGE_WORDS[c.st] || c.st}: ${w[0]}`], stageSummary(c.st)));
275
+ let ky = y + boxH + gapY;
276
+ c.kids.forEach((k) => {
277
+ parts.push(`<path class="branch" d="M${bx},${y + boxH} L${bx},${ky + kidH / 2} L${kx},${ky + kidH / 2}"></path>`);
278
+ parts.push(node(kx, ky, kidW, kidH, `kid tone-${tone(k)}`, `data-node="${esc(k.node_id)}"`, k.label, [shortLabel(k, 40)], ""));
279
+ ky += kidH + gapY;
280
+ });
281
+ if (c.more) {
282
+ parts.push(`<path class="branch" d="M${bx},${y + boxH} L${bx},${ky + kidH / 2} L${kx},${ky + kidH / 2}"></path>`);
283
+ parts.push(node(kx, ky, kidW, kidH, "kid more", `data-stage="${esc(c.st)}"`, `${c.total} in this stage`, [`+${c.more} more…`], ""));
284
+ ky += kidH + gapY;
285
+ }
286
+ if (i < cols.length - 1) parts.push(`<path class="spine" d="M${sx},${y + boxH / 2} L${sx},${ky + 8}" marker-end="url(#arrow)"></path>`);
287
+ y = ky + 18;
288
+ });
289
+ H = y;
290
+ }
291
+ const legend = `<p class="tv-legend"><span><i class="box ok"></i> holds / verified / can run</span><span><i class="box warn"></i> open, caveat, not ready</span><span><i class="box bad"></i> fails, rejected, confirmed doubt, missing</span><span><i class="box off"></i> skipped or not run</span><span>Click a box to open it.</span></p>`;
292
+ return `<div class="tv-map"><svg viewBox="0 0 ${W} ${H}" width="${W}" height="${H}" role="img" aria-label="the stages Mat2Bot ran, with each stage's records"><defs><marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z"></path></marker></defs>${parts.join("")}</svg></div>` + legend;
293
+ }
294
+ function overview() {
295
+ const ev = T.events.map((e) => `<li class="${e.status}"><span class="seq">${e.seq}</span><span>${esc(e.stage)}</span><span>${esc(e.name)}${e.subject ? ` <small>(${esc(e.subject)})</small>` : ""}<span class="msg">${esc(e.message)}</span></span>${chip("execution", e.status)}</li>`).join("");
296
+ return mapView() + `<details class="tv-timeline"><summary>What ran, in order (${T.events.length} events)</summary><ol class="tv-events">${ev || '<li><span class="tv-empty">no events recorded</span></li>'}</ol>
297
+ <p class="tv-sub">Times are the run's own clock (a fixed clock in a reproducible package). A skipped stage was not reached; a refused one stopped on purpose.</p></details>`;
298
+ }
299
+ // ---------------------------------------------------------------- component view
300
+ function groupsOf(stage) {
301
+ const kids = topLevel(stage);
302
+ const byRoute = new Map();
303
+ kids.forEach((n) => { const r = n.detail && n.detail.route; const key = r ? "route " + r : ""; (byRoute.get(key) || byRoute.set(key, []).get(key)).push(n); });
304
+ return [...byRoute.entries()];
305
+ }
306
+ function short(n) { return n ? (n.label.length > 48 ? n.label.slice(0, 46) + "…" : n.label) : "?"; }
307
+ function relChips(n, visible) {
308
+ const out = [];
309
+ (OUT.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.target)) out.push(`<a href="#node=${encodeURIComponent(e.target)}">${esc(EDGE_WORDS[e.kind])}: ${esc(short(NODES.get(e.target)))}</a>`); });
310
+ (IN.get(n.node_id) || []).forEach((e) => { if (!visible.has(e.source) && e.kind !== "cites") out.push(`<a href="#node=${encodeURIComponent(e.source)}">${esc(short(NODES.get(e.source)))} ${esc(EDGE_WORDS[e.kind])} this</a>`); });
311
+ return out.length ? `<div class="rel">${out.slice(0, 6).join(" · ")}${out.length > 6 ? ` · +${out.length - 6}` : ""}</div>` : "";
312
+ }
313
+ function card(n, visible, s, depth) {
314
+ const kidsShown = depth < 1 && n.children.length && NESTING.includes(n.kind) ? n.children : [];
315
+ const acts = [];
316
+ if (n.kind === "rival") acts.push(`<button type="button" data-why="${esc(n.node_id)}">Why was it rejected?</button>`);
317
+ if (n.kind === "route") acts.push(`<button type="button" data-cmp="${esc(n.node_id)}">${(s.cmp || []).includes(n.node_id) ? "Comparing ✓" : "Compare"}</button>`);
318
+ if (n.children.length && !kidsShown.length) acts.push(`<button type="button" data-open="${esc(n.node_id)}">Show ${n.children.length} inside</button>`);
319
+ acts.push(`<a href="#node=${encodeURIComponent(n.node_id)}">Details</a>`);
320
+ return `<div class="tv-card" data-id="${esc(n.node_id)}"><span class="k">${esc(KIND_WORDS[n.kind] || n.kind)}</span>
321
+ <button type="button" class="lbl" data-node="${esc(n.node_id)}">${esc(n.label)}</button><div class="chips">${chips(n)}</div>${relChips(n, visible)}
322
+ <div class="acts">${acts.join("")}</div>${kidsShown.length ? `<div class="tv-kids">${kidsShown.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, visible, s, depth + 1)).join("")}</div>` : ""}</div>`;
323
+ }
324
+ function component(s) {
325
+ const st = s.stage;
326
+ const groups = groupsOf(st);
327
+ const visible = new Set();
328
+ groups.forEach(([, ns]) => ns.forEach((n) => { visible.add(n.node_id); n.children.forEach((c) => visible.add(c)); }));
329
+ const stn = STAGE_NODE[st];
330
+ const head = `<p class="tv-crumb"><a href="#">Map</a> › ${esc(stn ? stn.label : st)} ${chip("execution", stn ? stn.execution : "not_run")}${stn && stn.detail.message ? `<br><small>${esc(stn.detail.message)}</small>` : ""}</p>`;
331
+ if (st === "AUDIT") return head + auditView();
332
+ if (!groups.length) return head + `<p class="tv-empty">Nothing was recorded for this stage${stn && stn.execution === "skipped" ? ": it was skipped" : ""}.</p>`;
333
+ const body = groups.map(([g, ns]) => `<div class="tv-group">${g ? `<h3>${esc(g)}</h3>` : ""}<div class="tv-cards">${ns.map((n) => card(n, visible, s, 0)).join("")}</div></div>`).join("");
334
+ return head + legend() + `<div class="tv-comp"><svg class="tv-edges" aria-hidden="true"></svg><div class="tv-groups">${body}</div></div>` + compare(s);
335
+ }
336
+ function legend() {
337
+ return `<p class="tv-legend"><span><i></i> rests on / cites / computed from</span><span><i class="bad dash"></i> doubted by</span><span><i class="ok dot"></i> settled by</span>
338
+ <span><i class="bad"></i> rejected because</span><span><i class="muted"></i> comes after</span><span><i class="muted dot"></i> done with</span><span><i class="bad dash"></i> needs equipment</span></p>`;
339
+ }
340
+ function auditView() {
341
+ if (!AUDIT) return `<p class="tv-empty">The package does not carry an audit of itself. ${CFG.audit_url ? "The live audit is loading…" : "Run <code>mat2bot audit &lt;package&gt;</code> to re-derive every claim from the files alone."}</p>`;
342
+ return `<p>${esc(AUDIT.when || "")}: <b>${esc(AUDIT.verdict)}</b>${CFG.links && CFG.links.audit ? ` · <a href="${esc(CFG.links.audit)}">the full audit page</a>` : ""}</p>
343
+ <ul class="tv-audit">${AUDIT.checks.map((c) => `<li>${chip("science", c.verdict === "UNKNOWN" ? "UNKNOWN" : c.verdict)} ${esc(c.name)}${c.detail ? ` <small>— ${esc(c.detail)}</small>` : ""}</li>`).join("")}</ul>`;
344
+ }
345
+ function drawEdges() {
346
+ const svg = app.querySelector("svg.tv-edges");
347
+ if (!svg) return;
348
+ const box = svg.parentElement.getBoundingClientRect();
349
+ const at = (id) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(id)}"]`); if (!el) return null; const r = el.getBoundingClientRect(); return { x: r.left - box.left + r.width / 2, y: r.top - box.top + r.height / 2 }; };
350
+ const paths = [];
351
+ T.edges.forEach((e) => {
352
+ const a = at(e.source), b = at(e.target);
353
+ if (!a || !b) return;
354
+ const mx = (a.x + b.x) / 2;
355
+ paths.push(`<path class="${e.kind}" data-s="${esc(e.source)}" data-t="${esc(e.target)}" d="M${a.x},${a.y} C${mx},${a.y} ${mx},${b.y} ${b.x},${b.y}"><title>${esc(EDGE_WORDS[e.kind])}${e.label ? ": " + esc(e.label) : ""}</title></path>`);
356
+ });
357
+ svg.setAttribute("viewBox", `0 0 ${box.width} ${box.height}`);
358
+ svg.innerHTML = paths.join("");
359
+ }
360
+ function highlight(id, on) {
361
+ app.querySelectorAll("svg.tv-edges path").forEach((p) => { if (p.dataset.s === id || p.dataset.t === id) p.classList.toggle("hl", on); });
362
+ }
363
+ function why(id) {
364
+ app.querySelectorAll(".tv-card.hl").forEach((c) => c.classList.remove("hl"));
365
+ const targets = (OUT.get(id) || []).filter((e) => e.kind === "rejected_for").map((e) => e.target);
366
+ let first = null;
367
+ targets.forEach((t) => { const el = app.querySelector(`.tv-card[data-id="${CSS.escape(t)}"]`); if (el) { el.classList.add("hl"); first = first || el; } });
368
+ highlight(id, true);
369
+ if (first) first.scrollIntoView({ block: "center", behavior: "smooth" });
370
+ else if (targets.length) go({ stage: state().stage, node: targets[0] });
371
+ }
372
+ function compare(s) {
373
+ const ids = (s.cmp || []).slice(0, 2).map((id) => NODES.get(id)).filter(Boolean);
374
+ if (ids.length < 2) return ids.length === 1 ? `<p class="tv-sub">Pick a second route to compare with ${esc(short(ids[0]))}.</p>` : "";
375
+ const row = (name, f) => `<tr><th>${name}</th>${ids.map((n) => `<td>${f(n)}</td>`).join("")}</tr>`;
376
+ const doubts = (n) => T.nodes.filter((d) => d.kind === "doubt" && d.detail.route === n.detail.route && d.science === "open").map((d) => esc(d.label)).join("<br>") || "none open";
377
+ const labs = (n) => T.nodes.filter((l) => l.kind === "laboratory" && l.detail.route === n.detail.route).map((l) => esc(l.label)).join("<br>") || "–";
378
+ return `<div class="tv-compare"><h3>Side by side</h3><table><thead><tr><th></th>${ids.map((n) => `<th>${esc(short(n))}</th>`).join("")}</tr></thead><tbody>
379
+ ${row("Support", (n) => chip("science", n.science) + ` <small>${esc(n.detail.row)}</small>`)}
380
+ ${row("Precedent", (n) => esc(n.detail.precedent))}
381
+ ${row("Reagents", (n) => (n.detail.precursors || []).map(esc).join("<br>"))}
382
+ ${row("Conditions", (n) => Object.entries(n.detail.parameters || {}).map(([k, v]) => `${esc(k)} = ${esc(v)}`).join("<br>") || "none stated")}
383
+ ${row("Equipment", (n) => (n.detail.equipment || []).map(esc).join("<br>"))}
384
+ ${row("Open doubts", doubts)}${row("Laboratories", labs)}</tbody></table>
385
+ <p><button type="button" data-cmp-clear="1">Clear</button></p></div>`;
386
+ }
387
+ // ---------------------------------------------------------------- provenance panel
388
+ function link(url, text) { return url && /^https?:\/\//.test(url) ? `<a href="${esc(url)}" rel="noopener" target="_blank">${esc(text || url)}</a>` : esc(text || url || ""); }
389
+ function value(d) {
390
+ if (d.value == null && !("unit" in d)) return "";
391
+ const u = d.uncertainty;
392
+ return `<p class="num">${d.value == null ? "unresolved" : esc(Number(d.value).toPrecision(5).replace(/\.?0+$/, ""))} ${esc(d.unit || "")}${u ? ` ± ${esc(Number(u.expanded).toPrecision(2))} (k = ${esc(u.k)})` : ""}</p>
393
+ <dl>${d.method ? `<dt>method</dt><dd><code>${esc(d.method)}</code></dd>` : ""}${d.basis ? `<dt>basis</dt><dd>${esc(d.basis)}</dd>` : ""}<dt>provenance</dt><dd>${esc(d.provenance)}</dd>
394
+ ${u ? `<dt>uncertainty</dt><dd>u = ${esc(Number(u.u).toPrecision(3))}, type ${esc(u.type)}; ${esc(u.basis)}</dd>` : ""}${d.domain ? `<dt>valid for</dt><dd><code>${esc(JSON.stringify(d.domain))}</code></dd>` : ""}
395
+ ${d.note ? `<dt>note</dt><dd>${esc(d.note)}</dd>` : ""}</dl>${(d.sources || []).length ? `<h3>Sources</h3><ul>${d.sources.map((s) => `<li>${esc(s.citation || s.id)}${s.id && s.kind === "doi" ? " · " + link("https://doi.org/" + s.id, "doi:" + s.id) : s.url ? " · " + link(s.url, "source") : ""}${s.quote ? `<blockquote>${esc(s.quote)}</blockquote>` : ""}</li>`).join("")}</ul>` : ""}`;
396
+ }
397
+ function generic(d, skip) {
398
+ const rows = Object.entries(d).filter(([k, v]) => !skip.includes(k) && v != null && v !== "" && !(Array.isArray(v) && !v.length) && !(typeof v === "object" && !Array.isArray(v) && !Object.keys(v).length));
399
+ if (!rows.length) return "";
400
+ return `<dl>${rows.map(([k, v]) => `<dt>${esc(k.replace(/_/g, " "))}</dt><dd>${fmt(v)}</dd>`).join("")}</dl>`;
401
+ }
402
+ function fmt(v) {
403
+ if (Array.isArray(v)) return `<ul>${v.map((x) => `<li>${typeof x === "object" ? fmt(x) : esc(x)}</li>`).join("")}</ul>`;
404
+ if (typeof v === "object") return `<dl>${Object.entries(v).map(([k, x]) => `<dt>${esc(k)}</dt><dd>${fmt(x)}</dd>`).join("")}</dl>`;
405
+ if (typeof v === "string" && /^https?:\/\//.test(v)) return link(v);
406
+ if (typeof v === "string" && /^R-[A-Z0-9-]+-\d{3}$/.test(v)) return `<code>${esc(v)}</code>`;
407
+ return esc(v);
408
+ }
409
+ function panel(id) {
410
+ const n = NODES.get(id);
411
+ if (!n) return `<aside class="tv-panel"><button type="button" class="close" data-close="1">Close</button><h2>No such record</h2><p>${esc(id)} is not in this trace.</p></aside>`;
412
+ const d = n.detail || {};
413
+ let body = "";
414
+ if (n.kind === "calculation" && "value" in d) body = value(d);
415
+ else if (n.kind === "evidence") body = `${d.claim ? `<p>${esc(d.claim)}</p>` : ""}<dl>${d.citation ? `<dt>citation</dt><dd>${esc(d.citation)}</dd>` : ""}${d.doi ? `<dt>doi</dt><dd>${link("https://doi.org/" + d.doi, d.doi)}</dd>` : d.url ? `<dt>source</dt><dd>${link(d.url)}</dd>` : ""}${d.licence ? `<dt>licence</dt><dd>${esc(d.licence)}</dd>` : ""}${d.locator ? `<dt>where</dt><dd>${esc(d.locator)}</dd>` : ""}</dl>${d.quote ? `<h3>Quoted</h3><blockquote>${esc(d.quote)}</blockquote>` : ""}${generic(d, ["claim", "citation", "doi", "url", "licence", "locator", "quote", "kind", "evidence_id"])}`;
416
+ else if (n.kind === "doubt") body = `<p>${esc(d.statement)}</p><dl><dt>kind</dt><dd>${esc(d.kind)} doubt</dd><dt>status</dt><dd>${chip("science", d.status)}</dd><dt>rule</dt><dd><code>${esc(d.rule)}</code></dd>${d.closable_by ? `<dt>closed only by</dt><dd>${esc(d.closable_by)}</dd>` : ""}<dt>critical</dt><dd>${d.critical ? "yes" : "no"}</dd></dl>`;
417
+ else body = generic(d, ["route"]);
418
+ const rel = (edges, dir) => edges.map((e) => { const o = NODES.get(dir === "out" ? e.target : e.source); return o ? `<li><a href="#node=${encodeURIComponent(o.node_id)}">${esc(short(o))}</a> <small>(${esc(EDGE_WORDS[e.kind])}${e.label ? ", " + esc(e.label) : ""})</small></li>` : ""; }).join("");
419
+ const outs = OUT.get(id) || [], ins = IN.get(id) || [];
420
+ const q = [["What it rests on", outs.filter((e) => ["supported_by", "computed_from", "cites", "resolved_by", "depends_on", "mapped_to", "requires_equipment", "rejected_for"].includes(e.kind)), "out"],
421
+ ["What rests on it, or questions it", ins, "in"]];
422
+ return `<aside class="tv-panel" role="dialog" aria-label="record"><button type="button" class="close" data-close="1">Close</button>
423
+ <span class="k">${esc(KIND_WORDS[n.kind] || n.kind)} · stage ${esc(n.stage)}${d.route ? ` · route ${esc(d.route)}` : ""}</span><h2>${esc(n.label)}</h2><div class="chips">${chips(n)}</div>
424
+ ${body}${q.map(([t, es, dir]) => es.length ? `<h3>${t}</h3><ul>${rel(es, dir)}</ul>` : "").join("")}
425
+ ${n.children.length ? `<h3>Inside</h3><ul>${n.children.map((c) => NODES.get(c)).filter(Boolean).map((c) => `<li><a href="#node=${encodeURIComponent(c.node_id)}">${esc(short(c))}</a> ${chips(c)}</li>`).join("")}</ul>` : ""}
426
+ <h3>Where it is recorded</h3><p><code>${esc(n.ref || "a presentation-only group")}</code>${n.presentation_only ? " (a grouping, not a record)" : ""}</p></aside>`;
427
+ }
428
+ // ---------------------------------------------------------------- render and events
429
+ function render() {
430
+ const s = state();
431
+ app.innerHTML = frame(s) + (s.stage ? component(s) : overview(s)) + (s.node ? panel(s.node) : "");
432
+ if (s.stage) requestAnimationFrame(drawEdges);
433
+ if (s.node) {
434
+ const el = app.querySelector(`.tv-card[data-id="${CSS.escape(s.node)}"]`);
435
+ if (el) { el.classList.add("sel"); highlight(s.node, true); }
436
+ const g = app.querySelector(`g.mnode[data-node="${CSS.escape(s.node)}"]`);
437
+ if (g) g.classList.add("sel");
438
+ }
439
+ }
440
+ app.addEventListener("click", (ev) => {
441
+ const b = ev.target.closest("[data-tab],[data-stage],[data-node],[data-why],[data-open],[data-cmp],[data-cmp-clear],[data-close],a[href^='#']");
442
+ if (!b || !app.contains(b)) return;
443
+ const s = state();
444
+ if (b.dataset.tab != null) { ev.preventDefault(); if (b.dataset.tab === "") go({}); else if (b.dataset.tab === "__comp") go({ stage: s.stage || STAGES[0], cmp: s.cmp }); else go({ stage: s.stage || (s.node ? NODES.get(s.node).stage : STAGES[0]), node: s.node || ((STAGE_NODE[s.stage || STAGES[0]] || { children: [] }).children[0] || "target"), cmp: s.cmp }); return; }
445
+ if (b.dataset.stage) { ev.preventDefault(); go({ stage: b.dataset.stage }); return; }
446
+ if (b.dataset.node) { ev.preventDefault(); go({ stage: s.stage, node: b.dataset.node, cmp: s.cmp }); return; }
447
+ if (b.dataset.why) { why(b.dataset.why); return; }
448
+ if (b.dataset.open) { b.outerHTML = `<div class="tv-kids">${NODES.get(b.dataset.open).children.map((id) => NODES.get(id)).filter(Boolean).map((k) => card(k, new Set(T.nodes.map((n) => n.node_id)), s, 1)).join("")}</div>`; requestAnimationFrame(drawEdges); return; }
449
+ if (b.dataset.cmp) { const c = s.cmp.includes(b.dataset.cmp) ? s.cmp.filter((x) => x !== b.dataset.cmp) : [...s.cmp, b.dataset.cmp].slice(-2); go({ stage: s.stage, node: s.node, cmp: c }); return; }
450
+ if (b.dataset.cmpClear) { go({ stage: s.stage, node: s.node, cmp: [] }); return; }
451
+ if (b.dataset.close) { go({ stage: s.stage, cmp: s.cmp }); return; }
452
+ if (b.tagName === "A" && b.getAttribute("href").startsWith("#")) { ev.preventDefault(); const h = b.getAttribute("href"); const t = parse(h); go({ ...t, stage: t.stage || s.stage, cmp: t.cmp.length ? t.cmp : s.cmp }); }
453
  });
454
+ app.addEventListener("keydown", (ev) => { if ((ev.key === "Enter" || ev.key === " ") && ev.target.closest("g.mnode")) { ev.preventDefault(); ev.target.closest("g.mnode").dispatchEvent(new MouseEvent("click", { bubbles: true })); } });
455
+ app.addEventListener("mouseover", (ev) => { const c = ev.target.closest(".tv-card"); if (c) highlight(c.dataset.id, true); });
456
+ app.addEventListener("mouseout", (ev) => { const c = ev.target.closest(".tv-card"); if (c && c.dataset.id !== state().node) highlight(c.dataset.id, false); });
457
+ if (!EMBEDDED) window.addEventListener("hashchange", render);
458
+ window.addEventListener("resize", () => requestAnimationFrame(() => { if (state().stage) drawEdges(); else render(); }));
459
+ document.addEventListener("keydown", (ev) => { if (ev.key === "Escape" && state().node) { const s = state(); go({ stage: s.stage, cmp: s.cmp }); } });
460
+ render();
461
+ if (CFG.audit_url && !AUDIT) {
462
+ fetch(CFG.audit_url, { cache: "no-store" }).then((r) => (r.ok ? r.json() : null)).then((a) => {
463
+ if (a && a.verdict && Array.isArray(a.checks)) { AUDIT = a; render(); }
464
+ }).catch(() => {});
465
+ }
466
+ return { render, go, setAudit(a) { AUDIT = a; render(); } };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
467
  }
468
+
469
+ window.Mat2BotTrace = { mount };
470
+ const el = document.getElementById("trace-app");
471
+ const data = document.getElementById("trace");
472
+ if (el && data) {
473
+ const cfgEl = document.getElementById("trace-config");
474
+ mount(el, JSON.parse(data.textContent), JSON.parse((cfgEl && cfgEl.textContent) || "{}"));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  }
476
  })();
477
  </script></body></html>
cases/x2_caco3_vaterite/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d70c5fbab2c4323317fbd296a405210a6beeeab75fca1d8126713f2713b17128
3
- size 232341
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4850a6f1fa94375eb1f1d4f05b84c66fce0d80d45b95d6f675cb9a111672b9e
3
+ size 234870
cases/x2_caco3_vaterite/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
cases/x3_caco3_aragonite/package.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2e076acf5b5bcebd825c4f95e27eb885e8f5f33154eda242f414cda1ffca0476
3
- size 215262
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dcbf5cb4ef36e0f1f4e72de32acfa2abec3a00933f901e3890cd80ac7179cf43
3
+ size 217765
cases/x3_caco3_aragonite/trace.html CHANGED
The diff for this file is too large to render. See raw diff
 
data/site.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "version": "0.1.0",
3
- "commit": "e8595f4",
4
  "built": "2026-10-27",
5
  "evaluation": {
6
  "total": 73,
 
1
  {
2
  "version": "0.1.0",
3
+ "commit": "53965be",
4
  "built": "2026-10-27",
5
  "evaluation": {
6
  "total": 73,
index.html CHANGED
@@ -15,6 +15,7 @@
15
  <header class="top">
16
  <a class="brand" href="#top" aria-label="Mat2Bot Explorer, back to the top"><span class="gem" aria-hidden="true"></span>Mat2Bot <em>Explorer</em></a>
17
  <nav aria-label="Sections">
 
18
  <a href="#how">How it works</a>
19
  <a href="#cases">Test cases</a>
20
  <a href="#honesty">Can you trust it?</a>
 
15
  <header class="top">
16
  <a class="brand" href="#top" aria-label="Mat2Bot Explorer, back to the top"><span class="gem" aria-hidden="true"></span>Mat2Bot <em>Explorer</em></a>
17
  <nav aria-label="Sections">
18
+ <a href="https://babu09-mat2bot-ask.hf.space" class="ask">Ask about a material</a>
19
  <a href="#how">How it works</a>
20
  <a href="#cases">Test cases</a>
21
  <a href="#honesty">Can you trust it?</a>
style.css CHANGED
@@ -286,3 +286,6 @@ details summary { cursor: pointer; color: var(--brand); font-weight: 600; font-s
286
  .trail-strip li.bad { border-color: var(--blocked); }
287
  .trail-strip li.off { opacity: .7; }
288
  .muted { color: var(--muted); }
 
 
 
 
286
  .trail-strip li.bad { border-color: var(--blocked); }
287
  .trail-strip li.off { opacity: .7; }
288
  .muted { color: var(--muted); }
289
+
290
+ /* the link to the one-box page */
291
+ .top nav a.ask { border: 1px solid var(--brand); border-radius: 999px; padding: 4px 12px; color: var(--brand); font-weight: 700; }