@floless/app 0.163.0 → 0.165.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.
@@ -1407,6 +1407,8 @@ rect.lblhot:focus-visible{outline:2px solid var(--brand);outline-offset:2px;stro
1407
1407
  tags for the metadata line. */
1408
1408
  #rfiStat b{color:var(--ok)} /* nothing outstanding — the resolved state */
1409
1409
  #rfiStat.has b{color:var(--warn)} /* …and "needs review", never an error */
1410
+ /* #2920: a green 0 beside questions nobody filed would read as all-clear, so the 0 goes muted and the second figure warns. */
1411
+ #rfiStat.readq:not(.has) #rc{color:var(--mut)} #rfiStat .rcread{color:var(--mut);font-weight:400} #rfiStat .rcread b{color:var(--warn)}
1410
1412
  #rfiStat.unknown::after{content:'!';display:inline-grid;place-items:center;width:14px;height:14px;margin-left:4px;border:1px solid color-mix(in srgb,var(--warn) 72%,transparent);border-radius:999px;color:var(--warn);font-size:10px;font-weight:800;line-height:1;background:color-mix(in srgb,var(--warn) 12%,transparent)}
1411
1413
  /* #2450 — the Raise an RFI dialog wears the RFI list's own rows, chips, notes and forms. */
1412
1414
  #rfiRaiseModal{position:fixed;inset:0;z-index:20;display:none;align-items:center;justify-content:center}
@@ -1450,6 +1452,7 @@ rect.lblhot:focus-visible{outline:2px solid var(--brand);outline-offset:2px;stro
1450
1452
  #rfiList .rfirow+.rfirow{border-top:1px solid var(--line)}
1451
1453
  #rfiList .rfirow:hover{background:var(--hover-soft)}
1452
1454
  #rfiList .rfirow:focus-within{outline:2px solid var(--brand);outline-offset:-2px}
1455
+ #rfiList .rfirow.is-mentioned{outline:2px solid var(--brand);outline-offset:-2px}
1453
1456
  /* The status badge. A SIZE symptom is dashed — it is not filed yet, and the canvas already spells
1454
1457
  "unresolved" as a dash everywhere else (line.member.rfi, polygon.member.rfi). A record's badge is
1455
1458
  a solid outline, so "filed" and "not filed" are told apart by SHAPE and survive losing colour. */
@@ -1474,6 +1477,11 @@ rect.lblhot:focus-visible{outline:2px solid var(--brand);outline-offset:2px;stro
1474
1477
  #rfiList .rfiunfiled>.rfinote,#rfiList .rfiunfiled>.rfiacts{padding:0 8px}
1475
1478
  #rfiList .rfiunfiled .rfiwhy{color:var(--warn)}
1476
1479
  #rfiList .rfiunfiled b.rfiwarn{color:var(--warn)}
1480
+ /* #2920: the read's unfiled questions, one block per kind; long kinds open on request. */
1481
+ #rfiList .rfiread:focus{outline:none}
1482
+ #rfiList .rfireadgroup{padding:6px 8px 2px;border-top:1px dashed var(--line);margin-top:6px}
1483
+ #rfiList .rfireadgroup .rfirow{padding-left:0;padding-right:0}
1484
+ #rfiList .rfireadhead{font-size:12px;line-height:1.5} #rfiList .rfireadn{color:var(--mut)}
1477
1485
  #rfiList .rfiacts{margin-top:6px;display:flex;flex-wrap:wrap;gap:5px;align-items:center}
1478
1486
  #rfiList .rfiacts button{font-size:11px;padding:3px 8px}
1479
1487
  #rfiList .rfiacts [aria-disabled=true]{opacity:.48;cursor:progress;background:var(--btn);border-color:var(--ctrl-border)}
@@ -1877,6 +1885,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1877
1885
  /* Same trap: "Send selection to Tekla" is hidden with an empty selection, and plain [hidden] loses
1878
1886
  to the #moreMenu rule above — without this it ships as a visible row that only scolds you. */
1879
1887
  #moreMenu #sendTeklaB[hidden],#moreMenu #sendRevitB[hidden],#moreMenu #sendSketchupB[hidden],#moreMenu #sendRhinoB[hidden]{display:none}
1888
+ #moreMenu #aiMarksToggleB[hidden]{display:none} /* #2521 row 6: the AI decisions switch exists only on a model with marks */
1880
1889
  #moreMenu button:disabled{opacity:.4;cursor:default;background:transparent}
1881
1890
  #moreMenu button.on{color:var(--brand)}
1882
1891
  button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
@@ -1890,6 +1899,27 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1890
1899
  #srcStat{white-space:nowrap}
1891
1900
  /* #2521 row 5: the Quick model chip. Amber (= needs review, never an error), as last saved; dashed when unknown. */
1892
1901
  #quickStat{white-space:nowrap;color:var(--warn)}
1902
+ /* #2521 row 6: the AI-decision marks (an open square at an end, a ring at a joint) and the strip. Tokens only. */
1903
+ .ai-end-mark{fill:var(--panel);fill-opacity:.85;stroke:var(--warn);pointer-events:none}
1904
+ .ai-joint-mark{fill:none;stroke:var(--warn);pointer-events:none}
1905
+ /* Above #bottomDock (bottom 12px, its bars 36px tall), never under its hint or the Select/Snap bars, in 2D, 3D and split. */
1906
+ .ai-strip{position:absolute;left:12px;bottom:56px;z-index:6;max-width:min(620px,calc(100% - 20px));background:var(--panel);border:1px solid var(--warn-edge);border-radius:6px;padding:5px 9px;font-size:11.5px;line-height:1.45;color:var(--mut);box-shadow:0 2px 8px rgba(0,0,0,.25)}
1907
+ .ai-strip[hidden]{display:none}
1908
+ .ai-strip .ai-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
1909
+ .ai-strip .ai-lead{color:var(--warn);font-weight:600}
1910
+ .ai-strip .ai-key{display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
1911
+ .ai-strip .ai-key svg{flex:none}
1912
+ .ai-strip .ai-key .sq{fill:var(--panel);stroke:var(--warn);stroke-width:1.5}
1913
+ .ai-strip .ai-key .rg{fill:none;stroke:var(--warn);stroke-width:1.5}
1914
+ .ai-strip .chip.assumed{margin:0;cursor:default}
1915
+ .ai-strip .ai-more{border:0;background:transparent;color:var(--text);font:inherit;text-decoration:underline;text-underline-offset:2px;padding:0 2px;cursor:pointer}
1916
+ .ai-strip .ai-more:focus-visible,.ai-strip .chip:focus-visible,.v2-ai-decisions:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
1917
+ .ai-strip .ai-details{margin-top:5px;padding-top:5px;border-top:1px solid var(--line);max-height:40vh;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
1918
+ .ai-strip .ai-details::-webkit-scrollbar{width:8px}.ai-strip .ai-details::-webkit-scrollbar-thumb{background:var(--line);border-radius:4px}.ai-strip .ai-details::-webkit-scrollbar-track{background:transparent}
1919
+ .ai-strip .ai-details ul{margin:0 0 4px;padding-left:16px}
1920
+ .v2-ai-decisions .ai-head{display:flex;align-items:center;gap:6px;margin-bottom:2px}
1921
+ .v2-ai-decisions .ai-row{margin:2px 0}
1922
+ .v2-ai-decisions .ai-foot{color:var(--mut);margin-top:3px}
1893
1923
  #quickStat.is-unknown{text-decoration:underline dashed;text-underline-offset:3px}
1894
1924
  .conf-quick{margin:0 0 8px;padding:6px 10px;border:1px solid var(--warn-edge);border-radius:6px;color:var(--mut);font-size:12px;line-height:1.45}
1895
1925
  .conf-quick b{color:var(--warn)}
@@ -2985,7 +3015,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
2985
3015
  <div class=statgrp id=qualGrp>
2986
3016
  <button data-command-id="steel.quality-stats" type=button class="stat statgrp-btn" id=qualBtn aria-expanded=false aria-controls=qualPanel data-tip="What is unresolved on this sheet — RFI, duplicates, member ends, and how well the drawing was read">Quality <b id=qualN>0</b></button>
2987
3017
  <div class=statgrp-panel id=qualPanel hidden>
2988
- <button data-command-id="steel.rfi-list" class="stat act" id=rfiStat aria-expanded="false" aria-controls="rfiModal" data-tip="List every RFI — a question for an engineer, or a member whose size FloLess cannot price"><span class=k>RFI</span><span class=v><b id=rc>0</b></span></button>
3018
+ <button data-command-id="steel.rfi-list" class="stat act" id=rfiStat aria-expanded="false" aria-controls="rfiModal" data-tip="List every RFI — a question for an engineer, or a member whose size FloLess cannot price"><span class=k>RFI</span><span class=v><b id=rc>0</b><span id=rcRead class=rcread style="display:none"> · <b id=rcReadN>0</b> not filed</span></span></button>
2989
3019
  <span class=stat id=dupStat data-tip="Overlapping/duplicate members (same geometry)"><span class=k>Duplicates</span><span class=v><b id=dpc>0</b></span></span>
2990
3020
  <span class=stat id=endsStat data-tip="Member ends that may stop at a support face instead of its centerline."><span class=k>Member ends</span><span class=v><b id=endsCount>—</b></span></span>
2991
3021
  <!-- Written by refresh() and shown only when every count above is zero. A panel of four zeroes states
@@ -3070,6 +3100,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
3070
3100
  to 16 — then jumped on the first drag. One authority on what a legal size is. -->
3071
3101
  <div class=mrow><span class=mlbl>Grid label size</span><input data-command-id="steel.grid-label-size" id=gridLabelSize type=range min=14 max=48 step=1 aria-label="Grid label size in pixels" data-tip="How big the grid bubbles are drawn, in both 2D and 3D. Like a CAD drawing they hold this size on screen however far you zoom in or out."><span id=gridLabelSizeV class=mval>26 px</span></div>
3072
3102
  <button data-command-id="steel.position-gizmo" id=posGizmoToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show a drag handle on the selected member for moving it and rolling its section right in the 3D view"><span class=mck aria-hidden=true></span>Position handle</button>
3103
+ <button data-command-id="steel.show-ai-decisions" id=aiMarksToggleB class=dtog role=menuitemcheckbox aria-checked=true hidden data-tip="Marks the member ends and connections where the AI made a decision in this Quick model, in 2D and 3D. The AI decisions strip and Inspect stay either way."><span class=mck aria-hidden=true></span>AI decisions</button>
3073
3104
  <div class=pl-section id=plSection>
3074
3105
  <div class=pl-header><button data-command-id="steel.property-label-visibility#Display" id=plToggleB class=dtog role=menuitemcheckbox aria-checked=true aria-label="Property labels in the active view" data-tip="Show or hide labels here without losing their settings. The 2D plan, the 3D default and each saved 3D view have their own switch and choice of members; the properties shown are shared."><span class=mck aria-hidden=true></span></button>
3075
3106
  <button data-command-id="steel.property-label-settings#Display" id=plDisclosure class=pl-disclosure aria-expanded=false aria-controls=plScope data-tip="Choose which members have property labels">Property labels<span class=pl-chevron aria-hidden=true>▸</span></button></div>
@@ -3138,6 +3169,9 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
3138
3169
  #stage3d keeps position:absolute;inset:0, which is what lets the 3D engine's resize() and its
3139
3170
  ResizeObserver(canvas.parentElement) keep working untouched — they now measure #pane3d. -->
3140
3171
  <div id=stagewrap>
3172
+ <!-- #2521 row 6: the AI decisions strip. Always shown for a Quick (or possibly Quick) model, whatever is selected and
3173
+ whether or not the marks are switched on: it is where "unmarked members may still rest on AI decisions" lives. -->
3174
+ <div id=aiStrip class=ai-strip role=note aria-label="AI decisions in this model" hidden></div>
3141
3175
  <div id=pane2d>
3142
3176
  <div id=stage><svg id=svg tabindex=-1 aria-label="2D model plan"></svg></div>
3143
3177
  <!-- #935: this sheet's registration is present and REFUSED, so the steel on screen may be metres from
@@ -3622,15 +3656,17 @@ const EditorFocus = (() => {
3622
3656
  Promise.resolve().then(() => runner(job.req, current)).then(
3623
3657
  (outcome) => vacate(job, current() && outcome ? outcome : { superseded: true }),
3624
3658
  // The runner shows its own sentences; this is only the last line of defence, so the caller is never left waiting.
3625
- (error) => { console.error('[steel] could not show the connection asked for', error); vacate(job, current() ? { ok: false, said: job.req.memberId ? 'The model could not show member ' + job.req.memberId + '. Press Show in the model again, or find it in the Model panel.' : 'The model could not show connection ' + job.req.jointId + '. Press Open in the model again, or find it in the Model panel.' } : { superseded: true }); });
3659
+ (error) => { console.error('[steel] could not show the connection asked for', error); vacate(job, current() ? { ok: false, said: job.req.rfiId ? 'FloLess could not show ' + job.req.rfiId + '. Find it on the RFIs page, or press it in the chat again.' : job.req.memberId ? 'The model could not show member ' + job.req.memberId + '. Press Show in the model again, or find it in the Model panel.' : 'The model could not show connection ' + job.req.jointId + '. Press Open in the model again, or find it in the Model panel.' } : { superseded: true }); });
3626
3660
  };
3627
3661
  window.flolessEditorState = { project: PROJECT, ready: false };
3628
3662
  const text = (value) => typeof value === 'string' && value ? value : '';
3629
3663
  // #2450: a request may also ask to raise an RFI, and name the check to show first.
3630
3664
  // #2471: or name one member (an AI Chat answer's cited member) instead of a connection.
3665
+ // #2874: or one RFI a chat message mentioned, shown on this project's RFIs page.
3631
3666
  const normalise = (req) => req && text(req.jointId)
3632
3667
  ? { jointId: req.jointId, ...(req.raiseRfi === true ? { raiseRfi: true } : {}), ...(text(req.checkId) ? { checkId: req.checkId } : {}) }
3633
- : req && text(req.memberId) ? { memberId: req.memberId } : null;
3668
+ : req && text(req.memberId) ? { memberId: req.memberId }
3669
+ : req && text(req.rfiId) && /^RFI-\d{3,16}$/.test(req.rfiId) ? { rfiId: req.rfiId } : null;
3634
3670
  window.flolessEditorFocus = (req) => {
3635
3671
  if (!normalise(req)) return false;
3636
3672
  const id = typeof req.requestId === 'string' && req.requestId ? req.requestId : 'editor-' + (++made);
@@ -4031,6 +4067,7 @@ let GridDisplay = null; // grid-display.js — the Grid pane's ONE boundary betw
4031
4067
  // directly above: a deferred module script binds AFTER boot() has drawn, and the vm harness cannot see it.
4032
4068
  let ViewGen = null; // steel-view-generation.js pure F11 helpers — loaded before saved views are sanitised
4033
4069
  let ModelCmd = null; // steel-model-commands.js — the model boundary's WRITE half (unit 5, P3a); the read half is steel-model-adapter.js
4070
+ let AiMarks = null; // steel-ai-marks.js (#2521 row 6): which members rest on an AI decision
4034
4071
  let V2Projection = null, V2Commands = null, V2Validation = null, FilterCore = null, ProfileColours = null, ReferenceSheet = null, ReadConfidence = null;
4035
4072
  let ChatQuestions = null; // model-chat-questions.js — the Questions in chat card and chat labels, shared with every model viewer
4036
4073
  let FramesCore = null; // steel-frames-core.js — the moment-frame schedule rules the server shares: what a frame row is, which girder sizes a sheet shows, how a read may add (#2210)
@@ -4252,6 +4289,7 @@ let reviewEventWatermark = null; // a review frame th
4252
4289
  let reviewCycle = null; // the in-flight refresh: { bounds, attempts, late }
4253
4290
  function reviewEventMatches(m){return m&&typeof m==='object'&&m.type==='review-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4254
4291
  /* #2449: an assumption on one of this project's connections was recorded or withdrawn. */
4292
+ function aiDecisionsEventMatches(m){return m&&typeof m==='object'&&m.type==='ai-decisions-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4255
4293
  function assumptionEventMatches(m){return m&&typeof m==='object'&&m.type==='connection-assumptions-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
4256
4294
  function reviewFrameOrderable(m){return Number.isSafeInteger(m.reviewRevision)&&m.reviewRevision>=0;}
4257
4295
  function editorHasUnsavedWork(){const sv=document.getElementById('saveStat');return !!sv&&(sv.classList.contains('dirty')||sv.classList.contains('err')||sv.classList.contains('conflict'));}
@@ -4402,9 +4440,15 @@ function handleReviewChanged(m){
4402
4440
  /* #2521 row 5: paint the Quick model chip from the server's `quick` (the snapshot served, or what a save stored). The
4403
4441
  server sends the words; a precise model, or no field, hides the chip. It describes the model AS LAST SAVED. */
4404
4442
  let lastSavedQuick=null;
4443
+ /* #2521 row 6: the same verdict for the AI-decision marks, which must never read "precise" from a label FloLess never
4444
+ read: undefined until a snapshot or save answered (the marks then say they could not read everything), null only
4445
+ for an explicit precise answer, {state:'unknown'} for a verdict it cannot read. */
4446
+ let lastSavedVerdict;
4405
4447
  function paintQuickStat(q){
4406
4448
  if(q===undefined)return; // a reply whose body could not be read leaves the last label in place; null = precise
4449
+ lastSavedVerdict=q===null?null:q&&q.state==='quick'&&typeof q.short==='string'?q:{state:'unknown'};
4407
4450
  lastSavedQuick=q&&(q.state==='quick'||q.state==='unknown')&&typeof q.short==='string'?q:null;
4451
+ if(window.aiMarksRepaintStrip)window.aiMarksRepaintStrip(); // #2521 row 6: the strip reads the last-saved verdict too
4408
4452
  const el=document.getElementById('quickStat');if(!el)return;
4409
4453
  // Precise: hide the chip AND clear an open confidence report's line, so both describe the same saved document.
4410
4454
  if(!lastSavedQuick){el.style.display='none';el.textContent='';el.removeAttribute('data-tip');if(typeof renderConfQuick==='function')renderConfQuick();return;}
@@ -4482,6 +4526,8 @@ function startContractEvents(){
4482
4526
  same value lands immediately after, so nothing is lost by dropping it. */
4483
4527
  if(displayUnitsEventMatches(m)){handleDisplayUnitsChanged(m);return;}
4484
4528
  // #2449: an assumption was recorded or withdrawn. Forget what the inspector was told and ask again.
4529
+ // #2521 row 6: the AI-decision record changed. Forget what Inspect was told (a late answer from before is dropped by the epoch).
4530
+ if(aiDecisionsEventMatches(m)){if(contractEventReady&&window.aiMarksRecordChanged)window.aiMarksRecordChanged();return;}
4485
4531
  if(assumptionEventMatches(m)){if(contractEventReady&&window.forgetConnectionAssumptions)window.forgetConnectionAssumptions();return;}
4486
4532
  if(reviewEventMatches(m)){if(!contractEventReady){if(reviewFrameOrderable(m)&&(!reviewEventWatermark||m.reviewRevision>=reviewEventWatermark.reviewRevision))reviewEventWatermark=m;}else handleReviewChanged(m);return;}
4487
4533
  if(!contractEventMatches(m))return;if(!contractEventReady)bufferContractEvent(m);else handleContractChanged(m);};
@@ -4710,7 +4756,7 @@ async function boot() {
4710
4756
  if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
4711
4757
  armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
4712
4758
  startContractEvents(); // subscribe first; contract events buffer until the atomic snapshot is installed
4713
- [DisplayUnits, GridDisplay, SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation, SplitView, FilterCore, PlanXf, CatalogPicker, ModelEditor, ViewportToolbar, ModelLighting, PointerDock, EditorShell, ReviewClient, ProfileColours, ReferenceSheet, ReadConfidence, CkStd, ModelPanelBridge, ChatQuestions, SteelSlim, LastSeen, MarksCore, FramesCore] = await Promise.all([
4759
+ [DisplayUnits, GridDisplay, SteelCore, ViewGen, ModelCmd, DetailRefs, V2Projection, V2Commands, V2Validation, SplitView, FilterCore, PlanXf, CatalogPicker, ModelEditor, ViewportToolbar, ModelLighting, PointerDock, EditorShell, ReviewClient, ProfileColours, ReferenceSheet, ReadConfidence, CkStd, ModelPanelBridge, ChatQuestions, SteelSlim, LastSeen, MarksCore, FramesCore, AiMarks] = await Promise.all([
4714
4760
  import('./display-units.js'), import('./grid-display.js'),
4715
4761
  import('./steel-3d-core.js'), import('./steel-view-generation.js'), import('./steel-model-commands.js'),
4716
4762
  import('./steel-detail-refs.js'), import('./steel-model-v2-projection.js'),
@@ -4721,7 +4767,7 @@ async function boot() {
4721
4767
  import('./connection-review-client.js'), import('./steel-profile-colours.js'),
4722
4768
  import('./steel-reference-sheet.js'), import('./steel-read-confidence.js'),
4723
4769
  import('./checkpoint-standard.js'), import('./model-panel-bridge.js'), import('./model-chat-questions.js'),
4724
- import('./steel-model-slim.js'), import('./steel-last-seen.js'), import('./steel-marks-core.js'), import('./steel-frames-core.js'),
4770
+ import('./steel-model-slim.js'), import('./steel-last-seen.js'), import('./steel-marks-core.js'), import('./steel-frames-core.js'), import('./steel-ai-marks.js'),
4725
4771
  ]);
4726
4772
  ({ FT_TO_MM, IN_TO_MM, LB_PER_FT_TO_KG_PER_M } = SteelCore); // the shared unit constants, bound before main() and every reader of them
4727
4773
  // BEFORE the first paint, deliberately. Every length on this page reads through it, so resolving it
@@ -5380,6 +5426,211 @@ function seeChangesFromOpenTab(opener) { openChangeList({ situation: 'B', baseTa
5380
5426
  function main(bootRecordedBase) {
5381
5427
  let P, X0,Y0,X1,Y1, FT, RB64, EXTX, EXTY, profs, NO_PLAN_VIEW=false; // per-plan, set by setPlan()
5382
5428
  let v2IdSeq=0;
5429
+ /* #2521 row 6: what rests on an AI decision, marked on the canvas, in 3D and in Inspect, with one strip for what cannot
5430
+ be marked. Plan: docs/superpowers/specs/2026-10-29-quick-model-row6-PLAN.md (Revisions 1 and 2). The analysis
5431
+ (web/steel-ai-marks.js) reads the LIVE model, so a mark follows the member on screen; what is shown combines it with
5432
+ the last-saved verdict (`aiMarksDisplayState`), so the screen never says less than the Quick label. A mark is a
5433
+ FINDING: unmarked never means drawn, and the strip says so whenever anything is shown. */
5434
+ let showAiMarks=(()=>{try{return localStorage.getItem('steel:aiMarks:v2')!=='0';}catch(_){return true;}})(); // ⋯ Display → AI decisions: on by default (owner ruling 2026-10-29)
5435
+ let aiMarksMemo=null,aiStripOpen=false,aiMarks3dSent=null;
5436
+ function aiMarksNow(){
5437
+ if(!AiMarks||!C||C.type!=='steel.model/v2')return null;
5438
+ // Every edit, undo, redo and installed save reply bumps the generation; a replaced model is a new C. So hover, zoom and
5439
+ // selection repaints reuse one analysis (plan R11).
5440
+ if(aiMarksMemo&&aiMarksMemo.c===C&&aiMarksMemo.gen===modelEditGeneration)return aiMarksMemo.marks;
5441
+ const marks=AiMarks.aiDecisionMarksOf(C);aiMarksMemo={c:C,gen:modelEditGeneration,marks};return marks;
5442
+ }
5443
+ function aiMarksState(){if(!AiMarks)return'none';return AiMarks.aiMarksDisplayState(aiMarksNow()||{state:'none'},lastSavedVerdict);}
5444
+ const aiHasCanvasMarks=m=>!!m&&(m.ends.length>0||m.joints.length>0);
5445
+ const aiEndWord=(role,end)=>role==='column'?(end===0?'base':'top'):(end===0?'start':'end');
5446
+ /* What the mark means, on the member's OWN tooltip (the marks themselves never take a pointer). */
5447
+ function aiTipFor(m){
5448
+ if(!showAiMarks||!m)return'';const marks=aiMarksNow(),list=marks&&marks.members.get(m.id);if(!list)return'';
5449
+ const ends=list.filter(x=>x.kind==='height').map(x=>aiEndWord(m.role,x.end));
5450
+ const parts=[];
5451
+ if(ends.length)parts.push('The AI chose this member’s '+ends.join(' and ')+' height'+(ends.length>1?'s':'')+'.');
5452
+ if(list.some(x=>x.kind==='connection'))parts.push('The AI assumed a connection on it.');
5453
+ return parts.length?parts.join(' ')+' Select it to see why.':'';
5454
+ }
5455
+ function aiDistToSeg(p,a,b){return SteelCore.projectPointOnSegment2d(p,a,b,SteelCore.SEG_DEGENERACY.atMost(0)).distance;} // only an exactly zero-length segment is a point
5456
+ /* A joint's ring: the main member's end its `at` names (a base plate, a beam-end shear plate); else the end of a secondary
5457
+ member nearest the main member's line, where it frames in; else the middle of the main member. */
5458
+ function aiJointPoint2d(j,byId){
5459
+ const main=j.main&&byId.get(j.main);
5460
+ if(!main){const sm=j.memberIds.map(id=>byId.get(id)).find(Boolean);return sm?[(sm.wp[0][0]+sm.wp[1][0])/2,(sm.wp[0][1]+sm.wp[1][1])/2]:null;}
5461
+ if(j.mainEnd===0||j.mainEnd===1)return main.wp[j.mainEnd];
5462
+ let best=null,bd=Infinity;
5463
+ for(const id of j.memberIds){if(id===j.main)continue;const sm=byId.get(id);if(!sm)continue;for(const p of sm.wp){const d=aiDistToSeg(p,main.wp[0],main.wp[1]);if(d<bd){bd=d;best=p;}}}
5464
+ return best||[(main.wp[0][0]+main.wp[1][0])/2,(main.wp[0][1]+main.wp[1][1])/2];
5465
+ }
5466
+ /* The canvas marks of the plan on screen, sized in 1/zoom like the review marker (updateBadges redraws them on zoom). */
5467
+ function aiMarksInner(){
5468
+ if(!showAiMarks||!P||!Array.isArray(P.members))return'';
5469
+ const marks=aiMarksNow();if(!aiHasCanvasMarks(marks))return'';
5470
+ // Positions come from every member this plan draws; visibility only decides whether a mark is shown. An end mark needs
5471
+ // its member shown; a ring needs ANY member of the joint shown (it rests on the connection whichever one is hidden).
5472
+ const byId=new Map(),shown=new Set();
5473
+ for(const m of P.members)if(m&&Array.isArray(m.wp)&&m.wp[0]&&m.wp[1]){byId.set(m.id,m);if(visible2d(m))shown.add(m.id);}
5474
+ const h=10/zoom,sw=1.6/zoom,r=8/zoom;let out='';
5475
+ for(const e of marks.ends){const m=shown.has(e.memberId)&&byId.get(e.memberId),p=m&&m.wp[e.end];if(!p)continue;
5476
+ out+=`<rect class=ai-end-mark data-ai-member="${esc(e.memberId)}" data-ai-end="${e.end}" x="${p[0]-h/2}" y="${p[1]-h/2}" width="${h}" height="${h}" style="stroke-width:${sw}px"/>`;}
5477
+ for(const j of marks.joints){if(!j.memberIds.some(id=>shown.has(id)))continue;const p=aiJointPoint2d(j,byId);if(!p)continue;
5478
+ out+=`<circle class=ai-joint-mark data-ai-joint="${esc(j.jointId)}" cx="${p[0]}" cy="${p[1]}" r="${r}" style="stroke-width:${sw}px"/>`;}
5479
+ return out;
5480
+ }
5481
+ function aiPlanLabel(viewId){const plan=(C.plans||[]).find(p=>V2Projection.planViewId(p)===viewId);return plan?String(plan.title||plan.sheet||viewId):String(viewId);}
5482
+ /* The record's words for one decision, when FloLess has read them: what was chosen, why, and how sure the AI was. */
5483
+ function aiChosenText(id,marks){
5484
+ const entry=marks.entries.get(id),rec=aiRecord.rows.get(id);
5485
+ const chosen=(entry&&typeof entry.chosen==='string'&&entry.chosen)||(rec&&rec.chosen)||'';
5486
+ let t=chosen?'the AI chose '+chosen:'the AI decided it';
5487
+ if(rec&&rec.why)t+=' (why: '+String(rec.why).replace(/\.\s*$/,'')+(rec.confidence?'; '+rec.confidence+' confidence':'')+')';
5488
+ else if(!AI_DECISION_ID.test(id))t+=' (FloLess cannot read this decision’s id, so it cannot say why)';
5489
+ else if(aiRecord.absent.has(id))t+=' (this decision is not in the project’s record, so FloLess cannot say why)';
5490
+ else if(aiRecordFailed(id))t+=' (FloLess could not read why just now; it tries again when you select the member)';
5491
+ else if(aiRecord.inflight.has(id))t+=' (reading why…)';
5492
+ return t;
5493
+ }
5494
+ function aiNoteText(item,marks){
5495
+ const entry=item.decisionId?marks.entries.get(item.decisionId):null,chosen=entry&&entry.chosen?': '+entry.chosen:'';
5496
+ if(item.reason==='unreadable')return'An AI decision FloLess could not read.';
5497
+ switch(item.channel){
5498
+ case'filter':return'The Drawing Filter (which sheets and areas the read used) was chosen by the AI'+chosen+'. Every member rests on that choice.';
5499
+ case'setup-origin':return'The model origin was chosen by the AI'+chosen+'. Every member’s position rests on it.';
5500
+ case'audit-gap':return'The AI settled a question the drawings left open'+chosen+'.';
5501
+ case'unmodelled-detail':return'The AI left a detail unmodelled'+chosen+'.';
5502
+ case'connection':return'The AI assumed a connection FloLess cannot place on a member now'+chosen+'.';
5503
+ case'setup':return'The AI decided the scale or level of a drawing view no longer in the model'+chosen+'.';
5504
+ default:return'An AI decision FloLess could not read.';
5505
+ }
5506
+ }
5507
+ /* The strip: legend, the view's own AI setup, the count of model-wide decisions, the general sentence, and Details. */
5508
+ function renderAiStrip(){
5509
+ const el=document.getElementById('aiStrip');if(!el)return;
5510
+ const state=C?aiMarksState():'none';
5511
+ if(state==='none'){if(!el.hidden){el.hidden=true;el.textContent='';el.dataset.key='';}return;}
5512
+ const marks=aiMarksNow()||{ends:[],joints:[],views:new Map(),model:[],entries:new Map(),members:new Map()};
5513
+ const vid=C&&C.plans&&C.plans[C.active]?V2Projection.planViewId(C.plans[C.active]):'';
5514
+ const key=[state,showAiMarks,aiStripOpen,aiMarksMemo&&aiMarksMemo.gen,vid,aiRecord.epoch].join('|');
5515
+ if(el.dataset.key===key&&!el.hidden)return; // render() calls this on every repaint: rebuild only when something it shows moved
5516
+ const hadFocus=el.contains(document.activeElement)?document.activeElement.getAttribute('data-command-id'):null;
5517
+ el.dataset.key=key;el.textContent='';el.hidden=false;
5518
+ const line=document.createElement('div');line.className='ai-line';el.appendChild(line);
5519
+ const span=(cls,text)=>{const x=document.createElement('span');if(cls)x.className=cls;x.textContent=text;return x;};
5520
+ if(state==='unknown')line.appendChild(span('ai-lead','FloLess could not read every AI decision this model rests on.'));
5521
+ else line.appendChild(span('ai-lead','AI decisions'));
5522
+ const keyMark=(shape,text)=>{const k=document.createElement('span');k.className='ai-key';
5523
+ k.innerHTML=shape==='sq'?'<svg width=11 height=11 aria-hidden=true><rect class=sq x=1.5 y=1.5 width=8 height=8 /></svg>':'<svg width=12 height=12 aria-hidden=true><circle class=rg cx=6 cy=6 r=4.5 /></svg>';
5524
+ k.appendChild(document.createTextNode(text));return k;};
5525
+ if(showAiMarks&&marks.ends.length)line.appendChild(keyMark('sq','height the AI chose'));
5526
+ if(showAiMarks&&marks.joints.length)line.appendChild(keyMark('rg','connection the AI assumed'));
5527
+ if(!showAiMarks&&aiHasCanvasMarks(marks))line.appendChild(span('','Marks hidden (⋯ Display → AI decisions).'));
5528
+ const viewRows=vid?marks.views.get(vid):null;
5529
+ if(viewRows&&viewRows.length){
5530
+ const rows=[...new Set(viewRows.map(v=>v.row))];
5531
+ const chip=span('chip assumed','AI chose this view’s '+rows.map(r=>r==='scale'?'scale':'level').join(' and '));
5532
+ chip.tabIndex=0;chip.setAttribute('role','note');
5533
+ chip.setAttribute('data-command-id','steel.ai-decision-view-note#'+vid);chip.setAttribute('data-command-instance-label',aiPlanLabel(vid));
5534
+ const said=viewRows.map(v=>'its '+(v.row==='scale'?'drawing scale':'level')+(marks.entries.get(v.decisionId)&&marks.entries.get(v.decisionId).chosen?' ('+marks.entries.get(v.decisionId).chosen+')':'')).join(' and ');
5535
+ const tip='The AI decided '+said+' for '+aiPlanLabel(vid)+'. Every member drawn on this view rests on that choice, and Inspect says so for each. Not reviewed.';
5536
+ chip.setAttribute('data-tip',tip);chip.setAttribute('aria-label',tip);
5537
+ line.appendChild(chip);
5538
+ }
5539
+ if(marks.model.length)line.appendChild(span('','+ '+marks.model.length+' that bear'+(marks.model.length===1?'s':'')+' on the whole model.'));
5540
+ line.appendChild(span('','Unmarked members may still rest on AI decisions FloLess cannot trace.'));
5541
+ const more=document.createElement('button');more.type='button';more.className='ai-more';more.textContent=aiStripOpen?'Less':'Details';
5542
+ more.setAttribute('data-command-id','steel.ai-decisions-note');more.setAttribute('aria-expanded',String(aiStripOpen));more.setAttribute('aria-controls','aiStripDetails');
5543
+ more.setAttribute('data-tip','What the AI decided that bears on the whole model, and what the marks and the label each describe');
5544
+ more.onclick=e=>{e.stopPropagation();aiStripOpen=!aiStripOpen;renderAiStrip();};
5545
+ line.appendChild(more);
5546
+ if(aiStripOpen){
5547
+ const d=document.createElement('div');d.className='ai-details';d.id='aiStripDetails';
5548
+ if(marks.model.length){const ul=document.createElement('ul');for(const item of marks.model){const li=document.createElement('li');li.textContent=aiNoteText(item,marks);ul.appendChild(li);}d.appendChild(ul);}
5549
+ const n=marks.decisionCount;
5550
+ d.appendChild(span('',(n?'Your current edits rest on '+n+' AI decision'+(n===1?'':'s')+' FloLess can trace. ':'Your current edits rest on no AI decision FloLess can trace. ')
5551
+ +'The marks follow your current edits; the Quick model label describes the model as last saved. None of these decisions is reviewed.'));
5552
+ el.appendChild(d);
5553
+ }
5554
+ if(hadFocus){const back=el.querySelector('[data-command-id="'+CSS.escape(hadFocus)+'"]');if(back)back.focus();}
5555
+ }
5556
+ /* Inspect, one member selected: every AI decision it rests on, in words, then what FloLess cannot see. */
5557
+ function inspectorAiDecisions(m,canonical,p){
5558
+ const marks=aiMarksNow(),list=marks&&marks.members.get(canonical.id);if(!list||!list.length)return;
5559
+ aiRecordWant([...new Set(list.flatMap(x=>x.kind==='height'?x.decisionIds:[x.decisionId]))]);
5560
+ const box=document.createElement('div');box.className='hint v2-ai-decisions';box.setAttribute('role','note');box.tabIndex=0;
5561
+ box.setAttribute('data-command-id','steel.inspector-ai-decisions');box.setAttribute('aria-label','Rests on AI decisions');
5562
+ box.style.cssText='margin:4px 0 8px;grid-column:1/-1;line-height:1.5';
5563
+ // The record's words arrive later: they refill THIS note only, never the panel, so a height being typed is never lost.
5564
+ box._aiRefill=()=>{const now=aiMarksNow(),l=now&&now.members.get(canonical.id);if(l&&l.length)fillAiNote(box,m,canonical,l,now);};
5565
+ fillAiNote(box,m,canonical,list,marks);
5566
+ // After the elevation fields' row and any notes under it, like the height notes; else at the end of the panel.
5567
+ const input=document.getElementById(m.role==='column'?'tosC':'tosB'),cell=input&&input.closest('.pval');
5568
+ let anchor=cell&&cell.parentElement&&cell.parentElement!==document.getElementById('panel')?cell.parentElement:null;
5569
+ if(anchor){while(anchor.nextElementSibling&&/\bv2-elevation-/.test(anchor.nextElementSibling.className))anchor=anchor.nextElementSibling;anchor.after(box);}
5570
+ else p.appendChild(box);
5571
+ }
5572
+ function fillAiNote(box,m,canonical,list,marks){
5573
+ box.textContent='';
5574
+ const head=document.createElement('div');head.className='ai-head';
5575
+ const chip=document.createElement('span');chip.className='chip assumed';chip.textContent='AI decision';
5576
+ const b=document.createElement('b');b.textContent='Rests on AI decisions';head.append(chip,b);box.appendChild(head);
5577
+ for(const mark of list){
5578
+ const row=document.createElement('div');row.className='ai-row';
5579
+ if(mark.kind==='height'){
5580
+ const z=(mark.end===0?canonical.from:canonical.to)?.z,now=z&&Number.isFinite(z.known)?fmtDispElev(z.known):'';
5581
+ const word=aiEndWord(m.role,mark.end),n=mark.decisionIds.length;
5582
+ row.textContent=word.charAt(0).toUpperCase()+word.slice(1)+' height'+(now?' '+now:'')+' rests on '+(n===1?'an AI decision':n+' AI decisions')
5583
+ +(mark.derived?', derived from '+(n===1?'it':'them')+' by a copy, split or merge':'')+': '+mark.decisionIds.map(id=>aiChosenText(id,marks)).join('; ')+'.';
5584
+ }else if(mark.kind==='connection'){
5585
+ const joint=(C.joints||[]).find(j=>j&&j.id===mark.jointId);
5586
+ row.textContent='Its connection '+String(joint&&joint.name||mark.jointId)+' rests on an AI assumption: '+aiChosenText(mark.decisionId,marks)+'.';
5587
+ }else{
5588
+ row.textContent='Drawn on '+aiPlanLabel(mark.viewId)+', whose '+(mark.row==='scale'?'drawing scale':'level')+' the AI decided: '+aiChosenText(mark.decisionId,marks)+'.';
5589
+ }
5590
+ box.appendChild(row);
5591
+ }
5592
+ const foot=document.createElement('div');foot.className='ai-foot';
5593
+ foot.textContent='Not reviewed. FloLess lists what it can trace; this member may still rest on other AI decisions.';box.appendChild(foot);
5594
+ }
5595
+ /* The record's words (why, confidence), read by id on demand (plan R8, V2). In-flight requests are shared; an epoch,
5596
+ bumped when the record changes or the model is replaced, drops an answer that arrives after it is stale, before it
5597
+ reaches the cache or the screen. A failed read is retried after half a minute. */
5598
+ const AI_DECISION_ID=/^[0-9a-f]{12}$/; // the record's id shape: anything else is never sent (one bad id would refuse the whole batch)
5599
+ const aiRecord={epoch:0,rows:new Map(),failed:new Map(),absent:new Set(),inflight:new Map(),repaint:0};
5600
+ function aiRecordInvalidate(){aiRecord.epoch++;aiRecord.rows.clear();aiRecord.failed.clear();aiRecord.absent.clear();aiRecord.inflight.clear();}
5601
+ const aiRecordFailed=id=>{const t=aiRecord.failed.get(id);return t!==undefined&&Date.now()-t<30000;};
5602
+ function aiRecordWant(ids){
5603
+ if(!PROJECT)return;
5604
+ const missing=ids.filter(id=>AI_DECISION_ID.test(id)&&!aiRecord.rows.has(id)&&!aiRecord.absent.has(id)&&!aiRecordFailed(id)&&!aiRecord.inflight.has(id));
5605
+ for(let i=0;i<missing.length;i+=200){
5606
+ const chunk=missing.slice(i,i+200),epoch=aiRecord.epoch;
5607
+ const done=fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/ai-decisions?ids='+chunk.join(','))
5608
+ .then(r=>r.ok?r.json():Promise.reject(new Error('the server answered '+r.status)))
5609
+ .catch(e=>{console.warn('ai-decisions: could not read the record for project',PROJECT,String(e&&e.message||e));return null;}).then(d=>{
5610
+ if(epoch!==aiRecord.epoch)return; // stale: the record changed while this was asked
5611
+ for(const id of chunk)aiRecord.inflight.delete(id);
5612
+ const rows=d&&!d.unavailable&&Array.isArray(d.decisions)?d.decisions:null;
5613
+ for(const row of rows||[])if(row&&typeof row.id==='string')aiRecord.rows.set(row.id,row);
5614
+ // A full answer that lacks an id means the record does not hold it: said once, not retried until the record changes.
5615
+ // No answer, or an unavailable record, is a failed read: retried after half a minute.
5616
+ for(const id of chunk)if(!aiRecord.rows.has(id)){if(rows)aiRecord.absent.add(id);else aiRecord.failed.set(id,Date.now());}
5617
+ if(!aiRecord.repaint)aiRecord.repaint=requestAnimationFrame(()=>{aiRecord.repaint=0;for(const b of document.querySelectorAll('.v2-ai-decisions'))if(b._aiRefill)b._aiRefill();}); // the note only: never the panel's fields
5618
+ });
5619
+ for(const id of chunk)aiRecord.inflight.set(id,done);
5620
+ }
5621
+ }
5622
+ /* The 3D marks follow the 2D ones: the same analysis, the same switch. Pushed only when they change. */
5623
+ function syncAiMarks3d(force){
5624
+ if(!view3dReady)return; // through the Steel adapter, never the raw viewport (the seam ratchet only shrinks)
5625
+ const marks=showAiMarks?aiMarksNow():null;
5626
+ if(!force&&aiMarks3dSent&&aiMarks3dSent.marks===marks)return;
5627
+ aiMarks3dSent={marks};
5628
+ modelEditor.steel.setAiMarks(aiHasCanvasMarks(marks)?AiMarks.canvasMarksOf(marks):null);
5629
+ }
5630
+ function updAiMarksToggle(){const b=document.getElementById('aiMarksToggleB');if(!b)return;b.hidden=!aiHasCanvasMarks(aiMarksNow());b.classList.toggle('on',showAiMarks);b.setAttribute('aria-checked',String(showAiMarks));}
5631
+ /* The two callers outside main(): the label paint (paintQuickStat) and the record-changed event. */
5632
+ window.aiMarksRepaintStrip=renderAiStrip;
5633
+ window.aiMarksRecordChanged=()=>{aiRecordInvalidate();render();};
5383
5634
  const newModelId=()=>`m-v2-${Date.now().toString(36)}-${(v2IdSeq++).toString(36)}`;
5384
5635
  V2_SESSION=V2Commands.createV2CommandSession(C,{
5385
5636
  validate:doc=>V2Validation.validateClientSteelModelV2(doc,V2_SCHEMA),
@@ -5536,7 +5787,7 @@ function installMemberEndContract(doc,etag,revision,keepHistory){
5536
5787
  // apply() restores decisions from `serverDecided`, so its history stays valid (see adoptSaveReply).
5537
5788
  if(!keepHistory){undo.length=0;redo.length=0;picStore.clear();picSeen=new Map();updUR();} // nothing left to undo to, so the pictures kept for it go too (the live library is fingerprinted again at the next snapshot)
5538
5789
  serverDecided=decidedMembers(doc.members);
5539
- bumpModelEditGeneration(); // the server replaced the document under the editor; nothing captured before this describes what is now on screen
5790
+ aiRecordInvalidate();bumpModelEditGeneration(); // the server replaced the document under the editor; nothing captured before this describes what is now on screen
5540
5791
  // A restamped row is rewritten too: it still holds the document from BEFORE the server's change, and a
5541
5792
  // reload would put that back — a staled decision returning live, refused on the next save. A row from
5542
5793
  // another generation (a stale draft that could not be parked) is not ours to touch: only the user's own
@@ -10252,14 +10503,14 @@ function render(){
10252
10503
  // #2214: a column that ends under this sheet's floor is drawn dashed and lighter. It has ONE tooltip, so the
10253
10504
  // below-the-floor sentence and the placeholder sentence are composed rather than competing attributes.
10254
10505
  const _cb=m.belowCut?colBelowInfo(m):null;
10255
- const _tipText=[_cb&&_cb.tip,_phText].filter(Boolean).join(' ');
10506
+ const _tipText=[_cb&&_cb.tip,_phText,aiTipFor(m)].filter(Boolean).join(' ');
10256
10507
  const _ph=_tipText?` data-tip="${esc(_tipText)}"`:'';
10257
10508
  if(pts){const components=pts.components||[pts];s+=components.map((part,index)=>`<polygon class="member${rfi?' rfi':''}${m.belowCut?' colbelow':''}${sel?' sel':''}${fh?' find-hit':''}" data-id="${m.id}" data-part="${index}" points="${_polyStr(part)}" fill="${c}" stroke="${c}"${g}${_ph}/>`).join('');continue;}}
10258
10509
  const ls=memberLineStyle(m); // F5: category line weight/dash. Inline style (NOT a presentation attr) so it beats line.member/.sel CSS width; the glow still cues selection.
10259
10510
  const _fx=on?`filter:drop-shadow(0 0 3px ${c}) drop-shadow(0 0 8px ${c});`:'', _sw=(ls&&ls.w)?`stroke-width:${ls.w}px;`:'', _sd=(ls&&ls.d&&!rfi)?`stroke-dasharray:${ls.d};stroke-linecap:butt;`:''; /* butt WITH a dash: line.member's round cap adds half the stroke width at EACH end of every dash, so at thick (9px) it ate every gap — dashed 14/8 and dotted 2/8 both left -1px of gap and drew solid. Round caps stay on solid lines, where they have nothing to close. */ // RFI keeps its semantic 10 6 dash
10260
10511
  const _sty=(_fx||_sw||_sd)?` style="${_fx}${_sw}${_sd}"`:'';
10261
10512
  // A column below the floor whose footprint cannot be built falls to this line, and must still say what it is (#2214).
10262
- const _lcb=(m.role==='column'&&m.belowCut)?colBelowInfo(m):null,_lt=_lcb?` data-tip="${esc(_lcb.tip)}"`:'';
10513
+ const _lcb=(m.role==='column'&&m.belowCut)?colBelowInfo(m):null,_ltText=[_lcb&&_lcb.tip,aiTipFor(m)].filter(Boolean).join(' '),_lt=_ltText?` data-tip="${esc(_ltText)}"`:'';
10263
10514
  s+=`<line class="member${rfi?' rfi':''}${_lcb?' colbelow':''}${sel?' sel':''}${fh?' find-hit':''}" data-id="${m.id}"${_lt} x1="${m.wp[0][0]}" y1="${m.wp[0][1]}" x2="${m.wp[1][0]}" y2="${m.wp[1][1]}" stroke="${c}"${_sty}/>`;}
10264
10515
  {const hsel=sel2d().filter(visible2d);if(hsel.length>=1&&!P.elevationView){const HR=epR();for(const sm of hsel)for(let i=0;i<2;i++) s+=`<circle class="handle ${i===0?'ep-start':'ep-end'}" data-mid="${sm.id}" data-h="${i}" cx="${sm.wp[i][0]}" cy="${sm.wp[i][1]}" r="${HR}"/>`;}} // end 1 (start) yellow, end 2 (end) magenta · shown for every selected member · radius grows with zoom (epR) so it stays visible against the thick line
10265
10516
  if(mode==='add'||(picking&&pickKind==='profile')){
@@ -10295,13 +10546,14 @@ function render(){
10295
10546
  s+=renderPropLabels(); // right-click property-label chips (2D); 3D labels ride the div-overlay pool
10296
10547
  s+=renderSelLenLabels(); // on-select member-length chips (2D), gated by the ⋯ Display "Show member length" toggle
10297
10548
  s+=memberEndReviewSvg();
10549
+ s+='<g class=ai-marks aria-hidden=true>'+aiMarksInner()+'</g>'; // #2521 row 6: ends and joints that rest on an AI decision (never a click target)
10298
10550
  if(P.frame)s+=axisGlyphSvg(P.frame.o,P.frame.u,false); // local-axes glyph at the origin (only when a frame is set; removed on reset)
10299
10551
  // No datalist population here any more. The #profiles and #details <datalist>s went with the rest of
10300
10552
  // them (an OS-drawn white popup has no themed mode), and COMBO_SRC.profiles/.details already read
10301
10553
  // `profs` and `detTexts()` live — so the combobox offers the same list with no mirror to keep filled.
10302
10554
  // Deleting the elements while these two writes stayed made render() throw on null here, which also
10303
10555
  // killed every call after it on this line (stats/panel/upd*/syncDisplayRows). Measured in Chromium.
10304
- svg.innerHTML=s; if(P.elevationView)sizeElevationLabels(); layoutPropLabels2d(); stats(); panel(); updUR(); updDup(); updRegistration(); updateMemberEndStatus(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); syncReachRow(); syncDisplayRows(); syncUnitsRow();syncEnvChip();restoreProfilePickerFocus(profileFocusToken);if(typeof askAiRefreshSelection==='function')askAiRefreshSelection();
10556
+ svg.innerHTML=s; if(P.elevationView)sizeElevationLabels(); layoutPropLabels2d(); stats(); panel(); updUR(); updDup(); updRegistration(); updateMemberEndStatus(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); syncReachRow(); syncDisplayRows(); syncUnitsRow();syncEnvChip();renderAiStrip();syncAiMarks3d();restoreProfilePickerFocus(profileFocusToken);if(typeof askAiRefreshSelection==='function')askAiRefreshSelection();
10305
10557
  if(selFilterReady)reflectSelFilter(); // keep the Select-bar Members/Connections buttons in sync with the model — a new/removed connection kind (e.g. the first auto-detailed base plate) flips their on/off without a manual toggle. Gated on selFilterReady so it doesn't run until the deferred first reflect has armed it (that reflect needs BASE_MEMBER_TYPES, initialised later in main()).
10306
10558
  if(view3dShown&&window.Steel3DView){updateIsolateBtn();if((selIds.size||selGridIds.size)&&modelEditor.steel.selectedClips&&modelEditor.steel.selectedClips().length)modelEditor.steel.setSelectedClips([]);} // canonical commits keep member + grid highlight in sync; selecting geometry still clears clip-tool selection (exclusive)
10307
10559
  syncLegendToPane(); // the Objects list: the selection, and in 2D the sheet it lists
@@ -10631,7 +10883,8 @@ function updateBadges(){const R=12/zoom,F=13/zoom,ox=el=>(+el.dataset.fi-(+el.da
10631
10883
  svg.querySelectorAll('circle.handle,circle.dimhandle').forEach(h=>h.setAttribute('r',epR()));
10632
10884
  // (brace arrowheads need no rescale here — they are content-unit sized, so they scale with the member
10633
10885
  // stroke exactly like the line they cap. See braceHeadPoints().)
10634
- {const dg=svg.querySelector('g.dimsg');if(dg)dg.innerHTML=renderDimsInner();} // dims shrink below DIM_ZMIN (see dimSvg) so dense dims don't overlap when zoomed out (B8) — every part of a dim is zoom-derived, so rebuild the group rather than patch it
10886
+ {const dg=svg.querySelector('g.dimsg');if(dg)dg.innerHTML=renderDimsInner();}
10887
+ {const ag=svg.querySelector('g.ai-marks');if(ag)ag.innerHTML=aiMarksInner();} // #2521 row 6: the AI-decision marks hold their screen size while zooming // dims shrink below DIM_ZMIN (see dimSvg) so dense dims don't overlap when zoomed out (B8) — every part of a dim is zoom-derived, so rebuild the group rather than patch it
10635
10888
  sizeElevationLabels(); // an elevation's level text (#2780)
10636
10889
  sizeGridBubbles(); // radius, font AND centre — the bubble hangs off its line end by its own radius, so a zoom that changes the radius moves it too
10637
10890
  // property-label chips: recompute size + stacked screen offset from the baked anchor (ax,ay) + per-row screen
@@ -10891,7 +11144,7 @@ function projectedMemberLookup(presence=V2Projection.createMemberPresenceIndex(C
10891
11144
 
10892
11145
  function syncV2SelectionNotice(p){
10893
11146
  if(!p||!selIds.size||viewPropsId)return; // a view in the panel keeps the selection, not its notices
10894
- p.querySelectorAll('.v2-selection-notice,.v2-elevation-warning,.v2-elevation-proposal,.v2-elevation-answered').forEach(el=>el.remove());
11147
+ p.querySelectorAll('.v2-selection-notice,.v2-elevation-warning,.v2-elevation-proposal,.v2-elevation-answered,.v2-ai-decisions').forEach(el=>el.remove());
10895
11148
  const presence=V2Projection.createMemberPresenceIndex(C);
10896
11149
  const ids=[...selIds].filter(id=>presence.members.has(id));
10897
11150
  if(!ids.length)return;
@@ -11006,7 +11259,10 @@ function syncV2SelectionNotice(p){
11006
11259
  if(m&&canonical&&m.role==='column'){mark('bos',!Number.isFinite(canonical.from?.z?.known));mark('tosC',!Number.isFinite(canonical.to?.z?.known));}
11007
11260
  else if(m&&canonical){mark('tosA',!Number.isFinite(canonical.from?.z?.known));mark('tosB',!Number.isFinite(canonical.to?.z?.known));}
11008
11261
  if(m&&canonical)inspectorHeightNotes(m,canonical);
11262
+ if(m&&canonical)inspectorAiDecisions(m,canonical,p); // #2521 row 6
11009
11263
  }
11264
+ // #2521 row 6: a member no plan view draws (read from an elevation, or picked in 3D) still rests on what it rests on.
11265
+ else if(!projected.length&&selected.length===1)inspectorAiDecisions(selected[0],selected[0],p);
11010
11266
  }
11011
11267
  /**
11012
11268
  * Under each elevation field of ONE selected member (#1723): say when the height shown is only where the
@@ -14866,11 +15122,12 @@ redrawForUnitsFn=()=>{syncUnitsRow();syncReachRow();syncEnvChip();render();sync3
14866
15122
  b.onclick=e=>{e.stopPropagation();if(b.disabled||displayUnits()===units)return;commitDisplayUnits(units);};};
14867
15123
  pick('unitsFt',DisplayUnits.FT_IN);pick('unitsMm',DisplayUnits.MM);
14868
15124
  }
14869
- function syncDisplayRows(){updGridToggle();updPosGizmoToggle();updDimToggle();updCalloutToggle();updPlToggle();updRefToggle();}
15125
+ function syncDisplayRows(){updAiMarksToggle();updGridToggle();updPosGizmoToggle();updDimToggle();updCalloutToggle();updPlToggle();updRefToggle();}
14870
15126
  function updDimToggle(){const b=document.getElementById('dimToggleB');if(!b)return;b.disabled=false;b.classList.toggle('on',dimsVisible);b.setAttribute('aria-checked',String(dimsVisible));}
14871
15127
  document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();dimsVisible=!dimsVisible;updDimToggle();render();};
14872
15128
 
14873
15129
  function updPosGizmoToggle(){const b=document.getElementById('posGizmoToggleB');if(!b)return;b.disabled=false;b.classList.toggle('on',showPosGizmo);b.setAttribute('aria-checked',String(showPosGizmo));}
15130
+ document.getElementById('aiMarksToggleB').onclick=e=>{e.stopPropagation();showAiMarks=!showAiMarks;try{localStorage.setItem('steel:aiMarks:v2',showAiMarks?'1':'0');}catch(_){}updAiMarksToggle();render();}; // #2521 row 6: hides the 2D and 3D marks only; the strip and Inspect stay (owner ruling 2026-10-29)
14874
15131
  document.getElementById('posGizmoToggleB').onclick=e=>{e.stopPropagation();showPosGizmo=!showPosGizmo;try{localStorage.setItem('steel:posGizmo:v2',showPosGizmo?'1':'0');}catch(_){}updPosGizmoToggle();if(view3dReady&&window.Steel3DView&&window.Steel3DView.setPositionGizmoVisible)window.Steel3DView.setPositionGizmoVisible(showPosGizmo);}; // the gizmo is a 3D overlay — push straight to the view (.stopPropagation keeps the menu open, like every .dtog)
14875
15132
  // ⋯ Display → Grid label size. One setting, both views: 2D re-places its bubbles from the anchors baked
14876
15133
  // by gridSvg (no re-render — a rebuild between a dblclick's two clicks would kill the rename gesture),
@@ -23103,7 +23360,8 @@ async function setView(on,{remember=true}={}){
23103
23360
  // nothing to undo here; just stop.
23104
23361
  if(seq!==viewSeq)return;
23105
23362
  modelSelection.replay();
23106
- if(window.Steel3DView.setPositionGizmoVisible)window.Steel3DView.setPositionGizmoVisible(showPosGizmo); // reflect the persisted ⋯ Display → Position handle state when 3D becomes visible
23363
+ if(window.Steel3DView.setPositionGizmoVisible)window.Steel3DView.setPositionGizmoVisible(showPosGizmo);
23364
+ syncAiMarks3d(true); // #2521 row 6: the AI-decision marks, as the switch and the live model say // reflect the persisted ⋯ Display → Position handle state when 3D becomes visible
23107
23365
  if(window.Steel3DView.setGridLabelPx)window.Steel3DView.setGridLabelPx(gridLabelPx); // the renderer reads the shared key at LOAD and the slider pushes live, but a size set BEFORE the module arrived reaches it through neither — so relay it here too, like every other preference in this block. Makes a 2D/3D divergence self-healing on the next switch rather than permanent.
23108
23366
  wire3DBar();loadSteelFavourites();build3DLegend();
23109
23367
  // Push what we already hold, THEN stream the rest in behind the native steel. Deliberately not
@@ -24460,7 +24718,8 @@ let rfiRecordsSeq=0; // bumped on every settled list response, so the
24460
24718
  success hides a real failure. The panel this replaces carried the same guard (`qSeq`); dropping it
24461
24719
  in the rewrite was a regression, not a simplification. */
24462
24720
  let rfiFetchSeq=0;
24463
- /* One browser-side ceiling covers save-before-promotion plus the RFI POST. It is intentionally shorter
24721
+ /** #2874: the RFI a chat mention just opened, outlined for a moment; renderRfiList redraws the outline while it is set. */
24722
+ let rfiMentioned=null;/* One browser-side ceiling covers save-before-promotion plus the RFI POST. It is intentionally shorter
24464
24723
  than the server ledger's lifetime: the browser may stop waiting while the server finishes, then the
24465
24724
  SAME operation key safely discovers that outcome instead of issuing a second action. */
24466
24725
  const RFI_ACTION_TIMEOUT_MS=30_000;
@@ -24698,15 +24957,22 @@ function paintRfiStat(){
24698
24957
  ?'Reading this project’s filed RFIs…'
24699
24958
  :'FloLess could not read the project’s current questions — open the list to see why';
24700
24959
  n.textContent=unread?'—':String(count);
24960
+ // #2920: the read's unfiled questions, beside the open count and never added to it — they are not RFIs yet.
24961
+ const readN=unread?0:rfiReadCount(),readEl=document.getElementById('rcRead'),readNum=document.getElementById('rcReadN');
24962
+ if(readEl&&readNum){readEl.style.display=readN?'':'none';readNum.textContent=String(readN);}
24963
+ if(b.classList&&b.classList.toggle)b.classList.toggle('readq',readN>0);
24964
+ // A class, so the Quality summary's observer sees it: questions nobody could check are not "nothing unresolved".
24965
+ if(b.classList&&b.classList.toggle)b.classList.toggle('readunknown',!unread&&!!rfiState.readQuestionsUnavailable);
24966
+ const readTip=readN?' '+readN+' question'+(readN===1?'':'s')+' from the drawing read '+(readN===1?'is':'are')+' not filed yet.':'';
24701
24967
  if(b.classList&&b.classList.toggle)b.classList.toggle('has',unread||count>0);
24702
24968
  if(b.classList&&b.classList.toggle)b.classList.toggle('unknown',!!rfiRecovery);
24703
24969
  const unknownTip=rfiRecovery?' An RFI attempt has an unknown result — open the list to review it.':'';
24704
24970
  // setAttribute, not `dataset`: the tooltip handler reads the ATTRIBUTE, and so does every probe.
24705
24971
  b.setAttribute('data-tip',(unread?unreadTip
24706
- :'List every RFI — a question for an engineer, or a member whose size FloLess cannot price')+unknownTip);
24972
+ :'List every RFI — a question for an engineer, or a member whose size FloLess cannot price.'+readTip)+unknownTip);
24707
24973
  b.setAttribute('aria-label',rfiState.status==='loading'
24708
24974
  ?'Reading RFIs. '+unreadTip+unknownTip
24709
- :unread?'RFIs unavailable. '+unreadTip+unknownTip:'RFIs, '+count+' open.'+unknownTip);
24975
+ :unread?'RFIs unavailable. '+unreadTip+unknownTip:'RFIs, '+count+' open.'+readTip+unknownTip);
24710
24976
  }
24711
24977
 
24712
24978
  const liveDrawingTargets=g=>{const rows=Array.isArray(g&&g.drawingTargets)&&g.drawingTargets.length?g.drawingTargets:g&&g.drawingTarget?[g.drawingTarget]:[];
@@ -24737,7 +25003,10 @@ async function refreshRfiRecords(opts){
24737
25003
  rfiState={status:'fail',records:live,sizeTruth:'known',liveTruth:j.liveTruth==='unavailable'?'unavailable':'known',detail:'',
24738
25004
  liveDetail:String(j.liveTruthDetail||''),http:r.status||0,error:String((j&&j.error)||''),
24739
25005
  // #2521 row 3b-2: a Quick version's unfiled questions live in the version, so they show even now.
24740
- quickFiling:Array.isArray(j&&j.quickFiling)?j.quickFiling:[]};
25006
+ quickFiling:Array.isArray(j&&j.quickFiling)?j.quickFiling:[],
25007
+ // #2920: the newest read's unfiled questions are counted from the version, so they show even now.
25008
+ readQuestions:j&&j.readQuestions&&typeof j.readQuestions==='object'?j.readQuestions:null,
25009
+ readQuestionsUnavailable:!!(j&&j.readQuestionsUnavailable)};
24741
25010
  }else{
24742
25011
  const filed=j.rfis.map(r=>{
24743
25012
  const g=r&&r.liveGap,targets=liveDrawingTargets(g);
@@ -24753,7 +25022,9 @@ async function refreshRfiRecords(opts){
24753
25022
  sizeTruth:j.sizeTruth==='known'?'known':'unavailable',
24754
25023
  liveTruth:j.liveTruth==='known'?'known':'unavailable',
24755
25024
  detail:String(j.sizeTruthDetail||''),liveDetail:String(j.liveTruthDetail||''),http:200,error:'',
24756
- quickFiling:Array.isArray(j.quickFiling)?j.quickFiling:[]};
25025
+ quickFiling:Array.isArray(j.quickFiling)?j.quickFiling:[],
25026
+ readQuestions:j.readQuestions&&typeof j.readQuestions==='object'?j.readQuestions:null,
25027
+ readQuestionsUnavailable:!!j.readQuestionsUnavailable};
24757
25028
  }
24758
25029
  }catch(e){
24759
25030
  if(mine!==rfiFetchSeq)return false;
@@ -26474,20 +26745,27 @@ function renderRfiList(){
26474
26745
  ?'<b>Nothing closed yet.</b>No RFI on this project has been closed.'
26475
26746
  :total
26476
26747
  ?'<b>Nothing matches this filter.</b>There are '+total+' RFI'+(total===1?'':'s')+' here — widen the filter above to see them.'
26748
+ // #2920: never the all-clear while the read's own questions are waiting above, unfiled.
26749
+ :rfiReadCount()
26750
+ ?'<b>No RFIs '+(rfiStatusFilter==='all'?'yet':'are open')+'.</b>The questions from the drawing read above are not filed yet.'
26751
+ :rfiState.readQuestionsUnavailable
26752
+ ?'<b>No RFIs are open.</b>The questions the drawing read asked could not be checked — see above.'
26477
26753
  :rfiStatusFilter==='all'
26478
26754
  ?'<b>No RFIs yet.</b>Nothing has been asked about this project, and every member has a size FloLess can price.'
26479
26755
  :'<b>Nothing is waiting on an answer.</b>Every question that was asked has been closed, and every member has a size FloLess can price.';
26480
- list.innerHTML=rfiQuickFilingHtml()+'<div class=rfiempty>'+empty+'</div>';
26756
+ list.innerHTML=rfiQuickFilingHtml()+rfiReadQuestionsHtml()+'<div class=rfiempty>'+empty+'</div>';
26481
26757
  wireRfiList();
26482
26758
  rfiRestoreFocus(restore);
26483
26759
  return;
26484
26760
  }
26485
26761
 
26486
- const shown=rows.slice(0,RFI_ROW_CAP);
26487
- let html=rfiQuickFilingHtml();
26762
+ const shown=rfiShownRows(rows,RFI_ROW_CAP,rfiMentioned);
26763
+ let html=rfiQuickFilingHtml()+rfiReadQuestionsHtml();
26488
26764
  for(const row of shown)html+=(row.kind==='record'?rfiRecordRowHtml(row.record):rfiSymptomRowHtml(row));
26489
26765
  if(rows.length>shown.length)html+='<div class=rfimore>'+(rows.length-shown.length)+' more not listed here — narrow the filter above.</div>';
26490
26766
  list.innerHTML=html;
26767
+ // #2874: the RFI a chat mention just opened keeps its outline through a repaint while it shows.
26768
+ if(rfiMentioned){const r=_rfiByAttr(list,'data-rfi-row',rfiRowKey('record',rfiMentioned));if(r)r.classList.add('is-mentioned');}
26491
26769
  wireRfiList();
26492
26770
  rfiRestoreFocus(restore);
26493
26771
  }
@@ -26837,7 +27115,78 @@ function rfiTargetControls(r,occurrenceIndex){
26837
27115
  * shown here, where the person is now looking, and the outcome goes back to the shell for its own line.
26838
27116
  */
26839
27117
  const EDITOR_FOCUS_3D_WAIT_MS=20000;
27118
+ /** The last-resort sentence when showing what was asked for failed in a way the runner did not foresee. */
27119
+ function editorFocusFailed(req){
27120
+ if(req.rfiId)return 'FloLess could not show '+req.rfiId+'. Find it on the RFIs page, or press it in the chat again.';
27121
+ return req.memberId?'The model could not show member '+req.memberId+'. Press Show in the model again, or find it in the Model panel.'
27122
+ :'The model could not show connection '+req.jointId+'. Press Open in the model again, or find it in the Model panel.';
27123
+ }
27124
+ /**
27125
+ * #2874: one RFI a chat message mentioned, on this project's RFIs page. "Shown" only once the page is up, its records
27126
+ * are read, a view that lists the RFI is on (the status filter and the scope widen to All and the whole project when
27127
+ * they hide it), and its row is focused and outlined. Every other outcome is a sentence, never an error page.
27128
+ */
27129
+ /**
27130
+ * #2874: read the records for a chat mention, so a just-filed or just-removed RFI is judged on the list as it is now,
27131
+ * never on the one the page held before. Each read is cancelled at the deadline, so none is left running; a read
27132
+ * another one replaced left the old list in place, so it is read again. True once a read is the one the list shows,
27133
+ * false at the deadline, null when the request was replaced meanwhile.
27134
+ */
27135
+ async function rfiReadForMention(until,current){
27136
+ while(Date.now()<until){
27137
+ const stop=new AbortController();
27138
+ let late=false;
27139
+ const timer=setTimeout(()=>{late=true;stop.abort();},Math.max(0,until-Date.now()));
27140
+ let shown=false;
27141
+ try{shown=await refreshRfiRecords({signal:stop.signal});}
27142
+ catch(e){console.warn('[rfi] a records read for a chat mention failed',e);}
27143
+ finally{clearTimeout(timer);stop.abort();}
27144
+ if(!current())return null;
27145
+ if(shown)return true;
27146
+ if(late||Date.now()>=until)return false;
27147
+ await new Promise(resolve=>setTimeout(resolve,100));
27148
+ if(!current())return null;
27149
+ }
27150
+ return false;
27151
+ }
27152
+ /** The rows the RFI list draws: the first `cap`, in order, with the RFI a chat mention asked for kept in the last place
27153
+ * when it falls past the cap, since widening the filter cannot bring a row below that cut into view. */
27154
+ function rfiShownRows(rows,cap,mentioned){
27155
+ const shown=rows.slice(0,cap);
27156
+ if(!mentioned||rows.length<=cap)return shown;
27157
+ const at=rows.findIndex(row=>row&&row.kind==='record'&&row.record&&row.record.id===mentioned);
27158
+ return at>=cap?[...shown.slice(0,cap-1),rows[at]]:shown;
27159
+ }
27160
+ async function runRfiFocus(rfiId,current){
27161
+ // Every failure is shown here, where the person is looking, as well as returned for the chat's own line.
27162
+ const failed=said=>{answerToast(said);return {ok:false,said};};
27163
+ if(rfiFormFor&&rfiOpen())return failed('An RFI form is open. Finish or cancel it, then press '+rfiId+' in the chat again.');
27164
+ if(!(await openRFI(null,null,null)))return current()?failed('FloLess could not open the RFIs page. Click RFIs above, then find '+rfiId+'.'):null;
27165
+ if(!current())return null;
27166
+ const fresh=await rfiReadForMention(Date.now()+EDITOR_FOCUS_3D_WAIT_MS,current);
27167
+ if(fresh===null)return null;
27168
+ if(!fresh)return failed('The RFIs did not load in time, so '+rfiId+' was not shown. Press it in the chat again.');
27169
+ if(!rfiState.records.some(row=>row&&row.id===rfiId)){
27170
+ const said=rfiState.status==='ok'?rfiId+' is no longer one of this project’s RFIs. The list shows the RFIs it has now.'
27171
+ :'FloLess could not read this project’s RFIs just now, so '+rfiId+' was not shown. Press it in the chat again in a moment.';
27172
+ return {...failed(said),reason:'missing'};
27173
+ }
27174
+ const list=document.getElementById('rfiList');
27175
+ const rowOf=()=>_rfiByAttr(list,'data-rfi-row',rfiRowKey('record',rfiId));
27176
+ // Set before the list is drawn again, so it keeps this RFI in view even past the number of rows it draws.
27177
+ rfiMentioned=rfiId;
27178
+ let widened=false;
27179
+ if(!rowOf()){rfiScope='project';rfiStatusFilter='all';widened=true;renderRfiList();}
27180
+ const row=rowOf();
27181
+ if(!row){rfiMentioned=null;return failed(rfiId+' could not be shown on the RFIs page. Find it under All.');}
27182
+ rfiApplyFocus({recordId:rfiId});
27183
+ row.classList.add('is-mentioned');
27184
+ setTimeout(()=>{if(rfiMentioned!==rfiId)return;rfiMentioned=null;
27185
+ const shown=_rfiByAttr(document.getElementById('rfiList'),'data-rfi-row',rfiRowKey('record',rfiId));if(shown)shown.classList.remove('is-mentioned');},2400);
27186
+ return widened?{ok:true,said:'Showing all RFIs, so '+rfiId+' is in view.'}:{ok:true};
27187
+ }
26840
27188
  async function runEditorFocus(req,current){
27189
+ if(req.rfiId)return runRfiFocus(req.rfiId,current);
26841
27190
  const until=Date.now()+EDITOR_FOCUS_3D_WAIT_MS;
26842
27191
  while(!window.Steel3DView&&Date.now()<until){await new Promise(resolve=>setTimeout(resolve,100));if(!current())return null;}
26843
27192
  // #2471: a member an answer cited. The shell checked the project is the cited one; this frame shows that project.
@@ -26883,7 +27232,7 @@ EditorFocus.setRunner(async(req,current)=>{
26883
27232
  catch(error){
26884
27233
  console.error('[steel] could not show the connection asked for',error);
26885
27234
  if(!current())return null;
26886
- const said=req.memberId?'The model could not show member '+req.memberId+'. Press Show in the model again, or find it in the Model panel.':'The model could not show connection '+req.jointId+'. Press Open in the model again, or find it in the Model panel.';
27235
+ const said=editorFocusFailed(req);
26887
27236
  answerToast(said);
26888
27237
  return {ok:false,said};
26889
27238
  }
@@ -27376,6 +27725,134 @@ async function rfiQuickRefile(versionN){
27376
27725
  finally{rfiQuickRefileBusy=null;await refreshRfiRecords();if(rfiOpen())renderRfiList();if(window.__tip)window.__tip.hide();}
27377
27726
  }
27378
27727
 
27728
+ /* #2920 — the questions the newest drawing read asked that nobody filed (owner ruling 2026-10-29). A guided read
27729
+ files only what its reader names, so a read that names nothing published its questions to an empty list. They
27730
+ show here, grouped by kind, and a person raises the ones they want; none is an RFI until somebody does. */
27731
+ const RFI_READ_KIND={
27732
+ 'unknown-elevation':{label:'Member-end heights the read assumed',sub:'Each end is placed at a plan level so the member is built. No drawing confirms the height.'},
27733
+ 'unresolved-line':{label:'Drawn lines not matched to a member'},
27734
+ 'column-short-of-beam':{label:'Columns that stop short of the beams on them'},
27735
+ 'section-inconsistent':{label:'Beams on one span with different sections'},
27736
+ };
27737
+ /** One grouped RFI holds at most this many questions (the store's group limit); more become several. */
27738
+ const RFI_READ_GROUP_MAX=64;
27739
+ /** A group longer than this opens on request, so 84 height rows do not bury everything below them. */
27740
+ const RFI_READ_OPEN_MAX=3;
27741
+ let rfiReadBusy=null,rfiReadFail=null;
27742
+ const rfiReadOpenKinds=new Set();
27743
+ function rfiReadKindLabel(kind,served){
27744
+ // The server's words first: they are the title a grouped RFI of this kind is filed under.
27745
+ if(typeof served==='string'&&served)return served;
27746
+ const known=RFI_READ_KIND[kind];if(known)return known.label;
27747
+ const words=String(kind||'question').replace(/-/g,' ');return words.charAt(0).toUpperCase()+words.slice(1);
27748
+ }
27749
+ /** The read's unfiled questions, by kind, in the order the read listed them. */
27750
+ function rfiReadGroups(){
27751
+ const rq=rfiState.readQuestions;
27752
+ if(!rq||!Array.isArray(rq.notFiled)||!rq.notFiled.length)return [];
27753
+ const byKind=new Map();
27754
+ for(const q of rq.notFiled){if(!q||typeof q.gapKey!=='string')continue;if(!byKind.has(q.kind))byKind.set(q.kind,[]);byKind.get(q.kind).push(q);}
27755
+ return [...byKind].map(([kind,rows])=>({kind,rows}));
27756
+ }
27757
+ /** How many of the read's questions are not filed: the chip's second figure. */
27758
+ function rfiReadCount(){
27759
+ const rq=rfiState.readQuestions;
27760
+ return rq&&Number.isSafeInteger(rq.notFiledCount)&&rq.notFiledCount>0&&!rq.rfiFileUnavailable?rq.notFiledCount:0;
27761
+ }
27762
+ /** A question cut to a phrase Instructor can say: the start of the sentence, never the row's internal id. */
27763
+ function rfiReadShortQuestion(text){
27764
+ const s=String(text||'').replace(/\s+/g,' ').trim();
27765
+ if(!s)return 'this question';
27766
+ return s.length>70?s.slice(0,67).replace(/\s+\S*$/,'')+'…':s;
27767
+ }
27768
+ function rfiReadMembersHtml(ids){
27769
+ if(!Array.isArray(ids)||!ids.length)return '';
27770
+ const shown=ids.slice(0,6).map(id=>'<span>'+esc(id)+'</span>').join('');
27771
+ return '<div class=rfimeta>'+shown+(ids.length>6?'<span>and '+(ids.length-6)+' more</span>':'')+'</div>';
27772
+ }
27773
+ function rfiReadFailHtml(key){
27774
+ return rfiReadFail&&rfiReadFail.key===key?'<div class="rfinote rfiwhy" role=status>'+esc(rfiReadFail.text)+'</div>':'';
27775
+ }
27776
+ function rfiReadRaiseAllLabel(n){
27777
+ const parts=Math.ceil(n/RFI_READ_GROUP_MAX);
27778
+ return parts===1?'Raise one RFI for all '+n:'Raise '+parts+' RFIs for all '+n;
27779
+ }
27780
+ function rfiReadQuestionsHtml(){
27781
+ const rq=rfiState.readQuestions,groups=rfiReadGroups();
27782
+ // Said, never hidden: a list that could not look at the read's questions must not read as one that has none.
27783
+ if(rfiState.readQuestionsUnavailable)return '<section class="rfiunfiled rfiread" data-rfi-read-unavailable aria-label="From the read"><div class=glab>From the read</div><div class="rfinote rfiwhy">FloLess could not list the questions the drawing read asked, so some may be missing from this list. Reopen this step to try again.</div></section>';
27784
+ if(!rq||!groups.length)return '';
27785
+ const unknown=!!rq.rfiFileUnavailable,v=esc(rq.versionN);
27786
+ const heading=unknown?'From the read, filing status unknown':'From the read, not filed';
27787
+ const note=unknown
27788
+ ?'FloLess could not read the RFI file, so it cannot tell which of these questions from the drawing read of version '+v+' are filed already.'
27789
+ :'The drawing read of version '+v+' asked these questions. None of them is an RFI until you raise it.';
27790
+ let html='<section class="rfiunfiled rfiread" data-rfi-row=readsection tabindex=-1 data-rfi-read-version="'+v+'" aria-label="'+esc(heading)+'"><div class=glab>'+esc(heading)+'</div><div class=rfinote>'+note+'</div>';
27791
+ for(const g of groups){
27792
+ const n=g.rows.length,known=RFI_READ_KIND[g.kind],label=rfiReadKindLabel(g.kind,g.rows[0]&&g.rows[0].kindLabel),groupKey='readgroup:'+g.kind;
27793
+ const open=n<=RFI_READ_OPEN_MAX||rfiReadOpenKinds.has(g.kind),busyAll=rfiReadBusy===groupKey;
27794
+ const members=new Set();for(const q of g.rows)for(const id of (q.memberIds||[]))members.add(id);
27795
+ const count=g.kind==='unknown-elevation'&&members.size?n+' end'+(n===1?'':'s')+' on '+members.size+' member'+(members.size===1?'':'s'):String(n);
27796
+ const raiseAll=!unknown&&n>1?'<button data-command-id="steel.rfi-read-raise-all#'+esc(label)+'" data-command-instance-label="'+esc(label)+'" data-rfi-ctl="read-raise-all" data-rfi-read-raise-all="'+esc(g.kind)+'" data-tip="Files these '+n+' questions as '+(n>RFI_READ_GROUP_MAX?'grouped RFIs of up to '+RFI_READ_GROUP_MAX+' questions each':'one grouped RFI')+'. Nothing is sent to anyone."'
27797
+ +(rfiReadBusy!==null?' aria-busy='+(busyAll?'true':'false')+' aria-disabled=true data-blocked-reason="'+(busyAll?'These questions are being filed':'Another question is being filed')+'"':'')+'>'+(busyAll?'Raising…':esc(rfiReadRaiseAllLabel(n)))+'</button>':'';
27798
+ const toggle=n>RFI_READ_OPEN_MAX?'<button class=ghost data-command-id="steel.rfi-read-toggle#'+esc(label)+'" data-command-instance-label="'+esc(label)+'" data-rfi-ctl="read-toggle" data-rfi-read-toggle="'+esc(g.kind)+'" aria-expanded="'+open+'">'+(open?'Hide':'Show '+n)+'</button>':'';
27799
+ html+='<div class=rfireadgroup data-rfi-row="'+esc(groupKey)+'" data-rfi-read-kind="'+esc(g.kind)+'"><div class=rfireadhead><b>'+esc(label)+'</b> <span class=rfireadn>('+esc(count)+')</span></div>'
27800
+ +(known&&known.sub?'<div class=rfinote>'+esc(known.sub)+'</div>':'')
27801
+ +rfiReadFailHtml(groupKey)
27802
+ +(raiseAll||toggle?'<div class=rfiacts>'+raiseAll+toggle+'</div>':'');
27803
+ if(open)for(const q of g.rows){
27804
+ const key='read:'+q.gapKey,busy=rfiReadBusy===key;
27805
+ const raise=unknown?'':'<div class=rfiacts><button data-command-id="steel.rfi-read-raise#'+esc(q.id||q.gapKey)+'" data-command-instance-label="'+esc(rfiReadShortQuestion(q.question))+'" data-rfi-ctl="read-raise" data-rfi-read-raise="'+esc(q.gapKey)+'" data-tip="Files this question as an open RFI. Nothing is sent to anyone."'
27806
+ +(rfiReadBusy!==null?' aria-busy='+(busy?'true':'false')+' aria-disabled=true data-blocked-reason="'+(busy?'This question is being filed':'Another question is being filed')+'"':'')+'>'+(busy?'Raising…':'Raise an RFI')+'</button></div>';
27807
+ html+='<div class=rfirow data-rfi-row="'+esc(key)+'" data-rfi-read-unfiled="'+esc(q.gapKey)+'"><span class="rfikind sym">'+(unknown?'status unknown':'not filed')+'</span><div class=rfitx>'+esc(q.question)
27808
+ +rfiReadMembersHtml(q.memberIds)+rfiReadFailHtml(key)+raise+'</div></div>';
27809
+ }
27810
+ html+='</div>';
27811
+ }
27812
+ if(rq.heldBack>0)html+='<div class=rfimore>'+esc(rq.heldBack)+' more question'+(rq.heldBack===1?'':'s')+' from the read are not listed here.</div>';
27813
+ return html+'</section>';
27814
+ }
27815
+ /** Files read questions: one (a row's Raise an RFI) or every question of one kind as grouped RFIs. */
27816
+ async function rfiReadRaise(gapKeys,asOne,busyKey){
27817
+ const rq=rfiState.readQuestions;
27818
+ if(rfiReadBusy!==null||!rq||!gapKeys.length)return;
27819
+ rfiReadBusy=busyKey;rfiReadFail=null;
27820
+ rfiFocusOverride={rows:[busyKey],ctl:asOne?'read-raise-all':'read-raise'};renderRfiList();
27821
+ // Where focus goes once this row or group has left the list: the next one, else the section, else the title.
27822
+ const order=rfiReadGroups().flatMap(g=>['readgroup:'+g.kind,...g.rows.map(q=>'read:'+q.gapKey)]);
27823
+ const after=order.slice(order.indexOf(busyKey)+1).filter(k=>!(k.startsWith('read:')&&gapKeys.includes(k.slice(5))));
27824
+ let filed=false;
27825
+ try{
27826
+ const res=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/versions/'+encodeURIComponent(rq.versionN)+'/read-questions',
27827
+ {method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(asOne?{gapKeys,asOne:true}:{gapKeys})});
27828
+ const body=await res.json().catch(()=>null);
27829
+ if(res.ok&&body&&body.ok){
27830
+ const outcomes=Array.isArray(body.outcomes)?body.outcomes:[];
27831
+ const made=new Set(outcomes.filter(o=>['created','reused','reopened','successor'].includes(o.result)).map(o=>o.rfiId));
27832
+ const already=outcomes.filter(o=>o.result==='already-seeded').length;
27833
+ // Only what genuinely failed to file stays listed: a question the model no longer asks leaves on the reread.
27834
+ const notFiled=outcomes.filter(o=>o.result==='over-capacity'||o.result==='unplaceable'||o.result==='unchecked').length;
27835
+ filed=made.size>0||already>0;
27836
+ if(made.size)toast((made.size===1?[...made][0]+' raised':made.size+' RFIs raised')+(already?'; '+already+' question'+(already===1?' was':'s were')+' filed already':'')+'.');
27837
+ else if(already)toast('Already filed: '+(already===1?'that question is':'those questions are')+' an RFI.');
27838
+ if(notFiled)rfiReadFail={key:busyKey,text:notFiled+' question'+(notFiled===1?'':'s')+' could not be filed as an RFI, so '+(notFiled===1?'it stays':'they stay')+' listed here'+(made.size||already?'; the others were filed':'')+'. Try again, or ask in AI Chat why.'};
27839
+ }else rfiReadFail={key:busyKey,text:'This could not be filed: '+((body&&body.error)||'the RFI file could not be written')+'. Nothing was changed.'};
27840
+ }catch(e){
27841
+ console.error('[steel] could not file the read questions',e);
27842
+ rfiReadFail={key:busyKey,text:'FloLess could not be reached, so it is not known whether this was filed. Reopen the RFIs step: anything that was filed shows there as an RFI.'};
27843
+ }
27844
+ finally{
27845
+ rfiReadBusy=null;
27846
+ await refreshRfiRecords();
27847
+ rfiFocusOverride=filed&&!rfiReadFail?{rows:[...after,'readsection'],ctl:'*first'}:{rows:[busyKey],ctl:asOne?'read-raise-all':'read-raise'};
27848
+ // Through the shared settle, which yields to somebody typing on another row (review): never a bare repaint.
27849
+ rfiSettleRepaint({force:true,actingRow:busyKey});
27850
+ // A repaint deferred for somebody typing on another row must not steal their focus later (review round 2).
27851
+ if(rfiListIsStale)rfiFocusOverride=null;
27852
+ if(window.__tip)window.__tip.hide();
27853
+ }
27854
+ }
27855
+
27379
27856
  function rfiRecordRowHtml(r){
27380
27857
  if(r&&r.grouped)return rfiGroupedRecordRowHtml(r);
27381
27858
  const rowKey=rfiRowKey('record',r.id);
@@ -27796,6 +28273,10 @@ function wireRfiList(){
27796
28273
  // `promote` comes off the CARRIER, because the row key alone cannot say which namespace it is in.
27797
28274
  if(v==='apply')return Promise.resolve(rfiApplyAction(id,occurrence)).catch(rfiGestureFailure);return rfiOpenForm(id,v,promote,occurrence,scopeKind);});
27798
28275
  root.querySelectorAll('[data-rfi-quick-refile]').forEach(b=>b.onclick=()=>Promise.resolve(rfiQuickRefile(Number(b.dataset.rfiQuickRefile))).catch(rfiGestureFailure));
28276
+ // #2920: the read's unfiled questions — one, every one of a kind, or show and hide a kind.
28277
+ root.querySelectorAll('[data-rfi-read-raise]').forEach(b=>b.onclick=()=>{const k=b.dataset.rfiReadRaise;return Promise.resolve(rfiReadRaise([k],false,'read:'+k)).catch(rfiGestureFailure);});
28278
+ root.querySelectorAll('[data-rfi-read-raise-all]').forEach(b=>b.onclick=()=>{const kind=b.dataset.rfiReadRaiseAll,g=rfiReadGroups().find(x=>x.kind===kind);if(!g)return;return Promise.resolve(rfiReadRaise(g.rows.map(q=>q.gapKey),true,'readgroup:'+kind)).catch(rfiGestureFailure);});
28279
+ root.querySelectorAll('[data-rfi-read-toggle]').forEach(b=>b.onclick=()=>{const kind=b.dataset.rfiReadToggle;if(rfiReadOpenKinds.has(kind))rfiReadOpenKinds.delete(kind);else rfiReadOpenKinds.add(kind);rfiFocusOverride={rows:['readgroup:'+kind],ctl:'read-toggle'};renderRfiList();});
27799
28280
  root.querySelectorAll('[data-rfi-expand]').forEach(b=>b.onclick=()=>{
27800
28281
  const id=b.dataset.rfiExpand;if(rfiExpandedGroups.has(id))rfiExpandedGroups.delete(id);else rfiExpandedGroups.add(id);
27801
28282
  rfiFocusOverride={rows:[rfiRowKey('record',id)],ctl:'expand'};renderRfiList();});
@@ -31398,13 +31879,17 @@ rfiPostShell({type:'floless:editor-ready'});
31398
31879
  function set(el,txt){ if(el && el.textContent!==txt) el.textContent=txt; }
31399
31880
  function refresh(){
31400
31881
  set(document.getElementById('structN'),String(num(document.getElementById('mc'))));
31401
- const bad=num(document.getElementById('rc'))+num(document.getElementById('dpc'))+num(document.getElementById('endsCount'));
31882
+ // #2920: a question the read asked and nobody filed is unresolved too, so it counts here and keeps "Nothing
31883
+ // unresolved" from being said over it. The RFI readout itself shows it apart from the open RFIs.
31884
+ const bad=num(document.getElementById('rc'))+num(document.getElementById('rcReadN'))+num(document.getElementById('dpc'))+num(document.getElementById('endsCount'));
31402
31885
  set(document.getElementById('qualN'),String(bad));
31403
31886
  qual.classList.toggle('has',bad>0);
31404
31887
  // Four zeroes state the numbers but not the answer. Only when the ends check has actually RUN, though:
31405
31888
  // "—" means not known, and calling that all-clear would be the panel asserting something it cannot see.
31406
31889
  const endsKnown=(document.getElementById('endsCount').textContent||'').trim()!=='—';
31407
- document.getElementById('qualClear').hidden=!(bad===0&&endsKnown);
31890
+ // #2920: nor while the drawing read's questions could not be listed (Codex on #2929).
31891
+ const readUnknown=document.getElementById('rfiStat').classList.contains('readunknown');
31892
+ document.getElementById('qualClear').hidden=!(bad===0&&endsKnown&&!readUnknown);
31408
31893
  // The pounds line follows Weight, so it hides with it rather than being left behind on its own.
31409
31894
  document.getElementById('wtLbStat').style.display=document.getElementById('wtStat').style.display;
31410
31895
  // Structure is Members + Weight and nothing else, so when stats() hides both for a sheet with no plan