@floless/app 0.124.1 → 0.125.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -351,7 +351,7 @@ export function createV2CommandSession(model, options = {}) {
351
351
  id, profile: projected.profile || '', from, to,
352
352
  provenance: 'manual',
353
353
  };
354
- for (const key of ['material', 'role', 'memberType', 'position', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
354
+ for (const key of ['material', 'role', 'memberType', 'position', 'positionH', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
355
355
  if (projected[key] !== undefined) member[key] = clone(projected[key]);
356
356
  }
357
357
  if (Array.isArray(projected.ends)) {
@@ -77,7 +77,7 @@ export function projectMember(member, plan, session = null) {
77
77
  role: member.role || 'beam',
78
78
  provenance: member.provenance,
79
79
  };
80
- for (const key of ['material', 'memberType', 'position', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
80
+ for (const key of ['material', 'memberType', 'position', 'positionH', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
81
81
  if (member[key] !== undefined) meta[key] = clone(member[key]);
82
82
  }
83
83
  const endMeta = Array.isArray(member.ends) ? member.ends : [{}, {}];
@@ -65,17 +65,59 @@
65
65
  white-on-dark leak this rule exists to fix cannot arise because the OS picks the colours.
66
66
  verify-native-controls cannot see inside a conditional @media, so this neither satisfies nor
67
67
  weakens it. (Codex review on #592.) */
68
+ /* RANGE sliders, themed the same way and for the same reason the checkbox above is: `accent-color`
69
+ tints only the thumb and the FILLED part of the track, leaving the rest as the UA widget — measured
70
+ in Chromium as a WHITE bar across this dark #zoombar. The track and thumb are therefore drawn, not
71
+ tinted, and unscoped so the next slider on this surface inherits it instead of needing its own rule.
72
+ Both engines get their own rules: `appearance:none` DELETES Chromium's thumb unless
73
+ ::-webkit-slider-thumb re-declares it, and Firefox does not implement that pseudo-element. Never GROUP the
74
+ two vendors in one selector list — an unrecognised pseudo-element invalidates the whole list, so
75
+ both engines discard it and the slider renders with no track and no thumb at all.
76
+ accent-color also tinted the FILLED part of the track and Chromium exposes no pseudo-element for
77
+ it, so this slider no longer shows how far along the value is; Firefox does expose it, hence the
78
+ ::-moz-range-progress rule below. Restoring the cue in Chromium needs JS and is a separate change.
79
+ Same declarations as steel-editor.html's block (indentation aside). Nothing enforces that they stay
80
+ in step; verify-native-controls holds each surface to the contract independently, which is what
81
+ actually matters if they ever drift. */
82
+ input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:14px;padding:0;border:0;
83
+ background:transparent;cursor:pointer}
84
+ input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:var(--line)}
85
+ input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--line)}
86
+ input[type=range]::-moz-range-progress{height:4px;border-radius:2px;background:var(--brand)}
87
+ /* margin-top centres the 12px thumb on the 4px track: (4-12)/2. Chromium paints the thumb 12px
88
+ INCLUDING its 1px border, so the border is not an extra -1 — measured at 8x, -5px sat it a whole
89
+ pixel high. Firefox is expected to centre ::-moz-range-thumb itself — no Firefox is installed on
90
+ the machines this was written and reviewed on, so every Firefox claim here is reasoned from the
91
+ spec, not measured, while every Chromium one is measured. */
92
+ input[type=range]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:12px;height:12px;
93
+ margin-top:-4px;border-radius:50%;background:var(--brand);border:1px solid var(--bg)}
94
+ input[type=range]::-moz-range-thumb{width:12px;height:12px;border-radius:50%;background:var(--brand);
95
+ border:1px solid var(--bg)}
96
+ input[type=range]:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
68
97
  @media (forced-colors: active){
69
98
  input[type=checkbox]{appearance:revert;-webkit-appearance:revert;width:revert;height:revert;
70
99
  border:revert;background:revert;display:revert;padding:revert}
71
100
  input[type=checkbox]::before{content:none}
101
+ /* EVERY authored property is reverted, pseudo-elements included. Reverting only the input left the
102
+ track pinned at 4px and the thumb suppressed by its own reset, collapsing the control to a 120x4
103
+ sliver with no handle — measured at forced-colors:active, and worse than the 16px native widget
104
+ these users had before this block existed. */
105
+ input[type=range]{appearance:revert;-webkit-appearance:revert;width:revert;height:revert;
106
+ padding:revert;border:revert;background:revert}
107
+ input[type=range]::-webkit-slider-runnable-track{height:revert;border-radius:revert;background:revert}
108
+ input[type=range]::-moz-range-track{height:revert;border-radius:revert;background:revert}
109
+ input[type=range]::-moz-range-progress{height:revert;border-radius:revert;background:revert}
110
+ input[type=range]::-webkit-slider-thumb{appearance:revert;-webkit-appearance:revert;width:revert;
111
+ height:revert;margin-top:revert;border-radius:revert;background:revert;border:revert}
112
+ input[type=range]::-moz-range-thumb{width:revert;height:revert;border-radius:revert;background:revert;
113
+ border:revert}
72
114
  }
73
115
  .ck input{cursor:pointer;margin:0}
74
116
  .ck .ct{margin-left:auto;color:var(--mut);font-variant-numeric:tabular-nums;font-size:11px}
75
117
  .muted{color:var(--mut);font-size:12px;line-height:1.5}
76
118
  hr{border:0;border-top:1px solid var(--line);margin:0}
77
119
  #zoombar{position:absolute;left:12px;bottom:12px;display:flex;align-items:center;gap:8px;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:6px 10px;box-shadow:0 4px 14px rgba(0,0,0,.45);z-index:5}
78
- #zoombar input[type=range]{width:120px;padding:0;accent-color:var(--brand)}
120
+ #zoombar input[type=range]{width:120px} /* SIZING only — the theming is the global input[type=range] rule above */
79
121
  #zoombar #zpct{min-width:42px;text-align:right;color:var(--mut);font-variant-numeric:tabular-nums}
80
122
  #zoombar .ghost{height:24px;padding:0 8px;background:transparent;border:1px solid var(--line);color:var(--mut);border-radius:5px;font-size:11px}
81
123
  #zoombar .ghost:hover{color:var(--text);border-color:var(--brand)}
@@ -1,5 +1,5 @@
1
1
  /* ============================================================================
2
- * workspaces.js — the Workflows | Workspaces mode shell (slice 1).
2
+ * workspaces.js — the Workspaces | Workflows mode shell (slice 1).
3
3
  * Owns: mode state, the landing project grid, the open-project view (Drawings |
4
4
  * Model iframes), the project picker + lifecycle menu, and per-project Approve.
5
5
  * Composes with app.js/panels.js by CLASS-GATING (CSS hides Workflows chrome under
@@ -253,7 +253,6 @@
253
253
  const WORKSPACE_APPS = {
254
254
  'steel-model': {
255
255
  displayName: 'Steel model',
256
- seedLabel: 'steel model',
257
256
  projectCapability: 'review, detail, export',
258
257
  createActions: [
259
258
  {
@@ -263,21 +262,11 @@
263
262
  sub: 'Turn steel drawings into a 3D model you can review and export.',
264
263
  label: 'Pick drawings',
265
264
  },
266
- {
267
- kind: 'current',
268
- headline: 'Copy from Workflows',
269
- capability: 'Open model → new project',
270
- sub: 'Copies the steel model open in Workflows into a new project here.',
271
- label: 'Copy the open model',
272
- // Describes the MECHANISM, never a live fact. Disabling this card when there is nothing to
273
- // copy would need a server probe whose answer goes stale between render and click — so it
274
- // could never be the only gate anyway (the rollback in createSeeded is). A tip that says
275
- // what the card does sets the same expectation and cannot be wrong.
276
- // "nothing is KEPT", not "nothing gets created" — the rollback's archive POST can itself
277
- // fail, and on that branch a project does briefly exist. A tip must not promise what the
278
- // failure path cannot honour.
279
- tip: 'Copies the steel model currently open in Workflows. If nothing’s open there, nothing is kept.',
280
- },
265
+ // The "Copy from Workflows" card (kind:'current') lived here until #625. It was the
266
+ // transitional bridge from the days when the model normally lived in the Workflows
267
+ // pipeline view; with Workspaces now the primary entry point (#623) it was a third card
268
+ // for a path most users never take. The server verb it drove (POST /api/projects with
269
+ // `seedFromApp`) is deliberately LEFT INTACT — only the client's way in is gone.
281
270
  ],
282
271
  editor: '/steel-editor.html',
283
272
  filter: '/steel-filter.html',
@@ -375,10 +364,11 @@
375
364
  // Two ids, because a rename separates them and each half is load-bearing: `appId` is the LIVE app a
376
365
  // card creates on (post the descriptor key after a rename and the server rightly 404s "not
377
366
  // installed"), `templateId` is the descriptor key supplying the card's copy. ONE entry per
378
- // descriptor, preferring the canonical install: steel declares two create actions, so an entry per
379
- // installed app would double the landing's most important surface the moment anyone duplicates a
380
- // workflow. `ambiguous` marks a root with more than one live app behind it, so that single card can
381
- // say which workflow it will use rather than silently picking (see renderLanding).
367
+ // descriptor, preferring the canonical install: a descriptor may declare several create actions
368
+ // (steel declared two until #625), so an entry per installed app would multiply the landing's most
369
+ // important surface the moment anyone duplicates a workflow. `ambiguous` marks a root with more
370
+ // than one live app behind it, so that single card can say which workflow it will use rather than
371
+ // silently picking (see renderLanding).
382
372
  //
383
373
  // Drives the per-app create cards. Falls back to the descriptor keys if /api/apps can't be read.
384
374
  // Starts at the descriptor keys so the create cards are on the FIRST paint, then /api/apps narrows
@@ -597,6 +587,16 @@
597
587
  // the combo isn't even visible in Workspaces mode. Every path that changes the open project
598
588
  // (open, close, rename → openProject, mode switch, boot) ends here, so the title can't go stale.
599
589
  if (bridge.setWorkspaceTitle) bridge.setWorkspaceTitle(workspaceTabSubject(ws, current));
590
+ // Scope the shared Requests window to the open project, so it stops stacking every other
591
+ // project's queued work. Three states, and the landing is NOT the same as Workflows mode:
592
+ // `null` (Workflows) lets aware.js scope to the open workflow, while `{}` (the landing) says
593
+ // there is no scope at all — without that distinction the window would name a workflow the
594
+ // user cannot even see from here. The same `ws` guard as above is load-bearing: setMode()
595
+ // does NOT clear `current`.
596
+ if (bridge.setRequestScope) {
597
+ if (!ws) bridge.setRequestScope(null);
598
+ else bridge.setRequestScope(current ? { project: current.id, appId: current.app, label: current.name } : {});
599
+ }
600
600
  // Keep the shared guide beacon in step with mode: in Workflows mode (or the Workspaces
601
601
  // landing) it must NOT show a workspace guide — clear it so aware.js reverts to the
602
602
  // workflow beacon; in a Workspaces project it points at that project's lifecycle.
@@ -662,8 +662,14 @@
662
662
  if (!(e.ctrlKey || e.metaKey) || e.altKey || e.shiftKey) return;
663
663
  const t = e.target;
664
664
  if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;
665
- if (e.key === '1') { e.preventDefault(); setMode('workflows'); }
666
- else if (e.key === '2') { e.preventDefault(); setMode('workspaces'); }
665
+ // POSITIONAL, like every tabbed app's Ctrl+N: 1 is the LEFT tab, 2 the right. The number is not
666
+ // a name for a mode — nothing in the UI documents these shortcuts, so the only thing telling a
667
+ // user what Ctrl+1 does is the row of tabs in front of them, and a binding that disagreed with
668
+ // the visible order would be silently wrong. So READ the order off the markup rather than
669
+ // restating it: #623 swapped the tabs, and a hardcoded pair would have had to be remembered
670
+ // again on the next reorder. This way there is nothing to keep in step.
671
+ const slot = [...$switch.querySelectorAll('button[data-mode]')][Number(e.key) - 1];
672
+ if (slot) { e.preventDefault(); setMode(slot.dataset.mode); }
667
673
  });
668
674
 
669
675
  // ── landing ─────────────────────────────────────────────────────────────────
@@ -787,8 +793,8 @@
787
793
  // True while the user is engaged with something an unprompted rebuild would pull out from under
788
794
  // them. Two halves, because neither covers the other:
789
795
  // - projActionBusy — an in-flight rename/duplicate/archive from the card kebab.
790
- // - any open modal — the landing's OTHER prompts (createSeeded's and createFromDrawing's name
791
- // boxes, deleteArchivedProject's confirm) never touch projActionBusy, and formModal returns
796
+ // - any open modal — the landing's OTHER prompts (createFromDrawing's name box,
797
+ // deleteArchivedProject's confirm) never touch projActionBusy, and formModal returns
792
798
  // focus on close to the element that opened it. Rebuild the landing underneath and that element
793
799
  // is detached; promptName passes no fallback, so focus lands on <body>. Read off the shared
794
800
  // .modal-backdrop.show class rather than a new bridge seam — workspaces.js already opens these
@@ -1138,19 +1144,15 @@
1138
1144
  }
1139
1145
 
1140
1146
  function workspaceCreateEntries(entries) {
1141
- // Create affordances stay docked at the top, separate from existing projects. Drawing-first
1142
- // entries lead; importing the current Workflows model stays last because it is a different mode.
1143
- return entries
1144
- .flatMap((entry) => {
1145
- const d = WORKSPACE_APPS[entry.templateId];
1146
- const actions = d && Array.isArray(d.createActions) ? d.createActions : [];
1147
- return actions.map((action) => ({ entry, d, action }));
1148
- })
1149
- .sort((a, b) => {
1150
- if (a.action.kind === 'current' && b.action.kind !== 'current') return 1;
1151
- if (a.action.kind !== 'current' && b.action.kind === 'current') return -1;
1152
- return 0;
1153
- });
1147
+ // Create affordances stay docked at the top, separate from existing projects. Cards come out in
1148
+ // descriptor order, per workflow. (A sort used to push the kind:'current' card last because it
1149
+ // started from a different mode; that card is gone — #625 — and every remaining action starts
1150
+ // from a drawing, so declaration order IS the intended order.)
1151
+ return entries.flatMap((entry) => {
1152
+ const d = WORKSPACE_APPS[entry.templateId];
1153
+ const actions = d && Array.isArray(d.createActions) ? d.createActions : [];
1154
+ return actions.map((action) => ({ entry, d, action }));
1155
+ });
1154
1156
  }
1155
1157
 
1156
1158
  function workspaceCreateCardHtml(entry, action) {
@@ -1294,8 +1296,30 @@
1294
1296
  + `<span class="ws-load-error-detail">${escapeHtml(projectsLoadError)}</span>`
1295
1297
  + ` <button type="button" id="ws-retry-projects">↻ Try again</button></div>`;
1296
1298
  } else {
1299
+ // First-run onboarding (#598). Workflows mode greets a newcomer with a real card and a route
1300
+ // into the guided tour; landing HERE first (a direct link, or Workflows already has apps
1301
+ // installed so its card never shows) used to be one dim line and no route at all.
1302
+ //
1303
+ // Deliberately NOT the Workflows card's shape. The create cards are already on screen right
1304
+ // above this, and they are the actual first action — a second bordered, accent-filled "start
1305
+ // here" panel under them would put two accent affordances in a staring contest and invert the
1306
+ // hierarchy. So: the same plain note, one added sentence, and the tour as a QUIET text link
1307
+ // (the .onb-build-btn tier, never the filled .onb-tour-btn one).
1308
+ //
1309
+ // The added sentence says what a project IS, because that is the one thing a newcomer here
1310
+ // cannot infer — not "no Run here", which .ws-sub already states unconditionally two lines up.
1297
1311
  const note = 'No projects yet — start one from the cards above, or Import project to restore an exported .zip.';
1298
- html += `<div class="ws-empty-note">${escapeHtml(note)}${archived.length ? ' You have archived projects below.' : ''}</div>`;
1312
+ const what = 'A project is an approved, running copy of a workflow app — you open it like a document and keep working. Building or changing the app itself happens in Workflows mode.';
1313
+ html += `<div class="ws-empty-note">${escapeHtml(note)} ${escapeHtml(what)}${archived.length ? ' You have archived projects below.' : ''}`
1314
+ // Same prompt, same aria wording as the Workflows card — a screen-reader user who meets both
1315
+ // entry points should hear one action, not two. The id is what carries focus across a
1316
+ // repaint (landingFocusKey keys on it).
1317
+ + `<div class="ws-empty-tour">New here? `
1318
+ + `<button type="button" id="ws-onb-tour" class="ws-empty-tour-btn" `
1319
+ + `aria-label="Start the guided tour — copies the onboarding prompt to your clipboard" `
1320
+ + `data-tip="Copies a prompt — paste it into Claude Code or Codex">Start the guided tour →</button>`
1321
+ + `<span class="sr-only ws-empty-tour-live" aria-live="polite"></span>`
1322
+ + `</div></div>`;
1299
1323
  }
1300
1324
  }
1301
1325
  // Archived ("Trash") section — a collapsed disclosure below the live grid, only when non-empty.
@@ -1341,6 +1365,9 @@
1341
1365
  if (keepFocus) $landing.querySelector(keepFocus)?.focus({ focusVisible: true, preventScroll: true });
1342
1366
  paintCardThumbs();
1343
1367
  tipTruncatedNames();
1368
+ // The first-run tour link, when the empty state rendered one. app.js owns the copy behaviour so
1369
+ // both entry points to the tour stay identical; a no-op when the button isn't on screen.
1370
+ wireTourCopy($landing.querySelector('#ws-onb-tour'));
1344
1371
  reflashCard(); // a repaint must not swallow an in-flight confirmation glow
1345
1372
  }
1346
1373
 
@@ -1396,8 +1423,8 @@
1396
1423
  const v = el.getAttribute(a);
1397
1424
  if (v != null) return `[${a}="${escapeAttr(v)}"]`;
1398
1425
  }
1399
- // A create card needs BOTH halves of its identity: one workflow can declare several create actions
1400
- // (steel declares two), so data-seed-app alone would match the wrong card.
1426
+ // A create card needs BOTH halves of its identity: one workflow can declare several create
1427
+ // actions (steel declared two until #625), so data-seed-app alone would match the wrong card.
1401
1428
  // The lineage root is the stable identity across a workflow rename; data-seed-app is the live
1402
1429
  // action target and can change during an autonomous apps-changed repaint. Keying focus on it
1403
1430
  // would drop a keyboard user to <body> precisely when the workflow moves (#362 review).
@@ -1430,10 +1457,18 @@
1430
1457
  const appId = seed.dataset.seedApp;
1431
1458
  const templateId = seed.dataset.seedTemplate || appId;
1432
1459
  if (!WORKSPACE_APPS[templateId]) return;
1460
+ // Every create action is drawing-first since #625 removed the copy-from-Workflows card. The
1461
+ // check stays a check rather than an assumption: a future kind must declare its own branch,
1462
+ // not silently inherit the file picker.
1433
1463
  if (seed.dataset.seedAction === 'drawing') {
1434
1464
  const files = await pickDrawingFiles($seedFile); // drop-a-drawing: open the picker
1435
1465
  if (files.length) createFromDrawing(appId, templateId, files);
1436
- } else createSeeded(appId, templateId); // takeoff import
1466
+ } else {
1467
+ // Unreachable today, and it must not be SILENT the day it isn't: an unhandled kind still
1468
+ // renders a full dashed, focusable card, so without this the first person to add one gets a
1469
+ // control that does nothing and says nothing. A dead control is no better than a missing one.
1470
+ console.warn(`[workspaces] create action "${seed.dataset.seedAction}" has no handler — the card does nothing`);
1471
+ }
1437
1472
  }
1438
1473
  });
1439
1474
  $landing.addEventListener('keydown', (e) => {
@@ -1494,44 +1529,10 @@
1494
1529
  return res && typeof res.name === 'string' && res.name.trim() ? res.name.trim() : null;
1495
1530
  }
1496
1531
 
1497
- // `appId` is the LIVE app to create on; `templateId` its lineage root, which supplies the wording.
1498
- // They differ whenever the workflow has been renamed or duplicated — see the seed-card comment.
1499
- async function createSeeded(appId, templateId) {
1500
- const name = await promptName('New project', 'Name this project', '');
1501
- if (!name) return;
1502
- try {
1503
- const { project, seeded } = await api('/api/projects', { method: 'POST', body: JSON.stringify({ name, app: appId, seedFromApp: true }) });
1504
- const seedLabel = (WORKSPACE_APPS[templateId] && WORKSPACE_APPS[templateId].seedLabel) || 'model';
1505
- // ROLL BACK when there was nothing to copy (#489). `seeded:false` means the app held no current
1506
- // model (or it was unreadable), so this card's ONE job did not happen. Saying so in a toast was
1507
- // honest but not enough: it still created and opened a project indistinguishable from a real
1508
- // one, whose Model tab reads "No model for steel-model" and whose only other signal is a 404 in
1509
- // a console the user never opens. They then have to discover the failure two clicks later and
1510
- // clean up a junk project. The sibling drop-a-drawing create already rolls its own failure back
1511
- // through archiveEmptyProject; this is the same move, and it can make the stronger statement —
1512
- // the branch happens BEFORE openProject, so nothing was ever shown and "no project was created"
1513
- // is literally true, where the drawing path can only say the empty one "was removed".
1514
- if (!seeded) {
1515
- const removed = await archiveEmptyProject(project.id);
1516
- showToast(
1517
- removed
1518
- ? `There’s no ${seedLabel} currently open in Workflows to copy — no project was created.`
1519
- : `There’s no ${seedLabel} currently open in Workflows to copy — but an empty project was left behind; archive it from the ⋯ menu.`,
1520
- 'warn',
1521
- );
1522
- // `archiveEmptyProject` drops the local row whether or not the archive SUCCEEDED, so on
1523
- // failure the card the toast just told the user to open a menu on would not be there. Go back
1524
- // to the server: it still holds that project, so the card returns and the instruction can
1525
- // actually be followed. On success this also reconciles against any racing loadProjects().
1526
- if (removed) renderLanding(); else await loadProjects();
1527
- return;
1528
- }
1529
- showToast(`Project "${project.name}" created from the current ${seedLabel}`, 'ok');
1530
- track('workspace_project_created', { app: appId }); // takeoff-import create path
1531
- projects.unshift(project);
1532
- openProject(project.id);
1533
- } catch (err) { showToast('Couldn’t create the project: ' + (err && err.message || err), 'warn'); }
1534
- }
1532
+ // `createSeeded` — the copy-the-open-Workflows-model create — lived here until #625 removed the one
1533
+ // card that called it, along with the `seedLabel` wording it read and the rollback it ran when the
1534
+ // app held nothing to copy (#489). The server verb it posted (`seedFromApp` on POST /api/projects)
1535
+ // is untouched; git history has the client half if the card ever comes back.
1535
1536
 
1536
1537
  // Drop-a-drawing create. No new server verb: create an EMPTY project, then fire the
1537
1538
  // existing revision pipeline (attachRevision) with the dropped file so the terminal AI reads it into
@@ -1606,7 +1607,7 @@
1606
1607
  hostReadinessStates = {};
1607
1608
  renderReadinessState = null;
1608
1609
  track('workspace_project_opened', { app: p.app }); // a real open (card click or post-create landing)
1609
- lastRevState = 'none'; stopRevisionPoll(); closeRevReview(); // fresh project — drop any prior revision-poll state and any open review
1610
+ resetRevisionState(); closeRevReview(); // fresh project — drop any prior revision state and any open review
1610
1611
  // …and any open CONVERSION, for the same reason. The header project combo reaches `openProject`
1611
1612
  // without going through `closeProject`, so switching projects under an open migrate modal would
1612
1613
  // otherwise leave it on screen bound to `migState.projectId` — the project just navigated away
@@ -1678,7 +1679,7 @@
1678
1679
  exportState = null;
1679
1680
  hostReadinessStates = {};
1680
1681
  renderReadinessState = null;
1681
- stopRevisionPoll();
1682
+ resetRevisionState();
1682
1683
  stopKnowledgePoll(); kbCloseConfirm(); kbResetViewer(); knowledgeState = null; // the KB pane is per-project — never carry it across
1683
1684
  // A STAGED REVIEW IS PER-PROJECT TOO, and the line above is the precedent. Without this the modal
1684
1685
  // survived leaving the project: it kept rendering the old project's proposals over the landing, and
@@ -1697,7 +1698,7 @@
1697
1698
  // Reset with the rest of the per-project state — this file resets `histDiffSupported` for exactly
1698
1699
  // this reason. Bumping the generation also voids any probe still in flight for the closing project.
1699
1700
  exportsHasModel = true; modelPresenceGen++;
1700
- lastRevState = 'none'; $revisionCard.hidden = true; closeProjMenu(); applyMode(); syncWorkspaceGuide();
1701
+ closeProjMenu(); applyMode(); syncWorkspaceGuide(); // revision state cleared by resetRevisionState() above
1701
1702
  }
1702
1703
  document.getElementById('ws-back').addEventListener('click', closeProject);
1703
1704
 
@@ -5249,9 +5250,41 @@
5249
5250
  // no SSE hook — and refreshes History on completion. Cards are DOM-built (textContent, never
5250
5251
  // innerHTML) so an AI-supplied error string can never reach the DOM as markup.
5251
5252
  let lastRevState = 'none';
5252
- let revBaseVersion = 0; // the ledger head captured at attach — success = the head advances past it
5253
+ let revBaseVersion = 0; // the ledger head captured at attach — success = the head advances past it
5254
+ let revBaseProject = null; // …and WHICH project it was captured in; a baseline means nothing anywhere else
5253
5255
  let revCardReq = null;
5254
5256
  let revisionPoll = null;
5257
+ let revisionGen = 0; // bumped per render AND by openProject/closeProject — see renderRevisionCard
5258
+ let revRequestsFailed = false; // one log per outage, not one per 3-second poll tick
5259
+ /**
5260
+ * Every piece of revision state above is PER-PROJECT, so opening or closing one must clear all of
5261
+ * it — and until this existed only `lastRevState` was. What the other three left behind:
5262
+ *
5263
+ * - `$revisionCard` / `revCardReq`: `openProject` never touched the card, and the only thing that
5264
+ * used to wipe it on a switch was the stale render carrying on with the new project as `current`
5265
+ * — the very bug the guards in `renderRevisionCard` now stop. So the clearing has to be explicit
5266
+ * here, or one failed `/api/requests` for the newly opened project leaves the OLD project's card
5267
+ * standing over it with live buttons: "Review changes" resolving a foreign request id, "Dismiss"
5268
+ * DELETING the previous project's pending read.
5269
+ *
5270
+ * `revBaseVersion` is deliberately NOT reset here, and the reason is worth stating because zeroing
5271
+ * it looks like the same tidy-up. The completion check is `tip.n > revBaseVersion`, and its job (see
5272
+ * the comment at the check) is to keep a bare request DELETE — Dismiss, or the footer's Clear all —
5273
+ * from claiming a read completed. Zeroing on every open turns that into `tip.n > 0`, which ANY
5274
+ * previously committed revision-read satisfies: switch away and back, clear the request from a
5275
+ * second tab, and the card announces a completion that never happened and re-locks exports.
5276
+ * Scoping the baseline to the project it was captured in (`revBaseProject`) fixes the cross-project
5277
+ * miss without widening that window — an unknown project falls back to 0, exactly as a cold page
5278
+ * load always has.
5279
+ */
5280
+ function resetRevisionState() {
5281
+ lastRevState = 'none';
5282
+ revCardReq = null;
5283
+ revisionGen++; // voids any render still in flight for the project being left
5284
+ stopRevisionPoll();
5285
+ $revisionCard.hidden = true;
5286
+ $revisionCard.replaceChildren();
5287
+ }
5255
5288
  const isInitialRevisionRead = (req) => !req || !req.baseVersion || req.baseVersion <= 0;
5256
5289
  function stopRevisionPoll() { if (revisionPoll) { clearInterval(revisionPoll); revisionPoll = null; } }
5257
5290
  function startRevisionPoll() {
@@ -5297,6 +5330,7 @@
5297
5330
  if (bridge.loadRequests) bridge.loadRequests().catch(() => {}); // refresh the footer Requests popover
5298
5331
  if (current !== proj) return; // switched away while posting — don't drive the wrong project's card/poll
5299
5332
  revBaseVersion = (req && typeof req.baseVersion === 'number') ? req.baseVersion : 0;
5333
+ revBaseProject = proj.id; // the baseline belongs to THIS project — see resetRevisionState
5300
5334
  showToast(`${revBaseVersion <= 0 ? 'Initial' : 'Revised'} set queued — ${files.length} file${files.length > 1 ? 's' : ''} for your terminal AI`, 'ok');
5301
5335
  lastRevState = 'pending';
5302
5336
  startRevisionPoll();
@@ -5348,10 +5382,34 @@
5348
5382
  }
5349
5383
 
5350
5384
  async function renderRevisionCard() {
5351
- if (!current) { $revisionCard.hidden = true; return; }
5385
+ // GENERATION, not just the captured object — the idiom `refreshModelPresence`/`refreshApprovalState`
5386
+ // already use here, and for the reason `closeProject` bumps THEIR counters: a *close* has to void an
5387
+ // in-flight render, and comparing the project alone cannot see one. `openProject` re-uses the cached
5388
+ // `projects` entry, so closing a project and re-opening it hands back the SAME object — an identity
5389
+ // check passes and the stale render carries on. Bumping per render also settles two renders racing
5390
+ // for one project (the 3s poll can start a second while the first is still out): newest wins.
5391
+ const gen = ++revisionGen;
5392
+ const proj = current;
5393
+ if (!proj) { $revisionCard.hidden = true; return; }
5352
5394
  let reqs = [];
5353
- try { const b = await api('/api/requests'); reqs = Array.isArray(b) ? b : (b.requests || []); } catch { return; }
5354
- const mine = reqs.filter((r) => r && r.type === 'revision-read' && r.project === current.id);
5395
+ // ONCE PER OUTAGE, not once per tick. This runs on a 3-second poll, so an unguarded log turns a
5396
+ // server restart into a wall of red — the same "every open logs an error" noise #600 was written
5397
+ // to remove, and enough to fail the console-clean bar every E2E is held to. Silence was still
5398
+ // wrong (a stuck card had no trace at all), so the first failure speaks and the recovery resets it.
5399
+ try {
5400
+ const b = await api('/api/requests');
5401
+ reqs = Array.isArray(b) ? b : (b.requests || []);
5402
+ revRequestsFailed = false;
5403
+ } catch (e) {
5404
+ if (!revRequestsFailed) console.error('[workspaces] could not load requests for the revision card', e);
5405
+ revRequestsFailed = true;
5406
+ return;
5407
+ }
5408
+ // Superseded while the requests were in flight. Everything past here reads the project and paints
5409
+ // the ONE shared card, so resuming would either throw on a null `current` (the Workspaces
5410
+ // breadcrumb, mid-poll) or paint the old project's revision state over the newly opened one.
5411
+ if (gen !== revisionGen || !current || current.id !== proj.id) return;
5412
+ const mine = reqs.filter((r) => r && r.type === 'revision-read' && r.project === proj.id);
5355
5413
  const failed = mine.find((r) => r.status === 'failed');
5356
5414
  const staged = mine.find((r) => r.status === 'staged');
5357
5415
  const pending = mine.find((r) => r.status === 'pending');
@@ -5363,23 +5421,35 @@
5363
5421
  // must NOT show a false "complete" toast or re-lock exports.
5364
5422
  if (lastRevState === 'pending' && state === 'none') {
5365
5423
  let vr;
5366
- try { vr = await api(`/api/projects/${encodeURIComponent(current.id)}/versions`); }
5367
- catch { return; } // transient — leave lastRevState 'pending'; the poll retries next tick
5424
+ try { vr = await api(`/api/projects/${encodeURIComponent(proj.id)}/versions`); }
5425
+ catch (e) { console.error('[workspaces] could not read versions to confirm the revision read', e); return; }
5426
+ // ^ transient — leave lastRevState 'pending'; the poll retries next tick.
5427
+ // THIS one is not transient and does not retry: `openProject`/`closeProject` have already reset
5428
+ // `lastRevState` and stopped the poll, so the pending→none EDGE below is gone for good and the
5429
+ // completion toast for `proj` is DROPPED, not deferred. That is the deliberate trade — the
5430
+ // alternative, which is what shipped before, was to fire "Revision read complete" while another
5431
+ // project is on screen and clear ITS `approvedAt`, attributing one project's read to another.
5432
+ if (gen !== revisionGen || !current || current.id !== proj.id) return;
5368
5433
  const tip = (vr.versions || [])[0];
5369
- if (tip && tip.kind === 'revision-read' && tip.n > revBaseVersion) {
5370
- current.approvedAt = vr.approvedAt || undefined; // the AI read cleared the sign-off (exports re-lock)
5434
+ // A baseline captured in ANOTHER project says nothing about this one's ledger, and reading it as
5435
+ // though it did suppressed real completions (attach at head 12 there, a read commits at 4 here —
5436
+ // `4 > 12` is false, so no toast, no re-lock, no repaint, and nothing said). Unknown falls back
5437
+ // to 0, which is what a cold page load has always used.
5438
+ const base = revBaseProject === proj.id ? revBaseVersion : 0;
5439
+ if (tip && tip.kind === 'revision-read' && tip.n > base) {
5440
+ proj.approvedAt = vr.approvedAt || undefined; // the AI read cleared the sign-off (exports re-lock)
5371
5441
  // A model may have just come into existence, and the repaints below fire only for the VISIBLE
5372
5442
  // pane — which on the drop-a-drawing flow is Drawings, neither of them. Without this the header
5373
5443
  // stays gated, telling the user to read a drawing they just finished reading. (approveProject
5374
5444
  // re-probes so the ACTION is never blocked; this stops the chrome lying in the meantime.)
5375
- refreshModelPresence(current.id, current.app).catch(() => { /* header stays as-is */ });
5445
+ refreshModelPresence(proj.id, proj.app).catch(() => { /* header stays as-is */ });
5376
5446
  // AND the approval state, which model presence alone no longer covers. Before "not reviewable"
5377
5447
  // was told apart from "the probe failed", an empty project sat in the ERROR state here and the
5378
5448
  // header's click-to-retry quietly repaired it on the next click. That retry is gone by design —
5379
5449
  // it cannot help a project that is simply too old — so the read completing, which is the event
5380
5450
  // that just made `no-contract` false, has to say so itself. Without this the header keeps
5381
5451
  // telling someone to read a drawing they have this second finished reading.
5382
- refreshApprovalState(current.id).catch((e) => console.error('[workspaces] approval header did not refresh after the read', e));
5452
+ refreshApprovalState(proj.id).catch((e) => console.error('[workspaces] approval header did not refresh after the read', e));
5383
5453
  if (!$wsHistory.hidden) renderHistory();
5384
5454
  // …and the Exports pane, if it is the one showing. "Exports re-lock" was the intent, but
5385
5455
  // nothing repainted them: the pane kept its live buttons and its per-destination Details
@@ -6060,6 +6130,10 @@
6060
6130
  'elevation-default-missing': 'Elevations',
6061
6131
  'elevation-in-inferred': 'Elevations',
6062
6132
  'column-zero-height': 'Elevations',
6133
+ // Its own cluster rather than "Elevations", where its sibling sits: this one is about where the
6134
+ // member stands in PLAN, and filing a plan finding under an elevation heading is the skim-past
6135
+ // failure the default-deny note above exists to prevent.
6136
+ 'column-plan-offset': 'Member geometry',
6063
6137
  'dedup-merge-proposed': 'Duplicate members',
6064
6138
  'marker-unbound': 'Duplicate members',
6065
6139
  'marker-merge-dependent': 'Duplicate members',
@@ -7664,8 +7738,8 @@
7664
7738
  // project-picker is now a pure switcher with no inline actions). Never switches projects itself
7665
7739
  // except where a rename of the OPEN project must re-src its iframes — the caller decides navigation.
7666
7740
  // Each branch updates the local `projects` array from the endpoint's result (unshift a duplicate,
7667
- // move a rename to the front, filter out an archive — the unshift mirrors createSeeded/
7668
- // createFromDrawing) and repaints the grid IMMEDIATELY, so the change is on screen WITH the toast
7741
+ // move a rename to the front, filter out an archive — the unshift mirrors createFromDrawing)
7742
+ // and repaints the grid IMMEDIATELY, so the change is on screen WITH the toast
7669
7743
  // instead of seconds later when loadProjects() re-fetches; the trailing loadProjects() is then just
7670
7744
  // a background reconcile. projActionBusy blocks a double-submit (e.g. Duplicate twice on a large
7671
7745
  // project whose copy is still in flight) — a re-entry while one is in flight is toasted, not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.124.1",
3
+ "version": "0.125.1",
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": {
@@ -39,6 +39,7 @@
39
39
  "verify:flo-versions": "node build/verify-flo-versions.mjs",
40
40
  "verify:boundary": "node build/verify-model-boundary.mjs",
41
41
  "verify:change-reasons": "node build/verify-change-reasons.mjs",
42
+ "verify:claim-lock": "node ../tools/routine-claim.mjs selftest",
42
43
  "typecheck": "tsc --noEmit",
43
44
  "prepack": "npm run build",
44
45
  "verify:skill-scripts": "node build/verify-skill-scripts.mjs"