@intentius/behold 0.29.41 → 0.29.43

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/AGENTS.md CHANGED
@@ -1047,6 +1047,38 @@ src/chant-floors.ts (0.124.28), and the route refuses a chant below any of them
1047
1047
  before spawning. The panel's Trunk tab (web/trunk-lane.js) reads it when opened
1048
1048
  and approves through `POST /api/workspace/gates/approve`.
1049
1049
 
1050
+ The release column (#692) sits between the commits and the environments:
1051
+ `releases[]`, every release `release list` names, newest first, each with its
1052
+ `commit`, `label` and digest, its newest `cut` (who, when, and chant's
1053
+ `signatureCheck`), `runs` (environments in promotion order, with components),
1054
+ `waits` (a release gate that binds it, or a gate of its member reached at its
1055
+ commit; `pending`, or `superseded`), and `next`, the environment its member's
1056
+ promotion order names after the last one that runs it (null in the last one,
1057
+ and for a revoked release, which chant never promotes). Each commit carries
1058
+ `cuts`, the releases cut from it.
1059
+
1060
+ `configOnly` is true when a release carries artifact digests and they equal
1061
+ its previous release's. The previous release is the one of the same member
1062
+ cut from the nearest older commit: releases are ordered by their commit's
1063
+ place in the trunk list (first-parent, newest first), a commit older than the
1064
+ list after every listed one, and ties (one commit, or commits outside the
1065
+ list) by `release list`'s order, newest cut first. That is how `release cut`
1066
+ reuses an unchanged artifact's digest. It is null for the oldest release and
1067
+ for a release with no artifact digests (a member with no components).
1068
+
1069
+ The revoked fields ship in chant 0.124.29 (`RELEASE_COLUMN_CHANT_FLOOR`,
1070
+ chant#4033, chant#4043): `revoked` on a `release list` release (the
1071
+ ci/revoked tag, with `rollback`, the lines status gives for each component
1072
+ running it), `superseded` on each environment (release gates chant reads as
1073
+ superseded, never approvable), `rollback` on an environment's releases, and
1074
+ `release` and `rollback` on a deploy record. `releaseColumn: {full, floor}`
1075
+ says whether they were read. Below the floor nothing is refused: the column
1076
+ comes from `release list` alone with no revoked mark, and the tab says which
1077
+ chant would add it. The fixtures in `src/__fixtures__/trunk-lane/` are
1078
+ recorded from chant main in the workspace `src/trunk-lane-fixture.ts` makes,
1079
+ and `src/trunk-lane-chant.test.ts` reads the same workspace through a real
1080
+ chant when `BEHOLD_TEST_CHANT_BIN` names one.
1081
+
1050
1082
  ## A gate's change set on the graph (#681)
1051
1083
 
1052
1084
  `GET /api/workspace/change-set?gate=<member>/<op>/<gate>&env=<env>`
package/dist/cli.js CHANGED
@@ -2193,7 +2193,7 @@ function floorFor(read) {
2193
2193
  if (!f) throw new Error(`no chant floor for the read "${read}" in src/chant-floors.ts`);
2194
2194
  return f;
2195
2195
  }
2196
- var TRAFFIC_FLOOR, NAMESPACE_JOIN_FLOOR, WORKSPACE_CHANT_FLOOR, WHY_CHANT_FLOOR, OPERATOR_LOG_FLOOR, CARVE_STATUS_FLOOR, CI_LIST_CHANT_FLOOR, RELEASE_LIST_CHANT_FLOOR, PROMOTION_ORDER_CHANT_FLOOR, CHANGE_SET_SHOW_CHANT_FLOOR, RUN_EVENTS_CHANT_FLOOR, CHANT_FLOORS;
2196
+ var TRAFFIC_FLOOR, NAMESPACE_JOIN_FLOOR, WORKSPACE_CHANT_FLOOR, WHY_CHANT_FLOOR, OPERATOR_LOG_FLOOR, CARVE_STATUS_FLOOR, CI_LIST_CHANT_FLOOR, RELEASE_LIST_CHANT_FLOOR, PROMOTION_ORDER_CHANT_FLOOR, CHANGE_SET_SHOW_CHANT_FLOOR, RUN_EVENTS_CHANT_FLOOR, RELEASE_COLUMN_CHANT_FLOOR, CHANT_FLOORS;
2197
2197
  var init_chant_floors = __esm({
2198
2198
  "src/chant-floors.ts"() {
2199
2199
  "use strict";
@@ -2209,6 +2209,7 @@ var init_chant_floors = __esm({
2209
2209
  PROMOTION_ORDER_CHANT_FLOOR = "0.124.28";
2210
2210
  CHANGE_SET_SHOW_CHANT_FLOOR = "0.124.28";
2211
2211
  RUN_EVENTS_CHANT_FLOOR = "0.124.28";
2212
+ RELEASE_COLUMN_CHANT_FLOOR = "0.124.29";
2212
2213
  CHANT_FLOORS = [
2213
2214
  { read: "workspace read contract", floor: WORKSPACE_CHANT_FLOOR, adds: "chant workspace (contract 1)" },
2214
2215
  { read: "why", floor: WHY_CHANT_FLOOR, adds: "graph --intent writes a why (chant#3312)" },
@@ -2220,7 +2221,8 @@ var init_chant_floors = __esm({
2220
2221
  { read: "release list", floor: RELEASE_LIST_CHANT_FLOOR, adds: "chant release list --json (chant#4026)" },
2221
2222
  { read: "promotion order", floor: PROMOTION_ORDER_CHANT_FLOOR, adds: "workspace status promotionOrder (chant#4030)" },
2222
2223
  { read: "change set", floor: CHANGE_SET_SHOW_CHANT_FLOOR, adds: "chant change-set show --json (chant#4022, chant#4045)" },
2223
- { read: "run events", floor: RUN_EVENTS_CHANT_FLOOR, adds: "run --events-json and chant run events (chant#4019, chant#4041, chant#4042)" }
2224
+ { read: "run events", floor: RUN_EVENTS_CHANT_FLOOR, adds: "run --events-json and chant run events (chant#4019, chant#4041, chant#4042)" },
2225
+ { read: "release column", floor: RELEASE_COLUMN_CHANT_FLOOR, adds: "revoked releases, and the release a deploy was made from (chant#4033, chant#4043)", degraded: "the Trunk tab draws its releases from chant release list alone, with no revoked mark" }
2224
2226
  ];
2225
2227
  }
2226
2228
  });
@@ -25447,7 +25449,7 @@ function floorChecks(root, targets, estate) {
25447
25449
  return CHANT_FLOORS.map((f) => {
25448
25450
  const behind = resolutions.filter(({ res }) => !floorMet(f, res.version));
25449
25451
  const head = `${f.read}: needs chant ${f.floor} (${f.adds}); ${have}`;
25450
- return behind.length ? { name: "floor", status: "warn", detail: `${head}, not met`, fix: `Upgrade @intentius/chant to ${f.floor} or newer in ${list2(behind.map(({ target }) => relative9(root, target) || target))}; the pane that needs the ${f.read} stays off until then.` } : { name: "floor", status: "pass", detail: `${head}, met` };
25452
+ return behind.length ? { name: "floor", status: "warn", detail: `${head}, not met`, fix: `Upgrade @intentius/chant to ${f.floor} or newer in ${list2(behind.map(({ target }) => relative9(root, target) || target))}; ${f.degraded ? `until then ${f.degraded}` : `the pane that needs the ${f.read} stays off until then`}.` } : { name: "floor", status: "pass", detail: `${head}, met` };
25451
25453
  });
25452
25454
  }
25453
25455
  function lexiconCheck(root, declared2, estate) {
@@ -29485,7 +29487,7 @@ function commitsFromCiList(doc) {
29485
29487
  problems: arr(w.problems).filter(isRecord22).map((p) => ({ trailer: String(p.trailer ?? ""), message: String(p.message ?? "") }))
29486
29488
  } : null;
29487
29489
  const ignored = arr(c.ignored).filter(isRecord22).map((t2) => ({ tag: String(t2.tag ?? ""), status: String(t2.status ?? ""), reason: String(t2.reason ?? "") }));
29488
- out.push({ sha: c.sha, committed: String(c.committed ?? ""), state, phases, revoked: rv, work, ignored, where: [] });
29490
+ out.push({ sha: c.sha, committed: String(c.committed ?? ""), state, phases, revoked: rv, work, ignored, where: [], cuts: [] });
29489
29491
  }
29490
29492
  return out;
29491
29493
  }
@@ -29506,7 +29508,11 @@ function promotionOrder(status2) {
29506
29508
  function releaseMembers(status2) {
29507
29509
  return arr(status2.members).filter(isRecord22).filter((m) => typeof m.name === "string" && arr(m.promotionOrder).length > 0).map((m) => ({ name: m.name, dir: typeof m.dir === "string" ? m.dir : "." }));
29508
29510
  }
29509
- function deployRecords(status2, env) {
29511
+ function revocation(v) {
29512
+ if (!isRecord22(v) || typeof v.tag !== "string") return null;
29513
+ return { tag: v.tag, tagged: str18(v.tagged), phase: str18(v.phase), run: run2(v.run), signer: str18(v.signer) };
29514
+ }
29515
+ function deployRecords(status2, env, full) {
29510
29516
  const out = [];
29511
29517
  for (const m of arr(status2.members)) {
29512
29518
  if (!isRecord22(m) || typeof m.name !== "string") continue;
@@ -29522,7 +29528,9 @@ function deployRecords(status2, env) {
29522
29528
  timestamp: String(r.timestamp ?? ""),
29523
29529
  actor: String(r.actor ?? ""),
29524
29530
  approver: str18(r.approver),
29525
- runId: String(r.runId ?? "")
29531
+ runId: String(r.runId ?? ""),
29532
+ release: full && str18(r.releaseDigest) ? { releaseDigest: r.releaseDigest, label: str18(r.releaseLabel) } : null,
29533
+ rollback: full && isRecord22(r.revoked) ? str18(r.revoked.rollback) : null
29526
29534
  });
29527
29535
  }
29528
29536
  }
@@ -29549,6 +29557,80 @@ function releasesIn(doc, member, env) {
29549
29557
  }
29550
29558
  return out;
29551
29559
  }
29560
+ function supersededGates(status2, env) {
29561
+ const out = [];
29562
+ for (const m of arr(status2.members)) {
29563
+ if (!isRecord22(m) || typeof m.name !== "string") continue;
29564
+ for (const g of arr(m.gates)) {
29565
+ if (!isRecord22(g) || g.state !== "superseded" || g.env !== env) continue;
29566
+ const op = str18(g.component);
29567
+ const gate = str18(g.name);
29568
+ const releaseDigest = str18(g.releaseDigest);
29569
+ const revoked = revocation(g.revoked);
29570
+ if (!op || !gate || !releaseDigest || !revoked) continue;
29571
+ out.push({ key: `${m.name}/${op}/${gate}`, member: m.name, op, gate, env, releaseDigest, gitSha: str18(g.gitSha), runId: str18(g.runId), revoked });
29572
+ }
29573
+ }
29574
+ return out;
29575
+ }
29576
+ var artifactKey = (v) => arr(v).filter(isRecord22).map((a) => JSON.stringify([String(a.component ?? ""), String(a.kind ?? ""), String(a.path ?? ""), String(a.digest ?? "")])).sort();
29577
+ function releaseColumn(docs2, commits, environments, full) {
29578
+ const at2 = new Map(commits.map((c, i) => [c.sha, i]));
29579
+ const place = (commit) => at2.get(commit) ?? Number.POSITIVE_INFINITY;
29580
+ const rows = [];
29581
+ for (const { member, doc } of docs2) {
29582
+ const items = arr(doc.releases).map((r, i) => ({ r, i })).filter((x) => isRecord22(x.r) && typeof x.r.releaseDigest === "string" && typeof x.r.commit === "string").sort((a, b) => place(a.r.commit) - place(b.r.commit) || a.i - b.i);
29583
+ const order = environments.filter((e) => e.members.includes(member)).map((e) => e.env);
29584
+ items.forEach(({ r, i }, k) => {
29585
+ const releaseDigest = r.releaseDigest;
29586
+ const commit = r.commit;
29587
+ const before = items[k + 1]?.r;
29588
+ const artifacts = artifactKey(r.artifactDigests);
29589
+ const cuts = arr(r.cuts).filter(isRecord22);
29590
+ const last = cuts.at(-1);
29591
+ const check = last && isRecord22(last.signatureCheck) ? last.signatureCheck : null;
29592
+ const ran = arr(r.environments).filter(isRecord22);
29593
+ const runs2 = [
29594
+ ...environments.map((e) => e.env),
29595
+ ...ran.map((e) => String(e.env ?? "")).filter((env) => !environments.some((e) => e.env === env))
29596
+ ].map((env) => {
29597
+ const e = ran.find((x) => x.env === env);
29598
+ return e ? { env, components: arr(e.components).filter((c) => typeof c === "string") } : null;
29599
+ }).filter((x) => x !== null);
29600
+ const waits = [];
29601
+ for (const e of environments) {
29602
+ for (const g of e.waiting) {
29603
+ const mine = g.releaseDigest ? g.releaseDigest === releaseDigest : g.member === member && g.gitSha === commit;
29604
+ if (mine && g.state === "pending") waits.push({ env: e.env, gate: g.key, state: "pending" });
29605
+ }
29606
+ for (const g of e.superseded) if (g.releaseDigest === releaseDigest) waits.push({ env: e.env, gate: g.key, state: "superseded" });
29607
+ }
29608
+ const rv = full ? revocation(r.revoked) : null;
29609
+ const rollback = environments.flatMap((e) => e.releases.filter((x) => x.member === member && x.releaseDigest === releaseDigest).flatMap((x) => x.rollback));
29610
+ const furthest = Math.max(-1, ...runs2.map((x) => order.indexOf(x.env)));
29611
+ rows.push({
29612
+ at: place(commit),
29613
+ i,
29614
+ row: {
29615
+ member,
29616
+ releaseDigest,
29617
+ label: str18(r.label),
29618
+ commit,
29619
+ listed: at2.has(commit),
29620
+ artifacts: artifacts.length,
29621
+ previous: before ? { releaseDigest: before.releaseDigest, label: str18(before.label) } : null,
29622
+ configOnly: before && artifacts.length ? artifacts.join() === artifactKey(before.artifactDigests).join() : null,
29623
+ cut: last ? { by: String(last.actor ?? ""), at: String(last.timestamp ?? ""), signature: check ? { status: String(check.status ?? ""), reason: String(check.reason ?? "") } : null } : null,
29624
+ revoked: rv ? { ...rv, rollback } : null,
29625
+ runs: runs2,
29626
+ waits,
29627
+ next: rv ? null : order[furthest + 1] ?? null
29628
+ }
29629
+ });
29630
+ });
29631
+ }
29632
+ return rows.sort((a, b) => a.at - b.at || (a.row.member < b.row.member ? -1 : a.row.member > b.row.member ? 1 : 0) || a.i - b.i).map((x) => x.row);
29633
+ }
29552
29634
  var isRefusal = (v) => typeof v.error === "string" && typeof v.code === "string";
29553
29635
  function laneFrom(input) {
29554
29636
  let trunk = null;
@@ -29583,23 +29665,29 @@ function laneFrom(input) {
29583
29665
  };
29584
29666
  const environments = input.statuses.map((s) => {
29585
29667
  const base = { env: s.env, canary: s.canary, members: s.members };
29586
- if (isRefusal(s.status)) return { ...base, releases: [], deploys: [], waiting: [], refusal: s.status };
29587
- const records = deployRecords(s.status, s.env);
29588
- const releases = releaseDocs.flatMap(
29589
- ({ member, doc }) => releasesIn(doc, member, s.env).map((r) => ({
29590
- ...r,
29591
- listed: bySha.has(r.commit),
29592
- approver: records.find((d) => d.member === member && r.components.includes(d.component) && d.approver)?.approver ?? null
29593
- }))
29668
+ if (isRefusal(s.status)) return { ...base, releases: [], deploys: [], waiting: [], superseded: [], refusal: s.status };
29669
+ const records = deployRecords(s.status, s.env, input.full);
29670
+ const releases2 = releaseDocs.flatMap(
29671
+ ({ member, doc }) => releasesIn(doc, member, s.env).map((r) => {
29672
+ const mine = records.filter((d) => d.member === member && r.components.includes(d.component));
29673
+ return {
29674
+ ...r,
29675
+ listed: bySha.has(r.commit),
29676
+ approver: mine.find((d) => d.approver)?.approver ?? null,
29677
+ rollback: mine.map((d) => d.rollback).filter((x) => x !== null)
29678
+ };
29679
+ })
29594
29680
  );
29595
- const covered = (d) => releases.some((r) => r.member === d.member && r.components.includes(d.component));
29681
+ const covered = (d) => releases2.some((r) => r.member === d.member && (r.components.includes(d.component) || r.releaseDigest === d.release?.releaseDigest));
29596
29682
  const deploys = records.filter((d) => !covered(d)).map((d) => ({ ...d, listed: bySha.has(d.gitSha) }));
29597
29683
  const waiting = s.gates.filter((g) => g.env === s.env).map(({ dir: _dir, ...g }) => ({ ...g, commitState: g.gitSha ? bySha.get(g.gitSha)?.state ?? null : null }));
29598
- for (const r of releases) place(r.commit, { env: s.env, what: "runs" });
29684
+ for (const r of releases2) place(r.commit, { env: s.env, what: "runs" });
29599
29685
  for (const d of deploys) place(d.gitSha, { env: s.env, what: "runs" });
29600
29686
  for (const g of waiting) if (g.gitSha && g.state === "pending") place(g.gitSha, { env: s.env, what: "waits", gate: g.key });
29601
- return { ...base, releases, deploys, waiting };
29687
+ return { ...base, releases: releases2, deploys, waiting, superseded: input.full ? supersededGates(s.status, s.env) : [] };
29602
29688
  });
29689
+ const releases = releaseColumn(releaseDocs, commits, environments, input.full);
29690
+ for (const r of releases) bySha.get(r.commit)?.cuts.push({ member: r.member, releaseDigest: r.releaseDigest, label: r.label });
29603
29691
  return {
29604
29692
  trunk,
29605
29693
  ...trunkRefusal ? { trunkRefusal } : {},
@@ -29607,6 +29695,8 @@ function laneFrom(input) {
29607
29695
  environments,
29608
29696
  order: input.order,
29609
29697
  releaseRefusals,
29698
+ releases,
29699
+ releaseColumn: { full: input.full, floor: RELEASE_COLUMN_CHANT_FLOOR },
29610
29700
  read: { at: input.at.toISOString() }
29611
29701
  };
29612
29702
  }
@@ -29640,7 +29730,8 @@ async function readTrunkLane(ws, opts) {
29640
29730
  Promise.all(steps.map(async (s) => ({ ...s, ...await statusOf(s.env) }))),
29641
29731
  Promise.all(members.map(async (m) => ({ member: m.name, doc: await attempt(() => reader2.readTrunk("release list", [], m.dir)) })))
29642
29732
  ]);
29643
- return { ok: true, lane: laneFrom({ ci, statuses, releaseLists, order, at: (opts.now ?? (() => /* @__PURE__ */ new Date()))() }) };
29733
+ const full = floorMet(floorFor("release column"), opts.chant);
29734
+ return { ok: true, lane: laneFrom({ ci, statuses, releaseLists, order, full, at: (opts.now ?? (() => /* @__PURE__ */ new Date()))() }) };
29644
29735
  }
29645
29736
 
29646
29737
  // src/change-set-overlay.ts
@@ -31759,7 +31850,7 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
31759
31850
  const tooOld = laneFloorRefusal(version);
31760
31851
  if (tooOld) return c.json({ workspace: true, chant: version ?? null, refusal: tooOld, ...approver });
31761
31852
  const env = cfg.env || "local";
31762
- const read = await readTrunkLane(ws, { env });
31853
+ const read = await readTrunkLane(ws, { env, chant: version });
31763
31854
  if (!read.ok) return c.json({ workspace: true, chant: version ?? null, refusal: read.refusal, ...approver });
31764
31855
  return c.json({ workspace: true, chant: version ?? null, ...read.lane, ...approver });
31765
31856
  });
@@ -32238,7 +32329,7 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
32238
32329
  { method: "POST", path: "/api/ops/:name/run", desc: "run a committed Op (delegated write)" },
32239
32330
  { method: "POST", path: "/api/ops/:name/signal/:gate", desc: "approve an Op's gate (releases the waiting run)" },
32240
32331
  { method: "GET", path: "/api/workspace/gates", desc: "a declared workspace's waiting gates from chant workspace status <env> --json (?env=), keyed member/op/gate, with the approver behold would record (#477) as approver and approverIdentity {principal, source, forge, signs}, or approver null and approverRefusal (#690); a policy-override gate carries override {subject, rules, plan, digest, state, spentAt, product, command, source} and no approve path (#519)" },
32241
- { method: "GET", path: "/api/workspace/lane", desc: "the trunk lane (#680): per environment in the members' promotion order, the trunk's commits from chant ci list --json (green, revoked or undecided, with phases, runs and work items), the gates waiting on one, and the releases and deploy records each environment runs, from chant workspace status <env> --json and chant release list --json; approver fields as /api/workspace/gates; a chant below 0.124.28 is refused with refusal code chant-too-old" },
32332
+ { method: "GET", path: "/api/workspace/lane", desc: "the trunk lane (#680): per environment in the members' promotion order, the trunk's commits from chant ci list --json (green, revoked or undecided, with phases, runs and work items), the gates waiting on one, and the releases and deploy records each environment runs, from chant workspace status <env> --json and chant release list --json; the release column (#692): releases newest first, each with its cut, config-only mark, where it runs and waits and the environment it promotes to next, and from chant 0.124.29 its revoked mark with the rollback line and the release gates chant reads as superseded (releaseColumn.full false below it); approver fields as /api/workspace/gates; a chant below 0.124.28 is refused with refusal code chant-too-old" },
32242
32333
  { method: "GET", path: "/api/workspace/change-set", desc: "a waiting gate's stored change set for the graph overlay (#681): ?gate=<member>/<op>/<gate>&env=<env>; the gate and its digest from chant workspace status <env> --json, the change set from chant change-set show <digest> --member <member> --json; gate {key, gitSha, runId, releaseDigest}, digest, planned {releaseDigest, environment} for a release gate, graph {member, at}, entries [{address, action, bucket create|change|delete, node or null, attributes}], nodes {<id>: {bucket, actions}}, counts, gaps; a chant below 0.124.28 is refused with refusal code chant-too-old" },
32243
32334
  { method: "GET", path: "/api/workspace/why", desc: "why a member (?member=) or a node (?node=<member>/<id>) is the way it is: the decisions covering it, the runs and commits behind it, from chant workspace graph --intent <region> --json; read on demand, cancelled with the request (#471)" },
32244
32335
  { method: "POST", path: "/api/workspace/gates/approve", desc: "approve one workspace gate: JSON body {key, env}; env and plan come from a fresh status read; recorded as the request's approver with --actor and --note, a signed gate signed with that person's key or refused 422 code signed (#690); preview-locked (#477); a policy-override gate answers 422 code override with its command (#519)" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/behold",
3
- "version": "0.29.41",
3
+ "version": "0.29.43",
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.",
package/web/app.js CHANGED
@@ -11,7 +11,7 @@
11
11
  import "./view-repo.js"; // behold#571: first, so every read carries the page's ?repo=
12
12
  import { createRefreshQueue } from "./refresh-queue.js";
13
13
  import { readViewQuery, writeViewQuery, settleView, settlePlace, refusalLine } from "./view-url.js";
14
- import { quietCardLines, readEmbed, selectMessage, viewFromMessage } from "./embed.js";
14
+ import { quietCardLines, readEmbed, selectMessage, viewFromMessage, wheelPx, wheelZoomsBare } from "./embed.js";
15
15
  import { WORDS as POP_WORDS, cardRoot as popCardRoot, placePopover, popReduce, popState, resourcePopover, rootPopover } from "./kiosk-popover.js";
16
16
  import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLightBg, rootPaint, rootText } from "./kiosk-roots.js";
17
17
  import { gateCards } from "./workspace-gates.js";
@@ -122,7 +122,7 @@ import { shotFromMessage, shotViewBox, tweenViewBox, unionBox, sameViewBox } fro
122
122
  // (/api/terragucci/carve, liveCarveGate below), or when /api/graph's meta
123
123
  // carries `dots` (the local preview server, scripts/dots-preview.ts). With
124
124
  // neither it stays unmounted, and its hooks below are no-ops.
125
- import { mountDots, unmountDots, dotsCamera, dotsZoomOutFactor, dotsCarving } from "./dots.js";
125
+ import { mountDots, unmountDots, dotsCamera, dotsZoomOutFactor, dotsCarving, dotsMinViewWidth } from "./dots.js";
126
126
  import { carveDrawable } from "./dots-live.js";
127
127
  initTheme();
128
128
  // #476: framed in a host pane. The flag is a class on <html>, so the CSS that
@@ -4713,7 +4713,9 @@ function wireKioskFrame() {
4713
4713
  // behold#571: a click on the graph holds the kiosk's shot where the viewer is reading.
4714
4714
  if (card && kioskShot) kioskViewerMoved();
4715
4715
  // behold#571: a click on a wave's box (not a card in it) asks the kiosk for that wave's trace, or its log.
4716
- if (!card && !panMoved && embedOpts.host && window.parent !== window) {
4716
+ // While the dots layer has the SVG out of the paint, its wave boxes are not on screen: a tap there is on a dot or a card.
4717
+ const svgShown = !(currentSvg() && currentSvg().style.visibility === "hidden");
4718
+ if (!card && !panMoved && svgShown && embedOpts.host && window.parent !== window) {
4717
4719
  const box = e.target.closest && (e.target.closest("rect[data-group-id]") || e.target.closest("[data-group-id]"));
4718
4720
  let n = box ? tgWaveOfKey(box.getAttribute("data-group-id")) : null;
4719
4721
  if (n === null) {
@@ -7150,16 +7152,18 @@ function ensureZoomControls(host) {
7150
7152
  "wheel",
7151
7153
  (e) => {
7152
7154
  // Trackpad pinch fires wheel+ctrlKey; ⌘/Ctrl+scroll is the explicit gesture.
7153
- // Plain scroll is left alone (nothing to scroll when fit).
7154
- if (!vb || !(e.ctrlKey || e.metaKey)) return;
7155
+ // Plain scroll is left alone (nothing to scroll when fit), except in the kiosk's
7156
+ // bare frame: the graph is the whole stage there, so a mouse wheel zooms it, as a map's does.
7157
+ if (!vb || !(e.ctrlKey || e.metaKey || wheelZoomsBare(embedOpts.bare, e))) return;
7155
7158
  e.preventDefault();
7156
7159
  const s = currentSvg();
7157
7160
  if (!s) return;
7158
7161
  const r = s.getBoundingClientRect();
7159
7162
  const cx = vb[0] + ((e.clientX - r.left) / r.width) * vb[2];
7160
7163
  const cy = vb[1] + ((e.clientY - r.top) / r.height) * vb[3];
7161
- const f = Math.exp(e.deltaY * 0.0025); // scroll up → f<1 → zoom in
7162
- const minW = vbInit[2] / 60;
7164
+ const f = Math.exp(wheelPx(e) * 0.0025); // scroll up → f<1 → zoom in
7165
+ // While the dots layer draws the roster's cards, no further in than a little past them: past that is an empty stage.
7166
+ const minW = Math.max(vbInit[2] / 60, dotsMinViewWidth() ?? 0);
7163
7167
  const maxW = vbInit[2] * (dotsZoomOutFactor() ?? 3); // #712: the dots preview zooms out further
7164
7168
  const nw = Math.min(maxW, Math.max(minW, vb[2] * f));
7165
7169
  const nh = nw * (vb[3] / vb[2]);
@@ -7200,7 +7204,7 @@ function ensureZoomControls(host) {
7200
7204
  const m0 = mid(touch.pts);
7201
7205
  const cx = vb[0] + ((m.x - r.left) / r.width) * vb[2];
7202
7206
  const cy = vb[1] + ((m.y - r.top) / r.height) * vb[3];
7203
- const nw = Math.min(vbInit[2] * (dotsZoomOutFactor() ?? 3), Math.max(vbInit[2] / 60, vb[2] * f));
7207
+ const nw = Math.min(vbInit[2] * (dotsZoomOutFactor() ?? 3), Math.max(vbInit[2] / 60, dotsMinViewWidth() ?? 0, vb[2] * f));
7204
7208
  const nh = nw * (vb[3] / vb[2]);
7205
7209
  vb[0] = cx - ((cx - vb[0]) * nw) / vb[2] - ((m.x - m0.x) / r.width) * nw;
7206
7210
  vb[1] = cy - ((cy - vb[1]) * nh) / vb[3] - ((m.y - m0.y) / r.height) * nh;
@@ -11,6 +11,10 @@ import { tipSpot, tipsStyle, TIPS_STYLE_ID } from "./kiosk-event-help-ui.js";
11
11
  import { openEventModal } from "./event-help-modal.js";
12
12
  import { TIP } from "./dots-kiosk.js";
13
13
  import { lagText } from "./tour-player.js";
14
+ import { onLinkChange, pageStaleness } from "./kiosk-link.js";
15
+
16
+ /** behold#725: the stale badge's tooltip. */
17
+ export const STALE_WORDS = "The kiosk is not reading from behold right now, so this may be out of date. It keeps retrying.";
14
18
 
15
19
  const fmt = (n) => Number(n).toLocaleString("en-US");
16
20
 
@@ -32,6 +36,23 @@ export function badgeText(state) {
32
36
  return state.recording && state.recording.kind === "live" ? "live" : "recorded";
33
37
  }
34
38
 
39
+ /**
40
+ * behold#725: the live badge and its lag while the kiosk's link may be down.
41
+ * Live and reading: "live", the lag counting from now. While the kiosk can't
42
+ * read (`staleness` from web/kiosk-link.js): "stale", and the lag frozen at
43
+ * the last good read, so the screen never says "live" beside "not updating".
44
+ * Anything else: the badge as badgeText has it, and no lag.
45
+ */
46
+ export function liveBadge(state, staleness = { stale: false, since: null }, now = Date.now()) {
47
+ const word = badgeText(state);
48
+ if (word !== "live") return { word, cls: `cx-badge-${word}`, lag: null };
49
+ if (staleness.stale) {
50
+ const at = staleness.since ? staleness.since.getTime() : null;
51
+ return { word: "stale", cls: "cx-badge-stale", lag: at === null ? null : lagText(state.lastWriteAt, at, state.running) };
52
+ }
53
+ return { word, cls: "cx-badge-live", lag: lagText(state.lastWriteAt, now, state.running) };
54
+ }
55
+
35
56
  /** The badge's tooltip: what the recording is, or where the live carve is read from. */
36
57
  export function recordedWords(state) {
37
58
  const r = state.recording || {};
@@ -155,10 +176,11 @@ export function createNarration({ bar, caption, tipsHost, modalHost, origin }) {
155
176
  caption.replaceChildren();
156
177
  const top = el("div", "cx-top");
157
178
  const h = el("h1", "cx-title");
158
- const rec = el("span", `cx-rec cx-badge-${badgeText(state)}`, badgeText(state));
159
- rec.title = recordedWords(state);
179
+ const badge = liveBadge(state, pageStaleness());
180
+ const rec = el("span", `cx-rec ${badge.cls}`, badge.word);
181
+ rec.title = badge.word === "stale" ? STALE_WORDS : recordedWords(state);
160
182
  h.append(rec);
161
- const lag = badgeText(state) === "live" ? lagText(state.lastWriteAt, Date.now(), state.running) : null;
183
+ const lag = badge.lag;
162
184
  if (lag) h.append(el("span", `cx-lag${lag === "waiting for the job" ? " cx-lag-wait" : ""}`, lag));
163
185
  h.append(el("span", null, b.title));
164
186
  top.appendChild(h);
@@ -195,10 +217,11 @@ export function createNarration({ bar, caption, tipsHost, modalHost, origin }) {
195
217
  caption.replaceChildren();
196
218
  caption.classList.add("cx-tour");
197
219
  const top = el("div", "cx-top cx-tour-top");
198
- const rec = el("span", "cx-rec cx-badge-live", "live");
199
- rec.title = recordedWords(state);
220
+ const badge = liveBadge({ ...state, recording: { ...(state.recording || {}), kind: "live" } }, pageStaleness());
221
+ const rec = el("span", `cx-rec ${badge.cls}`, badge.word);
222
+ rec.title = badge.word === "stale" ? STALE_WORDS : recordedWords(state);
200
223
  top.appendChild(rec);
201
- const lag = lagText(state.lastWriteAt, Date.now(), state.running);
224
+ const lag = badge.lag;
202
225
  if (lag) top.appendChild(el("span", `cx-lag${lag === "waiting for the job" ? " cx-lag-wait" : ""}`, lag));
203
226
  const rail = el("ol", "cx-rail");
204
227
  rail.setAttribute("aria-label", `${tr.title || "The tour"}: chapter ${tr.n} of ${tr.of}`);
@@ -247,6 +270,9 @@ export function createNarration({ bar, caption, tipsHost, modalHost, origin }) {
247
270
  }
248
271
  };
249
272
 
273
+ // behold#725: the badge follows the kiosk's link at once, not at the next state from the frame.
274
+ onLinkChange(() => { if (last) draw(last); });
275
+
250
276
  return {
251
277
  update(state) {
252
278
  if (state.type !== "behold:dots-state") {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { recordedWords, mergeLandings } from "./carve-narration.js";
2
+ import { recordedWords, mergeLandings, liveBadge } from "./carve-narration.js";
3
3
 
4
4
  describe("the carve export's narration (#712)", () => {
5
5
  it("says what the recording is", () => {
@@ -16,3 +16,33 @@ describe("the carve export's narration (#712)", () => {
16
16
  expect(m.text).toMatch(/^a, b and c: their first resources land/);
17
17
  });
18
18
  });
19
+
20
+ // behold#725: the live badge never says "live" beside the kiosk's "not updating" cue.
21
+ describe("the live badge while the kiosk can't read (behold#725)", () => {
22
+ const live = { recording: { kind: "live" }, lastWriteAt: "2026-10-17T12:00:00.000Z", running: false };
23
+ const t = (iso) => new Date(iso).getTime();
24
+
25
+ it("says live, with the lag counting from now, while reads come back", () => {
26
+ const b = liveBadge(live, { stale: false, since: null }, t("2026-10-17T12:00:30.000Z"));
27
+ expect(b).toEqual({ word: "live", cls: "cx-badge-live", lag: "last write 30 s ago" });
28
+ });
29
+
30
+ it("says stale while the cue is up, its lag frozen at the last good read", () => {
31
+ const since = new Date("2026-10-17T12:00:12.000Z");
32
+ const b = liveBadge(live, { stale: true, since }, t("2026-10-17T12:05:00.000Z"));
33
+ expect(b.word).toBe("stale");
34
+ expect(b.cls).toBe("cx-badge-stale");
35
+ expect(b.lag).toBe("last write 12 s ago");
36
+ // Later still, the same words: frozen, not counting.
37
+ expect(liveBadge(live, { stale: true, since }, t("2026-10-17T12:09:00.000Z")).lag).toBe("last write 12 s ago");
38
+ });
39
+
40
+ it("drops the lag when nothing was ever read, and goes back to live on recovery", () => {
41
+ expect(liveBadge(live, { stale: true, since: null }).lag).toBe(null);
42
+ expect(liveBadge(live, { stale: false, since: null }, t("2026-10-17T12:00:05.000Z")).word).toBe("live");
43
+ });
44
+
45
+ it("leaves a recording's badge alone", () => {
46
+ expect(liveBadge({ recording: { kind: "carve" } }, { stale: true, since: null })).toEqual({ word: "recorded", cls: "cx-badge-recorded", lag: null });
47
+ });
48
+ });