@floless/app 0.168.0 → 0.170.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 (80) hide show
  1. package/cli-actions.mjs +8 -1
  2. package/dist/floless-server.cjs +125533 -99597
  3. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  4. package/dist/schemas/steel.model.v2.schema.json +2 -1
  5. package/dist/skills/floless-app-knowledge/SKILL.md +43 -13
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  7. package/dist/skills/floless-app-rfi/SKILL.md +4 -2
  8. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  9. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  10. package/dist/skills/floless-app-steel-model/SKILL.md +8 -5
  11. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  12. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  13. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  14. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  15. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  16. package/dist/templates/college-phase-exporter.flo +7 -2
  17. package/dist/templates/trimble-list-projects.flo +10 -2
  18. package/dist/web/agent-steps.js +90 -19
  19. package/dist/web/agents.js +77 -31
  20. package/dist/web/app.css +267 -4
  21. package/dist/web/app.js +71 -7
  22. package/dist/web/aware-update-client.js +4 -4
  23. package/dist/web/aware.js +1277 -219
  24. package/dist/web/chat.css +10 -0
  25. package/dist/web/chat.js +407 -117
  26. package/dist/web/checkpoint-standard.js +5 -3
  27. package/dist/web/commands-drawing-check.js +4 -0
  28. package/dist/web/commands-shell.js +551 -15
  29. package/dist/web/commands-steel.js +68 -2
  30. package/dist/web/commands-vector.js +69 -0
  31. package/dist/web/drawing-check-editor.html +10 -0
  32. package/dist/web/drawing-check-editor.js +821 -237
  33. package/dist/web/failure-copy.js +50 -2
  34. package/dist/web/filter-ai-proposal.js +11 -8
  35. package/dist/web/flo-3d.js +310 -0
  36. package/dist/web/flo-card.js +72 -0
  37. package/dist/web/guide.js +33 -24
  38. package/dist/web/index.html +95 -5
  39. package/dist/web/instructor.js +102 -15
  40. package/dist/web/left-pane.js +4 -1
  41. package/dist/web/local-discovery.js +8 -7
  42. package/dist/web/missed-routines.js +239 -0
  43. package/dist/web/model-editor-steel-adapter.js +41 -1
  44. package/dist/web/model-measure.js +6 -0
  45. package/dist/web/model-spatial-panel.js +19 -4
  46. package/dist/web/model-spatial-tools.js +3 -3
  47. package/dist/web/model-viewport-revit-adapter.js +3 -3
  48. package/dist/web/model-viewport-toolbar.js +11 -0
  49. package/dist/web/origin-rule.js +155 -0
  50. package/dist/web/pages.js +17 -14
  51. package/dist/web/panels.js +1 -1
  52. package/dist/web/project-access.js +1 -1
  53. package/dist/web/project-history.js +2 -2
  54. package/dist/web/project-modules.js +5 -5
  55. package/dist/web/project-reconciliation.js +1 -1
  56. package/dist/web/project-rfis.js +8 -3
  57. package/dist/web/project-workflows.js +8 -6
  58. package/dist/web/renderers.js +6 -0
  59. package/dist/web/report-csp.js +68 -0
  60. package/dist/web/revit-editor.js +22 -8
  61. package/dist/web/run-history.js +14 -4
  62. package/dist/web/steel-3d-core.js +39 -9
  63. package/dist/web/steel-3d-flo.js +331 -0
  64. package/dist/web/steel-3d-view.js +164 -0
  65. package/dist/web/steel-ai-marks.js +3 -1
  66. package/dist/web/steel-editor.html +583 -129
  67. package/dist/web/steel-environments.js +297 -0
  68. package/dist/web/steel-filter.html +3 -2
  69. package/dist/web/steel-model-v2-client-validation.js +8 -1
  70. package/dist/web/steel-model-v2-commands.js +23 -9
  71. package/dist/web/steel-model-v2-projection.js +1 -1
  72. package/dist/web/step-rename.js +3 -2
  73. package/dist/web/terminal-requests.js +79 -1
  74. package/dist/web/tool-updates.js +9 -7
  75. package/dist/web/vector-3d.html +1 -1
  76. package/dist/web/vector-editor.html +50 -8
  77. package/dist/web/workspace-root-management.js +1 -1
  78. package/dist/web/workspaces.js +2334 -253
  79. package/launch.mjs +5 -0
  80. package/package.json +11 -8
@@ -41,12 +41,13 @@
41
41
  });
42
42
  } catch (error) {
43
43
  if (error.name === 'AbortError') throw error;
44
- throw new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.');
44
+ throw Object.assign(new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.'), { forPerson: true });
45
45
  }
46
46
  const data = await response.json().catch(() => ({}));
47
47
  if (!response.ok || !data.ok) {
48
- const error = new Error(data.ok === false && typeof data.error === 'string'
49
- ? data.error : 'FloLess could not check those locations. Try the scan again.');
48
+ // #3097: the reply rides on the error, so errorText works the sentence out from it (personText, else the shared
49
+ // sentence) and a reply marked diagnostic never reaches the status line.
50
+ const error = Object.assign(new Error('local discovery request refused'), { status: response.status, body: data });
50
51
  error.code = data.code;
51
52
  error.expiredSelectionIds = Array.isArray(data.expiredSelectionIds) ? data.expiredSelectionIds : null;
52
53
  throw error;
@@ -126,8 +127,8 @@
126
127
  resetResults();
127
128
  status.textContent = 'Scope changed. Scan again to see current findings.';
128
129
  } catch (error) {
129
- status.textContent = error.message
130
- || 'FloLess could not remove this folder from the next scan. It is still listed — try Remove again.';
130
+ status.textContent = errorText(error, { action: 'remove this folder from the next scan',
131
+ unsure: 'It is still listed, so try Remove again.' });
131
132
  }
132
133
  }));
133
134
  row.append(remove);
@@ -431,7 +432,7 @@
431
432
  paintFolders();
432
433
  status.textContent = 'Expired folder choices were removed. Scan again, or add those folders again.';
433
434
  } else if (error.name !== 'AbortError' && generation === scanGeneration) {
434
- status.textContent = error.message || 'FloLess could not check those locations. Try the scan again.';
435
+ status.textContent = errorText(error, { action: 'check those locations', retrySafe: true });
435
436
  }
436
437
  } finally {
437
438
  if (generation === scanGeneration) { scanController = null; setBusy(false); }
@@ -451,7 +452,7 @@
451
452
  resetResults();
452
453
  status.textContent = 'Folder added to the next scan. Up to three selected folders can be included. No scan has started.';
453
454
  }
454
- } catch (error) { status.textContent = error.message || 'FloLess could not choose that folder. Try another local folder.'; }
455
+ } catch (error) { status.textContent = errorText(error, { action: 'choose that folder', unsure: 'Check the folder list, or try another local folder.' }); }
455
456
  }));
456
457
  scanButton.addEventListener('click', scan);
457
458
  filterInput.addEventListener('input', () => { page = 0; paintPage(); });
@@ -0,0 +1,239 @@
1
+ /* Routines that missed their time while FloLess was closed (owner ruling 2026-11-06, plan
2
+ * docs/superpowers/specs/2026-11-06-missed-routine-catch-up-offer-plan.md).
3
+ *
4
+ * The server keeps ONE open question per routine (`missedOffer` on GET /api/routines), however many times it was missed.
5
+ * This is the card that asks it, bottom right, always one card: one routine reads "Run now / Skip"; two or more get a
6
+ * tick box each (none ticked — a run can write to a model or use an AI subscription, so running is always a choice),
7
+ * "Run selected (n)" and "Skip all". Nothing runs on its own. Run goes through the routine's own run route (every gate
8
+ * applies) and names the question it answers, so a second tab cannot answer it twice. × is "Later": the card stays away
9
+ * in this tab until another routine misses its time; Routines says what still waits and reopens it. The card stays out
10
+ * of the way of any open dialog.
11
+ *
12
+ * aware.js hands every routines list it loads to `update()`; this module renders only.
13
+ */
14
+ (() => {
15
+ const state = {
16
+ offers: [], // [{ routineId, offerId, name, first, last, count, atLeast, starting, ai }]
17
+ ticked: new Set(), // offer ids
18
+ later: new Set(), // offer ids the person set aside in this tab
19
+ answered: new Set(), // offer ids answered from this tab (their leaving needs no note)
20
+ busy: false,
21
+ ctx: null, // { api, reportErr, reload }
22
+ };
23
+ let card = null;
24
+
25
+ const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
26
+ const toast = (text, kind) => { if (typeof showToast === 'function') showToast(text, kind); };
27
+ const AI_TIP = 'Runs an AI agent and uses your AI subscription';
28
+ const BUSY_REASON = 'Sending your answer. This works again in a moment.';
29
+ // While an answer is on its way every control waits, and says why.
30
+ const busyAttr = () => (state.busy ? `disabled data-blocked-reason="${BUSY_REASON}"` : '');
31
+
32
+ /** "07:00", plus the day when it was not today — the person's own clock, as the routine's runs say it. */
33
+ function clock(iso) {
34
+ const at = new Date(iso);
35
+ if (Number.isNaN(at.getTime())) return '';
36
+ const hm = `${String(at.getHours()).padStart(2, '0')}:${String(at.getMinutes()).padStart(2, '0')}`;
37
+ if (at.toDateString() === new Date().toDateString()) return hm;
38
+ return `${hm} on ${at.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' })}`;
39
+ }
40
+ const why = (o) => (o.starting ? 'FloLess was still starting up' : 'FloLess was closed');
41
+ const times = (o) => `${o.atLeast ? 'at least ' : ''}${o.count} times`;
42
+ function rowSub(o) {
43
+ // Past the count cap the last time is only where counting stopped, so the row says since when instead.
44
+ if (o.atLeast) return `Missed ${times(o)} since ${clock(o.first)}`;
45
+ return o.count === 1 ? `Missed at ${clock(o.last)}` : `Missed ${times(o)}, last at ${clock(o.last)}`;
46
+ }
47
+
48
+ /** The open questions in a routines list: a schedule routine that would still run (on, not broken, agent not held). */
49
+ function offersOf(routines) {
50
+ return (Array.isArray(routines) ? routines : []).flatMap((r) => {
51
+ const o = r && r.missedOffer;
52
+ if (!o || r.kind === 'trigger' || !r.enabled || r.broken || r.agentHold) return [];
53
+ return [{ routineId: r.id, offerId: o.id, name: r.name || r.id, first: o.first, last: o.last, count: o.count,
54
+ atLeast: o.atLeast === true, starting: o.starting === true, ai: !!r.agent || r.aiStep === true }];
55
+ });
56
+ }
57
+
58
+ function update(routines, ctx) {
59
+ if (ctx) state.ctx = ctx;
60
+ const next = offersOf(routines);
61
+ const nextIds = new Set(next.map((o) => o.offerId));
62
+ // A question that left on its own while the card showed it says so — without claiming it ran: it may have run on
63
+ // its schedule, been switched off, or been answered in another tab.
64
+ if (card && !card.hidden) {
65
+ const gone = state.offers.filter((o) => !nextIds.has(o.offerId) && !state.answered.has(o.offerId)
66
+ && !next.some((n) => n.routineId === o.routineId));
67
+ for (const o of gone) toast(`“${o.name}” is no longer waiting for an answer: it ran on its schedule, was switched off or was answered elsewhere.`, 'info');
68
+ }
69
+ state.offers = next;
70
+ for (const id of [...state.ticked]) if (!nextIds.has(id)) state.ticked.delete(id);
71
+ render();
72
+ paintRoutinesNote();
73
+ }
74
+
75
+ function visibleOffers() { return state.offers.filter((o) => !state.later.has(o.offerId)); }
76
+
77
+ function ensureCard() {
78
+ if (card && card.isConnected) return card;
79
+ const container = document.getElementById('toast-container');
80
+ if (!container) return null;
81
+ card = document.createElement('section');
82
+ card.className = 'toast warn missed-card';
83
+ card.id = 'missed-routines-card';
84
+ card.setAttribute('role', 'region');
85
+ card.setAttribute('aria-label', 'Routines that missed their time');
86
+ card.hidden = true;
87
+ card.addEventListener('click', onClick);
88
+ card.addEventListener('change', onChange);
89
+ container.prepend(card);
90
+ return card;
91
+ }
92
+
93
+ function render() {
94
+ // Shown while at least one question has not been set aside; once shown, it lists every open one.
95
+ const show = visibleOffers().length > 0;
96
+ const offers = state.offers;
97
+ if (!show) { if (card) { card.hidden = true; card.innerHTML = ''; } return; }
98
+ const el = ensureCard();
99
+ if (!el) return;
100
+ // A repaint keeps the person's place: focus goes back to the same control (same command, same routine). When that
101
+ // control is gone — the card changed shape — it goes to Later, never to a different action a keypress would start.
102
+ const focusables = () => [...el.querySelectorAll('button, input, [tabindex="0"]')];
103
+ const keyOf = (node) => `${node.getAttribute('data-command-id') || ''}|${node.getAttribute('data-offer') || ''}`;
104
+ const hadFocus = el.contains(document.activeElement) ? keyOf(document.activeElement) : null;
105
+ el.hidden = false;
106
+ el.classList.toggle('busy', state.busy);
107
+ el.innerHTML = offers.length === 1 ? singleHtml(offers[0]) : manyHtml(offers);
108
+ if (hadFocus !== null) {
109
+ const list = focusables();
110
+ (list.find((node) => keyOf(node) === hadFocus && !node.disabled) || el.querySelector('[data-missed="later"]'))?.focus();
111
+ }
112
+ }
113
+
114
+ const laterButton = () => '<button type="button" class="toast-close missed-later" data-missed="later" data-command-id="shell.missed-routines-later" aria-label="Later" data-tip="Later. Nothing runs; Routines keeps these waiting for your answer.">×</button>';
115
+ const aiPill = (o) => (o.ai ? `<span class="ai-pill" tabindex="0" data-tip="${esc(AI_TIP)}">AI</span>` : '');
116
+
117
+ function singleHtml(o) {
118
+ const what = o.count === 1
119
+ ? `didn’t run at ${esc(clock(o.last))} because ${why(o)}.`
120
+ : o.atLeast
121
+ ? `missed ${esc(times(o))} since ${esc(clock(o.first))}, because ${why(o)}. It runs once.`
122
+ : `missed ${esc(times(o))}, the last at ${esc(clock(o.last))}, because ${why(o)}. It runs once.`;
123
+ return `
124
+ <div class="missed-head"><span class="missed-title">A routine missed its time</span>${laterButton()}</div>
125
+ <p class="missed-text"><strong>${esc(o.name)}</strong>${aiPill(o)} ${what} Run it now?</p>
126
+ ${o.ai ? `<p class="missed-foot">${esc(AI_TIP)}.</p>` : ''}
127
+ <div class="missed-actions">
128
+ <button type="button" class="toast-action missed-primary" data-missed="run-one" data-command-id="shell.missed-routines-run" ${busyAttr()}>Run now</button>
129
+ <button type="button" class="toast-action" data-missed="skip-one" data-command-id="shell.missed-routines-skip" ${busyAttr()}>Skip</button>
130
+ </div>`;
131
+ }
132
+
133
+ function manyHtml(offers) {
134
+ const n = state.ticked.size;
135
+ const all = n === offers.length;
136
+ const anyStarting = offers.some((o) => o.starting);
137
+ const aiTicked = offers.some((o) => o.ai && state.ticked.has(o.offerId));
138
+ const blocked = state.busy ? BUSY_REASON : n === 0 ? 'Tick the routines you want to run first.' : '';
139
+ const rows = offers.map((o) => `
140
+ <label class="missed-row">
141
+ <input type="checkbox" class="missed-pick" data-offer="${esc(o.offerId)}" data-command-id="shell.missed-routines-pick#${esc(o.routineId)}" data-command-instance-label="${esc(o.name)}" ${state.ticked.has(o.offerId) ? 'checked' : ''} ${busyAttr()}>
142
+ <span class="missed-row-main"><span class="missed-row-name">${esc(o.name)}</span>${aiPill(o)}<span class="missed-row-sub">${esc(rowSub(o))}</span></span>
143
+ </label>`).join('');
144
+ return `
145
+ <div class="missed-head"><span class="missed-title">${offers.length} routines missed their time</span>${laterButton()}</div>
146
+ <p class="missed-text">${anyStarting ? 'FloLess was closed or still starting up' : 'FloLess was closed'}, so nothing ran. Choose what to run now; each runs once.</p>
147
+ <div class="missed-select"><button type="button" class="rtn-link" data-missed="select-all" data-command-id="shell.missed-routines-select-all" ${busyAttr()}>${all ? 'Clear all' : 'Select all'}</button></div>
148
+ <div class="missed-list">${rows}</div>
149
+ ${aiTicked ? '<p class="missed-foot">AI routines use your AI subscription.</p>' : ''}
150
+ <div class="missed-actions">
151
+ <button type="button" class="toast-action missed-primary" data-missed="run-selected" data-command-id="shell.missed-routines-run-selected"${n === 0 || state.busy ? ' disabled' : ''}${blocked ? ` data-blocked-reason="${esc(blocked)}" data-tip="${esc(blocked)}"` : ''}>Run selected (${n})</button>
152
+ <button type="button" class="toast-action" data-missed="skip-all" data-command-id="shell.missed-routines-skip-all" ${busyAttr()}>Skip all</button>
153
+ </div>`;
154
+ }
155
+
156
+ function onChange(event) {
157
+ const box = event.target.closest('.missed-pick');
158
+ if (!box) return;
159
+ if (box.checked) state.ticked.add(box.dataset.offer); else state.ticked.delete(box.dataset.offer);
160
+ render();
161
+ }
162
+
163
+ function onClick(event) {
164
+ const button = event.target.closest('[data-missed]');
165
+ if (!button || button.disabled) return;
166
+ const what = button.dataset.missed;
167
+ if (what === 'later') { for (const o of state.offers) state.later.add(o.offerId); render(); paintRoutinesNote(); return; }
168
+ if (what === 'select-all') {
169
+ if (state.ticked.size === state.offers.length) state.ticked.clear();
170
+ else for (const o of state.offers) state.ticked.add(o.offerId);
171
+ render();
172
+ return;
173
+ }
174
+ if (what === 'run-one') void answer('run', [state.offers[0]]);
175
+ else if (what === 'skip-one') void answer('skip', [state.offers[0]]);
176
+ else if (what === 'run-selected') void answer('run', state.offers.filter((o) => state.ticked.has(o.offerId)));
177
+ else if (what === 'skip-all') void answer('skip', state.offers.slice());
178
+ }
179
+
180
+ /** Sends the answer for each question, one by one, then says what happened in one toast per outcome. */
181
+ async function answer(kind, offers) {
182
+ const ctx = state.ctx;
183
+ if (!ctx || !offers.length || state.busy) return;
184
+ state.busy = true;
185
+ render();
186
+ const done = [];
187
+ const alreadyRunning = [];
188
+ const gone = [];
189
+ for (const o of offers) {
190
+ state.answered.add(o.offerId);
191
+ try {
192
+ if (kind === 'run') {
193
+ await ctx.api(`/api/routines/${encodeURIComponent(o.routineId)}/run`, { method: 'POST', body: JSON.stringify({ missedOfferId: o.offerId }) });
194
+ } else {
195
+ await ctx.api(`/api/routines/${encodeURIComponent(o.routineId)}/missed-offer/skip`, { method: 'POST', body: JSON.stringify({ expectedOfferId: o.offerId }) });
196
+ }
197
+ done.push(o.name);
198
+ } catch (error) {
199
+ if (error?.body?.running) alreadyRunning.push(o.name);
200
+ else if (error?.body?.code === 'no-missed-offer') gone.push(o.name);
201
+ else { state.answered.delete(o.offerId); ctx.reportErr(error, kind === 'run' ? `run “${o.name}”` : `skip “${o.name}”`); }
202
+ }
203
+ }
204
+ state.busy = false;
205
+ const names = (list) => list.map((name) => `“${name}”`).join(', ');
206
+ if (done.length) {
207
+ toast(kind === 'run'
208
+ ? `${done.length === 1 ? `Started ${names(done)}` : `Started ${done.length} routines`}. How each run goes shows in Routines.`
209
+ : `${done.length === 1 ? `Skipped ${names(done)}` : `Skipped ${done.length} routines`}. Nothing ran; each runs at its next scheduled time.`, 'ok');
210
+ }
211
+ if (alreadyRunning.length) toast(`${names(alreadyRunning)} ${alreadyRunning.length === 1 ? 'is' : 'are'} already running, so FloLess didn’t start ${alreadyRunning.length === 1 ? 'it' : 'them'} again. ${alreadyRunning.length === 1 ? 'It is' : 'They are'} still waiting for your answer.`, 'info');
212
+ if (gone.length) toast(`${names(gone)} ${gone.length === 1 ? 'is' : 'are'} no longer waiting for an answer, so nothing was done for ${gone.length === 1 ? 'it' : 'them'}.`, 'info');
213
+ for (const name of alreadyRunning) { const o = offers.find((x) => x.name === name); if (o) state.answered.delete(o.offerId); }
214
+ await ctx.reload?.();
215
+ render();
216
+ }
217
+
218
+ /** Routines says what still waits for an answer, and reopens the card. */
219
+ function paintRoutinesNote() {
220
+ const note = document.getElementById('rtn-missed-note');
221
+ const text = document.getElementById('rtn-missed-text');
222
+ if (!note || !text) return;
223
+ const n = state.offers.length;
224
+ note.hidden = n === 0;
225
+ text.textContent = n === 1 ? '1 routine missed its time while FloLess was closed and waits for your answer.'
226
+ : `${n} routines missed their time while FloLess was closed and wait for your answer.`;
227
+ }
228
+
229
+ /** Closes Routines (the card never shows over a dialog), shows the card again after Later and moves focus into it. */
230
+ function open() {
231
+ if (document.getElementById('routines-modal')?.classList.contains('show')) document.getElementById('routines-close')?.click();
232
+ state.later.clear();
233
+ render();
234
+ card?.querySelector('[data-missed]:not([disabled]):not(.missed-later)')?.focus();
235
+ }
236
+
237
+ document.getElementById('rtn-missed-review')?.addEventListener('click', open);
238
+ window.flolessMissedRoutines = { update, open };
239
+ })();
@@ -204,6 +204,14 @@ export function createSteelAdapter({ viewport, editorBridge = {} }) {
204
204
  drawnMemberIds: () => invoke('drawnMemberIds', [], null),
205
205
  // #2521 row 6: the member ends and connections that rest on an AI decision; null clears them.
206
206
  setAiMarks: (spec) => invoke('setAiMarks', [spec]),
207
+ // Flo on the model (web/steel-3d-flo.js): the Labels menu switch and size, AI Chat's mood for this project, and the note
208
+ // the editor leaves before it reloads for a change made elsewhere, so Flo can visit what changed; and a re-read of
209
+ // Flo's card when the person changes what it shows.
210
+ setFlo: (on) => invoke('setFlo', [on]),
211
+ setFloMood: (mood) => invoke('setFloMood', [mood]),
212
+ refreshFloCard: () => invoke('refreshFloCard'),
213
+ setFloSize: (k) => invoke('setFloSize', [k]),
214
+ floRemember: () => invoke('floRemember'),
207
215
  isIsolated: () => !!invoke('isIsolated', [], false),
208
216
  selectionHiddenIds: () => invoke('selectionHiddenIds', [], []),
209
217
  connHiddenIds: () => invoke('connHiddenIds', [], []),
@@ -367,7 +375,7 @@ const CONTRIBUTIONS = Object.freeze({
367
375
  kind: 'menu', el: 'm3dView', menu: 'm3dViewMenu', aria: true, label: 'Labels', semantic: 'steel.labels',
368
376
  icon: STEEL_LABELS_ICON_V1,
369
377
  cmd: STEEL_TOOLBAR_CONTRIBUTIONS_V1[0],
370
- tip: 'Show or hide reference lines and property labels on the 3D model',
378
+ tip: 'Show or hide reference lines, property labels and Flo on the 3D model',
371
379
  items: [
372
380
  {
373
381
  kind: 'toggle', cmd: 'steel.show-labels#reference lines', el: 'm3dRef', checked: false,
@@ -392,6 +400,38 @@ const CONTRIBUTIONS = Object.freeze({
392
400
  },
393
401
  ],
394
402
  },
403
+ {
404
+ // Flo (owner, 2026-11-04): an extra, off until switched on here, beside the other things drawn over the model.
405
+ // The disclosure chooses what Flo's card says; the card lists them in this order, not the order they were
406
+ // switched on. The page wires it by these ids (steel-editor.html wireFloSection), after every render.
407
+ kind: 'section', el: 'floSection', class: 'pl-section', items: [
408
+ {
409
+ kind: 'row', class: 'pl-header', items: [
410
+ { kind: 'toggle', cmd: 'steel.show-flo', el: 'floToggleB', checked: false, ariaLabel: 'Show Flo', label: '', tip: 'Flo stands on the 3D model, hops onto the member you select and says what it is. It also shows what AI Chat is doing on this project. It is decoration only and changes nothing in the model.' },
411
+ { kind: 'disclosure', cmd: 'steel.flo-card-settings', el: 'floCardDisc', class: 'pl-disclosure', controls: 'floCardScope', label: 'Flo', tip: 'Choose what Flo’s card says about the member Flo hops onto' },
412
+ ],
413
+ },
414
+ // How big Flo and its card are drawn, like Grid label size for the grid bubbles: one setting for both.
415
+ { kind: 'range', cmd: 'steel.flo-size', el: 'floSize', valueEl: 'floSizeV', label: 'Flo size', min: 60, max: 200, step: 10, value: 100, ariaLabel: 'Flo size in percent', tip: 'How big Flo and Flo’s card are drawn in 3D. They keep this size on screen however far you zoom.' },
416
+ {
417
+ kind: 'scope', el: 'floCardScope', class: 'pl-scope', revealBy: 'floCardDisc', hidden: true, items: [
418
+ { kind: 'note', el: 'floCardNote', class: 'pl-note' },
419
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Type', el: 'floCardF_type', checked: false, label: 'Type', tip: 'Flo’s card shows whether it is a beam, column or brace', data: { 'data-key': 'type' } },
420
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Mark', el: 'floCardF_mark', checked: false, label: 'Mark', tip: 'Flo’s card shows its mark from the drawings', data: { 'data-key': 'mark' } },
421
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Profile', el: 'floCardF_profile', checked: false, label: 'Profile', tip: 'Flo’s card shows its profile, large', data: { 'data-key': 'profile' } },
422
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Length', el: 'floCardF_length', checked: false, label: 'Length', tip: 'Flo’s card shows its length', data: { 'data-key': 'length' } },
423
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Weight', el: 'floCardF_weight', checked: false, label: 'Weight', tip: 'Flo’s card shows its weight, from the profile and length', data: { 'data-key': 'weight' } },
424
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Top (TOS)', el: 'floCardF_col_tos', checked: false, label: 'Top (TOS)', tip: 'Flo’s card shows the top of a column', data: { 'data-key': 'col_tos' } },
425
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Bottom (BOS)', el: 'floCardF_col_bos', checked: false, label: 'Bottom (BOS)', tip: 'Flo’s card shows the bottom of a column', data: { 'data-key': 'col_bos' } },
426
+ { kind: 'toggle', cmd: 'steel.flo-card-field#TOS (start)', el: 'floCardF_tos_start', checked: false, label: 'TOS (start)', tip: 'Flo’s card shows the top of steel at a beam’s start', data: { 'data-key': 'tos_start' } },
427
+ { kind: 'toggle', cmd: 'steel.flo-card-field#TOS (end)', el: 'floCardF_tos_end', checked: false, label: 'TOS (end)', tip: 'Flo’s card shows the top of steel at a beam’s end', data: { 'data-key': 'tos_end' } },
428
+ { kind: 'toggle', cmd: 'steel.flo-card-field#Verified', el: 'floCardF_verified', checked: false, label: 'Verified', tip: 'Flo’s card shows whether it is verified', data: { 'data-key': 'verified' } },
429
+ { kind: 'toggle', cmd: 'steel.flo-card-field#ID', el: 'floCardF_id', checked: false, label: 'ID', tip: 'Flo’s card shows its member ID', data: { 'data-key': 'id' } },
430
+ { kind: 'item', cmd: 'steel.flo-card-reset', el: 'floCardReset', class: 'fc-reset', label: 'Reset to default', tip: 'Type, mark, profile, length and weight' },
431
+ ],
432
+ },
433
+ ],
434
+ },
395
435
  ],
396
436
  }],
397
437
  });
@@ -401,6 +401,12 @@ export function mountModelMeasureTool({
401
401
  const onKey = (event) => {
402
402
  const key = String(event.key || '').toLowerCase();
403
403
  if (editor && event.key === 'Escape') { event.preventDefault(); closeEditor(); return; }
404
+ // D, F, X, Y and Z are toggles: a held key's auto-repeat would flip them on and off and leave the
405
+ // tool or lock in whatever state the last repeat landed on (#3145). Only the first press counts;
406
+ // the repeats are still consumed so nothing behind the tool acts on them.
407
+ if (event.repeat && ['d', 'f', 'x', 'y', 'z'].includes(key) && !event.ctrlKey && !event.metaKey && !event.altKey) {
408
+ if (key === 'd' || armed) { event.preventDefault(); return; }
409
+ }
404
410
  if (key === 'd' && !event.ctrlKey && !event.metaKey && !event.altKey) { event.preventDefault(); api.toggle(); return; }
405
411
  if (!armed) {
406
412
  if (event.key === 'Delete' && selectedIndex !== null) { event.preventDefault(); session.remove(selectedIndex); syncSession(); render(); notify(); }
@@ -9,7 +9,7 @@
9
9
  let panelSequence = 0;
10
10
  const finite = (value, label) => {
11
11
  const next = Number(value);
12
- if (!Number.isFinite(next)) throw new TypeError(`${label} must be a finite number.`);
12
+ if (!Number.isFinite(next)) throw Object.assign(new TypeError(`${label} must be a finite number.`), { forPerson: true });
13
13
  return next;
14
14
  };
15
15
  const degrees = (radians) => radians * 180 / Math.PI;
@@ -69,6 +69,17 @@ function note(doc, text) { const value = doc.createElement('div'); value.classNa
69
69
 
70
70
  function actionRow(doc) { const row = doc.createElement('div'); row.className = 'model-spatial-panel-actions'; return row; }
71
71
 
72
+ // The shared spatial tools word their checks for a developer ("clip.min must have positive extents"), so the checks a
73
+ // person can trip from this panel's own controls are answered here by code, each saying what to change. Each sentence
74
+ // must hold for every call that raises its code: the range check covers points and directions alike.
75
+ const SPATIAL_GUIDANCE = Object.freeze({
76
+ E_MODEL_SPATIAL_EXTENTS: 'Each minimum must be smaller than its maximum. Change the box corners, then update the clip again.',
77
+ E_MODEL_SPATIAL_DEGENERATE: 'That direction has no length: its values are all zero, or the points picked lie on one line. Change them, then try again.',
78
+ E_MODEL_SPATIAL_RANGE: 'That value is larger than FloLess can place. Use a smaller number, then try again.',
79
+ E_MODEL_WORK_PLANE_UNAVAILABLE: 'There is no working plane yet. Set one first, then try again.',
80
+ E_MODEL_FRAME_LIMIT: 'This view already has as many saved frames as it can hold. Remove one, then try again.',
81
+ });
82
+
72
83
  /**
73
84
  * @param {{tools:any, trigger:HTMLElement, ports?:Record<string,Function>, documentRef?:Document,
74
85
  * windowRef?:Window, onBeforeOpen?:()=>void, onError?:(error:Error)=>void,
@@ -95,7 +106,7 @@ export function mountModelSpatialPanel({
95
106
  // quantity, so clicking Apply to change another field must not move this one by the rounding gap.
96
107
  if (typeof source !== 'string' && source?.dataset?.displayText === text) return Number(source.dataset.originalMm);
97
108
  const mm = lengthDisplay.parse(text);
98
- if (typeof mm !== 'number' || !Number.isFinite(mm)) throw new TypeError(`${label} must be a finite length.`);
109
+ if (typeof mm !== 'number' || !Number.isFinite(mm)) throw Object.assign(new TypeError(`${label} must be a finite length.`), { forPerson: true });
99
110
  return mm;
100
111
  };
101
112
  const lengthValuesFrom = (host, prefix, label) => [0, 1, 2].map((index) =>
@@ -105,7 +116,11 @@ export function mountModelSpatialPanel({
105
116
 
106
117
  const report = (error) => {
107
118
  const value = error instanceof Error ? error : new Error(String(error));
108
- if (status) { status.textContent = value.message; status.dataset.tone = 'error'; }
119
+ // #3097 3b: the panel's own input checks are said as written (forPerson), and a shared-tool check a person can
120
+ // trip with typed values is answered by its code; anything else that threw gets the shared sentence and stays in
121
+ // the console.
122
+ const guidance = SPATIAL_GUIDANCE[value.code];
123
+ if (status) { status.textContent = guidance || errorText(value, { action: 'use that spatial tool', retrySafe: true }); status.dataset.tone = 'error'; }
109
124
  try { onError(value); } catch (_) { /* reporting cannot break the spatial interaction */ }
110
125
  };
111
126
  const run = (operation, success = '') => {
@@ -169,7 +184,7 @@ export function mountModelSpatialPanel({
169
184
  if (lengthDisplay) {
170
185
  const raw = text.trim(), relative = raw.startsWith('@');
171
186
  const parts = (relative ? raw.slice(1) : raw).split(',').map((part) => part.trim());
172
- if (parts.length !== 3) throw new TypeError('Enter X, Y, Z as three finite lengths.');
187
+ if (parts.length !== 3) throw Object.assign(new TypeError('Enter X, Y, Z as three finite lengths.'), { forPerson: true });
173
188
  text = `${relative ? '@' : ''}${parts.map((part, axis) => readLength(part, `Coordinate ${'XYZ'[axis]}`)).join(',')}`;
174
189
  }
175
190
  const point = tools.parseCoordinates(text, basePoint);
@@ -27,7 +27,7 @@ const finite = (value, label) => {
27
27
  const vec3 = (value, label) => {
28
28
  if (!Array.isArray(value) || value.length !== 3) throw new TypeError(`${label} must be a 3D point.`);
29
29
  const next = value.map((item, index) => finite(item, `${label}[${index}]`));
30
- if (next.some((item) => Math.abs(item) > MAX_COORDINATE_MM)) throw new TypeError(`${label} exceeds the supported coordinate range.`);
30
+ if (next.some((item) => Math.abs(item) > MAX_COORDINATE_MM)) throw Object.assign(new TypeError(`${label} exceeds the supported coordinate range.`), { code: 'E_MODEL_SPATIAL_RANGE' });
31
31
  return next;
32
32
  };
33
33
  const canonicalText = (value, label, maximum) => {
@@ -42,7 +42,7 @@ const cross = (a, b) => [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a
42
42
  const length = (value) => Math.hypot(...value);
43
43
  const unit = (value, label) => {
44
44
  const magnitude = length(value);
45
- if (!(magnitude > EPS)) throw new TypeError(`${label} is degenerate.`);
45
+ if (!(magnitude > EPS)) throw Object.assign(new TypeError(`${label} is degenerate.`), { code: 'E_MODEL_SPATIAL_DEGENERATE' });
46
46
  return scale(value, 1 / magnitude);
47
47
  };
48
48
 
@@ -96,7 +96,7 @@ function validatePlane(value, label = 'plane') {
96
96
 
97
97
  function validateBox(value, label = 'box') {
98
98
  const min = vec3(value?.min, `${label}.min`); const max = vec3(value?.max, `${label}.max`);
99
- if (min.some((item, index) => item >= max[index])) throw new TypeError(`${label} must have positive extents.`);
99
+ if (min.some((item, index) => item >= max[index])) throw Object.assign(new TypeError(`${label} must have positive extents.`), { code: 'E_MODEL_SPATIAL_EXTENTS' });
100
100
  return snapshot({ min, max });
101
101
  }
102
102
 
@@ -1323,9 +1323,9 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1323
1323
  setWorkPlaneVisible: (value) => needSpatial().setWorkPlaneVisible(value),
1324
1324
  clearWorkPlane() { const tools = needSpatial(); const state = tools.state(); if (state.workPlane?.visible) tools.setWorkPlaneVisible(false); return tools.resetGlobal(); },
1325
1325
  workPlaneInfo: () => spatialState?.workPlane ?? null,
1326
- setWorkArea(from) { const box = canonicalBounds(from === 'selection' ? selectedMeshes() : ownedMeshes); if (!box) throw new Error(from === 'selection' ? 'Select model objects first.' : 'No visible model bounds are available.'); return needSpatial().setWorkArea({ ...box, wholeParts: true }); },
1327
- toggleWorkArea() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw new Error('Set a work area first.'); return tools.setWorkAreaVisible(!area.visible); },
1328
- toggleWorkAreaWhole() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw new Error('Set a work area first.'); return tools.setWorkAreaWhole(!area.wholeParts); },
1326
+ setWorkArea(from) { const box = canonicalBounds(from === 'selection' ? selectedMeshes() : ownedMeshes); if (!box) throw Object.assign(new Error(from === 'selection' ? 'Select model objects first.' : 'Nothing in this model is shown, so there is no work area to set.'), { forPerson: true }); return needSpatial().setWorkArea({ ...box, wholeParts: true }); },
1327
+ toggleWorkArea() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw Object.assign(new Error('Set a work area first.'), { forPerson: true }); return tools.setWorkAreaVisible(!area.visible); },
1328
+ toggleWorkAreaWhole() { const tools = needSpatial(); const area = tools.state().workArea; if (!area) throw Object.assign(new Error('Set a work area first.'), { forPerson: true }); return tools.setWorkAreaWhole(!area.wholeParts); },
1329
1329
  workAreaState: () => spatialState?.workArea ?? null,
1330
1330
  projection: () => controller.cameraState().projection, displayMode: () => controller.displayMode(),
1331
1331
  lightingState: () => ({ ...lighting }), setLighting: (value) => ({ ...applyLighting(value) }),
@@ -144,6 +144,14 @@ const ITEM = {
144
144
  */
145
145
  row: (d) => `<div${attr('id', d.el)}${attr('class', d.class)}>${d.items.map(renderItem).join('')}</div>`,
146
146
 
147
+ /*
148
+ * A labelled slider inside a menu: the words above, the slider and its read-out (filled in by the page) beside.
149
+ * The command id sits on the slider itself, which is what a person moves.
150
+ */
151
+ range: (d) => `<div class="mrow"><span class="mlbl">${escapeHtml(d.label)}</span>`
152
+ + `<input type="range"${common(d)}${attr('min', d.min)}${attr('max', d.max)}${attr('step', d.step)}${attr('value', d.value)}${attr('aria-label', d.ariaLabel)}>`
153
+ + `<span${attr('id', d.valueEl)} class="mval"></span></div>`,
154
+
147
155
  /** A free-text field inside a menu. */
148
156
  input: (d) => `<input${attr('data-command-id', d.cmd)}${attr('aria-label', d.ariaLabel)}${attr('id', d.el)}`
149
157
  + attr('inputmode', d.inputmode) + attr('placeholder', d.placeholder) + ' autocomplete="off"'
@@ -331,6 +339,9 @@ export function mountToolbarChrome({ toolbar, getItems = defaultItems, port = nu
331
339
  listenOrdinary(menu, 'keydown', (event) => {
332
340
  if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); closeMenu(menu, true); return; }
333
341
  const items = enabledMenuItems(menu); const at = items.indexOf(event.target); if (at < 0) return;
342
+ // On a slider the arrows and Home / End are its own keys (step, lowest, highest), not row navigation; Tab and
343
+ // Escape still leave it.
344
+ if (event.target.type === 'range' && ['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) return;
334
345
  let next = null;
335
346
  if (event.key === 'ArrowDown') next = (at + 1) % items.length;
336
347
  else if (event.key === 'ArrowUp') next = (at - 1 + items.length) % items.length;