@intentius/behold 0.29.39 → 0.29.41
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 +148 -10
- package/README.md +6 -2
- package/dist/cli.js +15965 -13076
- package/example-writes/README.md +1 -1
- package/example-writes/chant.config.ts +0 -6
- package/package.json +5 -2
- package/web/app.js +327 -21
- package/web/carve-export.js +142 -0
- package/web/carve-narration.js +268 -0
- package/web/carve-narration.test.js +18 -0
- package/web/change-set-overlay.js +147 -0
- package/web/change-set-overlay.test.js +83 -0
- package/web/dots-border.js +66 -0
- package/web/dots-border.test.js +27 -0
- package/web/dots-kiosk.js +279 -0
- package/web/dots-kiosk.test.js +60 -0
- package/web/dots-layout.d.ts +10 -0
- package/web/dots-layout.js +201 -0
- package/web/dots-live.js +316 -0
- package/web/dots-live.test.js +220 -0
- package/web/dots-lod.js +122 -0
- package/web/dots-lod.test.js +78 -0
- package/web/dots-recording.d.ts +7 -0
- package/web/dots-recording.js +247 -0
- package/web/dots-recording.test.js +71 -0
- package/web/dots-scene.js +294 -0
- package/web/dots-scene.test.js +118 -0
- package/web/dots-timeline.js +128 -0
- package/web/dots-timeline.test.js +83 -0
- package/web/dots-tour.js +153 -0
- package/web/dots.js +2124 -0
- package/web/dots.test.js +15 -0
- package/web/index.html +29 -0
- package/web/kiosk-carve.js +219 -0
- package/web/kiosk-carve.test.js +26 -0
- package/web/kiosk-event-help-ui.js +6 -0
- package/web/kiosk.html +2 -1
- package/web/kiosk.js +21 -6
- package/web/operator.js +1 -1
- package/web/run-playhead.js +102 -19
- package/web/run-playhead.test.js +81 -11
- package/web/tour-player.js +204 -0
- package/web/tour-player.test.js +115 -0
- package/web/tours/behold.tour.v1.schema.json +182 -0
- package/web/tours/terralith.json +330 -0
- package/web/trunk-lane.js +254 -0
- package/web/trunk-lane.test.js +117 -0
- package/web/workspace-gates.js +29 -4
- package/web/workspace-gates.test.js +23 -2
package/web/dots.test.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// #712: unmounted, the dots layer changes nothing in the app. app.js calls
|
|
2
|
+
// these on every camera move and every wheel event; with no preview mounted
|
|
3
|
+
// they must be no-ops and leave today's 3x zoom-out limit in place.
|
|
4
|
+
import { describe, it, expect } from "vitest";
|
|
5
|
+
import { dotsActive, dotsZoomOutFactor, dotsCamera, unmountDots } from "./dots.js";
|
|
6
|
+
|
|
7
|
+
describe("the dots layer when the preview is off (#712)", () => {
|
|
8
|
+
it("is inactive, sets no zoom limit and ignores the camera", () => {
|
|
9
|
+
expect(dotsActive()).toBe(false);
|
|
10
|
+
expect(dotsZoomOutFactor()).toBe(null);
|
|
11
|
+
expect(() => dotsCamera()).not.toThrow();
|
|
12
|
+
expect(() => unmountDots()).not.toThrow();
|
|
13
|
+
expect(dotsActive()).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
});
|
package/web/index.html
CHANGED
|
@@ -242,6 +242,32 @@
|
|
|
242
242
|
/* #506: the audit record's lane, in the tab and in a card's inspect pane. */
|
|
243
243
|
#tab-terragucci .tg-timeline-title { font-weight: 600; border-top: 1px solid var(--rule); padding-top: 6px; }
|
|
244
244
|
.tg-timeline { display: flex; flex-direction: column; gap: 3px; font-size: var(--t-caption); }
|
|
245
|
+
/* #680: the trunk lane. */
|
|
246
|
+
#panel-body #tab-trunk.active { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-caption); }
|
|
247
|
+
#tab-trunk h3 { margin: 8px 0 0; font-size: var(--t-caption); }
|
|
248
|
+
#tab-trunk .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
249
|
+
#tab-trunk .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
|
|
250
|
+
#tab-trunk .lane-commit { border-top: 1px solid var(--rule); padding-top: 3px; }
|
|
251
|
+
#tab-trunk .lane-sha { font-family: var(--font-mono); }
|
|
252
|
+
#tab-trunk .lane-revoked { color: var(--degraded); font-weight: 600; }
|
|
253
|
+
#tab-trunk .lane-undecided { color: var(--muted); }
|
|
254
|
+
#tab-trunk .lane-where { color: var(--pending); }
|
|
255
|
+
#tab-trunk .lane-facts, #tab-trunk .lane-runs { color: var(--muted); overflow-wrap: anywhere; }
|
|
256
|
+
#tab-trunk .ws-gate { border: 1px solid var(--pending, var(--rule)); border-radius: 6px; padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; }
|
|
257
|
+
#tab-trunk .ws-gate-title { font-weight: 600; }
|
|
258
|
+
#tab-trunk .ws-gate-facts, #tab-trunk .ws-gate-note { color: var(--muted); overflow-wrap: anywhere; }
|
|
259
|
+
#tab-trunk a { color: inherit; }
|
|
260
|
+
#tab-trunk .lane-change-set { color: var(--pending); }
|
|
261
|
+
/* #681: a gate's change set, previewed on the graph. */
|
|
262
|
+
#panel-body #tab-change-set.active { display: flex; flex-direction: column; gap: 4px; font-size: var(--t-caption); }
|
|
263
|
+
#tab-change-set h3 { margin: 8px 0 0; font-size: var(--t-caption); }
|
|
264
|
+
#tab-change-set .cs-title { font-weight: 600; font-family: var(--font-mono); overflow-wrap: anywhere; }
|
|
265
|
+
#tab-change-set .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
266
|
+
#tab-change-set .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
|
|
267
|
+
.cs-entry { position: relative; padding: 2px 0 2px 10px; font-size: var(--t-caption); overflow-wrap: anywhere; }
|
|
268
|
+
.cs-entry::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--bar, var(--bar-neutral)); }
|
|
269
|
+
.cs-entry-head { font-family: var(--font-mono); font-weight: 600; }
|
|
270
|
+
.cs-entry-facts, .cs-entry-field { color: var(--muted); font-family: var(--font-mono); }
|
|
245
271
|
.rel-strip { border-collapse: collapse; margin: 6px 0; font-size: 12px; }
|
|
246
272
|
.rel-strip th, .rel-strip td { padding: 3px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--neutral); }
|
|
247
273
|
.rel-strip .rel-component { font-family: var(--font-mono); overflow-wrap: anywhere; }
|
|
@@ -565,6 +591,9 @@
|
|
|
565
591
|
reads the same in both. */
|
|
566
592
|
.run-playhead { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 6px; }
|
|
567
593
|
.run-verdict { font-size: var(--t-caption); }
|
|
594
|
+
/* #679: where the steps came from (chant's run events, a degraded older
|
|
595
|
+
stream, or a best-effort log read). Inline colour sets the tone. */
|
|
596
|
+
.run-source { font-size: var(--t-caption); color: var(--muted); }
|
|
568
597
|
/* What behold does NOT know — a lost stream, an unreachable gate query.
|
|
569
598
|
Same voice as the carve refusal: a statement, not an alarm. */
|
|
570
599
|
.run-lost { border-left: 3px solid var(--bar-foreign); background: var(--well);
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// The kiosk's frame for a live carve (#715). When the estate has choudoufu
|
|
2
|
+
// roots or estate rosters, the framed app mounts the dots layer's live driver
|
|
3
|
+
// (web/dots.js, web/dots-live.js). While a migration runs it directs the
|
|
4
|
+
// camera and tells the kiosk, twice a second, what is happening: the beat
|
|
5
|
+
// (title and next line from demo.json, the line under them from the newest
|
|
6
|
+
// progress line), the counts, and where each estate's box is.
|
|
7
|
+
//
|
|
8
|
+
// This draws that: a caption in Watch's caption's place and size (along the
|
|
9
|
+
// stage's bottom on a desktop, under the graph on a phone) with a "live"
|
|
10
|
+
// badge, and Tips bubbles on the first landing in each estate, the first
|
|
11
|
+
// refusal and the end. It hides Watch's own caption only while the carve has
|
|
12
|
+
// the camera, and tells the frame which mode the kiosk is in and how much of
|
|
13
|
+
// it the caption and the cycle's trail cover, so the boxes are framed clear
|
|
14
|
+
// of them. In Inspect the director frames the boxes too while the carve has
|
|
15
|
+
// the camera, unless a person has the graph in hand. A kiosk whose frame
|
|
16
|
+
// never mounts the layer gets no message, and this draws nothing: the kiosk
|
|
17
|
+
// is as it was.
|
|
18
|
+
|
|
19
|
+
import { createNarration } from "./carve-narration.js";
|
|
20
|
+
import { SLOWED } from "./tour-player.js";
|
|
21
|
+
|
|
22
|
+
const STYLE = `
|
|
23
|
+
#k-carve { display: none; }
|
|
24
|
+
body.k-carving #k-caption { display: none; }
|
|
25
|
+
body.k-carving.k-watch #k-carve { display: grid; }
|
|
26
|
+
/* The same place and size as Watch's own caption (web/kiosk.html #k-caption): along the bottom of the stage on a desktop, in the flow under the graph on a phone. */
|
|
27
|
+
#k-carve { position: absolute; left: 5px; right: 5px; bottom: 5px; z-index: 6; grid-template-rows: auto calc(2 * 1.25em * 1.3) calc(2 * 1.25em * 1.3); gap: 0.25em; padding: 0.7em 1.4em 0.8em; background: var(--surface-pane-b, var(--panel)); border-top: 1px solid var(--rule, var(--line)); border-radius: 0 0 8px 8px; box-shadow: 0 -10px 30px color-mix(in srgb, var(--bg) 70%, transparent); }
|
|
28
|
+
#k-carve .cx-top { display: flex; align-items: baseline; gap: 0.8em; min-width: 0; }
|
|
29
|
+
#k-carve .cx-title { margin: 0; font-size: 1.55em; line-height: 1.2; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
30
|
+
#k-carve .cx-next { margin: 0 0 0 auto; color: var(--muted); font: 0.92em var(--font-mono); position: relative; padding-bottom: 6px; white-space: nowrap; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
|
|
31
|
+
#k-carve .cx-nbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--rule, var(--line)) 55%, transparent); overflow: hidden; }
|
|
32
|
+
#k-carve .cx-nbar-in { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar, var(--bar-pending)); border-radius: inherit; }
|
|
33
|
+
#k-carve .cx-row { margin: 0; display: grid; grid-template-columns: var(--k-label-w, 6.5em) minmax(0, 1fr); column-gap: 0.8em; align-items: start; align-self: stretch; padding-left: 0.75em; line-height: 1.25; box-shadow: inset 3px 0 0 var(--bar, var(--bar-neutral)); color: color-mix(in srgb, var(--fg) 78%, var(--muted)); }
|
|
34
|
+
#k-carve .cx-row:first-of-type { box-shadow: inset 5px 0 0 var(--bar, var(--bar-neutral)); }
|
|
35
|
+
#k-carve .cx-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 72ch; }
|
|
36
|
+
#k-carve .cx-label { font: 600 0.66rem/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--bar, var(--muted)); padding-top: 0.6em; }
|
|
37
|
+
#k-carve .cx-lead { font-size: 1.3em; font-weight: 600; color: var(--fg); }
|
|
38
|
+
#k-carve .cx-rec { display: inline-block; font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-ink, var(--muted)); border: 1px solid var(--rule, var(--line)); border-radius: 999px; padding: 1px 8px; cursor: help; vertical-align: 0.15em; margin-right: 10px; }
|
|
39
|
+
#k-carve .cx-badge-live { color: var(--bar-managed); border-color: var(--bar-managed); }
|
|
40
|
+
#k-carve .cx-badge-live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 0.05em; }
|
|
41
|
+
#k-carve .cx-tone-busy { --bar: var(--bar-pending); }
|
|
42
|
+
#k-carve .cx-tone-ok { --bar: var(--bar-managed); }
|
|
43
|
+
#k-carve .cx-tone-bad { --bar: var(--bar-degraded); }
|
|
44
|
+
#k-carve .cx-tone-idle { --bar: var(--bar-neutral); }
|
|
45
|
+
/* The live badge's lag: how long since the newest write (web/tour-player.js lagText). */
|
|
46
|
+
#k-carve .cx-lag { font: 600 11px var(--font-mono); color: var(--muted); margin-right: 10px; vertical-align: 0.15em; white-space: nowrap; }
|
|
47
|
+
#k-carve .cx-lag-wait { color: var(--bar-pending); }
|
|
48
|
+
/* The tour (behold.tour/v1): the rail, the chapter's card docked in the caption, the numbers, the notes. */
|
|
49
|
+
#k-carve.cx-tour { grid-template-rows: auto auto auto auto; gap: 0.35em; }
|
|
50
|
+
#k-carve .cx-tour-top { align-items: center; flex-wrap: wrap; gap: 0.5em 0.8em; }
|
|
51
|
+
#k-carve .cx-tour-top .cx-rec { margin-right: 0; }
|
|
52
|
+
#k-carve .cx-rail { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; min-width: 0; }
|
|
53
|
+
#k-carve .cx-ch { position: relative; display: flex; align-items: baseline; gap: 6px; padding: 2px 8px 5px; border: 1px solid var(--rule, var(--line)); border-radius: 6px; font: 600 11px var(--font-mono); color: var(--muted); white-space: nowrap; }
|
|
54
|
+
#k-carve .cx-ch-done { color: color-mix(in srgb, var(--fg) 70%, var(--muted)); }
|
|
55
|
+
#k-carve .cx-ch-current { color: var(--fg); border-color: var(--bar-pending); }
|
|
56
|
+
#k-carve .cx-ch-name { font: 600 11px var(--font-ui); max-width: 26ch; overflow: hidden; text-overflow: ellipsis; }
|
|
57
|
+
#k-carve .cx-ch-bar { position: absolute; left: 6px; right: 6px; bottom: 2px; height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--rule, var(--line)) 60%, transparent); overflow: hidden; }
|
|
58
|
+
#k-carve .cx-ch-bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); background: var(--bar-managed); }
|
|
59
|
+
#k-carve .cx-ch-current .cx-ch-bar::after { background: var(--bar-pending); }
|
|
60
|
+
#k-carve .cx-follow { margin: 0 0 0 auto; display: flex; gap: 10px; align-items: baseline; font: 12px var(--font-ui); color: var(--muted); white-space: nowrap; }
|
|
61
|
+
#k-carve .cx-follow-label { font: 600 0.66rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
|
|
62
|
+
#k-carve .cx-follow a { color: var(--focus, var(--fg)); }
|
|
63
|
+
#k-carve .cx-card { padding-left: 0.75em; box-shadow: inset 5px 0 0 var(--bar-pending); }
|
|
64
|
+
#k-carve .cx-card.cx-enter { animation: cx-dock 0.45s ease-out; }
|
|
65
|
+
@keyframes cx-dock { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
|
|
66
|
+
@media (prefers-reduced-motion: reduce) { #k-carve .cx-card.cx-enter { animation: none; } }
|
|
67
|
+
#k-carve .cx-card-title { white-space: normal; font-size: 1.4em; }
|
|
68
|
+
#k-carve .cx-ch-kicker { font: 600 0.5em var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-right: 0.8em; vertical-align: 0.3em; }
|
|
69
|
+
#k-carve .cx-card-line { margin: 0.15em 0 0; color: color-mix(in srgb, var(--fg) 85%, var(--muted)); line-height: 1.35; max-width: 90ch; }
|
|
70
|
+
#k-carve .cx-numbers { margin: 0.2em 0 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
|
|
71
|
+
#k-carve .cx-num { display: flex; flex-direction: column; }
|
|
72
|
+
#k-carve .cx-num dt { font: 600 0.66rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
|
|
73
|
+
#k-carve .cx-num dd { margin: 0; font-size: 1.25em; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
|
|
74
|
+
#k-carve .cx-notes { margin: 0; font: 12px/1.35 var(--font-mono); color: var(--muted); padding-left: 0.75em; overflow-wrap: anywhere; }
|
|
75
|
+
/* A phone: in the page's flow under the graph, where Watch's caption goes (web/kiosk.html). */
|
|
76
|
+
@media (max-width: 600px) {
|
|
77
|
+
body.k-watch #k-carve { position: static; order: 1; flex-direction: column; gap: 4px; border-radius: 0; box-shadow: none; border: 0; border-top: 1px solid var(--line); padding: 8px 12px 10px; }
|
|
78
|
+
body.k-carving.k-watch #k-carve { display: flex; }
|
|
79
|
+
#k-carve .cx-top { flex-wrap: wrap; gap: 4px 16px; }
|
|
80
|
+
#k-carve .cx-title { font-size: 16px; white-space: normal; }
|
|
81
|
+
#k-carve .cx-next { margin-left: 0; flex: 1 1 100%; max-width: none; font-size: 13px; padding-bottom: 7px; }
|
|
82
|
+
#k-carve .cx-row { grid-template-columns: 5em minmax(0, 1fr); gap: 10px; padding-left: 10px; }
|
|
83
|
+
#k-carve .cx-row:first-of-type { box-shadow: inset 3px 0 0 var(--bar, var(--bar-neutral)); }
|
|
84
|
+
#k-carve .cx-label { font-size: 11px; padding-top: 3px; }
|
|
85
|
+
#k-carve .cx-lead { font-size: 14px; }
|
|
86
|
+
#k-carve .cx-text { -webkit-line-clamp: unset; display: block; }
|
|
87
|
+
#k-carve .cx-rail { flex-wrap: wrap; }
|
|
88
|
+
#k-carve .cx-ch-name { display: none; }
|
|
89
|
+
#k-carve .cx-follow { margin-left: 0; flex-wrap: wrap; white-space: normal; }
|
|
90
|
+
#k-carve .cx-card-title { font-size: 17px; }
|
|
91
|
+
#k-carve .cx-card-line { font-size: 14px; }
|
|
92
|
+
#k-carve .cx-num dd { font-size: 16px; }
|
|
93
|
+
}
|
|
94
|
+
/* Slowed playback, in Inspect's quiet rows: off (real time) unless a person picks it. */
|
|
95
|
+
.k-slowed { font: 12px var(--font-ui); background: var(--well, transparent); color: var(--fg); border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px; cursor: pointer; }
|
|
96
|
+
.k-slowed[aria-pressed="true"] { border-color: var(--bar-pending); }
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
/** Whether a message is the framed dots layer's live state, from this origin. */
|
|
100
|
+
export function liveCarveMessage(e, origin) {
|
|
101
|
+
return !!(e && e.origin === origin && e.data && e.data.type === "behold:dots-state" && e.data.live === true);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Start listening. `frame()`: the iframe shown now; `watch`: Watch's
|
|
106
|
+
* elements (its layer and caption); `eh`: the Tips hosts; `isWatch()`: whether
|
|
107
|
+
* the kiosk is in Watch. Returns `tellMode()`, for the kiosk to call when its
|
|
108
|
+
* mode changes.
|
|
109
|
+
*/
|
|
110
|
+
export function startKioskCarve({ frame, watch, eh, origin = location.origin, isWatch = () => true }) {
|
|
111
|
+
const trail = eh && eh.trailHost ? eh.trailHost : null;
|
|
112
|
+
if (typeof window === "undefined" || typeof document === "undefined" || !watch || !watch.layer) return { tellMode() {}, caption: () => (watch ? watch.caption : null), slowedControl: () => null };
|
|
113
|
+
let node = null;
|
|
114
|
+
let narration = null;
|
|
115
|
+
let carving = false;
|
|
116
|
+
// The frame last told the kiosk's mode: a frame swapped in (a new view) is told again.
|
|
117
|
+
let told = null;
|
|
118
|
+
let lastBottom = -1;
|
|
119
|
+
// Slowed playback: a person's choice, real time until then. One button, kept across the header's redraws.
|
|
120
|
+
let slowed = 1;
|
|
121
|
+
let slowedNode = null;
|
|
122
|
+
const slowedButton = () => {
|
|
123
|
+
if (slowedNode || typeof document === "undefined") return slowedNode;
|
|
124
|
+
slowedNode = document.createElement("button");
|
|
125
|
+
slowedNode.type = "button";
|
|
126
|
+
slowedNode.className = "k-slowed";
|
|
127
|
+
const label = () => {
|
|
128
|
+
const at = SLOWED.find((x) => x.n === slowed) || SLOWED[0];
|
|
129
|
+
slowedNode.textContent = at.words;
|
|
130
|
+
slowedNode.setAttribute("aria-pressed", String(slowed !== 1));
|
|
131
|
+
slowedNode.title = slowed === 1 ? "Writes draw as they are read. Click to slow them down." : `Each read's writes are drawn ${at.stepMs} ms apart. Click for the next speed.`;
|
|
132
|
+
};
|
|
133
|
+
label();
|
|
134
|
+
slowedNode.addEventListener("click", () => {
|
|
135
|
+
const i = SLOWED.findIndex((x) => x.n === slowed);
|
|
136
|
+
slowed = SLOWED[(i + 1) % SLOWED.length].n;
|
|
137
|
+
label();
|
|
138
|
+
const f = frame();
|
|
139
|
+
try {
|
|
140
|
+
if (f && f.contentWindow) f.contentWindow.postMessage({ type: "behold:dots-slowed", n: slowed }, origin);
|
|
141
|
+
} catch {
|
|
142
|
+
/* the frame went away */
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return slowedNode;
|
|
146
|
+
};
|
|
147
|
+
const ensure = () => {
|
|
148
|
+
if (node) return;
|
|
149
|
+
const st = document.createElement("style");
|
|
150
|
+
st.textContent = STYLE;
|
|
151
|
+
document.head.appendChild(st);
|
|
152
|
+
node = document.createElement("footer");
|
|
153
|
+
node.id = "k-carve";
|
|
154
|
+
node.setAttribute("aria-live", "polite");
|
|
155
|
+
node.setAttribute("aria-label", "The live carve");
|
|
156
|
+
// Beside Watch's own caption, so it takes the same place in the layout.
|
|
157
|
+
if (watch.caption && watch.caption.parentNode) watch.caption.parentNode.insertBefore(node, watch.caption.nextSibling);
|
|
158
|
+
else watch.layer.appendChild(node);
|
|
159
|
+
narration = createNarration({
|
|
160
|
+
bar: null,
|
|
161
|
+
caption: node,
|
|
162
|
+
tipsHost: eh && eh.tipsHost ? eh.tipsHost : null,
|
|
163
|
+
modalHost: eh && eh.modalHost ? eh.modalHost : null,
|
|
164
|
+
origin: () => {
|
|
165
|
+
const f = frame();
|
|
166
|
+
return f ? f.getBoundingClientRect() : { left: 0, top: 0, width: window.innerWidth, height: window.innerHeight };
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
const insets = () => {
|
|
171
|
+
const f = frame();
|
|
172
|
+
if (!f || !node || !carving) return { top: 0, bottom: 0 };
|
|
173
|
+
const g = f.getBoundingClientRect();
|
|
174
|
+
const c = node.getBoundingClientRect();
|
|
175
|
+
// event-help's trail sits on the caption's top edge: the boxes stay clear of both.
|
|
176
|
+
const tr = trail && !trail.hidden ? trail.getBoundingClientRect() : null;
|
|
177
|
+
const top = tr && tr.height && tr.top < c.top && tr.bottom >= c.top - 2 ? tr.top : c.top;
|
|
178
|
+
const over = c.height && top < g.bottom && c.bottom > g.top ? g.bottom - top : 0;
|
|
179
|
+
return { top: 0, bottom: Math.max(0, Math.round(over)) };
|
|
180
|
+
};
|
|
181
|
+
const tellMode = () => {
|
|
182
|
+
const f = frame();
|
|
183
|
+
try {
|
|
184
|
+
if (f && f.contentWindow) f.contentWindow.postMessage({ type: "behold:dots-mode", mode: isWatch() ? "watch" : "inspect", insets: insets() }, origin);
|
|
185
|
+
} catch {
|
|
186
|
+
/* the frame went away */
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
window.addEventListener("message", (e) => {
|
|
190
|
+
if (e.origin !== origin || !e.data) return;
|
|
191
|
+
if (e.data.type === "behold:dots-ready" && e.data.live) return void tellMode();
|
|
192
|
+
if (!liveCarveMessage(e, origin)) return;
|
|
193
|
+
const f = frame();
|
|
194
|
+
if (f && e.source && e.source !== f.contentWindow) return;
|
|
195
|
+
ensure();
|
|
196
|
+
if (e.source && e.source !== told) {
|
|
197
|
+
told = e.source;
|
|
198
|
+
tellMode();
|
|
199
|
+
}
|
|
200
|
+
if (!!e.data.carving !== carving) {
|
|
201
|
+
carving = !!e.data.carving;
|
|
202
|
+
document.body.classList.toggle("k-carving", carving);
|
|
203
|
+
tellMode();
|
|
204
|
+
}
|
|
205
|
+
// The caption shows only while the carve has the camera (body.k-carving); the Tips come either way.
|
|
206
|
+
narration.update(e.data);
|
|
207
|
+
// The caption's height follows its words: the frame keeps the boxes clear of it as it changes.
|
|
208
|
+
const ins = insets();
|
|
209
|
+
if (ins.bottom !== lastBottom) {
|
|
210
|
+
lastBottom = ins.bottom;
|
|
211
|
+
tellMode();
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
/** The caption shown now: the carve's while it has the camera, so the trail and the shot stay clear of it. */
|
|
215
|
+
const caption = () => (carving && node && isWatch() ? node : watch.caption);
|
|
216
|
+
/** The slowed control for Inspect's quiet rows, once a frame draws a live carve; null before. */
|
|
217
|
+
const slowedControl = () => (node ? slowedButton() : null);
|
|
218
|
+
return { tellMode, caption, slowedControl };
|
|
219
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// #715: the kiosk takes the live carve's state only from its own origin's
|
|
2
|
+
// frame, and only when the frame says it is live; a kiosk whose frame never
|
|
3
|
+
// mounts the layer is told nothing and draws nothing new.
|
|
4
|
+
import { describe, it, expect } from "vitest";
|
|
5
|
+
import { liveCarveMessage, startKioskCarve } from "./kiosk-carve.js";
|
|
6
|
+
import { badgeText, recordedWords } from "./carve-narration.js";
|
|
7
|
+
|
|
8
|
+
const O = "http://127.0.0.1:4000";
|
|
9
|
+
|
|
10
|
+
describe("the kiosk's live carve (#715)", () => {
|
|
11
|
+
it("reads only a live state from its own origin", () => {
|
|
12
|
+
expect(liveCarveMessage({ origin: O, data: { type: "behold:dots-state", live: true } }, O)).toBe(true);
|
|
13
|
+
expect(liveCarveMessage({ origin: O, data: { type: "behold:dots-state" } }, O)).toBe(false);
|
|
14
|
+
expect(liveCarveMessage({ origin: "http://elsewhere", data: { type: "behold:dots-state", live: true } }, O)).toBe(false);
|
|
15
|
+
expect(liveCarveMessage({ origin: O, data: { type: "behold:shot" } }, O)).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
it("does nothing without Watch's elements", () => {
|
|
18
|
+
expect(() => startKioskCarve({ frame: () => null, watch: null, eh: null, origin: O }).tellMode()).not.toThrow();
|
|
19
|
+
});
|
|
20
|
+
it("says live over a live carve and recorded over a replay", () => {
|
|
21
|
+
const live = { src: "terralith", recording: { kind: "live", resources: 79, migration: "carve", from: "s3://reports" } };
|
|
22
|
+
expect(badgeText(live)).toBe("live");
|
|
23
|
+
expect(recordedWords(live)).toMatch(/^live carve of terralith, 79 resources, drawn from the estate rosters/);
|
|
24
|
+
expect(badgeText({ src: "x", recording: { kind: "carve" } })).toBe("recorded");
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -28,6 +28,8 @@ export const TIPS_TITLE = "Short notes on what just happened, beside the things
|
|
|
28
28
|
/** The trail's label. */
|
|
29
29
|
export const TRAIL_WORDS = "This cycle";
|
|
30
30
|
|
|
31
|
+
/** The Tips CSS, for a page that draws Tips of its own (web/kiosk-dots.js, #712). */
|
|
32
|
+
export const TIPS_STYLE_ID = "eh-style";
|
|
31
33
|
const STYLE = `
|
|
32
34
|
#eh-trail { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.35em; overflow-x: auto; scrollbar-width: none; contain: inline-size; min-width: 0; padding: 0.15em 0.9em 0.3em; font-size: 0.78em; color: var(--muted); min-height: 1.9em; }
|
|
33
35
|
#eh-trail::-webkit-scrollbar { display: none; }
|
|
@@ -76,6 +78,10 @@ body.k-watch #eh-trail { position: fixed; z-index: 7; left: 5px; right: 5px; pad
|
|
|
76
78
|
* clear of every label wins; with none clear, the one covering least. `arrow` is where the tip's notch sits along it, under
|
|
77
79
|
* the anchor's middle as far as the tip reaches.
|
|
78
80
|
*/
|
|
81
|
+
export function tipsStyle() {
|
|
82
|
+
return STYLE;
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
export function tipSpot(rect, size, win, labels = []) {
|
|
80
86
|
const W = win.w || 1600;
|
|
81
87
|
const w = size.w || 200;
|
package/web/kiosk.html
CHANGED
|
@@ -247,7 +247,8 @@
|
|
|
247
247
|
.k-credits { margin: 0; color: var(--muted); font-size: 0.78em; line-height: 1.35; }
|
|
248
248
|
/* behold#571: the hold panel, lit in the waiting tone its job row and its wave box carry. */
|
|
249
249
|
.k-right { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0.3em; min-width: 0; min-height: 0; contain: size; }
|
|
250
|
-
|
|
250
|
+
/* behold#571: the cycle line sits under the header's controls (#688 made them full size), not beneath them. */
|
|
251
|
+
.k-right > .k-cycle { margin: 0; padding: 2.6em 0.3em 0; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
251
252
|
.k-box-hold { padding: 0.5em 0.9em 0.6em; }
|
|
252
253
|
.k-hold { background: var(--surface-box); border-radius: 8px; }
|
|
253
254
|
.k-hold-head { margin: 0 0 0.3em; font: 700 0.95em var(--font-mono); color: var(--fg); }
|
package/web/kiosk.js
CHANGED
|
@@ -25,6 +25,7 @@ import { getThemeName, mountThemePicker, onThemeChange } from "./theme.js";
|
|
|
25
25
|
import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLightBg, rootSegments, rootText } from "./kiosk-roots.js";
|
|
26
26
|
import { creditLines, filterIndex, keepRun, liveEstimate, liveFor, namesOther, notRunRepo, notRunWords, replayAt, replayBanner, replayIndex, rootNoun, rootWord, runAsOf, scrubDemo, servesRepo, vendorOf } from "./kiosk-vendor.js";
|
|
27
27
|
import { repoParam, repoUrl, stepCheckout } from "./kiosk-repo.js";
|
|
28
|
+
import { startKioskCarve } from "./kiosk-carve.js";
|
|
28
29
|
import { STATE_WORDS, changingRoots, costLine, pinsCommit, planFitsPin, pullPin, readEdges, rootsCount, totalsLine, waveRows, blastRows } from "./terragucci-change.js";
|
|
29
30
|
|
|
30
31
|
/** The scenarios terragucci#1014 numbers. An id not here is shown by the title demo.json carries. */
|
|
@@ -805,6 +806,9 @@ function drawBar(bar, s, now) {
|
|
|
805
806
|
const r = more[i];
|
|
806
807
|
left.appendChild(r ? leadRow(name, "k-row-more", r.label, elRoots("p", "k-about", r.text, s)) : leadRow(name, "k-row-more"));
|
|
807
808
|
}
|
|
809
|
+
// The live carve's slowed playback, a quiet row of its own once the frame draws one: real time unless a person slows it.
|
|
810
|
+
const slowed = s.slowedControl ? s.slowedControl() : null;
|
|
811
|
+
if (slowed) left.appendChild(leadRow("slowed", "k-row-more", "Playback", slowed));
|
|
808
812
|
|
|
809
813
|
// The pull request's facts, each a chip that wraps whole; never cut off. behold#571: no line on where the narration was read from.
|
|
810
814
|
const factParts = s.noReports ? [] : factLines(demo, s.answer, nounTool(s));
|
|
@@ -992,7 +996,7 @@ function drawDrawer(host, tail, nums, open) {
|
|
|
992
996
|
export const DRAWER_EMPTY = "The job's lines show here as it writes them.";
|
|
993
997
|
/** behold#571: the drawer's two states, said on its head. */
|
|
994
998
|
export const DRAWER_MORE = "Open the log";
|
|
995
|
-
export const DRAWER_LESS = "
|
|
999
|
+
export const DRAWER_LESS = "Close";
|
|
996
1000
|
|
|
997
1001
|
/** The result card at the end of the run: the result line, the counts, and each wave's numbers. */
|
|
998
1002
|
function drawResult(host, model, s) {
|
|
@@ -1197,6 +1201,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1197
1201
|
s.shot = null;
|
|
1198
1202
|
// behold#571: event-help, started further down once what it reads is in place.
|
|
1199
1203
|
let ehApi = null;
|
|
1204
|
+
// #715: the live carve's caption and Tips, when the frame draws one (web/kiosk-carve.js).
|
|
1205
|
+
let carveCtl = null;
|
|
1200
1206
|
// behold#571: the run view as the cycle has seen it (steadyRun), and when a read behind the step last asked again.
|
|
1201
1207
|
let runMemo = null;
|
|
1202
1208
|
let freshAt = 0;
|
|
@@ -1470,6 +1476,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1470
1476
|
if (!s.watchMode && runsParent && main.parentNode !== runsParent) runsParent.insertBefore(main, runsNext);
|
|
1471
1477
|
}
|
|
1472
1478
|
if (watch) renderModeToggle(tools && tools.mode, s.watchMode ? "watch" : "inspect", setMode);
|
|
1479
|
+
if (carveCtl) carveCtl.tellMode();
|
|
1473
1480
|
};
|
|
1474
1481
|
const setMode = (m) => {
|
|
1475
1482
|
const next = m === "watch";
|
|
@@ -1516,6 +1523,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1516
1523
|
}
|
|
1517
1524
|
s.watchHeld = { secs: Math.ceil(left / 1000) };
|
|
1518
1525
|
}
|
|
1526
|
+
/** The caption shown now: Watch's own, or the live carve's while it has the camera (#715). */
|
|
1527
|
+
const shownCaption = () => (carveCtl && carveCtl.caption ? carveCtl.caption() || watch.caption : watch.caption);
|
|
1519
1528
|
/** behold#571: the caption's top, or event-help's trail's when it sits over the caption. */
|
|
1520
1529
|
const captionTop = (cap) => {
|
|
1521
1530
|
const trail = eh && eh.trailHost;
|
|
@@ -1526,7 +1535,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1526
1535
|
const shotInsets = (shot) => {
|
|
1527
1536
|
if (!watch || !frame || isPhone() || !frame.getBoundingClientRect) return {};
|
|
1528
1537
|
const f = frame.getBoundingClientRect();
|
|
1529
|
-
const cap =
|
|
1538
|
+
const cap = shownCaption().getBoundingClientRect();
|
|
1530
1539
|
const bottom = Math.max(0, f.bottom - captionTop(cap)) + 16;
|
|
1531
1540
|
const side = shot.kind === "held" ? watch.callout : shot.kind === "active" ? watch.drawer : shot.kind === "result" ? watch.result : null;
|
|
1532
1541
|
// The result card sits right beside the graph (placeBeside's gap): an inset of its width and that gap centres the two together.
|
|
@@ -1634,7 +1643,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1634
1643
|
}
|
|
1635
1644
|
const L = watch.layer.getBoundingClientRect();
|
|
1636
1645
|
const F = frame.getBoundingClientRect();
|
|
1637
|
-
const capTop = captionTop(
|
|
1646
|
+
const capTop = captionTop(shownCaption().getBoundingClientRect()) - L.top;
|
|
1638
1647
|
const view = { x: F.left - L.left, y: F.top - L.top, w: F.width, h: capTop - (F.top - L.top) };
|
|
1639
1648
|
const boxOf = (n) => {
|
|
1640
1649
|
const waves = (s.boxes && s.boxes.waves) || {};
|
|
@@ -1647,10 +1656,12 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1647
1656
|
return { x: x + view.x, y: y + view.y, w: Math.max(...ok.map((b) => b.x + b.w)) - x, h: Math.max(...ok.map((b) => b.y + b.h)) - y };
|
|
1648
1657
|
};
|
|
1649
1658
|
const taken = [];
|
|
1659
|
+
// While the live carve has the camera, the graph shows dots, not the wave boxes: the panes sit at the view's top right.
|
|
1660
|
+
const carvingNow = shownCaption() !== watch.caption;
|
|
1650
1661
|
const put = (node, n) => {
|
|
1651
1662
|
if (node.hidden) return;
|
|
1652
1663
|
const size = { w: node.offsetWidth, h: node.offsetHeight };
|
|
1653
|
-
const box = boxOf(n);
|
|
1664
|
+
const box = carvingNow ? null : boxOf(n);
|
|
1654
1665
|
// Before the frame says where the box is: the right of the view, under its top.
|
|
1655
1666
|
const labels = ((s.boxes && s.boxes.labels) || []).map((r) => ({ x: r.x + view.x, y: r.y + view.y, w: r.w, h: r.h }));
|
|
1656
1667
|
const p = box ? placeBeside(box, size, view, 18, labels) : { x: view.x + view.w - size.w - 20, y: view.y + 20, side: "below" };
|
|
@@ -1668,7 +1679,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1668
1679
|
put(watch.result, null); // beside the whole graph
|
|
1669
1680
|
const hits = (r) => taken.some((t) => r.x < t.x2 && r.x2 > t.x && r.y < t.y2 && r.y2 > t.y);
|
|
1670
1681
|
for (const b of watch.badges.children) {
|
|
1671
|
-
const box = boxOf(Number(b.dataset.kWave));
|
|
1682
|
+
const box = carvingNow ? null : boxOf(Number(b.dataset.kWave));
|
|
1672
1683
|
b.classList.remove("k-placed");
|
|
1673
1684
|
if (!box) continue;
|
|
1674
1685
|
const w = b.offsetWidth;
|
|
@@ -1770,7 +1781,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1770
1781
|
boxes: s.boxes,
|
|
1771
1782
|
frame,
|
|
1772
1783
|
watch: s.watchMode,
|
|
1773
|
-
caption:
|
|
1784
|
+
// The caption shown now: the live carve's while it has the camera (web/kiosk-carve.js).
|
|
1785
|
+
caption: watch ? shownCaption() : null,
|
|
1774
1786
|
replay: s.mode === "replay",
|
|
1775
1787
|
approveLine: appr ? appr.approve : null,
|
|
1776
1788
|
label: d.label || "",
|
|
@@ -2108,6 +2120,9 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2108
2120
|
// A frame that never says it drew still swaps in, late, rather than never.
|
|
2109
2121
|
bufferTimer = setTimeout(swapFrame, FRAME_SWAP_MS);
|
|
2110
2122
|
};
|
|
2123
|
+
// #715: a frame drawing a live carve tells the kiosk what to say; one that does not says nothing, and nothing here changes.
|
|
2124
|
+
if (typeof window !== "undefined" && window.addEventListener && watch) carveCtl = startKioskCarve({ frame: () => frame, watch, eh, origin, isWatch: () => s.watchMode });
|
|
2125
|
+
s.slowedControl = () => (carveCtl ? carveCtl.slowedControl() : null);
|
|
2111
2126
|
if (typeof window !== "undefined" && window.addEventListener) {
|
|
2112
2127
|
window.addEventListener("message", (e) => {
|
|
2113
2128
|
if (e.origin !== origin || !e.data || e.data.type !== "behold:drawn") return;
|
package/web/operator.js
CHANGED
|
@@ -475,7 +475,7 @@ export function renderConvergeGateCard(gate, actions = {}) {
|
|
|
475
475
|
box.appendChild(el("div", "run-gate-meta", NO_APPROVE[actions.why] || NO_APPROVE.host));
|
|
476
476
|
return box;
|
|
477
477
|
}
|
|
478
|
-
// Standalone, chant records
|
|
478
|
+
// Standalone, chant records the approver /api/project names (#690). Said before the click.
|
|
479
479
|
const approve = el("button", "approve", actions.approver ? `Record approval as ${actions.approver}` : "Record approval");
|
|
480
480
|
approve.title =
|
|
481
481
|
`${(gate.approve && gate.approve.method) || "POST"} ${(gate.approve && gate.approve.path) || ""} — ` +
|