@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.
@@ -313,7 +313,7 @@
313
313
  "properties": {
314
314
  "known": { "type": "number", "description": "Where the server placed it, in world mm. Not evidence of anything; see `why`." },
315
315
  "assumed": { "const": true },
316
- "why": { "type": "string", "minLength": 1, "maxLength": 600, "description": "Plain English: what the set does say, and why it does not settle this endpoint. Read by `gapFactsStated`, which refuses a blank or template value." },
316
+ "why": { "type": "string", "minLength": 1, "maxLength": 1000, "description": "Plain English: what the set does say, and why it does not settle this endpoint. Read by `gapFactsStated`, which refuses a blank or template value. The server's own placement sentence, followed by the reader's `why` verbatim when the reader submitted the end as unknown (#1735) - hence 1000, not 600: the longest server sentence with a 40-character sheet name, the joining phrase, and a full 600-character reader `why`, with nothing cut from the stored reason (a published question, capped separately, shortens only this reason and keeps its sheet list)." },
317
317
  "checked": { "type": "array", "minItems": 1, "maxItems": 20, "items": { "$ref": "#/$defs/checkedPage" }, "description": "The pages actually read. At least one, and the audit additionally requires one the manifest holds — a question pointing at a drawing nobody read is worse than no question." },
318
318
  "candidates": { "$ref": "#/$defs/elevationCandidates", "description": "Carried verbatim from the reader's unknown end when the server places it (#1723). Never used to place anything." }
319
319
  }
@@ -7,7 +7,7 @@ description: >-
7
7
  two-phase Drawing Filter process: first prepare and save the deterministic Filter, then read only the
8
8
  selected evidence into model-global members, registered plan views, observations, and revision history.
9
9
  metadata:
10
- version: 0.63.0
10
+ version: 0.64.0
11
11
  ---
12
12
 
13
13
  # Steel Takeoff — read drawings into `steel.model/v2`
@@ -1158,8 +1158,44 @@ Work in this order:
1158
1158
  same sheet in overlapping enlarged tiles. The owner's rule: *"you should suggest — so user can
1159
1159
  approve it, but it doesn't have to give it to you because you can actually read it."*
1160
1160
 
1161
- - A callout whose scope plainly governs this end is drawing evidence — record it on the
1162
- observation, as step 3 says.
1161
+ **This is a procedure, not advice — run it on every plan view you read members from, in this order,
1162
+ BEFORE you compose a single endpoint elevation for that view:**
1163
+
1164
+ 1. **Fetch all nine tiles, `part=1` through `part=9`.** Not `part=0` alone, and not a subset: the
1165
+ whole-sheet picture is too small to read a callout's value, and a callout sits wherever its
1166
+ member is — a read that skipped the top row of tiles missed every callout along the top of the
1167
+ sheet.
1168
+ 2. **Read each tile as the server sends it — the tiles ARE the enlargement.** Nothing here needs a
1169
+ file: do not store, shrink or cut up a picture yourself, and never stop to ask for access to do
1170
+ so. If a picture arrives cut off or too small to read a height, fetch again the tile that covers
1171
+ that part of the sheet (`part=1..9`, left to right, top to bottom) — a shrunk tile turns a height
1172
+ into a smudge, and a truncated one is not the picture at all.
1173
+ 3. **Transcribe every drawn top-of-steel callout on the sheet into a list** — one row per callout:
1174
+ `{ asRead, value, near }`, where `asRead` is the height exactly as drawn, `value` your conversion
1175
+ to world millimetres on the model's datum, and `near` the place its leader lands, in the
1176
+ drawing's own words (the grid intersection, or the member and the grid it is on). Keep the list
1177
+ in your working notes and tell the user how many you found on that sheet. A sheet that states its
1178
+ heights some other way (a general note, a level table) gets no rows here — its scope is read as
1179
+ *Read a callout's SCOPE* above says.
1180
+ 4. **Then give every end on that sheet what the list says about it:**
1181
+ - a callout whose scope plainly governs this end is drawing evidence — record it on the
1182
+ observation (see *Read a callout's SCOPE* above);
1183
+ - otherwise, every row of the list at this end's grid intersection or along this member's line
1184
+ goes on the unknown as `candidates`, nearest first, at most five — see the shape below;
1185
+ - only an end with no row anywhere near it, and that nothing else in the set settles, is a bare
1186
+ unknown with its `why` and `checked`.
1187
+
1188
+ **The failure this procedure exists to stop, measured on a real read:** the reader fetched a roof
1189
+ plan's picture, wrote in its own reason that the sheet *"shows several top-of-steel elevations, and
1190
+ this line cannot be tied confidently to one callout"* — and then set **every** roof end on that
1191
+ sheet with that one sentence, `{"unknown": true}` and **no candidates**. It had read this section.
1192
+ Every one of those ends reached the user as a cold question about a height that was drawn on the
1193
+ sheet it cited. **A blanket unknown over a sheet that carries callouts is the failure, however true
1194
+ its `why`.** If you find yourself composing one rule for all the ends of such a sheet, stop and run
1195
+ the four-step callout procedure above.
1196
+
1197
+ The candidate shape:
1198
+
1163
1199
  - One you read but cannot tie to this end with certainty, or several that could apply, go on the
1164
1200
  unknown as `candidates` (at most five): `{ value, asRead, quote, near, page: { sourceHash, pageId,
1165
1201
  sheet } }`. `value` is your conversion to world millimetres; `asRead` is the height exactly as
package/dist/web/app.css CHANGED
@@ -933,10 +933,10 @@
933
933
  /* resize:vertical, not none: two rows fits the prompt with very little margin, and a font
934
934
  fallback or a user minimum-font-size pushes it to a third — which would otherwise scroll behind
935
935
  a scrollbar with no way to open the box up. */
936
- resize: vertical; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
936
+ resize: vertical; scrollbar-width: thin; scrollbar-color: var(--text-dim) transparent;
937
937
  }
938
938
  .onb-tour-manual::-webkit-scrollbar { width: 9px; }
939
- .onb-tour-manual::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 9px; }
939
+ .onb-tour-manual::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 9px; }
940
940
  .onb-tour-manual::-webkit-scrollbar-track { background: transparent; }
941
941
  .onb-tour-manual:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
942
942
  .onb-tour-hint { flex: 1; font-size: 11px; color: var(--text-dim); font-style: italic; line-height: 1.45; }
@@ -1912,7 +1912,7 @@
1912
1912
  max-height:280px; margin:0; padding:10px 11px; overflow:auto; white-space:pre-wrap;
1913
1913
  border:1px solid var(--border-strong); border-radius:5px; background:var(--surface-2);
1914
1914
  color:var(--text-muted); font:500 11px/1.55 var(--mono);
1915
- scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent;
1915
+ scrollbar-width:thin; scrollbar-color:var(--text-dim) transparent;
1916
1916
  }
1917
1917
  /* Live footnote under a form's fields (formModal `onChange`) — the running cost of what is
1918
1918
  currently picked. Muted and rule-separated because it reports on the form rather than being
@@ -1923,12 +1923,12 @@
1923
1923
  color: var(--text-muted); font: 500 12px/1.5 var(--ui);
1924
1924
  }
1925
1925
  .fm-note::-webkit-scrollbar { width:9px; height:9px; }
1926
- .fm-note::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:5px; }
1926
+ .fm-note::-webkit-scrollbar-thumb { background:var(--text-dim); border-radius:5px; }
1927
1927
  .fm-note::-webkit-scrollbar-track { background:transparent; }
1928
1928
  .fm-omissions {
1929
1929
  max-height:300px; overflow:auto; padding:8px 10px; border:1px solid var(--border-strong);
1930
1930
  border-radius:5px; background:var(--surface-2); scrollbar-width:thin;
1931
- scrollbar-color:var(--border-strong) transparent;
1931
+ scrollbar-color:var(--text-dim) transparent;
1932
1932
  }
1933
1933
  .fm-omission-group + .fm-omission-group { margin-top:12px; padding-top:10px; border-top:1px solid var(--border); }
1934
1934
  .fm-omission-group h4 { margin:0 0 6px; color:var(--text-muted); font:600 11px/1.4 var(--ui); }
@@ -1936,7 +1936,7 @@
1936
1936
  .fm-omission-group ul { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:4px 12px; margin:0; padding:0; list-style:none; }
1937
1937
  .fm-omission-group li { overflow-wrap:anywhere; color:var(--text); font:500 11px/1.45 var(--mono); }
1938
1938
  .fm-omissions::-webkit-scrollbar { width:9px; height:9px; }
1939
- .fm-omissions::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:5px; }
1939
+ .fm-omissions::-webkit-scrollbar-thumb { background:var(--text-dim); border-radius:5px; }
1940
1940
  .fm-omissions::-webkit-scrollbar-track { background:transparent; }
1941
1941
  /* ── formModal `type:'checklist'` — rows that each carry their own state ──────────────────
1942
1942
  Names a SET of checkboxes, so it is a group label rather than a <label for>; styled to match
@@ -3505,10 +3505,10 @@
3505
3505
  .leave-guard-unsaved {
3506
3506
  margin-top: 12px; max-height: 240px; overflow: auto; padding: 8px 12px;
3507
3507
  border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface-2);
3508
- scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
3508
+ scrollbar-width: thin; scrollbar-color: var(--text-dim) transparent;
3509
3509
  }
3510
3510
  .leave-guard-unsaved::-webkit-scrollbar { width: 9px; height: 9px; }
3511
- .leave-guard-unsaved::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
3511
+ .leave-guard-unsaved::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 5px; }
3512
3512
  .leave-guard-unsaved::-webkit-scrollbar-track { background: transparent; }
3513
3513
  .leave-guard-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
3514
3514
  .leave-guard-list li { font: 12.5px/1.45 var(--ui); color: var(--text-muted); padding-left: 12px; position: relative; }
@@ -5369,10 +5369,10 @@ body {
5369
5369
  line-height: 1.45;
5370
5370
  white-space: normal;
5371
5371
  scrollbar-width: thin;
5372
- scrollbar-color: var(--border-strong) transparent;
5372
+ scrollbar-color: var(--text-dim) transparent;
5373
5373
  }
5374
5374
  #graft-instructor-note::-webkit-scrollbar { width: 7px; }
5375
- #graft-instructor-note::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 7px; }
5375
+ #graft-instructor-note::-webkit-scrollbar-thumb { background: var(--text-dim); border-radius: 7px; }
5376
5376
  #graft-instructor-note::-webkit-scrollbar-track { background: transparent; }
5377
5377
  #graft-instructor-note:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
5378
5378
  #graft-instructor-note .ix-chip { display: inline-block; margin-bottom: 4px; }
@@ -5782,15 +5782,23 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
5782
5782
  .tabs.ws-step-tabs button.ws-step-locked { color:var(--text-dim); cursor:not-allowed; opacity:.62; }
5783
5783
  .tabs.ws-step-tabs button.ws-step-locked::before { content:'·'; color:var(--border-strong); margin-right:5px; }
5784
5784
  .tabs.ws-step-tabs button.ws-step-locked:hover { color:var(--text-muted); border-bottom-color:transparent; }
5785
+ /* #1781: the Drawing Filter holds a save that is not finished. Static, the strip's own waiting colour —
5786
+ a pulse would say something is happening, and nothing is until the user answers. */
5787
+ .tabs.ws-step-tabs button[data-filter-pending]::after { content:''; display:inline-block; width:6px; height:6px;
5788
+ margin-left:6px; vertical-align:middle; border-radius:50%; background:var(--warn); }
5789
+ /* The same colours as the strip beside it: a save being written, and one that was refused. */
5790
+ .tabs.ws-step-tabs button[data-filter-pending="saving"]::after { background:var(--accent); }
5791
+ .tabs.ws-step-tabs button[data-filter-pending="blocked"]::after,
5792
+ .tabs.ws-step-tabs button[data-filter-pending="reload"]::after { background:var(--err); }
5785
5793
  .ws-stage-guidance { flex:none; margin:0 14px 8px; padding:8px 11px; border:1px solid var(--border);
5786
5794
  border-left:3px solid var(--accent-dim); border-radius:6px; background:var(--surface-2);
5787
5795
  color:var(--text-muted); font-size:11.5px; line-height:1.45; max-height:min(34vh, 240px);
5788
5796
  overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; scrollbar-gutter:stable;
5789
- scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent; }
5797
+ scrollbar-width:thin; scrollbar-color:var(--text-dim) transparent; }
5790
5798
  .ws-stage-guidance:empty { margin:0; padding:0; border:0; max-height:0; overflow:hidden; }
5791
5799
  .ws-stage-guidance[hidden] { display:none; }
5792
5800
  .ws-stage-guidance::-webkit-scrollbar { width:7px; }
5793
- .ws-stage-guidance::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:7px; }
5801
+ .ws-stage-guidance::-webkit-scrollbar-thumb { background:var(--text-dim); border-radius:7px; }
5794
5802
  .ws-stage-guidance::-webkit-scrollbar-track { background:transparent; }
5795
5803
  .ws-stage-guidance:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
5796
5804
  /* The strip's real width is the viewport minus the user-resizable chat pane, so its own box is the
@@ -6536,11 +6544,11 @@ tr.hist-diff-row[hidden] { display:none; }
6536
6544
  .kb-adjust-input { width:100%; background:var(--surface-2); border:1px solid var(--border-strong); color:var(--text);
6537
6545
  padding:9px 11px; font-family:var(--ui); font-size:13px; border-radius:4px; outline:none; resize:vertical;
6538
6546
  min-height:56px; line-height:1.5; transition:border-color .15s;
6539
- scrollbar-width:thin; scrollbar-color:var(--border-strong) transparent; }
6547
+ scrollbar-width:thin; scrollbar-color:var(--text-dim) transparent; }
6540
6548
  .kb-adjust-input:focus { border-color:var(--accent); }
6541
6549
  .kb-adjust-input:disabled { opacity:.6; cursor:default; }
6542
6550
  .kb-adjust-input::-webkit-scrollbar { width:10px; }
6543
- .kb-adjust-input::-webkit-scrollbar-thumb { background:var(--border-strong); border-radius:6px; }
6551
+ .kb-adjust-input::-webkit-scrollbar-thumb { background:var(--text-dim); border-radius:6px; }
6544
6552
  .kb-adjust-input::-webkit-scrollbar-track { background:transparent; }
6545
6553
  .kb-adjust-foot { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
6546
6554
  .kb-adjust-hint { font-size:11px; color:var(--text-muted); line-height:1.4; }
package/dist/web/aware.js CHANGED
@@ -8659,6 +8659,25 @@
8659
8659
  es.onerror = () => setServerStatus(false); // server unreachable → red; EventSource auto-reconnects (onopen → green)
8660
8660
  }
8661
8661
 
8662
+ // A Request start the chat routes refused with one of the codes below has its own sentence in AI
8663
+ // Chat's table (what happened, and the next step), shown in place of the generic toast: "try again,
8664
+ // reopen FloLess" was the whole message for a refusal no retry could ever pass (#1779). The list is
8665
+ // explicit because that table answers EVERY error with some sentence — an unmapped code gets "could
8666
+ // not complete this chat action" — so any other failure, coded or not (a missing request, an ownership
8667
+ // change, corrupt chat state, a coded 5xx), keeps the generic report and each surface's own fallback.
8668
+ function chatStartErrorText(e) {
8669
+ const explained = ['request-chat-not-runnable', 'request-chat-no-prompt', 'request-background-owned', 'request-chat-conflict',
8670
+ 'request-chat-unscoped', 'request-chat-not-ready', 'request-chat-owner-mismatch', 'local-timeout'];
8671
+ if (!e || !explained.includes(e.code)) return '';
8672
+ try { return String(window.flolessChat?.describeError?.(e) || ''); } catch { return ''; }
8673
+ }
8674
+ function reportChatStartErr(e) {
8675
+ const text = chatStartErrorText(e);
8676
+ if (!text) { reportErr(e); return; }
8677
+ console.warn(e);
8678
+ showToast(text, 'warn');
8679
+ }
8680
+
8662
8681
  function reportErr(e) {
8663
8682
  if (awarePageUnloading && e instanceof TypeError && e.message === 'Failed to fetch') return;
8664
8683
  console.error(e);
@@ -9514,6 +9533,38 @@
9514
9533
  try { target.focus(); } catch { /* focus is best-effort */ }
9515
9534
  }
9516
9535
  }
9536
+ /** The upload modal's one-line summary. "Start it in AI Chat here" only when the chat start route
9537
+ would accept this request (`chatCanStart`, #1779); otherwise the note below says what it needs. */
9538
+ /** What to do about a first read AI Chat refuses (#1779). A pending read blocks a new attach of the
9539
+ same project (409), so every route goes through removing it first; the Requests row offers no
9540
+ Start for a first read, so "start it from Requests" would name a control that is not there. */
9541
+ function firstReadRefusalNextStep(req) {
9542
+ // Same order as the server's refusal ladder: a set that is not all PDF is refused before the
9543
+ // extractor is even asked about, so it must be fixed first.
9544
+ const refs = Array.isArray(req.sourceRefs) ? req.sourceRefs : [];
9545
+ if (refs.length && !refs.every((ref) => /\.pdf$/i.test(String(ref?.name || ref?.path || '')))) {
9546
+ return 'Remove this request in Requests (✕), then attach the drawings again as PDF files.';
9547
+ }
9548
+ if (req.extractorAvailable === false) {
9549
+ return 'Install PyMuPDF for Python on this computer and restart FloLess. Then remove this request in Requests (✕) and attach the drawings again.';
9550
+ }
9551
+ return 'Open Requests to see what it needs.';
9552
+ }
9553
+ function requestHelpSubtitle(req, { n, fileKind, isRevisionRead, canUseManualHandoff, copied }) {
9554
+ return isRevisionRead && !canUseManualHandoff
9555
+ ? `${n} ${fileKind} added to Requests. Open Requests to see the current status and recovery step.`
9556
+ : isRevisionRead
9557
+ ? copied
9558
+ ? req.chatCanStart === true
9559
+ ? `${n} ${fileKind} added to Requests. Start it in AI Chat here, or use the copied terminal instruction.`
9560
+ : `${n} ${fileKind} added to Requests. The note below says what this read needs before it can start.`
9561
+ : `${n} ${fileKind} added to Requests. Copy the request here or from the Requests panel.`
9562
+ : copied
9563
+ ? req.chatCanStart === true
9564
+ ? 'Your request was added to Requests. Start it in AI Chat here, or use the copied terminal instruction.'
9565
+ : 'Your request was added to Requests. The terminal instruction is copied.'
9566
+ : 'Your request was added to Requests. Copy the instructions here or from the Requests panel.';
9567
+ }
9517
9568
  function showRequestQueuedModal(req, opts = {}) {
9518
9569
  const $m = document.getElementById('request-help-modal');
9519
9570
  if (!$m || !req) return;
@@ -9537,17 +9588,7 @@
9537
9588
  ? `${isInitial ? 'Initial drawing read' : 'Updated drawing read'} ready to start`
9538
9589
  : 'Drawing request needs attention'
9539
9590
  : 'Request queued';
9540
- if ($sub) {
9541
- $sub.textContent = isRevisionRead && !canUseManualHandoff
9542
- ? `${n} ${fileKind} added to Requests. Open Requests to see the current status and recovery step.`
9543
- : isRevisionRead
9544
- ? copied
9545
- ? `${n} ${fileKind} added to Requests. Start it in AI Chat here, or use the copied terminal instruction.`
9546
- : `${n} ${fileKind} added to Requests. Copy the request here or from the Requests panel.`
9547
- : copied
9548
- ? 'Your request was added to Requests. Start it in AI Chat here, or use the copied terminal instruction.'
9549
- : 'Your request was added to Requests. Copy the instructions here or from the Requests panel.';
9550
- }
9591
+ if ($sub) $sub.textContent = requestHelpSubtitle(req, { n, fileKind, isRevisionRead, canUseManualHandoff, copied });
9551
9592
  renderRequestHelpGuidance(req);
9552
9593
  // Only a pending drawing read may be handed to another terminal. A future or settled status may
9553
9594
  // already have an owner, so showing Copy here could start a second writer from a stale POST view.
@@ -9629,7 +9670,9 @@
9629
9670
  // is complete, choose Review changes" with "go and nag that conversation", and dropped the
9630
9671
  // failed/unrecognised recovery instructions entirely.
9631
9672
  const chatOwnsRequest = requestRunsInChat(req) && (!isRevisionRead || isPendingRevisionRead);
9632
- const canStartInChat = Boolean((req.project || req.workflowId) && preferredChatProvider()
9673
+ // `chatCanStart` is the chat start route's own verdict, stamped on the view by the server (#1779):
9674
+ // without it an image-only or extractor-less first read was offered a Start that could only 409.
9675
+ const canStartInChat = Boolean((req.project || req.workflowId) && preferredChatProvider() && req.chatCanStart === true
9633
9676
  && !chatOwnsRequest && (!isRevisionRead || req.status === 'pending'));
9634
9677
  const ownerNoun = req.project ? 'project' : 'workflow';
9635
9678
  const canStartUpdatedRead = isRevisionRead && req.status === 'pending' && !isInitial && req.canRun && headlessReady();
@@ -9708,7 +9751,11 @@
9708
9751
  : 'The drawing read failed. Attach the drawing set again from Drawing Filter to retry safely.'
9709
9752
  : isRevisionRead
9710
9753
  ? isInitial
9711
- ? 'FloLess cannot start the first read automatically yet: your terminal AI must create the starting project checkpoint, then wait for you to review and save the Drawing Filter. After you save, tell the terminal AI to continue.'
9754
+ // A first read AI Chat refuses for a reason of its own (#1779): say THAT reason, never the
9755
+ // generic first-read sentence, which would send the person to a terminal that refuses too.
9756
+ ? req.chatCanStart === false && req.runWhy && !req.canRun
9757
+ ? `FloLess cannot start this first drawing read yet: ${req.runWhy}. ${firstReadRefusalNextStep(req)}`
9758
+ : 'FloLess cannot start the first read automatically yet: your terminal AI must create the starting project checkpoint, then wait for you to review and save the Drawing Filter. After you save, tell the terminal AI to continue.'
9712
9759
  : canStartUpdatedRead
9713
9760
  ? 'If a supported terminal AI is available, choose Start automatically. You can also paste the request into your terminal AI. After Save, return to that same terminal AI and tell it to continue; FloLess will show the result here.'
9714
9761
  : req.canRun
@@ -9731,7 +9778,7 @@
9731
9778
  && (requestHelpReq.type !== 'revision-read' || requestHelpReq.status === 'pending') && headlessReady());
9732
9779
  $split.hidden = !can;
9733
9780
  const canChat = Boolean(!requestHelpRunActive && requestHelpReq && (requestHelpReq.project || requestHelpReq.workflowId)
9734
- && preferredChatProvider() && !chatOwns && requestHelpReq.status === 'pending');
9781
+ && preferredChatProvider() && requestHelpReq.chatCanStart === true && !chatOwns && requestHelpReq.status === 'pending');
9735
9782
  $chat.hidden = !canChat;
9736
9783
  $chat.disabled = !!requestHelpBusyMode;
9737
9784
  const provider = canChat ? preferredChatProvider() : null;
@@ -9771,7 +9818,7 @@
9771
9818
  // note AND whether its two Start controls render. Without them another tab starting the request
9772
9819
  // in AI Chat leaves the old handoff modal open with a live Start button on a request that now
9773
9820
  // has an owner — the same stale-repaint defect the revision card's key exists to stop.
9774
- return [r.status, !!r.prepassReady, !!r.filterCheckpointCurrent, !!r.canRun, r.runWhy || '',
9821
+ return [r.status, !!r.prepassReady, !!r.filterCheckpointCurrent, !!r.canRun, r.runWhy || '', !!r.chatCanStart,
9775
9822
  r.run && r.run.state || '', r.resumeCommand || '', !!r.desktopHandoffs,
9776
9823
  r.chatConversation?.executionOwner || '', r.chatConversation?.chatState || ''].join('|');
9777
9824
  }
@@ -11000,11 +11047,12 @@
11000
11047
  } catch (error) {
11001
11048
  if (error?.code === 'chat-start-cancelled') return;
11002
11049
  const notReady = error?.code === 'chat-runtime-not-ready';
11050
+ const explained = notReady ? '' : chatStartErrorText(error);
11003
11051
  if (notReady) showToast(error.message, 'warn');
11004
- else reportErr(error);
11052
+ else reportChatStartErr(error);
11005
11053
  if (actionStatus) actionStatus.textContent = notReady
11006
11054
  ? error.message
11007
- : `Couldn’t ${starting ? 'start' : 'open'} ${requestLabel(request)} in AI Chat. Try again.`;
11055
+ : explained || `Couldn’t ${starting ? 'start' : 'open'} ${requestLabel(request)} in AI Chat. Try again.`;
11008
11056
  if (notReady || !button.isConnected) {
11009
11057
  endStart();
11010
11058
  renderRequests();
@@ -12459,9 +12507,17 @@
12459
12507
  const epoch = (completeReportDiscoveryEpoch.get(id) || 0) + 1;
12460
12508
  completeReportDiscoveryEpoch.set(id, epoch);
12461
12509
  const previous = completeReportDiscovery.get(id);
12462
- completeReportDiscovery.set(id, { checking: true });
12463
- if ($routinesModal.classList.contains('show')) renderRoutinesList();
12510
+ // A row already saying "being prepared" keeps saying it while it asks again (no flicker).
12511
+ if (!previous?.starting) {
12512
+ completeReportDiscovery.set(id, { checking: true });
12513
+ if ($routinesModal.classList.contains('show')) renderRoutinesList();
12514
+ }
12464
12515
  try {
12516
+ const starting = await savedReportsStillStarting();
12517
+ if (starting) {
12518
+ if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
12519
+ return noteReportStillStarting(id, epoch, previous, starting === 'paused');
12520
+ }
12465
12521
  const canHttpBootstrap = await ensureReportDiscoverySession();
12466
12522
  let result;
12467
12523
  try { result = await api(`/api/routines/${encodeURIComponent(id)}/complete-report`); }
@@ -12483,6 +12539,12 @@
12483
12539
  return result;
12484
12540
  } catch (error) {
12485
12541
  if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
12542
+ if (error.body?.code === 'model-report-recovery-pending') {
12543
+ // Reports were paused again after start-up (a later check failed): same neutral, self-retrying
12544
+ // row, and the cached report stays — "not ready yet" is not evidence that it is gone.
12545
+ reportsMaybeStarting = true;
12546
+ return noteReportStillStarting(id, epoch, previous, true);
12547
+ }
12486
12548
  const message = error.status === 401 ? 'Sign in again to view saved reports.'
12487
12549
  : 'Could not check this report. Check your access and try again.';
12488
12550
  completeReportDiscovery.set(id, { error: message });
@@ -12499,6 +12561,51 @@
12499
12561
  return null;
12500
12562
  }
12501
12563
 
12564
+ // Saved model reports are verified AFTER the server starts listening (#1826), so for a while after
12565
+ // FloLess starts, report discovery is not ready yet. That is a normal state, not an access problem:
12566
+ // a routine's row says so in neutral words and asks again on its own.
12567
+ const REPORT_STARTING_NOTE = 'Getting your saved report ready… This updates on its own.';
12568
+ const REPORT_STARTING_STUCK_NOTE = 'Your saved report is still being prepared. FloLess keeps checking; if this does not clear, use Report an issue.';
12569
+ const REPORT_STARTING_STUCK_AFTER_MS = 10 * 60 * 1000;
12570
+ // True until /api/health says saved reports are ready. While it may be false we ask health first, so
12571
+ // a page opened during start-up never sends a discovery request that would only be refused.
12572
+ let reportsMaybeStarting = true;
12573
+
12574
+ /** null when saved reports are ready (or health cannot say); otherwise 'checking' or 'paused'. */
12575
+ async function savedReportsStillStarting() {
12576
+ if (!reportsMaybeStarting) return null;
12577
+ try {
12578
+ const response = await fetch('/api/health', { cache: 'no-store' });
12579
+ if (!response.ok) return null;
12580
+ const state = (await response.json())?.startup?.reports;
12581
+ // An older server has no startup field: it only ever answers once reports are ready.
12582
+ if (state === undefined || state === 'ready') { reportsMaybeStarting = false; return null; }
12583
+ return state === 'paused' ? 'paused' : 'checking';
12584
+ } catch { return null; } // the discovery request below then reports any real problem
12585
+ }
12586
+
12587
+ /** Show the neutral "being prepared" row and ask again later; superseded by any newer refresh. */
12588
+ function noteReportStillStarting(id, epoch, previous, paused) {
12589
+ const attempts = previous?.starting ? previous.attempts + 1 : 0;
12590
+ const startingSince = previous?.starting ? previous.startingSince : Date.now();
12591
+ // "paused" means the server already knows a check failed and is retrying: say so at once.
12592
+ const stuck = paused || Date.now() - startingSince > REPORT_STARTING_STUCK_AFTER_MS;
12593
+ const next = { starting: true, attempts, startingSince, note: stuck ? REPORT_STARTING_STUCK_NOTE : REPORT_STARTING_NOTE };
12594
+ completeReportDiscovery.set(id, next);
12595
+ // Repaint only when what the row says changes, so a screen reader is not told the same thing again
12596
+ // on every retry.
12597
+ if ($routinesModal.classList.contains('show') && previous?.note !== next.note) renderRoutinesList();
12598
+ // Ask again only while the Routines list is open. Closed, nothing shows the row; reopening it, the
12599
+ // server's "reports ready" broadcast, and View report all check again anyway.
12600
+ const delay = Math.min(5000 * 2 ** attempts, 30_000);
12601
+ setTimeout(() => {
12602
+ if (completeReportDiscoveryEpoch.get(id) === epoch && $routinesModal.classList.contains('show')) {
12603
+ void refreshRoutineReportDiscovery(id);
12604
+ }
12605
+ }, delay);
12606
+ return next;
12607
+ }
12608
+
12502
12609
  async function viewScheduledCompleteReport(id) {
12503
12610
  const r = routinesData.find((item) => item.id === id);
12504
12611
  if (!isCompleteReportRoutine(r)) return;
@@ -12506,6 +12613,10 @@
12506
12613
  if (currentId !== r.workflow) return;
12507
12614
  // Recheck at the moment of opening; a cached handle is never an authorization grant.
12508
12615
  const state = await refreshRoutineReportDiscovery(id);
12616
+ if (state?.starting) {
12617
+ showToast('Your saved report is still being prepared. It will be ready in a moment.', 'info');
12618
+ return;
12619
+ }
12509
12620
  if (!state?.report) {
12510
12621
  showToast('This saved report is no longer available. Check your access or run the routine again.', 'warn');
12511
12622
  return;
@@ -12936,7 +13047,9 @@
12936
13047
  const isTrigger = r.kind === 'trigger';
12937
13048
  const isCompleteReport = isCompleteReportRoutine(r);
12938
13049
  const discovery = isCompleteReport ? completeReportDiscovery.get(r.id) : null;
12939
- const reportLine = !isCompleteReport ? '' : discovery?.checking
13050
+ const reportLine = !isCompleteReport ? '' : discovery?.starting
13051
+ ? `<div class="rtn-report-note" role="status">${escapeHtml(discovery.note)}</div>`
13052
+ : discovery?.checking
12940
13053
  ? '<div class="rtn-report-note">Checking saved report access…</div>'
12941
13054
  : discovery?.error
12942
13055
  ? `<div class="rtn-report-note warn" role="status">${escapeHtml(discovery.error)}</div>`
@@ -13810,14 +13923,18 @@
13810
13923
  } catch (error) {
13811
13924
  if (error?.code === 'chat-start-cancelled' || gone()) return;
13812
13925
  const notReady = error?.code === 'chat-runtime-not-ready';
13926
+ const explained = notReady ? '' : chatStartErrorText(error);
13813
13927
  if (notReady) showToast(error.message, 'warn');
13814
- else reportErr(error);
13928
+ else reportChatStartErr(error);
13815
13929
  setRequestHelpBusy(null);
13816
13930
  const sub = document.getElementById('request-help-sub');
13817
- if (sub) sub.textContent = notReady ? error.message : requestHelpCopied
13931
+ if (sub) sub.textContent = notReady ? error.message : explained || (requestHelpCopied
13818
13932
  ? 'The request is still in Requests. Try again, start it in the background, or use the copied instruction in your terminal.'
13819
- : 'The request is still in Requests. Try again, start it in the background, or copy the terminal instruction.';
13820
- if ($requestHelpCopy && !requestHelpCopied) $requestHelpCopy.hidden = false;
13933
+ : 'The request is still in Requests. Try again, start it in the background, or copy the terminal instruction.');
13934
+ // A Request with no safe instruction has nothing to copy either — AI Chat's sentence says to
13935
+ // clear it and create it again, so offering Copy would contradict it.
13936
+ if ($requestHelpCopy && error?.code === 'request-chat-no-prompt') $requestHelpCopy.hidden = true;
13937
+ else if ($requestHelpCopy && !requestHelpCopied) $requestHelpCopy.hidden = false;
13821
13938
  $requestHelpChat.focus();
13822
13939
  }
13823
13940
  };
@@ -14391,6 +14508,23 @@
14391
14508
  && (request.run?.state === 'queued' || request.run?.state === 'running' || request.run?.state === 'needs-you'
14392
14509
  || request.run?.handoffReady || request.run?.recoveryReady || request.run?.processContained === false));
14393
14510
  },
14511
+ // #1776: the drawing read AI Chat is running in this conversation (a revision-read, or a rebake,
14512
+ // which is a read too), while it is still reading — the only listener a message typed there can
14513
+ // be answering once its turn has stopped on a question. Server-owned facts only: the read's own
14514
+ // chat link (`executionOwner: 'chat'`) and its status. A read whose prepass is ready but whose
14515
+ // Drawing Filter is not yet saved is waiting for Save, not for a reply, so it does not claim the
14516
+ // composer: the Drawing Filter's own AI is the one to ask then. A read whose chat reply failed or
14517
+ // was interrupted DOES claim it: the Requests window tells the person to ask that conversation
14518
+ // to try again or continue, and that message is a turn in this conversation, not a filter
14519
+ // question. (Recovery and archived conversations disable the composer, so they never get here.)
14520
+ readInChat(chatId) {
14521
+ if (!chatId) return null;
14522
+ const read = pendingRequests.find((request) => request
14523
+ && (request.type === 'revision-read' || request.type === 'rebake') && request.status === 'pending'
14524
+ && request.chatConversation?.executionOwner === 'chat' && request.chatConversation.chatId === chatId
14525
+ && !(request.prepassReady && !request.filterCheckpointCurrent));
14526
+ return read ? { requestId: read.id } : null;
14527
+ },
14394
14528
  // ── Workspaces guide beacon (the SAME #guide-beacon/#guide-modal, document variant) ──
14395
14529
  // workspaces.js owns the open project + its lifecycle state; aware.js owns the beacon
14396
14530
  // chrome. workspaces.js calls setWorkspaceGuide() with a small snapshot whenever the
package/dist/web/chat.css CHANGED
@@ -67,6 +67,9 @@
67
67
  --text-muted: #c3ccd9;
68
68
  --text-dim: #8996a8;
69
69
  }
70
+ /* Those two tints are for the dark surface; on the light one they wash muted copy and ghost buttons out,
71
+ so the light theme keeps its own. */
72
+ [data-theme="light"] .ai-chat-shell, [data-theme="light"] .ai-chat-controls { --text-muted: inherit; --text-dim: inherit; }
70
73
  .ai-chat-controls .narrative-tabs { flex: 1; min-width: 0; }
71
74
  .ai-chat-controls .narrative-tab { color: var(--text-muted); }
72
75
  .ai-chat-tab-actions { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
@@ -263,7 +266,7 @@
263
266
  background: var(--surface-2);
264
267
  box-shadow: 0 14px 34px rgba(0, 0, 0, .42);
265
268
  scrollbar-width: thin;
266
- scrollbar-color: var(--border-strong) var(--surface-2);
269
+ scrollbar-color: var(--text-dim) var(--surface-2);
267
270
  }
268
271
  .ai-chat-picker[hidden] { display: none; }
269
272
  .ai-chat-picker::-webkit-scrollbar,
@@ -283,6 +286,12 @@
283
286
  .ai-chat-feed::-webkit-scrollbar-thumb,
284
287
  .ai-chat-settings::-webkit-scrollbar-thumb,
285
288
  .ai-chat-skills::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 7px; }
289
+ /* The picker, the skills list and the composer sit on --surface-2, which in the dark theme is the
290
+ SAME colour as --border-strong: that thumb was invisible (#1768). --text-dim is the app's own
291
+ hover-thumb token and reads on --surface-2 in both themes. */
292
+ .ai-chat-picker::-webkit-scrollbar-thumb,
293
+ .ai-chat-skills::-webkit-scrollbar-thumb,
294
+ #chat-input::-webkit-scrollbar-thumb { background: var(--text-dim); }
286
295
  .ai-chat-choice {
287
296
  appearance: none;
288
297
  width: 100%;
@@ -725,9 +734,9 @@
725
734
  .ai-chat-filter-card-head strong { font-weight: 600; }
726
735
  .ai-chat-filter-state { color: var(--text-dim); font: 600 8px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
727
736
  .ai-chat-filter-changes { display: flex; flex-direction: column; gap: 4px; max-height: 180px; margin: 8px 0 0; padding: 0; overflow-y: auto; list-style: none;
728
- scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface-2); }
737
+ scrollbar-width: thin; scrollbar-color: var(--text-dim) var(--surface-2); }
729
738
  .ai-chat-filter-changes::-webkit-scrollbar { width: 8px; }
730
- .ai-chat-filter-changes::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--border-strong); }
739
+ .ai-chat-filter-changes::-webkit-scrollbar-thumb { border-radius: 4px; background: var(--text-dim); }
731
740
  .ai-chat-filter-changes::-webkit-scrollbar-track { background: var(--surface-2); }
732
741
  .ai-chat-filter-change { display: flex; gap: 6px; color: var(--text); font-size: 11px; line-height: 15px; overflow-wrap: anywhere; }
733
742
  .ai-chat-filter-change-glyph { flex: none; width: 1em; color: var(--text-muted); font: 11px/15px var(--mono); text-align: center; }
@@ -983,6 +992,9 @@
983
992
  border-left-color: var(--warn);
984
993
  background: color-mix(in srgb, var(--warn) 8%, var(--surface-2));
985
994
  }
995
+ /* The light theme's muted grey reads at about 4.1:1 on these tints, under the 4.5:1 small text needs, so a receipt
996
+ takes the darker slate the light palette already has. */
997
+ [data-theme="light"] .ai-chat-tekla-read { --text-muted: #475569; }
986
998
  .ai-chat-tekla-read > strong { font-size: 11px; font-weight: 600; }
987
999
  .ai-chat-tekla-read p { margin: 0; color: var(--text-muted); }
988
1000
  .ai-chat-tekla-read dl {
@@ -1038,6 +1050,52 @@
1038
1050
  .ai-chat-tekla-parts td.profile { font-family: var(--mono); }
1039
1051
  .ai-chat-tekla-parts .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
1040
1052
  .ai-chat-tekla-parts td.empty { color: var(--text-dim, var(--text-muted)); }
1053
+ /* Questions in chat about the parts a Tekla read listed (#1653 stage 4): the shared card (web/model-chat-questions.js)
1054
+ on the newest selection receipt. A hairline and unboxed rows read as the history of these parts, not as part of the
1055
+ read's result (the facts and the table are the inset panels). The rule mixes --text-dim, as the plain border tokens
1056
+ vanish on the receipt's tint in both themes. */
1057
+ .ai-chat-tekla-history { --q-rule: color-mix(in srgb, var(--text-dim) 38%, transparent);
1058
+ min-width: 0; margin-top: 3px; padding-top: 8px; border-top: 1px solid var(--q-rule);
1059
+ display: flex; flex-direction: column; gap: 6px; }
1060
+ .ai-chat-tekla-history[hidden] { display: none; }
1061
+ .ai-chat-tekla-read .ai-chat-tekla-history-note { font-size: 10px; }
1062
+ .ai-chat-tekla-history .chat-questions { min-width: 0; }
1063
+ .ai-chat-tekla-history .chat-q-title { margin: 0 0 4px; color: var(--text-muted); font-size: 9px;
1064
+ letter-spacing: .04em; text-transform: uppercase; overflow-wrap: anywhere; }
1065
+ .ai-chat-tekla-history .chat-q { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px;
1066
+ align-items: start; padding: 5px 0; border-bottom: 1px solid var(--q-rule); }
1067
+ .ai-chat-tekla-history .chat-q:last-child { border-bottom: 0; }
1068
+ .ai-chat-tekla-history .chat-q-note, .ai-chat-tekla-history .chat-q-ai { grid-column: 1; min-width: 0;
1069
+ display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
1070
+ .ai-chat-tekla-history .chat-q-note { color: var(--text); font-size: 11px; }
1071
+ .ai-chat-tekla-history .chat-q-ai { color: var(--text-muted); font-size: 10px; font-style: italic; }
1072
+ .ai-chat-tekla-history .chat-q-meta, .ai-chat-tekla-history .chat-q-about { grid-column: 1; min-width: 0;
1073
+ overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
1074
+ .ai-chat-tekla-history .chat-q-show, .ai-chat-tekla-history .chat-q-failed .ghost { appearance: none; flex: none;
1075
+ min-height: 24px; padding: 3px 7px; border: 1px solid var(--border-strong); border-radius: 4px;
1076
+ background: var(--surface-2); color: var(--text-muted); font: 10px/1.35 var(--ui); white-space: nowrap; cursor: pointer; }
1077
+ .ai-chat-tekla-history .chat-q-show { grid-column: 2; align-self: start; }
1078
+ .ai-chat-tekla-history .chat-q-show:hover, .ai-chat-tekla-history .chat-q-failed .ghost:hover { background: var(--surface-3); color: var(--text); }
1079
+ .ai-chat-tekla-history .chat-q-show:focus-visible, .ai-chat-tekla-history .chat-q-failed .ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
1080
+ /* The global .hint is centred, italic and padded for empty panels; here it is one plain line with Retry. */
1081
+ .ai-chat-tekla-history .chat-q-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0;
1082
+ color: var(--text-muted); font-size: 10px; font-style: normal; text-align: left; }
1083
+ .ai-chat-tekla-history .chat-q-more > summary, .ai-chat-tekla-history .chat-q-orphans > summary { display: flex;
1084
+ align-items: baseline; min-height: 24px; padding: 3px 2px; color: var(--text-muted); font-size: 10px;
1085
+ line-height: 1.35; list-style: none; cursor: pointer; user-select: none; }
1086
+ .ai-chat-tekla-history .chat-q-more > summary::-webkit-details-marker, .ai-chat-tekla-history .chat-q-orphans > summary::-webkit-details-marker { display: none; }
1087
+ .ai-chat-tekla-history .chat-q-more > summary::before, .ai-chat-tekla-history .chat-q-orphans > summary::before {
1088
+ content: '\25B8'; flex: none; margin-right: 6px; transition: transform .12s ease; }
1089
+ .ai-chat-tekla-history details[open] > summary::before { transform: rotate(90deg); }
1090
+ .ai-chat-tekla-history .chat-q-more > summary:hover, .ai-chat-tekla-history .chat-q-orphans > summary:hover { color: var(--text); }
1091
+ .ai-chat-tekla-history .chat-q-more > summary:focus-visible, .ai-chat-tekla-history .chat-q-orphans > summary:focus-visible {
1092
+ outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
1093
+ @media (prefers-reduced-motion: reduce) { .ai-chat-tekla-history summary::before { transition: none; } }
1094
+ /* A narrow pane stacks Show in chat under the text (the card sets each button's row span inline). */
1095
+ @container aiChatFeed (max-width: 330px) {
1096
+ .ai-chat-tekla-history .chat-q { grid-template-columns: minmax(0, 1fr); }
1097
+ .ai-chat-tekla-history .chat-q-show { grid-column: 1; grid-row: auto !important; justify-self: end; margin-top: 3px; }
1098
+ }
1041
1099
 
1042
1100
  .ai-chat-skills {
1043
1101
  position: absolute;
@@ -1053,7 +1111,7 @@
1053
1111
  background: var(--surface-2);
1054
1112
  box-shadow: 0 -12px 30px rgba(0, 0, 0, .35);
1055
1113
  scrollbar-width: thin;
1056
- scrollbar-color: var(--border-strong) var(--surface-2);
1114
+ scrollbar-color: var(--text-dim) var(--surface-2);
1057
1115
  }
1058
1116
  .ai-chat-skills[hidden] { display: none; }
1059
1117
  .ai-chat-skill-origin { color: var(--text-dim); font: 8px/1.3 var(--mono); text-transform: uppercase; }
@@ -1080,7 +1138,7 @@
1080
1138
  font: 12px/1.45 var(--ui);
1081
1139
  caret-color: var(--accent);
1082
1140
  scrollbar-width: thin;
1083
- scrollbar-color: var(--border-strong) var(--surface-2);
1141
+ scrollbar-color: var(--text-dim) var(--surface-2);
1084
1142
  }
1085
1143
  #chat-input::placeholder { color: var(--text-dim); }
1086
1144
  #chat-input:disabled { opacity: .52; cursor: not-allowed; }