@floless/app 0.147.0 → 0.148.1

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.
@@ -20,12 +20,19 @@ export function subjectLabelText(text) {
20
20
  }
21
21
 
22
22
  /**
23
- * An object of a snapshot model as AI Chat names it. Revit: what it is, then its id (`Basic Wall · element:382`) -
23
+ * An object of a model as AI Chat names it. Revit: what it is, then its id (`Basic Wall · element:382`) -
24
24
  * many elements share a type and some rows carry none, so a name without the id reads as a duplicate. Tekla Parser:
25
- * the name, profile and Tekla ID the viewer shows, with the entity id added when the read had no Tekla ID.
26
- * `rows` are the entity's property rows (Tekla reads its name and profile from them).
25
+ * the name, profile and Tekla ID the viewer shows, with the entity id added when the read had no Tekla ID. Live
26
+ * Tekla: the mark (else the name) · profile. `rows` are the entity's property rows (Tekla Parser reads its name and
27
+ * profile from them).
27
28
  */
28
29
  export function modelSubjectLabel(source, entity, rows = []) {
30
+ // A part of the live Tekla model, as its selection read lists it: the mark (else the name) and the profile. Marks
31
+ // repeat and change on renumbering, which is why the link itself is the part's GUID and never this label.
32
+ if (source === 'tekla') {
33
+ const what = entity?.mark || entity?.name || 'Tekla part';
34
+ return entity?.profile ? `${what} · ${entity.profile}` : what;
35
+ }
29
36
  const id = String(entity?.id ?? '');
30
37
  if (source === 'tekla-parser') {
31
38
  const fields = teklaObjectFields(entity || {}, rows);
@@ -66,7 +73,8 @@ export function chatQuestionDate(iso) {
66
73
 
67
74
  /**
68
75
  * One row per question: the links of one message collapse into it, naming the objects it was about. A link is the
69
- * person's selection, the chat model's note on it, or its answer naming the object. What a row says never depends on
76
+ * person's selection (or a live Tekla read made for the question), the chat model's note on it, or its answer naming
77
+ * the object. What a row says never depends on
70
78
  * which link arrived first: every link of a question carries the same question line and time, the newest note wins,
71
79
  * and "named in the answer" is a fact of the set. Newest question first.
72
80
  */
@@ -115,7 +123,9 @@ function chatQuestionRow(doc, row, opts) {
115
123
  if (was) { const who = doc.createElement('div'); who.className = 'chat-q-about'; who.textContent = `When asked: ${was}`; li.append(who); }
116
124
  }
117
125
  const show = doc.createElement('button'); show.type = 'button'; show.className = 'ghost chat-q-show'; show.textContent = 'Show in chat';
118
- show.dataset.commandId = `${commandPrefix}.chat-question-show#${link.messageEventId}`; show.dataset.commandInstanceLabel = link.note;
126
+ // One question can sit in both lists of a combined card (one part still there, one missing): each button its own id.
127
+ show.dataset.commandId = `${commandPrefix}.chat-question-show#${link.messageEventId}${opts.instanceSuffix || ''}`;
128
+ show.dataset.commandInstanceLabel = link.note;
119
129
  show.setAttribute('aria-label', `Show in chat: ${link.note}`);
120
130
  show.style.gridRow = `1/span ${li.children.length}`; // spans every line this row has, and no empty ones
121
131
  show.onclick = () => { if (!onShow(link)) toast(CHAT_NOT_OPEN_COPY); };
@@ -126,10 +136,12 @@ function chatQuestionList(doc, host, rows, opts) {
126
136
  const shown = rows.slice(0, 3), rest = rows.slice(3);
127
137
  for (const row of shown) host.append(chatQuestionRow(doc, row, opts));
128
138
  if (!rest.length) return;
129
- const more = doc.createElement('details'); more.className = 'chat-q-more'; more.open = opts.ui.moreOpen === true;
130
- const sum = doc.createElement('summary'); sum.dataset.commandId = `${opts.commandPrefix}.chat-questions-more`; more.append(sum);
139
+ // One card may hold two lists (the combined card): each "more" has its own command and its own open state.
140
+ const moreId = opts.moreId || 'chat-questions-more', moreKey = opts.moreKey || 'moreOpen';
141
+ const more = doc.createElement('details'); more.className = 'chat-q-more'; more.open = opts.ui[moreKey] === true;
142
+ const sum = doc.createElement('summary'); sum.dataset.commandId = `${opts.commandPrefix}.${moreId}`; more.append(sum);
131
143
  const say = () => { sum.textContent = more.open ? 'Show fewer' : `Show ${rest.length} more`; }; say();
132
- more.addEventListener('toggle', () => { opts.ui.moreOpen = more.open; say(); }); // stays open across repaints
144
+ more.addEventListener('toggle', () => { opts.ui[moreKey] = more.open; say(); }); // stays open across repaints
133
145
  for (const row of rest) more.append(chatQuestionRow(doc, row, opts));
134
146
  host.append(more);
135
147
  }
@@ -138,15 +150,19 @@ function chatQuestionList(doc, host, rows, opts) {
138
150
  * The "Questions in chat" card, or null when there is nothing to say.
139
151
  * chatLinks {state: 'idle'|'ready'|'failed', links, partial}
140
152
  * selected the selected objects as [{kind, id}]; empty when nothing is selected, and then the questions about
141
- * objects not in the model are offered instead
153
+ * objects not in the model are offered instead (with `orphans: 'also'`, as well)
142
154
  * resolves(link) the link's object is in the model shown now
143
155
  * currentLabel(link) the object's label now, '' when unknown
144
- * commandPrefix the page's Instructor namespace ('steel', 'revit', 'tekla-parser')
156
+ * commandPrefix the page's Instructor namespace ('steel', 'revit', 'tekla-parser', 'shell')
145
157
  * onShow(link) open AI Chat at that question; false when AI Chat cannot be reached
146
158
  * onRetry(), toast(text)
147
- * ui {moreOpen, orphansOpen}, kept by the page so an open list stays open across repaints
159
+ * ui {moreOpen, orphansOpen, orphansMoreOpen}, kept by the page so an open list stays open across repaints
160
+ * orphans 'when-nothing-selected' (a model viewer: the list replaces the selection's) or 'also' (one card lists
161
+ * both, as a live Tekla read does: the parts it read, then the linked parts it did not find)
162
+ * orphanTitle(count) the missing section's title; `count` may read "at least N"
148
163
  */
149
- export function renderChatQuestions({ doc, chatLinks, selected, resolves, currentLabel, commandPrefix, onShow, onRetry, toast, ui }) {
164
+ export function renderChatQuestions({ doc, chatLinks, selected, resolves, currentLabel, commandPrefix, onShow, onRetry, toast, ui,
165
+ orphans: orphanMode = 'when-nothing-selected', orphanTitle = (count) => `Questions about objects not in the model (${count})` }) {
150
166
  if (!chatLinks || chatLinks.state === 'idle') return null;
151
167
  const box = doc.createElement('section'); box.className = 'chat-questions'; box.setAttribute('aria-label', 'Questions in chat');
152
168
  if (chatLinks.state === 'failed') {
@@ -161,18 +177,23 @@ export function renderChatQuestions({ doc, chatLinks, selected, resolves, curren
161
177
  if (selected.length) {
162
178
  const keys = new Set(selected.map((item) => `${item.kind}\0${item.id}`));
163
179
  const rows = chatQuestionRows(chatLinks.links.filter((link) => keys.has(`${link.kind}\0${link.id}`) && resolves(link)));
164
- if (!rows.length) return null;
165
- const title = doc.createElement('div'); title.className = 'sect chat-q-title'; title.textContent = `Questions in chat (${atLeast}${rows.length})`;
166
- box.append(title); chatQuestionList(doc, box, rows, { ...opts, about: selected.length > 1, unresolved: false });
167
- return box;
180
+ if (rows.length) {
181
+ const title = doc.createElement('div'); title.className = 'sect chat-q-title'; title.textContent = `Questions in chat (${atLeast}${rows.length})`;
182
+ box.append(title); chatQuestionList(doc, box, rows, { ...opts, about: selected.length > 1, unresolved: false });
183
+ }
184
+ if (orphanMode !== 'also') return rows.length ? box : null;
168
185
  }
169
186
  const orphans = chatQuestionRows(chatLinks.links.filter((link) => !resolves(link)));
170
- if (!orphans.length) return null;
171
- const det = doc.createElement('details'); det.className = 'chat-q-orphans'; det.open = ui.orphansOpen === true;
172
- det.addEventListener('toggle', () => { ui.orphansOpen = det.open; });
173
- const sum = doc.createElement('summary'); sum.dataset.commandId = `${commandPrefix}.chat-questions-orphans`;
174
- // Removed, never there, or read from another source file: an answer can name an id the model lacks.
175
- sum.textContent = `Questions about objects not in the model (${atLeast}${orphans.length})`; det.append(sum);
176
- chatQuestionList(doc, det, orphans, { ...opts, about: true, unresolved: true });
177
- box.append(det); return box;
187
+ if (orphans.length) {
188
+ const det = doc.createElement('details'); det.className = 'chat-q-orphans'; det.open = ui.orphansOpen === true;
189
+ det.addEventListener('toggle', () => { ui.orphansOpen = det.open; });
190
+ const sum = doc.createElement('summary'); sum.dataset.commandId = `${commandPrefix}.chat-questions-orphans`;
191
+ // Removed, never there, or read from another source file: an answer can name an id the model lacks. Live Tekla:
192
+ // a linked part the read did not find when checked.
193
+ sum.textContent = orphanTitle(`${atLeast}${orphans.length}`); det.append(sum);
194
+ const own = orphanMode === 'also' ? { moreId: 'chat-questions-orphans-more', moreKey: 'orphansMoreOpen', instanceSuffix: ':missing' } : {};
195
+ chatQuestionList(doc, det, orphans, { ...opts, ...own, about: true, unresolved: true });
196
+ box.append(det);
197
+ }
198
+ return box.childElementCount ? box : null;
178
199
  }
@@ -46,7 +46,6 @@ function syncHostTheme() {
46
46
  syncHostTheme();
47
47
  window.addEventListener('storage', (event) => { if (event.key === hostThemeKey) syncHostTheme(); });
48
48
  const modelProduct = isTeklaParser ? 'Tekla Parser' : 'Revit Parser';
49
- const sourceProduct = isTeklaParser ? 'Tekla' : 'Revit';
50
49
  const commandPrefix = isTeklaParser ? 'tekla-parser' : 'revit';
51
50
  // AI Chat names this viewer's objects as this model's (#1653): the pill, the card and the chat model's links.
52
51
  const subjectSource = isTeklaParser ? 'tekla-parser' : 'revit';
@@ -1546,7 +1546,10 @@ savedEl.addEventListener('keydown', e => {
1546
1546
  function markDirty(retireAiUndo=true,preserveOnUndo=false){
1547
1547
  if(retireAiUndo && filterAiUndo) retireFilterAiUndo(FILTER_AI_EDITED);
1548
1548
  if(!retireAiUndo && preserveOnUndo && filterAiUndo) filterAiUndo.preserveDirtyOnUndo = true;
1549
- dirty = true; saveBtn.disabled = checkpointSaveBlocked; setSaved('dirty');
1549
+ // An approval refused after the save committed leaves Save off until a reload, and the latched chip is
1550
+ // the only thing that reopens why (#1781). An edit must not trade it for a plain "Unsaved" label.
1551
+ dirty = true; saveBtn.disabled = checkpointSaveBlocked;
1552
+ setSaved(checkpointSaveBlocked && savedState === 'signoff-blocked' ? 'signoff-blocked' : 'dirty');
1550
1553
  if(revisionRequest) syncRequiredSaveCue();
1551
1554
  }
1552
1555
 
@@ -4174,6 +4177,8 @@ function failSignoffPreview(seq, error){
4174
4177
  // offer the actions that can actually help, instead of an Approve the server would refuse.
4175
4178
  signoffOutcome = (error && error.signoffCode) || 'steel-exclusion-preview-unavailable';
4176
4179
  setSignoffMode(signoffOutcome);
4180
+ // The dialog is already open, so nothing else tells the shell it now explains a refusal (#1781).
4181
+ notifyFilterAi();
4177
4182
  }
4178
4183
 
4179
4184
  function openSignOff(values){
@@ -4592,6 +4597,22 @@ window.__floGuard = {
4592
4597
  isDirty: () => dirty,
4593
4598
  save: async () => { await beginSave(); return !dirty; },
4594
4599
  discard: () => { dirty = false; },
4600
+ // #1781: what the workspace must say OUTSIDE this frame, so the tab strip and the progress strip never
4601
+ // call the Drawing Filter saved while a save here is unfinished. The first match wins:
4602
+ // 'saving' the writes are in flight (a required first save too, whose `dirty` is false);
4603
+ // 'blocked' the save or its approval was refused. The dialog, or the status chip that reopens it,
4604
+ // explains why; Approve and Cancel are gone, so nothing may tell the person to press them.
4605
+ // Only while one of those two is actually there: with neither, "the Filter explains why"
4606
+ // would send the person to nothing (markDirty keeps the chip latched for that reason);
4607
+ // 'confirm' the dismissal confirmation is open and waiting for Approve or Cancel;
4608
+ // 'reload' a required save failed and Save stays disabled until the Drawing Filter is reloaded;
4609
+ // 'unsaved' edits nobody has pressed Save on; '' nothing is pending.
4610
+ // Every change reaches the parent via notifyFilterAi.
4611
+ pendingSave: () => saveInFlight ? 'saving'
4612
+ : signoffOutcome && (!signoffOverlay.hidden || savedState === 'signoff-blocked') ? 'blocked'
4613
+ : !signoffOverlay.hidden ? 'confirm'
4614
+ : checkpointSaveBlocked ? 'reload'
4615
+ : dirty ? 'unsaved' : '',
4595
4616
  };
4596
4617
 
4597
4618
  // Test seam (mirrors steel-3d-view's debug()/probe()) — lets a headless E2E drive the eyedropper
@@ -4338,6 +4338,82 @@
4338
4338
  ));
4339
4339
  }
4340
4340
 
4341
+ /**
4342
+ * Work the Drawing Filter holds that is NOT saved, as the page's own guard reports it (#1781):
4343
+ * 'saving' while its writes are in flight, 'blocked' when the save or its approval was refused and the
4344
+ * Filter explains why, 'confirm' while its "Confirm what this read will dismiss" dialog waits for
4345
+ * Approve or Cancel, 'reload' when a required save failed and Save stays off until a reload,
4346
+ * 'unsaved' for edits nobody pressed Save on, and '' when nothing is pending.
4347
+ *
4348
+ * The Filter lives in a hidden iframe once the user moves to another step, so without this the strip
4349
+ * and the Model tab went on saying "The Drawing Filter is saved" over a save that was waiting on a
4350
+ * confirmation — and AI Chat, which reads the strip, repeated it. Everything that reads it is repainted
4351
+ * from `floless:filter-ai-changed`, which the Filter raises on each of these transitions.
4352
+ */
4353
+ function drawingFilterPendingSave() {
4354
+ const frame = frames.drawings;
4355
+ // A frame that never loaded holds no Filter work to report.
4356
+ if (!frame || !frame.dataset.loaded) return '';
4357
+ let state = '';
4358
+ try {
4359
+ const guard = frame.contentWindow && frame.contentWindow.__floGuard;
4360
+ // A frame still booting (or about:blank) has no guard yet, and so nothing pending.
4361
+ if (!guard || typeof guard.pendingSave !== 'function') return '';
4362
+ state = guard.pendingSave();
4363
+ } catch (err) {
4364
+ // A loaded Filter whose guard cannot be read is a defect, not an empty state. Say it once per
4365
+ // page: this runs on every repaint, and the strip then shows what it would without the Filter.
4366
+ if (!drawingFilterPendingSave.warned) {
4367
+ drawingFilterPendingSave.warned = true;
4368
+ console.error('Could not read whether the Drawing Filter has an unfinished save', err);
4369
+ }
4370
+ return '';
4371
+ }
4372
+ return drawingFilterPendingText(state) ? state : '';
4373
+ }
4374
+
4375
+ /**
4376
+ * The strip's sentence for each pending Filter save (heading · what to do next), or '' for any other
4377
+ * value; the Model tab's tooltip reuses it. Each one names only controls on screen in that state.
4378
+ */
4379
+ function drawingFilterPendingText(state) {
4380
+ switch (state) {
4381
+ case 'saving': return 'Saving the Drawing Filter · FloLess is writing your latest changes. This message clears when the save finishes.';
4382
+ case 'blocked': return 'Drawing Filter couldn’t finish saving · The Drawing Filter explains why and what to do next. Open Drawing Filter to read it.';
4383
+ case 'confirm': return 'Drawing Filter isn’t saved yet · A confirmation is waiting in Drawing Filter: choose Approve these exclusions to save, or Cancel to keep editing.';
4384
+ case 'reload': return 'Drawing Filter couldn’t finish saving · The save was refused, so Save filter is turned off. Open Drawing Filter, press Reload, review your selections, and press Save filter again.';
4385
+ case 'unsaved': return 'Drawing Filter has unsaved changes · Go to Drawing Filter and press Save filter to keep them.';
4386
+ default: return '';
4387
+ }
4388
+ }
4389
+
4390
+ /**
4391
+ * The Drawing Filter step tab carries the pending state too, so it is visible from every step: a static
4392
+ * dot (no pulse), a themed tooltip, and an accessible name that says it. aria-label rather than extra
4393
+ * text in the button, because the tab's text is its label everywhere else that reads it.
4394
+ */
4395
+ function paintDrawingFilterPendingTab(state) {
4396
+ const tab = $stepTabs && $stepTabs.querySelector('button[data-step="drawings"]');
4397
+ if (!tab) return;
4398
+ // [tooltip, what the accessible name adds]
4399
+ const copy = {
4400
+ saving: ['Saving the Drawing Filter', 'saving'],
4401
+ blocked: ['Not saved — open it to see why and what to do next', 'save could not finish'],
4402
+ confirm: ['Not saved yet — a confirmation is waiting here', 'not saved yet, a confirmation is waiting'],
4403
+ reload: ['Save failed — reload the Drawing Filter, then save again', 'save failed, reload needed'],
4404
+ unsaved: ['Unsaved changes — press Save filter to keep them', 'unsaved changes'],
4405
+ }[state];
4406
+ if (copy) {
4407
+ tab.setAttribute('data-filter-pending', state);
4408
+ tab.setAttribute('data-tip', copy[0]);
4409
+ tab.setAttribute('aria-label', `${tab.textContent.trim()}, ${copy[1]}`);
4410
+ } else if (tab.hasAttribute('data-filter-pending')) {
4411
+ tab.removeAttribute('data-filter-pending');
4412
+ tab.removeAttribute('data-tip');
4413
+ tab.removeAttribute('aria-label');
4414
+ }
4415
+ }
4416
+
4341
4417
  function appendStageGuidanceFilterAction() {
4342
4418
  if (!$stageGuidance || $stageGuidance.querySelector('[data-revfilter]')) return;
4343
4419
  const actions = document.createElement('div');
@@ -4354,9 +4430,59 @@
4354
4430
  markScrollable($stageGuidance);
4355
4431
  }
4356
4432
 
4433
+ /**
4434
+ * The control inside the Drawing Filter that answers its unfinished save (#1781), or null when Save
4435
+ * itself is the next action. The sign-off dialog shows Cancel + Approve while it waits, but only
4436
+ * Close (and Reload, where the work is saved) once a refusal replaced them — so take the first one
4437
+ * actually on screen. A refusal the person already closed is reopened by the status chip, and a
4438
+ * reload-only failure by the Reload button on the bar at the bottom of the Filter.
4439
+ */
4440
+ function drawingFilterPendingTarget(doc, state) {
4441
+ if (state === 'confirm' || state === 'blocked') {
4442
+ const overlay = doc.getElementById('signoffOverlay');
4443
+ if (overlay && !overlay.hidden) {
4444
+ return ['signoffCancel', 'signoffClose', 'signoffReload']
4445
+ .map((id) => doc.getElementById(id))
4446
+ .find((button) => button && !button.hidden && !button.disabled) || null;
4447
+ }
4448
+ const chip = doc.getElementById('saved');
4449
+ return state === 'blocked' && chip && chip.getAttribute('role') === 'button' ? chip : null;
4450
+ }
4451
+ if (state === 'reload') return doc.querySelector('#conflictBanner [data-command-id="filter.reload"]');
4452
+ return null;
4453
+ }
4454
+
4455
+ /**
4456
+ * "Open Drawing Filter" everywhere it appears (the strip and the revision card): go to the Filter
4457
+ * and focus its next required action — a waiting confirmation or refusal first, because the page
4458
+ * is inert behind that dialog; otherwise Save (or the sentence saying why Save is off).
4459
+ */
4460
+ function openDrawingFilterNextAction() {
4461
+ // The strip is on every step, and the Filter it points at is a hidden frame on all but one.
4462
+ if (currentStep !== 'drawings') setStep('drawings');
4463
+ const state = drawingFilterPendingSave();
4464
+ if (state && state !== 'unsaved' && state !== 'saving') {
4465
+ try {
4466
+ const child = frames.drawings.contentWindow;
4467
+ const target = drawingFilterPendingTarget(child.document, state);
4468
+ if (target) {
4469
+ child.focus();
4470
+ target.focus();
4471
+ // Focus can silently fail (a control hidden a moment ago, a frame not yet shown); only a
4472
+ // focus that actually landed counts, otherwise fall through to the ordinary route below.
4473
+ if (child.document.activeElement === target) return;
4474
+ }
4475
+ } catch (err) {
4476
+ console.error('Could not move focus to the Drawing Filter’s waiting action', err);
4477
+ }
4478
+ }
4479
+ focusDrawingFilterSave();
4480
+ }
4481
+
4357
4482
  function wireStageGuidanceFilterAction() {
4358
4483
  $stageGuidance?.addEventListener('click', (e) => {
4359
- if (e.target.closest('[data-revfilter]')) focusDrawingFilterSave();
4484
+ if (!e.target.closest('[data-revfilter]')) return;
4485
+ openDrawingFilterNextAction();
4360
4486
  });
4361
4487
  }
4362
4488
 
@@ -4530,7 +4656,12 @@
4530
4656
  if (waitingForInitial && revCardReq?.preparationState === 'blocked') return 'FloLess could not finish drawing preparation. Restart FloLess, then open Requests and follow the detailed instructions if it remains blocked.';
4531
4657
  if (waitingForInitial && revCardReq?.preparationState === 'manifest-published' && !revCardReq?.prepassReady) return `Drawing preparation is complete and saved. Return to the same ${readSessionName(revCardReq)} and tell it to continue creating the Drawing Filter.`;
4532
4658
  if (waitingForInitial && revCardReq?.filterSaveContinuation?.state === 'recovery-needed') return `The Drawing Filter needs attention. ${savedFilterNextStep(revCardReq)}`;
4533
- if (waitingForInitial && revCardReq?.filterCheckpointCurrent) return `The Drawing Filter is saved. ${savedFilterNextStep(revCardReq)}`;
4659
+ if (waitingForInitial && revCardReq?.filterCheckpointCurrent) {
4660
+ // The EARLIER save is on record, but the Filter now holds a newer one nobody has finished (#1781).
4661
+ const pendingSave = drawingFilterPendingSave();
4662
+ if (pendingSave) return drawingFilterPendingText(pendingSave).replace(' · ', '. ');
4663
+ return `The Drawing Filter is saved. ${savedFilterNextStep(revCardReq)}`;
4664
+ }
4534
4665
  if (waitingForInitial && revCardReq?.prepassReady) return `Check steel, member marks, grids, dimensions, and relevant callouts. Ask in AI Chat on the left if you need help. ${readyFilterNextStep(revCardReq)}`;
4535
4666
  if (waitingForInitial && revCardReq?.preparationRetryable) return `Steel Filter preparation was interrupted. Your drawings are still attached. Return to the same ${readSessionName(revCardReq)} and retry preparation for this same request.`;
4536
4667
  if (waitingForInitial) return `The initial drawing read is waiting for ${readRunsInChat(revCardReq) ? 'AI Chat' : 'your terminal AI'}. The model unlocks after you review the Drawing Filter and press Save filter.`;
@@ -4556,6 +4687,7 @@
4556
4687
  b.removeAttribute('data-blocked-reason');
4557
4688
  b.setAttribute('tabindex', '0');
4558
4689
  });
4690
+ paintDrawingFilterPendingTab('');
4559
4691
  clearStageGuidance();
4560
4692
  return;
4561
4693
  }
@@ -4581,19 +4713,32 @@
4581
4713
  b.setAttribute('tabindex', '0');
4582
4714
  }
4583
4715
  });
4716
+ // After the loop, which clears every unlocked tab's tooltip — the Drawing Filter tab is never locked.
4717
+ // Before the redirect below, so the tab the person is sent to already carries the pending save.
4718
+ const pendingSave = drawingFilterPendingSave();
4719
+ paintDrawingFilterPendingTab(pendingSave);
4584
4720
  // A project opened on the old default Model step can become gated when the lifecycle probe
4585
4721
  // returns. Move it to the first actionable stage instead of leaving a locked tab selected.
4586
4722
  if (currentStep !== 'drawings' && stageGateFor(currentStep)) {
4587
4723
  setStep('drawings');
4588
4724
  return;
4589
4725
  }
4726
+ // The strip always speaks for a save waiting on the person (confirm), refused (blocked) or needing a
4727
+ // reload (reload). Plain unsaved edits it reports only where it would otherwise call the Filter saved:
4728
+ // before the first Save its own guidance already says to press Save filter. A save in flight it also
4729
+ // reports while a stage is locked — that same guidance would otherwise say to press a Save filter the
4730
+ // first save has just disabled — but not in a modelled project, where it would flash on every press.
4731
+ const stripPending = pendingSave === 'confirm' || pendingSave === 'blocked' || pendingSave === 'reload'
4732
+ || ((pendingSave === 'unsaved' || pendingSave === 'saving') && !!revCardReq?.filterCheckpointCurrent)
4733
+ || (pendingSave === 'saving' && locked)
4734
+ ? pendingSave : '';
4590
4735
  if (!$stageGuidance) return;
4591
4736
  const initialRead = revCardReq && isInitialRevisionRead(revCardReq);
4592
4737
  const waitingForInitial = initialRead && lastRevState === 'pending';
4593
4738
  const stagedInitial = initialRead && lastRevState === 'staged';
4594
4739
  const failedInitial = initialRead && lastRevState === 'failed';
4595
4740
  const unavailableInitial = initialRead && lastRevState === 'unavailable';
4596
- if (!locked) {
4741
+ if (!locked && !stripPending) {
4597
4742
  clearStageGuidance();
4598
4743
  return;
4599
4744
  }
@@ -4619,6 +4764,17 @@
4619
4764
  paintStageGuidance(liveProgress);
4620
4765
  return;
4621
4766
  }
4767
+ // An unfinished Filter save (being written, waiting on its confirmation, refused, needing a reload,
4768
+ // or never pressed) outranks every sentence below — the one they would otherwise show here is "The
4769
+ // Drawing Filter is saved" (#1781). Live progress above still wins: a read already running works from
4770
+ // the EARLIER save, and hiding it would say less.
4771
+ if (stripPending) {
4772
+ const stripState = stripPending === 'blocked' || stripPending === 'reload' ? 'failed'
4773
+ : stripPending === 'saving' ? 'active' : 'waiting';
4774
+ paintStageGuidance(drawingFilterPendingText(stripPending), stripState);
4775
+ appendStageGuidanceFilterAction();
4776
+ return;
4777
+ }
4622
4778
  const guidance = stagedInitial
4623
4779
  ? 'The drawing read is complete · Open Drawing Filter and choose Review changes before moving to Model, Exports, or History.'
4624
4780
  : failedInitial
@@ -10400,6 +10556,10 @@
10400
10556
  } catch { /* the loaded child is not ready/same-origin — navigate to the authoritative target */ }
10401
10557
  frame.src = frame.dataset.want;
10402
10558
  }
10559
+ // #1781: the Filter raises this on every unsaved / waiting-for-confirmation / saved transition. The strip,
10560
+ // the Drawing Filter tab and the Model tab's tooltip all read that state, so repaint them now rather
10561
+ // than at the next three-second poll — or never, on a step that has no poll running.
10562
+ window.addEventListener('floless:filter-ai-changed', () => { if (current) applyStageGating(); });
10403
10563
  frames.drawings.addEventListener('load', () => {
10404
10564
  requestAnimationFrame(() => {
10405
10565
  reconcileDrawingRevisionRequestAfterLoad();
@@ -10491,7 +10651,8 @@
10491
10651
  const copyButton = e.target.closest('[data-revcopy]');
10492
10652
  await copyRevisionCardRequest(req, copyButton);
10493
10653
  } else if (e.target.closest('[data-revfilter]')) {
10494
- focusDrawingFilterSave();
10654
+ // The same destination as the strip's button, so its narration is true on both (#1781).
10655
+ openDrawingFilterNextAction();
10495
10656
  } else if (e.target.closest('[data-revdismiss]')) {
10496
10657
  await dismissFailedRevision(req);
10497
10658
  }
@@ -13010,9 +13171,10 @@
13010
13171
  }
13011
13172
  } catch (err) {
13012
13173
  finishProgress();
13013
- showToast(action === 'duplicate'
13174
+ const inUse = projectFolderInUseMessage(err);
13175
+ showToast(inUse || (action === 'duplicate'
13014
13176
  ? 'Duplicate failed: ' + (err && err.message || err)
13015
- : 'Action failed: ' + (err && err.message || err), 'warn');
13177
+ : 'Action failed: ' + (err && err.message || err)), 'warn', inUse ? { persistent: true } : undefined);
13016
13178
  }
13017
13179
  finally { finishProgress(); projActionBusy = false; }
13018
13180
  loadProjects();
@@ -13179,6 +13341,18 @@
13179
13341
  } finally { finishProgress(); }
13180
13342
  }
13181
13343
 
13344
+ // #1719: when another program has a file open inside the project folder, Windows refuses to move or
13345
+ // remove it. The server answers with a complete plain-English sentence (what happened, why, what to do),
13346
+ // so it is shown as-is instead of under a generic "Action failed:" prefix or a "could not save" guess.
13347
+ // It carries the only next step, so it stays until dismissed rather than fading after 5 s.
13348
+ function projectFolderInUseMessage(err) {
13349
+ return err && err.body && err.body.code === 'project-folder-in-use' && err.message ? err.message : '';
13350
+ }
13351
+ function showFolderActionFailure(err, fallback) {
13352
+ const inUse = projectFolderInUseMessage(err);
13353
+ showToast(inUse || fallback, 'warn', inUse ? { persistent: true } : undefined);
13354
+ }
13355
+
13182
13356
  // Restore an archived project to the live grid (the inverse of Archive). Fully reversible — Archive
13183
13357
  // puts it right back — so no confirm: a toast is consistent with how Rename/Duplicate/Archive confirm.
13184
13358
  async function unarchiveProject(id) {
@@ -13186,7 +13360,7 @@
13186
13360
  try {
13187
13361
  await api(`/api/projects/${encodeURIComponent(id)}/unarchive`, { method: 'POST', body: '{}' });
13188
13362
  showToast(`Restored${p ? ` “${p.name}”` : ''}`, 'ok');
13189
- } catch (err) { showToast('We couldn’t restore that item because FloLess could not save the change. Try again.', 'warn'); }
13363
+ } catch (err) { showFolderActionFailure(err, 'We couldn’t restore that item because FloLess could not save the change. Try again.'); }
13190
13364
  loadProjects();
13191
13365
  }
13192
13366
 
@@ -13207,7 +13381,7 @@
13207
13381
  try {
13208
13382
  await api(`/api/projects/${encodeURIComponent(id)}/archived`, { method: 'DELETE' });
13209
13383
  showToast(`Deleted “${name}”`, 'ok');
13210
- } catch (err) { showToast('We couldn’t delete that item because FloLess could not save the change. Try again.', 'warn'); }
13384
+ } catch (err) { showFolderActionFailure(err, 'We couldn’t delete that item because FloLess could not save the change. Try again.'); }
13211
13385
  loadProjects();
13212
13386
  }
13213
13387
 
@@ -3,7 +3,14 @@ import { DISTRIBUTION_PROFILES } from './distribution-profile.mjs';
3
3
  const normalize = (value) => String(value).replace(/\//g, '\\').replace(/\\+$/g, '').toLowerCase();
4
4
  const resource = (kind, name, claim, details = {}) => Object.freeze({ kind, name, claim, ...details });
5
5
 
6
- /** Closed, version-controlled inventory used by builders and both future oracles. */
6
+ /**
7
+ * Closed, version-controlled projection of one distribution profile. The storage roots and registry
8
+ * keys it claims are per USER (%LOCALAPPDATA%, %USERPROFILE%, HKCU); the loopback port and the named
9
+ * pipe are machine-wide, which is why two profiles cannot hold them at once; the lifecycle mutex is
10
+ * `Local\`-prefixed and so per session. The cloud origins and the child-process environment are
11
+ * shared configuration rather than owned resources — `findDistributionResourceCollisions` exempts
12
+ * both kinds for that reason.
13
+ */
7
14
  export function projectDistributionResources(profile) {
8
15
  const id = profile.identity;
9
16
  const root = profile.storage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.147.0",
3
+ "version": "0.148.1",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {