@floless/app 0.157.0 → 0.159.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/cli-actions.mjs +7 -0
  2. package/dist/floless-server.cjs +188306 -155284
  3. package/dist/schemas/drawing-check.profile.v1.schema.json +33 -1
  4. package/dist/skills/floless-app-actions/SKILL.md +26 -5
  5. package/dist/skills/floless-app-bridge/SKILL.md +5 -3
  6. package/dist/skills/floless-app-knowledge/SKILL.md +14 -1
  7. package/dist/skills/floless-app-knowledge/references/schema.md +4 -1
  8. package/dist/skills/floless-app-onboarding/SKILL.md +67 -4
  9. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +7 -4
  10. package/dist/skills/floless-app-queue/SKILL.md +3 -1
  11. package/dist/skills/floless-app-steel-model/SKILL.md +41 -1
  12. package/dist/skills/floless-app-steel-takeoff/SKILL.md +71 -1
  13. package/dist/skills/floless-app-workflows/SKILL.md +6 -3
  14. package/dist/web/agents.js +12 -5
  15. package/dist/web/app.css +229 -27
  16. package/dist/web/app.js +6 -0
  17. package/dist/web/aware.js +275 -64
  18. package/dist/web/chat.css +60 -22
  19. package/dist/web/chat.js +396 -59
  20. package/dist/web/commands-shell.js +546 -11
  21. package/dist/web/commands-steel.js +1 -0
  22. package/dist/web/drawing-check-editor.html +10 -0
  23. package/dist/web/drawing-check-editor.js +44 -0
  24. package/dist/web/guide.js +4 -2
  25. package/dist/web/index.html +66 -12
  26. package/dist/web/instructor.js +21 -9
  27. package/dist/web/kb-categories.js +351 -0
  28. package/dist/web/kb-graph-worker.js +73 -0
  29. package/dist/web/pages.js +185 -19
  30. package/dist/web/project-access.js +67 -8
  31. package/dist/web/project-modules.js +474 -0
  32. package/dist/web/project-workflows.js +274 -0
  33. package/dist/web/run-page-view.js +353 -0
  34. package/dist/web/steel-3d-core.js +46 -0
  35. package/dist/web/steel-3d-view.js +8 -38
  36. package/dist/web/steel-editor.html +225 -43
  37. package/dist/web/tab-signal.js +323 -0
  38. package/dist/web/terminal-requests.js +48 -7
  39. package/dist/web/workspace-root-recovery.js +119 -0
  40. package/dist/web/workspaces.js +1597 -220
  41. package/launch-starting-page.mjs +184 -0
  42. package/launch.mjs +214 -73
  43. package/package.json +7 -1
  44. package/dist/web/report-files.js +0 -50
@@ -542,6 +542,52 @@ export function sectionOutlinePts(kind, w, d, thk) {
542
542
  return { outer }; // BOX / unclassified → rectangle
543
543
  }
544
544
 
545
+ /**
546
+ * The 3D section kind of one scene member: an explicit `section.shape` override wins, then the bake's
547
+ * `section.round` (a round HSS cannot be told from its designation — `sectionKindOf` answers TUBE for both
548
+ * `HSS6X6X3/8` and `HSS6.625X0.280`), then the designation through `sectionKindOf`. Shared by the 3D
549
+ * renderer (`steel-3d-view.js`) and the Page `.glb` exporter (`server/glb-export.ts`) so the two cannot
550
+ * draw the same member as different shapes.
551
+ */
552
+ export function memberShapeKind(el) {
553
+ const explicit = (el && el.section && el.section.shape || '').toString().toUpperCase().trim();
554
+ if (/^(I|C|L|TUBE|BOX|ROUND)$/.test(explicit)) return explicit;
555
+ if (el && el.section && el.section.round === true) return 'ROUND';
556
+ return sectionKindOf((el && el.meta && el.meta.profile) || '');
557
+ }
558
+
559
+ /** True when a member is drawn as an extruded section rather than a plain box. */
560
+ export function memberExtrudes(el) {
561
+ const display = el && el.meta && el.meta.displaySection;
562
+ const displayExtrudes = !!display && !/^(rect|joist|unsupported-custom)$/.test(String(display.shape));
563
+ return displayExtrudes || memberShapeKind(el) !== 'BOX';
564
+ }
565
+
566
+ // A real thickness off the element's `xsection` (AISC table / designation) when there is one and it fits
567
+ // inside the section, else null so the caller keeps its estimate. The fit check matters: a metric
568
+ // designation's thickness token is parsed as inches, which would draw a leg thicker than the whole angle.
569
+ function xsectionThk(xs, key, half) {
570
+ const t = xs && typeof xs[key] === 'number' ? xs[key] : null;
571
+ return t != null && t > 0 && t < 2 * half ? t : null;
572
+ }
573
+
574
+ /**
575
+ * The section topology a member is extruded from. `displaySection` (tee, double-angle, …) wins; without it
576
+ * the element's `xsection` supplies the real thicknesses. Without either every thickness is a GUESS off the
577
+ * envelope — an L4X4 leg came out 18.3mm against a real 9.5 — and the estimates in `sectionOutlinePts` are
578
+ * the fallback that lets a member be drawn at all.
579
+ */
580
+ export function memberSectionTopology(kind, w, d, xs, displaySection) {
581
+ const fallback = xs ? {
582
+ ...(xs.shape === 'i' ? { shape: 'i', d: xs.d, bf: xs.bf, tw: xsectionThk(xs, 'tw', w / 2), tf: xsectionThk(xs, 'tf', d / 2) } : {}),
583
+ ...(xs.shape === 'channel' ? { shape: 'channel', d: xs.d, bf: xs.bf, tw: xsectionThk(xs, 'tw', w / 2), tf: xsectionThk(xs, 'tf', d / 2) } : {}),
584
+ ...(xs.shape === 'angle' ? { shape: 'angle', d: xs.d, b: xs.b, t: xsectionThk(xs, 't', Math.min(w, d) / 2) } : {}),
585
+ ...(xs.shape === 'rhs' ? { shape: 'rhs', d: xs.d, b: xs.b, t: xsectionThk(xs, 't', Math.min(w, d) / 2) } : {}),
586
+ ...(xs.shape === 'chs' ? { shape: 'chs', od: xs.od, t: xsectionThk(xs, 't', Math.min(w, d) / 2) } : {}),
587
+ } : null;
588
+ return sectionTopology(displaySection || fallback, w, d, kind);
589
+ }
590
+
545
591
  /** How many segments approximate a circle for the consumers that need a polygon. */
546
592
  export const ROUND_SEGMENTS = 48;
547
593
 
@@ -21,7 +21,7 @@ import { surfaceTextures, applyTriplanar, TILE_MM, DIRECTIONAL } from './steel-m
21
21
  import { canvasToolGuidanceState } from './steel-canvas-guidance.js';
22
22
  import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
23
23
  import { FT_TO_MM as FT_MM } from './steel-units.js';
24
- import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, projectToPlane, snapGridPoint, projectPointOnSegment2d, projectPointOnSegment3d, selectedFrontmostHit, worldEndpointCommit, SEG_DEGENERACY, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf, sectionTopology, memberMeshAxes, positionSwingDelta, snapToStep, rollCommitNorm, unwrapAngleStep, translateEndpoints, livePositionState, swingBasis, swingEndpoint, swingBarriers, clampSwingTheta, POSITION_SWING_MARGIN_RAD, POSITION_OFFSET_SNAP_MM, POSITION_ROT_SNAP_DEG, POSITION_BASIS_CAPABILITY_VERSION } from './steel-3d-core.js';
24
+ import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, projectToPlane, snapGridPoint, projectPointOnSegment2d, projectPointOnSegment3d, selectedFrontmostHit, worldEndpointCommit, SEG_DEGENERACY, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf, sectionTopology, memberShapeKind, memberExtrudes, memberSectionTopology, memberMeshAxes, positionSwingDelta, snapToStep, rollCommitNorm, unwrapAngleStep, translateEndpoints, livePositionState, swingBasis, swingEndpoint, swingBarriers, clampSwingTheta, POSITION_SWING_MARGIN_RAD, POSITION_OFFSET_SNAP_MM, POSITION_ROT_SNAP_DEG, POSITION_BASIS_CAPABILITY_VERSION } from './steel-3d-core.js';
25
25
  // `gridGeometry`, `gridCandidates3d` and `sheetScaleMm` live behind the host's model read boundary
26
26
  // because their display-scale argument is meaningless on a world-mm model grid.
27
27
  import { visibleGridLevels, gridTransientScopeSignature, reconcileGridTransientState, objectSelectionStatus } from './grid-core.js';
@@ -940,42 +940,13 @@ function lengthAxisOf(el) {
940
940
  // finish across the nut's short axis instead of along its sweep.
941
941
  if (kind === 'rod' || kind === 'bolt-shank' || kind === 'anchor' || kind === 'nut') return 'y'; // CylinderGeometry
942
942
  if (kind === 'plate' || kind === 'washer' || kind === 'bolt-head') return 'z';
943
- const display = el?.meta?.displaySection;
944
- const displayExtrudes = display && !/^(rect|joist|unsupported-custom)$/.test(String(display.shape));
945
- return !displayExtrudes && shapeOf(el) === 'BOX' ? 'y' : 'z'; // Box vs Extrude
946
- }
947
- function shapeOf(el) {
948
- const explicit = (el.section && el.section.shape || '').toString().toUpperCase().trim();
949
- if (/^(I|C|L|TUBE|BOX|ROUND)$/.test(explicit)) return explicit; // explicit section.shape override wins
950
- // A ROUND section cannot be told from its designation here: `sectionKindOf` matches a literal prefix and
951
- // answers TUBE for both `HSS6X6X3/8` (rectangular) and `HSS6.625X0.280` (round). The bake parses the
952
- // numerics and says so on `section.round` — without it a pipe drew as a rectangle whose corner reaches
953
- // 0.707·OD, putting a rolled pipe's flush face 23.7 mm off its reference line.
954
- if (el.section && el.section.round === true) return 'ROUND';
955
- // The designation itself goes to the shared classifier (steel-3d-core.js), which the 2D plan outline
956
- // and the base-plate weld also use. The copy that lived here drew MC channels as I-sections (#647).
957
- return sectionKindOf((el.meta && el.meta.profile) || '');
958
- }
959
- // A real thickness off the element's `xsection` (AISC table / designation) when there is one and it fits
960
- // inside the section, else null so the caller keeps its estimate. The fit check matters: a metric
961
- // designation's thickness token is parsed as inches, which would draw a leg thicker than the whole angle.
962
- function realThk(xs, key, half) {
963
- const t = xs && typeof xs[key] === 'number' ? xs[key] : null;
964
- return t != null && t > 0 && t < 2 * half ? t : null;
965
- }
966
- // `xs` is the scene element's `xsection`. Without it every thickness here is a GUESS off the envelope —
967
- // an L4X4 leg came out 18.3mm against a real 9.5, so a connection bearing on the real face rendered buried
968
- // in a member that was drawn nearly twice too thick. The estimates remain as the fallback for sections we
969
- // have no data for; they are the reason a member can still be drawn at all.
943
+ return !memberExtrudes(el) ? 'y' : 'z'; // Box vs Extrude
944
+ }
945
+ // The section kind and topology are steel-3d-core.js's (`memberShapeKind`, `memberSectionTopology`), shared
946
+ // with the Page .glb exporter so a shared 3D file draws every member as this view does.
947
+ const shapeOf = memberShapeKind;
970
948
  function profileShape(kind, w, d, xs, displaySection) {
971
- const fallback = xs ? {
972
- ...(xs.shape === 'i' ? { shape: 'i', d: xs.d, bf: xs.bf, tw: realThk(xs, 'tw', w / 2), tf: realThk(xs, 'tf', d / 2) } : {}),
973
- ...(xs.shape === 'channel' ? { shape: 'channel', d: xs.d, bf: xs.bf, tw: realThk(xs, 'tw', w / 2), tf: realThk(xs, 'tf', d / 2) } : {}),
974
- ...(xs.shape === 'angle' ? { shape: 'angle', d: xs.d, b: xs.b, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
975
- ...(xs.shape === 'rhs' ? { shape: 'rhs', d: xs.d, b: xs.b, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
976
- ...(xs.shape === 'chs' ? { shape: 'chs', od: xs.od, t: realThk(xs, 't', Math.min(w, d) / 2) } : {}),
977
- } : null;
978
- const topology = sectionTopology(displaySection || fallback, w, d, kind);
949
+ const topology = memberSectionTopology(kind, w, d, xs, displaySection);
979
950
  const trace = (path, descriptor) => {
980
951
  if (descriptor.kind === 'circle') { path.absarc(descriptor.cx, descriptor.cy, descriptor.radius, 0, Math.PI * 2, false); return; }
981
952
  descriptor.points.forEach(([x, y], i) => (i ? path.lineTo(x, y) : path.moveTo(x, y))); path.closePath();
@@ -989,8 +960,7 @@ function profileShape(kind, w, d, xs, displaySection) {
989
960
  function memberGeom(el, w, d, len) {
990
961
  const kind = shapeOf(el);
991
962
  const display = el?.meta?.displaySection;
992
- const displayExtrudes = display && !/^(rect|joist|unsupported-custom)$/.test(String(display.shape));
993
- if (kind === 'BOX' && !displayExtrudes) return new THREE.BoxGeometry(w, len, d); // length on local Y
963
+ if (!memberExtrudes(el)) return new THREE.BoxGeometry(w, len, d); // length on local Y
994
964
  const shapes = profileShape(kind, w, d, el && el.xsection, display);
995
965
  const g = new THREE.ExtrudeGeometry(shapes, { depth: len, bevelEnabled: false, curveSegments: 32 });
996
966
  g.translate(0, 0, -len / 2); return g; // extruded +Z, centred
@@ -1463,6 +1463,17 @@ rect.lblhot:focus-visible{outline:2px solid var(--brand);outline-offset:2px;stro
1463
1463
  #rfiList .rfimeta span{background:var(--sunken);border:1px solid var(--line);color:var(--mut);
1464
1464
  border-radius:4px;padding:0 5px;font-size:10px;line-height:1.7}
1465
1465
  #rfiList .rfinote{margin-top:4px;color:var(--mut);font-size:11px;line-height:1.5}
1466
+ /* #2521 row 3b-2 — the AI's mark. The word "AI" carries it, so it survives losing colour; the brand
1467
+ outline only says it is not one of the grey facts beside it. Shown where the AI wrote the proposal. */
1468
+ #rfiList .rfimeta .rfiby.ai{color:var(--brand);border-color:var(--brand)}
1469
+ #rfiList .rfioccurrence-title{display:inline-flex;align-items:baseline;gap:6px;flex-wrap:wrap;margin-top:0}
1470
+ /* A Quick version's questions the AI could not get into the RFI file. Rows, not the banner: they are
1471
+ questions waiting on a filing, and the dashed badge already means "not filed" in this list. */
1472
+ #rfiList .rfiunfiled{padding:6px 0 8px;border-bottom:1px solid var(--line);margin-bottom:4px}
1473
+ #rfiList .rfiunfiled .glab{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut);padding:0 8px}
1474
+ #rfiList .rfiunfiled>.rfinote,#rfiList .rfiunfiled>.rfiacts{padding:0 8px}
1475
+ #rfiList .rfiunfiled .rfiwhy{color:var(--warn)}
1476
+ #rfiList .rfiunfiled b.rfiwarn{color:var(--warn)}
1466
1477
  #rfiList .rfiacts{margin-top:6px;display:flex;flex-wrap:wrap;gap:5px;align-items:center}
1467
1478
  #rfiList .rfiacts button{font-size:11px;padding:3px 8px}
1468
1479
  #rfiList .rfiacts [aria-disabled=true]{opacity:.48;cursor:progress;background:var(--btn);border-color:var(--ctrl-border)}
@@ -3585,14 +3596,15 @@ const EditorFocus = (() => {
3585
3596
  Promise.resolve().then(() => runner(job.req, current)).then(
3586
3597
  (outcome) => vacate(job, current() && outcome ? outcome : { superseded: true }),
3587
3598
  // The runner shows its own sentences; this is only the last line of defence, so the caller is never left waiting.
3588
- (error) => { console.error('[steel] could not show the connection asked for', error); vacate(job, current() ? { ok: false, said: 'The model could not show connection ' + job.req.jointId + '. Press Open in the model again, or find it in the Model panel.' } : { superseded: true }); });
3599
+ (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 }); });
3589
3600
  };
3590
3601
  window.flolessEditorState = { project: PROJECT, ready: false };
3591
3602
  const text = (value) => typeof value === 'string' && value ? value : '';
3592
3603
  // #2450: a request may also ask to raise an RFI, and name the check to show first.
3604
+ // #2471: or name one member (an AI Chat answer's cited member) instead of a connection.
3593
3605
  const normalise = (req) => req && text(req.jointId)
3594
3606
  ? { jointId: req.jointId, ...(req.raiseRfi === true ? { raiseRfi: true } : {}), ...(text(req.checkId) ? { checkId: req.checkId } : {}) }
3595
- : null;
3607
+ : req && text(req.memberId) ? { memberId: req.memberId } : null;
3596
3608
  window.flolessEditorFocus = (req) => {
3597
3609
  if (!normalise(req)) return false;
3598
3610
  const id = typeof req.requestId === 'string' && req.requestId ? req.requestId : 'editor-' + (++made);
@@ -14040,7 +14052,20 @@ function toast(msg,sticky,ms,visualOnly){let t=document.getElementById('toast');
14040
14052
  if(!t){t=document.createElement('div');t.id='toast';t.style.cssText='position:fixed;left:50%;bottom:18px;transform:translateX(-50%);background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:8px 14px;box-shadow:var(--shadow-md);z-index:60;font:13px var(--ui);line-height:1.5;max-width:min(480px,86vw);opacity:0;transition:opacity .2s;pointer-events:none';document.body.appendChild(t);}
14041
14053
  if(visualOnly){t.removeAttribute('role');t.removeAttribute('aria-live');t.removeAttribute('aria-atomic');}
14042
14054
  else{t.setAttribute('role','status');t.setAttribute('aria-live','polite');t.setAttribute('aria-atomic','true');}
14043
- t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},ms>0?ms:TOAST_MS);}
14055
+ t.textContent=msg;t.style.opacity='1';clearTimeout(t._h);if(!sticky)t._h=setTimeout(()=>{t.style.opacity='0';},ms>0?ms:TOAST_MS);
14056
+ t._holdUntil=0;t._deferred=null;clearTimeout(t._dh);} // any later toast ends a hold and drops a waiting status line (#2621)
14057
+ // #2621: the answer to something the person asked for from outside (Open / Show in the model) holds the toast for
14058
+ // its full time. The 3D bake lands in the same moment and its build-status line used to replace the answer 2 ms
14059
+ // later, so the person never read why their press failed.
14060
+ const ANSWER_TOAST_MS=9000;
14061
+ function answerToast(msg){toast(msg,false,ANSWER_TOAST_MS);document.getElementById('toast')._holdUntil=Date.now()+ANSWER_TOAST_MS;}
14062
+ // A passive status line (the build status after a bake) waits out a held answer and then shows for its own full
14063
+ // time. `line` is called when it SHOWS, not when it was asked for, so what it says is what is true then (an empty
14064
+ // line shows nothing); only the latest waits, since it reads the same live state the older one would have.
14065
+ function statusToast(line){const t=document.getElementById('toast'),left=t?t._holdUntil-Date.now():0;
14066
+ if(!(left>0)){const msg=line();if(msg)toast(msg);return;}
14067
+ clearTimeout(t._dh);t._deferred=line;
14068
+ t._dh=setTimeout(()=>{const l=t._deferred;t._deferred=null;const msg=l?l():'';if(msg)toast(msg);},left);}
14044
14069
  // --- pointer: select(+ctrl toggle / box) + group-move + endpoint (Shift = ortho) ---
14045
14070
  function applyProfileLabel(prof){
14046
14071
  if(mode!=='add'&&picking&&pickKind==='profile'&&selIds.size===1){const id=[...selIds][0];picking=false;edit(()=>{const m=byId(id);ModelCmd.patchMember(m,{profile:prof,rfi:_wtPlf(prof)==null});if(!profs.includes(prof)){profs.push(prof);profs.sort();}});restoreProfilePickerOwnerAfterApply('pickProf');return true;}
@@ -15303,20 +15328,35 @@ function connectionRefusalCopy(d,m){
15303
15328
  };
15304
15329
  return byCode[d.code]||{head:'Not built · Connection was refused',detail:'The connection engine refused '+(d.jointId||'this joint')+' ('+(d.code||'unknown reason')+'). No geometry or member trim was created.'};
15305
15330
  }
15331
+ // The build-status line, written when it SHOWS rather than when the bake landed (#2621): one that waited out a held
15332
+ // answer says what is true then. A diagnostic counts as told only once this line reaches the screen, so one whose
15333
+ // line was replaced or dropped is still said by the next; one that went away meanwhile is not. While a re-bake is
15334
+ // in flight the list is empty, so the line is empty and nothing is marked told. `connectionSkipNote` is the latest
15335
+ // bake's skipped counts, kept until said: a bake without skips clears it.
15336
+ let connectionSkipNote=null;
15337
+ function connectionStatusLine(){
15338
+ const fresh=connectionDiagnostics.filter(d=>!shownConnectionDiagnosticSignatures.has(connectionDiagnosticSignature(d)));
15339
+ const refused=fresh.filter(d=>d.severity==='error').length,adjusted=fresh.filter(d=>d.code==='bolt-gauge-adjusted').length;
15340
+ const limited=fresh.filter(d=>d.code==='support-section-unsupported').length,sk=connectionSkipNote||{unreported:0,noFit:0};
15341
+ const bits=[];
15342
+ if(refused)bits.push(refused+' connection'+(refused>1?'s':'')+' not built');
15343
+ if(adjusted)bits.push(adjusted+' built with an adjusted bolt gauge');
15344
+ if(limited)bits.push(limited+' connection'+(limited>1?'s':'')+' built with limited support-side fit');
15345
+ if(sk.unreported)bits.push(sk.unreported+' connection'+(sk.unreported>1?'s':'')+' not shown in 3D');
15346
+ if(sk.noFit)bits.push(sk.noFit+' member'+(sk.noFit>1?'s':'')+' priced but not drawn — no tabulated footprint');
15347
+ if(!bits.length)return '';
15348
+ for(const d of fresh)shownConnectionDiagnosticSignatures.add(connectionDiagnosticSignature(d));
15349
+ connectionSkipNote=null;
15350
+ return bits.join(' · ')+' — see the member’s Properties panel.';
15351
+ }
15306
15352
  function updateConnectionDiagnostics(raw,announce=true){
15307
15353
  const unique=[],seen=new Set();
15308
15354
  for(const d of (Array.isArray(raw)?raw:[])){if(!d||typeof d!=='object'||!d.jointId||!d.code)continue;const sig=connectionDiagnosticSignature(d);if(seen.has(sig))continue;seen.add(sig);unique.push(d);}
15309
15355
  for(const sig of [...shownConnectionDiagnosticSignatures])if(!seen.has(sig))shownConnectionDiagnosticSignatures.delete(sig);
15310
15356
  const fresh=unique.filter(d=>!shownConnectionDiagnosticSignatures.has(connectionDiagnosticSignature(d)));
15311
15357
  connectionDiagnostics=unique;connectionDiagnosticsStatus='ready';announceConnectionTruth('Connection build status checked.',false);
15312
- for(const d of fresh)shownConnectionDiagnosticSignatures.add(connectionDiagnosticSignature(d));
15313
- if(announce&&fresh.length){
15314
- const refused=fresh.filter(d=>d.severity==='error').length,adjusted=fresh.filter(d=>d.code==='bolt-gauge-adjusted').length;
15315
- const limited=fresh.filter(d=>d.code==='support-section-unsupported').length;
15316
- const bits=[];if(refused)bits.push(refused+' connection'+(refused>1?'s':'')+' not built');if(adjusted)bits.push(adjusted+' built with an adjusted bolt gauge');if(limited)bits.push(limited+' connection'+(limited>1?'s':'')+' built with limited support-side fit');
15317
- toast(bits.join(' · ')+' — see the member’s Properties panel.');
15318
- }
15319
- return {count:fresh.length,refused:fresh.filter(d=>d.severity==='error').length,adjusted:fresh.filter(d=>d.code==='bolt-gauge-adjusted').length,limited:fresh.filter(d=>d.code==='support-section-unsupported').length};
15358
+ if(announce&&fresh.length)statusToast(connectionStatusLine);
15359
+ return fresh.length;
15320
15360
  }
15321
15361
  function applyConnectionBakeTruth(j,announce=true){
15322
15362
  const fresh=updateConnectionDiagnostics(j&&j.diagnostics,false),sk=Array.isArray(j&&j.skipped)?j.skipped:[];
@@ -15327,15 +15367,9 @@ function applyConnectionBakeTruth(j,announce=true){
15327
15367
  // the silence below was justified by, so it gets said (#627).
15328
15368
  const noFit=sk.filter(s=>String(s).startsWith('nofootprint:')).length;
15329
15369
  if(sk.length)console.warn('3D bake skipped '+sk.length+' item(s):',sk);
15330
- if(announce&&(fresh.count||unreported||noFit)){
15331
- const bits=[];
15332
- if(fresh.refused)bits.push(fresh.refused+' connection'+(fresh.refused>1?'s':'')+' not built');
15333
- if(fresh.adjusted)bits.push(fresh.adjusted+' built with an adjusted bolt gauge');
15334
- if(fresh.limited)bits.push(fresh.limited+' connection'+(fresh.limited>1?'s':'')+' built with limited support-side fit');
15335
- if(unreported)bits.push(unreported+' connection'+(unreported>1?'s':'')+' not shown in 3D');
15336
- if(noFit)bits.push(noFit+' member'+(noFit>1?'s':'')+' priced but not drawn — no tabulated footprint');
15337
- toast(bits.join(' · ')+' — see the member’s Properties panel.');
15338
- }
15370
+ if(!announce)return;
15371
+ connectionSkipNote=unreported||noFit?{unreported,noFit}:null;
15372
+ if(fresh||unreported||noFit)statusToast(connectionStatusLine);
15339
15373
  }
15340
15374
  async function fetchScenePayload(contract=C){
15341
15375
  const r=await fetch('/api/contract/'+encodeURIComponent(APP_ID)+'/scene'+PROJECT_QS,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({contract})});
@@ -15370,6 +15404,7 @@ function connectionTruthRequest(){
15370
15404
  }
15371
15405
  function invalidateConnectionDiagnostics(immediate=false){
15372
15406
  const seq=++connectionDiagnosticsSeq,truth=connectionTruthRequest();
15407
+ connectionSkipNote=null; // the last bake's skips are stale now too; a status line still waiting must not say them (#2621)
15373
15408
  if(connectionDiagnosticsTimer){clearTimeout(connectionDiagnosticsTimer);connectionDiagnosticsTimer=null;}
15374
15409
  connectionPreviewJointByEnd=truth.previewByEnd;
15375
15410
  if((!Array.isArray(C&&C.joints)||!C.joints.length)&&!truth.count){connectionDiagnostics=[];connectionDiagnosticsStatus='ready';announceConnectionTruth('',false);return;}
@@ -22842,12 +22877,14 @@ async function setView(on,{remember=true}={}){
22842
22877
  // Bounded by a WALL-CLOCK deadline rather than a tick count: setTimeout is clamped to >=1s in a
22843
22878
  // background tab, which would stretch a counted 5 s into roughly a hundred.
22844
22879
  let viewWantSeq=0; // any newer request supersedes an outstanding wait
22880
+ let viewChoiceSeq=0; // bumped only by the person's own 2D/3D/Split choice; view3dSettled stops waiting on it
22881
+ let viewRestorePending=false; // the boot restore of the saved layout is queued; a focus request takes it over (#2622)
22845
22882
  function setViewBusy(on){const g=document.getElementById('viewToggle');if(g){if(on)g.setAttribute('aria-busy','true');else g.removeAttribute('aria-busy');}}
22846
22883
  // Both handlers key on the MODE, not on the active pane. Keying on view3d made each a no-op in a split:
22847
22884
  // with the 2D pane active the 2D segment did nothing, with the 3D pane active the 3D segment did nothing,
22848
22885
  // and split became a trap you could not leave by the control that got you into it.
22849
22886
  function requestView2d(){viewWantSeq++;setViewBusy(false);if(viewMode!=='2d')setView('2d');}
22850
- function requestView3d(){
22887
+ function requestView3d({remember=true}={}){
22851
22888
  const want=++viewWantSeq,deadline=Date.now()+5000;
22852
22889
  return new Promise(resolve=>{
22853
22890
  const tick=async()=>{
@@ -22857,7 +22894,7 @@ function requestView3d(){
22857
22894
  try{
22858
22895
  let appliedSeq=viewSeq;
22859
22896
  if(viewMode==='3d'){if(viewTransition)await viewTransition;}
22860
- else{const pending=setView('3d');appliedSeq=viewSeq;await pending;}
22897
+ else{const pending=setView('3d',{remember});appliedSeq=viewSeq;await pending;}
22861
22898
  resolve(want===viewWantSeq&&appliedSeq===viewSeq&&viewMode==='3d');
22862
22899
  }catch(error){console.error('[steel] could not finish changing views',error);resolve(false);}
22863
22900
  return;
@@ -22869,22 +22906,30 @@ function requestView3d(){
22869
22906
  }
22870
22907
  // Split needs the renderer exactly as 3D does, so it waits on the same deadline rather than refusing
22871
22908
  // instantly — see requestView3d's comment above for why an instant refusal is the worse failure.
22872
- function requestViewSplit(){
22909
+ // It answers whether Split landed, so a caller can await it and a newer request still supersedes it while it waits.
22910
+ function requestViewSplit({remember=true}={}){
22873
22911
  const want=++viewWantSeq,deadline=Date.now()+5000;
22912
+ return new Promise(resolve=>{
22874
22913
  const tick=()=>{
22875
- if(want!==viewWantSeq)return;
22876
- if(viewMode==='split'){setViewBusy(false);return;}
22877
- if(window.Steel3DView||Date.now()>=deadline){setViewBusy(false);setView('split');return;}
22914
+ if(want!==viewWantSeq){resolve(false);return;}
22915
+ if(viewMode==='split'){setViewBusy(false);resolve(true);return;}
22916
+ if(window.Steel3DView||Date.now()>=deadline){
22917
+ setViewBusy(false);
22918
+ setView('split',{remember}).then(()=>resolve(want===viewWantSeq&&viewMode==='split'),
22919
+ error=>{console.error('[steel] could not finish changing views',error);resolve(false);});
22920
+ return;
22921
+ }
22878
22922
  setTimeout(tick,50);
22879
22923
  };
22880
22924
  tick();
22925
+ });
22881
22926
  }
22882
22927
  // Each clears pendingView: between the hand-over below and its deferred start, view3d is still false,
22883
22928
  // so a REAL 2D click landing in that gap is a no-op AND would then be overridden by the queued 3D
22884
22929
  // switch — silently doing the opposite of the last thing the user asked for.
22885
- document.getElementById('vt2d').onclick=()=>{pendingView=null;requestView2d();};
22886
- document.getElementById('vt3d').onclick=()=>{pendingView=null;requestView3d();};
22887
- {const s=document.getElementById('vtSplit');if(s)s.onclick=()=>{pendingView=null;requestViewSplit();};}
22930
+ document.getElementById('vt2d').onclick=()=>{pendingView=null;viewChoiceSeq++;requestView2d();};
22931
+ document.getElementById('vt3d').onclick=()=>{pendingView=null;viewChoiceSeq++;requestView3d();};
22932
+ {const s=document.getElementById('vtSplit');if(s)s.onclick=()=>{pendingView=null;viewChoiceSeq++;requestViewSplit();};}
22888
22933
  // CAPTURE phase, so the pane is active BEFORE the canvas's own handler runs: the 3D engine's onDown is
22889
22934
  // itself a capture-phase listener on #stage3d, and it must see inputActive already true.
22890
22935
  document.getElementById('pane2d').addEventListener('pointerdown',()=>setActivePane('2d'),true);
@@ -22940,7 +22985,8 @@ viewHandlersLive=true;
22940
22985
  // hand-over below is: main() is still wiring the state setView acts on.
22941
22986
  if(pendingView===null&&requestedMode!=='2d'){
22942
22987
  const want=requestedMode;
22943
- setTimeout(()=>{if(pendingView!==null)return;setView(want,{remember:false});},0);
22988
+ viewRestorePending=true;
22989
+ setTimeout(()=>{if(pendingView!==null||!viewRestorePending)return;viewRestorePending=false;setView(want,{remember:false});},0);
22944
22990
  }
22945
22991
  // A model without an editable 2D plan defaults to 3D, where the full model is visible.
22946
22992
  //
@@ -24372,7 +24418,9 @@ async function refreshRfiRecords(opts){
24372
24418
  // unknown project, a malformed id, a project with no incarnation yet — carry no code at all, so an
24373
24419
  // arm that switched on one would fall through for a state a real project can reach.
24374
24420
  rfiState={status:'fail',records:live,sizeTruth:'known',liveTruth:j.liveTruth==='unavailable'?'unavailable':'known',detail:'',
24375
- liveDetail:String(j.liveTruthDetail||''),http:r.status||0,error:String((j&&j.error)||'')};
24421
+ liveDetail:String(j.liveTruthDetail||''),http:r.status||0,error:String((j&&j.error)||''),
24422
+ // #2521 row 3b-2: a Quick version's unfiled questions live in the version, so they show even now.
24423
+ quickFiling:Array.isArray(j&&j.quickFiling)?j.quickFiling:[]};
24376
24424
  }else{
24377
24425
  const filed=j.rfis.map(r=>{
24378
24426
  const g=r&&r.liveGap,targets=liveDrawingTargets(g);
@@ -24387,7 +24435,8 @@ async function refreshRfiRecords(opts){
24387
24435
  // reassuring answer, so it is the one that must be earned rather than defaulted to.
24388
24436
  sizeTruth:j.sizeTruth==='known'?'known':'unavailable',
24389
24437
  liveTruth:j.liveTruth==='known'?'known':'unavailable',
24390
- detail:String(j.sizeTruthDetail||''),liveDetail:String(j.liveTruthDetail||''),http:200,error:''};
24438
+ detail:String(j.sizeTruthDetail||''),liveDetail:String(j.liveTruthDetail||''),http:200,error:'',
24439
+ quickFiling:Array.isArray(j.quickFiling)?j.quickFiling:[]};
24391
24440
  }
24392
24441
  }catch(e){
24393
24442
  if(mine!==rfiFetchSeq)return false;
@@ -25898,14 +25947,14 @@ function renderRfiList(){
25898
25947
  :rfiStatusFilter==='all'
25899
25948
  ?'<b>No RFIs yet.</b>Nothing has been asked about this project, and every member has a size FloLess can price.'
25900
25949
  :'<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.';
25901
- list.innerHTML='<div class=rfiempty>'+empty+'</div>';
25950
+ list.innerHTML=rfiQuickFilingHtml()+'<div class=rfiempty>'+empty+'</div>';
25902
25951
  wireRfiList();
25903
25952
  rfiRestoreFocus(restore);
25904
25953
  return;
25905
25954
  }
25906
25955
 
25907
25956
  const shown=rows.slice(0,RFI_ROW_CAP);
25908
- let html='';
25957
+ let html=rfiQuickFilingHtml();
25909
25958
  for(const row of shown)html+=(row.kind==='record'?rfiRecordRowHtml(row.record):rfiSymptomRowHtml(row));
25910
25959
  if(rows.length>shown.length)html+='<div class=rfimore>'+(rows.length-shown.length)+' more not listed here — narrow the filter above.</div>';
25911
25960
  list.innerHTML=html;
@@ -26261,6 +26310,19 @@ const EDITOR_FOCUS_3D_WAIT_MS=20000;
26261
26310
  async function runEditorFocus(req,current){
26262
26311
  const until=Date.now()+EDITOR_FOCUS_3D_WAIT_MS;
26263
26312
  while(!window.Steel3DView&&Date.now()<until){await new Promise(resolve=>setTimeout(resolve,100));if(!current())return null;}
26313
+ // #2471: a member an answer cited. The shell checked the project is the cited one; this frame shows that project.
26314
+ if(req.memberId){
26315
+ const m=await focusMember(req.memberId,{current,
26316
+ beforeSelect:()=>rfiFormFor?'An RFI form is open. Finish or cancel it, then press Show in the model again.':'',
26317
+ beforeFrame:()=>{if(rfiOpen())closeRFI();}});
26318
+ if(!m||!current())return null;
26319
+ if(!m.ok){
26320
+ const said=m.reason==='missing'?m.said+' Ask about it again in the chat.':m.reason==='view'?m.said+' Switch to the 3D view, then press Show in the model again.':m.said;
26321
+ answerToast(said);
26322
+ return {ok:false,reason:m.reason,said};
26323
+ }
26324
+ return {ok:true};
26325
+ }
26264
26326
  const r=await focusConnection(req.jointId,{current,fallbackToMain:true,
26265
26327
  beforeSelect:()=>rfiFormFor?'An RFI form is open. Finish or cancel it, then press Open in the model again.':'',
26266
26328
  beforeFrame:()=>{if(rfiOpen())closeRFI();}});
@@ -26272,17 +26334,17 @@ async function runEditorFocus(req,current){
26272
26334
  if(req.raiseRfi){
26273
26335
  const why=r.ok||(r.reason!=='missing'&&r.reason!=='busy')?openRaiseRfi(req.jointId,req.checkId||null):'';
26274
26336
  raise={raised:r.ok||(r.reason!=='missing'&&r.reason!=='busy')?!why:false,...(why?{raiseSaid:why}:{})};
26275
- if(why)toast(why,false,9000);
26337
+ if(why)answerToast(why);
26276
26338
  }
26277
26339
  if(!r.ok){
26278
26340
  const said=r.reason==='missing'?'Connection '+req.jointId+' is no longer in the model. Ask about it again in the chat to get a fresh card.'
26279
26341
  :r.reason==='view'?r.said+' Switch to the 3D view, then press Open in the model again.'
26280
26342
  :r.reason==='unbuilt'&&!(raise&&raise.raised)?r.said+' Its row on the readiness card says why; raise an RFI or record an assumption from there.'
26281
26343
  :r.said;
26282
- toast(said,false,9000);
26344
+ answerToast(said);
26283
26345
  return {ok:false,reason:r.reason,said,...(raise||{})};
26284
26346
  }
26285
- if(r.fallback){toast(r.said,false,9000);return {ok:true,fallback:r.fallback,said:r.said,...(raise||{})};}
26347
+ if(r.fallback){answerToast(r.said);return {ok:true,fallback:r.fallback,said:r.said,...(raise||{})};}
26286
26348
  return {ok:true,...(raise||{})};
26287
26349
  }
26288
26350
  // A bug in the runner still ends in a sentence where the person is looking, and the cause in the console.
@@ -26291,8 +26353,8 @@ EditorFocus.setRunner(async(req,current)=>{
26291
26353
  catch(error){
26292
26354
  console.error('[steel] could not show the connection asked for',error);
26293
26355
  if(!current())return null;
26294
- const said='The model could not show connection '+req.jointId+'. Press Open in the model again, or find it in the Model panel.';
26295
- toast(said,false,9000);
26356
+ 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.';
26357
+ answerToast(said);
26296
26358
  return {ok:false,said};
26297
26359
  }
26298
26360
  });
@@ -26347,8 +26409,11 @@ async function focusConnection(jointId,opts){
26347
26409
  if(!joint)return {ok:false,reason:'missing',said:'Connection '+jointId+' is no longer in the model.'};
26348
26410
  if(o.viewPending)o.viewPending(true);
26349
26411
  let ready=false;
26350
- try{ready=await requestView3d();}finally{if(o.viewPending)o.viewPending(false);}
26412
+ const choice=viewChoiceSeq;
26413
+ try{ready=await requestFocusView();}finally{if(o.viewPending)o.viewPending(false);}
26351
26414
  if(!current())return null;
26415
+ ready=await view3dSettled(ready,current,choice);
26416
+ if(ready===null)return null;
26352
26417
  const busy=o.beforeSelect?o.beforeSelect():'';
26353
26418
  if(busy)return {ok:false,reason:'busy',said:busy};
26354
26419
  const parts=connChildIdsEditor(jointId);
@@ -26359,6 +26424,8 @@ async function focusConnection(jointId,opts){
26359
26424
  if(!selIdOK(main))return {ok:false,reason:'filter',said:'FloLess could not build connection '+jointId+', and its main member '+main+' is excluded by the selection filter. Turn on that member type under Select, then try again.'};
26360
26425
  // The editor's own "go to the main member" sequence (cmpMember): leave any whole-connection selection
26361
26426
  // first, or its envelope, breadcrumb and inspector stay on the connection picked before.
26427
+ // In a split the 3D pane takes the tools — only now, so a refusal never disarms a 2D tool for nothing (#2622).
26428
+ if(viewMode==='split')setActivePane('3d');
26362
26429
  if(modelEditor.isReady()&&modelEditor.steel.clearConnSel)modelEditor.steel.clearConnSel();
26363
26430
  modelSelection.replaceMembers([main]);selDimIds.clear();sel3dDimIds.clear();modelSelection.clearGrids();render();
26364
26431
  if(!selIds.has(main))return {ok:false,reason:'select',said:'FloLess could not build connection '+jointId+', and the 3D view could not select its main member '+main+'.'};
@@ -26373,6 +26440,7 @@ async function focusConnection(jointId,opts){
26373
26440
  if(!ready||!window.Steel3DView)return {ok:false,reason:'view',said:'The 3D view could not show connection '+jointId+'.'};
26374
26441
  if(!parts.length)return {ok:false,reason:'unbuilt',said:'FloLess could not build connection '+jointId+', so the model has nothing of it to show.'};
26375
26442
  if(!parts.every(selIdOK))return {ok:false,reason:'filter',said:'Connection '+jointId+' is excluded by the selection filter. Turn on '+(joint.kind||'its type')+' connections under Select, then try again.'};
26443
+ if(viewMode==='split')setActivePane('3d'); // as above: the 3D pane holds the selection and its tools
26376
26444
  const selectedThisAttempt=treeSelectConn(jointId,{});
26377
26445
  const selected=connSelInfo();
26378
26446
  if(!selectedThisAttempt||!selected||selected.conn!==jointId||!selected.whole)return {ok:false,reason:'select',said:'The 3D view could not select connection '+jointId+'.'};
@@ -26380,6 +26448,62 @@ async function focusConnection(jointId,opts){
26380
26448
  if(modelEditor.dispatch('model.fit-selection')===false)return {ok:false,reason:'frame',said:'Connection '+jointId+' is selected, but it is hidden in the 3D view. Use Show all in the Visibility menu, then press Open in the model again.'};
26381
26449
  return {ok:true};
26382
26450
  }
26451
+ // The 3D view a request needs, in the layout the person chose (#2622). Split already shows a live 3D pane, so it is
26452
+ // kept; a saved Split the boot restore has not applied yet is asked for rather than overridden by full 3D, and
26453
+ // awaited, so cancelling the request (rfiCancelTarget) still stops it. Otherwise full 3D. Neither switch writes
26454
+ // the saved layout: opening a connection is not the person choosing a view. A boot restore still queued is taken
26455
+ // over, since this already honours the saved layout: left to run, it would switch Split a second time under the
26456
+ // rebuild this started, or, on a window too narrow for Split, drop the full 3D asked for back to 2D. A Split taken
26457
+ // over that then does not land (the request was cancelled, or the switch failed) is asked for once more — unless the person chose a view,
26458
+ // a newer request has taken over (it asks for the layout itself, and the hand-back would cancel it), or Split no
26459
+ // longer fits.
26460
+ let focusViewSeq=0;
26461
+ async function requestFocusView(){
26462
+ const restoring=viewRestorePending,choice=viewChoiceSeq,mine=++focusViewSeq;
26463
+ viewRestorePending=false;
26464
+ if(viewMode==='split')return !viewTransition;
26465
+ if(requestedMode==='split'&&splitAvailable){
26466
+ const landed=await requestViewSplit({remember:false});
26467
+ if(!landed&&restoring&&mine===focusViewSeq&&viewChoiceSeq===choice&&splitAvailable&&viewMode!=='split')requestViewSplit({remember:false});
26468
+ return landed;
26469
+ }
26470
+ return requestView3d({remember:false});
26471
+ }
26472
+ // Opened from another step, the editor restores its own last view at the same moment and that supersedes a
26473
+ // requestView3d() (it answers false), although 3D comes up anyway (#2471, #2581): give it a few seconds to settle
26474
+ // before saying it could not show the thing asked for. Split counts, as its 3D pane is live (#2622). Answers whether 3D is up, or null once `current()` says a
26475
+ // newer request replaced this one. A view the person chose themselves since `choice` (viewChoiceSeq, read before the
26476
+ // request) is never waited out: a 2D click means they changed their mind, and a later 3D click must not revive it.
26477
+ async function view3dSettled(ready,current,choice){
26478
+ for(const until=Date.now()+5000;!ready&&viewChoiceSeq===choice&&Date.now()<until;){
26479
+ await new Promise(resolve=>setTimeout(resolve,100));
26480
+ if(!current())return null;
26481
+ ready=viewChoiceSeq===choice&&!!window.Steel3DView&&(viewMode==='3d'||viewMode==='split')&&!viewTransition;
26482
+ }
26483
+ return ready;
26484
+ }
26485
+ // #2471: one member, selected and framed in the 3D view — an AI Chat answer's "Show in the model" for a member it cited.
26486
+ // The connection fallback's own sequence (cmpMember): leave any connection selection, select the member, frame it.
26487
+ async function focusMember(memberId,opts){
26488
+ const o=opts||{},current=o.current||(()=>true);
26489
+ if(!(C.members||[]).some(m=>m&&m.id===memberId))return {ok:false,reason:'missing',said:'Member '+memberId+' is no longer in the model.'};
26490
+ const choice=viewChoiceSeq;
26491
+ let ready=await requestFocusView();
26492
+ if(!current())return null;
26493
+ ready=await view3dSettled(ready,current,choice);
26494
+ if(ready===null)return null;
26495
+ const busy=o.beforeSelect?o.beforeSelect():'';
26496
+ if(busy)return {ok:false,reason:'busy',said:busy};
26497
+ if(!ready||!window.Steel3DView)return {ok:false,reason:'view',said:'The 3D view could not show member '+memberId+'.'};
26498
+ if(!selIdOK(memberId))return {ok:false,reason:'filter',said:'Member '+memberId+' is excluded by the selection filter. Turn on that member type under Select, then try again.'};
26499
+ if(viewMode==='split')setActivePane('3d');
26500
+ if(modelEditor.isReady()&&modelEditor.steel.clearConnSel)modelEditor.steel.clearConnSel();
26501
+ modelSelection.replaceMembers([memberId]);selDimIds.clear();sel3dDimIds.clear();modelSelection.clearGrids();render();
26502
+ if(!selIds.has(memberId))return {ok:false,reason:'select',said:'The 3D view could not select member '+memberId+'.'};
26503
+ if(o.beforeFrame)o.beforeFrame();
26504
+ if(modelEditor.dispatch('model.fit-selection')===false)return {ok:false,reason:'frame',said:'Member '+memberId+' is selected, but it is hidden in the 3D view. Use Show all in the Visibility menu, then press Show in the model again.'};
26505
+ return {ok:true};
26506
+ }
26383
26507
  async function rfiOpenTarget(button){
26384
26508
  const tuple=JSON.parse(button.dataset.rfiTarget),held=rfiCurrentTarget(tuple);
26385
26509
  const localErrorKey=Number.isSafeInteger(tuple[3])?rfiOccurrenceKey(tuple[0],tuple[3]):null;
@@ -26511,7 +26635,7 @@ function rfiGroupedRecordRowHtml(r){
26511
26635
  const targetView=occ.liveGap?{...occ.liveGap,id:r.id,kind:r.kind,recordRevision:r.recordRevision,liveGapId:occ.liveGap.id}:view;
26512
26636
  const targets=rfiTargetControls(targetView,index);
26513
26637
  const error=rfiTargetErrors.get(key);
26514
- return '<li class=rfioccurrence data-rfi-occurrence="'+index+'"><article aria-labelledby="rfi-occ-'+r.seq+'-'+index+'"><div class=rfioccurrence-head><h4 id="rfi-occ-'+r.seq+'-'+index+'" tabindex="-1">Occurrence '+(index+1)+' of '+count+' — '+esc(rfiGroupedOccurrenceSubject(occ))+'</h4><span class="rfikind '+rfiStatusTone(occ)+'">'+esc(rfiStatusWords(occ))+'</span></div>'
26638
+ return '<li class=rfioccurrence data-rfi-occurrence="'+index+'"><article aria-labelledby="rfi-occ-'+r.seq+'-'+index+'"><div class=rfioccurrence-head><span class="rfioccurrence-title rfimeta"><h4 id="rfi-occ-'+r.seq+'-'+index+'" tabindex="-1">Occurrence '+(index+1)+' of '+count+' — '+esc(rfiGroupedOccurrenceSubject(occ))+'</h4>'+rfiAiMark(occ.latestBy)+'</span><span class="rfikind '+rfiStatusTone(occ)+'">'+esc(rfiStatusWords(occ))+'</span></div>'
26515
26639
  +'<div class=rfinote>'+esc(occ.question)+(sheets?' · '+esc(sheets):'')+'</div>'
26516
26640
  +(error?'<div class=rfifail role=alert>'+esc(error.message)+'</div>':'')
26517
26641
  +(occurrenceForm?rfiFormHtml(view,'occurrence '+(index+1)+' of '+count,rowKey):(formOpen?'':'<div class=rfiacts>'+rfiGroupedOccurrenceVerbs(r,occ,rowBusy)+targets+'</div>'))
@@ -26527,6 +26651,60 @@ function rfiGroupedRecordRowHtml(r){
26527
26651
  +(formOpen?'':rfiOutcomeHtml(rowKey))+occurrences+'</div></div>';
26528
26652
  }
26529
26653
 
26654
+ /* #2521 row 3b-2 — "AI" beside a proposal the AI wrote (the sighting's `latestBy`), in a Quick model. Not
26655
+ for `raisedBy` alone: a later sighting by a guided read carries its own proposal and no AI mark. */
26656
+ const RFI_AI_TIP='Proposed by the AI in a Quick model: this answer is the AI\'s decision, not a person\'s.';
26657
+ function rfiAiMark(by){
26658
+ return by==='ai'?'<span class="rfiby ai" tabindex="0" aria-label="'+esc(RFI_AI_TIP)+'" data-tip="'+esc(RFI_AI_TIP)+'">AI</span>':'';
26659
+ }
26660
+ /* Where each Quick version's questions stand, and the ones the AI could not get into the RFI file yet.
26661
+ The counts keep every zero: they are the accounting, and a missing class would read as "none". */
26662
+ let rfiQuickRefileBusy=null;
26663
+ function rfiQuickFilingHtml(){
26664
+ const versions=(rfiState.quickFiling||[]).filter(v=>v&&v.counts);
26665
+ if(!versions.length)return '';
26666
+ const n=x=>x===null||x===undefined?'not known':String(x);
26667
+ return versions.map(v=>{
26668
+ const c=v.counts,unfiled=Array.isArray(v.notFiled)?v.notFiled:[];
26669
+ const counts='<div class=rfinote data-rfi-quick-counts="'+esc(v.versionN)+'">Quick model v'+esc(v.versionN)+': '
26670
+ +esc(n(c.settled))+' settled by the AI · '+esc(n(c.filed))+' filed as AI RFIs · '
26671
+ +(c.filedByLaterRead?esc(c.filedByLaterRead)+' filed by a later read · ':'')
26672
+ +'<b class=rfiwarn>'+esc(n(c.notFiled))+' not filed yet</b> · <b>'+esc(n(c.changedInReview))+' changed in your review</b> · '
26673
+ +esc(n(c.appearedAfter))+' appeared after the AI\'s work'
26674
+ +(c.settledAndGone?' · '+esc(c.settledAndGone)+' settled and gone from the final read':'')
26675
+ +(c.leftOutByAudit?' · '+esc(c.leftOutByAudit)+' left out by the audit':'')+'</div>'
26676
+ +(v.snapshotUnavailable?'<div class=rfinote>'+esc(v.snapshotUnavailable.charAt(0).toUpperCase()+v.snapshotUnavailable.slice(1))+'.</div>':'');
26677
+ if(!unfiled.length)return '<div class=rfiunfiled data-rfi-quick-version="'+esc(v.versionN)+'">'+counts+'</div>';
26678
+ const busy=rfiQuickRefileBusy===v.versionN;
26679
+ const retry=v.rfiFileUnavailable?'':'<div class=rfiacts><button data-command-id="steel.rfi-quick-refile#v'+esc(v.versionN)+'" data-command-instance-label="'+esc('version '+v.versionN)+'" data-rfi-ctl="quick-refile:'+esc(v.versionN)+'" data-rfi-quick-refile="'+esc(v.versionN)+'" data-tip="File the questions version '+esc(v.versionN)+' keeps, as the AI\'s; anything already filed is not filed twice"'
26680
+ +(busy?' aria-busy=true aria-disabled=true data-blocked-reason="These questions are being filed"':'')+'>'+(busy?'Filing…':'Try filing again')+'</button></div>';
26681
+ // With the RFI file unreadable, whether these were filed is not known: the section says so, never "not filed".
26682
+ const unknown=!!v.rfiFileUnavailable,heading=unknown?'Filing status unknown':'Not filed yet';
26683
+ return '<section class=rfiunfiled data-rfi-quick-version="'+esc(v.versionN)+'" aria-label="'+heading+', version '+esc(v.versionN)+'"><div class=glab>'+heading+'</div>'+counts+retry
26684
+ +unfiled.map(q=>'<div class=rfirow data-rfi-quick-unfiled="'+esc(q.gapKey)+'"><span class="rfikind sym">'+(unknown?'status unknown':'not filed')+'</span><div class=rfitx>'+esc(q.question)
26685
+ +'<div class=rfimeta>'+rfiAiMark('ai')+'</div>'
26686
+ +(q.proposed?'<div class=rfinote>AI\'s proposed answer: '+esc(q.proposed)+'</div>':'')
26687
+ +(q.tried?'<div class=rfinote>Tried: '+esc(q.tried)+'</div>':'')
26688
+ +'<div class="rfinote rfiwhy">'+esc(q.reason.charAt(0).toUpperCase()+q.reason.slice(1))+'</div></div></div>').join('')
26689
+ +(v.notFiledHeldBack?'<div class=rfimore>'+esc(v.notFiledHeldBack)+(unknown?' more whose filing status is unknown':' more not filed yet')+' are not listed here.</div>':'')+'</section>';
26690
+ }).join('');
26691
+ }
26692
+ async function rfiQuickRefile(versionN){
26693
+ if(rfiQuickRefileBusy!==null)return;
26694
+ rfiQuickRefileBusy=versionN;renderRfiList();
26695
+ try{
26696
+ const res=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/versions/'+encodeURIComponent(versionN)+'/rfis',{method:'POST',headers:{'content-type':'application/json'},body:'{}'});
26697
+ const body=await res.json().catch(()=>null);
26698
+ if(res.ok&&body&&body.ok){
26699
+ const filed=(body.outcomes||[]).filter(o=>['created','reused','reopened','successor'].includes(o.result)).length;
26700
+ const notFiled=(body.outcomes||[]).filter(o=>o.result==='over-capacity'||o.result==='unplaceable').length;
26701
+ toast(filed?filed+' question'+(filed===1?'':'s')+' filed as the AI\'s'+(notFiled?'; '+notFiled+' still could not be filed':'')+'.':notFiled?'Nothing more could be filed: '+notFiled+' still do not fit.':'Nothing was left to file.');
26702
+ }else toast('These questions could not be filed: '+((body&&body.error)||'the RFI file could not be written')+'. Nothing was changed.');
26703
+ }catch(e){console.error('[steel] could not retry filing the AI questions',e);toast('These questions could not be filed, because FloLess could not be reached. Nothing was changed.');}
26704
+ // The button the pointer is over is replaced by the repaint, so no pointer-out ever hides its tip.
26705
+ finally{rfiQuickRefileBusy=null;await refreshRfiRecords();if(rfiOpen())renderRfiList();if(window.__tip)window.__tip.hide();}
26706
+ }
26707
+
26530
26708
  function rfiRecordRowHtml(r){
26531
26709
  if(r&&r.grouped)return rfiGroupedRecordRowHtml(r);
26532
26710
  const rowKey=rfiRowKey('record',r.id);
@@ -26552,7 +26730,7 @@ function rfiRecordRowHtml(r){
26552
26730
  +rfiElevationControls(rowKey,r.id,g)
26553
26731
  +'<div class=rfiacts>'+copy+targets+'</div></div></div>';
26554
26732
  }
26555
- const meta=['<span>'+esc(r.id)+'</span>','<span>'+esc(rfiStatusWords(r))+'</span>']
26733
+ const meta=[rfiAiMark(r.latestBy),'<span>'+esc(r.id)+'</span>','<span>'+esc(rfiStatusWords(r))+'</span>']
26556
26734
  .concat(ids.slice(0,6).map(id=>'<span>'+esc(id)+'</span>'))
26557
26735
  .concat(sheets.map(sh=>'<span>Sheet '+esc(sh)+'</span>'))
26558
26736
  .join('');
@@ -26573,7 +26751,10 @@ function rfiRecordRowHtml(r){
26573
26751
  if(r.applied)notes.push('Recorded as applied to the model on '+esc(rfiWhen(r.applied.at))+'.');
26574
26752
  if(r.closed)notes.push('Closed '+esc(rfiDispositionWords(r.closed.disposition))
26575
26753
  +' on '+esc(rfiWhen(r.closed.at))+(r.closed.note?' — '+esc(rfiSentence(r.closed.note)):'.'));
26576
- if(r.proposed)notes.push('FloLess would have proceeded with '+esc(rfiSentence(r.proposed)));
26754
+ // #2521 row 3b-2: the AI's recommendation. Not "built on": a question about an unbuilt connection or an unresolved
26755
+ // placement was never applied, and a later edit can change the model (Codex review).
26756
+ if(r.proposed)notes.push(r.latestBy==='ai'?'The AI’s proposed answer: '+esc(rfiSentence(r.proposed))
26757
+ :'FloLess would have proceeded with '+esc(rfiSentence(r.proposed)));
26577
26758
  if(r.targetsOmitted)notes.push('Showing '+esc((r.targets||[]).filter(t=>t&&t.where==='drawing').length)+' drawing locations. '+esc(r.targetsOmitted)+' additional drawing locations are not available here.');
26578
26759
  if(r.kind==='unbuilt-connection'&&r.subjectsOmitted)notes.push(esc(r.subjectsOmitted)+' additional verified markers are not listed in this RFI.');
26579
26760
  // The one member a Locate can fly to — only ids the model STILL has, since the list may have been
@@ -26941,6 +27122,7 @@ function wireRfiList(){
26941
27122
  const scopeKind=b.dataset.rfiScopeKind;
26942
27123
  // `promote` comes off the CARRIER, because the row key alone cannot say which namespace it is in.
26943
27124
  if(v==='apply')return Promise.resolve(rfiApplyAction(id,occurrence)).catch(rfiGestureFailure);return rfiOpenForm(id,v,promote,occurrence,scopeKind);});
27125
+ root.querySelectorAll('[data-rfi-quick-refile]').forEach(b=>b.onclick=()=>Promise.resolve(rfiQuickRefile(Number(b.dataset.rfiQuickRefile))).catch(rfiGestureFailure));
26944
27126
  root.querySelectorAll('[data-rfi-expand]').forEach(b=>b.onclick=()=>{
26945
27127
  const id=b.dataset.rfiExpand;if(rfiExpandedGroups.has(id))rfiExpandedGroups.delete(id);else rfiExpandedGroups.add(id);
26946
27128
  rfiFocusOverride={rows:[rfiRowKey('record',id)],ctl:'expand'};renderRfiList();});