@floless/app 0.126.0 → 0.126.2

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.
@@ -3947,13 +3947,13 @@ function widthEstimated(profile){
3947
3947
  if(!m||!/^(W|S|M|HP|C|MC|WT|ST|MT)$/.test(m[1]))return false; // only the I/channel/tee families fall back to a ratio
3948
3948
  const key=p.replace(/\s+/g,'');
3949
3949
  return sec[key]===undefined&&bf[key]===undefined;}
3950
- // Section shape kind from the designation — mirrors steel-3d-view.js shapeOf (parity with 3D).
3951
- function sectionKindOf(profile){const p=String(profile||'').toUpperCase().trim();
3952
- if(/^(W|M|S|HP|UC|UB|UKC|UKB|IPE|HE)/.test(p))return 'I';
3953
- if(/^(C|MC|PFC)/.test(p))return 'C';
3954
- if(/^L/.test(p))return 'L';
3955
- if(/^(HSS|PIPE|TS|SHS|RHS|CHS|TUBE|HSQ)/.test(p))return 'TUBE';
3956
- return 'BOX';}
3950
+ // Section shape kind from the designation — the ONE classifier, in steel-3d-core.js, shared with the 3D
3951
+ // extrusion (steel-3d-view.js shapeOf) and the base-plate weld (server/steel-joints.ts). This used to be
3952
+ // a hand-kept COPY of that regex chain, which is exactly how #647 survived: a bare `M` in the I-branch
3953
+ // made the `MC` branch unreachable, so every MC channel drew as a wide flange. Unguarded because boot()
3954
+ // awaits SteelCore at the top, before it fetches the contract and before main() — and every path here
3955
+ // (render(), and updateLine() on a live drag) needs C/P, which cannot exist until after that await.
3956
+ function sectionKindOf(profile){return SteelCore.sectionKindOf(profile);}
3957
3957
  // Local section outline (centred at origin), w/d in PX — mirrors steel-3d-view.js profileShape (the
3958
3958
  // tf/tw web+flange fractions match, so 2D and 3D read as the same section). Tube drawn solid in 2D.
3959
3959
  function sectionShapePts(profile,w,d){const hw=w/2,hd=d/2,kind=sectionKindOf(profile);
@@ -5748,6 +5748,11 @@ function panel(){
5748
5748
  const unavailable=connectionDiagnosticsStatus==='unavailable';
5749
5749
  return `<div class=drow aria-busy="${unavailable?'false':'true'}"><div style="flex:1 1 100%;min-width:0"><div class="dmsg warn">${unavailable?'Build status unavailable':'Checking connection build status…'}</div><div class=hint role=note style="margin-top:3px">${unavailable?'The connection engine could not verify this detail. No build action is offered until verification succeeds.':'The connection engine is checking the current model before offering a build action.'}</div></div>${unavailable?`<button id=${id}_retry class=ghostw data-tip="Check this connection against the current model again">Check again</button>`:''}</div>`;
5750
5750
  }
5751
+ if(diag&&diag.code==='support-section-unsupported'){
5752
+ const truth=supportSectionWarningCopy(diag),preview=!joint;
5753
+ return `<div class=drow><div style="flex:1 1 100%;min-width:0"><div class=dmsg warn>${preview?'Would build with limited support-side fit':'Built with limited support-side fit'}</div><div class=hint role=note style="margin-top:3px">${esc(truth.detail)}</div></div>`
5754
+ +(r.ok?`<button id=${id}_ap class=ghostw data-tip="${preview?'Build this connection from the detail':'Build it again from the detail, replacing what is here'}">${preview?'Build it':'Rebuild it'}</button>`:'')+`${capBtn}</div>`;
5755
+ }
5751
5756
  if(diag&&diag.severity==='error'){
5752
5757
  const truth=connectionRefusalCopy(diag,m);
5753
5758
  return `<div class=drow><div style="flex:1 1 100%;min-width:0"><div class="dmsg warn">${esc(truth.head)}</div><div class=hint role=note style="margin-top:3px">${esc(truth.detail)}</div></div></div>`;
@@ -8065,6 +8070,10 @@ function announceConnectionTruth(message,busy){
8065
8070
  if(p){if(busy)p.setAttribute('aria-busy','true');else p.removeAttribute('aria-busy');}
8066
8071
  if(s){s.setAttribute('role','status');s.setAttribute('aria-live','polite');s.setAttribute('aria-atomic','true');s.textContent=message||'';}
8067
8072
  }
8073
+ function supportSectionWarningCopy(d){
8074
+ const support=d.supportId||'the named support',profile=d.profile||'this section';
8075
+ return {head:'Built with limited support-side fit',detail:'Support '+support+' ('+profile+') is not an I-shaped section, so the support-side cope or web-face shift was not applied. Review this connection before fabrication.'};
8076
+ }
8068
8077
  function connectionRefusalCopy(d,m){
8069
8078
  const support=d.supportId||'the named support',main=d.mainId||m.id,profile=d.profile||m.profile||'This profile';
8070
8079
  if(d.code==='closed-section-unsupported'){
@@ -8085,6 +8094,7 @@ function connectionRefusalCopy(d,m){
8085
8094
  'support-not-found':{head:'Not built · No support meets this brace end',detail:'No support face could be proved for '+main+'. No gusset or brace trim was created.'},
8086
8095
  'setback-unprovable':{head:'Not built · Brace setback cannot be proved',detail:'The support face and '+main+' do not define a safe setback. No gusset or brace trim was created.'},
8087
8096
  'trim-exceeds-member':{head:'Not built · The required trim is too long',detail:main+' cannot safely give up enough length for this gusset. No geometry or trim was created.'},
8097
+ 'support-section-unsupported':{head:'Built with limits · Support section is not an I-girder',detail:support+' ('+profile+') has no v1 cope or web-face model. The connection remains visible, but support-side placement and flange clearance need review.'},
8088
8098
  'bearing-face-unresolved':{head:'Not built · Bearing face cannot be resolved',detail:profile+' has no provable face for this through-bolted detail. No geometry or trim was created.'},
8089
8099
  'bolt-region-too-small':{head:'Not built · The bolt group does not fit',detail:'The authored plate cannot hold the required bolt group and edge distances. No geometry or trim was created.'}
8090
8100
  };
@@ -8099,10 +8109,11 @@ function updateConnectionDiagnostics(raw,announce=true){
8099
8109
  for(const d of fresh)shownConnectionDiagnosticSignatures.add(connectionDiagnosticSignature(d));
8100
8110
  if(announce&&fresh.length){
8101
8111
  const refused=fresh.filter(d=>d.severity==='error').length,adjusted=fresh.filter(d=>d.code==='bolt-gauge-adjusted').length;
8102
- const bits=[];if(refused)bits.push(refused+' connection'+(refused>1?'s':'')+' not built');if(adjusted)bits.push(adjusted+' built with an adjusted bolt gauge');
8112
+ const limited=fresh.filter(d=>d.code==='support-section-unsupported').length;
8113
+ 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');
8103
8114
  toast(bits.join(' · ')+' — see the member inspector.');
8104
8115
  }
8105
- return {count:fresh.length,refused:fresh.filter(d=>d.severity==='error').length,adjusted:fresh.filter(d=>d.code==='bolt-gauge-adjusted').length};
8116
+ 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};
8106
8117
  }
8107
8118
  function applyConnectionBakeTruth(j,announce=true){
8108
8119
  const fresh=updateConnectionDiagnostics(j&&j.diagnostics,false),sk=Array.isArray(j&&j.skipped)?j.skipped:[];
@@ -8117,6 +8128,7 @@ function applyConnectionBakeTruth(j,announce=true){
8117
8128
  const bits=[];
8118
8129
  if(fresh.refused)bits.push(fresh.refused+' connection'+(fresh.refused>1?'s':'')+' not built');
8119
8130
  if(fresh.adjusted)bits.push(fresh.adjusted+' built with an adjusted bolt gauge');
8131
+ if(fresh.limited)bits.push(fresh.limited+' connection'+(fresh.limited>1?'s':'')+' built with limited support-side fit');
8120
8132
  if(legacy)bits.push(legacy+' connection'+(legacy>1?'s':'')+' not shown in 3D');
8121
8133
  if(noFit)bits.push(noFit+' member'+(noFit>1?'s':'')+' priced but not drawn — no tabulated footprint');
8122
8134
  toast(bits.join(' · ')+' — '+((legacy||noFit)?'see the member inspector and console.':'see the member inspector.'));
@@ -4,7 +4,8 @@
4
4
  * Every public command clones the document, changes the clone, validates the complete result, then
5
5
  * commits into the original root object. A rejected command therefore cannot leak a half-written model.
6
6
  * Projection controllers are notified only after commit: member-only edits patch stable ids; structural
7
- * edits rebuild because sheet membership may have changed.
7
+ * edits rebuild because sheet membership may have changed. A mutator must DECLARE which of those it is —
8
+ * see `transact` — because the third shape, saying neither, notifies nobody and renders a stale canvas.
8
9
  *
9
10
  * This module is inert until steel-editor.html creates a session and hands it tagged projection objects.
10
11
  */
@@ -269,7 +270,6 @@ export function createV2CommandSession(model, options = {}) {
269
270
  model,
270
271
  registerProjection(controller) { projections.add(controller); return controller; },
271
272
  unregisterProjection(controller) { projections.delete(controller); },
272
- refreshProjections() { for (const projection of projections) projection.rebuild(); },
273
273
  replaceDocument(next, label = 'replace document') {
274
274
  return session.transact(label, (draft) => {
275
275
  replaceRoot(draft, clone(next));
@@ -302,6 +302,19 @@ export function createV2CommandSession(model, options = {}) {
302
302
  transact(label, mutator) {
303
303
  const draft = clone(model);
304
304
  const effect = mutator(draft) || {};
305
+ // Every mutator must SAY what the projections have to be told: `structural` (rebuild) or a
306
+ // `changedIds` list (patch those rows, and an empty list means deliberately none). Saying neither
307
+ // used to be a silent third path — the shape a mutator that simply returns nothing produces — and it
308
+ // committed the document while notifying no projection at all: a canvas drawing the previous model,
309
+ // with no exception and no console line to find it by (#664). It is refused BEFORE the commit, so a
310
+ // mis-declared command is as atomic as an invalid one.
311
+ if (!effect.structural && !Object.hasOwn(effect, 'changedIds')) {
312
+ throw new V2CommandError(
313
+ 'effect-undeclared',
314
+ `${label} declared no projection effect; return { structural: true } or { changedIds: [...] }`,
315
+ [`effect keys: ${Object.keys(effect).join(', ') || '(none)'}`],
316
+ );
317
+ }
305
318
  const changedIds = effect.changedIds instanceof Set ? effect.changedIds : new Set(effect.changedIds || []);
306
319
  const problems = validationProblems(validate, draft);
307
320
  if (problems.length) {
@@ -315,13 +328,20 @@ export function createV2CommandSession(model, options = {}) {
315
328
  return committed;
316
329
  },
317
330
 
331
+ /**
332
+ * Replace top-level document keys wholesale. Structural by this file's own definition: the caller
333
+ * chooses the keys, so `members`, `plans` and `grid` — everything a projection mirrors — are all
334
+ * reachable, and there is no key list here that could stay in step with the projection as it grows.
335
+ * A rebuild costs one re-projection on what is a click-driven command (dim_style today), and it is
336
+ * the only answer that cannot draw the previous model.
337
+ */
318
338
  patchModel(patch) {
319
339
  return session.transact('patch model', (doc) => {
320
340
  for (const [key, value] of Object.entries(patch)) {
321
341
  if (value === undefined) delete doc[key];
322
342
  else doc[key] = clone(value);
323
343
  }
324
- return {};
344
+ return { structural: true };
325
345
  });
326
346
  },
327
347
 
@@ -4472,7 +4472,7 @@
4472
4472
  label: 'Working copy · DRAFT', group: 'Drafts',
4473
4473
  });
4474
4474
  for (const saved of data.checkpoints || []) out.push({ selector: { kind: 'checkpoint', checkpointId: saved.checkpointId, expectedHash: saved.hash }, label: `Checkpoint ${String(saved.checkpointId).slice(0, 8)} · DRAFT`, group: 'Drafts', sub: saved.baseVersion ? `Pending work from v${saved.baseVersion}` : 'No approved baseline' });
4475
- for (const row of data.approved || []) {
4475
+ for (const row of data.defaultUnavailable?.reason === 'refused' ? [] : (data.approved || [])) {
4476
4476
  if (!data.default || Number(row.version) !== Number(data.default.version)) out.push({ selector: { kind: 'approved', version: row.version }, label: `Older approved · v${row.version}`, group: 'Approved history' });
4477
4477
  }
4478
4478
  return out;
@@ -4491,7 +4491,8 @@
4491
4491
  function exportSourceHtml() {
4492
4492
  if (exportSourcesState.status === 'loading') return '<div class="export-source-status" role="status">Loading export sources…</div>';
4493
4493
  if (exportSourcesState.status !== 'ready') return '<div class="export-source-status unavailable" role="status">Export sources unavailable — retry by reopening Exports.</div>';
4494
- const options = exportSourceOptions(exportSourcesState.data);
4494
+ const data = exportSourcesState.data || {};
4495
+ const options = exportSourceOptions(data);
4495
4496
  const selected = currentExportSourceOption();
4496
4497
  const selectedKey = selected ? JSON.stringify(selected.selector) : '';
4497
4498
  const grouped = ['Recommended', 'Drafts', 'Approved history'].map((group) => {
@@ -4501,7 +4502,10 @@
4501
4502
  + rows.map((option) => { const key = JSON.stringify(option.selector); return `<button type="button" class="export-source-option${key === selectedKey ? ' selected' : ''}" role="option" aria-selected="${String(key === selectedKey)}" data-export-source="${escapeAttr(key)}"><span>${escapeHtml(option.label)}</span>${option.sub ? `<small>${escapeHtml(option.sub)}</small>` : ''}</button>`; }).join('') + '</div>';
4502
4503
  }).join('');
4503
4504
  let warning = '';
4504
- if (selected && selected.selector.kind === 'latest-approved') {
4505
+ if (data.defaultUnavailable?.reason === 'refused') {
4506
+ const unavailableVersion = data.defaultUnavailable.version ? ` v${data.defaultUnavailable.version}` : '';
4507
+ warning = `<div class="export-source-banner refused" role="alert"><b>Approved${unavailableVersion} is unavailable.</b> ${escapeHtml(data.defaultUnavailable.message)} Review the approval before exporting. <button type="button" data-review-changes>Review approval</button></div>`;
4508
+ } else if (selected && selected.selector.kind === 'latest-approved') {
4505
4509
  warning = approvalState.pendingCount ? `<div class="export-source-banner"><b>${approvalState.pendingCount} pending change${approvalState.pendingCount === 1 ? '' : 's'} aren’t included.</b> Exports use approved v${approvalState.headVersion}. <button type="button" data-review-changes>Review changes</button></div>` : '';
4506
4510
  } else if (selected && (selected.selector.kind === 'working' || selected.selector.kind === 'checkpoint')) {
4507
4511
  warning = '<div class="export-source-banner draft"><b>DRAFT · Unapproved changes will be included.</b> This source is frozen when export starts.</div>';
@@ -4532,7 +4536,9 @@
4532
4536
  // Same split as History's empty state (#490): with a model, Approve is genuinely the unlocking
4533
4537
  // action; with none, `POST …/approve` 404s, so pointing at it is a dead end and the real next
4534
4538
  // step is to go read a drawing. `stepLabel('drawings')` because that label is per-app.
4535
- html += hasModel
4539
+ html += exportSourcesState.data?.defaultUnavailable?.reason === 'refused'
4540
+ ? `<div class="ws-exports-gate refused" role="alert">Exports are paused because the approved snapshot failed its integrity check. <button type="button" data-review-changes>Review approval</button></div>`
4541
+ : hasModel
4536
4542
  ? `<div class="ws-exports-gate">Exports go out after sign-off — ` +
4537
4543
  `<button type="button" id="ws-exports-approve">Approve this version</button> to enable them.</div>`
4538
4544
  : `<div class="ws-exports-gate">Nothing to export yet — ` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.126.0",
3
+ "version": "0.126.2",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {
@@ -33,6 +33,8 @@
33
33
  "verify:no-title": "node build/verify-no-title.mjs",
34
34
  "verify:no-native-select": "node build/verify-no-native-select.mjs",
35
35
  "verify:scrollbars": "node build/verify-scrollbars.mjs",
36
+ "verify:flo-report-scrollbars": "node build/verify-flo-report-scrollbars.mjs",
37
+ "verify:flo-lock-drift": "node build/verify-flo-lock-drift.mjs",
36
38
  "verify:native-controls": "node build/verify-native-controls.mjs",
37
39
  "verify:display-sync": "node build/verify-display-sync.mjs",
38
40
  "verify:view-modes": "node build/verify-view-modes.mjs",
@@ -40,6 +42,7 @@
40
42
  "verify:flo-versions": "node build/verify-flo-versions.mjs",
41
43
  "verify:boundary": "node build/verify-model-boundary.mjs",
42
44
  "verify:change-reasons": "node build/verify-change-reasons.mjs",
45
+ "verify:no-agent-trailer": "node build/verify-no-agent-trailer.mjs",
43
46
  "verify:claim-lock": "node ../tools/routine-claim.mjs selftest",
44
47
  "typecheck": "tsc --noEmit",
45
48
  "prepack": "npm run build",