@floless/app 0.162.1 → 0.164.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 (39) hide show
  1. package/dist/floless-server.cjs +39748 -35132
  2. package/dist/schemas/steel.model.v2.schema.json +16 -2
  3. package/dist/skills/floless-app-actions/SKILL.md +54 -3
  4. package/dist/skills/floless-app-onboarding/SKILL.md +2 -2
  5. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -6
  6. package/dist/skills/floless-app-report-issue/SKILL.md +12 -1
  7. package/dist/skills/floless-app-rfi/SKILL.md +36 -9
  8. package/dist/skills/floless-app-steel-model/SKILL.md +5 -3
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +39 -34
  10. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +10 -6
  11. package/dist/web/agents.js +24 -4
  12. package/dist/web/app.css +47 -7
  13. package/dist/web/app.js +22 -3
  14. package/dist/web/aware.js +157 -43
  15. package/dist/web/chat.css +36 -1
  16. package/dist/web/chat.js +322 -44
  17. package/dist/web/commands-filter.js +35 -0
  18. package/dist/web/commands-shell.js +208 -11
  19. package/dist/web/commands-steel.js +23 -0
  20. package/dist/web/failure-copy.js +168 -0
  21. package/dist/web/index.html +35 -1
  22. package/dist/web/instructor.js +3 -1
  23. package/dist/web/landing-sort.js +277 -0
  24. package/dist/web/model-editor-steel-adapter.js +5 -0
  25. package/dist/web/model-panel-bridge.js +13 -2
  26. package/dist/web/model-view-query.js +23 -15
  27. package/dist/web/project-access.js +3 -3
  28. package/dist/web/project-rfis.js +303 -10
  29. package/dist/web/project-workflows.js +1 -1
  30. package/dist/web/steel-3d-view.js +162 -1
  31. package/dist/web/steel-ai-marks.js +233 -0
  32. package/dist/web/steel-editor.html +950 -36
  33. package/dist/web/steel-filter-core.js +2 -0
  34. package/dist/web/steel-filter-flo.js +225 -0
  35. package/dist/web/steel-filter.html +156 -9
  36. package/dist/web/steel-model-v2-commands.js +3 -1
  37. package/dist/web/steel-profile-colours.js +124 -24
  38. package/dist/web/workspaces.js +380 -58
  39. package/package.json +1 -1
@@ -650,6 +650,8 @@ export function statChip(state) {
650
650
  case 'dirty': return { cls: 'dirty', text: 'Unsaved ', badge: '●' };
651
651
  case 'saving': return { cls: '', text: 'Saving filter…', badge: null };
652
652
  case 'saved': return { cls: 'saved', text: 'Filter saved ', badge: '✓' };
653
+ // #2521 row 2c: saved, but by the AI's choice in a Quick model build: never worded as the person's Save.
654
+ case 'ai-saved': return { cls: 'saved', text: 'Saved as the AI’s choice ', badge: '✓' };
653
655
  case 'err': return { cls: 'err', text: 'Save failed ', badge: '✕' };
654
656
  // Not an error: the user's selection is fine, the model simply moved under them.
655
657
  case 'conflict': return { cls: 'conflict', text: 'Save conflict', badge: null };
@@ -0,0 +1,225 @@
1
+ /**
2
+ * #2926: Flo on the Drawing Filter, showing which part of the drawing the AI is reading.
3
+ *
4
+ * The shell (`filterFloState` in workspaces.js) decides, from the read's own signals, whether Flo is reading,
5
+ * waiting on the person, or off, and passes the sheet pictures the read last asked for. This module only shows
6
+ * that state on the stage. It never decides that work is happening and never invents what is seen: the box is
7
+ * the picture the AI was given, and the bubble's words are the progress record's or the AI's own.
8
+ */
9
+
10
+ export const FLO_PART_NAMES = ['', 'top-left', 'top-middle', 'top-right', 'middle-left', 'middle', 'middle-right',
11
+ 'bottom-left', 'bottom-middle', 'bottom-right'];
12
+ /** A look older than this has no box any more: Flo thinks where it is. */
13
+ export const FLO_FRESH_LOOK_MS = 45_000;
14
+ /** Several looks between two polls: Flo visits at most the newest FLO_CATCH_UP, FLO_VISIT_MS each. */
15
+ export const FLO_CATCH_UP = 3;
16
+ export const FLO_VISIT_MS = 2500;
17
+ export const FLO_STORAGE_KEY = 'floless:filter-flo';
18
+
19
+ /** The Filter sheet a look is of: the ONE sheet with its source and page number, else -1 (none, or two). */
20
+ export function floSheetIndex(sheets, look) {
21
+ let found = -1;
22
+ (sheets || []).forEach((sh, i) => {
23
+ if (found === -2 || String(sh?.sourceHash || '').toLowerCase() !== look.sourceHash || sh.pageNumber !== look.pageNumber) return;
24
+ found = found === -1 ? i : -2;
25
+ });
26
+ return found < 0 ? -1 : found;
27
+ }
28
+
29
+ /** The part of a sheet a look covered, in the sheet's coordinates. `rect: null` was the sheet's own picture. */
30
+ export function floLookBox(sheet, look, bgRect) {
31
+ if (!look.rect) return bgRect(sheet);
32
+ const w = sheet?.page?.w || 0, h = sheet?.page?.h || 0;
33
+ const [x0, y0, x1, y1] = look.rect;
34
+ return { x: x0 * w, y: y0 * h, w: (x1 - x0) * w, h: (y1 - y0) * h };
35
+ }
36
+
37
+ /** Where Flo is looking, in words. `sheet` is the Filter sheet's name, or null when the Filter has none for it. */
38
+ export function floWhere(look, sheet) {
39
+ // The set may be several files, so the page number is of its own file.
40
+ if (!sheet) return `Looking at a page the Filter does not show (page ${look.pageNumber} of its file)`;
41
+ return look.part ? `Looking at the ${FLO_PART_NAMES[look.part]} part of ${sheet}` : `Looking at the whole of ${sheet}`;
42
+ }
43
+
44
+ /**
45
+ * Where Flo stands (its top-left, stage px) beside a box it is reading, and which side its bubble goes.
46
+ * Just above the box's top-left corner; just under it when there is no room above, so neither Flo nor the bubble
47
+ * covers what is being read. Only a box filling the view puts them inside it. `pw`/`ph` are the pilot's size
48
+ * (Flo + bubble), `top`/`bottom` the bands to keep clear.
49
+ */
50
+ export function floPerch(box, stage, pilot, clear) {
51
+ const { W, H } = stage, { pw, ph, fw } = pilot;
52
+ let x = box.L - 30;
53
+ const above = box.T - ph - 2, below = box.B + 2;
54
+ let y = above >= clear.top ? above : below + ph <= H - clear.bottom ? below : box.T + 8;
55
+ const left = x + pw > W - 8;
56
+ if (left) x = x + fw - pw;
57
+ return { x: Math.max(8, Math.min(W - pw - 8, x)), y: Math.max(clear.top, Math.min(H - clear.bottom - ph, y)), left };
58
+ }
59
+
60
+ /**
61
+ * The overlay. `d` is the page's half: its elements and what only it knows.
62
+ * root, scan, pilot, bubble, head, sentence, where, showBtn, answerBtn, toggle, live: the elements;
63
+ * avatar: floAvatar(...)'s handle, or null; stage: the stage element;
64
+ * sheets(), active(), setSheet(i), focusSheets(): the Filter's sheets;
65
+ * toStage(x, y): a sheet point in stage px; bgRect(sheet): where the sheet's own picture lies;
66
+ * clearTop(), clearBottom(): px kept clear (the place bar; the zoom bar and the note above it);
67
+ * ask(): asks the shell to open the question in AI Chat; storage: localStorage or null; now(): ms.
68
+ */
69
+ export function mountFilterFlo(d) {
70
+ let state = { mode: 'off' };
71
+ let on = true;
72
+ try { on = d.storage?.getItem(FLO_STORAGE_KEY) !== 'off'; } catch { /* private mode: on, the default */ }
73
+ let cur = null, queue = [], tour = 0, freshTimer = 0, leaving = 0, lastSeq = 0, last = null, spoken = '', read = null, unpin = 0;
74
+
75
+ const show = (el, yes) => { el.hidden = !yes; };
76
+ const sheetName = (i) => (i >= 0 ? d.sheets()[i]?.sheet || null : null);
77
+
78
+ function hide() {
79
+ clearTimeout(freshTimer);
80
+ d.avatar?.setMood('idle');
81
+ if (d.root.hidden || leaving) return;
82
+ d.root.classList.add('leaving');
83
+ leaving = setTimeout(() => { leaving = 0; d.root.hidden = true; d.root.classList.remove('leaving'); }, 300);
84
+ }
85
+ function reveal() {
86
+ if (leaving) { clearTimeout(leaving); leaving = 0; d.root.classList.remove('leaving'); }
87
+ d.root.hidden = false;
88
+ }
89
+
90
+ function step() {
91
+ clearTimeout(tour); tour = 0;
92
+ if (!queue.length) return;
93
+ cur = queue.shift();
94
+ render();
95
+ if (queue.length) tour = setTimeout(step, FLO_VISIT_MS);
96
+ }
97
+
98
+ /** The state the shell decided. Called on every poll; new looks start a short visit, oldest first. */
99
+ function update(next) {
100
+ state = next && typeof next === 'object' ? next : { mode: 'off' };
101
+ // A picture belongs to the read that asked for it: another read starts with no box. The same read keeps its
102
+ // picture and its visits through a wait or a moment off, so reading resumes where it was.
103
+ if (state.read !== read) { read = state.read; cur = null; queue = []; clearTimeout(tour); tour = 0; }
104
+ if (state.mode === 'reading') {
105
+ const t = d.now(), looks = Array.isArray(state.looks) ? state.looks : [];
106
+ const newest = looks.reduce((m, l) => Math.max(m, l.seq), 0);
107
+ if (looks.length && newest < lastSeq) lastSeq = 0; // the server restarted and numbers looks from 1 again
108
+ const fresh = looks.filter((l) => l.seq > lastSeq && l.ageMs < FLO_FRESH_LOOK_MS).map((l) => ({ ...l, at: t - l.ageMs }));
109
+ lastSeq = Math.max(lastSeq, newest);
110
+ if (fresh.length) {
111
+ queue = fresh.slice(-FLO_CATCH_UP);
112
+ if (!tour) { step(); return; }
113
+ }
114
+ }
115
+ render();
116
+ }
117
+
118
+ function render(instant = false) {
119
+ // The switch is there only while a read is live: with nothing to show it would be a control that does nothing.
120
+ d.toggle.hidden = state.mode !== 'reading' && state.mode !== 'waiting';
121
+ const mode = on ? state.mode : 'off';
122
+ const waiting = mode === 'waiting';
123
+ // Said once on the way in (and again only if what it waits on changes), never per poll: the bubble is not a
124
+ // live region.
125
+ const said = waiting ? `Waiting for your answer: ${state.text}` : '';
126
+ if (said !== spoken) { d.live.textContent = said; spoken = said; }
127
+ if (mode !== 'reading' && mode !== 'waiting') { hide(); return; }
128
+ reveal();
129
+ clearTimeout(freshTimer);
130
+ const t = d.now();
131
+ const look = mode === 'reading' && cur && t - cur.at < FLO_FRESH_LOOK_MS ? cur : null;
132
+ const at = look ? floSheetIndex(d.sheets(), look) : -1;
133
+ d.bubble.classList.toggle('waiting', waiting);
134
+ if (waiting) {
135
+ d.head.textContent = 'Waiting for your answer';
136
+ d.sentence.textContent = state.text;
137
+ d.where.textContent = state.chat ? '' : 'Answer it in the terminal where the read is running.';
138
+ } else {
139
+ d.head.textContent = state.label || 'Now:';
140
+ d.sentence.textContent = state.now || '';
141
+ d.where.textContent = look ? floWhere(look, sheetName(at)) : '';
142
+ }
143
+ show(d.where, !!d.where.textContent);
144
+ const away = !!look && at >= 0 && at !== d.active();
145
+ if (away) d.showBtn.textContent = `Show ${sheetName(at)}`;
146
+ show(d.showBtn, away);
147
+ show(d.answerBtn, waiting && !!state.chat);
148
+ if (waiting) { d.avatar?.setMood('yourcall', true); d.avatar?.rest(); }
149
+ else d.avatar?.setMood(look ? 'working' : 'thinking', true);
150
+ place(instant, look, at);
151
+ if (look) freshTimer = setTimeout(() => render(), Math.max(0, cur.at + FLO_FRESH_LOOK_MS - t) + 50);
152
+ }
153
+
154
+ /** Puts Flo, its bubble and the box where the state says, in stage px. `instant` while the view moves. */
155
+ function place(instant = false, look = undefined, at = undefined) {
156
+ if (d.root.hidden || d.root.classList.contains('leaving')) return;
157
+ const W = d.stage.clientWidth, H = d.stage.clientHeight;
158
+ if (!W || !H) return;
159
+ if (look === undefined) {
160
+ const t = d.now();
161
+ look = state.mode === 'reading' && cur && t - cur.at < FLO_FRESH_LOOK_MS ? cur : null;
162
+ at = look ? floSheetIndex(d.sheets(), look) : -1;
163
+ }
164
+ if (instant) {
165
+ // Glides come back two frames after the LAST move: one pending at a time, or a pan's earlier frame turns them
166
+ // on under its later ones and Flo trails the drawing.
167
+ d.root.classList.add('instant');
168
+ cancelAnimationFrame(unpin);
169
+ unpin = requestAnimationFrame(() => { unpin = requestAnimationFrame(() => { unpin = 0; d.root.classList.remove('instant'); }); });
170
+ }
171
+ d.bubble.style.maxWidth = `${Math.max(140, Math.min(290, W - 96))}px`;
172
+ const pilot = { pw: d.pilot.offsetWidth || 0, ph: d.pilot.offsetHeight || 0, fw: 46 };
173
+ const clear = { top: d.clearTop(), bottom: d.clearBottom() };
174
+ let p = null, box = null;
175
+ if (state.mode === 'waiting' && on) {
176
+ p = { x: 12, y: Math.max(clear.top, H - clear.bottom - pilot.ph), left: false };
177
+ } else if (look && at >= 0 && at === d.active()) {
178
+ const sh = d.sheets()[at], r = floLookBox(sh, look, d.bgRect);
179
+ const a = d.toStage(r.x, r.y), b = d.toStage(r.x + r.w, r.y + r.h);
180
+ box = { L: Math.max(4, a.x), T: Math.max(4, a.y), R: Math.min(W - 4, b.x), B: Math.min(H - 4, b.y) };
181
+ if (box.R - box.L < 8 || box.B - box.T < 8) box = null; // that part is out of view: no box to draw
182
+ p = floPerch(box || { L: Math.min(Math.max(a.x, 38), W), T: Math.max(a.y, clear.top), B: Math.max(a.y, clear.top) },
183
+ { W, H }, pilot, clear);
184
+ } else if (look) {
185
+ // Reading a sheet that is not on screen, or a page the Filter has no single sheet for: wait at the top, with a
186
+ // Show button when the Filter has that sheet. The view never moves by itself.
187
+ p = { x: Math.max(8, (W - pilot.pw) / 2), y: clear.top, left: false };
188
+ } else {
189
+ // Between pictures: think where it stood.
190
+ p = last ? { ...last, y: Math.max(clear.top, Math.min(H - clear.bottom - pilot.ph, last.y)) } : { x: 16, y: clear.top, left: false };
191
+ }
192
+ last = p;
193
+ d.pilot.classList.toggle('left', p.left);
194
+ d.pilot.style.transform = `translate(${Math.round(p.x)}px, ${Math.round(p.y)}px)`;
195
+ d.scan.classList.toggle('hide', !box);
196
+ if (box) {
197
+ Object.assign(d.scan.style, { left: `${box.L}px`, top: `${box.T}px`, width: `${box.R - box.L}px`, height: `${box.B - box.T}px` });
198
+ const fx = p.left ? p.x + pilot.pw - pilot.fw / 2 : p.x + pilot.fw / 2, fy = p.y + 30;
199
+ const k = (v) => Math.max(-1, Math.min(1, v / 140));
200
+ d.avatar?.lookAt(k((box.L + box.R) / 2 - fx), k((box.T + box.B) / 2 - fy));
201
+ } else if (state.mode === 'reading') d.avatar?.rest();
202
+ }
203
+
204
+ function setOn(next) {
205
+ on = !!next;
206
+ d.toggle.setAttribute('aria-pressed', String(on));
207
+ try { d.storage?.setItem(FLO_STORAGE_KEY, on ? 'on' : 'off'); } catch { /* private mode */ }
208
+ render(true);
209
+ }
210
+
211
+ d.toggle.setAttribute('aria-pressed', String(on));
212
+ d.toggle.addEventListener('click', () => setOn(!on));
213
+ d.showBtn.addEventListener('click', () => {
214
+ const i = cur ? floSheetIndex(d.sheets(), cur) : -1;
215
+ if (i < 0) return;
216
+ d.setSheet(i);
217
+ render(true);
218
+ d.focusSheets(); // the button is gone now that its sheet is on screen
219
+ });
220
+ d.answerBtn.addEventListener('click', () => d.ask());
221
+ // Pan and hover pass through everything but the buttons.
222
+ for (const el of [d.showBtn, d.answerBtn]) el.addEventListener('pointerdown', (e) => e.stopPropagation());
223
+
224
+ return { update, place: (instant) => place(instant), isOn: () => on };
225
+ }
@@ -518,6 +518,10 @@ body.publication-blocked #empty{position:static;flex:1}
518
518
  12px insets) -- one row at a 290px stage, two rows at 250px, every button fully visible and inside
519
519
  the stage in both. Measured above 768px on purpose: below it the harness emulates a touch device,
520
520
  where `@media not (hover:hover)` hides Hover info outright and the bar is back to two buttons.
521
+ FOUR BUTTONS while Flo is reading or waiting (#2926 adds Show Flo, hidden otherwise; three on a touch device,
522
+ which hides Hover info): measured 334px on one row in a
523
+ real browser, so by the same arithmetic it first wraps once #stage is narrower than ~358px. Not re-measured at
524
+ the wrap itself.
521
525
  On the button rule: min-width:0 and overflow:hidden are ALTERNATIVE ways to defeat a flex item's
522
526
  content-based automatic minimum size, not a pair — measured by toggling each, and removing either
523
527
  one alone still let the button shrink to 46px, while removing BOTH pinned it at its 86px content
@@ -531,7 +535,8 @@ body.publication-blocked #empty{position:static;flex:1}
531
535
  #zoombar button{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:var(--stage-btn);border-color:var(--stage-ctrl);color:var(--stage-text)}
532
536
  #zoombar button:hover{background:var(--stage-btn-hover)}
533
537
  /* Hover info is a READ tool, not a framing control -- the divider says so, so the bar reads as the
534
- framing pair plus one canvas tool rather than three commands of one kind. aria-hidden: it is
538
+ framing pair plus the canvas tools after it (Hover info, and Show Flo during a read) rather than
539
+ commands of one kind. aria-hidden: it is
535
540
  decoration, and the buttons' own names already say what each does. */
536
541
  #zoombar .zb-sep{width:1px;align-self:stretch;background:var(--stage-line);flex:none}
537
542
  /* Hover info ON. It reuses button.primary's exact fill — the "this is active" language the page
@@ -630,6 +635,50 @@ body.publication-blocked #empty{position:static;flex:1}
630
635
  #hoverNote{position:absolute;left:12px;bottom:58px;max-width:min(360px, calc(100% - 24px));background:var(--stage-panel);border:1px solid var(--stage-line);border-left:3px solid var(--warn);border-radius:0 8px 8px 0;padding:8px 10px;box-shadow:var(--stage-shadow);color:var(--stage-mut);font-size:12px;line-height:1.5;pointer-events:none;z-index:30}
631
636
  #hoverNote[hidden]{display:none}
632
637
  #hoverNote b{display:block;color:var(--stage-text);font-weight:600;margin-bottom:2px}
638
+ /* #2926: Flo, showing which part of the drawing the AI is reading (web/steel-filter-flo.js). Stage furniture
639
+ only: the stage tokens, the brand outline #focusPlace already draws, and #hoverNote's amber rail for "waiting
640
+ on you" — the rail alone carries the amber, for the reason given above. No new colour. Takes no pointer
641
+ events but its buttons', so panning and Hover info work through it. Hidden means display:none, which also
642
+ stops Flo's animation loop (flo-avatar.js only draws what is on screen). */
643
+ #floToggle[hidden]{display:none}
644
+ #floFx{position:absolute;inset:0;pointer-events:none;overflow:hidden;transition:opacity .3s ease;--flo-glide:cubic-bezier(.22,1,.36,1)}
645
+ #floFx[hidden]{display:none}
646
+ #floFx.leaving{opacity:0}
647
+ #floScan{position:absolute;left:0;top:0;width:0;height:0;border-radius:6px;overflow:hidden;background:color-mix(in srgb,var(--brand) 6%,transparent);transition:left .95s var(--flo-glide),top .95s var(--flo-glide),width .95s var(--flo-glide),height .95s var(--flo-glide),opacity .4s ease}
648
+ #floScan.hide{opacity:0}
649
+ #floScan i{position:absolute;width:16px;height:16px;border:2px solid var(--brand)}
650
+ #floScan i:nth-of-type(1){left:0;top:0;border-right:0;border-bottom:0;border-top-left-radius:6px}
651
+ #floScan i:nth-of-type(2){right:0;top:0;border-left:0;border-bottom:0;border-top-right-radius:6px}
652
+ #floScan i:nth-of-type(3){left:0;bottom:0;border-right:0;border-top:0;border-bottom-left-radius:6px}
653
+ #floScan i:nth-of-type(4){right:0;bottom:0;border-left:0;border-top:0;border-bottom-right-radius:6px}
654
+ /* A slow light down the box, then a rest: it sits over linework people read for half an hour. */
655
+ #floScan span{position:absolute;inset:0;transform:translateY(-100%);background:linear-gradient(to bottom,transparent calc(100% - 46px),color-mix(in srgb,var(--brand) 25%,transparent));animation:flo-sweep 7s linear infinite}
656
+ #floScan.hide span{animation:none}
657
+ @keyframes flo-sweep{36%{transform:translateY(0)}36.1%,100%{transform:translateY(-100%)}}
658
+ #floPilot{position:absolute;left:0;top:0;display:flex;align-items:flex-start;gap:4px;transition:transform 1.1s var(--flo-glide)}
659
+ #floPilot.left{flex-direction:row-reverse}
660
+ #floFx.instant #floPilot,#floFx.instant #floScan{transition:none}
661
+ #floAvatar{flex:none}
662
+ #floAvatar .flo-avatar{display:block;--flo-line:var(--brand);--flo-fill:var(--stage-panel);--flo-hat:var(--stage-text);--flo-hat-line:var(--stage-text);--flo-pulse:var(--stage-text)}
663
+ /* On a light sheet a white hat needs its outline, as app.css gives Flo in the light theme. */
664
+ [data-theme="light"] #floAvatar .flo-avatar{--flo-hat-line:var(--brand)}
665
+ #floDots{position:relative;width:14px;height:40px;flex:none}
666
+ #floDots i{position:absolute;border-radius:50%;background:var(--stage-panel);border:1px solid var(--stage-line)}
667
+ #floDots i:first-child{width:6px;height:6px;left:1px;top:24px}
668
+ #floDots i:last-child{width:9px;height:9px;left:6px;top:12px}
669
+ #floPilot.left #floDots i:first-child{left:7px}
670
+ #floPilot.left #floDots i:last-child{left:-1px}
671
+ #floBubble{max-width:290px;padding:8px 11px;background:var(--stage-panel);border:1px solid var(--stage-line);border-radius:8px;box-shadow:var(--stage-shadow);color:var(--stage-text);font-size:12.5px;line-height:1.45}
672
+ #floBubble.waiting{border-left:3px solid var(--warn);border-radius:0 8px 8px 0}
673
+ #floBubble p{margin:0}
674
+ #floHead{font-weight:600}
675
+ #floBubble.waiting #floHead{display:block;margin-bottom:2px}
676
+ #floBubble.waiting #floNow{display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
677
+ #floWhere{display:block;margin-top:3px;color:var(--stage-mut);font-size:12px}
678
+ #floWhere[hidden],#floBubble button[hidden]{display:none}
679
+ #floBubble button{display:block;pointer-events:auto;margin-top:7px;white-space:nowrap;background:var(--stage-btn);border-color:var(--stage-ctrl);color:var(--stage-text)}
680
+ #floBubble button:hover{background:var(--stage-btn-hover)}
681
+ @media (prefers-reduced-motion:reduce){#floFx,#floPilot,#floScan{transition:none}#floScan span{display:none}}
633
682
  /* The hovered element's own row in each facet: the checkbox the user is about to untick, lit where it
634
683
  sits. Reuses the option-row hover fill and the left-accent idiom .sheet-option.selected already
635
684
  carries — no new colour, no new shape. This is the half of the feature that answers the actual
@@ -820,14 +869,31 @@ body.publication-blocked #empty{position:static;flex:1}
820
869
  <p class="hint" style="margin-top:8px;max-width:340px">The AI reading your drawings prepares this filter. Its layers, line weights and colours will appear here automatically when ready.</p>
821
870
  </div>
822
871
  </div>
872
+ <!-- #2926: Flo, showing which part of the drawing the AI is reading. Below the stage's bars in the stacking
873
+ order, so it never covers them. The bubble is NOT a live region (it changes every few seconds and the
874
+ progress strip already says "Now:"); #floLive says "Waiting for your answer" once, on the way in. -->
875
+ <div id="floFx" hidden>
876
+ <div id="floScan" class="hide" aria-hidden="true"><span></span><i></i><i></i><i></i><i></i></div>
877
+ <div id="floPilot">
878
+ <div id="floAvatar" aria-hidden="true"></div>
879
+ <div id="floDots" aria-hidden="true"><i></i><i></i></div>
880
+ <div id="floBubble">
881
+ <p><b id="floHead"></b> <span id="floNow"></span></p>
882
+ <span id="floWhere" hidden></span>
883
+ <button id="floShow" type="button" data-command-id="filter.flo-show-sheet" data-tip="Show the sheet the AI is reading now" hidden></button>
884
+ <button id="floAnswer" type="button" data-command-id="filter.flo-answer" data-tip="Open the question in AI Chat" hidden>Answer in AI Chat</button>
885
+ </div>
886
+ </div>
887
+ </div>
823
888
  <!-- The ONLY fit/zoom controls -- plus, after the divider, Hover info, which is a canvas READ tool
824
- rather than a framing one (so "only fit/zoom" still holds of the framing pair). Labels stay terse so all three stay fully legible before the bar's
889
+ rather than a framing one (so "only fit/zoom" still holds of the framing pair), and Show Flo while a
890
+ drawing read is live (#2926). Labels stay terse so all of them stay fully legible before the bar's
825
891
  max-width cap (see its CSS) starts compressing them in a narrow Workspaces pane — the cap
826
892
  means longer text costs legibility, never an overhanging bar. "Zoom steel" not "Steel": a
827
893
  bare noun read as a category, not a command. data-tip (never title=) carries the full
828
894
  sentence. -->
829
895
  <div id="placebar" role="status" aria-live="polite" hidden><span id="placebarText"></span><button id="placebarClear" type="button" data-command-id="filter.place-clear" data-tip="Remove the marked place from this drawing">Clear</button></div>
830
- <div id="zoombar"><button id="fit2" data-command-id="filter.fit" data-tip="Fit the whole page in view">Fit</button><button id="zoomsteel2" data-command-id="filter.zoom-steel" data-tip="Zoom to fit the steel elements on this sheet">Zoom steel</button><span class="zb-sep" aria-hidden="true"></span><button id="hoverInfo" type="button" aria-pressed="false" data-command-id="filter.hover-info" data-tip="Point at any line or label, shown or switched off, to read its layer, thickness and colour — and light up its rows in the Filters panel. Click a switched-off line to see what to tick to bring it back. Background-only linework, on layers the drawing read never picked up, can’t be read by pointing; click an empty spot to ask the original drawing what is there, where the original drawing is available.">Hover info</button></div>
896
+ <div id="zoombar"><button id="fit2" data-command-id="filter.fit" data-tip="Fit the whole page in view">Fit</button><button id="zoomsteel2" data-command-id="filter.zoom-steel" data-tip="Zoom to fit the steel elements on this sheet">Zoom steel</button><span class="zb-sep" aria-hidden="true"></span><button id="hoverInfo" type="button" aria-pressed="false" data-command-id="filter.hover-info" data-tip="Point at any line or label, shown or switched off, to read its layer, thickness and colour — and light up its rows in the Filters panel. Click a switched-off line to see what to tick to bring it back. Background-only linework, on layers the drawing read never picked up, can’t be read by pointing; click an empty spot to ask the original drawing what is there, where the original drawing is available.">Hover info</button><button id="floToggle" type="button" aria-pressed="true" hidden data-command-id="filter.flo-toggle" data-tip="While a drawing read runs, Flo shows which part of the drawing the AI is reading, and says when it is waiting for your answer">Show Flo</button></div>
831
897
  <!-- The hover readout, anchored at the line it names (see #hoverbar's CSS for why it is not docked).
832
898
  Hidden until the pointer is on a line with the mode on; hidden again when it leaves the line, or
833
899
  when a click opens the popover (which then says the same thing).
@@ -854,6 +920,7 @@ body.publication-blocked #empty{position:static;flex:1}
854
920
  talk over the hover readout the way a per-target region would. -->
855
921
  <div id="hoverNote" aria-hidden="true" hidden><b id="hoverNoteTitle"></b><span id="hoverNoteBody"></span></div>
856
922
  <div id="hoverNoteLive" class="sr-only" role="status" aria-live="polite"></div>
923
+ <div id="floLive" class="sr-only" role="status" aria-live="polite"></div>
857
924
  </main>
858
925
  </div>
859
926
  <div id="eye">
@@ -894,6 +961,9 @@ body.publication-blocked #empty{position:static;flex:1}
894
961
  screen's commands first) and forwards `?`/F1 up, because a keydown inside an iframe never
895
962
  reaches the shell's own handler. This surface arms nothing, so its snapshot is just its identity — see commands-filter.js. -->
896
963
  <script src="filter-guidance.js"></script>
964
+ <!-- #2926: Flo's one drawing module and its mount, as index.html loads them (flo.js first: flo-avatar.js calls it). -->
965
+ <script src="flo.js"></script>
966
+ <script src="flo-avatar.js"></script>
897
967
  <script src="commands.js"></script>
898
968
  <script src="commands-filter.js"></script>
899
969
  <script src="instructor-reporter.js"></script>
@@ -908,12 +978,19 @@ import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, e
908
978
  import { checkpointStandard } from './checkpoint-standard.js';
909
979
  import { filterAiBlockedLayerKeys, filterAiTouchesUnreadLayer, parseFilterAiProposal } from './filter-ai-proposal.js';
910
980
  import { hitIndexBuilder, hitTest, textRunRect } from './steel-filter-hit.js';
981
+ import { mountFilterFlo } from './steel-filter-flo.js';
982
+ // #2926: Flo's overlay, mounted at the end of this module. Declared first because setVB() calls it on every view change.
983
+ let filterFlo = null;
911
984
 
912
985
  const APP_ID = new URLSearchParams(location.search).get('app') || '';
913
986
  // Workspaces use a project-keyed contract; an empty project id is the app-keyed workflow surface.
914
987
  const PROJECT = new URLSearchParams(location.search).get('project') || '';
915
988
  let revisionRequest = new URLSearchParams(location.search).get('revisionRequest') || '';
916
989
  let revisionFilterSavedEtag = new URLSearchParams(location.search).get('revisionFilterSavedEtag') || '';
990
+ // #2521 row 2c: the saved checkpoint is the AI's choice in a Quick model build, not the person's Save. Then Save stays
991
+ // pressable (with nothing changed) so the person can save it as theirs, and the chip says whose save it is.
992
+ let revisionFilterChosenByAi = !!revisionFilterSavedEtag && new URLSearchParams(location.search).get('revisionFilterChosenBy') === 'ai';
993
+ const checkpointSavedState = () => (revisionFilterChosenByAi ? 'ai-saved' : 'saved');
917
994
  // Monotonic ownership for async Save results. Saved evidence may advance many times for one request;
918
995
  // only an actual A→B/A→empty identity transition increments this generation.
919
996
  let revisionCheckpointGeneration = 0;
@@ -1610,7 +1687,12 @@ function syncRequiredSaveCue(){
1610
1687
  // The checkpoint always explains the next action, but only a non-empty selection can be saved.
1611
1688
  // A valid prepared filter may already be ready; otherwise the first facet edit re-evaluates it.
1612
1689
  if(checkpoint) saveBtn.disabled = !ready;
1613
- else saveBtn.disabled = !dirty && !conflicted;
1690
+ else {
1691
+ // #2521 row 2c: the AI's saved choice can be saved as the person's own, unchanged; nothing else saved can.
1692
+ const aiChoice = checkpointCurrent && revisionFilterChosenByAi && !conflicted;
1693
+ saveBtn.disabled = !dirty && !conflicted && !aiChoice;
1694
+ if(aiChoice) saveBtn.setAttribute('data-tip', 'The AI chose this Drawing Filter for the Quick model. Press Save filter to save it as yours; you are shown what it leaves out first.');
1695
+ }
1614
1696
  }
1615
1697
 
1616
1698
  // A checkpoint Save is two writes: first the exact Filter, then the request's "filter saved" receipt.
@@ -1642,15 +1724,33 @@ function setFilterEditingLocked(locked){
1642
1724
 
1643
1725
  // Same-origin parent bridge: polling may complete, fail, or clear a checkpoint while this editor has
1644
1726
  // unsaved facet changes. Update only the checkpoint state and URL; never reload the document away.
1727
+ /** Keep the reloadable URL saying whose save the checkpoint is, so a reload shows the same chip and Save state. */
1728
+ function syncChosenByParam(){
1729
+ const url = new URL(location.href);
1730
+ if(revisionFilterChosenByAi) url.searchParams.set('revisionFilterChosenBy', 'ai');
1731
+ else url.searchParams.delete('revisionFilterChosenBy');
1732
+ history.replaceState(null, '', url.pathname + url.search);
1733
+ }
1645
1734
  window.__floRevisionCheckpoint = {
1646
- setRequest(value, savedEtag){
1735
+ setRequest(value, savedEtag, chosenBy){
1647
1736
  const nextRequest = String(value || '');
1648
1737
  const nextSavedEtag = nextRequest ? String(savedEtag || '') : '';
1649
1738
  const requestChanged = nextRequest !== revisionRequest;
1650
1739
  const evidenceChanged = nextSavedEtag !== revisionFilterSavedEtag;
1740
+ // #2521 row 2c: whose save the checkpoint is. Only ever the AI's on a saved checkpoint.
1741
+ const nextChosenByAi = !!nextSavedEtag && chosenBy === 'ai';
1651
1742
  // The 3-second poll ordinarily repeats the same projection. It must be a true no-op: retiring
1652
1743
  // focus, repainting the live status, or re-running cue state on every identical tick is churn.
1653
- if(!requestChanged && !evidenceChanged) return true;
1744
+ if(!requestChanged && !evidenceChanged){
1745
+ // The same checkpoint changing hands (never expected, but the server's word wins) is a label, not new evidence.
1746
+ if(nextChosenByAi !== revisionFilterChosenByAi && !saveInFlight){
1747
+ revisionFilterChosenByAi = nextChosenByAi;
1748
+ syncChosenByParam();
1749
+ if(!dirty && revisionRequest && revisionFilterSavedEtag === serverEtag) setSaved(checkpointSavedState());
1750
+ syncRequiredSaveCue();
1751
+ }
1752
+ return true;
1753
+ }
1654
1754
  // The contract PUT intentionally invalidates the old receipt before `/filter-saved` can publish
1655
1755
  // the replacement. A poll can observe that E1→empty window while this exact Save owns the editor.
1656
1756
  // Defer only same-request evidence changes: request replacement/settlement must still supersede the
@@ -1679,13 +1779,16 @@ window.__floRevisionCheckpoint = {
1679
1779
  }
1680
1780
  revisionRequest = nextRequest;
1681
1781
  revisionFilterSavedEtag = nextSavedEtag;
1782
+ revisionFilterChosenByAi = nextChosenByAi;
1682
1783
  const url = new URL(location.href);
1683
1784
  if(revisionRequest) url.searchParams.set('revisionRequest', revisionRequest);
1684
1785
  else url.searchParams.delete('revisionRequest');
1685
1786
  if(revisionFilterSavedEtag) url.searchParams.set('revisionFilterSavedEtag', revisionFilterSavedEtag);
1686
1787
  else url.searchParams.delete('revisionFilterSavedEtag');
1788
+ if(revisionFilterChosenByAi) url.searchParams.set('revisionFilterChosenBy', 'ai');
1789
+ else url.searchParams.delete('revisionFilterChosenBy');
1687
1790
  history.replaceState(null, '', url.pathname + url.search);
1688
- if(!dirty) setSaved(revisionRequest && revisionFilterSavedEtag === serverEtag ? 'saved' : '');
1791
+ if(!dirty) setSaved(revisionRequest && revisionFilterSavedEtag === serverEtag ? checkpointSavedState() : '');
1689
1792
  syncRequiredSaveCue();
1690
1793
  // The size notice belongs to the checkpoint it was checked against (#1780): a new request voids
1691
1794
  // any answer in flight and anything on screen, and asks again for the new one.
@@ -2043,7 +2146,7 @@ function initFromFilter(){
2043
2146
  buildFacet('colors', F.colors || [], it => it.hex);
2044
2147
  buildSheetSwitcher();
2045
2148
  setSheet(active);
2046
- if(revisionRequest && revisionFilterSavedEtag && revisionFilterSavedEtag === serverEtag) setSaved('saved');
2149
+ if(revisionRequest && revisionFilterSavedEtag && revisionFilterSavedEtag === serverEtag) setSaved(checkpointSavedState());
2047
2150
  syncRequiredSaveCue();
2048
2151
  }
2049
2152
 
@@ -3734,7 +3837,7 @@ eyeNext.onclick = () => { if(identifyShown && identifyShown.i < identifyShown.hi
3734
3837
  // --- pan/zoom via viewBox; a click (no drag) on an element opens the eyedropper ---
3735
3838
  let base = { x:0, y:0, w:1000, h:1000 }, vb = { ...base }, drag = null;
3736
3839
  // BOTH svgs, always together: #under (raster + halo) must register 1:1 with the linework on #canvas.
3737
- function setVB(){ const v = `${vb.x} ${vb.y} ${vb.w} ${vb.h}`; svg.setAttribute('viewBox', v); under.setAttribute('viewBox', v); }
3840
+ function setVB(){ const v = `${vb.x} ${vb.y} ${vb.w} ${vb.h}`; svg.setAttribute('viewBox', v); under.setAttribute('viewBox', v); filterFlo?.place(true); }
3738
3841
  svg.addEventListener('wheel', e => {
3739
3842
  e.preventDefault();
3740
3843
  const r = svg.getBoundingClientRect();
@@ -4571,10 +4674,13 @@ async function saveNow(){
4571
4674
  }
4572
4675
  if(revisionRequest === checkpointRequest){
4573
4676
  revisionFilterSavedEtag = serverEtag;
4677
+ // #2521 row 2c: the person's own Save: whatever the AI chose before is now theirs.
4678
+ revisionFilterChosenByAi = false;
4574
4679
  completedCheckpoint = true;
4575
4680
  const url = new URL(location.href);
4576
4681
  url.searchParams.set('revisionRequest', revisionRequest);
4577
4682
  url.searchParams.set('revisionFilterSavedEtag', revisionFilterSavedEtag);
4683
+ url.searchParams.delete('revisionFilterChosenBy');
4578
4684
  history.replaceState(null, '', url.pathname + url.search);
4579
4685
  }
4580
4686
  }
@@ -4785,6 +4891,47 @@ window.__filterTest = {
4785
4891
  })();
4786
4892
 
4787
4893
  boot();
4894
+
4895
+ // #2926: Flo, showing which part of the drawing the AI is reading. The shell decides the state from the read's own
4896
+ // signals (filterFloState in workspaces.js) and hands it over on every request poll; this page only shows it.
4897
+ // Mounted after boot() has started, so a fault in this optional overlay never keeps the Filter from loading.
4898
+ {
4899
+ const $ = (id) => document.getElementById(id);
4900
+ const stage = $('stage'), zoombar = $('zoombar');
4901
+ filterFlo = mountFilterFlo({
4902
+ root: $('floFx'), scan: $('floScan'), pilot: $('floPilot'), bubble: $('floBubble'), head: $('floHead'), sentence: $('floNow'),
4903
+ where: $('floWhere'), showBtn: $('floShow'), answerBtn: $('floAnswer'), toggle: $('floToggle'), live: $('floLive'),
4904
+ avatar: typeof window.floAvatar === 'function' ? window.floAvatar($('floAvatar'), { size: 56, mood: 'idle', hat: true }) : null,
4905
+ stage,
4906
+ sheets: () => sheets, active: () => active, setSheet,
4907
+ focusSheets: () => { const t = $('sheetTrigger'); if(t && !$('sheetCombo').hidden) t.focus(); },
4908
+ toStage: (x, y) => {
4909
+ const m = svg.getScreenCTM();
4910
+ if(!m) return { x: 0, y: 0 };
4911
+ const p = new DOMPoint(x, y).matrixTransform(m), r = stage.getBoundingClientRect();
4912
+ return { x: p.x - r.left, y: p.y - r.top };
4913
+ },
4914
+ bgRect,
4915
+ clearTop: () => { const pb = $('placebar'); return pb && !pb.hidden ? pb.offsetTop + pb.offsetHeight + 8 : 12; },
4916
+ clearBottom: () => {
4917
+ const note = $('hoverNote');
4918
+ return 12 + (zoombar ? zoombar.offsetHeight : 0) + 6 + (note && !note.hidden && note.offsetHeight ? note.offsetHeight + 6 : 0);
4919
+ },
4920
+ ask: () => { try { if(window.parent !== window) window.parent.dispatchEvent(new CustomEvent('floless:filter-flo-answer')); } catch { /* no shell */ } },
4921
+ storage: (() => { try { return window.localStorage; } catch { return null; } })(),
4922
+ now: () => Date.now(),
4923
+ });
4924
+ window.flolessFilterFlo = (state) => filterFlo.update(state);
4925
+ // For a real browser pass to read the outcome; it drives nothing.
4926
+ window.__filterTest.flo = () => ({
4927
+ shown: !$('floFx').hidden, on: filterFlo.isOn(), waiting: $('floBubble').classList.contains('waiting'),
4928
+ head: $('floHead').textContent, now: $('floNow').textContent, where: $('floWhere').hidden ? '' : $('floWhere').textContent,
4929
+ show: $('floShow').hidden ? '' : $('floShow').textContent, answer: !$('floAnswer').hidden,
4930
+ box: $('floScan').classList.contains('hide') ? null : ['left', 'top', 'width', 'height'].map((k) => parseFloat($('floScan').style[k])),
4931
+ pilot: $('floPilot').style.transform, live: $('floLive').textContent,
4932
+ });
4933
+ if(typeof ResizeObserver === 'function') new ResizeObserver(() => filterFlo.place(true)).observe(stage);
4934
+ }
4788
4935
  </script>
4789
4936
  </body>
4790
4937
  </html>
@@ -53,7 +53,9 @@ const elevMm = (mm) => ({ known: Math.round(Number(mm) * 1e9) / 1e9 });
53
53
  * gesture as "correct this value", which is what a detailer actually does.
54
54
  */
55
55
  const carryAssumed = (prev, next) => (prev && prev.assumed === true
56
- ? { ...next, assumed: true, why: prev.why, checked: prev.checked }
56
+ // #2873: the read's provisional estimate rides along as the record of what was estimated. Once a move
57
+ // changes the height it is history, and the server's note then says "the estimate was …", never "this is it".
58
+ ? { ...next, assumed: true, why: prev.why, checked: prev.checked, ...(prev.estimate && typeof prev.estimate === 'object' ? { estimate: prev.estimate } : {}) }
57
59
  // A height the PERSON answered on a question card (#1882) rides along only while it is still the height
58
60
  // they gave: a move that keeps the height keeps the provenance; any change of height drops it, because
59
61
  // the new number is no longer what they answered (and a typed elevation is their own statement anyway).