@intentius/behold 0.29.49 → 0.29.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/behold",
3
- "version": "0.29.49",
3
+ "version": "0.29.50",
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.",
@@ -37,6 +37,7 @@
37
37
  "preview:dots": "tsx scripts/dots-preview.ts",
38
38
  "export:carve": "tsx scripts/export-carve.ts",
39
39
  "preview:carve": "tsx scripts/export-carve.ts && node scripts/serve-static.mjs dist-carve 4712",
40
+ "preview:tour": "tsx scripts/tour-preview.ts",
40
41
  "tsc": "tsc --noEmit",
41
42
  "test": "vitest run",
42
43
  "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",
@@ -45,7 +46,7 @@
45
46
  },
46
47
  "dependencies": {
47
48
  "@hono/node-server": "^2.0.5",
48
- "@intentius/chant": "^0.124.28",
49
+ "@intentius/chant": "^0.124.32",
49
50
  "@intentius/chant-k8s-client": "^0.124.24",
50
51
  "@intentius/pinhole": "^0.5.0",
51
52
  "ajv": "^8.20.0",
package/web/app.js CHANGED
@@ -22,6 +22,7 @@ import { laneElement as tgLane, rootOfCard as tgRootOfCard, historyElement as tg
22
22
  import { renderLane } from "./terragucci-lifecycle.js";
23
23
  import { renderReleases } from "./releases.js";
24
24
  import { renderTrunkLane } from "./trunk-lane.js";
25
+ import { startLocalRuns } from "./local-run.js";
25
26
  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";
26
27
  import { collisionFilter as coFilter, collisionHeader as coHeader, collisionMarks as coMarks, collisionsFor as coFor, COLLISION_NOTE as CO_NOTE, FILES_NOTE as CO_FILES_NOTE, FILTER_OFF as CO_FILTER_OFF, FILTER_ON as CO_FILTER_ON, gapLines as coGapLines, hideEdge as coHideEdge, itemRow as coItemRow, nodeRow as coNodeRow, sideLines as coSideLines } from "./collision-marks.js";
27
28
  import { flagMarks as flFlagMarks, flagRow as flFlagRow, flagsFor as flFlagsFor, flagsHeader as flHeader, gapLines as flGapLines, NODES_NOTE as FL_NODES_NOTE, pickEnv as flPickEnv, STALE_COLOR as FL_STALE_COLOR, TURN_ON_NOTE as FL_TURN_ON_NOTE } from "./feature-flags.js";
@@ -142,6 +143,10 @@ const embedOpts = readEmbed(location.search);
142
143
  if (embedOpts.theme && !setTheme(embedOpts.theme, { persist: false })) console.warn(`behold: no theme named ${embedOpts.theme}`);
143
144
  if (embedOpts.embed) document.documentElement.classList.add("embed");
144
145
  if (embedOpts.embed && embedOpts.bare) document.documentElement.classList.add("bare"); // #569: the graph alone, for a kiosk
146
+ // The kiosk on a phone: one finger scrolls the page and two pan or zoom the graph. A one-finger pan held most of the
147
+ // screen, so any scroll over the graph moved it and paused Watch.
148
+ const kioskTouch = () => !!(embedOpts.embed && embedOpts.bare) && typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches;
149
+ if (kioskTouch()) document.documentElement.classList.add("kiosk-touch");
145
150
  initPanel({ embed: embedOpts.embed, phone: typeof matchMedia === "function" && matchMedia(INSPECT_PHONE_QUERY).matches });
146
151
  mountThemePicker(document.getElementById("panel-theme"));
147
152
 
@@ -2716,17 +2721,46 @@ function loadWorkspaceGates({ force = false } = {}) {
2716
2721
  // env the view has left never lands under the one it moved to.
2717
2722
  const seq = ++wsGates.seq;
2718
2723
  wsGates.env = env;
2719
- fetch(`/api/workspace/gates${env ? `?env=${encodeURIComponent(env)}` : ""}`)
2720
- .then((r) => r.json())
2721
- .then((j) => {
2722
- if (seq === wsGates.seq) wsGates.answer = j;
2723
- })
2724
- .catch(() => {
2725
- if (seq === wsGates.seq) wsGates.answer = null;
2726
- })
2727
- .finally(() => {
2728
- if (seq === wsGates.seq) paintWorkspaceGates();
2729
- });
2724
+ // #472: the open decision points ride with the gates, so a question lands on
2725
+ // the card of the gate that waits on it in the same paint.
2726
+ const read = (url) =>
2727
+ fetch(url)
2728
+ .then((r) => r.json())
2729
+ .catch(() => null);
2730
+ Promise.all([read(`/api/workspace/gates${env ? `?env=${encodeURIComponent(env)}` : ""}`), read("/api/workspace/points")]).then(([gates, points]) => {
2731
+ if (seq !== wsGates.seq) return;
2732
+ wsGates.answer = gates;
2733
+ wsGates.points = points;
2734
+ paintWorkspaceGates();
2735
+ });
2736
+ }
2737
+ /** #472: one open decision point's lines, inside a gate's card or as its own. */
2738
+ function pointBlock(p) {
2739
+ const box = document.createElement("div");
2740
+ box.className = "ws-point";
2741
+ box.dataset.point = p.id;
2742
+ const title = document.createElement("div");
2743
+ title.className = "ws-gate-title";
2744
+ title.textContent = p.title;
2745
+ const question = document.createElement("div");
2746
+ question.className = "ws-point-question";
2747
+ question.textContent = p.question;
2748
+ const facts = document.createElement("div");
2749
+ facts.className = "ws-gate-facts";
2750
+ facts.textContent = p.facts;
2751
+ const note = document.createElement("div");
2752
+ note.className = "ws-gate-note";
2753
+ note.textContent = p.note;
2754
+ note.title = p.command;
2755
+ box.append(title, question, facts, note);
2756
+ if (p.showCommand) {
2757
+ // Text a person copies; behold never runs it.
2758
+ const line = document.createElement("code");
2759
+ line.className = "ws-point-command";
2760
+ line.textContent = p.command;
2761
+ box.appendChild(line);
2762
+ }
2763
+ return box;
2730
2764
  }
2731
2765
  function paintWorkspaceGates() {
2732
2766
  const host = document.getElementById("ws-gates");
@@ -2737,8 +2771,14 @@ function paintWorkspaceGates() {
2737
2771
  host.hidden = true;
2738
2772
  return;
2739
2773
  }
2740
- const { cards, elsewhere, refusal } = gateCards(answer, { embed: embedOpts.embed, member: embedOpts.embed ? view.member : null });
2774
+ const { cards, elsewhere, refusal, pointsRefusal } = gateCards(answer, { embed: embedOpts.embed, member: embedOpts.embed ? view.member : null, points: wsGates.points });
2741
2775
  for (const c of cards) {
2776
+ if (c.point) {
2777
+ const own = pointBlock(c);
2778
+ own.classList.add("ws-gate");
2779
+ host.appendChild(own);
2780
+ continue;
2781
+ }
2742
2782
  const box = document.createElement("div");
2743
2783
  box.className = "ws-gate";
2744
2784
  box.dataset.gate = c.key;
@@ -2761,6 +2801,7 @@ function paintWorkspaceGates() {
2761
2801
  b.title = c.button.title;
2762
2802
  box.appendChild(b);
2763
2803
  }
2804
+ for (const p of c.points || []) box.appendChild(pointBlock(p));
2764
2805
  host.appendChild(box);
2765
2806
  }
2766
2807
  if (elsewhere) {
@@ -2776,6 +2817,13 @@ function paintWorkspaceGates() {
2776
2817
  err.title = refusal.remedy || "";
2777
2818
  host.appendChild(err);
2778
2819
  }
2820
+ if (pointsRefusal) {
2821
+ const err = document.createElement("div");
2822
+ err.className = "ws-gate ws-gate-note";
2823
+ err.textContent = `decision points unread: ${pointsRefusal.error}`;
2824
+ err.title = pointsRefusal.remedy || "";
2825
+ host.appendChild(err);
2826
+ }
2779
2827
  host.hidden = !host.children.length;
2780
2828
  }
2781
2829
  function approveWorkspaceGate(key, btn) {
@@ -3623,7 +3671,15 @@ function mountLiveCarve(g, svgEl) {
3623
3671
  }
3624
3672
  if (!on && kioskShot) queueMicrotask(() => applyKioskShot(true));
3625
3673
  },
3626
- }).catch((err) => console.warn("live carve:", err));
3674
+ })
3675
+ .then(fitClearOfRail)
3676
+ .catch((err) => console.warn("live carve:", err));
3677
+ }
3678
+
3679
+ /** behold#729: the rail mounts after the graph's first fit; a view still at its fit or shot moves clear of it. */
3680
+ function fitClearOfRail() {
3681
+ if (kioskShot) applyKioskShot(false);
3682
+ else if (vbAtFit) fitGraph();
3627
3683
  }
3628
3684
 
3629
3685
  let tgLifecycle = null;
@@ -5608,7 +5664,7 @@ function kioskShotBox() {
5608
5664
  }
5609
5665
  kioskHeld = null;
5610
5666
  document.documentElement.classList.remove("kiosk-held");
5611
- return shotViewBox(kioskShotTarget(svg, kioskShot), pane, insets);
5667
+ return shotViewBox(kioskShotTarget(svg, kioskShot), pane, { ...insets, right: Math.max(insets.right, railInset(pane)) });
5612
5668
  }
5613
5669
  /** The whole-graph framing Watch holds on a small stage while the graph and the pane stay (web/kiosk-shot.js heldFrame); null on a bigger one. */
5614
5670
  var kioskHeld = null;
@@ -6080,6 +6136,30 @@ function approveFromLane(key, env, btn) {
6080
6136
  }
6081
6137
  initTrunkLane();
6082
6138
 
6139
+ // --- behold#685: run a plan job locally ---------------------------------------
6140
+ // chant ci run plan --local at a commit, drawn in the runs pane's run view
6141
+ // beside CI's run of the same job. It starts a command, so it is drawn only
6142
+ // where behold may start one: a served workspace, never in a public view, an
6143
+ // embed, a static export, preview mode or a terragucci or SQL Yodeler repo.
6144
+ async function initLocalRuns() {
6145
+ if (staticMode || publicMode || embedOpts.embed) return;
6146
+ const project = await apiFetch("/api/project").then((r) => r.json()).catch(() => ({}));
6147
+ if (!project.workspace || project.previewMode || project.publicMode || project.terragucci || project.sqlYodeler) return;
6148
+ const host = addPanelTab("local-runs", "Local", "Run a CI plan job on this machine with chant ci run --local, beside CI's run of it.");
6149
+ if (!host) return;
6150
+ host.id = "tab-local-runs";
6151
+ let started = false;
6152
+ const start = () => {
6153
+ if (started) return;
6154
+ started = true;
6155
+ startLocalRuns(host, { fetchJson: (url, init) => fetch(url, init).then((r) => r.json()), events, toast: showToast });
6156
+ };
6157
+ const tab = document.querySelector('#panel-tabs button[data-tab="local-runs"]');
6158
+ if (tab) tab.addEventListener("click", start);
6159
+ if (host.classList.contains("active")) start();
6160
+ }
6161
+ initLocalRuns();
6162
+
6083
6163
  // --- #683: feature flags, on or off per environment ---------------------------
6084
6164
  // The Flags tab reads /api/workspace/flags when it is opened: each flag of the
6085
6165
  // workspace with its owner, work item and value per environment, a flip
@@ -8307,7 +8387,9 @@ function render(ir, svg, m) {
8307
8387
  }
8308
8388
  // #712: only the dots preview's meta carries `dots`. #715: a live carve, when the gate opened.
8309
8389
  if (svgEl && m && m.dots) {
8310
- 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));
8390
+ mountDots({ host: g, svg: svgEl, meta: m, vbInit: vbInit.slice(), getVB: () => vb, setVB: (a) => { vb = a.slice(); vbAtFit = false; applyVB(); } })
8391
+ .then(fitClearOfRail)
8392
+ .catch((err) => console.warn("dots preview:", err));
8311
8393
  } else if (svgEl && liveCarve) mountLiveCarve(g, svgEl);
8312
8394
  else unmountDots();
8313
8395
  ensureZoomControls(g);
@@ -8479,6 +8561,21 @@ function panelInsets(pane) {
8479
8561
  : { left: 0, right: Math.min(cap, Math.max(0, pane.right - r.left)) };
8480
8562
  }
8481
8563
 
8564
+ // behold#729: the dots zoom rail floats on the pane's right edge, so a fit or a
8565
+ // kiosk shot that ignores it leaves the rightmost cards under it. Read at fit
8566
+ // time like the panel: Watch hides it, a held stage and a directing carve fade
8567
+ // it out, and then it covers nothing.
8568
+ const RAIL_GAP = 8;
8569
+ function railInset(pane) {
8570
+ const rail = document.querySelector("#dots-ui .dots-rail");
8571
+ if (!rail) return 0;
8572
+ const cs = getComputedStyle(rail);
8573
+ if (cs.display === "none" || cs.visibility === "hidden" || Number(cs.opacity) === 0) return 0;
8574
+ const r = rail.getBoundingClientRect();
8575
+ if (!r.width || r.bottom <= pane.top || r.top >= pane.bottom || r.left >= pane.right) return 0;
8576
+ return Math.min(pane.width * 0.3, Math.max(0, pane.right - r.left + RAIL_GAP));
8577
+ }
8578
+
8482
8579
  /**
8483
8580
  * The viewBox that fits the whole graph into the pane's UNCOVERED part.
8484
8581
  *
@@ -8496,7 +8593,8 @@ function fittedViewBox() {
8496
8593
  const pane = host.getBoundingClientRect();
8497
8594
  const [x0, y0, w0, h0] = vbInit;
8498
8595
  if (!(pane.width > 0 && pane.height > 0 && w0 > 0 && h0 > 0)) return null;
8499
- const { left, right } = panelInsets(pane);
8596
+ const { left, right: panelRight } = panelInsets(pane);
8597
+ const right = Math.max(panelRight, railInset(pane));
8500
8598
  const band = Math.max(1, pane.width - left - right);
8501
8599
  const s = Math.min(band / w0, pane.height / h0);
8502
8600
  const vw = pane.width / s;
@@ -8720,6 +8818,9 @@ function ensureZoomControls(host) {
8720
8818
  const s = currentSvg();
8721
8819
  if (!touch || !vb || !s) return;
8722
8820
  const pts = touchPoints(e);
8821
+ // The kiosk on a phone leaves one finger to the page's scroll, until a gesture has had two.
8822
+ if (kioskTouch() && pts.length < 2 && !touch.pinched) return;
8823
+ if (pts.length >= 2) touch.pinched = true;
8723
8824
  const r = s.getBoundingClientRect();
8724
8825
  e.preventDefault();
8725
8826
  if (pts.length >= 2 && touch.pts.length >= 2) {
@@ -8750,7 +8851,7 @@ function ensureZoomControls(host) {
8750
8851
  { passive: false },
8751
8852
  );
8752
8853
  host.addEventListener("touchend", (e) => {
8753
- touch = e.touches.length ? { pts: touchPoints(e), moved: !!(touch && touch.moved) } : null;
8854
+ touch = e.touches.length ? { pts: touchPoints(e), moved: !!(touch && touch.moved), pinched: !!(touch && touch.pinched) } : null;
8754
8855
  });
8755
8856
  let drag = false;
8756
8857
  let px = 0;
@@ -0,0 +1,70 @@
1
+ // #472: a workspace's open decision points, drawn where they belong. Pure:
2
+ // app.js fetches /api/workspace/points beside /api/workspace/gates and paints
3
+ // what these return.
4
+ //
5
+ // A gate that asks a decision point (chant#3170) names its open question as
6
+ // `answer.id`, and the point read lists the same id, so the question is drawn
7
+ // on that gate's card. A question no waiting gate names gets a card of its own
8
+ // in the gate strip. behold answers none of them: framed, the host's rail does
9
+ // (arugula-salad/arugula#621); standalone, the card gives chant's line to run.
10
+
11
+ /** The words a framed point card uses where a standalone one gives the line. */
12
+ export const HOST_ANSWERS = "answer it in the rail of the host that framed this graph";
13
+ /** The words a standalone point card puts before chant's line. */
14
+ export const STANDALONE_ANSWERS = "behold doesn't answer decision points. Answer it at the workspace root:";
15
+
16
+ /** Who may answer, in words: `2 people holding maintainer`. */
17
+ export function whoAnswers(quorum) {
18
+ const count = (quorum && quorum.count) || 1;
19
+ const roles = (quorum && quorum.roles) || [];
20
+ return `${count} ${count === 1 ? "person" : "people"}${roles.length ? ` holding ${roles.join(" or ")}` : ""}`;
21
+ }
22
+
23
+ const shown = (v) => (typeof v === "boolean" ? (v ? "yes" : "no") : String(v));
24
+
25
+ /** One point as the lines a card draws: the question, who may answer, the facts, and how to answer it elsewhere. */
26
+ export function pointLines(p, { embed = false } = {}) {
27
+ const facts = [];
28
+ if (p.candidates && p.candidates.length) facts.push(`answers: ${p.candidates.map(shown).join(", ")}`);
29
+ facts.push(`${whoAnswers(p.quorum)} may answer`);
30
+ if (p.state === "proposed" && p.model) facts.push(`a model proposes ${shown(p.model.answer)}${p.model.confidence !== null ? ` (${Math.round(p.model.confidence * 100)}%)` : ""}, waiting for a person to confirm it`);
31
+ else if (p.model && p.model.answer !== null) facts.push(`a model answered ${shown(p.model.answer)} below its threshold`);
32
+ if (p.askedBy) facts.push(`asked by steward ${p.askedBy}`);
33
+ if (p.askedOn) facts.push(`asked ${p.askedOn}`);
34
+ if (p.stale) facts.push("the point changed since it was asked");
35
+ return {
36
+ id: p.id,
37
+ title: `decision point ${p.point}: ${p.title}`,
38
+ question: p.question,
39
+ facts: facts.join(" · "),
40
+ command: p.command,
41
+ // Standalone, the card shows `command` after the note, as text to copy.
42
+ note: embed ? HOST_ANSWERS : STANDALONE_ANSWERS,
43
+ showCommand: !embed,
44
+ };
45
+ }
46
+
47
+ /**
48
+ * Place each open point: on the card of the waiting gate whose `answer.id`
49
+ * names it (`byGate`, by gate key), or on its own (`loose`). `gates` is the
50
+ * gates answer's list, `points` the points answer's.
51
+ */
52
+ export function placePoints(points, gates) {
53
+ const byId = new Map();
54
+ for (const g of gates || []) if (g.answer && g.answer.id) byId.set(g.answer.id, g.key);
55
+ const byGate = new Map();
56
+ const loose = [];
57
+ for (const p of points || []) {
58
+ const key = byId.get(p.id);
59
+ if (key) byGate.set(key, [...(byGate.get(key) || []), p]);
60
+ else loose.push(p);
61
+ }
62
+ return { byGate, loose };
63
+ }
64
+
65
+ /** The title of a point card that no waiting gate here names. */
66
+ export function loosePointTitle(p) {
67
+ const lines = pointLines(p);
68
+ if (!p.gate) return lines.title;
69
+ return `${lines.title} (asked by gate ${p.gate.op}/${p.gate.gate}${p.gate.env ? ` in ${p.gate.env}` : ""})`;
70
+ }
@@ -0,0 +1,87 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { HOST_ANSWERS, placePoints, pointLines, STANDALONE_ANSWERS, whoAnswers } from "./decision-points.js";
3
+ import { gateCards, HOST_APPROVES } from "./workspace-gates.js";
4
+
5
+ const GATE_Q = "staging-apply-ec72c7930446";
6
+ const LOOSE_Q = "launch-tier-1f278d6a8207";
7
+ const command = (id) => `chant workspace points answer ${id} --answer <value> --by <name>`;
8
+
9
+ // What /api/workspace/points answers for src/__fixtures__/decision-points/.
10
+ const points = {
11
+ workspace: true,
12
+ points: [
13
+ { id: LOOSE_Q, point: "launch-tier", title: "Which tier the launch goes out on", question: "Pick the tier the launch goes out on.", questionType: "choice", candidates: ["small", "large"], subject: "L-7", gate: null, state: "escalated", quorum: { count: 1, roles: [] }, model: null, askedOn: "2026-10-20", askedBy: null, stale: false, path: `answers/${LOOSE_Q}.md`, command: command(LOOSE_Q) },
14
+ { id: GATE_Q, point: "staging-apply", title: "Apply this plan to staging", question: "Should this plan be applied to staging?", questionType: "noul", candidates: [true, false], subject: "gate:deploy/approve-apply@staging", gate: { op: "deploy", gate: "approve-apply", env: "staging" }, state: "escalated", quorum: { count: 2, roles: ["maintainer"] }, model: null, askedOn: "2026-10-20", askedBy: null, stale: false, path: `answers/${GATE_Q}.md`, command: command(GATE_Q) },
15
+ ],
16
+ };
17
+
18
+ const gates = {
19
+ workspace: true,
20
+ env: "staging",
21
+ approver: "alex",
22
+ gates: [
23
+ { key: "web/deploy/approve-apply", member: "web", op: "deploy", gate: "approve-apply", env: "staging", planDigest: null, approvals: [], needed: 1, signed: false, approve: command(GATE_Q), answer: { point: "staging-apply", id: GATE_Q, path: `answers/${GATE_Q}.md` } },
24
+ { key: "api/ship/go", member: "api", op: "ship", gate: "go", env: "staging", planDigest: null, approvals: [], needed: 1, signed: false, approve: "chant approve ship go --env staging" },
25
+ ],
26
+ };
27
+
28
+ describe("pointLines (#472)", () => {
29
+ it("says the question, who may answer, and gives chant's line standalone", () => {
30
+ const l = pointLines(points.points[1]);
31
+ expect(l).toMatchObject({ title: "decision point staging-apply: Apply this plan to staging", question: "Should this plan be applied to staging?", note: STANDALONE_ANSWERS, command: command(GATE_Q), showCommand: true });
32
+ expect(l.facts).toBe("answers: yes, no · 2 people holding maintainer may answer · asked 2026-10-20");
33
+ });
34
+ it("sends a framed reader to the host's rail", () => {
35
+ expect(pointLines(points.points[1], { embed: true })).toMatchObject({ note: HOST_ANSWERS, showCommand: false });
36
+ });
37
+ it("names a model's proposal waiting for a person", () => {
38
+ const l = pointLines({ ...points.points[0], state: "proposed", model: { answer: "large", confidence: 0.91, threshold: 0.8, model: "m" } });
39
+ expect(l.facts).toContain("a model proposes large (91%), waiting for a person to confirm it");
40
+ });
41
+ it("counts who may answer", () => {
42
+ expect(whoAnswers({ count: 1, roles: [] })).toBe("1 person");
43
+ expect(whoAnswers({ count: 3, roles: ["sre", "owner"] })).toBe("3 people holding sre or owner");
44
+ });
45
+ });
46
+
47
+ describe("placePoints (#472)", () => {
48
+ it("puts a question on the gate whose answer names it, and the rest on their own", () => {
49
+ const { byGate, loose } = placePoints(points.points, gates.gates);
50
+ expect([...byGate.keys()]).toEqual(["web/deploy/approve-apply"]);
51
+ expect(byGate.get("web/deploy/approve-apply").map((p) => p.id)).toEqual([GATE_Q]);
52
+ expect(loose.map((p) => p.id)).toEqual([LOOSE_Q]);
53
+ });
54
+ it("puts every question on its own when no gate names one", () => {
55
+ expect(placePoints(points.points, []).loose).toHaveLength(2);
56
+ });
57
+ });
58
+
59
+ describe("gate cards with decision points (#472)", () => {
60
+ it("draws the question on its gate, no approve button, and the loose question after the gates", () => {
61
+ const { cards } = gateCards(gates, { points });
62
+ const [asks, plain, loose] = cards;
63
+ expect(asks).toMatchObject({ key: "web/deploy/approve-apply", title: "web: deploy waits at gate approve-apply on decision point staging-apply", facts: "env staging" });
64
+ expect(asks.button).toBeUndefined();
65
+ expect(asks.note).toContain("which behold doesn't answer");
66
+ expect(asks.points.map((p) => p.id)).toEqual([GATE_Q]);
67
+ expect(plain.button).toMatchObject({ label: "Approve as alex" });
68
+ expect(plain.points).toBeUndefined();
69
+ expect(loose).toMatchObject({ key: `point/${LOOSE_Q}`, point: true, title: "decision point launch-tier: Which tier the launch goes out on", command: command(LOOSE_Q) });
70
+ });
71
+ it("framed, sends the point's gate to the rail and keeps the plain gate's note", () => {
72
+ const { cards } = gateCards(gates, { embed: true, points });
73
+ expect(cards[0].note).toBe(HOST_ANSWERS);
74
+ expect(cards[1].note).toBe(HOST_APPROVES);
75
+ expect(cards.some((c) => c.button)).toBe(false);
76
+ expect(cards[0].points[0].showCommand).toBe(false);
77
+ });
78
+ it("names the gate a loose question was asked by when that gate waits elsewhere", () => {
79
+ const { cards } = gateCards({ ...gates, gates: [gates.gates[1]] }, { points });
80
+ expect(cards.find((c) => c.key === `point/${GATE_Q}`).title).toBe("decision point staging-apply: Apply this plan to staging (asked by gate deploy/approve-apply in staging)");
81
+ });
82
+ it("passes the points refusal through, and draws the gates as before without a points answer", () => {
83
+ const refusal = { error: "Decision points needs chant 0.107.0 or newer.", code: "chant-too-old" };
84
+ expect(gateCards(gates, { points: { workspace: true, points: [], refusal } }).pointsRefusal).toEqual(refusal);
85
+ expect(gateCards(gates).cards).toHaveLength(2);
86
+ });
87
+ });
package/web/dots-kiosk.js CHANGED
@@ -267,6 +267,9 @@ export function resourceCounts(migration) {
267
267
  /** The Tip for a migration that has just finished. */
268
268
  export function liveEndTip(migration, t) {
269
269
  const c = resourceCounts(migration);
270
+ // An adoption only stamps and a retag only moves: the count it has none of is left out (#711), not said as a 0.
271
+ const parts = [c.moved ? `${fmt(c.moved)} moved` : null, c.stamped ? `${fmt(c.stamped)} stamped` : null].filter(Boolean);
272
+ const what = parts.length ? parts.join(" and ").replace(/^(\S+) (moved|stamped)/, "$1 resources $2") : "0 resources moved";
270
273
  return {
271
274
  key: `end:${migration.name}`,
272
275
  at: t,
@@ -274,6 +277,6 @@ export function liveEndTip(migration, t) {
274
277
  estate: null,
275
278
  tone: c.refused ? "bad" : "ok",
276
279
  title: `${migration.name}: done`,
277
- text: `${migration.name} is done: ${fmt(c.moved)} resources moved and ${fmt(c.stamped)} stamped by tag writes alone, none recreated${c.refused ? `; ${c.refused} refused, left where they were` : ""}.`,
280
+ text: `${migration.name} is done: ${what} by tag writes alone, none recreated${c.refused ? `; ${c.refused} refused, left where they were` : ""}.`,
278
281
  };
279
282
  }
@@ -116,6 +116,16 @@ describe("the live carve as a show (#715)", () => {
116
116
  expect(done.focus).toEqual({ kind: "all" });
117
117
  expect(liveEndTip(m, 0).key).toBe("end:carve");
118
118
  });
119
+
120
+ it("says an adoption's end in stamps alone, with no 0 moved (#711)", () => {
121
+ const line = (address, outcome) => ({ at: "2026-10-20T10:00:00Z", estate_from: "", estate_to: "tl7-shared", address, live_id: address, outcome });
122
+ const adopt = { name: "adopt", counts: { moved: 0, stamped: 2, refused: 0, skipped: 0, left: 0 }, lines: [line("a", "stamped"), line("b", "stamped")] };
123
+ expect(liveEndTip(adopt, 0).text).toBe("adopt is done: 2 resources stamped by tag writes alone, none recreated.");
124
+ const split = { name: "split", counts: { moved: 1, stamped: 0, refused: 0, skipped: 0, left: 0 }, lines: [line("a", "moved")] };
125
+ expect(liveEndTip(split, 0).text).toBe("split is done: 1 resources moved by tag writes alone, none recreated.");
126
+ const both = { name: "m", counts: { moved: 1, stamped: 2, refused: 0, skipped: 0, left: 0 }, lines: [line("a", "moved"), line("b", "stamped"), line("c", "stamped")] };
127
+ expect(liveEndTip(both, 0).text).toBe("m is done: 1 resources moved and 2 stamped by tag writes alone, none recreated.");
128
+ });
119
129
  });
120
130
 
121
131
  describe("the gate, in the page (#715)", () => {
package/web/dots.js CHANGED
@@ -166,6 +166,7 @@ function addStyle() {
166
166
  .dots-on > svg { position: relative; z-index: 1; background: transparent; }
167
167
  /* Once the cards are out of the paint a touch lands on the host: a pinch there is the camera's, never the page's zoom. */
168
168
  .dots-on { touch-action: none; }
169
+ html.kiosk-touch .dots-on { touch-action: pan-x pan-y; }
169
170
  .dots-on > svg > rect[fill^="url(#pin-"] { display: none; }
170
171
  .dots-on > svg [data-node-id], .dots-on > svg rect[data-group-id], .dots-on > svg text { opacity: var(--dots-card-a, 1); }
171
172
  #dots-canvas { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; }
@@ -182,13 +183,14 @@ function addStyle() {
182
183
  .dots-rail-mark:hover i, .dots-rail-mark:focus-visible i { border-color: var(--focus); }
183
184
  .dots-rail-mark:disabled { cursor: default; color: var(--muted); }
184
185
  .dots-rail-mark:disabled:hover i { border-color: var(--muted); }
185
- .dots-bottom { position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: calc(100% - 24px); pointer-events: none; }
186
+ /* behold#729: the pane's whole width less a gutter, so the caption can use it; a box centred at left 50% could never be wider than half the pane. */
187
+ .dots-bottom { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
186
188
  .dots-bottom > * { pointer-events: auto; }
187
189
  .dots-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: calc(100% - 24px); background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; box-sizing: border-box; }
188
190
  .dots-bar button, .dots-bar select { background: var(--well); color: var(--fg); border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px; font: inherit; cursor: pointer; }
189
191
  .dots-bar input[type=range] { width: min(320px, 40vw); accent-color: var(--focus); }
190
192
  .dots-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 12em; }
191
- .dots-caption { padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--fg); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
193
+ .dots-caption { padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--bg) 80%, transparent); color: var(--fg); max-width: min(72ch, 100%); text-align: center; box-sizing: border-box; }
192
194
  .dots-kiosk .dots-caption { display: none; }
193
195
  /* #715: a live carve has no playback head: it plays as it is written. */
194
196
  .dots-live .dots-bar { display: none; }
@@ -1042,6 +1044,31 @@ function landedIds() {
1042
1044
  return out;
1043
1045
  }
1044
1046
 
1047
+ /**
1048
+ * A selected dot's tip follows the dot as the camera moves (the director reframes the boxes at each chapter), hides
1049
+ * while the dot is not drawn, and goes with the selection when a new read's scene no longer holds the dot.
1050
+ */
1051
+ function followSelected() {
1052
+ if (!S || !S.selected || !S.tip) return;
1053
+ const i = S.idx.get(S.selected);
1054
+ if (i === undefined) {
1055
+ S.selected = null;
1056
+ S.tip.style.display = "none";
1057
+ S.tipAt = null;
1058
+ if (S.provLink) S.provLink.hidden = true;
1059
+ return;
1060
+ }
1061
+ if (!S.pvis[i]) {
1062
+ S.tip.style.display = "none";
1063
+ S.tipAt = null;
1064
+ return;
1065
+ }
1066
+ const at = `${Math.round(S.px[i])},${Math.round(S.py[i])},${Math.round(S.ph[i])}`;
1067
+ if (at === S.tipAt && S.tip.style.display === "block") return;
1068
+ S.tipAt = at;
1069
+ showTip(S.selected, S.px[i], S.py[i] + S.ph[i], S.py[i] - S.ph[i]);
1070
+ }
1071
+
1045
1072
  /** Select a dot: its tip stays up, and its provenance is read out in the live region, for a reader without a pointer. */
1046
1073
  function selectDot(id) {
1047
1074
  if (!S) return;
@@ -1279,6 +1306,7 @@ function polyline(ctx, pts) {
1279
1306
  }
1280
1307
 
1281
1308
  function draw(dt) {
1309
+ followSelected();
1282
1310
  const { ctx, canvas, scene, pitch: P, origin: O, col } = S;
1283
1311
  const cam = camera();
1284
1312
  const dpr = window.devicePixelRatio || 1;
@@ -2019,10 +2047,19 @@ function viewerHold() {
2019
2047
  */
2020
2048
  function watchViewer() {
2021
2049
  const host = S.host;
2050
+ // The kiosk on a phone: one finger scrolls the page (web/app.js kioskTouch), so only a second finger has the camera.
2051
+ const phone = () => document.documentElement.classList.contains("kiosk-touch");
2052
+ // A tap's compatibility mousedown carries no pointerType: on a phone it is the tap.
2053
+ const pressed = (e) => {
2054
+ if (!(phone() && (e.pointerType === "touch" || e.type === "mousedown"))) viewerHold();
2055
+ };
2022
2056
  const dragging = (e) => {
2023
- if (e.buttons) viewerHold();
2057
+ if (e.buttons && !(phone() && e.pointerType === "touch")) viewerHold();
2058
+ };
2059
+ const touched = (e) => {
2060
+ if (!phone() || e.touches.length >= 2) viewerHold();
2024
2061
  };
2025
- for (const [ev, f] of [["wheel", viewerHold], ["pointerdown", viewerHold], ["mousedown", viewerHold], ["touchstart", viewerHold], ["touchmove", viewerHold], ["pointermove", dragging]]) {
2062
+ for (const [ev, f] of [["wheel", viewerHold], ["pointerdown", pressed], ["mousedown", pressed], ["touchstart", touched], ["touchmove", touched], ["pointermove", dragging]]) {
2026
2063
  host.addEventListener(ev, f, { passive: true });
2027
2064
  S.off.push(() => host.removeEventListener(ev, f));
2028
2065
  }
package/web/index.html CHANGED
@@ -128,6 +128,7 @@
128
128
  the "⤢ fit" button resets. behold also adds a selection highlight. */
129
129
  #graph svg { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none;
130
130
  user-select: none; -webkit-user-select: none; }
131
+ html.kiosk-touch #graph svg { touch-action: pan-x pan-y; }
131
132
  #graph svg.grabbing { cursor: grabbing; }
132
133
  /* Edge hover-highlight — trace a single edge through an overlapping bundle.
133
134
  pinhole already paints a fat transparent hit-path per edge (pointer-events
@@ -206,6 +207,10 @@
206
207
  #ws-gates .ws-gate-title { font-weight: 600; }
207
208
  #ws-gates .ws-gate-facts, #ws-gates .ws-gate-note { color: var(--muted); font-size: var(--t-caption); }
208
209
  #ws-gates .ws-gate button { margin-top: var(--s1); }
210
+ /* #472: an open decision point, inside its gate's card or on its own. Never a button. */
211
+ #ws-gates .ws-gate .ws-point { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--rule); }
212
+ #ws-gates .ws-point-question { font-size: var(--t-caption); }
213
+ #ws-gates .ws-point-command { display: block; margin-top: var(--s1); font-size: var(--t-caption); overflow-wrap: anywhere; user-select: all; }
209
214
  /* #526: SQL Yodeler's report and drift, from files, dated. Never a fill. */
210
215
  #panel-body #tab-yodel.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
211
216
  #tab-yodel h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); }
@@ -284,6 +289,40 @@
284
289
  #tab-trunk .ws-gate-facts, #tab-trunk .ws-gate-note { color: var(--muted); overflow-wrap: anywhere; }
285
290
  #tab-trunk a { color: inherit; }
286
291
  #tab-trunk .lane-change-set { color: var(--pending); }
292
+ /* behold#685: a plan run locally, beside CI's, in the runs pane's run view (web/kiosk-runs.js renderRun; kiosk.html's rules, scoped). */
293
+ #panel-body #tab-local-runs.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
294
+ #tab-local-runs h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); }
295
+ #tab-local-runs .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
296
+ #tab-local-runs .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
297
+ #tab-local-runs .lr-form { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: end; }
298
+ #tab-local-runs .lr-field { display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
299
+ #tab-local-runs .lr-field input { font: var(--t-caption) var(--font-mono); width: 12ch; }
300
+ #tab-local-runs .lr-field input[name="commit"], #tab-local-runs .lr-field input[name="base"] { width: 16ch; }
301
+ #tab-local-runs .lr-ci-row { display: flex; gap: var(--s3); align-items: center; border-top: 1px solid var(--rule); padding-top: 3px; }
302
+ #tab-local-runs .lr-ci-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
303
+ #tab-local-runs .lr-run { cursor: pointer; border-top: 1px solid var(--rule); padding-top: 3px; font-family: var(--font-mono); }
304
+ #tab-local-runs .lr-run.lr-selected { background: var(--active); }
305
+ #tab-local-runs .lr-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: var(--s3); margin-top: var(--s2); }
306
+ #tab-local-runs .lr-half { border: 1px solid var(--rule); border-radius: 6px; min-width: 0; }
307
+ #tab-local-runs .lr-half-head { font-weight: 600; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); overflow-wrap: anywhere; }
308
+ #tab-local-runs .r-head { padding: var(--s2) var(--s3); }
309
+ #tab-local-runs .r-head-title { display: flex; gap: var(--s2); align-items: center; font-weight: 600; }
310
+ #tab-local-runs .r-head-sub, #tab-local-runs .r-head-meta, #tab-local-runs .r-label, #tab-local-runs .r-note, #tab-local-runs .r-dur, #tab-local-runs .r-steps-word { color: var(--muted); }
311
+ #tab-local-runs .r-head-sub { overflow-wrap: anywhere; }
312
+ #tab-local-runs .r-label { display: block; font-weight: 600; padding: var(--s2) var(--s3) 0; }
313
+ #tab-local-runs .r-jobs { list-style: none; margin: 0; padding: 0; }
314
+ #tab-local-runs .r-job, #tab-local-runs .r-step-line, #tab-local-runs .r-steps-head { display: flex; gap: var(--s2); align-items: center; padding: 2px var(--s3); cursor: pointer; }
315
+ #tab-local-runs .r-job-name, #tab-local-runs .r-steps-job { font-family: var(--font-mono); font-weight: 600; }
316
+ #tab-local-runs .r-dur { margin-left: auto; white-space: nowrap; }
317
+ #tab-local-runs .r-icon { width: 1em; height: 1em; flex: none; }
318
+ #tab-local-runs .r-ok { color: var(--managed); } #tab-local-runs .r-bad { color: var(--degraded); } #tab-local-runs .r-wait, #tab-local-runs .r-busy { color: var(--foreign); } #tab-local-runs .r-idle { color: var(--neutral); }
319
+ #tab-local-runs .r-caret { color: var(--muted); width: 0.8em; }
320
+ #tab-local-runs .r-open > .r-step-line, #tab-local-runs .r-job.r-selected { background: var(--active); }
321
+ #tab-local-runs .r-log { margin: 2px var(--s3) var(--s2) 1.6em; padding: var(--s2) 0; background: var(--surface-box, transparent); border: 1px solid var(--rule); border-radius: 6px; font: 0.95em/1.45 var(--font-mono); overflow-x: auto; max-height: 20em; overflow-y: auto; white-space: pre-wrap; }
322
+ #tab-local-runs .r-log-line { display: grid; grid-template-columns: 3em 1fr; gap: var(--s3); padding-right: var(--s3); }
323
+ #tab-local-runs .r-ln { color: var(--muted); text-align: right; user-select: none; }
324
+ #tab-local-runs .r-log-cut, #tab-local-runs .r-log-setup { color: var(--muted); padding-left: 4em; font-style: italic; }
325
+ #tab-local-runs a { color: inherit; }
287
326
  /* #692: the release column. */
288
327
  #tab-trunk .lane-release { border-top: 1px solid var(--rule); padding-top: 3px; }
289
328
  #tab-trunk .lane-release .lane-where { overflow-wrap: anywhere; }
@@ -291,6 +330,12 @@
291
330
  #tab-trunk .lane-revoked-why { color: var(--degraded); overflow-wrap: anywhere; }
292
331
  #tab-trunk .lane-rollback { font-family: var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
293
332
  #tab-trunk .lane-runs-revoked, #tab-trunk .lane-superseded { color: var(--degraded); overflow-wrap: anywhere; }
333
+ /* #731: a mixed environment, and chant's lines that settle it. */
334
+ #tab-trunk .lane-mixed { color: var(--pending); font-weight: 600; overflow-wrap: anywhere; }
335
+ #tab-trunk .lane-mixed-component { color: var(--muted); padding-left: var(--s3); overflow-wrap: anywhere; }
336
+ #tab-trunk .lane-mixed-unsettled { color: var(--degraded); }
337
+ #tab-trunk .lane-command { font-family: var(--font-mono); color: var(--muted); padding-left: var(--s3); overflow-wrap: anywhere; }
338
+ #tab-trunk .lane-command-line { user-select: all; }
294
339
  /* #681: a gate's change set, previewed on the graph. */
295
340
  #panel-body #tab-change-set.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
296
341
  #tab-change-set h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); }