@floless/app 0.124.1 → 0.125.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.
@@ -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
@@ -6060,6 +6061,10 @@
6060
6061
  'elevation-default-missing': 'Elevations',
6061
6062
  'elevation-in-inferred': 'Elevations',
6062
6063
  'column-zero-height': 'Elevations',
6064
+ // Its own cluster rather than "Elevations", where its sibling sits: this one is about where the
6065
+ // member stands in PLAN, and filing a plan finding under an elevation heading is the skim-past
6066
+ // failure the default-deny note above exists to prevent.
6067
+ 'column-plan-offset': 'Member geometry',
6063
6068
  'dedup-merge-proposed': 'Duplicate members',
6064
6069
  'marker-unbound': 'Duplicate members',
6065
6070
  'marker-merge-dependent': 'Duplicate members',
@@ -7664,8 +7669,8 @@
7664
7669
  // project-picker is now a pure switcher with no inline actions). Never switches projects itself
7665
7670
  // except where a rename of the OPEN project must re-src its iframes — the caller decides navigation.
7666
7671
  // 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
7672
+ // move a rename to the front, filter out an archive — the unshift mirrors createFromDrawing)
7673
+ // and repaints the grid IMMEDIATELY, so the change is on screen WITH the toast
7669
7674
  // instead of seconds later when loadProjects() re-fetches; the trailing loadProjects() is then just
7670
7675
  // a background reconcile. projActionBusy blocks a double-submit (e.g. Duplicate twice on a large
7671
7676
  // 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.0",
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"