@floless/app 0.148.1 → 0.149.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 (43) hide show
  1. package/bin/floless.mjs +1 -1
  2. package/dist/floless-server.cjs +28663 -18914
  3. package/dist/schemas/drawing-check.profile.v1.schema.json +156 -0
  4. package/dist/schemas/steel.model.v2.schema.json +43 -1
  5. package/dist/schemas/tekla.model.v2.schema.json +6 -2
  6. package/dist/skills/floless-app-steel-model/SKILL.md +54 -11
  7. package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +9 -5
  8. package/dist/skills/floless-app-steel-takeoff/SKILL.md +128 -15
  9. package/dist/skills/floless-app-vectorize/SKILL.md +7 -4
  10. package/dist/templates/check-drawings.flo +46 -0
  11. package/dist/templates/drawing-check.flo +55 -0
  12. package/dist/templates/tekla-parser.flo +6 -2
  13. package/dist/web/app.css +143 -8
  14. package/dist/web/aware.js +444 -39
  15. package/dist/web/chat.css +171 -9
  16. package/dist/web/chat.js +2005 -759
  17. package/dist/web/commands-drawing-check.js +53 -0
  18. package/dist/web/commands-shell.js +275 -3
  19. package/dist/web/commands-steel.js +1 -0
  20. package/dist/web/commands-tekla-parser.js +3 -0
  21. package/dist/web/commands.js +1 -1
  22. package/dist/web/connections.js +382 -0
  23. package/dist/web/display-units.js +15 -1
  24. package/dist/web/drawing-check-editor.html +289 -0
  25. package/dist/web/drawing-check-editor.js +1242 -0
  26. package/dist/web/drawing-check-overlay.js +36 -0
  27. package/dist/web/filter-ai-proposal.js +32 -13
  28. package/dist/web/index.html +25 -3
  29. package/dist/web/instructor.js +2 -2
  30. package/dist/web/local-discovery.js +144 -2
  31. package/dist/web/model-display-units.js +23 -9
  32. package/dist/web/model-viewport-revit-adapter.js +12 -2
  33. package/dist/web/revit-editor.css +5 -0
  34. package/dist/web/revit-editor.js +141 -20
  35. package/dist/web/steel-editor.html +166 -27
  36. package/dist/web/steel-filter.html +60 -166
  37. package/dist/web/steel-model-v2-commands.js +13 -3
  38. package/dist/web/steel-model-v2-projection.js +20 -0
  39. package/dist/web/steel-units.js +3 -1
  40. package/dist/web/workspaces.js +306 -22
  41. package/launch.mjs +5 -5
  42. package/package.json +3 -1
  43. package/dist/web/filter-ai-context.js +0 -92
@@ -1482,6 +1482,10 @@ rect.lblhot:focus-visible{outline:2px solid var(--brand);outline-offset:2px;stro
1482
1482
  .read-field{display:grid;grid-template-columns:minmax(120px,1fr) minmax(150px,2fr) auto;gap:10px;padding:4px 0;border-top:1px solid var(--line);font-size:12px;align-items:baseline}
1483
1483
  .read-field:first-of-type{border-top:0}.read-field .read-value{overflow-wrap:anywhere}.read-field .read-pct{font-variant-numeric:tabular-nums;white-space:nowrap}
1484
1484
  .read-notes{margin:12px 0 0;padding:10px 12px;border:1px solid var(--line);border-radius:6px;background:var(--sunken)}
1485
+ /* #1906: a picture the person attached to a height answer, opened from the inspector note or Model notes. */
1486
+ button.answer-picture{appearance:none;border:0;padding:0 2px;background:transparent;color:var(--brand);font:inherit;text-decoration:underline;cursor:pointer}
1487
+ button.answer-picture:hover{color:var(--text)}
1488
+ button.answer-picture:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
1485
1489
  .read-notes h3{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut);margin:0 0 5px}.read-notes ul{margin:0 0 10px;padding-left:18px}.read-notes ul:last-child{margin-bottom:0}.read-notes li{font-size:12px;line-height:1.45;overflow-wrap:anywhere}
1486
1490
  #svg:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
1487
1491
  .mgrid{padding:14px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:12px}
@@ -4269,6 +4273,28 @@ async function boot() {
4269
4273
  'Re-read the drawing to create a current multi-sheet filter before opening the model.', APP_ID);
4270
4274
  return;
4271
4275
  }
4276
+ /* A view with NO `viewKind` is refused here, in plain words (#1880). The schema requires the field, and
4277
+ the MUST-MATCH in steel-editor-v2-must-match.test.ts forbids guessing one: an unclassified row could be
4278
+ an elevation, and drawing it as a plan would invent a framing plan nobody read. This refusal used to
4279
+ happen by accident — the first member lookup handed the row to the plan transform, which threw out of
4280
+ boot() as a raw "Failed to load". Member lookups now ask only PLAN views (`memberPlanViewIds`), so an
4281
+ elevation's steel no longer takes the editor down; the one document that genuinely cannot be shown is
4282
+ named here instead. `unknown` is a STATED kind (the reader could not tell) and opens normally. */
4283
+ const unclassifiedViews = loaded.plans.filter(p => !p || typeof p.viewKind !== 'string' || !p.viewKind);
4284
+ // Named the way every other surface names a view (`planViewLabels`: the page, plus the view when the
4285
+ // page carries several).
4286
+ const unclassifiedViewNames = rows => {
4287
+ const labels = V2Projection.planViewLabels(loaded.plans);
4288
+ const named = rows.map(p => labels.get(V2Projection.planViewId(p)) || (p && (p.id || p.sheet)) || '(unnamed)');
4289
+ return named.length > 5 ? named.slice(0, 5).join(', ') + ' and ' + (named.length - 5) + ' more' : named.join(', ');
4290
+ };
4291
+ if (unclassifiedViews.length) {
4292
+ showEmpty('⚠', 'Couldn’t open this model',
4293
+ 'Some of its drawing views aren’t marked as a plan, an elevation or a section, so FloLess can’t tell where to place their steel. Re-run the read to rebuild the model, or restore an earlier version from History.',
4294
+ APP_ID,
4295
+ { detail: 'Views with no type: ' + unclassifiedViewNames(unclassifiedViews) });
4296
+ return;
4297
+ }
4272
4298
  const schemaRes = await fetch('/api/schema/steel-model-v2');
4273
4299
  if (!schemaRes.ok) throw new Error('steel.model/v2 schema unavailable');
4274
4300
  V2_SCHEMA = await schemaRes.json();
@@ -4729,7 +4755,7 @@ function viewLabel(pl){
4729
4755
  row. Stops at the first hit, so the ordinary one-sheet case still builds exactly one projection. */
4730
4756
  function v2ProjectedMember(id){
4731
4757
  const here=(P&&P.members||[]).find(m=>m&&m.id===id);if(here)return here;
4732
- for(const viewId of V2Projection.memberViewIds(C,id)){
4758
+ for(const viewId of V2Projection.memberPlanViewIds(C,id)){
4733
4759
  const row=v2ProjectionForView(viewId).plan.members.find(m=>m&&m.id===id);
4734
4760
  if(row)return row;
4735
4761
  }
@@ -4748,7 +4774,7 @@ const byId=id=>v2ProjectedMember(id);
4748
4774
  just refused is the silent wrongness both issues exist to end. */
4749
4775
  const compareViewIdsUtf8=(a,b)=>{const A=new TextEncoder().encode(a),B=new TextEncoder().encode(b);const n=Math.min(A.length,B.length);for(let i=0;i<n;i++){if(A[i]!==B[i])return A[i]-B[i];}return A.length-B.length;};
4750
4776
  const planeOf=id=>{
4751
- const eligible=V2Projection.memberViewIds(C,id).filter(v=>!v2ProjectionForView(v).plan.registrationRefusal);
4777
+ const eligible=V2Projection.memberPlanViewIds(C,id).filter(v=>!v2ProjectionForView(v).plan.registrationRefusal);
4752
4778
  if(!eligible.length)return P;
4753
4779
  const active=P&&viewIdOf(P);
4754
4780
  if(active&&eligible.includes(active))return v2ProjectionForView(active).plan;
@@ -4786,10 +4812,54 @@ function selCanonicalArr(){return [...selIds].map(canonicalMemberProps).filter(B
4786
4812
  typed. */
4787
4813
  function blockingViewsFor(ids){const out=new Map();
4788
4814
  if(!V2Projection)return out;
4789
- for(const id of ids){for(const viewId of V2Projection.memberViewIds(C,id)){
4815
+ for(const id of ids){for(const viewId of V2Projection.memberPlanViewIds(C,id)){
4790
4816
  const plan=v2ProjectionForView(viewId).plan;
4791
4817
  if(plan.registrationRefusal)out.set(viewId,plan.registrationRefusal);}}
4792
4818
  return out;}
4819
+ /* #1880 — members that NO plan view shows but some other view does: the X-braces read from a frame
4820
+ elevation. Elevations and sections are read for steel the plans do not carry, and the 2D plan transform
4821
+ cannot draw them, so these members reach the user through 3D and the inspector alone — and every
4822
+ plan-space lookup (`byId`, `selArr`) answers nothing for them. Nothing here builds a projection. */
4823
+ function sourceOnlyIds(ids){
4824
+ if(!V2Projection)return [];
4825
+ return ids.filter(id=>!V2Projection.memberPlanViewIds(C,id).length&&V2Projection.memberViewIds(C,id).length>0);}
4826
+ /* view id -> its row, deduped, for the views showing those members. The rows are what the copy names. */
4827
+ function sourceOnlyViewsFor(ids){const out=new Map();
4828
+ for(const id of sourceOnlyIds(ids)){
4829
+ for(const viewId of V2Projection.memberViewIds(C,id)){const pl=(C.plans||[]).find(x=>viewIdOf(x)===viewId);if(pl)out.set(viewId,pl);}}
4830
+ return out;}
4831
+ /* "S-302 · S-302-3, an elevation" / "A (an elevation) and B (a section)". An elevation or section with no
4832
+ `sourceRegistration` is not aligned to the model grid, and saying so matters: its members are still
4833
+ placed where the read recorded them, so their position deserves a check before anyone relies on it. */
4834
+ function sourceViewUnaligned(pl){return (pl.viewKind==='elevation'||pl.viewKind==='section')&&!pl.sourceRegistration;}
4835
+ function sourceViewList(rows){
4836
+ const kindOf=pl=>(pl.viewKind==='elevation'?'an elevation':pl.viewKind==='section'?'a section':'a view whose type wasn’t identified')
4837
+ +(sourceViewUnaligned(pl)?' that wasn’t aligned to the model grid':'');
4838
+ const named=rows.map(pl=>(viewLabel(pl)||'an unnamed view')+(rows.length===1?', '+kindOf(pl):' ('+kindOf(pl)+')'));
4839
+ return named.length<=1?named.join(''):named.slice(0,-1).join(', ')+' and '+named[named.length-1];}
4840
+ function sourceOnlyLead(count,rows){
4841
+ return (count===1?'This member was':'These '+count+' members were')+' read from '+sourceViewList(rows)+'. '
4842
+ +'Only plan views are drawn in 2D for now, so '+(count===1?'it appears':'they appear')
4843
+ +' in the 3D view only, placed from that drawing.'
4844
+ +(rows.some(sourceViewUnaligned)?' Check '+(count===1?'its position':'their positions')+' in 3D before relying on '+(count===1?'it':'them')+'.':'');}
4845
+ /* The same fact for a refused ACTION (a 3D drag, an RFI locate/resolve): what could not happen, which
4846
+ members, why, and — from the caller, because it differs — the way forward. Null when none of `ids` is
4847
+ source-only, so a caller keeps its own message for the cases that are genuinely something else (a
4848
+ refused plan registration). Only the source-only ids are named: a mixed list must not claim every
4849
+ member came from an elevation. */
4850
+ function sourceOnlyBlockedText(ids,what,next){
4851
+ const only=sourceOnlyIds(ids);if(!only.length)return null;
4852
+ const one=only.length===1,rows=[...sourceOnlyViewsFor(only).values()];
4853
+ return 'FloLess can’t '+what+' here: '+(one?only[0]+' was':only.join(', ')+' were')+' read from '+sourceViewList(rows)
4854
+ +', and only plan views are drawn in 2D for now. '+next(one);}
4855
+ /* A 3D drag on such a member has no plan row to write through (`byId` answers nothing), so it used to be
4856
+ accepted and silently do nothing. Say why instead, open no empty undo step, and REBUILD the scene the
4857
+ way `edit()` would have: the 3D view moves its own mesh during the drag preview and does not put it
4858
+ back on release, so without this the refused member would stay drawn where it was dropped. */
4859
+ function refuseSourceOnlyEdit(id,verb){
4860
+ const text=sourceOnlyBlockedText([id],verb+' it',()=>'It stays where it was; to change it, ask your terminal AI.');
4861
+ if(!text)return false;
4862
+ toast(text);render();sync3D();return true;}
4793
4863
  /* ── the ONE display edge ────────────────────────────────────────────────────────────────────────
4794
4864
  * Everything in this file is WORLD MILLIMETRES now. It used to run an inches-canonical sub-world —
4795
4865
  * its own `parseLen` answered decimal inches and its own `fmtFtIn` consumed them — while the
@@ -5489,9 +5559,11 @@ function normBrace(m){
5489
5559
  ModelCmd.setMemberBrace(m,out);return m;}
5490
5560
  // The DRAWN line for a brace — READ-ONLY (pick / marquee / zoom-fit / label anchors), NEVER a mutation.
5491
5561
  // Lateral & offset-0 = the true WPs; a vertical brace shifts perpendicular by brace.offset (mm→px).
5492
- function braceDisplayLine(m){const a=m.wp[0],b=m.wp[1];
5493
- if(!isBrace(m)||m.brace.type==='lateral'||!m.brace.offset)return [[a[0],a[1]],[b[0],b[1]]];
5494
- const k=(P&&P.mm_per_px>0)?P.mm_per_px:FT_TO_MM, offPx=m.brace.offset/k; // mm / (mm per px) = px
5562
+ // `m.brace` is OPTIONAL on a v2 member (#1880): a reader emits `memberType: 'brace'` with no sub-object, and
5563
+ // that reads as the `normBrace` defaults — vertical, above, no offset — rather than throwing out of render().
5564
+ function braceDisplayLine(m){const a=m.wp[0],b=m.wp[1],br=m.brace||{};
5565
+ if(!isBrace(m)||br.type==='lateral'||!br.offset)return [[a[0],a[1]],[b[0],b[1]]];
5566
+ const k=(P&&P.mm_per_px>0)?P.mm_per_px:FT_TO_MM, offPx=br.offset/k; // mm / (mm per px) = px
5495
5567
  const dx=b[0]-a[0],dy=b[1]-a[1],L=Math.hypot(dx,dy)||1,nx=-dy/L,ny=dx/L;
5496
5568
  return [[a[0]+nx*offPx,a[1]+ny*offPx],[b[0]+nx*offPx,b[1]+ny*offPx]];}
5497
5569
  // The line any VISUAL should anchor to: a brace's DRAWN (offset) line, every other member's work points.
@@ -5550,14 +5622,14 @@ function braceHeadPoints(m){
5550
5622
  _braceHeadPts([P0[0]-outLo[0]*step,P0[1]-outLo[1]*step],outLo,AL)];
5551
5623
  }
5552
5624
  function braceSymbol(m,c,glow){
5553
- const dl=braceDisplayLine(m),a=dl[0],b=dl[1];
5554
- const dashed=(m.brace.type==='vertical'&&m.brace.floor==='below');
5625
+ const dl=braceDisplayLine(m),a=dl[0],b=dl[1],br=m.brace||{}; // optional sub-object — see braceDisplayLine
5626
+ const dashed=(br.type==='vertical'&&br.floor==='below');
5555
5627
  const sel=selIds.has(m.id); // find-hit needs no class here: render() passes its glow through `glow` on the group
5556
5628
  const hitW=Math.max(braceArrowLen(m)*1.05, 8); // corridor spans the head wingspan (2·0.45·AL) → arrowheads are clickable
5557
5629
  let s=`<g class="bracesym${sel?' sel':''}" data-id="${m.id}"${glow}>`;
5558
5630
  // Witness lines back to the TRUE work points: an offset brace's end handles sit on the column ℄, away from
5559
5631
  // the drawn symbol, and would otherwise look orphaned. Same idiom as the dimension witness (ui-ux review).
5560
- if(m.brace.offset&&m.brace.type!=='lateral')
5632
+ if(br.offset&&br.type!=='lateral')
5561
5633
  s+=`<line class=bracewit x1="${m.wp[0][0]}" y1="${m.wp[0][1]}" x2="${a[0]}" y2="${a[1]}"/>`
5562
5634
  +`<line class=bracewit x1="${m.wp[1][0]}" y1="${m.wp[1][1]}" x2="${b[0]}" y2="${b[1]}"/>`;
5563
5635
  // Invisible hit corridor UNDER the visible line (heads are pointer-events:none, so the arrowhead — the most
@@ -5711,8 +5783,11 @@ function apply(json){
5711
5783
  const d=JSON.parse(json);
5712
5784
  V2_SESSION.restoreSnapshot(d);
5713
5785
  bumpRfiEpoch(); // #1090 — an undo/redo changes which sizes are unresolved; see bumpRfiEpoch
5714
- V2_PROJECTION=v2ProjectionForView(viewIdOf(C.plans[C.active]));
5715
- P=projectPlan();
5786
+ // #1880 — the active view can be an ELEVATION (a 3D edit made while one is shown), and the plan
5787
+ // transform refuses anything that is not a plan: the same placeholder `setPlan` installs for it, then.
5788
+ const activeView=C.plans&&C.plans[C.active];
5789
+ if(activeView&&activeView.viewKind==='plan'){V2_PROJECTION=v2ProjectionForView(viewIdOf(activeView));P=projectPlan();}
5790
+ else{V2_PROJECTION=null;NO_PLAN_VIEW=true;P=activeView?{...structuredClone(activeView),members:[],segments:[],dims:[],details:[],callouts:[],tos_callouts:[],grid:null,default_tos_mm:Number.isFinite(activeView.elevation_mm)?activeView.elevation_mm:0}:{sheet:'',members:[],segments:[],dims:[],details:[],callouts:[],tos_callouts:[],grid:null,default_tos_mm:0};}
5716
5791
  syncElevationContext();
5717
5792
  updCS();
5718
5793
  modelSelection.replaceMembers([...selIds].filter(id=>byId(id)||/^det:/.test(id))); // keep a selected placed-detail id (det:…) — it isn't a member
@@ -9129,7 +9204,7 @@ async function connModifyRequest(j){
9129
9204
  }
9130
9205
  function syncV2SelectionNotice(p){
9131
9206
  if(!p||!selIds.size||viewPropsId)return; // a view in the panel keeps the selection, not its notices
9132
- p.querySelectorAll('.v2-selection-notice,.v2-elevation-warning,.v2-elevation-proposal').forEach(el=>el.remove());
9207
+ p.querySelectorAll('.v2-selection-notice,.v2-elevation-warning,.v2-elevation-proposal,.v2-elevation-answered').forEach(el=>el.remove());
9133
9208
  const ids=[...selIds].filter(id=>!!(C.members||[]).find(m=>m&&m.id===id));
9134
9209
  if(!ids.length)return;
9135
9210
  const other=[];
@@ -9171,7 +9246,12 @@ function syncV2SelectionNotice(p){
9171
9246
  const blocking=blockingViewsFor(lost),reason=blocking.size
9172
9247
  ?(' '+[...blocking.keys()].map(v=>{const pl=(C&&C.plans||[]).find(x=>viewIdOf(x)===v);
9173
9248
  return regLeadText((pl&&viewLabel(pl))||v,blocking.get(v));}).join(' ')):'';
9174
- msg.textContent=lost.length+' more selected member'+(lost.length===1?' is':'s are')+' not shown below ('+lost.join(', ')+') — '+(lost.length===1?'it':'they')+' cannot be drawn on this sheet.'+reason;
9249
+ // #1880 — a member read from an elevation is "lost" for a different reason, and the registration
9250
+ // sentence above would be false for it: say which view it came from and that the edits below skip it.
9251
+ const onlyLost=sourceOnlyIds(lost),sourceReason=onlyLost.length
9252
+ ?' '+(onlyLost.length===1?onlyLost[0]+' was':onlyLost.join(', ')+' were')+' read from '+sourceViewList([...sourceOnlyViewsFor(onlyLost).values()])
9253
+ +'; only plan views are drawn in 2D for now, so the edits below don’t change '+(onlyLost.length===1?'it':'them')+'.':'';
9254
+ msg.textContent=lost.length+' more selected member'+(lost.length===1?' is':'s are')+' not shown below ('+lost.join(', ')+') — '+(lost.length===1?'it':'they')+' cannot be drawn on this sheet.'+reason+sourceReason;
9175
9255
  row.appendChild(msg);if(after)after.after(row);else p.prepend(row);after=row;}}
9176
9256
  const selected=(C.members||[]).filter(m=>ids.includes(m.id));
9177
9257
  const unknown=selected.reduce((n,m)=>n+(!Number.isFinite(m?.from?.z?.known)?1:0)+(!Number.isFinite(m?.to?.z?.known)?1:0),0);
@@ -9206,6 +9286,28 @@ function inspectorHeightNotes(m,canonical){
9206
9286
  const gapKey='unknown-elevation:'+canonical.id+':'+end;
9207
9287
  const live=rfiState.records.find(r=>r&&r.liveGap&&r.liveGap.gapKey===gapKey);
9208
9288
  const g=live&&live.liveGap,p=g&&g.proposal&&g.proposal.apply==='now'?g.proposal:null;
9289
+ // #1882: a height the PERSON answered on a height question during the read. Said plainly, and kept apart
9290
+ // from the amber "drawn at this height for now" note: this one is evidence, given by them.
9291
+ const answered=!!z&&!!z.answered&&typeof z.answered==='object'&&Number.isFinite(z.known);
9292
+ if(answered){
9293
+ const a=z.answered;
9294
+ const box=document.createElement('div');box.className='hint v2-elevation-answered';box.setAttribute('role','note');
9295
+ box.style.cssText='margin:2px 0 6px;grid-column:1/-1;line-height:1.5';
9296
+ const chip=document.createElement('span');chip.className='chip verified';chip.textContent='your answer';
9297
+ const when=typeof a.answeredAt==='string'&&!Number.isNaN(Date.parse(a.answeredAt))?' on '+new Date(a.answeredAt).toLocaleDateString():'';
9298
+ const said=a.how==='typed'?'You typed '+(a.typed||fmtDispElev(z.known)):'You confirmed '+(a.shownAs||fmtDispElev(z.known));
9299
+ const text=document.createElement('span');
9300
+ const fromPicture=a.basis==='read-of-your-picture'?' (the read’s reading of your picture)':'';
9301
+ text.textContent=' '+said+fromPicture+' for “'+String(a.label||'this end')+'” when the drawing read asked'+when+'. FloLess uses your answer as this height.';
9302
+ box.append(chip,text);
9303
+ // #1906: the person's source note and pictures travel with the answer, so the model says why.
9304
+ if(typeof a.note==='string'&&a.note){const note=document.createElement('span');note.textContent=' Source: '+a.note+'.';box.append(note);}
9305
+ for(const ref of Array.isArray(a.evidence)?a.evidence:[])box.append(' ',answerPictureButton(a.requestId,ref,String(a.label||'this end')));
9306
+ // Same anchor as the assumed note below: after the field's whole row, never inside the value cell.
9307
+ const aCell=input.closest('.pval'),aRow=aCell&&aCell.parentElement&&aCell.parentElement!==document.getElementById('panel')?aCell.parentElement:null;
9308
+ (aRow||(input.nextElementSibling&&input.nextElementSibling.classList.contains('edec')?input.nextElementSibling:input)).after(box);
9309
+ return;
9310
+ }
9209
9311
  const assumed=!!z&&z.assumed===true&&Number.isFinite(z.known);
9210
9312
  if(!assumed&&!p)return;
9211
9313
  const box=document.createElement('div');box.className='hint v2-elevation-proposal';box.setAttribute('role','note');
@@ -9856,7 +9958,7 @@ function panel(){
9856
9958
  const faulted=faultSheets.length>0;
9857
9959
  const clause=(list,state,verb)=>list.length?(' The registration'+(list.length>1?'s':'')+' on '+esc(list.map(nameOfView).join(', '))
9858
9960
  +(list.length>1?' are ':' is ')+state+' — '+verb+(list.length>1?' them':' it')+' is what brings its editing controls back.'):'';
9859
- p.innerHTML='<h3>Selected on another view</h3><div class="dmsg'+(faulted?' warn':'')+'" style="margin-top:8px">'
9961
+ p.innerHTML='<h3>Selected on another view</h3><div class="dmsg'+(faulted?' warn':'')+'" style="margin-top:8px;flex:none">'
9860
9962
  +esc(selIds.size===1?'That member cannot be shown here.':'Those '+selIds.size+' members cannot be shown here.')
9861
9963
  +' '+sheets.map(s=>esc(regLeadText(nameOfView(s),blocking.get(s)))).join(' ')+'</div>'
9862
9964
  /* The remedy sentence names the ONE route that works, and that is a correction rather than a polish.
@@ -9870,6 +9972,17 @@ function panel(){
9870
9972
  +'<div class="row hint" style="margin-top:8px">Read-only — these come from the model itself, so nothing about the sheets&rsquo; registration changes them. No sheet can draw this member yet.'
9871
9973
  +clause(faultSheets,'refused','correcting')+clause(openSheets,'not finished yet','finishing')+'</div>'
9872
9974
  +refusedSheetPropsHtml(canon);
9975
+ return;}
9976
+ /* #1880 — selected in 3D, and NO plan view shows it: an X-brace read from a frame elevation. Its
9977
+ properties come from the model itself, so they are shown read-only, with the views it was read from
9978
+ named in plain words. Without this branch the click fell through to the legend below, which tells the
9979
+ user their click did nothing. */
9980
+ const onlyIds=new Set(sourceOnlyIds(canon.map(m=>m.id))),onlyRows=canon.filter(m=>onlyIds.has(m.id));
9981
+ if(onlyRows.length){
9982
+ p.innerHTML='<h3>Shown in 3D only</h3><div class="dmsg" style="margin-top:8px;flex:none">'
9983
+ +esc(sourceOnlyLead(onlyRows.length,[...sourceOnlyViewsFor([...onlyIds]).values()]))+'</div>'
9984
+ +'<div class="row hint" style="margin-top:8px">Read-only — these come from the model itself. To change one, ask your terminal AI; this editor can&rsquo;t yet edit a member shown only on an elevation or section.</div>'
9985
+ +refusedSheetPropsHtml(onlyRows);
9873
9986
  return;}}
9874
9987
  if(arr.length===0){const elevationContext=nativeElevationModel()?nativeElevationContextHtml():
9875
9988
  '<div style="border-top:1px solid var(--line);margin-top:12px;padding-top:12px"><div class=sect>Project defaults</div>'+
@@ -10351,7 +10464,7 @@ function panel(){
10351
10464
  if(v===''){setBr({offset:0});return;}
10352
10465
  const mm=parseLenMm(v);if(mm==null||!Number.isFinite(mm)){toast(lenRefusal(v));render();return;}
10353
10466
  setBr({offset:mm});}; // both are millimetres now — the parser and the stored field finally agree
10354
- const _bf=document.getElementById('brFlip');if(_bf)_bf.onclick=()=>setBr({offset:-(m.brace.offset||0)}); // draw the symbol on the other side (no typing a minus)
10467
+ const _bf=document.getElementById('brFlip');if(_bf)_bf.onclick=()=>setBr({offset:-((m.brace&&m.brace.offset)||0)}); // draw the symbol on the other side (no typing a minus)
10355
10468
  const _bsw=document.getElementById('brSwap');if(_bsw)_bsw.onclick=()=>edit(()=>{normBrace(m);ModelCmd.patchMemberBrace(m,{lowerEnd:1-braceLowerEnd(m)});});}
10356
10469
  {const setPos=(v,source)=>commitPositionEdit([m],{position:v},source); // profile placement on the reference line; persists + re-extrudes the 3D
10357
10470
  const _pt=document.getElementById('posTop'),_pm=document.getElementById('posMid'),_pb=document.getElementById('posBot');
@@ -12103,7 +12216,7 @@ function toLevelCommit(tool,ti){const sel=selArr();const T=C.plans[ti];
12103
12216
  if(!sel.length){toast('Selection is empty — nothing to '+(tool==='move'?'move':'copy'));return;}
12104
12217
  if(!T)return;
12105
12218
  const targetView=viewIdOf(T),hereView=viewIdOf(P),targetName=viewLabel(T);
12106
- const entries=sel.map(m=>{const views=V2Projection.memberViewIds(C,m.id),sourceViewId=views.includes(hereView)?hereView:views[0];return sourceViewId?{id:m.id,sourceViewId}:null;})
12219
+ const entries=sel.map(m=>{const views=V2Projection.memberPlanViewIds(C,m.id),sourceViewId=views.includes(hereView)?hereView:views[0];return sourceViewId?{id:m.id,sourceViewId}:null;})
12107
12220
  .filter(row=>row&&row.sourceViewId!==targetView);
12108
12221
  if(!entries.length){toast('Selection is already on '+targetName);return;}
12109
12222
  let effect=null;
@@ -13754,7 +13867,7 @@ const view3dApi={
13754
13867
  ptPerFt:()=>v2Refuse('ptPerFt — a drawing scale belongs to a SHEET; v2 members and grid are world mm'),
13755
13868
  defaultTosMm:()=>v2Refuse('defaultTosMm — native members carry explicit elevations, so a substituted default would silently relocate them'),
13756
13869
  geoMode:()=>geoMode, // 'el' | 'split' | null — armed Trim/Extend/Split state
13757
- onMoveMember:(id,newWp)=>runSteelAuthoring('move',{source:'drag-3d',selection:[id]},()=>edit(()=>{const m=byId(id);if(m)MC().replaceEndpoints(m,newWp);})), // 3D drag → shared lifecycle, then provider-owned write
13870
+ onMoveMember:(id,newWp)=>refuseSourceOnlyEdit(id,'move')?undefined:runSteelAuthoring('move',{source:'drag-3d',selection:[id]},()=>edit(()=>{const m=byId(id);if(m)MC().replaceEndpoints(m,newWp);})), // 3D drag → shared lifecycle, then provider-owned write
13758
13871
  positionGizmoState:(id)=>memberPositionGizmoState(id), // 3D Profile Position gizmo (slice 3a): read-only frame axes + current-frame offset/roll for one member
13759
13872
  endpointGestureState:(id)=>memberDirectGestureState(id), // direct 3D end-node drag: canonical world line + stale-gesture authority
13760
13873
  splitGestureState:(id)=>memberDirectGestureState(id), // direct 3D Split: the same canonical world line + stale-gesture authority
@@ -13768,11 +13881,11 @@ const view3dApi={
13768
13881
  onCopyDrag3d:(ids,dxMm,dyMm)=>runSteelAuthoring('copy',{source:'drag-copy-3d',selection:ids||[]},()=>{ // Ctrl+drag copy: shared lifecycle, WORLD MM at the provider boundary
13769
13882
  edit(()=>{modelSelection.replaceMembers(MC().copyDragMm(ids,[dxMm,dyMm],planeOf));}); // each clone lands on its SOURCE's plane at THAT plane's scale (a cross-sheet selection copies each member onto its own sheet, not the active one)
13770
13883
  toast('Copied '+(ids?ids.length:0)+' member'+((ids&&ids.length===1)?'':'s'));}),
13771
- onMoveEndpoint:(id,end,wp)=>runSteelAuthoring('stretch',{source:'endpoint-drag-3d',selection:[id]},()=>edit(()=>{const m=byId(id);if(m&&Array.isArray(m.wp)&&m.wp.length>=2)MC().setEndpoint(m,end,wp);})),
13884
+ onMoveEndpoint:(id,end,wp)=>refuseSourceOnlyEdit(id,'stretch')?undefined:runSteelAuthoring('stretch',{source:'endpoint-drag-3d',selection:[id]},()=>edit(()=>{const m=byId(id);if(m&&Array.isArray(m.wp)&&m.wp.length>=2)MC().setEndpoint(m,end,wp);})),
13772
13885
  onMoveEndpointWorld:(id,end,point,state)=>commitMemberEndpoints(id,{
13773
13886
  [end===0?'from':'to']:point,gesture:'endpoint',expect:state&&state.fingerprint,generation:state&&state.generation,
13774
13887
  },null), // v2 end-node drag → absolute world mm, one undo, stale snapshot checked before write
13775
- onElevateMember:(id,dMm)=>runSteelAuthoring('transform',{source:'elevation-drag-3d',selection:[id],numeric:{zMm:Number(dMm)}},()=>edit(()=>{const m=byId(id);if(!m)return; // 3D Alt-drag → provider-owned elevation write
13888
+ onElevateMember:(id,dMm)=>refuseSourceOnlyEdit(id,'raise or lower')?undefined:runSteelAuthoring('transform',{source:'elevation-drag-3d',selection:[id],numeric:{zMm:Number(dMm)}},()=>edit(()=>{const m=byId(id);if(!m)return; // 3D Alt-drag → provider-owned elevation write
13776
13889
  const pl=planeOfMember(m),base=(pl?(pl.default_tos_mm!=null?pl.default_tos_mm:0):defaultTosMm); // OWNING sheet by OBJECT identity (ids are only sheet-unique — planeOf(id) would hit the first sheet carrying that id, not necessarily this member's). Materialize an unset elevation from that sheet's datum — the 3D measures dz from that sheet's geometry, so adding it to the ACTIVE sheet's default would land the member off by the difference between the two defaults
13777
13890
  ModelCmd.elevateBy(m,dMm,base);})), // `base` is passed IN, never resolved inside: it is the OWNING sheet's datum, and the boundary's own defaultTosMm is the editor GLOBAL. Unifying them here would erase a pre-existing difference this refactor must preserve
13778
13891
  onTrimExtend:(targetId)=>{const tm=byId(targetId);
@@ -23338,6 +23451,9 @@ function rfiResolveControls(memberId,locked){
23338
23451
  }
23339
23452
  /** The one sentence a row prints when the model holds the member but cannot draw it anywhere. */
23340
23453
  const RFI_UNREACHABLE='FloLess cannot place this member on any sheet it can map, so its size cannot be set or located from here — the sheet it is drawn on needs its registration fixed first.';
23454
+ /* #1880 — the registration sentence is FALSE for a member read from an elevation (S-302 · S-302-3 is
23455
+ registered; elevations are simply not drawn in 2D), so those members get their own true reason. */
23456
+ function rfiUnreachableText(ids,what){return sourceOnlyBlockedText(ids,what,one=>'Select '+(one?'it':'them')+' in the 3D view to see '+(one?'it':'them')+', or ask your terminal AI to settle this question.')||RFI_UNREACHABLE;}
23341
23457
 
23342
23458
  /* ── Heights the drawing states, proposed rather than asked for (#1723) ───────────────────────────
23343
23459
  The server's live question row for a member end can carry a PROPOSAL — heights read off the drawing,
@@ -23383,7 +23499,7 @@ function rfiElevationControls(rowKey,rowId,g){
23383
23499
  const subject=rfiElevationSubject(g);
23384
23500
  if(!subject||!rfiEndUnresolved(subject.memberId,subject.end))return '';
23385
23501
  const m=byId(subject.memberId);
23386
- if(!m)return '<div class=rfinote>'+esc(RFI_UNREACHABLE)+'</div>';
23502
+ if(!m)return '<div class=rfinote>'+esc(rfiUnreachableText([subject.memberId],'set this height'))+'</div>';
23387
23503
  const busy=rfiElevBusy===rowKey,blocked=!!rfiElevBusy;
23388
23504
  const block=blocked?' aria-disabled="true" data-blocked-reason="A height is still being saved — wait for it to finish"':'';
23389
23505
  const what='the top of steel at the '+rfiEndWords(subject.end,m)+' of '+subject.memberId;
@@ -23437,7 +23553,7 @@ async function rfiApplyHeight(rowKey,mm,candidateKey){
23437
23553
  }
23438
23554
  }
23439
23555
  const m=byId(subject.memberId);
23440
- if(!m){rfiElevNote={rowKey,text:RFI_UNREACHABLE};return;}
23556
+ if(!m){rfiElevNote={rowKey,text:rfiUnreachableText([subject.memberId],'set this height')};return;}
23441
23557
  const applied=edit(()=>{
23442
23558
  if(m.role==='column'){if(subject.end===0)ModelCmd.setBosMm(m.col,mm);else ModelCmd.setTosValueMm(m.col,mm);}
23443
23559
  else ModelCmd.setTosValueMm(m.ends[subject.end],mm);
@@ -23822,7 +23938,7 @@ function rfiRecordRowHtml(r){
23822
23938
  const absentJoints=(r.targets||[]).filter(t=>t&&t.where==='model'&&t.jointId&&!(C.joints||[]).some(j=>j&&j.id===t.jointId));
23823
23939
  if(absentJoints.length)notes.push('A connection named by this RFI is no longer in the model.');
23824
23940
  if(!live.length&&!ids.length&&!targetControls)notes.push('This question has no drawing or model destination to open.');
23825
- if(ids.length&&!live.length)notes.push(RFI_UNREACHABLE);
23941
+ if(ids.length&&!live.length)notes.push(esc(rfiUnreachableText(ids,ids.length===1?'locate it':'locate them'))); // `notes` is HTML: ids and view labels are author-written
23826
23942
  if(!r.text)notes.push('This RFI records no question, so there is nothing to copy.');
23827
23943
  if(profileLocked)notes.push('Finish the paused profile check on the other RFI before changing this size.');
23828
23944
  /* THE BOOKKEEPING VERBS. `rfiVerbsFor` is total over the wire's own fields, so a verb this record cannot
@@ -23925,7 +24041,7 @@ function rfiSymptomRowHtml(row){
23925
24041
  +esc(rfiSymptomReason(m))
23926
24042
  +'<div class=rfimeta>'+meta+'</div>'
23927
24043
  +wasClosed
23928
- +(resolve?'':'<div class=rfinote>'+RFI_UNREACHABLE+'</div>')
24044
+ +(resolve?'':'<div class=rfinote>'+esc(rfiUnreachableText([m.id],'set its size'))+'</div>')
23929
24045
  +(profileLocked?'<div class=rfinote>Finish the paused profile check on the filed RFI before changing this size.</div>':'')
23930
24046
  // Suppressed while a form is open, because the form renders its OWN slot directly above Submit —
23931
24047
  // the record row does the same, and without it a promotion's refusal printed twice.
@@ -24255,15 +24371,17 @@ function wireRfiList(){
24255
24371
  function rfiLocate(id){
24256
24372
  // THE GUARD COMES FIRST. `setPlan` is a visible side effect, and running it before the check meant a
24257
24373
  // member the projection cannot resolve changed the user's sheet and then did nothing else.
24258
- if(!byId(id)){toast(RFI_UNREACHABLE);return;}
24374
+ if(!byId(id)){toast(rfiUnreachableText([id],'locate it'));return;}
24259
24375
  // ANY view that draws it, not only a plan one: this list is project-wide over every view kind, and
24260
24376
  // filtering to plans left a member drawn solely on an elevation selected on a sheet that does not
24261
- // show it — the "closed the dialog and nothing happened" failure this was meant to end.
24377
+ // show it — the "closed the dialog and nothing happened" failure this was meant to end. (A member
24378
+ // ONLY an elevation shows never gets here: `byId` resolves plan views alone, so the guard above
24379
+ // refuses it with the true reason — see `rfiUnreachableText`, #1880.)
24262
24380
  const views=V2Projection.memberViewIds(C,id);
24263
24381
  const owning=(C.plans||[]).findIndex(pl=>pl&&views.includes(viewIdOf(pl)));
24264
24382
  if(owning>=0&&owning!==C.active)setPlan(owning);
24265
24383
  const m=byId(id);
24266
- if(!m){toast(RFI_UNREACHABLE);return;}
24384
+ if(!m){toast(rfiUnreachableText([id],'locate it'));return;}
24267
24385
  selDimIds.clear();modelSelection.replaceMembers([id]);geoMode=null;setGeo();closeRFI();render();
24268
24386
  // Selected and framed are two things: if framing throws, the selection stands and the user sees a
24269
24387
  // selection that did not move. An empty catch would leave no evidence of which happened.
@@ -24471,7 +24589,28 @@ function readValueText(field){if(field.kind!=='elevation')return String(field.va
24471
24589
  return 'Unknown'+(typeof value.rfiRef==='string'&&value.rfiRef.trim()?(' · '+value.rfiRef.trim()):'');}
24472
24590
  function readNotesHtml(){const groups=[];const add=(label,notes)=>{const unique=[...new Set((Array.isArray(notes)?notes:[]).filter(n=>typeof n==='string'&&n.trim()).map(n=>n.trim()))];if(unique.length)groups.push({label,notes:unique});};
24473
24591
  add('Model notes',C.read_notes);for(const p of C.plans||[])add('Sheet '+(viewLabel(p)||String(p.sheet||'—')),p.read_notes);
24474
- if(!groups.length)return '';return '<section class=read-notes aria-label="Sheet read notes">'+groups.map(g=>'<h3>'+esc(g.label)+'</h3><ul>'+g.notes.map(n=>'<li>'+esc(n)+'</li>').join('')+'</ul>').join('')+'</section>';}
24592
+ const answers=yourAnswersHtml();
24593
+ if(!groups.length&&!answers)return '';return '<section class=read-notes aria-label="Sheet read notes">'+groups.map(g=>'<h3>'+esc(g.label)+'</h3><ul>'+g.notes.map(n=>'<li>'+esc(n)+'</li>').join('')+'</ul>').join('')+answers+'</section>';}
24594
+ /*
24595
+ * #1906 — "Your answers" in the model notes: every height the PERSON answered on a question card, with the
24596
+ * source note and pictures they gave. DERIVED from the answered arms in the model (server-authored, never
24597
+ * the read's prose), so it survives a revision read and cannot be written by the read.
24598
+ */
24599
+ function yourAnswersHtml(){const rows=[];
24600
+ for(const m of C.members||[])for(const [end,key] of [[0,'from'],[1,'to']]){const z=m&&m[key]&&m[key].z;
24601
+ if(!z||!z.answered||typeof z.answered!=='object'||!Number.isFinite(z.known))continue;const a=z.answered;
24602
+ const said=a.how==='typed'?'you typed '+(a.typed||fmtDispElev(z.known)):'you confirmed '+(a.shownAs||fmtDispElev(z.known));
24603
+ const when=typeof a.answeredAt==='string'&&!Number.isNaN(Date.parse(a.answeredAt))?', '+new Date(a.answeredAt).toLocaleDateString():'';
24604
+ const pics=(Array.isArray(a.evidence)?a.evidence:[]).map(ref=>' <button type=button class=answer-picture data-command-id="steel.answer-picture-open#'+esc(ref.fileName)+'" data-answer-request="'+esc(a.requestId)+'" data-answer-evidence="'+esc(ref.attachmentId)+'" data-command-instance-label="'+esc(String(a.label||m.id))+'" data-tip="Open '+esc(ref.fileName)+'">'+esc(ref.fileName)+'</button>').join('');
24605
+ rows.push('<li>'+esc(String(a.label||m.id))+': '+esc(said)+(a.basis==='read-of-your-picture'?' (the read’s reading of your picture)':'')+' on height question'+esc(when)+(a.note?' — '+esc(a.note):'')+pics+'</li>');}
24606
+ return rows.length?'<h3>Your answers</h3><ul>'+rows.join('')+'</ul>':'';}
24607
+ /** A button that opens a picture the person attached to an answer (#1906), served only after its digest check. */
24608
+ function answerPictureButton(requestId,ref,instance){const b=document.createElement('button');b.type='button';b.className='answer-picture';
24609
+ b.dataset.commandInstanceLabel=String(instance||ref.fileName||'picture');
24610
+ b.textContent=String(ref.fileName||'picture');b.dataset.commandId='steel.answer-picture-open#'+String(ref.fileName||'picture');
24611
+ b.dataset.answerRequest=String(requestId||'');b.dataset.answerEvidence=String(ref.attachmentId||'');b.dataset.tip='Open '+String(ref.fileName||'the picture');return b;}
24612
+ document.addEventListener('click',(event)=>{const b=event.target&&event.target.closest&&event.target.closest('button[data-answer-evidence]');if(!b)return;
24613
+ window.open('/api/projects/'+encodeURIComponent(PROJECT)+'/answer-evidence/'+encodeURIComponent(b.dataset.answerRequest||'')+'/'+encodeURIComponent(b.dataset.answerEvidence||''),'_blank','noopener');});
24475
24614
  function readFieldsHtml(row,target){return (row.observations||[]).map(observation=>{
24476
24615
  const flags=[observation.provenanceLabel];if(observation.inherited)flags.push('Shared evidence — inherited after split');if(observation.verified)flags.push('✓ Human-confirmed observation');
24477
24616
  return '<div class=read-group><div class=read-group-head><b>'+esc(observation.sheet||'Unknown sheet')+'</b><span>'+flags.map(esc).join(' · ')+'</span></div>'+observation.fields.map(field=>{