@intentius/behold 0.30.2 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/AGENTS.md +444 -15
  2. package/README.md +14 -13
  3. package/demos.json +14 -9
  4. package/dist/cli.js +53928 -26475
  5. package/example-carve/README.md +19 -23
  6. package/example-carve/app/package.json +1 -1
  7. package/example-carve/app/src/carved.ts +3 -3
  8. package/example-carve/carve-report.json +1 -1
  9. package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
  10. package/example-choudoufu-estate/README.md +7 -0
  11. package/example-choudoufu-estate/chant.workspace.json +1 -1
  12. package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
  13. package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
  14. package/example-terraform-estate/README.md +32 -5
  15. package/example-terraform-estate/chant.workspace.json +1 -1
  16. package/example-terraform-estate/recorded/adoption/platform.json +72 -0
  17. package/example-terraform-estate/recorded/adoption/prod.json +224 -0
  18. package/example-three-cloud/README.md +111 -18
  19. package/example-three-cloud/aws/Pulumi.yaml +15 -0
  20. package/example-three-cloud/aws/index.ts +174 -0
  21. package/example-three-cloud/aws/package-lock.json +2725 -0
  22. package/example-three-cloud/aws/package.json +14 -0
  23. package/example-three-cloud/aws/tsconfig.json +17 -0
  24. package/example-three-cloud/azure/main.tf +48 -0
  25. package/example-three-cloud/azure/site.tf +104 -0
  26. package/example-three-cloud/chant.config.json +9 -0
  27. package/example-three-cloud/chant.workspace.json +30 -4
  28. package/example-three-cloud/dns/chant.config.ts +26 -1
  29. package/example-three-cloud/dns/src/records.component.ts +32 -6
  30. package/example-three-cloud/package-lock.json +48 -27
  31. package/example-three-cloud/package.json +8 -6
  32. package/example-three-cloud/scripts/emulators-up.sh +28 -1
  33. package/example-three-cloud/scripts/front-door.ts +679 -86
  34. package/package.json +13 -6
  35. package/web/adopt-pulumi.js +114 -0
  36. package/web/adopt-pulumi.test.js +28 -0
  37. package/web/adopt.js +203 -0
  38. package/web/adopt.test.js +27 -0
  39. package/web/app.js +358 -10
  40. package/web/carve-steps.js +1 -1
  41. package/web/carve-steps.test.js +2 -2
  42. package/web/change-set-overlay.js +12 -5
  43. package/web/change-set-overlay.test.js +22 -0
  44. package/web/drift-stream.js +241 -0
  45. package/web/drift-stream.test.js +146 -0
  46. package/web/edge-weight.d.ts +1 -1
  47. package/web/edge-weight.js +5 -1
  48. package/web/edge-weight.test.js +19 -0
  49. package/web/graph-query.js +180 -0
  50. package/web/graph-query.test.js +49 -0
  51. package/web/graph.html +107 -0
  52. package/web/index-diff.js +109 -0
  53. package/web/index-diff.test.js +39 -0
  54. package/web/index.html +37 -0
  55. package/web/kiosk-ask-tips.js +15 -5
  56. package/web/kiosk-ask-tips.test.js +14 -1
  57. package/web/kiosk-estate-scene.js +72 -8
  58. package/web/kiosk-light-frame.js +1 -0
  59. package/web/kiosk-light.js +41 -3
  60. package/web/kiosk-member-kind.test.js +140 -0
  61. package/web/kiosk-popover.js +4 -1
  62. package/web/kiosk-side.js +296 -0
  63. package/web/kiosk-side.test.js +249 -0
  64. package/web/kiosk-watch.js +12 -0
  65. package/web/kiosk-watch.test.js +15 -1
  66. package/web/kiosk.html +47 -1
  67. package/web/kiosk.js +106 -7
  68. package/web/member-kind.js +31 -0
  69. package/web/template-apps.js +245 -0
  70. package/web/template-apps.test.js +252 -0
  71. package/web/templates.js +285 -0
  72. package/web/templates.test.js +155 -0
  73. package/web/terragucci-lifecycle.js +112 -62
  74. package/web/terragucci-lifecycle.test.js +29 -1
  75. package/web/terragucci-timeline.js +39 -2
  76. package/web/terragucci-timeline.test.js +42 -1
  77. package/example-three-cloud/aws/chant.config.ts +0 -8
  78. package/example-three-cloud/aws/site.component.ts +0 -13
  79. package/example-three-cloud/aws/src/site.ts +0 -27
  80. package/example-three-cloud/azure/chant.config.ts +0 -1
  81. package/example-three-cloud/azure/src/site.component.ts +0 -13
  82. package/example-three-cloud/azure/src/site.ts +0 -18
  83. /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
  84. /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
  85. /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
  86. /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
  87. /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
  88. /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
  89. /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
  90. /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
  91. /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
  92. /package/example-carve/{legacy-tf → tf-root}/versions.tf +0 -0
@@ -0,0 +1,249 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { describe, expect, it } from "vitest";
4
+ import { reportedRunView } from "./kiosk-light.js";
5
+ import { SIDE_STORE, actRunView, applyParts, jobKind, detailsModel, jobTone, keepSide, runTrace, sideApplied, sideState, sideStep, sideStored } from "./kiosk-side.js";
6
+
7
+ // The three-root estate of behold#937 (src/__fixtures__/terragucci-demo-ask), built as web/kiosk-light.test.js builds it.
8
+ const FIX = join(import.meta.dirname, "..", "src", "__fixtures__", "terragucci-demo-ask");
9
+ const read = (f) => JSON.parse(readFileSync(join(FIX, f), "utf8"));
10
+ const report = read("report-pull-request.json");
11
+ function answerOf(r) {
12
+ const roots = r.roots.map((x) => ({ member: "demo", name: x.path, path: x.path }));
13
+ const cards = {};
14
+ for (const root of r.roots) {
15
+ for (const c of root.changes) {
16
+ cards[`demo/${root.path}/${c.address}`] = [{ verdict: "plan", action: c.action, addresses: [c.address], values: (c.attributes || []).map((a) => ({ ...a, address: c.address })) }];
17
+ }
18
+ }
19
+ const reads = r.roots.flatMap((x) => (x.reads || []).map((rd) => ({ ...rd, root: x.path })));
20
+ return { roots, cards, unmatched: { roots: [], changes: [] }, pull_request: { roots: r.roots.map((x) => x.path), reads, blast: r.blast, waves: r.waves } };
21
+ }
22
+ const answer = answerOf(report);
23
+ const progressOf = (run) => ({ states: run.waves.map((w) => ({ number: w.number, state: w.state, roots: w.roots, composed: w.composed })), reads: run.roots.map((x) => ({ root: x.root, wave: x.wave, reads: x.reads, stateKey: x.state && x.state.key })) });
24
+
25
+ const memory = () => {
26
+ const m = new Map();
27
+ return { getItem: (k) => (m.has(k) ? m.get(k) : null), setItem: (k, v) => m.set(k, String(v)), m };
28
+ };
29
+ const throwing = { getItem: () => { throw new Error("denied"); }, setItem: () => { throw new Error("denied"); } };
30
+
31
+ describe("the side pane's place", () => {
32
+ it("shows in ask mode on anything wider than a phone, open until the viewer folds it", () => {
33
+ expect(sideState({ ask: true, phone: false, open: true })).toBe("open");
34
+ expect(sideState({ ask: true, phone: false, open: false })).toBe("folded");
35
+ expect(sideState({ ask: true, phone: true, open: true })).toBe("none");
36
+ expect(sideState({ ask: false, phone: false, open: true })).toBe("none");
37
+ });
38
+
39
+ it("remembers a fold in localStorage, and a storage that throws neither breaks nor folds it", () => {
40
+ const store = memory();
41
+ expect(sideStored(store)).toBe(true);
42
+ keepSide(store, false);
43
+ expect(store.m.get(SIDE_STORE)).toBe("closed");
44
+ expect(sideStored(store)).toBe(false);
45
+ keepSide(store, true);
46
+ expect(sideStored(store)).toBe(true);
47
+ expect(() => keepSide(throwing, false)).not.toThrow();
48
+ expect(sideStored(throwing)).toBe(true);
49
+ expect(sideStored(null)).toBe(true);
50
+ });
51
+ });
52
+
53
+ describe("the act's run as a trace", () => {
54
+ const t = (s) => `2026-10-25T04:2${s}Z`;
55
+ const runs = [
56
+ { id: 9, cycle: 471, trigger: "merge", event: "push", created_at: "2026-10-25T04:24:14Z", jobs: [{ id: 2, name: "plan", status: "skipped" }, { id: 3, name: "apply", status: "success", started_at: "2026-10-25T04:24:14.000Z", ended_at: "2026-10-25T04:24:28.000Z" }] },
57
+ { id: 8, cycle: 471, trigger: "plan", event: "pull_request", created_at: "2026-10-25T04:23:24Z", jobs: [{ id: 1, name: "plan", status: "success", started_at: "2026-10-25T04:23:25.000Z", ended_at: "2026-10-25T04:23:35.000Z" }, { id: 4, name: "apply", status: "skipped" }] },
58
+ { id: 7, cycle: 470, trigger: "merge", created_at: t("0:00"), jobs: [{ id: 5, name: "apply", status: "success", started_at: t("0:00"), ended_at: t("0:10") }] },
59
+ ];
60
+
61
+ it("lists this act's plan, its approval and its apply, in order, with their times", () => {
62
+ const tr = runTrace(runs, { cycle: 471, step: "applied" }, { now: Date.parse("2026-10-25T04:25:00Z") });
63
+ expect(tr.rows.map((r) => [r.label, r.tone, r.ms])).toEqual([
64
+ ["plan", "done", 10_000],
65
+ ["approval", "done", 39_000],
66
+ ["apply", "done", 14_000],
67
+ ]);
68
+ expect(tr.from).toBe(Date.parse("2026-10-25T04:23:25Z"));
69
+ expect(tr.to).toBe(Date.parse("2026-10-25T04:24:28Z"));
70
+ });
71
+
72
+ it("times a running job and a waiting approval up to now", () => {
73
+ const now = Date.parse("2026-10-25T04:24:00Z");
74
+ const tr = runTrace([runs[1]], { cycle: 471, step: "planned" }, { now });
75
+ expect(tr.rows.map((r) => [r.label, r.tone, r.ms])).toEqual([["plan", "done", 10_000], ["approval", "waiting", 25_000]]);
76
+ expect(tr.to).toBe(now);
77
+ const running = [{ ...runs[1], jobs: [{ id: 1, name: "plan", status: "running", started_at: "2026-10-25T04:23:25.000Z", ended_at: null }] }];
78
+ const r2 = runTrace(running, { cycle: 471, step: "pull-request" }, { now });
79
+ expect(r2.rows).toHaveLength(1);
80
+ expect(r2.rows[0]).toMatchObject({ label: "plan", tone: "running", ms: 35_000, end: null });
81
+ });
82
+
83
+ it("is empty before the act has a run, and without a step", () => {
84
+ expect(runTrace(runs, { cycle: 472, step: "pull-request" }).rows).toEqual([]);
85
+ expect(runTrace(runs, null).rows).toEqual([]);
86
+ });
87
+
88
+ it("puts each estate's part under the apply, from the run view", () => {
89
+ const progress = progressOf(read("run-applied.json"));
90
+ const parts = applyParts(answer, progress);
91
+ expect(parts.map((p) => p.label)).toEqual(["network", "app", "edge"]);
92
+ expect(parts.every((p) => p.tone === "done" && p.words === "applied")).toBe(true);
93
+ const tr = runTrace(runs, { cycle: 471, step: "applied" }, { answer, progress });
94
+ expect(tr.rows.filter((r) => r.depth === 1).map((r) => r.label)).toEqual(["network", "app", "edge"]);
95
+ });
96
+
97
+ it("names a job's tone", () => {
98
+ expect(["success", "running", "failure", "waiting", "skipped"].map(jobTone)).toEqual(["done", "running", "failed", "waiting", "skipped"]);
99
+ });
100
+ });
101
+
102
+ describe("the card about the current line", () => {
103
+ it("names what the line lights: the resource, its estate, and its lines", () => {
104
+ const d = detailsModel(answer, null, { light: ["network/terraform_data.subnet"] });
105
+ expect(d.items).toHaveLength(1);
106
+ expect(d.items[0]).toMatchObject({ name: "subnet", type: "terraform_data", action: "create", estate: "network" });
107
+ expect(d.items[0].lines[0]).toMatchObject({ state: "unknown" });
108
+ expect(d.estates).toEqual([{ name: "network", words: "state network.tfstate", written: false }]);
109
+ // An estate with nothing to say yet is not named.
110
+ expect(detailsModel({ ...answer, binaries: { network: "choudoufu" } }, null, { light: ["network/terraform_data.subnet"] }).estates).toEqual([]);
111
+ });
112
+
113
+ it("follows the paths downstream, at most three items, and says how many more", () => {
114
+ const d = detailsModel(answer, null, { light: ["network/terraform_data.subnet"], paths: true });
115
+ expect(d.items).toHaveLength(3);
116
+ expect(d.more).toBe(3);
117
+ expect(d.estates.map((e) => e.name).sort()).toEqual(["app", "edge", "network"]);
118
+ });
119
+
120
+ it("says which estate's record was written once the run view has it", () => {
121
+ const progress = progressOf(read("run-applied.json"));
122
+ const d = detailsModel({ ...answer, binaries: { network: "choudoufu", app: "choudoufu", edge: "choudoufu" } }, progress, { light: ["network/terraform_data.subnet"] });
123
+ expect(d.estates[0]).toMatchObject({ name: "network", written: true });
124
+ expect(d.estates[0].words).toContain("records written");
125
+ });
126
+
127
+ it("is empty for a line that lights nothing", () => {
128
+ expect(detailsModel(answer, null, null)).toBeNull();
129
+ expect(detailsModel(answer, null, { prompt: "hi" })).toBeNull();
130
+ expect(detailsModel(answer, null, { light: ["network/terraform_data.nope"] })).toBeNull();
131
+ expect(detailsModel({ error: "x" }, null, { light: ["network/terraform_data.subnet"] })).toBeNull();
132
+ });
133
+ });
134
+
135
+ describe("the step the trace follows", () => {
136
+ const cycles = new Map([["edit", 7], ["create", 8]]);
137
+ it("is the terminal's turn, on the act its scenario ran in, while demo.json is ahead", () => {
138
+ expect(sideStep({ cycle: 8, scenario: "create", step: "planned" }, { scenario: "edit", step: "applying" }, cycles)).toMatchObject({ cycle: 7, scenario: "edit", step: "applying" });
139
+ expect(sideStep({ cycle: 8, scenario: "create", step: "planned" }, { scenario: "create", step: "pull-request" }, cycles)).toMatchObject({ cycle: 8, step: "pull-request" });
140
+ });
141
+ it("is demo.json's step before any turn has played, or for a scenario never seen", () => {
142
+ const d = { cycle: 8, scenario: "create", step: "planned" };
143
+ expect(sideStep(d, null, cycles)).toBe(d);
144
+ expect(sideStep(d, { scenario: "other", step: "applied" }, cycles)).toBe(d);
145
+ expect(sideStep(null, null, cycles)).toBeNull();
146
+ });
147
+ });
148
+
149
+ describe("a pipeline with an approval job and an apply job per wave", () => {
150
+ const J = (name, status, a = null, b = null) => ({ id: name, name, status, started_at: a, ended_at: b });
151
+ const runs = [
152
+ { id: 13, cycle: 481, trigger: "merge", event: "push", created_at: "2026-10-25T04:38:23Z", jobs: [J("check", "success", "2026-10-25T04:38:23.693Z", "2026-10-25T04:38:28.276Z"), J("apply-wave-1", "success", "2026-10-25T04:38:30.000Z", "2026-10-25T04:38:38.000Z"), J("apply-wave-2", "success", "2026-10-25T04:38:39.000Z", "2026-10-25T04:38:40.500Z"), J("tips", "success", "2026-10-25T04:38:45.000Z", "2026-10-25T04:38:46.000Z")] },
153
+ { id: 12, cycle: 481, trigger: "push", event: "pull_request_approved", created_at: "2026-10-25T04:38:18Z", jobs: [J("plan", "skipped"), J("approval", "success", "2026-10-25T04:38:18.681Z", "2026-10-25T04:38:19.000Z")] },
154
+ { id: 10, cycle: 481, trigger: "plan", event: "pull_request", created_at: "2026-10-25T04:38:01Z", jobs: [J("plan", "success", "2026-10-25T04:38:01.000Z", "2026-10-25T04:38:06.000Z"), J("plan-note", "success", "2026-10-25T04:38:06.700Z", "2026-10-25T04:38:07.800Z")] },
155
+ ];
156
+
157
+ it("names the jobs it shows and leaves the bookkeeping out", () => {
158
+ expect(["plan", "replan", "approval", "apply", "apply-wave-3", "plan-note", "check", "tips"].map((n) => jobKind(n) && (jobKind(n).label || jobKind(n).kind))).toEqual(["plan", "re-plan", "approval", "apply", "apply", null, null, null]);
159
+ });
160
+
161
+ it("times the approval from the plan to the approval job, and one row per wave named for its estates", () => {
162
+ const progress = { states: [{ number: 1, roots: ["network"] }, { number: 2, roots: ["app"] }] };
163
+ const tr = runTrace(runs, { cycle: 481, step: "applied" }, { progress });
164
+ expect(tr.rows.map((r) => [r.label, r.tone, r.ms])).toEqual([
165
+ ["plan", "done", 5_000],
166
+ ["approval", "done", 13_000],
167
+ ["network", "done", 8_000],
168
+ ["app", "done", 1_500],
169
+ ]);
170
+ expect(runTrace(runs, { cycle: 481, step: "applied" }).rows.map((r) => r.label).slice(2)).toEqual(["wave 1", "wave 2"]);
171
+ });
172
+ });
173
+
174
+ describe("the run view the pane reads", () => {
175
+ it("is this act's only from its merge on: before it, the kiosk still holds the last act's", () => {
176
+ expect(["pull-request", "planned", "approved"].map((step) => sideApplied({ step }))).toEqual([false, false, false]);
177
+ expect(["merged", "applying", "applied", "reset"].map((step) => sideApplied({ step }))).toEqual([true, true, true, true]);
178
+ expect(sideApplied(null)).toBe(false);
179
+ });
180
+ });
181
+
182
+ describe("an act before its own apply says nothing applied", () => {
183
+ // The kiosk's run view read is the last merge's: an earlier act's, applied, written, its values filled.
184
+ const leaked = { ...progressOf(read("run-applied.json")), run: { commit: "2a64938856a4ccddeb8bf662b5ee5686e220d751", present: true } };
185
+ const scene = { ...answer, binaries: { network: "choudoufu", app: "choudoufu", edge: "choudoufu" } };
186
+ const ask = { light: ["network/terraform_data.subnet"], paths: true };
187
+ const words = (d) => JSON.stringify(d);
188
+ const APPLIED = /created|filled from|applied|records written|written/;
189
+
190
+ it("at the approval step, with the last merge's run view in hand, the card and the trace keep to plan-time facts", () => {
191
+ for (const step of ["pull-request", "planned", "approved"]) {
192
+ const demo = { cycle: 488, step, commit: "b6326854b7a54d55f7aecf032c73cd4ca52300f8" };
193
+ const view = actRunView(demo, leaked);
194
+ expect(view).toBeNull();
195
+ const d = detailsModel(scene, view, ask);
196
+ expect(words(d)).not.toMatch(APPLIED);
197
+ expect(d.items.flatMap((i) => i.lines.map((l) => l.state))).not.toContain("applied");
198
+ expect(d.items.some((i) => i.lines.some((l) => /known after apply/.test(l.text)))).toBe(true);
199
+ expect(d.estates).toEqual([]);
200
+ expect(applyParts(scene, view)).toEqual([]);
201
+ }
202
+ });
203
+
204
+ it("after the merge, a run view of another commit is still not this act's", () => {
205
+ const demo = { cycle: 488, step: "applying", commit: "eeceb433a52885525dcd1365a7e794b13d906714" };
206
+ expect(actRunView(demo, leaked)).toBeNull();
207
+ expect(words(detailsModel(scene, actRunView(demo, leaked), ask))).not.toMatch(APPLIED);
208
+ expect(actRunView({ ...demo, step: "reset", commit: "adf41a02" }, leaked)).toBeNull();
209
+ });
210
+
211
+ it("says applied once the act's own merge has written it", () => {
212
+ const demo = { cycle: 488, step: "applied", commit: "2a649388" };
213
+ const view = actRunView(demo, leaked);
214
+ expect(view).toBe(leaked);
215
+ const d = detailsModel(scene, view, ask);
216
+ expect(d.estates.map((e) => e.words)).toEqual(expect.arrayContaining(["applied \u00b7 records written"]));
217
+ expect(actRunView(demo, { ...leaked, run: { ...leaked.run, present: false } })).toBeNull();
218
+ expect(actRunView(demo, { ...leaked, run: undefined })).toBeNull();
219
+ });
220
+ });
221
+
222
+ describe("a pipeline that writes reports and no run view (Terragrunt on choudoufu)", () => {
223
+ // The live demo's Terragrunt act II, read after its apply: the reports are in, and its merge commit has no run.json.
224
+ const answer = read("answer-terragrunt-applied.json");
225
+ const none = read("progress-no-run-view.json");
226
+ const demo = { cycle: 4450, step: "applied", commit: "4b80d08fb9558addeda8a51681c4a2988d2bf428" };
227
+ const ask = { light: ["network/aws_subnet.subnet_b", "app/aws_network_interface.worker"], paths: true };
228
+ const texts = (d) => d.items.flatMap((i) => i.lines.map((l) => l.text));
229
+
230
+ it("fills the cards from the act's apply reports once they are in", () => {
231
+ expect(actRunView(demo, none)).toBeNull();
232
+ const view = actRunView(demo, reportedRunView(none, answer));
233
+ expect(view && view.run.reported).toBe(true);
234
+ const d = detailsModel(answer, view, ask);
235
+ expect(texts(d).join("\n")).not.toMatch(/known after apply/);
236
+ expect(texts(d)).toContain("id: eni-23d149dc22983274b");
237
+ expect(d.estates.map((e) => e.words)).toEqual(expect.arrayContaining(["applied \u00b7 records written"]));
238
+ });
239
+
240
+ it("keeps to plan-time facts while the reports are of another commit, and leaves a run view that is there alone", () => {
241
+ const other = { ...none, run: { ...none.run, commit: "bbe939d348bb135e6a5902f6a395e08194e5070e" } };
242
+ expect(reportedRunView(other, answer)).toBe(other);
243
+ expect(actRunView({ ...demo, commit: other.run.commit }, reportedRunView(other, answer))).toBeNull();
244
+ const waiting = { ...answer, roots: answer.roots.map((r) => ({ ...r, apply: { ...r.apply, approval: "waiting" } })) };
245
+ expect(reportedRunView(none, waiting)).toBe(none);
246
+ const there = { ...none, run: { ...none.run, present: true } };
247
+ expect(reportedRunView(there, answer)).toBe(there);
248
+ });
249
+ });
@@ -154,6 +154,18 @@ export function coneCaption(demo, answer) {
154
154
  return line ? { line, backend: backendLine(cone) } : null;
155
155
  }
156
156
 
157
+ /**
158
+ * Whether a viewer's hold on Watch's shot (a click, a pan or a zoom on the graph holds it for PICK_HOLD_MS) ends with
159
+ * this step: at the act's reset, and when another act (cycle) starts. Each puts a different graph in the pane (the
160
+ * base checkout's, then the next act's), where the place the viewer moved to in the last one means nothing, so the
161
+ * shot frames it afresh. `prev` and `next` are the steps (demo.json's `demo`), either null.
162
+ */
163
+ export function holdEnds(prev, next) {
164
+ if (!prev || !next) return false;
165
+ if (prev.cycle !== next.cycle) return true;
166
+ return next.step === "reset" && prev.step !== "reset";
167
+ }
168
+
157
169
  /**
158
170
  * What may sit over the graph in Watch. On a held small stage (`held`: one
159
171
  * framing holds it, web/kiosk-shot.js heldFrame), nothing the step puts
@@ -2,7 +2,7 @@
2
2
  // takes, what the caption leads with, the badges, the delivery line, the
3
3
  // result card, the drawer's folded lines, and where an overlay goes.
4
4
  import { describe, expect, it } from "vitest";
5
- import { MODE_STORE, QUIET_MS, activeWave, badgeTitle, badgeWords, badges, behindStep, firstSentence, steadyRun, captionModel, changeRoots, doraLine, modeStored, placeBeside, quietDuration, quietWords, recordKey, resultModel, runningStep, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
5
+ import { MODE_STORE, QUIET_MS, activeWave, badgeTitle, badgeWords, badges, behindStep, firstSentence, holdEnds, steadyRun, captionModel, changeRoots, doraLine, modeStored, placeBeside, quietDuration, quietWords, recordKey, resultModel, runningStep, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
6
6
 
7
7
  const C = "9f3c2a71d04e5b8c6a1f2e3d4c5b6a7980716253";
8
8
  const P = "1111111111111111111111111111111111111111";
@@ -263,3 +263,17 @@ describe("the quiet line", () => {
263
263
  expect(firstSentence("main moved to 1234abcd: port 8080 -> 9090. Wave 1 plans again")).toBe("main moved to 1234abcd: port 8080 -> 9090");
264
264
  });
265
265
  });
266
+
267
+ describe("a viewer's hold on the shot ends at the reset and at a new act", () => {
268
+ it("ends when the reset step comes, and when another cycle starts", () => {
269
+ expect(holdEnds({ cycle: 4, step: "applied" }, { cycle: 4, step: "reset" })).toBe(true);
270
+ expect(holdEnds({ cycle: 4, step: "applied" }, { cycle: 5, step: "pull-request" })).toBe(true);
271
+ expect(holdEnds({ cycle: 4, step: "reset" }, { cycle: 5, step: "pull-request" })).toBe(true);
272
+ });
273
+ it("holds through the act's own steps, and through the reset's repeated reads", () => {
274
+ expect(holdEnds({ cycle: 4, step: "planned" }, { cycle: 4, step: "applying" })).toBe(false);
275
+ expect(holdEnds({ cycle: 4, step: "reset" }, { cycle: 4, step: "reset" })).toBe(false);
276
+ expect(holdEnds(null, { cycle: 4, step: "reset" })).toBe(false);
277
+ expect(holdEnds({ cycle: 4, step: "applied" }, null)).toBe(false);
278
+ });
279
+ });
package/web/kiosk.html CHANGED
@@ -341,6 +341,8 @@
341
341
  .k-read-box { width: 1.9em; height: 1.05em; border-radius: 4px; border: 1.5px solid var(--muted); }
342
342
  .k-read-solid, .k-read-dashed { width: 2em; height: 0; border-top: 2px solid var(--fg); }
343
343
  .k-read-dashed { border-top-style: dashed; }
344
+ .k-read-hole { width: 1.9em; height: 1.05em; border-radius: 4px; border: 2px dashed var(--degraded); }
345
+ .k-read-previewed { width: 1.9em; height: 0.8em; border-radius: 0.4em; border: 1.5px solid var(--pending); }
344
346
  .k-read-order { width: 1.9em; height: 1em; background: linear-gradient(var(--muted), var(--muted)) 0 0 / 0.5em 100% no-repeat, linear-gradient(var(--muted), var(--muted)) 0.7em 25% / 0.5em 75% no-repeat, linear-gradient(var(--muted), var(--muted)) 1.4em 50% / 0.5em 50% no-repeat; opacity: 0.8; }
345
347
  .k-read-marks { width: 1.5em; height: 0.75em; background: radial-gradient(circle at 25% 50%, var(--foreign) 0 0.3em, transparent 0.32em), radial-gradient(circle at 75% 50%, var(--runtime) 0 0.3em, transparent 0.32em); }
346
348
  /* behold#571: a tool's page. Its name (and logo where allowed) before the scenario, the replay's banner, the credit. */
@@ -548,6 +550,47 @@
548
550
  border-radius: 0; box-shadow: none; padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px)); padding-left: 16px; padding-right: 16px; }
549
551
  }
550
552
  /* ==== end layout: ask mode ==== */
553
+ /* ==== the side pane (web/kiosk-side.js): the act's run and the current line's details, right of the graph, above the prompt ==== */
554
+ #k-side, #k-side-tab { display: none; }
555
+ body { --k-side-w: clamp(280px, 25vw, 520px); --k-side-tab-w: 30px; }
556
+ body.k-ask.k-watch.k-side-open #view-pane { right: calc(var(--k-side-w) + 10px); }
557
+ body.k-ask.k-watch.k-side-folded #view-pane { right: calc(var(--k-side-tab-w) + 10px); }
558
+ body.k-ask.k-watch.k-side-open #k-side { display: flex; flex-direction: column; gap: var(--s4); position: absolute; top: 0; right: 5px; width: var(--k-side-w); max-height: calc(100% - var(--k-ask-h, 30vh) - 15px); box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
559
+ padding: var(--s3) var(--s4) var(--s4); border: 1px solid var(--rule); border-radius: 8px; background: var(--surface-pane-a, var(--bg)); color: var(--fg); font: clamp(0.9rem, 0.85vw, 1.1rem)/1.4 var(--font-ui); }
560
+ body.k-ask.k-watch.k-side-folded #k-side-tab { display: block; position: absolute; top: 0; right: 5px; width: var(--k-side-tab-w); bottom: calc(var(--k-ask-h, 30vh) + 10px); box-sizing: border-box; padding: var(--s3) 0; border: 1px solid var(--rule); border-radius: 8px;
561
+ background: var(--surface-pane-a, var(--bg)); color: var(--muted); font: 600 0.82rem var(--font-ui); writing-mode: vertical-rl; cursor: pointer; }
562
+ body.k-ask.k-watch.k-side-folded #k-side-tab:hover, body.k-ask.k-watch.k-side-folded #k-side-tab:focus-visible { color: var(--fg); border-color: var(--pending); }
563
+ #k-side .k-side-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
564
+ #k-side .k-side-title { margin: 0; font: 600 0.9em var(--font-ui); color: var(--muted); }
565
+ #k-side .k-side-fold { font: 600 0.8em var(--font-ui); color: var(--muted); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 0.1em var(--s3); cursor: pointer; }
566
+ #k-side .k-side-fold:hover, #k-side .k-side-fold:focus-visible { color: var(--fg); border-color: var(--pending); }
567
+ #k-side .k-side-fold::after { content: " \203A"; }
568
+ #k-side .k-wf { margin-top: var(--s1); }
569
+ #k-side .k-wf-row.k-wf-plain { grid-template-columns: 5.6em minmax(0, 1fr) 3.6em; }
570
+ #k-side .k-wf-words { text-align: right; }
571
+ #k-side .k-side-part .k-wf-wave { padding-left: 0.9em; font-weight: 500; }
572
+ #k-side .k-side-part .k-wf-track { background: transparent; height: auto; }
573
+ #k-side .k-side-words { font-size: 0.86em; color: var(--ink2, var(--fg)); }
574
+ #k-side .k-side-seg.k-tone-done { background: color-mix(in srgb, var(--managed) 75%, transparent); }
575
+ #k-side .k-side-seg.k-tone-running { background: var(--runtime); }
576
+ #k-side .k-side-seg.k-tone-waiting { background: repeating-linear-gradient(135deg, var(--foreign) 0 4px, color-mix(in srgb, var(--foreign) 45%, transparent) 4px 8px); }
577
+ #k-side .k-side-seg.k-tone-failed { background: var(--degraded); }
578
+ #k-side .k-side-part.k-tone-done .k-side-words { color: var(--managed); }
579
+ #k-side .k-side-part.k-tone-failed .k-side-words { color: var(--degraded); }
580
+ #k-side .k-side-quiet { margin: 0; color: var(--muted); font-size: 0.86em; }
581
+ #k-side .k-side-traces .k-wf { margin-top: var(--s1); }
582
+ #k-side .k-side-card { padding-top: var(--s3); border-top: 1px solid var(--rule); display: grid; gap: var(--s2); }
583
+ #k-side .k-side-item p, #k-side .k-side-estate { margin: 0; overflow-wrap: anywhere; }
584
+ #k-side .k-side-name b, #k-side .k-side-estate b { font-weight: 700; margin-right: var(--s2); }
585
+ #k-side .k-side-type { color: var(--muted); font-size: 0.9em; }
586
+ #k-side .k-side-line { font: 0.92em var(--font-mono); padding-left: var(--s3); border-left: 2px solid var(--rule); }
587
+ #k-side .k-line-unknown { color: var(--foreign); border-left-style: dashed; border-left-color: var(--foreign); }
588
+ #k-side .k-line-applied { color: var(--managed); border-left-color: var(--managed); }
589
+ #k-side .k-side-written b { color: var(--managed); }
590
+ @media (max-width: 700px) {
591
+ body.k-ask.k-watch #k-side, body.k-ask.k-watch #k-side-tab { display: none !important; }
592
+ }
593
+ /* ==== end side pane ==== */
551
594
  /* ==== the demo banner (web/kiosk-banner.js): the example's name, its products, the code link ==== */
552
595
  #k-banner { display: flex; align-items: center; gap: var(--s2) var(--s5); min-width: 0; height: 34px; box-sizing: border-box; padding: 0 var(--s4); border-bottom: 1px solid var(--rule); background: var(--surface-pane-a, var(--bg)); overflow: hidden; white-space: nowrap; }
553
596
  #k-banner[hidden] { display: none; }
@@ -845,6 +888,9 @@
845
888
  <aside id="k-result" class="k-over" aria-label="The result" hidden></aside>
846
889
  <!-- behold#936: the prompt pane, in the header's and the caption's place while a step has a prompt (web/kiosk-ask.js). -->
847
890
  <section id="k-ask" aria-live="polite" aria-label="The prompt" hidden></section>
891
+ <!-- The prompt demo's side pane (web/kiosk-side.js): the act's run and what the current line names, right of the graph. -->
892
+ <aside id="k-side" aria-label="This act's run"></aside>
893
+ <button type="button" id="k-side-tab" aria-label="Show the run details">Run details</button>
848
894
  <footer id="k-caption" aria-live="polite"></footer>
849
895
  <!-- behold#781, behold#776: a phone's Watch only: the change's facts by the story, and the graph's marks as a list. -->
850
896
  <section id="k-change" aria-label="The change" hidden></section>
@@ -883,7 +929,7 @@
883
929
  bar: document.getElementById("bar"), frame: document.getElementById("view"), read: document.getElementById("k-read"), side: document.getElementById("runs-side"), main: document.getElementById("runs-main"), views: document.getElementById("views"),
884
930
  tools: { what: document.querySelector(".k-what"), pop: document.getElementById("k-what-pop"), theme: document.getElementById("k-theme"), runsToggle: document.getElementById("k-runs-toggle"), mode: document.getElementById("k-mode") },
885
931
  eh: { switchHost: document.getElementById("k-tools"), trailHost: document.getElementById("eh-trail"), tipsHost: document.getElementById("eh-tips"), modalHost: document.getElementById("eh-modals") },
886
- 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"), ask: document.getElementById("k-ask"), drawer: document.getElementById("k-drawer"), badges: document.getElementById("k-badges"), result: document.getElementById("k-result") },
932
+ 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"), ask: document.getElementById("k-ask"), side: document.getElementById("k-side"), sideTab: document.getElementById("k-side-tab"), drawer: document.getElementById("k-drawer"), badges: document.getElementById("k-badges"), result: document.getElementById("k-result") },
887
933
  },
888
934
  { tool: pageTool(document), source: pageSource(document), runs: pageRuns(document) },
889
935
  );
package/web/kiosk.js CHANGED
@@ -14,6 +14,7 @@
14
14
  // Nothing here is all-or-nothing, and nothing says so.
15
15
 
16
16
  import { linkState, linkWords, noteBack, noteRead, readFailed, shareLink } from "./kiosk-link.js";
17
+ import { KIND_ROWS } from "./member-kind.js";
17
18
  import { CHANT_PANEL_STEPS, chantApprovalModel, chantResultModel } from "./chant-pr-marks.js";
18
19
  import { createLivePacer } from "./chant-live-pace.js";
19
20
  import { applyJobs, cycleTrack, drawTrack, failureAt, seekMs, trackModel, waitingSpec } from "./kiosk-track.js";
@@ -22,7 +23,7 @@ import { TOOLS } from "./tool-mark.js";
22
23
  import { graphWaves } from "./chant-pr-marks.js";
23
24
  import { createProgressPacer, trackWaves } from "./terragucci-live-pace.js";
24
25
  import { PICK_HOLD_MS, annMark, mergeRun, startRuns, statusIcon } from "./kiosk-runs.js";
25
- import { MODES, MODE_STORE, badges as waveBadges, badgeTitle, behindStep, steadyRun, captionModel, captionRoom, coneCaption, stepLine, watchOverlays, doraLine, modeStored, placeBeside, quietWords, recordKey, resultModel, runningStep, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
26
+ import { MODES, MODE_STORE, badges as waveBadges, badgeTitle, behindStep, steadyRun, holdEnds, captionModel, captionRoom, coneCaption, stepLine, watchOverlays, doraLine, modeStored, placeBeside, quietWords, recordKey, resultModel, runningStep, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
26
27
  import { REFIT_WAIT_MS, debounced, shotMessage } from "./kiosk-shot.js";
27
28
  import { mountTrace } from "./kiosk-trace.js";
28
29
  import { startEventHelp } from "./kiosk-event-help-ui.js";
@@ -40,7 +41,8 @@ import { mountResetModal, resetShown } from "./kiosk-reset.js";
40
41
  import { graphFolds, graphPending } from "./kiosk-graph-pane.js";
41
42
  import { askEventHelp, askMode, askShot, createAskPane, hasAsk, replyValues } from "./kiosk-ask.js";
42
43
  import { STATE_WORDS, outcomesOf, changingRoots, costLine, pinsCommit, planFitsPin, pullPin, readEdges, rootsCount, totalsLine, waveRows, blastRows } from "./terragucci-change.js";
43
- import { startKioskLight } from "./kiosk-light.js"; // behold#937
44
+ import { reportedRunView, startKioskLight } from "./kiosk-light.js"; // behold#937
45
+ import { SIDE_PHONE, detailsModel, keepSide, renderSide, actRunView, runTrace, sideApplied, sideState, sideStep, sideStored } from "./kiosk-side.js";
44
46
 
45
47
  /** The scenarios terragucci#1014 numbers. An id not here is shown by the title demo.json carries. */
46
48
  export const SCENARIOS = {
@@ -703,6 +705,8 @@ export function readingRows(view, tool = null) {
703
705
  { mark: "card", words: "Card: one of its resources." },
704
706
  ...arrows,
705
707
  { mark: "marks", words: "Marks: the tools each job runs, in the jobs pane." },
708
+ // behold#1008: chant's composed run tells a stack no preview was made of from a previewed one (web/member-kind.js).
709
+ ...(tool === "chant-compose" ? KIND_ROWS.map((r) => ({ ...r })) : []),
706
710
  ];
707
711
  }
708
712
 
@@ -1853,7 +1857,76 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
1853
1857
  };
1854
1858
  const applyAsk = () => {
1855
1859
  if (typeof document !== "undefined" && document.body && document.body.classList) document.body.classList.toggle("k-ask", !!s.askOn && !!s.watchMode);
1860
+ applySide();
1856
1861
  };
1862
+ // The side pane (web/kiosk-side.js): the act's run and what the terminal's current line names, right of the graph
1863
+ // in Watch while the prompt pane is up, on a screen wider than a phone. Open until the viewer folds it.
1864
+ s.sideOpen = sideStored(shelf);
1865
+ s.sideAsk = null;
1866
+ s.sideTurn = null;
1867
+ // The cycle each scenario was last seen on in demo.json, for a turn the terminal plays after demo.json moved on.
1868
+ const sideCycles = new Map();
1869
+ const sideMerges = new Map();
1870
+ let sideWas = null;
1871
+ const sideNow = () => sideState({ ask: askMode(s), phone: typeof matchMedia === "function" && matchMedia(SIDE_PHONE).matches, open: s.sideOpen });
1872
+ function applySide() {
1873
+ if (typeof document === "undefined" || !document.body || !document.body.classList) return;
1874
+ const st = sideNow();
1875
+ document.body.classList.toggle("k-side-open", st === "open");
1876
+ document.body.classList.toggle("k-side-folded", st === "folded");
1877
+ if (st === sideWas) return;
1878
+ sideWas = st;
1879
+ // The graph's pane got narrower or wider: the frame refits on its own resize (web/app.js watchPaneForFit); the shot
1880
+ // is told again once the layout has settled, and the tips dock in the new room.
1881
+ if (typeof requestAnimationFrame === "function")
1882
+ requestAnimationFrame(() => {
1883
+ drawSide();
1884
+ tellShot(true);
1885
+ });
1886
+ }
1887
+ const setSide = (open) => {
1888
+ s.sideOpen = open;
1889
+ keepSide(shelf, open);
1890
+ applySide();
1891
+ if (open && watch && watch.side && watch.side.focus) watch.side.focus();
1892
+ };
1893
+ function drawSide() {
1894
+ if (!watch || !watch.side || sideNow() !== "open") return;
1895
+ // The terminal plays its steps in turn, and may be a step or an act behind demo.json: the trace is of the act
1896
+ // the terminal's current turn is in, at that turn's step.
1897
+ const at = sideStep(s.demo && s.demo.demo, s.sideTurn, sideCycles);
1898
+ const d = at && sideMerges.has(at.cycle) ? { ...at, commit: sideMerges.get(at.cycle) } : at;
1899
+ const runs = runsApi && runsApi.index && runsApi.index.doc ? runsApi.index.doc.runs : [];
1900
+ // The run view is the apply's: only this act's own, from its merge on (the kiosk's read can be the last merge's).
1901
+ // A pipeline that writes no run view (Terragrunt's and Atmos's on choudoufu) has the act's apply reports instead.
1902
+ const progress = actRunView(d, reportedRunView(s.progress, s.answer));
1903
+ const trace = runTrace(runs, d, { answer: s.answer, progress, now: now().getTime() });
1904
+ const details = detailsModel(s.answer, progress, s.sideAsk);
1905
+ renderSide(watch.side, { trace, details }, { traces: (host) => drawWaveTraces(host, s), onFold: () => setSide(false) });
1906
+ }
1907
+ if (watch && watch.sideTab && watch.sideTab.addEventListener) watch.sideTab.addEventListener("click", () => setSide(true));
1908
+ if (watch && watch.side && watch.side.setAttribute) watch.side.setAttribute("tabindex", "-1");
1909
+ // The prompt pane's height, which the side pane stands on: kept as --k-ask-h so the two never overlap.
1910
+ if (watch && watch.ask && typeof ResizeObserver !== "undefined" && typeof document !== "undefined") {
1911
+ new ResizeObserver(() => {
1912
+ const h = watch.ask.hidden ? 0 : Math.ceil(watch.ask.getBoundingClientRect().height);
1913
+ document.body.style.setProperty("--k-ask-h", `${h}px`);
1914
+ }).observe(watch.ask);
1915
+ }
1916
+ // The card follows the prompt pane's current turn: what its ask lights, from the plan (web/kiosk-light.js).
1917
+ if (typeof window !== "undefined" && window.addEventListener) {
1918
+ const turn = (e) => {
1919
+ const det = e && e.detail && typeof e.detail === "object" ? e.detail : {};
1920
+ s.sideAsk = det.ask && typeof det.ask === "object" ? det.ask : null;
1921
+ if (typeof det.scenario === "string" && typeof det.step === "string") s.sideTurn = { scenario: det.scenario, step: det.step };
1922
+ drawSide();
1923
+ };
1924
+ for (const t of ["behold:ask-hold", "behold:ask-start", "behold:ask-light", "behold:ask-status", "behold:ask-done", "behold:ask-clear"]) window.addEventListener(t, turn);
1925
+ if (typeof matchMedia === "function") {
1926
+ const mq = matchMedia(SIDE_PHONE);
1927
+ if (mq.addEventListener) mq.addEventListener("change", applySide);
1928
+ }
1929
+ }
1857
1930
  const askPane =
1858
1931
  watch && watch.ask
1859
1932
  ? createAskPane({
@@ -1874,8 +1947,15 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
1874
1947
  const resetModal = askPane && typeof document !== "undefined" && document.body ? mountResetModal(document) : null;
1875
1948
  /** Take one narration (demo.json, or a replayed step), and ask for the run it is about when the step moved. */
1876
1949
  const setDemo = (answer) => {
1950
+ const was = s.demo && s.demo.demo;
1877
1951
  s.demo = answer;
1878
1952
  const d = answer && answer.demo;
1953
+ // A viewer's hold on the shot ends at the reset and at a new act: the graph in the pane is another one then, and
1954
+ // the shot frames it to the pane as it is (a held view of the last graph left the reset's scene at the left edge).
1955
+ if (holdEnds(was || null, d || null) && s.endHold) s.endHold();
1956
+ if (d && typeof d.scenario === "string" && Number.isInteger(d.cycle)) sideCycles.set(d.scenario, d.cycle);
1957
+ // Each act's merge commit, as demo.json named it from the merge on (the reset names the base instead).
1958
+ if (d && Number.isInteger(d.cycle) && d.step !== "reset" && sideApplied(d) && typeof d.commit === "string") sideMerges.set(d.cycle, d.commit);
1879
1959
  if (askPane) {
1880
1960
  // behold#942: ask mode holds for the scenario, so the steps between prompts keep the graph and the pane.
1881
1961
  s.askHeld = askHeld(s.askHeld, d || null);
@@ -2072,6 +2152,12 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2072
2152
  // The layout moved under the frame: the shot goes again once it has settled.
2073
2153
  if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => tellShot(true));
2074
2154
  };
2155
+ s.endHold = () => {
2156
+ if (watchHoldAt === null && !s.watchHeld) return;
2157
+ watchHoldAt = null;
2158
+ s.watchHeld = null;
2159
+ lastShot = null;
2160
+ };
2075
2161
  const holdShot = () => {
2076
2162
  if (!s.watchMode) return;
2077
2163
  watchHoldAt = now().getTime();
@@ -2155,7 +2241,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2155
2241
  const trailLineH = chip ? chip.getBoundingClientRect().height + 4 : 26;
2156
2242
  return captionRoom({ capHeight: c.height, extras, rowH, trailH, trailLineH, below: Math.max(0, f.bottom - c.bottom) });
2157
2243
  }
2158
- function tellShot(force, still) {
2244
+ function tellShot(force, still, fresh = null) {
2159
2245
  if (!frame || !frame.contentWindow || !watch) return;
2160
2246
  // behold#940: ask mode holds in the frame between prompts and between shots, so it is told on its own, when it changes.
2161
2247
  if (askMode(s) !== askTold) {
@@ -2169,14 +2255,26 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2169
2255
  }
2170
2256
  return;
2171
2257
  }
2172
- if (s.watchHeld || !s.shot) return;
2258
+ if (!s.shot) return;
2259
+ // A viewer's hold keeps the frame they moved where it is. A frame that has just loaded (`fresh`, its window) has
2260
+ // nothing of theirs: it takes the shot, or it would fit itself to the graph it first drew and not to the pane.
2261
+ if (s.watchHeld && !fresh) return;
2173
2262
  const insets = shotInsets(s.shot);
2174
2263
  // The caption's tallest, for a held small stage's one framing; a stage that isn't held never reads it.
2175
2264
  const room = captionRoomPx();
2176
2265
  const key = `${s.shot.id}|${s.shot.ask ? "ask" : ""}|${insets.right || 0}|${Math.round((insets.top || 0) / 12)}|${Math.round((insets.left || 0) / 12)}|${Math.round((insets.bottom || 0) / 12)}|${s.shot.roots.join(",")}|${Math.round(room / 12)}`;
2266
+ const msg = shotMessage({ roots: s.shot.roots, waves: s.shot.waves, whole: s.shot.whole, insets, id: s.shot.id, room, ask: s.shot.ask === true, ...(still ? { ms: 0 } : {}) });
2267
+ if (s.watchHeld) {
2268
+ try {
2269
+ fresh.postMessage(msg, origin);
2270
+ } catch {
2271
+ /* the frame went away */
2272
+ }
2273
+ return;
2274
+ }
2177
2275
  if (!force && key === lastShot) return;
2178
2276
  lastShot = key;
2179
- post(shotMessage({ roots: s.shot.roots, waves: s.shot.waves, whole: s.shot.whole, insets, id: s.shot.id, room, ask: s.shot.ask === true, ...(still ? { ms: 0 } : {}) }));
2277
+ post(msg);
2180
2278
  }
2181
2279
  // behold#631: the projected cycle track, a chant kiosk's bottom band in place of the chip strip and the rail.
2182
2280
  const trackState = { cycle: null, pulls: [], key: null, since: null };
@@ -2268,6 +2366,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2268
2366
  // behold#781, behold#776: a phone's Watch says the change in words by the story, and lists the graph's marks.
2269
2367
  if (watch.change) drawChange(watch.change, s);
2270
2368
  drawWaves();
2369
+ drawSide();
2271
2370
  // behold#775: on a phone, each finished wave's trace under the step (hidden on a wider screen, where the badges open them).
2272
2371
  let traces = watch.layer.querySelector(":scope > .k-w-traces");
2273
2372
  if (!traces) {
@@ -2980,10 +3079,10 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2980
3079
  watchBox(watch && watch.ask);
2981
3080
  el.addEventListener("load", () => {
2982
3081
  // A new frame takes Watch's shot before it draws, so it opens on it and never on the fit.
2983
- tellShot(true);
3082
+ tellShot(true, false, el.contentWindow);
2984
3083
  tellFrame(true);
2985
3084
  // The frame reads its graph after load; tell it again once it has had the time.
2986
- for (const ms of [1500, 4000, 8000]) setTimeout(() => (tellFrame(true), tellShot(true)), ms);
3085
+ for (const ms of [1500, 4000, 8000]) setTimeout(() => (tellFrame(true), tellShot(true, false, el.contentWindow)), ms);
2987
3086
  });
2988
3087
  };
2989
3088
  const swapFrame = () => {
@@ -0,0 +1,31 @@
1
+ // behold#1008: how a composed run's member box says whether a preview was made of it.
2
+ //
3
+ // chant's composed run (src/chant-compose.ts composedView) gives each member a kind in `answer.chant.members`:
4
+ // hole nothing could be previewed (its change set lists holes); the box is dashed and tagged "no preview";
5
+ // previewed a preview that reads values known after apply; the box is tagged "previewed";
6
+ // plain a preview with every value known; no tag.
7
+ // The estate scene (web/kiosk-estate-scene.js) draws the marks and the kiosk's "How to read this" (web/kiosk.js
8
+ // readingRows) says what they mean, from the words here, so the two never drift apart.
9
+
10
+ /** The tag on a box of each marked kind. A plain member has none. */
11
+ export const KIND_TAGS = { hole: "no preview", previewed: "previewed" };
12
+
13
+ /** The legend's line for each marked kind, in the order the legend lists them. */
14
+ export const KIND_ROWS = [
15
+ { mark: "hole", words: "Dashed box: a stack no preview could be made of." },
16
+ { mark: "previewed", words: "Tag previewed: some values known after apply." },
17
+ ];
18
+
19
+ /** The words in a hole's empty box. */
20
+ export const HOLE_WORDS = "nothing could be previewed";
21
+
22
+ /** Each member's kind by path, from a composed answer: `Map<path, { kind, reasons }>`. Empty when the answer has none. */
23
+ export function memberKinds(answer) {
24
+ const out = new Map();
25
+ const rows = answer && answer.chant && Array.isArray(answer.chant.members) ? answer.chant.members : [];
26
+ for (const m of rows) {
27
+ if (!m || typeof m.member !== "string" || (m.kind !== "hole" && m.kind !== "previewed" && m.kind !== "plain")) continue;
28
+ out.set(m.member, { kind: m.kind, reasons: Array.isArray(m.reasons) ? m.reasons.filter((r) => typeof r === "string") : [] });
29
+ }
30
+ return out;
31
+ }