@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/web/kiosk-runs.js CHANGED
@@ -281,6 +281,39 @@ export function placeWords(run, scenarios, titles = {}, names = {}) {
281
281
  return [sc, run.cycle !== null && run.cycle !== undefined ? `cycle ${run.cycle}` : null].filter(Boolean).join(" · ");
282
282
  }
283
283
 
284
+ /**
285
+ * behold#815: what chant's run index says of a run beside its trigger: its
286
+ * workspace member, why it failed, and who signed its record. A run nobody
287
+ * signed says nothing of it (signing is opt-in, chant#4156). An apply that
288
+ * exited 3 says its plan moved or waits, never that it failed, with the
289
+ * refusal that says so or (#818, chant#4165) its exit code. Empty for a run
290
+ * from anywhere else.
291
+ */
292
+ export function indexWords(run) {
293
+ // behold#685: a plan behold ran locally (src/ci-local-run.ts) says the same of itself.
294
+ if (!run || (run.from !== "ci-run-index" && run.from !== "chant-ci-local")) return [];
295
+ // The status beside it already says failed: chant's reason is added only when it says more than that.
296
+ const why = run.moved ? `${run.moved} (${run.heldBy || run.failure})` : run.failure && run.failure !== "failed" ? `failed: ${run.failure}` : null;
297
+ return [run.member || null, why, typeof run.signer === "string" && run.signer ? `signed by ${run.signer}` : null].filter(Boolean);
298
+ }
299
+
300
+ /**
301
+ * behold#815: where a run of chant's run index says it ran, as a link: its
302
+ * runOrigin's URL, named by the URL's own host (a Forgejo run is recorded as
303
+ * forge `github`, so the forge's name is never taken from the record). Null
304
+ * without an http(s) URL.
305
+ */
306
+ export function originLink(run) {
307
+ if (!run || run.from !== "ci-run-index" || typeof run.origin !== "string") return null;
308
+ let u;
309
+ try {
310
+ u = new URL(run.origin);
311
+ } catch {
312
+ return null;
313
+ }
314
+ return u.protocol === "http:" || u.protocol === "https:" ? { href: u.href, text: `the run on ${u.host}` } : null;
315
+ }
316
+
284
317
  /**
285
318
  * behold#571: a runner's or an action's set-up line, not terragucci's own:
286
319
  * git's hints, the checkout's `[command]` lines and groups, the runner's
@@ -414,13 +447,14 @@ export function statusIcon(status) {
414
447
  }
415
448
 
416
449
  /** The sidebar: the live run pinned, then the recent ones. `pick(id)` selects one; nothing here writes. */
417
- export function renderSidebar(host, index, selectedId, { now = new Date(), scenarios = {}, titles = {}, names = {}, pick = () => {}, merged = null, replay = false, chant = false } = {}) {
450
+ export function renderSidebar(host, index, selectedId, { now = new Date(), scenarios = {}, titles = {}, names = {}, pick = () => {}, merged = null, replay = false, chant = false, from = null } = {}) {
418
451
  host.replaceChildren();
419
452
  const head = el("div", "r-side-head");
420
453
  head.appendChild(el("div", "r-side-title", "Runs"));
421
454
  // behold#571: a tool's page replays an earlier cycle's runs, and says so.
422
455
  // behold#752: chant's demo's runs are built from chant's run events, not copied from the forge.
423
- head.appendChild(el("div", "r-side-note", replay ? "The replayed cycle's runs, newest first." : chant ? "From chant's run events, newest first." : "From the forge, newest first."));
456
+ // behold#815: `from` names where else they come from (chant's run index).
457
+ head.appendChild(el("div", "r-side-note", replay ? "The replayed cycle's runs, newest first." : from || (chant ? "From chant's run events, newest first." : "From the forge, newest first.")));
424
458
  host.appendChild(head);
425
459
  if (!index || index.error || index.absent || !index.doc) {
426
460
  host.appendChild(el("p", "r-note", index ? index.absent || index.error : "Reading the runs…"));
@@ -445,7 +479,7 @@ export function renderSidebar(host, index, selectedId, { now = new Date(), scena
445
479
  li.appendChild(statusIcon(r.status));
446
480
  const body = el("div", "r-run-body");
447
481
  body.appendChild(el("div", "r-run-title", triggerWords(r)));
448
- const place = placeWords(r, scenarios, named, names);
482
+ const place = [placeWords(r, scenarios, named, names), ...indexWords(r)].filter(Boolean).join(" · ");
449
483
  if (place) body.appendChild(el("div", "r-run-place", place));
450
484
  const meta = el("div", "r-run-meta");
451
485
  meta.append(
@@ -525,13 +559,24 @@ export function renderRun(host, answer, ui, { now = new Date(), pickJob = () =>
525
559
  const meta = el("div", "r-head-meta");
526
560
  const bits = [
527
561
  `#${run.id}`,
528
- run.status === "waiting" ? "held at a terragucci gate, waiting for an approval" : STATUS_WORDS[run.status] || run.status,
562
+ // A run of chant's index whose plan moved says why on its own (indexWords): "held" is all the status adds.
563
+ run.status === "waiting" ? (run.moved ? "held" : `held at a ${run.from === "ci-run-index" ? "" : "terragucci "}gate, waiting for an approval`) : STATUS_WORDS[run.status] || run.status,
529
564
  run.ref ? `on ${run.ref}` : null,
530
565
  run.commit ? `commit ${run.commit.slice(0, 8)}` : null,
566
+ ...indexWords(run),
531
567
  run.started_at ? `started ${agoWords(run.started_at, now)}` : null,
532
568
  durationWords(run.started_at, run.ended_at, now),
533
569
  ].filter(Boolean);
534
570
  meta.textContent = bits.join(" · ");
571
+ // behold#815: the forge's own run, when chant's run index names one.
572
+ const link = originLink(run);
573
+ if (link) {
574
+ const a = el("a", "r-origin", link.text);
575
+ a.href = link.href;
576
+ a.target = "_blank";
577
+ a.rel = "noopener noreferrer";
578
+ meta.append(" · ", a);
579
+ }
535
580
  head.appendChild(meta);
536
581
  host.appendChild(head);
537
582
 
@@ -831,6 +876,7 @@ export function startRuns(
831
876
  replay = () => false,
832
877
  hideLine = null,
833
878
  // behold#752: where the live runs are read: terragucci's copies of forge runs, or chant's demo's runs built from its run events.
879
+ // behold#815: or chant's run index, whose `from` is the sidebar's line.
834
880
  urls = { runs: "/api/terragucci/runs", run: (id) => `/api/terragucci/runs/${id}` },
835
881
  } = {},
836
882
  ) {
@@ -880,7 +926,7 @@ export function startRuns(
880
926
  }
881
927
  // One merged read of the selected run for both the sidebar and its page.
882
928
  const merged = ans && ans.doc ? mergeRun(entry, ans.doc) : null;
883
- renderSidebar(side, s.index, id, { now: shown(), scenarios, titles: titles(), names: names(), pick, merged, replay: replay(), chant: urls.runs.startsWith("/api/chant/") });
929
+ renderSidebar(side, s.index, id, { now: shown(), scenarios, titles: titles(), names: names(), pick, merged, replay: replay(), chant: urls.runs.startsWith("/api/chant/"), from: urls.from || null });
884
930
  // The redraw replaces the scrollers: keep where a viewer left them.
885
931
  const old = main.querySelector(".r-log");
886
932
  const oldSteps = main.querySelector(".r-steps");
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { describe, expect, it } from "vitest";
4
- import { FEATURE_LINES, fitFeatures, FOLLOW_LINES, followsLog, logKey, nearEnd, mergeRun, newerOf, agoWords, defaultJob, defaultStep, durationWords, jobOrder, liveRun, codeish, logLineWords, logRows, placeWords, scenarioTitles, setupLine, sidebarRuns, splitSkipped, STATUS_TONE, toneOf, triggerWords } from "./kiosk-runs.js";
4
+ import { FEATURE_LINES, fitFeatures, FOLLOW_LINES, followsLog, logKey, nearEnd, mergeRun, newerOf, agoWords, defaultJob, defaultStep, durationWords, indexWords, jobOrder, originLink, liveRun, codeish, logLineWords, logRows, placeWords, scenarioTitles, setupLine, sidebarRuns, splitSkipped, STATUS_TONE, toneOf, triggerWords } from "./kiosk-runs.js";
5
5
 
6
6
  const FIX = join(import.meta.dirname, "..", "src", "__fixtures__", "terragucci-demo", "runs");
7
7
  const run = (id) => JSON.parse(readFileSync(join(FIX, `${id}.json`), "utf8"));
@@ -296,3 +296,44 @@ describe("the left bar's tone (behold#571)", () => {
296
296
  for (const tone of new Set(Object.values(STATUS_TONE))) expect(html).toContain(`[data-k-tone="${tone}"]`);
297
297
  });
298
298
  });
299
+
300
+ // behold#815: chant's run index, as src/ci-run-index.ts hands it to the pane.
301
+ describe("runs from chant's run index (behold#815)", () => {
302
+ const ci = (over = {}) => ({ schema: "demo.run/v1", from: "ci-run-index", id: "6782", status: "failure", trigger: "merge", pull: 773, ref: null, member: null, failure: "failed", signer: null, started_at: "2026-10-19T02:26:01.917Z", ended_at: "2026-10-19T02:26:10.991Z", jobs: [{ id: "6782", name: "pr-apply", needs: [], status: "failure" }], ...over });
303
+ it("names the member, why it failed, and who signed it, beside the trigger", () => {
304
+ expect(triggerWords(ci())).toBe("Merge of #773 to main");
305
+ // "failed" beside a failed status says nothing more; a reason that does is kept.
306
+ expect(indexWords(ci())).toEqual([]);
307
+ expect(indexWords(ci({ failure: "command-failed" }))).toEqual(["failed: command-failed"]);
308
+ expect(indexWords(ci({ member: "web", failure: null, signer: "ci-runner@chant-demo", status: "success" }))).toEqual(["web", "signed by ci-runner@chant-demo"]);
309
+ });
310
+ it("says nothing of a signer a run doesn't have: signing is opt-in (chant#4156)", () => {
311
+ for (const signer of [null, undefined, ""]) expect(indexWords(ci({ signer, failure: null })).join(" ")).not.toMatch(/sign/);
312
+ });
313
+ it("words an apply that exited 3 as a plan that moved or waits, not a failure (chant#4156)", () => {
314
+ expect(indexWords(ci({ status: "waiting", failure: "plan-changed", moved: "the plan moved or waits: re-plan and re-approve" }))).toEqual(["the plan moved or waits: re-plan and re-approve (plan-changed)"]);
315
+ expect(toneOf("waiting")).not.toBe(toneOf("failure"));
316
+ });
317
+ it("words an apply held by its exit code alone the same way, naming the code (#818, chant#4165)", () => {
318
+ expect(indexWords(ci({ status: "waiting", failure: "failed", moved: "the plan moved or waits: re-plan and re-approve", heldBy: "exit 3", exitCode: 3 }))).toEqual(["the plan moved or waits: re-plan and re-approve (exit 3)"]);
319
+ });
320
+ it("links the forge's run by its URL's host, never by runOrigin's forge name", () => {
321
+ expect(originLink(ci({ origin: "http://forgejo:3000/chant-demo/fan-out-estate/actions/runs/6782" }))).toEqual({ href: "http://forgejo:3000/chant-demo/fan-out-estate/actions/runs/6782", text: "the run on forgejo:3000" });
322
+ expect(originLink(ci({ origin: "javascript:alert(1)" }))).toBeNull();
323
+ expect(originLink(ci())).toBeNull();
324
+ expect(originLink({ origin: "https://x.example/r/1" })).toBeNull();
325
+ });
326
+ it("adds nothing to a run from anywhere else", () => {
327
+ expect(indexWords({ ...ci(), from: undefined, member: "web" })).toEqual([]);
328
+ expect(indexWords(null)).toEqual([]);
329
+ });
330
+ it("calls a job chant adds later a run, and draws a status it adds by its own word", () => {
331
+ expect(triggerWords(ci({ trigger: null, event: null }))).toBe("a run");
332
+ expect(toneOf("cancelled-by-host")).toBe("idle");
333
+ });
334
+ it("keys runs by chant's run id, a string, through the merge and the live pick", () => {
335
+ const entry = ci({ status: "waiting", ended_at: null });
336
+ expect(mergeRun(entry, ci({ status: "waiting", ended_at: null, jobs: [{ id: "6782", name: "pr-apply", needs: [], status: "waiting", steps: [] }] })).id).toBe("6782");
337
+ expect(liveRun([ci({ id: "b" }), ci({ id: "a" })]).id).toBe("b");
338
+ });
339
+ });
@@ -41,3 +41,26 @@ export function pageSource(doc) {
41
41
  const s = m ? m.getAttribute("content") : null;
42
42
  return s === "chant-demo" ? s : null;
43
43
  }
44
+
45
+ /**
46
+ * behold#815: the runs pane's reads when serve was given `--ci-report-url`:
47
+ * chant's run index and each run's events (src/ci-run-index.ts), in place of
48
+ * the forge's runs. Only the runs pane reads them; the demo's cycle and its
49
+ * approval panel read as before. `from` is the pane's line under "Runs".
50
+ */
51
+ export const CI_RUNS_READS = {
52
+ runs: "/api/chant/ci/runs",
53
+ run: (id) => `/api/chant/ci/runs/${encodeURIComponent(id)}`,
54
+ from: "From chant's run index, newest first.",
55
+ };
56
+
57
+ /** The runs the page was served for (`<meta name="kiosk-runs">`): `chant-ci`, or null for the source's own. */
58
+ export function pageRuns(doc) {
59
+ const m = doc && doc.querySelector ? doc.querySelector('meta[name="kiosk-runs"]') : null;
60
+ return m && m.getAttribute("content") === "chant-ci" ? "chant-ci" : null;
61
+ }
62
+
63
+ /** The runs pane's reads: chant's run index for `chant-ci`, else the source's (`reads.runs`, `reads.run`). */
64
+ export function runsReadsFor(runs, reads) {
65
+ return runs === "chant-ci" ? CI_RUNS_READS : { runs: reads.runs, run: reads.run };
66
+ }
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { CHANT_DEMO_READS, TERRAGUCCI_READS, pageSource, readsFor } from "./kiosk-source.js";
2
+ import { CHANT_DEMO_READS, CI_RUNS_READS, TERRAGUCCI_READS, pageRuns, pageSource, readsFor, runsReadsFor } from "./kiosk-source.js";
3
3
  import { startMetrics } from "./kiosk-metrics.js";
4
4
 
5
5
  // behold#752: a kiosk page reads terragucci's loop unless the server tells it chant's demo is its source.
@@ -37,3 +37,21 @@ describe("where a kiosk page reads its demo (behold#752)", () => {
37
37
  expect(await asked(CHANT_DEMO_READS)).toEqual(["/api/chant/demo", "/api/chant/demo/cycle"]);
38
38
  });
39
39
  });
40
+
41
+ // behold#815: with --ci-report-url, the runs pane alone reads chant's run index.
42
+ const runsDoc = (content) => ({ querySelector: (q) => (q === 'meta[name="kiosk-runs"]' && content !== null ? { getAttribute: () => content } : null) });
43
+
44
+ describe("where the runs pane reads its runs (behold#815)", () => {
45
+ it("a page without the tag reads the source's runs, the forge's or chant's demo's", () => {
46
+ expect(pageRuns(runsDoc(null))).toBeNull();
47
+ expect(runsReadsFor(null, TERRAGUCCI_READS)).toEqual({ runs: "/api/terragucci/runs", run: TERRAGUCCI_READS.run });
48
+ expect(runsReadsFor(null, CHANT_DEMO_READS).runs).toBe("/api/chant/demo/runs");
49
+ });
50
+ it("a page told `chant-ci` reads chant's run index, whatever its source, and says so in the sidebar", () => {
51
+ expect(pageRuns(runsDoc("chant-ci"))).toBe("chant-ci");
52
+ for (const reads of [TERRAGUCCI_READS, CHANT_DEMO_READS]) expect(runsReadsFor("chant-ci", reads)).toBe(CI_RUNS_READS);
53
+ expect([CI_RUNS_READS.runs, CI_RUNS_READS.run("chant-1792376662004"), CI_RUNS_READS.run("a/b")]).toEqual(["/api/chant/ci/runs", "/api/chant/ci/runs/chant-1792376662004", "/api/chant/ci/runs/a%2Fb"]);
54
+ expect(CI_RUNS_READS.from).toBe("From chant's run index, newest first.");
55
+ expect(pageRuns(runsDoc("forge"))).toBeNull();
56
+ });
57
+ });
@@ -167,7 +167,9 @@ export function trackModel(track, { demo, pulls = [], since = null, now = Date.n
167
167
  };
168
168
  }),
169
169
  }));
170
- for (const c of chapters) c.seek = c.segments.length ? c.segments[0].seek : null;
170
+ // A chapter's title replays it only once it is over: on the live cycle's current chapter the pill read as a label
171
+ // saying the demo was a replay, and a tap on it left live.
172
+ for (const c of chapters) c.seek = (replay || c.state === "done") && c.segments.length ? c.segments[0].seek : null;
171
173
  const nowLine = nowWords({ demo, segment: current, expected, elapsed, overrun, waves, jobs, now, fix: track.byStory ? pulls.indexOf(demo.pull) > 0 : at.chapter > 0 });
172
174
  return { chapters, at, elapsed, expected, overrun, now: nowLine, here: hereWords(chapters, at) };
173
175
  }
@@ -234,7 +236,8 @@ export function nowWords({ demo, segment, expected = 0, elapsed = 0, overrun = f
234
236
  case "fix opened":
235
237
  return say("The pipeline is starting the plan job", "the pipeline to start the plan");
236
238
  case "planned":
237
- return say(fix ? "The fix is planned; a review is asked next" : "The plan is in; a review is asked next");
239
+ // behold#784: no review is asked unless a wave would destroy something; the driver's line says what comes next.
240
+ return say(fix ? "The fix is planned" : "The plan is in");
238
241
  case "review":
239
242
  return say("Waiting for the reviewer", "the reviewer to approve the plan");
240
243
  case "merged":
@@ -328,12 +331,13 @@ body.k-watch #k-track { position: fixed; z-index: 7; left: 5px; right: 5px; }
328
331
  #k-track .kt-chapter-title { font-size: 0.88em; }
329
332
  #k-track .kt-segs .kt-label { display: none; }
330
333
  #k-track .kt-seg { height: 0.8em; min-width: 0.6em !important; }
331
- #k-track .kt-here { display: block; margin: 0; color: var(--pending); font-size: 0.92em; }
332
- #k-track .kt-now { font-size: 0.92em; white-space: normal; }
334
+ /* A phone leads with one line of what is happening now: the chapter in the rail already says which step. */
335
+ #k-track .kt-now { font-size: 1em; font-weight: 600; white-space: normal; margin-top: 0.3em; }
336
+ #k-track .kt-now::before { content: "Now: "; color: var(--pending); }
333
337
  /* behold#787: a phone's segments are too thin to press; a past chapter's title is the 44px target. */
334
338
  #k-track button.kt-seg.kt-seek { pointer-events: none; }
335
339
  #k-track button.kt-chapter-title.kt-seek { align-self: flex-start; max-width: 100%; min-height: 44px; padding: 0 0.8em; border: 1.5px solid color-mix(in srgb, var(--pending) 70%, transparent); border-radius: 999px; text-decoration: none; }
336
- #k-track button.kt-chapter-title.kt-seek::after { content: " · replay"; color: var(--pending); font-weight: 500; }
340
+ #k-track button.kt-chapter-title.kt-seek::after { content: " · watch again"; color: var(--pending); font-weight: 500; }
337
341
  }
338
342
  `;
339
343
 
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { FAILURE_LEAD_MS, FILL_CAP, applyJobs, cycleTrack, failureAt, hereWords, seekMs, trackModel, waitingSpec } from "./kiosk-track.js";
2
+ import { FAILURE_LEAD_MS, FILL_CAP, applyJobs, cycleTrack, failureAt, hereWords, nowWords, seekMs, trackModel, waitingSpec } from "./kiosk-track.js";
3
3
 
4
4
  // behold#631: chant-fanout's last finished cycle as cycles/chant-fanout/latest.json had it (cycle 499):
5
5
  // fifteen steps, two pull requests, from the change's open to the reset.
@@ -202,7 +202,8 @@ describe("a past step replays from its start (behold#787)", () => {
202
202
  it("gives each segment already past its first step's time, and each chapter its first segment's", () => {
203
203
  const m = trackModel(track, { demo: { step: "planned", pull: 13, chapter: chapters[2] }, pulls: [12, 13], since: now, now });
204
204
  expect(m.chapters[0].segments.map((g) => g.seek)).toEqual([T("18:49"), T("19:01"), T("19:14"), T("19:27"), T("19:30")]);
205
- expect(m.chapters.map((c) => c.seek)).toEqual([T("18:49"), T("19:49"), T("20:10"), null]);
205
+ // The current chapter's title doesn't replay it: only a chapter that is over does.
206
+ expect(m.chapters.map((c) => c.seek)).toEqual([T("18:49"), T("19:49"), null, null]);
206
207
  // The current step and those ahead have no seek in the live cycle.
207
208
  expect(m.chapters[2].segments.map((g) => g.seek)).toEqual([T("20:10"), null, null, null, null]);
208
209
  });
@@ -229,3 +230,12 @@ describe("a past step replays from its start (behold#787)", () => {
229
230
  expect(failureAt(null)).toBeNull();
230
231
  });
231
232
  });
233
+
234
+ describe("nowWords", () => {
235
+ // behold#784: a plan asks no review unless a wave would destroy something, so the planned line doesn't promise one.
236
+ it("says the plan is in, and nothing about a review", () => {
237
+ const demo = { label: "Fan out." };
238
+ expect(nowWords({ demo, segment: { label: "planned" } }).text).toBe("The plan is in");
239
+ expect(nowWords({ demo, segment: { label: "planned" }, fix: true }).text).toBe("The fix is planned");
240
+ });
241
+ });
package/web/kiosk.html CHANGED
@@ -115,6 +115,7 @@
115
115
  .r-head-title .r-icon { margin: 0; }
116
116
  .r-head-sub { color: var(--fg); font-size: 0.88em; margin-top: 0.15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
117
117
  .r-head-meta { color: var(--muted); font-size: 0.82em; }
118
+ .r-head-meta .r-origin { color: inherit; }
118
119
  /* behold#725: a section heading (Jobs, Features, Steps) keeps a line of its own: the pane is a flex column, and nothing in it but the steps may shrink. */
119
120
  .r-label { display: block; flex: none; position: static; font: 600 0.8em/1.3 var(--font-ui); color: var(--muted); padding: var(--s3) var(--s4) var(--s1); }
120
121
  #runs-main > :not(.r-steps) { flex: none; }
@@ -488,7 +489,22 @@
488
489
  .k-modes { height: auto; }
489
490
  .k-theme-arrow { min-width: 44px; }
490
491
  .k-w-held { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); flex: 1 1 100%; }
491
- .k-w-held button.k-w-resume { min-height: 44px; padding: 0 var(--s5); border: 2px solid var(--pending); border-radius: 999px; background: color-mix(in srgb, var(--pending) 18%, transparent); text-decoration: none; font-weight: 600; }
492
+ .k-w-held button.k-w-resume, #k-held-over button.k-w-resume { min-height: 44px; padding: 0 var(--s5); border: 2px solid var(--pending); border-radius: 999px; background: color-mix(in srgb, var(--pending) 18%, transparent); text-decoration: none; font-weight: 600; }
493
+ body.k-watch #k-held-over:not([hidden]) { position: fixed; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); padding: var(--s2) var(--s3); border: 2px solid var(--pending); border-radius: 10px; background: color-mix(in srgb, var(--panel) 94%, transparent); box-shadow: 0 2px 10px rgb(0 0 0 / 0.25); color: var(--fg); font-weight: 600; }
494
+ }
495
+ #k-held-over { display: none; }
496
+ .k-w-point { display: none; }
497
+ /* A phone's Watch says what it shows first and once: the point, the step track, one "Now:" line, the graph.
498
+ The intro, the waiting box and the caption's copy of the point repeat it; the facts under the graph fold. */
499
+ @media (max-width: 600px) {
500
+ body.k-watch .k-w-point { display: block; margin: 0.2em 0 0.1em; font: 700 1.2em/1.25 var(--font-ui); color: var(--fg); }
501
+ body.k-watch .k-w-intro, body.k-watch .k-cap-point, body.k-watch .k-cap-next, body.k-watch .k-cap-step { display: none; }
502
+ body.k-watch .eh-modal-wrap:has(> .eh-modal-waiting) { display: none; }
503
+ body.k-watch #k-change > .k-change-label, body.k-watch #k-waves > .k-wl-head { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: var(--s3); }
504
+ body.k-watch #k-change:not(.k-open) > :not(.k-change-label), body.k-watch #k-waves:not(.k-open) > :not(.k-wl-head) { display: none; }
505
+ body.k-watch #k-change .k-change-label::after, body.k-watch #k-waves .k-wl-title::after { content: " · show"; color: var(--pending); font-weight: 500; }
506
+ body.k-watch #k-change.k-open .k-change-label::after, body.k-watch #k-waves.k-open .k-wl-title::after { content: " · hide"; }
507
+ body.k-watch #k-waves:not(.k-open) .k-wl-hint { display: none; }
492
508
  }
493
509
  /* The caption: the title, what changes, the step. One of the two beats leads. */
494
510
  #k-caption { position: absolute; left: 5px; right: 5px; bottom: 5px; display: grid; grid-template-rows: auto calc(2 * 1.25em * 1.3) calc(2 * 1.25em * 1.3); gap: 0.25em; padding: var(--s3) 1.4em var(--s4);
@@ -741,6 +757,8 @@
741
757
  <div id="views" hidden></div>
742
758
  <section id="k-read" aria-label="How to read this" hidden></section>
743
759
  <iframe id="view" title="behold's view of the change"></iframe>
760
+ <!-- A paused Watch says so at the foot of the screen: on a phone the header that also says it is scrolled away. -->
761
+ <div id="k-held-over" role="status" hidden></div>
744
762
  </section>
745
763
  <!-- behold#571: Watch mode's overlays, over the graph; web/kiosk-watch.js says what each holds and where it goes. -->
746
764
  <div id="k-watch">
@@ -765,9 +783,14 @@
765
783
  <div id="eh-modals"></div>
766
784
  <script type="module">
767
785
  import { initTheme, KIOSK_THEME, getThemeName, onThemeChange, stepTheme } from "/theme.js";
786
+ // A phone's facts under the graph fold to their heads; a tap on a head opens or folds them (the class outlives a redraw).
787
+ document.addEventListener("click", (e) => {
788
+ const head = e.target.closest && e.target.closest("#k-change > .k-change-label, #k-waves > .k-wl-head");
789
+ if (head) head.parentElement.classList.toggle("k-open");
790
+ });
768
791
  import { startKiosk } from "/kiosk.js";
769
792
  import { pageTool } from "/kiosk-vendor.js";
770
- import { pageSource, readsFor } from "/kiosk-source.js";
793
+ import { pageRuns, pageSource, readsFor } from "/kiosk-source.js";
771
794
  import { installMotion } from "/motion.js";
772
795
  initTheme(KIOSK_THEME);
773
796
  // behold#725: every looping animation holds while the tab is hidden.
@@ -788,7 +811,7 @@
788
811
  eh: { switchHost: document.getElementById("k-tools"), trailHost: document.getElementById("eh-trail"), tipsHost: document.getElementById("eh-tips"), modalHost: document.getElementById("eh-modals") },
789
812
  watch: { layer: document.getElementById("k-watch"), caption: document.getElementById("k-caption"), change: document.getElementById("k-change"), waves: document.getElementById("k-waves"), callout: document.getElementById("k-callout"), drawer: document.getElementById("k-drawer"), badges: document.getElementById("k-badges"), result: document.getElementById("k-result") },
790
813
  },
791
- { tool: pageTool(document), source: pageSource(document) },
814
+ { tool: pageTool(document), source: pageSource(document), runs: pageRuns(document) },
792
815
  );
793
816
  // behold#571: the repo's numbers from Prometheus, a pane of its own in Inspect (web/kiosk-metrics.js), and Watch's badges and delivery line.
794
817
  import("/kiosk-metrics.js").then((m) => m.startMetrics(document.getElementById("k-metrics"), { tool: pageTool(document), reads: readsFor(pageSource(document)), onModel: (model) => kiosk.setMetrics(model) }));
package/web/kiosk.js CHANGED
@@ -34,7 +34,7 @@ import { creditLines, filterIndex, keepRun, kioskVendorOf, liveEstimate, liveFor
34
34
  import { repoParam, repoUrl, stepCheckout } from "./kiosk-repo.js";
35
35
  import { startKioskCarve } from "./kiosk-carve.js";
36
36
  import { drawWaveList, waveListKey } from "./kiosk-wave-list.js";
37
- import { readsFor } from "./kiosk-source.js";
37
+ import { readsFor, runsReadsFor } from "./kiosk-source.js";
38
38
  import { STATE_WORDS, changingRoots, costLine, pinsCommit, planFitsPin, pullPin, readEdges, rootsCount, totalsLine, waveRows, blastRows } from "./terragucci-change.js";
39
39
 
40
40
  /** The scenarios terragucci#1014 numbers. An id not here is shown by the title demo.json carries. */
@@ -1103,6 +1103,21 @@ export const RESUME_WORDS = "Resume now";
1103
1103
  /** behold#779: how long a tap on a touch screen holds Watch's shot (a click holds it PICK_HOLD_MS). */
1104
1104
  export const TAP_HOLD_MS = 20_000;
1105
1105
 
1106
+ /**
1107
+ * A paused Watch, said at the foot of the screen with its resume (kiosk.html shows it on a touch screen only): on a
1108
+ * phone the header that also says it is scrolled away by the time a tap on the graph paused it.
1109
+ */
1110
+ function drawHeldOver(doc, s) {
1111
+ const over = doc && doc.getElementById ? doc.getElementById("k-held-over") : null;
1112
+ if (!over) return;
1113
+ over.hidden = !s.watchHeld;
1114
+ if (!s.watchHeld) return void over.replaceChildren();
1115
+ const b = el("button", "k-w-resume", RESUME_WORDS);
1116
+ b.type = "button";
1117
+ b.addEventListener("click", () => s.followSteps && s.followSteps());
1118
+ over.replaceChildren(el("span", "k-held-words", heldWords(s.watchHeld.secs, true)), b);
1119
+ }
1120
+
1106
1121
  /** Watch's header: the scenario's place and the strip on the left, the delivery numbers on the right. */
1107
1122
  function drawWatchHead(bar, s, now) {
1108
1123
  const demo = s.demo.demo;
@@ -1129,6 +1144,8 @@ function drawWatchHead(bar, s, now) {
1129
1144
  if (s.mode === "replay" && s.replay && s.replay.asked) bar.appendChild(askedLine(s));
1130
1145
  const intro = introFor(s);
1131
1146
  if (intro) bar.appendChild(el("p", "k-w-intro", intro));
1147
+ // A phone leads with what the demo shows (kiosk.html shows it there only); the caption's copy of it goes.
1148
+ if (demo && demo.title) bar.appendChild(el("p", "k-w-point", demo.title));
1132
1149
  const strip = el("ol", "k-strip");
1133
1150
  // behold#631: a chant pull request's wait for its approval comes before its merge. Without a stop of its own on the
1134
1151
  // strip it shows as "planned", for the fix's pull request as for the first.
@@ -1144,6 +1161,7 @@ function drawWatchHead(bar, s, now) {
1144
1161
  p.appendChild(b);
1145
1162
  bar.appendChild(p);
1146
1163
  }
1164
+ drawHeldOver(bar.ownerDocument, s);
1147
1165
  const dora = doraLine(s.metrics);
1148
1166
  if (dora) {
1149
1167
  const p = el("p", "k-w-dora", dora);
@@ -1600,9 +1618,11 @@ export const CHANT_SIDE_ROOM = 520;
1600
1618
  * countdown. When the roots the step is about change, move the framed view
1601
1619
  * with a `behold:view` message; the frame takes them only from this origin.
1602
1620
  */
1603
- export function startKiosk({ bar, frame, side, main, views, read = null, tools = null, watch = null, eh = null }, { fetchJson = defaultFetch, now = () => new Date(), origin = location.origin, tool = null, source = null } = {}) {
1621
+ export function startKiosk({ bar, frame, side, main, views, read = null, tools = null, watch = null, eh = null }, { fetchJson = defaultFetch, now = () => new Date(), origin = location.origin, tool = null, source = null, runs = null } = {}) {
1604
1622
  // behold#752: terragucci's loop, or chant's fan-out demo from its own records (web/kiosk-source.js).
1605
1623
  const reads = readsFor(source);
1624
+ // behold#815: the runs pane's own reads, chant's run index when serve has --ci-report-url.
1625
+ const runsReads = runsReadsFor(runs, reads);
1606
1626
  const s = { source: reads.source, demo: null, answer: null, progress: null, components: false, pick: null, view: "resources", roots: [], waves: [], light: false, hover: null, frameHover: null, held: null };
1607
1627
  // behold#571: Watch or Inspect, the viewer's pick kept in their browser; Watch until they pick Inspect.
1608
1628
  const shelf = typeof localStorage !== "undefined" ? (() => { try { return localStorage; } catch { return null; } })() : null;
@@ -2813,11 +2833,13 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2813
2833
  tools: () => s.tools || [],
2814
2834
  rootTools: () => s.rootTools || {},
2815
2835
  light: () => s.light,
2816
- source: runsSource,
2817
- filter: vendor ? (index) => filterIndex(index, { tool, repo: s.repo }) : (index) => index,
2818
- replay: () => s.mode === "replay",
2836
+ // behold#815: chant's run index is the served repo's runs alone and their history, so the pane reads it whole,
2837
+ // on a tool's page and in a replay alike.
2838
+ source: runsReads.from ? () => null : runsSource,
2839
+ filter: vendor && !runsReads.from ? (index) => filterIndex(index, { tool, repo: s.repo }) : (index) => index,
2840
+ replay: () => !runsReads.from && s.mode === "replay",
2819
2841
  hideLine: vendor ? (line) => namesOther(line, tool) : null,
2820
- urls: { runs: reads.runs, run: reads.run },
2842
+ urls: runsReads,
2821
2843
  },
2822
2844
  );
2823
2845
  }