@intentius/behold 0.29.40 → 0.29.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/AGENTS.md +180 -10
  2. package/README.md +6 -2
  3. package/dist/cli.js +16121 -13141
  4. package/example-writes/README.md +1 -1
  5. package/example-writes/chant.config.ts +0 -6
  6. package/package.json +5 -2
  7. package/web/app.js +327 -21
  8. package/web/carve-export.js +142 -0
  9. package/web/carve-narration.js +294 -0
  10. package/web/carve-narration.test.js +48 -0
  11. package/web/change-set-overlay.js +147 -0
  12. package/web/change-set-overlay.test.js +83 -0
  13. package/web/dots-border.js +66 -0
  14. package/web/dots-border.test.js +27 -0
  15. package/web/dots-kiosk.js +279 -0
  16. package/web/dots-kiosk.test.js +60 -0
  17. package/web/dots-layout.d.ts +10 -0
  18. package/web/dots-layout.js +201 -0
  19. package/web/dots-live.js +316 -0
  20. package/web/dots-live.test.js +220 -0
  21. package/web/dots-lod.js +122 -0
  22. package/web/dots-lod.test.js +78 -0
  23. package/web/dots-recording.d.ts +7 -0
  24. package/web/dots-recording.js +247 -0
  25. package/web/dots-recording.test.js +71 -0
  26. package/web/dots-scene.js +294 -0
  27. package/web/dots-scene.test.js +118 -0
  28. package/web/dots-timeline.js +128 -0
  29. package/web/dots-timeline.test.js +83 -0
  30. package/web/dots-tour.js +153 -0
  31. package/web/dots.js +2124 -0
  32. package/web/dots.test.js +15 -0
  33. package/web/event-help-modal.js +1 -1
  34. package/web/index.html +215 -121
  35. package/web/kiosk-carve.js +225 -0
  36. package/web/kiosk-carve.test.js +26 -0
  37. package/web/kiosk-event-help-ui.js +7 -1
  38. package/web/kiosk-link.js +68 -0
  39. package/web/kiosk-link.test.js +69 -0
  40. package/web/kiosk-metrics.js +2 -2
  41. package/web/kiosk-trace.js +1 -1
  42. package/web/kiosk.html +186 -135
  43. package/web/kiosk.js +65 -7
  44. package/web/motion.js +42 -0
  45. package/web/motion.test.js +64 -0
  46. package/web/operator.js +1 -1
  47. package/web/run-playhead.js +102 -19
  48. package/web/run-playhead.test.js +81 -11
  49. package/web/terralith.html +2 -2
  50. package/web/theme.js +99 -26
  51. package/web/theme.test.js +70 -6
  52. package/web/tooltip.js +212 -0
  53. package/web/tooltip.test.js +193 -0
  54. package/web/tour-player.js +204 -0
  55. package/web/tour-player.test.js +115 -0
  56. package/web/tours/behold.tour.v1.schema.json +182 -0
  57. package/web/tours/terralith.json +330 -0
  58. package/web/trunk-lane.js +406 -0
  59. package/web/trunk-lane.test.js +224 -0
  60. package/web/workspace-gates.js +29 -4
  61. package/web/workspace-gates.test.js +23 -2
@@ -69,7 +69,7 @@ npm run dev -- serve example-writes --env prod
69
69
 
70
70
  `prod-apply` here is additive and ungated, so Sync applies in one click. Make it
71
71
  gated and Sync starts the Op but **pauses** at an approval gate — behold then shows
72
- an **Approve** button that signals the gate (a durable Temporal wait). Authority for
72
+ an **Approve** button that signals the gate (a durable wait in the run). Authority for
73
73
  the destructive step stays with a human:
74
74
 
75
75
  ```ts
@@ -1,12 +1,6 @@
1
- import type { TemporalChantConfig } from "@intentius/chant-lexicon-temporal";
2
-
3
1
  export default {
4
2
  lexicons: ["aws"],
5
3
  sourceDir: "src",
6
4
  environments: ["prod"],
7
5
  ownership: { stack: "behold-writes", env: "prod" },
8
- temporal: {
9
- profiles: { prod: { address: "localhost:7233", namespace: "default", taskQueue: "behold-writes", autoStart: true } },
10
- defaultProfile: "prod",
11
- } satisfies TemporalChantConfig,
12
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/behold",
3
- "version": "0.29.40",
3
+ "version": "0.29.42",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
@@ -34,6 +34,9 @@
34
34
  "demo": "npm --prefix example-writes install && tsx src/cli.ts serve example-writes --local --env prod",
35
35
  "demo:k8s": "bash example-k8s/scripts/local/local-up.sh; npm --prefix example-k8s install && tsx src/cli.ts serve example-k8s --local --env local; bash example-k8s/scripts/local/local-down.sh",
36
36
  "smoke:ui": "tsx smoke/ui-smoke.mjs",
37
+ "preview:dots": "tsx scripts/dots-preview.ts",
38
+ "export:carve": "tsx scripts/export-carve.ts",
39
+ "preview:carve": "tsx scripts/export-carve.ts && node scripts/serve-static.mjs dist-carve 4712",
37
40
  "tsc": "tsc --noEmit",
38
41
  "test": "vitest run",
39
42
  "build": "esbuild src/cli.ts --bundle --platform=node --format=esm --external:hono --external:@hono/node-server --external:@intentius/pinhole --external:@kubernetes/client-node --external:ajv --outfile=dist/cli.js && chmod +x dist/cli.js",
@@ -42,7 +45,7 @@
42
45
  },
43
46
  "dependencies": {
44
47
  "@hono/node-server": "^2.0.5",
45
- "@intentius/chant": "^0.124.24",
48
+ "@intentius/chant": "^0.124.28",
46
49
  "@intentius/chant-k8s-client": "^0.124.24",
47
50
  "@intentius/pinhole": "^0.5.0",
48
51
  "ajv": "^8.20.0",
package/web/app.js CHANGED
@@ -19,6 +19,8 @@ import { cornerOf, estateLine, hrefOf as tgHref, legend as tgLegend, markLine, r
19
19
  import { laneElement as tgLane, rootOfCard as tgRootOfCard, historyElement as tgHistoryLane } from "./terragucci-timeline.js";
20
20
  import { renderLane } from "./terragucci-lifecycle.js";
21
21
  import { renderReleases } from "./releases.js";
22
+ import { renderTrunkLane } from "./trunk-lane.js";
23
+ import { entriesFor as csEntriesFor, gapLines as csGapLines, inspectHeading as csInspectHeading, nodeMarks as csNodeMarks, offGraph as csOffGraph, overlayHeader as csHeader, overlayLegend as csLegend, PREVIEW_NOTE as CS_PREVIEW_NOTE } from "./change-set-overlay.js";
22
24
  import { renderYodelLane } from "./sql-yodeler-lane.js";
23
25
  import { initTerragucciEstate } from "./terragucci-estate.js";
24
26
  import { chantComponentMarks } from "./chant-pr-marks.js";
@@ -98,7 +100,7 @@ import { fetchDemos, demoLabel, demoTitle, demoProgress } from "./demos.js";
98
100
  // #284 item 2: the run playhead's panel — the verdict wording, the pending gate
99
101
  // card and the settled-step rows. Everything it DECIDES is pure in there; the
100
102
  // fetches, the SSE subscription and the graph re-pull stay here.
101
- import { hasPlayhead, renderPlayhead, waitingFor } from "./run-playhead.js";
103
+ import { hasPlayhead, renderPlayhead, waitingFor, sourceLabel, applyChipText, waitingLine, RUN_STATUS_COLOR } from "./run-playhead.js";
102
104
  // #234 joins 3 + 1: the operator strip (one honestly-dated tick per ConvergeOp,
103
105
  // the lease, the pending gate count) and the converge gate card, whose Approve
104
106
  // records a fact for the next tick rather than releasing anything. Same split as
@@ -115,6 +117,13 @@ import { comparisonRow, comparisonSummary } from "./cross-env.js";
115
117
  // The marker-vs-derived mark on a choudoufu card: how its identity was found.
116
118
  import { identityMark, tagGlyphSvg } from "./identity-mark.js";
117
119
  import { shotFromMessage, shotViewBox, tweenViewBox, unionBox, sameViewBox } from "./kiosk-shot.js"; // behold#571: Watch's camera
120
+ // #712, #715: the dots layer, the zoom past the cards. Mounted for a live
121
+ // carve when the estate has choudoufu roots or estate rosters
122
+ // (/api/terragucci/carve, liveCarveGate below), or when /api/graph's meta
123
+ // carries `dots` (the local preview server, scripts/dots-preview.ts). With
124
+ // neither it stays unmounted, and its hooks below are no-ops.
125
+ import { mountDots, unmountDots, dotsCamera, dotsZoomOutFactor, dotsCarving } from "./dots.js";
126
+ import { carveDrawable } from "./dots-live.js";
118
127
  initTheme();
119
128
  // #476: framed in a host pane. The flag is a class on <html>, so the CSS that
120
129
  // folds the chrome away needs no JS, and the theme is the host's for this
@@ -952,6 +961,14 @@ function inspect(node) {
952
961
  panel.appendChild(p);
953
962
  }
954
963
  }
964
+ // #681: what the open change set would do to this card, entry by entry.
965
+ const csEntries = csAnswer && csOn ? csEntriesFor(csAnswer, node.id) : [];
966
+ if (csEntries.length) {
967
+ const h = document.createElement("h3");
968
+ h.textContent = csInspectHeading(csAnswer);
969
+ panel.appendChild(h);
970
+ for (const e of csEntries) panel.appendChild(csEntryEl(e));
971
+ }
955
972
  // #526: SQL Yodeler's drift on this card, each dated by its file.
956
973
  const yrMarks = yrJoined && yrJoined.cards[node.id];
957
974
  if (yrMarks && yrMarks.length) {
@@ -2673,7 +2690,7 @@ function approveWorkspaceGate(key, btn) {
2673
2690
  showToast(`✗ approve ${key}: ${j.error}`, false);
2674
2691
  nowline("✗ " + j.error);
2675
2692
  } else {
2676
- showToast(`✓ ${key} approved as ${j.approver}`, true);
2693
+ showToast(`✓ ${key} approved as ${j.approver}${j.signed ? ", signed" : ""}`, true);
2677
2694
  }
2678
2695
  loadWorkspaceGates({ force: true });
2679
2696
  })
@@ -3445,12 +3462,68 @@ async function initTerragucci() {
3445
3462
  const project = await apiFetch("/api/project").then((r) => r.json()).catch(() => ({}));
3446
3463
  kioskRoots = project.terragucciRoots || null; // behold#571
3447
3464
  if (!project.terragucciReports) return;
3465
+ // #715: the live carve's gate, asked beside the reports; closed, nothing below changes.
3466
+ if (!staticMode) void liveCarveGate();
3448
3467
  await loadTerragucci();
3449
3468
  // #505: the chant/lifecycle lane, and what moved while this page is open.
3450
3469
  if (staticMode) return;
3451
3470
  await loadTerragucciLane();
3452
3471
  watchTerragucci();
3453
3472
  }
3473
+ // --- #715: the live carve ------------------------------------------------------
3474
+ // /api/terragucci/carve answers `live: true` only when the estate has
3475
+ // choudoufu roots or the reports hold estate rosters. Until it does (and has a
3476
+ // resource to draw), the dots layer is never mounted and the page is as it
3477
+ // was; the gate is asked again now and then, since the first wave's rosters
3478
+ // may land after the page opened.
3479
+ var liveCarve = null; // var: render() may run before this line is reached
3480
+ let liveGateTimer = 0;
3481
+ const LIVE_GATE_MS = 30_000;
3482
+ // The gate is open but nothing is drawable yet (a cycle's start, before the stock roster lands): ask again soon (#711).
3483
+ const LIVE_GATE_OPEN_MS = 5_000;
3484
+ async function liveCarveGate() {
3485
+ clearTimeout(liveGateTimer);
3486
+ let a = null;
3487
+ try {
3488
+ a = await apiFetch("/api/terragucci/carve").then((r) => r.json());
3489
+ } catch {
3490
+ a = null;
3491
+ }
3492
+ if (carveDrawable(a)) {
3493
+ liveCarve = a;
3494
+ const g = document.getElementById("graph");
3495
+ const svgEl = currentSvg();
3496
+ if (g && svgEl) mountLiveCarve(g, svgEl);
3497
+ return;
3498
+ }
3499
+ liveGateTimer = setTimeout(() => void liveCarveGate(), a && a.live === true ? LIVE_GATE_OPEN_MS : LIVE_GATE_MS);
3500
+ }
3501
+ function mountLiveCarve(g, svgEl) {
3502
+ if (!vbInit) return;
3503
+ mountDots({
3504
+ host: g,
3505
+ svg: svgEl,
3506
+ meta: {},
3507
+ vbInit: vbInit.slice(),
3508
+ getVB: () => vb,
3509
+ setVB: (a) => {
3510
+ vb = a.slice();
3511
+ vbAtFit = false;
3512
+ applyVB();
3513
+ },
3514
+ live: liveCarve,
3515
+ kiosk: !!embedOpts.bare,
3516
+ // The kiosk's shot waits while the carve directs, and takes the camera back after.
3517
+ onCarving: (on) => {
3518
+ if (on && shotAnim) {
3519
+ cancelAnimationFrame(shotAnim.raf);
3520
+ shotAnim = null;
3521
+ }
3522
+ if (!on && kioskShot) queueMicrotask(() => applyKioskShot(true));
3523
+ },
3524
+ }).catch((err) => console.warn("live carve:", err));
3525
+ }
3526
+
3454
3527
  let tgLifecycle = null;
3455
3528
  let tgPolled = null;
3456
3529
  async function loadTerragucciLane({ fresh = false } = {}) {
@@ -4485,6 +4558,8 @@ function kioskShotBox() {
4485
4558
 
4486
4559
  /** Move to the shot: a pan and zoom over its time, or at once (a re-render, a resize, reduced motion). */
4487
4560
  function applyKioskShot(animate) {
4561
+ // #715: while a live carve runs, its director has the camera; the shot waits for it to end.
4562
+ if (dotsCarving()) return kioskTellBoxes();
4488
4563
  const to = kioskShotBox();
4489
4564
  if (!to || !vb) return kioskTellBoxes();
4490
4565
  if (shotAnim && !animate) {
@@ -4840,6 +4915,209 @@ async function loadReleases({ fresh = false } = {}) {
4840
4915
  }
4841
4916
  initReleases();
4842
4917
 
4918
+ // --- #680: the trunk lane ---------------------------------------------------
4919
+ // /api/workspace/lane: the trunk's commits, then per environment in promotion
4920
+ // order what runs and what waits at a gate. A served workspace gets the tab;
4921
+ // the lane is read when the tab is opened (and on "Read again"), never at boot,
4922
+ // since it asks chant once per environment. Approving posts to the gate
4923
+ // strip's route, then both are read again.
4924
+ let laneHost = null;
4925
+ let laneRead = false;
4926
+ async function initTrunkLane() {
4927
+ if (staticMode || publicMode) return; // #569: /api/workspace/* is refused in a public view
4928
+ const project = await apiFetch("/api/project").then((r) => r.json()).catch(() => ({}));
4929
+ if (!project.workspace) return;
4930
+ laneHost = addPanelTab("trunk", "Trunk", "The trunk's recent commits and, per environment in promotion order, what runs there and what waits at a gate. Read from chant when you open the tab.");
4931
+ if (!laneHost) return;
4932
+ laneHost.id = "tab-trunk";
4933
+ const tab = document.querySelector('#panel-tabs button[data-tab="trunk"]');
4934
+ if (tab) tab.addEventListener("click", () => laneRead || loadTrunkLane());
4935
+ if (laneHost.classList.contains("active")) loadTrunkLane();
4936
+ }
4937
+ async function loadTrunkLane() {
4938
+ laneRead = true;
4939
+ const reading = document.createElement("div");
4940
+ reading.className = "tg-legend";
4941
+ reading.textContent = "reading the trunk from chant";
4942
+ laneHost.replaceChildren(reading);
4943
+ const a = await apiFetch("/api/workspace/lane")
4944
+ .then((r) => r.json())
4945
+ .catch((e) => ({ error: String(e) }));
4946
+ renderTrunkLane(laneHost, a, new Date(), { button, link: tgLink, embed: embedOpts.embed, canApprove: !previewMode && !staticMode, approve: approveFromLane, openChangeSet });
4947
+ const again = button("Read again", "", () => loadTrunkLane());
4948
+ again.title = "Read the trunk and every environment again.";
4949
+ laneHost.appendChild(again);
4950
+ }
4951
+ function approveFromLane(key, env, btn) {
4952
+ if (btn) btn.disabled = true;
4953
+ fetch("/api/workspace/gates/approve", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ key, env }) })
4954
+ .then((r) => r.json())
4955
+ .then((j) => {
4956
+ if (j.error) {
4957
+ showToast(`✗ approve ${key}: ${j.error}`, false);
4958
+ nowline("✗ " + j.error);
4959
+ } else {
4960
+ showToast(`✓ ${key} approved as ${j.approver}${j.signed ? ", signed" : ""}`, true);
4961
+ }
4962
+ loadTrunkLane();
4963
+ loadWorkspaceGates({ force: true });
4964
+ })
4965
+ .catch((e) => showToast(`✗ approve ${key}: ${e}`, false))
4966
+ .finally(() => {
4967
+ if (btn) btn.disabled = false;
4968
+ });
4969
+ }
4970
+ initTrunkLane();
4971
+
4972
+ // --- #681: a waiting gate's change set, on the graph -------------------------
4973
+ // Opened from a gate card's "change set" link in the Trunk tab. The server
4974
+ // reads the gate from status and the stored change set from chant change-set
4975
+ // show; the page draws each entry's node with an outline and a tag above the
4976
+ // card, in the drift legend's colours, and lists the entries chant mapped to
4977
+ // no node, or whose node this view does not draw, in the Change set tab. The
4978
+ // fill stays the live-status channel. Turning the overlay off removes the
4979
+ // marks; the tab keeps the change set until another one is opened.
4980
+ let csAnswer = null;
4981
+ let csOn = true;
4982
+ let csHost = null;
4983
+ let csAsk = null; // {key, env}: what "Read again" reads
4984
+ function openChangeSet(key, env) {
4985
+ csAsk = { key, env };
4986
+ csOn = true;
4987
+ if (!csHost) {
4988
+ csHost = addPanelTab("change-set", "Change set", "A waiting gate's change set, drawn on the graph as a preview: what approving the gate lets chant create, change or delete.");
4989
+ if (!csHost) return;
4990
+ csHost.id = "tab-change-set";
4991
+ }
4992
+ setPanelTab("change-set");
4993
+ loadChangeSet();
4994
+ }
4995
+ async function loadChangeSet() {
4996
+ if (!csAsk || !csHost) return;
4997
+ const reading = document.createElement("div");
4998
+ reading.className = "tg-legend";
4999
+ reading.textContent = "reading the change set from chant";
5000
+ csHost.replaceChildren(reading);
5001
+ const q = new URLSearchParams({ gate: csAsk.key, env: csAsk.env });
5002
+ csAnswer = await apiFetch(`/api/workspace/change-set?${q}`)
5003
+ .then((r) => r.json())
5004
+ .catch((e) => ({ error: String(e) }));
5005
+ markChangeSetCards();
5006
+ }
5007
+ /** The node ids the graph draws now. */
5008
+ function drawnNodeIds() {
5009
+ const svg = document.querySelector("#graph svg");
5010
+ return new Set(svg ? [...svg.querySelectorAll("[data-node-id]")].map((g) => g.getAttribute("data-node-id")) : []);
5011
+ }
5012
+ function markChangeSetCards() {
5013
+ const svg = document.querySelector("#graph svg");
5014
+ if (svg) {
5015
+ for (const old of svg.querySelectorAll("[data-cs-mark]")) old.remove();
5016
+ if (csAnswer && csOn) {
5017
+ for (const [id, m] of Object.entries(csNodeMarks(csAnswer))) {
5018
+ const g = svg.querySelector('[data-node-id="' + CSS.escape(id) + '"]');
5019
+ if (!g) continue;
5020
+ const rect = g.querySelector("rect");
5021
+ const box = rect && rect.getBBox ? rect.getBBox() : { x: 0, y: 0, width: 150, height: 60 };
5022
+ const ring = document.createElementNS("http://www.w3.org/2000/svg", "rect");
5023
+ ring.setAttribute("data-cs-mark", "ring");
5024
+ for (const [k, v] of Object.entries({ x: box.x - 4, y: box.y - 4, width: box.width + 8, height: box.height + 8, rx: 8, fill: "none", stroke: m.color, "stroke-width": 3, "pointer-events": "none" })) ring.setAttribute(k, String(v));
5025
+ const tag = document.createElementNS("http://www.w3.org/2000/svg", "text");
5026
+ tag.setAttribute("data-cs-mark", "tag");
5027
+ tag.setAttribute("x", String(box.x));
5028
+ tag.setAttribute("y", String(box.y - 9));
5029
+ tag.setAttribute("font-size", "11");
5030
+ tag.setAttribute("font-weight", "700");
5031
+ tag.setAttribute("fill", m.color);
5032
+ tag.textContent = m.tag;
5033
+ const title = document.createElementNS("http://www.w3.org/2000/svg", "title");
5034
+ title.setAttribute("data-cs-mark", "title");
5035
+ title.textContent = m.title;
5036
+ g.append(ring, tag, title);
5037
+ }
5038
+ }
5039
+ }
5040
+ renderChangeSetTab();
5041
+ }
5042
+ function csEntryEl(e) {
5043
+ const row = document.createElement("div");
5044
+ row.className = "cs-entry";
5045
+ row.style.setProperty("--bar", barVarFor(e.color));
5046
+ const head = document.createElement("div");
5047
+ head.className = "cs-entry-head";
5048
+ head.textContent = e.node ? `${e.head} · ${e.node}` : e.head;
5049
+ row.appendChild(head);
5050
+ if (e.facts) {
5051
+ const f = document.createElement("div");
5052
+ f.className = "cs-entry-facts";
5053
+ f.textContent = e.facts;
5054
+ row.appendChild(f);
5055
+ }
5056
+ for (const line of e.fields) {
5057
+ const f = document.createElement("div");
5058
+ f.className = "cs-entry-field";
5059
+ f.textContent = line;
5060
+ row.appendChild(f);
5061
+ }
5062
+ return row;
5063
+ }
5064
+ function renderChangeSetTab() {
5065
+ if (!csHost || !csAsk) return;
5066
+ csHost.replaceChildren();
5067
+ const line = (cls, text, title) => {
5068
+ const d = document.createElement("div");
5069
+ d.className = cls;
5070
+ d.textContent = text;
5071
+ if (title) d.title = title;
5072
+ csHost.appendChild(d);
5073
+ return d;
5074
+ };
5075
+ const h = csHeader(csAnswer);
5076
+ h.lines.forEach((t, i) => line(h.tone === "refusal" ? "tg-refusal" : i ? "tg-legend" : "cs-title", t, h.title));
5077
+ const refused = !csAnswer || csAnswer.error || csAnswer.refusal;
5078
+ if (!refused) {
5079
+ line("tg-legend", CS_PREVIEW_NOTE);
5080
+ for (const r of csLegend(csAnswer)) {
5081
+ const row = panelDotRow(r.color, r.label, String(r.count));
5082
+ row.title = r.title;
5083
+ csHost.appendChild(row);
5084
+ }
5085
+ for (const g of csGapLines(csAnswer)) line("tg-refusal", g.text, g.title);
5086
+ const toggle = button(csOn ? "Turn off the overlay" : "Turn on the overlay", "", () => {
5087
+ csOn = !csOn;
5088
+ markChangeSetCards();
5089
+ });
5090
+ toggle.title = csOn ? "Remove the change set's marks from the graph. The tab keeps it." : "Draw the change set's marks on the graph again.";
5091
+ csHost.appendChild(toggle);
5092
+ const marks = csNodeMarks(csAnswer);
5093
+ const drawn = drawnNodeIds();
5094
+ const ids = Object.keys(marks).filter((id) => drawn.has(id));
5095
+ if (ids.length) {
5096
+ csHost.appendChild(panelHeading("on the graph"));
5097
+ for (const id of ids) csHost.appendChild(panelDotRow(marks[id].color, id, marks[id].tag, () => selectNode(id)));
5098
+ }
5099
+ const off = csOffGraph(csAnswer, drawn);
5100
+ if (off.noNode.length) {
5101
+ const hd = panelHeading("not on the graph");
5102
+ hd.title = "chant mapped these entries to no graph node, such as a delete of a block the planning commit no longer declares.";
5103
+ csHost.appendChild(hd);
5104
+ for (const e of off.noNode) csHost.appendChild(csEntryEl(e));
5105
+ }
5106
+ if (off.notDrawn.length) {
5107
+ const hd = panelHeading("not in this view");
5108
+ hd.title = "Their nodes are not drawn in the current view. Switch to the workspace graph to see them.";
5109
+ csHost.appendChild(hd);
5110
+ for (const e of off.notDrawn) csHost.appendChild(csEntryEl(e));
5111
+ }
5112
+ if (!csAnswer.entries.length) line("tg-legend", "this change set changes nothing");
5113
+ }
5114
+ if (!staticMode) {
5115
+ const again = button("Read again", "", () => loadChangeSet());
5116
+ again.title = "Read the gate and its change set from chant again.";
5117
+ csHost.appendChild(again);
5118
+ }
5119
+ }
5120
+
4843
5121
 
4844
5122
  // --- #526: SQL Yodeler's report and drift, from files ------------------------
4845
5123
  // /api/yodel-report reads `yodel report --json` and drift JSON the person or
@@ -5233,11 +5511,11 @@ async function loadResources() {
5233
5511
  // demand, like #27's live diff), cached until the env/tier/target lens
5234
5512
  // changes. `apply` (M3) is a REAL delegated write: click opens a small
5235
5513
  // component/all picker, confirm triggers `POST /api/apply`
5236
- // (`chant run <target> --components --env <env> --progress-json` — behold
5514
+ // (`chant run <target> --components --env <env> --events-json`: behold
5237
5515
  // triggers, chant executes), and the structured wave/phase progress it
5238
- // streams back (see applyProgressReducer in src/apply.ts, broadcast as the
5239
- // `apply` SSE event) renders live below the dial — the primary surface for
5240
- // an apply, not the raw now-line.
5516
+ // streams back (chant's run events, folded by src/run-events.ts into
5517
+ // src/apply.ts's model, broadcast as the `apply` SSE event, #679) renders
5518
+ // live below the dial: the primary surface for an apply, not the raw now-line.
5241
5519
  let reconcileCache = null; // last ReconcileSummary for the current env/tier/target, or null
5242
5520
  let applyProgress = null; // last ApplyProgressState (src/apply.ts) for the current env, or null — hydrated from /api/ops on load, then kept live by the `apply` SSE event
5243
5521
  let applyPicker = false; // whether the inline "apply <component|all> →" prompt is open
@@ -5499,7 +5777,7 @@ function renderDial() {
5499
5777
  renderDial();
5500
5778
  },
5501
5779
  );
5502
- applyBtn.title = `Delegated write: chant run <component|all> --components --env ${view.env} --progress-json — behold triggers, chant executes.`;
5780
+ applyBtn.title = `Delegated write: chant run <component|all> --components --env ${view.env} --events-json. behold triggers, chant executes.`;
5503
5781
  track.appendChild(applyBtn);
5504
5782
  }
5505
5783
 
@@ -5563,7 +5841,7 @@ function renderApplyPicker() {
5563
5841
  const go = button("Apply →", "", () => {
5564
5842
  const component = sel.value;
5565
5843
  const what = component === "all" ? "ALL components" : component;
5566
- if (!window.confirm(`Apply ${what} to ${view.env}?\nThis is a real write — chant run --components --progress-json.`)) return;
5844
+ if (!window.confirm(`Apply ${what} to ${view.env}?\nThis is a real write: chant run --components --events-json.`)) return;
5567
5845
  applyPicker = false;
5568
5846
  runApply(component);
5569
5847
  });
@@ -5642,7 +5920,7 @@ async function confirmApplyAll() {
5642
5920
  : "";
5643
5921
  if (
5644
5922
  !window.confirm(
5645
- `${brokenNote}${reapplyNote}Apply ALL components to ${env}?\nReal write — chant run --components all --env ${env} --progress-json.\nLive progress appears in the dial.`,
5923
+ `${brokenNote}${reapplyNote}Apply ALL components to ${env}?\nReal write: chant run --components all --env ${env} --events-json.\nLive progress appears in the dial.`,
5646
5924
  )
5647
5925
  )
5648
5926
  return;
@@ -5671,11 +5949,12 @@ function runApply(component) {
5671
5949
  // ok, pending=running, degraded=failed, muted=not-yet-reached). Replaces the
5672
5950
  // raw-log-tail now-line as the thing you actually watch during a deploy; the
5673
5951
  // now-line still gets chant's human summary + any non-progress line as a
5674
- // fallback (src/op-runner.ts's apply() only filters OUT recognized
5675
- // RunProgressEvent lines from that channel).
5952
+ // fallback (src/op-runner.ts's apply() only filters OUT the run-event lines,
5953
+ // and an older chant's progress lines, from that channel).
5676
5954
  // `lost` (#165 §6): the CI follow stream died without a verdict — same tone
5677
5955
  // as the run playhead's lost (RUN_STATUS_COLOR), because it is the same fact.
5678
- const APPLY_STATUS_COLOR = { pending: "var(--muted)", running: "var(--pending)", ok: "var(--managed)", failed: "var(--degraded)", lost: "var(--foreign)" };
5956
+ // #679: `gated` and `waiting` wait on a person, in the pending tone, never red.
5957
+ const APPLY_STATUS_COLOR = { pending: "var(--muted)", running: "var(--pending)", ok: "var(--managed)", failed: "var(--degraded)", gated: "var(--pending)", waiting: "var(--pending)", lost: "var(--foreign)" };
5679
5958
 
5680
5959
  function renderApplyProgress(state) {
5681
5960
  const wrap = document.createElement("div");
@@ -5686,6 +5965,24 @@ function renderApplyProgress(state) {
5686
5965
  // executor — and says so instead of claiming to be an apply.
5687
5966
  summary.textContent = `${state.kind || "apply"}: ${state.status}`;
5688
5967
  wrap.appendChild(summary);
5968
+ // #679: where the progress came from. A pipeline chant did not run is read
5969
+ // from its runner's log, and the dial says that is best-effort; an older
5970
+ // chant's run says it is degraded.
5971
+ const from = sourceLabel(state.source, null);
5972
+ if (from) {
5973
+ const src = document.createElement("div");
5974
+ src.className = "apply-source";
5975
+ src.style.cssText = `font-size:var(--t-caption);color:${RUN_STATUS_COLOR[from.tone] || "var(--muted)"}`;
5976
+ src.textContent = from.text;
5977
+ wrap.appendChild(src);
5978
+ }
5979
+ for (const text of [state.lost, waitingLine(state.waitingOn)]) {
5980
+ if (!text) continue;
5981
+ const line = document.createElement("div");
5982
+ line.style.cssText = "font-size:var(--t-caption);color:var(--muted)";
5983
+ line.textContent = text;
5984
+ wrap.appendChild(line);
5985
+ }
5689
5986
  // #165: a dispatched run's own page — the one place an environment
5690
5987
  // protection rule's approval can be granted. A link, never a button: behold
5691
5988
  // holds no identity that could clear a forge gate, and must not acquire one.
@@ -5714,8 +6011,7 @@ function renderApplyProgress(state) {
5714
6011
  const color = APPLY_STATUS_COLOR[c.status] || "var(--muted)";
5715
6012
  const chip = document.createElement("span");
5716
6013
  chip.style.cssText = `border:1px solid ${color};color:${color};border-radius:var(--r-ctl);padding:2px 8px;font-size:var(--t-caption)`;
5717
- const detail = [c.phase, c.step].filter(Boolean).join(" · ");
5718
- chip.textContent = `${cname}${detail ? " · " + detail : ""} (${c.status})`;
6014
+ chip.textContent = applyChipText(cname, c);
5719
6015
  if (c.error) chip.title = c.error;
5720
6016
  row.appendChild(chip);
5721
6017
  }
@@ -6483,6 +6779,11 @@ function render(ir, svg, m) {
6483
6779
  setupGraphViewBox(svgEl);
6484
6780
  wireEdgeHighlight(svgEl, ir);
6485
6781
  }
6782
+ // #712: only the dots preview's meta carries `dots`. #715: a live carve, when the gate opened.
6783
+ if (svgEl && m && m.dots) {
6784
+ mountDots({ host: g, svg: svgEl, meta: m, vbInit: vbInit.slice(), getVB: () => vb, setVB: (a) => { vb = a.slice(); vbAtFit = false; applyVB(); } }).catch((err) => console.warn("dots preview:", err));
6785
+ } else if (svgEl && liveCarve) mountLiveCarve(g, svgEl);
6786
+ else unmountDots();
6486
6787
  ensureZoomControls(g);
6487
6788
  ensureBackToInfra(g);
6488
6789
  wire(ir);
@@ -6495,6 +6796,7 @@ function render(ir, svg, m) {
6495
6796
  markPendingCards(ir); // #422: and the cards whose member has not answered yet
6496
6797
  markTerragucciCards(); // #490: and what terragucci's reports found, dated
6497
6798
  markYodelCards(); // #526: and SQL Yodeler's drift, dated
6799
+ if (csAnswer) markChangeSetCards(); // #681: and the change set a gate binds, as a preview
6498
6800
  applyLayout(); // #228: last, so the hand-placed deltas ride on top of every other pass
6499
6801
  drawTgReads(); // #568: after the layout, so the reads lines meet the cards where they now sit
6500
6802
  renderDial();
@@ -6611,6 +6913,7 @@ function applyVB() {
6611
6913
  const s = currentSvg();
6612
6914
  if (s && vb) s.setAttribute("viewBox", vb.join(" "));
6613
6915
  scaleBoxLabels(); // #396 item 7b: box titles/badges keep a legible size at every zoom
6916
+ dotsCamera(); // #712: a no-op unless the dots preview is mounted
6614
6917
  kioskTellBoxes(); // behold#571: the kiosk's overlays ride the boxes they describe
6615
6918
  }
6616
6919
 
@@ -6857,7 +7160,7 @@ function ensureZoomControls(host) {
6857
7160
  const cy = vb[1] + ((e.clientY - r.top) / r.height) * vb[3];
6858
7161
  const f = Math.exp(e.deltaY * 0.0025); // scroll up → f<1 → zoom in
6859
7162
  const minW = vbInit[2] / 60;
6860
- const maxW = vbInit[2] * 3;
7163
+ const maxW = vbInit[2] * (dotsZoomOutFactor() ?? 3); // #712: the dots preview zooms out further
6861
7164
  const nw = Math.min(maxW, Math.max(minW, vb[2] * f));
6862
7165
  const nh = nw * (vb[3] / vb[2]);
6863
7166
  vb[0] = cx - ((cx - vb[0]) * nw) / vb[2];
@@ -6897,7 +7200,7 @@ function ensureZoomControls(host) {
6897
7200
  const m0 = mid(touch.pts);
6898
7201
  const cx = vb[0] + ((m.x - r.left) / r.width) * vb[2];
6899
7202
  const cy = vb[1] + ((m.y - r.top) / r.height) * vb[3];
6900
- const nw = Math.min(vbInit[2] * 3, Math.max(vbInit[2] / 60, vb[2] * f));
7203
+ const nw = Math.min(vbInit[2] * (dotsZoomOutFactor() ?? 3), Math.max(vbInit[2] / 60, vb[2] * f));
6901
7204
  const nh = nw * (vb[3] / vb[2]);
6902
7205
  vb[0] = cx - ((cx - vb[0]) * nw) / vb[2] - ((m.x - m0.x) / r.width) * nw;
6903
7206
  vb[1] = cy - ((cy - vb[1]) * nh) / vb[3] - ((m.y - m0.y) / r.height) * nh;
@@ -7578,6 +7881,8 @@ async function loadOnce(opts = {}, isCurrent = () => true) {
7578
7881
  try {
7579
7882
  let q = lensParams(new URLSearchParams({ detail: String(view.detail) }));
7580
7883
  let endpoint = "/api/graph";
7884
+ // #712: the dots preview's source rides along; absent from every other page's URL.
7885
+ const dotsSource = new URLSearchParams(location.search).get("dots");
7581
7886
  if (view.components) {
7582
7887
  // M1.1 (#57): the component DAG stays on /api/graph even with an env
7583
7888
  // picked — the server joins live per-component status onto it there
@@ -7664,6 +7969,7 @@ async function loadOnce(opts = {}, isCurrent = () => true) {
7664
7969
  resourcesByComponent = {};
7665
7970
  }
7666
7971
  if (progressive) frameLoad = memberFrames.begin();
7972
+ if (dotsSource) q.set("dots", dotsSource);
7667
7973
  const res = await apiFetch(`${endpoint}?${q}`);
7668
7974
  const body = await res.json();
7669
7975
  if (!isCurrent()) return; // a newer view/event is pending; do not paint the old result
@@ -8077,7 +8383,7 @@ async function refreshReadCost() {
8077
8383
  }
8078
8384
 
8079
8385
  // #259: the op stream is chant's own stdout, and an Op that reports as JSON
8080
- // (a plan summary, a run report, an unrecognized `--progress-json` line that
8386
+ // (a plan summary, a run report, a structured line that
8081
8387
  // src/op-runner.ts didn't filter out) used to land here as one unbroken line.
8082
8388
  // Parse it; if it IS a JSON object or array, show the collapsible tree instead.
8083
8389
  // Anything else — every ordinary human log line — is untouched text.
@@ -8126,8 +8432,8 @@ function showToast(msg, ok) {
8126
8432
  }
8127
8433
 
8128
8434
  // Structured apply progress (M3, #54): the server broadcasts the full
8129
- // ApplyProgressState (src/apply.ts) after every recognized RunProgressEvent —
8130
- // see src/op-runner.ts's apply(). Re-render the dial's progress panel each
8435
+ // ApplyProgressState (src/apply.ts) after every run event chant streams
8436
+ // (#679); see src/op-runner.ts's apply(). Re-render the dial's progress panel each
8131
8437
  // time; renderDial() is cheap (rebuilds a small DOM subtree) so no diffing.
8132
8438
  events.addEventListener("apply", (e) => {
8133
8439
  try {
@@ -8140,7 +8446,7 @@ events.addEventListener("apply", (e) => {
8140
8446
 
8141
8447
  // #284 item 2 — the run playhead. Same channel and same shape as `apply` above:
8142
8448
  // the server broadcasts the whole RunState (src/run-playhead.ts) after every
8143
- // settled StepRecord and every gateState read, so a client that (re)subscribes
8449
+ // run event (a step's start and settle, a gate) and every status read, so a client that (re)subscribes
8144
8450
  // mid-run renders correctly from the very next event. Repaint the dial always;
8145
8451
  // re-pull the graph only when the ops lens is what's on screen, since that's
8146
8452
  // the view the run state paints over.
@@ -8560,7 +8866,7 @@ async function initActions() {
8560
8866
  renderDial();
8561
8867
  setPanelTab("deploy"); // the dial lives on the panel's Deploy tab
8562
8868
  });
8563
- deploy.title = `chant run <component|all> --components --env ${view.env || opsInitialEnv} --progress-json — opens the component picker on the dial. behold triggers, chant executes.`;
8869
+ deploy.title = `chant run <component|all> --components --env ${view.env || opsInitialEnv} --events-json: opens the component picker on the dial. behold triggers, chant executes.`;
8564
8870
  bar.appendChild(deploy);
8565
8871
  }
8566
8872