@intentius/behold 0.29.41 → 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.
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.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.",
@@ -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
+ });
package/web/dots.js CHANGED
@@ -97,16 +97,16 @@ function addStyle() {
97
97
  .dots-rail-mark { position: absolute; right: 0; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--fg); cursor: pointer; padding: 3px 0; text-align: right; font: inherit; }
98
98
  .dots-rail-mark span { display: block; }
99
99
  .dots-rail-mark b { display: block; font-weight: 600; }
100
- .dots-rail-mark small { display: block; color: var(--muted); font-size: 11px; }
100
+ .dots-rail-mark small { display: block; color: var(--muted); font-size: 11.5px; }
101
101
  .dots-rail-mark i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--muted); background: var(--bg); flex: none; margin-right: 4px; }
102
102
  .dots-rail-mark:hover i, .dots-rail-mark:focus-visible i { border-color: var(--focus); }
103
103
  .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; }
104
104
  .dots-bottom > * { pointer-events: auto; }
105
- .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 10px; box-sizing: border-box; }
105
+ .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; }
106
106
  .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; }
107
107
  .dots-bar input[type=range] { width: min(320px, 40vw); accent-color: var(--focus); }
108
108
  .dots-time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 12em; }
109
- .dots-caption { padding: 3px 10px; 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; }
109
+ .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; }
110
110
  .dots-kiosk .dots-caption { display: none; }
111
111
  /* #715: a live carve has no playback head: it plays as it is written. */
112
112
  .dots-live .dots-bar { display: none; }
@@ -119,20 +119,20 @@ function addStyle() {
119
119
  .dots-keep-bar .dots-bar:hover, .dots-keep-bar .dots-bar:focus-within { opacity: 1; }
120
120
  /* In Watch the director holds the camera; the rail is Inspect's. */
121
121
  .dots-kiosk.dots-watch:not(.dots-keep-bar) .dots-rail { display: none; }
122
- .dots-tip { position: absolute; pointer-events: none; padding: 3px 7px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line); white-space: nowrap; display: none; font-size: 12px; max-width: min(560px, calc(100% - 16px)); }
123
- .dots-tip .dots-prov { white-space: normal; color: var(--muted); font: 11.5px/1.35 var(--font-mono, monospace); margin-top: 2px; }
122
+ .dots-tip { position: absolute; pointer-events: none; padding: 3px 6px; border-radius: 5px; background: var(--panel); border: 1px solid var(--line); white-space: nowrap; display: none; font-size: 12px; max-width: min(560px, calc(100% - 16px)); }
123
+ .dots-tip .dots-prov { white-space: normal; color: var(--ink2, var(--muted)); font: 11.5px/1.35 var(--font-mono, monospace); margin-top: 2px; }
124
124
  /* A recording's timeline (#711): the label on the timeline itself, wall-clock ticks, the marks the records give, the breaks it skips. */
125
125
  .dots-bar-rec { flex-direction: column; align-items: stretch; gap: 4px; width: min(860px, calc(100vw - 48px)); }
126
126
  .dots-tl-label { font: 600 12px var(--font-ui, system-ui); color: var(--fg); }
127
127
  .dots-tl-short { display: none; }
128
128
  .dots-tl-row { display: flex; align-items: flex-end; gap: 16px; }
129
129
  /* Break labels sit in their own row above the track; tick labels sit in the track, so the two never meet. */
130
- .dots-tl-track { position: relative; flex: 1; height: 30px; margin-top: 15px; border-bottom: 1px solid var(--line); }
130
+ .dots-tl-track { position: relative; flex: 1; height: 30px; margin-top: 16px; border-bottom: 1px solid var(--line); }
131
131
  .dots-bar input.dots-tl-range { position: absolute; left: 0; right: 0; bottom: -8px; width: 100%; margin: 0; accent-color: var(--focus); background: transparent; }
132
- .dots-tl-tick { position: absolute; bottom: 10px; transform: translateX(-50%); font: 10.5px var(--font-mono, monospace); color: var(--muted); white-space: nowrap; pointer-events: none; }
132
+ .dots-tl-tick { position: absolute; bottom: 10px; transform: translateX(-50%); font: 11.5px var(--font-mono, monospace); color: var(--muted); white-space: nowrap; pointer-events: none; }
133
133
  .dots-tl-tick::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1px; height: 4px; background: var(--line); }
134
134
  .dots-tl-break { position: absolute; top: 0; bottom: 0; width: 8px; transform: translateX(-50%); background: repeating-linear-gradient(135deg, var(--muted) 0 1.5px, transparent 1.5px 4px); opacity: 0.8; cursor: help; z-index: 1; }
135
- .dots-tl-break small { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font: 10px var(--font-mono, monospace); color: var(--muted); white-space: nowrap; }
135
+ .dots-tl-break small { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font: 11.5px var(--font-mono, monospace); color: var(--muted); white-space: nowrap; }
136
136
  .dots-tl-break-end small { left: auto; right: 0; transform: none; }
137
137
  .dots-bar .dots-tl-mark { position: absolute; top: 2px; width: 9px; height: 9px; padding: 0; margin-left: -4.5px; transform: rotate(45deg); border: 1.5px solid var(--focus); background: var(--focus); border-radius: 2px; cursor: pointer; z-index: 2; }
138
138
  .dots-bar .dots-tl-keyframe { border-color: var(--muted); background: var(--muted); }
@@ -141,7 +141,7 @@ function addStyle() {
141
141
  .dots-bar .dots-tl-first, .dots-bar .dots-tl-last { border-color: var(--bar-managed, var(--focus)); }
142
142
  .dots-speed { white-space: nowrap; font-variant-numeric: tabular-nums; }
143
143
  .dots-tip.dots-tip-go { pointer-events: auto; cursor: pointer; border-color: var(--focus); }
144
- .dots-prov-go { font: 11px var(--font-ui, system-ui); color: var(--focus); margin-top: 2px; }
144
+ .dots-prov-go { font: 11.5px var(--font-ui, system-ui); color: var(--focus); margin-top: 2px; }
145
145
  @media (max-width: 640px) { .dots-tl-long { display: none; } .dots-tl-short { display: inline; } .dots-tl-break small { display: none; } .dots-bar-rec { width: calc(100vw - 24px); } .dots-tl-row { flex-wrap: wrap; } .dots-tl-track { order: -1; flex: 1 1 100%; } }
146
146
  .dots-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
147
147
  .dots-keys { position: absolute; left: 8px; top: 8px; opacity: 0; pointer-events: none; font: 12px var(--font-ui, system-ui); background: var(--panel); color: var(--fg); border: 1px solid var(--focus); border-radius: 6px; padding: 3px 8px; }
@@ -153,7 +153,7 @@ function addStyle() {
153
153
  .dots-rail-mark { font-size: 11px; }
154
154
  .dots-rail-mark small { display: none; }
155
155
  .dots-bottom { bottom: 6px; }
156
- .dots-bar { gap: 6px; padding: 5px 8px; }
156
+ .dots-bar { gap: 6px; padding: 4px 8px; }
157
157
  .dots-bar input[type=range] { width: 100%; order: 9; }
158
158
  .dots-time { min-width: 0; }
159
159
  .dots-caption { font-size: 12px; white-space: normal; text-align: center; }
@@ -103,7 +103,7 @@ export const MODAL_STYLE = `
103
103
  border: 2px solid var(--bar, var(--focus)); box-shadow: 0 16px 48px color-mix(in srgb, var(--shadow) 80%, transparent); font-size: 1.05em; }
104
104
  .eh-modal-held { --bar: var(--bar-foreign, var(--foreign)); } .eh-modal-failed { --bar: var(--bar-degraded, var(--degraded)); } .eh-modal-applied { --bar: var(--bar-managed, var(--managed)); }
105
105
  .eh-modal-close { position: absolute; top: 0.4em; right: 0.5em; font-size: 1.3em; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
106
- .eh-modal-mode { margin: 0 2em 0.3em 0; font: 600 0.78em var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--bar, var(--muted)); }
106
+ .eh-modal-mode { margin: 0 2em 0.3em 0; font: 600 0.8em var(--font-ui); font-variant-numeric: tabular-nums; color: var(--bar, var(--muted)); }
107
107
  .eh-modal-title { margin: 0 0 0.5em; font-size: 1.35em; }
108
108
  .eh-modal-line { margin: 0.2em 0; color: color-mix(in srgb, var(--fg) 82%, var(--muted)); }
109
109
  .eh-modal-line.eh-lit { color: var(--fg); font-family: var(--font-mono); font-size: 0.9em; padding: 0.35em 0.6em; border-radius: 6px; background: color-mix(in srgb, var(--bar, var(--focus)) 14%, var(--well, transparent)); box-shadow: inset 3px 0 0 var(--bar, var(--focus)); }