Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

Notices never cover the camera or the model: they fold into one 'N notes' pill in the status strip that opens a list #310

Closed opened this
Closed without merging

smith/arm:smith/277-notices-never-cover-the-camera-or-the-mo → main 4 commits fork 6 threads · 6 unresolved

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
10 files changed +198 −24
Software/README.md +2
@@ -723,6 +723,8 @@ table is moved the drawing moves with it. On a stream, a joint that pushes hard
723723 is parked where it is and follows again once the leader backs off. Jams,
724724 blocks, stalls, peak loads and temperatures go to `metrics.jsonl`.
725725
726 On the page, nothing sits over the camera or the model: the room's announcement and a `warn`-zone warning fold into one "N notes" pill in the status strip, and a tap opens a list where each note can be dismissed (a dismissed warning stays gone until its text changes or it clears, so a `warn` boundary warning can be dismissed away; it comes back when the warning clears and returns, and an `enforce` hold is never a note, so it cannot be dismissed). What halts motion, a hold at the `enforce` boundary, a jam or a lost link, shows at once as one line lying over the driver's row in the strip, so nothing moves, and the E-stop keeps its banner.
727
726728 **Safety limits.** The arm server enforces these on every command, whoever
727729 sends it and whatever the page does (`src/safety.ts`). The defaults are
728730 conservative. The owner changes them in the settings panel, or with
Software/so101/src/stop-layout.test.ts +31 −1
@@ -1,5 +1,5 @@
11 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2 import { mkdtempSync } from "node:fs";
2 import { mkdtempSync, readFileSync } from "node:fs";
33 import { tmpdir } from "node:os";
44 import { join } from "node:path";
55 import { FeetechBus } from "./bus.ts";
@@ -110,3 +110,33 @@ describe("the served page's STOP", () => {
110110 if (click) expect(click).toMatch(/e\.detail\s*===\s*0/);
111111 });
112112 });
113
114 describe("notices on the served page", () => {
115 const css = () => flatRules([...html.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((m) => m[1]!).join("\n"));
116 const notesJs = readFileSync(new URL("./ui/notes.js", import.meta.url), "utf8");
117 const notesCss = flatRules(readFileSync(new URL("./ui/notes.css", import.meta.url), "utf8"));
118 const body = (sel: string) => [...css(), ...notesCss].filter((r) => r.selector.split(",").some((s) => s.trim() === sel)).map((r) => r.body).join(";");
119
120 test("with two notices the camera box is the same size as with none: the pill is in the strip, the list floats, nothing is in the view", () => {
121 const markup = html.replace(/<!--[\s\S]*?-->/g, "").replace(/<(script|style)\b[\s\S]*?<\/\1>/gi, "");
122 const app = markup.slice(markup.indexOf('<div id="app"'), markup.indexOf('<section id="strip"'));
123 expect(app).not.toMatch(/id="notes(Pill|List)"|id="notice"|id="holdLine"/);
124 const strip = markup.slice(markup.indexOf('<section id="strip"'), markup.indexOf("</section>", markup.indexOf('<section id="strip"')));
125 expect(strip).not.toContain("notesPill"); // the module puts the pill after #turnActions, inside the strip, and the list on the body
126 expect(notesJs).toMatch(/\$\("turnActions"\)\.after\(pill\)/);
127 expect(markup).not.toContain('id="notice"');
128 // the list takes no room in any row of the grid; the pill is shorter than the strip's own minimum height
129 expect(body("#notesList")).toMatch(/position:\s*fixed/);
130 expect(Number(/min-height:\s*(\d+)px/.exec(body("#notesPill"))?.[1])).toBeGreaterThanOrEqual(44);
131 expect(Number(/min-height:\s*(\d+)px/.exec(body("#notesPill"))?.[1])).toBeLessThan(Number(/min-height:\s*(\d+)px/.exec(body("#strip"))?.[1]));
132 // the pill is styled by the page itself, so it never shows unstyled while a stylesheet loads; a hold lies over the driver's row and adds none
133 expect(css().some((r) => r.selector.split(",").some((x) => x.trim() === "#notesPill"))).toBe(true);
134 expect(notesCss.some((r) => r.selector.includes("notesPill"))).toBe(false);
135 expect(body("#holdLine")).toMatch(/position:\s*absolute/);
136 expect(body("#strip .who")).toMatch(/position:\s*relative/);
137 expect(css().map((r) => r.selector).join("\n")).toMatch(/#holdLine:not\(:empty\)\) #driverLine/);
138 expect(css().filter((r) => /#holdLine:not\(:empty\)\) #driverLine/.test(r.selector)).map((r) => r.body).join(";")).toMatch(/visibility:\s*hidden/);
139 // the old over-the-video boxes only show for a stop
140 expect(body("#banner")).toMatch(/display:\s*none/);
141 });
142 });
Software/so101/src/ui/lobby-panel.js +2 −3
@@ -29,7 +29,7 @@ export const backoff = (attempt) => Math.min(250 * 2 ** Math.max(0, attempt - 1)
2929 const tell = (what) => /** @type {any} */ (globalThis).dispatchEvent?.(new Event(what));
3030
3131 /**
32 * @param {any} page what the page owns: $, el, relayed, tab(), showTab, msg, applyLock, applyStatus, noStatus, words, admin
32 * @param {any} page what the page owns: $, el, relayed, tab(), showTab, msg, applyLock, applyStatus, noStatus, words, admin, note
3333 */
3434 export function createRoom(page) {
3535 const { $, el, relayed, msg } = page;
@@ -111,8 +111,7 @@ export function createRoom(page) {
111111 $("driverTag").textContent = d ? `🎮 ${d.name}${driving ? " (you)" : ""}` : "";
112112 $("strip").classList.toggle("ready", Boolean(driving && d.readyBy));
113113 alertNext(Boolean(mine && mine.place === 1 && !st.paused));
114 $("notice").hidden = !st.announcement;
115 $("notice").textContent = st.announcement ?? "";
114 page.note("notice", st.announcement);
116115 $("capLine").textContent = st.maxSpeedPercent < 100 ? `Speed limited to ${st.maxSpeedPercent}% of full` : "";
117116 $("turnActions").replaceChildren(...turnButtons());
118117 $("quiet").checked = quiet();
Software/so101/src/ui/lobby-panel.test.ts +3 −3
@@ -49,7 +49,7 @@ describe("the room over /live", () => {
4949 const page = {
5050 $: (id: string) => nodes.get(id) ?? (nodes.set(id, node()), nodes.get(id)),
5151 el: (tag: string, props: object = {}) => Object.assign(node(), { tag }, props),
52 relayed: true, tab: () => "chat", showTab() {}, applyLock() {}, applyStatus() {}, noStatus() {}, words() {}, admin() {},
52 relayed: true, tab: () => "chat", showTab() {}, applyLock() {}, applyStatus() {}, noStatus() {}, words() {}, admin() {}, note() {},
5353 msg: (text: string, bad?: boolean) => void shown.push([text, bad]),
5454 };
5555 const room = createRoom(page);
@@ -79,7 +79,7 @@ describe("the room over /live", () => {
7979 const page = {
8080 $: (id: string) => nodes.get(id) ?? (nodes.set(id, Object.assign(node(), { classList: classList() })), nodes.get(id)),
8181 el: (tag: string, props: object = {}) => Object.assign(node(), { tag }, props),
82 relayed: true, tab: () => "chat", showTab() {}, applyLock: () => calls.push("lock"), applyStatus() {}, noStatus: () => calls.push("noStatus"), words() {}, admin() {},
82 relayed: true, tab: () => "chat", showTab() {}, applyLock: () => calls.push("lock"), applyStatus() {}, noStatus: () => calls.push("noStatus"), words() {}, admin() {}, note() {},
8383 msg() {},
8484 };
8585 const room = createRoom(page);
@@ -127,7 +127,7 @@ describe("a deliberate reopen", () => {
127127 const page = {
128128 $: (id: string) => nodes.get(id) ?? (nodes.set(id, n()), nodes.get(id)),
129129 el: (tag: string, props: object = {}) => Object.assign(n(), { tag }, props),
130 relayed: true, tab: () => "chat", showTab() {}, applyLock() {}, applyStatus() {}, noStatus: () => calls.push("noStatus"), words() {}, admin() {}, msg() {},
130 relayed: true, tab: () => "chat", showTab() {}, applyLock() {}, applyStatus() {}, noStatus: () => calls.push("noStatus"), words() {}, admin() {}, note() {}, msg() {},
131131 };
132132 const room = createRoom(page);
133133 room.lobbyConnect();
Software/so101/src/ui/notes.css added +2
@@ -0,0 +1,2 @@
1 #notesList { position: fixed; z-index: 9; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); max-height: 40vh; overflow: auto; margin: 0 auto; max-width: 480px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
2 .note { display: flex; gap: 8px; padding: 8px; border-left: 3px solid var(--blue); font-size: 14px; overflow-wrap: anywhere; } .note span { flex: 1; } .note button { flex: none; min-height: 44px; min-width: 44px; }
Software/so101/src/ui/notes.js added +54
@@ -0,0 +1,54 @@
1 // @ts-check
2 /**
3 * The page's notices (the room's #notice, the boundary warnings) as one count and one list, so none of them takes
4 * room over the camera or the model: the status strip shows "2 notes", a tap opens the list, each can be dismissed.
5 * A dismissed note stays gone until its text changes or it clears and comes back. Text only; the page uses textContent.
6 */
7
8 const MAX = 240;
9
10 export function createNotes() {
11 /** @type {Map<string, string>} */ const items = new Map();
12 /** @type {Map<string, string>} */ const dismissed = new Map();
13 return {
14 /** Set a note by key; an empty or missing text clears it (and forgets a dismissal, so it can come back). */
15 set(/** @type {string} */ key, /** @type {unknown} */ text) {
16 // eslint-disable-next-line no-control-regex
17 const t = typeof text === "string" ? text.replace(/[\u0000-\u001f\u007f]+/g, " ").trim().slice(0, MAX) : "";
18 if (t) items.set(key, t); else { items.delete(key); dismissed.delete(key); }
19 },
20 /** @returns {Array<{ key: string, text: string }>} the notes not dismissed, in the order they were first set */
21 list() { return [...items].filter(([k, t]) => dismissed.get(k) !== t).map(([key, text]) => ({ key, text })); },
22 dismiss(/** @type {string} */ key) { const t = items.get(key); if (t !== undefined) dismissed.set(key, t); },
23 };
outdated

dismissAll is never called and has no test. Delete it.

24 }
25
26 /**
27 * Mount the pill and the list on the page; returns set(key, text). Loaded on the first note, so a quiet page never pays for it.
28 * @param {(id: string) => HTMLElement} $ @param {(tag: string, props?: object, ...kids: any[]) => HTMLElement} el
29 */
30 export function mountNotes($, el) {
31 document.head.append(el("link", { rel: "stylesheet", href: import.meta.url.replace(/\.js$/, ".css") }));
32 const notes = createNotes();
33 const pill = el("button", { id: "notesPill", type: "button", hidden: true }), box = el("div", { id: "notesList", hidden: true });
34 pill.setAttribute("aria-controls", "notesList"); pill.setAttribute("aria-expanded", "false");
35 $("turnActions").after(pill); document.body.append(box);

The stylesheet is added here, after the pill is mounted. Unstyled-then-styled is a layout shift inside the strip. Put the #notesPill rule in viewer.html's CSS, or reveal the pill on the link's load.

36 function render() {
37 const list = notes.list();
38 pill.hidden = !list.length; pill.textContent = pillText(list.length);
39 if (!list.length) { box.hidden = true; pill.setAttribute("aria-expanded", "false"); }
40 if (box.hidden) return;
41 box.replaceChildren(...list.map((n) => {
42 const b = el("button", { type: "button", textContent: "Dismiss", onclick: () => { notes.dismiss(n.key); render(); } });
43 b.setAttribute("aria-label", `Dismiss: ${n.text}`);
44 return el("div", { className: "note" }, el("span", { textContent: n.text }), b);
45 }));
46 }
47 const toggle = (/** @type {boolean} */ open) => { box.hidden = !open; pill.setAttribute("aria-expanded", String(open)); render(); };

mountNotes (pill hidden when empty, aria-expanded, Escape focus return, Dismiss) has no test. Only createNotes is tested; add a small fake-DOM test.

48 pill.addEventListener("click", () => toggle(box.hidden));
49 addEventListener("keydown", (e) => { if (e.key === "Escape" && !box.hidden) { toggle(false); pill.focus(); } });
50 return { set(/** @type {string} */ key, /** @type {unknown} */ text) { notes.set(key, text); render(); } };
51 }
52
53 /** @param {number} n @returns {string} the pill's words */
54 export const pillText = (n) => `${n} note${n === 1 ? "" : "s"}`;
Software/so101/src/ui/notes.test.ts added +29
@@ -0,0 +1,29 @@
1 import { describe, expect, test } from "bun:test";
2 import { createNotes, pillText } from "./notes.js";
3
4 describe("notes", () => {
5 test("two notices count to one pill", () => {
6 const n = createNotes();
7 n.set("notice", "Back at 5"); n.set("zone", "the arm is near the table");
8 expect(n.list().length).toBe(2);
9 expect(pillText(2)).toBe("2 notes");
10 expect(pillText(1)).toBe("1 note");
11 });
12 test("dismissed stays gone until the text changes or it clears", () => {
13 const n = createNotes();
14 n.set("zone", "a"); n.dismiss("zone"); n.set("zone", "a");
15 expect(n.list()).toEqual([]);
16 n.set("zone", "b");
17 expect(n.list().map((x) => x.text)).toEqual(["b"]);
18 n.dismiss("zone"); n.set("zone", null); n.set("zone", "b");
19 expect(n.list().length).toBe(1);
20 });
21 test("text is bounded and clean; non-strings clear", () => {
22 const n = createNotes();
23 n.set("a", "x\ny" + "z".repeat(500));
24 expect(n.list()[0]!.text.length).toBe(240);
25 expect(n.list()[0]!.text).not.toContain("\n");
26 n.set("a", 5);
27 expect(n.list()).toEqual([]);
28 });
29 });
Software/so101/src/ui/zone-notes.js added +19
@@ -0,0 +1,19 @@
1 /** Boundary and link trouble: what halts motion is a hold (the strip, at once); a warning is a note (the pill). */
2 export function zoneLines(d, say, names, time) {
3 const hold = (hold) => ({ hold, note: "" });
4 if (d.reconnecting) return hold(`Reconnecting to the arm… showing where it was at ${time(d.seenAt)}. Driving is paused, and the arm holds where it is.`);
5 if (typeof d.source === "string" && d.source.startsWith("simulated: offline")) return hold("The arm has been unreachable for over a minute. This is the SIMULATION, not the real arm.");
6 if (d.jammed?.length) return hold(`jam: ${d.jammed.map((id) => names[id] ?? id).join(", ")} pushed against something and stopped — back the leader off`);
7 if (d.blocked && d.zone === "enforce") return hold(`held at the boundary: ${say(d.blocked)}`);
8 return { hold: "", note: d.blocked ? `warning: ${say(d.blocked)}` : d.violation ? `the arm is ${say(d.violation)} (zone: ${d.zone})` : "" };
9 }
10
11 /** note(key, text): loads the pill on the first text; a failed load is not cached and the text goes to `fallback`. */
12 export function noteSink(load, fallback) {
13 let mod = null;
14 return (key, text = "") => {
15 if (!mod) { if (!text) return; mod = load(); }
16 const m = mod;
17 m.then((n) => n.set(key, text), () => { if (mod === m) mod = null; if (text) fallback(text); });
18 };
19 }
Software/so101/src/ui/zone-notes.test.ts added +40
@@ -0,0 +1,40 @@
1 import { describe, expect, test } from "bun:test";
2 import { noteSink, zoneLines } from "./zone-notes.js";
3
4 const say = (v: string) => `<${v}>`, names = { 2: "shoulder_lift" }, time = () => "12:00";
5
6 describe("zoneLines routes a status to the strip or to a note", () => {
7 test("a reconnect, an unreachable arm, a jam and an enforce hold go to the strip", () => {
8 expect(zoneLines({ reconnecting: true, seenAt: 1 }, say, names, time).hold).toContain("Reconnecting to the arm… showing where it was at 12:00");
9 expect(zoneLines({ source: "simulated: offline" }, say, names, time).hold).toContain("SIMULATION");
10 expect(zoneLines({ jammed: [2] }, say, names, time)).toEqual({ hold: expect.stringContaining("jam: shoulder_lift"), note: "" });
11 expect(zoneLines({ blocked: "table", zone: "enforce" }, say, names, time)).toEqual({ hold: "held at the boundary: <table>", note: "" });
12 });
13 test("a warn-only zone is a note, never a hold", () => {
14 expect(zoneLines({ blocked: "table", zone: "warn" }, say, names, time)).toEqual({ hold: "", note: "warning: <table>" });
15 expect(zoneLines({ violation: "low", zone: "warn" }, say, names, time)).toEqual({ hold: "", note: "the arm is <low> (zone: warn)" });
16 expect(zoneLines({ zone: "warn" }, say, names, time)).toEqual({ hold: "", note: "" });
17 });
18 });
19
20 describe("noteSink", () => {
21 const tick = () => new Promise((r) => setTimeout(r, 0));
22 test("mounts on the first text only, then reuses the mount", async () => {
23 let loads = 0; const seen: unknown[][] = [];
24 const note = noteSink(async () => { loads++; return { set: (k: string, t: unknown) => void seen.push([k, t]) }; }, () => {});
25 note("zone", ""); await tick();
26 expect(loads).toBe(0);
27 note("zone", "a"); note("notice", "b"); await tick();
28 expect(loads).toBe(1);
29 expect(seen).toEqual([["zone", "a"], ["notice", "b"]]);
30 });
31 test("a failed load is not cached: the text is shown by the fallback and the next note loads again", async () => {
32 let loads = 0; const shown: string[] = [], seen: unknown[][] = [];
33 const note = noteSink(async () => { if (++loads === 1) throw new Error("offline"); return { set: (k: string, t: unknown) => void seen.push([k, t]) }; }, (t) => shown.push(t));
34 note("zone", "held"); await tick();
35 expect(shown).toEqual(["held"]);
36 note("zone", "again"); await tick();
37 expect(loads).toBe(2);
38 expect(seen).toEqual([["zone", "again"]]);
39 });
40 });
Software/so101/src/viewer.html +16 −17
@@ -79,17 +79,16 @@
7979 #link { color: #9aa4ae; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(36ch, 46vw); } #link.on { color: #3fb950; } #link.warn { color: #d29922; } #link.bad { color: #f85149; font-weight: 700; }
8080 .dot { width: 8px; height: 8px; border-radius: 50%; background: #f85149; display: inline-block; flex: none; } .dot.on { background: #3fb950; } .dot.warn { background: #d29922; }
8181 #banner { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); z-index: 5; width: max-content; max-width: min(640px, calc(100% - 16px)); padding: 8px 12px; border-radius: 8px; font-size: 13px; background: rgba(0,0,0,.8); border: 1px solid #30363d; display: none; }
82 #banner.bad { display: block; border-color: #f85149; color: #ffb3ad; } #banner.warn { display: block; border-color: #d29922; color: #f2cc60; }
8382 #msg { position: absolute; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: 8px; z-index: 6; margin: 0 auto; width: max-content; max-width: calc(100% - 16px); padding: 8px 12px; border-radius: 8px; font-size: 13px; background: rgba(13,17,23,.9); color: #e8eaed; border: 1px solid #30363d; }
8483 #refusal { position: absolute; left: 8px; right: 8px; bottom: 52px; z-index: 6; margin: 0 auto; width: max-content; max-width: calc(100% - 16px); padding: 6px 12px; border-radius: 8px; font-size: 13px; background: rgba(13,17,23,.9); border: 1px solid #f85149; color: #ffb3ad; } #refusal:empty { display: none; }
8584 #msg:empty { display: none; } #msg.bad { border-color: #f85149; color: #ffb3ad; }
8685
8786 /* the status strip: who drives, your place, time left, the turn's action and the E-stop */
8887 #strip { grid-area: strip; display: flex; align-items: center; gap: 10px; padding: 8px calc(12px + var(--safe-r)) 8px calc(12px + var(--safe-l)); background: var(--surface); border-bottom: 1px solid var(--line); min-height: 64px; }
89 #strip .who { flex: 1; min-width: 0; }
88 #strip .who { flex: 1; min-width: 0; position: relative; }
9089 #driverLine { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #driverLine.none { color: var(--dim); font-weight: 500; }
9190 #clock { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #clock.idle { color: var(--warn); }
92 #capLine { color: var(--dim); font-size: 12px; } #capLine:empty { display: none; }
91 #capLine { color: var(--dim); font-size: 12px; } #capLine:empty, #holdLine:empty { display: none; }
9392 #armLine { display: none; gap: 6px; align-items: center; color: var(--dim); font-size: 12px; white-space: nowrap; } #armText { min-width: 0; overflow: hidden; text-overflow: ellipsis; } /* shown on a phone held upright (ui/mobile.css) */
9493 #reconnect { align-self: flex-start; padding: 0 8px; border-radius: 9px; font-size: 11px; line-height: 16px; background: var(--warn); color: #000; visibility: hidden; } #reconnect.on { visibility: visible; }
9594 #driverLine.paused { color: var(--warn); }
@@ -130,7 +129,9 @@
130129 #tabs .badge { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--blue); color: var(--on-blue); font-size: 11px; line-height: 18px; }
131130 #tabs .badge:empty { display: none; }
132131
133 #notice { flex: none; padding: 10px calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l)); border-bottom: 1px solid var(--line); border-left: 3px solid var(--blue); background: var(--blue-soft); font-size: 14px; overflow-wrap: anywhere; }
132 #holdLine { position: absolute; top: 0; left: 0; right: 0; color: var(--bad); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
outdated

#holdLine takes a new row in the strip when a hold appears, and the camera shrinks. Reuse an existing row (capLine/driverLine) or reserve the line.

133 .who:has(#holdLine:not(:empty)) #driverLine { visibility: hidden; }

A single nowrap/ellipsis line is the only place a jam, reconnect or enforce hold appears, and it is clipped to the width of .who. Allow wrapping (e.g. white-space: normal with a max of 3 lines) and keep the driver name visible.

134 #notesPill { flex: none; min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; background: var(--blue-soft); }
134135
135136 /* chat */
136137 #tab-chat { padding: 0; gap: 0; }
@@ -311,14 +312,13 @@
311312
312313 <section id="strip" aria-label="Who drives" aria-live="polite">
313314 <div id="ring" hidden aria-hidden="true"><span id="ringN"></span></div>
314 <div class="who"><div id="driverLine" class="none">Connecting…</div><span id="reconnect" role="status">reconnecting…</span><div id="clock" aria-live="off"></div><div id="capLine"></div><div id="armLine" aria-live="off"><span class="dot" id="armDot"></span><span id="armText"></span></div></div>
315 <div class="who"><div id="driverLine" class="none">Connecting…</div><span id="reconnect" role="status">reconnecting…</span><div id="clock" aria-live="off"></div><div id="capLine"></div><div id="holdLine"></div><div id="armLine" aria-live="off"><span class="dot" id="armDot"></span><span id="armText"></span></div></div>
315316 <div id="turnActions"></div>
316317 <button id="sheetToggle" hidden aria-controls="sheet" aria-expanded="true">Hide</button>
317318 <button id="stop" class="estop" data-stop title="Stop (space or Esc): halt everything, hold with torque, until someone resumes" aria-label="Stop the arm">Stop</button>
318319 </section>
319320
320321 <section id="sheet" aria-label="Chat, queue and controls">
321 <div id="notice" role="status" hidden></div>
322322 <div class="tab" id="tab-chat" role="tabpanel" aria-labelledby="t-chat">
323323 <div id="chat" role="log" aria-label="Chat"></div>
324324 <button type="button" id="newMsgs" hidden>New messages ↓</button>
@@ -516,6 +516,7 @@
516516 import { cameraPlan, QUALITIES, samePlan } from "/ui/__VERSION__/camera-plan.js";
517517 import { bindSurface, canDrive, Driver, shape, UP } from "/ui/__VERSION__/drive.js";
518518 import { Frames } from "/ui/__VERSION__/frames.js";
519 import { noteSink, zoneLines } from "/ui/__VERSION__/zone-notes.js";
519520 import { createRoom } from "/ui/__VERSION__/lobby-panel.js";
520521
521522 const $ = (id) => document.getElementById(id);
@@ -1510,12 +1511,12 @@
15101511 setInterval(() => { if (!$("metricsPanel").hidden) showMetrics(); }, 5000);
15111512
15121513 // ---------------------------------------------------------------- the room: the turn, the queue and the chat over /live
1513 // Behind the hosted app's relay only the person whose turn it is may drive, and the server refuses everyone else.
1514 // The page follows suit: the Controls tab appears on your turn. Everything here arrives on one socket.
1514 // Behind the relay only the person whose turn it is may drive, and the server refuses the rest; the Controls tab appears on your turn.
15151515 let wordsSent = false;
15161516 $("wordsForm").addEventListener("submit", (e) => { e.preventDefault(); wordsSent = true; say({ type: "words", words: $("wordsForm").elements.words.value.split(",").map((w) => w.trim()).filter(Boolean) }); });
1517 const note = noteSink(() => import("/ui/__VERSION__/notes.js").then((m) => m.mountNotes($, el)), (t) => { $("holdLine").textContent = t; });
15171518 const room = createRoom({
1518 $, el, relayed, msg, tab: () => tab, showTab, applyLock: () => applyLock(), applyStatus: (s) => applyStatus(s), noStatus: () => noStatus(),
1519 $, el, relayed, msg, note, tab: () => tab, showTab, applyLock: () => applyLock(), applyStatus: (s) => applyStatus(s), noStatus: () => noStatus(),
15191520 words(m) { const f = $("wordsForm"); if (document.activeElement !== f.elements.words) f.elements.words.value = m.words.join(", "); if (wordsSent) { wordsSent = false; msg(`Word filter saved: ${m.words.length} word${m.words.length === 1 ? "" : "s"}.`); } },
15201521 admin: (saved) => fillAdmin(saved),
15211522 });
outdated

A rejected import() stays cached in notesMod, so all later notes are lost. Reset notesMod on failure.

@@ -1640,8 +1641,8 @@
16401641 return `${part} is ${(-beyond).toFixed(0)} mm ${v.what === "table" ? "above the table" : "from the base"}, inside the ${marginMm} mm margin`;
16411642 };
16421643 function banner(d) {
1643 const b = $("banner");
1644 const say = sayViolation;
1644 const b = $("banner"), say = sayViolation;
1645 $("holdLine").textContent = "";
16451646 if (d.estop) {
16461647 b.dataset.held = "";
16471648 b.className = "stop";
@@ -1659,12 +1660,10 @@
16591660 if (mayDrive() || isOwner()) b.append(el("button", { id: "resume", textContent: resumeArmed ? "Tap again to resume" : "Resume driving", className: "go", onclick: (e) => resume(e.currentTarget) }));
16601661 return;
16611662 }
1662 if (d.reconnecting) { b.className = "warn"; b.textContent = `Reconnecting to the arm… showing where it was at ${new Date(d.seenAt).toLocaleTimeString()}. Driving is paused, and the arm holds where it is.`; return; }
1663 if (typeof d.source === "string" && d.source.startsWith("simulated: offline")) { b.className = "bad"; b.textContent = "The arm has been unreachable for over a minute. This is the SIMULATION, not the real arm."; return; }
1664 if (d.jammed?.length) { b.className = "bad"; b.textContent = `jam: ${d.jammed.map((id) => NAMES[id] ?? id).join(", ")} pushed against something and stopped — back the leader off`; }
1665 else if (d.blocked) { b.className = d.zone === "enforce" ? "bad" : "warn"; b.textContent = `${d.zone === "enforce" ? "held at the boundary" : "warning"}: ${say(d.blocked)}`; }
1666 else if (d.violation) { b.className = "warn"; b.textContent = `the arm is ${say(d.violation)} (zone: ${d.zone})`; }
1667 else b.className = "";
1663 b.className = "";
1664 const z = zoneLines(d, say, NAMES, (t) => new Date(t).toLocaleTimeString());
1665 $("holdLine").textContent = z.hold;
1666 note("zone", z.note);
16681667 }
16691668 /** The arm's status, from /live (pushed when it changes) or, without it, from polling /status. */
16701669 // Until the limits, the settings and the model are in, a status is kept aside, not drawn; then it is applied whole,

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs