@floless/app 0.105.0 → 0.106.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.
@@ -201,17 +201,43 @@
201
201
  ],
202
202
  },
203
203
  };
204
- const wsApp = () => (current ? WORKSPACE_APPS[current.app] : null);
205
- const appDisplayName = (id) => (WORKSPACE_APPS[id] && WORKSPACE_APPS[id].displayName) || id;
204
+ // A project names its app by the LIVE id, which a rename or a duplicate moves off the descriptor
205
+ // keys above — so resolve through the lineage ROOT the server ships beside it (`templateId`, derived
206
+ // from the app-origin store, which rename and duplicate both carry). A renamed steel-model still
207
+ // finds the steel descriptor, so its projects still open and still say "Steel model".
208
+ // • falls back to `app` for a server that predates the field, and because for a canonical app the
209
+ // two are the same string anyway;
210
+ // • `p.app` remains the LIVE id everywhere it addresses the server — the frames' ?app=, the export
211
+ // and approve routes — so this is a presentation resolution only, never a re-pointing.
212
+ const wsDescOf = (p) => (p && WORKSPACE_APPS[p.templateId || p.app]) || null;
213
+ const wsApp = () => wsDescOf(current);
214
+ /** A project's app in HUMAN words ("Steel model"), falling back to the raw id for an app we have
215
+ * no descriptor for — the only case that still reads as a slug, and it is one we can't name. */
216
+ const projectAppName = (p) => (wsDescOf(p) || {}).displayName || (p && p.app) || '';
217
+ /** The same, by DESCRIPTOR KEY — for the create cards, which name an app we have a descriptor for. */
218
+ const descDisplayName = (templateId) => (WORKSPACE_APPS[templateId] || {}).displayName || templateId;
219
+ /** Whether this project's app has been renamed or duplicated away from its built-in id. The only
220
+ * case where naming the live workflow on the card tells the user something they don't know. */
221
+ const wsRenamed = (p) => !!(p && p.templateId && p.app && p.app !== p.templateId);
206
222
  let mode = 'workflows';
207
223
  try { if (localStorage.getItem(LS_MODE) === 'workspaces') mode = 'workspaces'; } catch { /* private mode */ }
208
224
  let projects = [];
209
225
  let projectsLoadError = null; // last /api/projects failure reason, or null — an empty list means
210
226
  // "none yet" ONLY when this is null (see the empty state in renderLanding)
211
227
  let archived = []; // archived projects (the "Trash") — listed under a collapsed section on the landing
212
- // Installed workspace apps, in descriptor order. Populated from /api/apps in loadProjects():
213
- // the set = apps flagged workspace===true that ALSO have a WORKSPACE_APPS descriptor (an app
214
- // flagged workspace with no descriptor is skipped with a console note — never a broken open).
228
+ // Installed workspace apps, in descriptor order — `{ appId, templateId, ambiguous }` per entry.
229
+ // Populated from /api/apps in loadProjects(): the set = apps flagged workspace===true whose LINEAGE
230
+ // ROOT has a WORKSPACE_APPS descriptor (an app whose root we have no descriptor for is skipped with
231
+ // a console note — never a broken open).
232
+ //
233
+ // Two ids, because a rename separates them and each half is load-bearing: `appId` is the LIVE app a
234
+ // card creates on (post the descriptor key after a rename and the server rightly 404s "not
235
+ // installed"), `templateId` is the descriptor key supplying the card's copy. ONE entry per
236
+ // descriptor, preferring the canonical install: steel declares two create actions, so an entry per
237
+ // installed app would double the landing's most important surface the moment anyone duplicates a
238
+ // workflow. `ambiguous` marks a root with more than one live app behind it, so that single card can
239
+ // say which workflow it will use rather than silently picking (see renderLanding).
240
+ //
215
241
  // Drives the per-app create cards. Falls back to the descriptor keys if /api/apps can't be read.
216
242
  // Starts at the descriptor keys so the create cards are on the FIRST paint, then /api/apps narrows
217
243
  // them. Two alternatives were tried and rejected against measurements:
@@ -223,7 +249,10 @@
223
249
  // The hazard those were guarding — clicking a card for an app that isn't installed — is closed
224
250
  // where it belongs instead: POST /api/projects refuses an app with no readable source, so no
225
251
  // client's paint timing can mint an orphan project, and the click surfaces an honest error toast.
226
- let wsAppIds = Object.keys(WORKSPACE_APPS);
252
+ // The pre-/api/apps default (and the failure fallback): assume each descriptor's canonical app is
253
+ // the installed one. Unambiguous by construction — one entry per descriptor, appId === templateId.
254
+ const wsDefaultAppEntries = () => Object.keys(WORKSPACE_APPS).map((id) => ({ appId: id, templateId: id, ambiguous: false }));
255
+ let wsAppEntries = wsDefaultAppEntries();
227
256
  let current = null; // the open project (null = landing)
228
257
 
229
258
  // The open app's visible label for a step key (Model→"Model" for steel, "Traced" for vectorize) —
@@ -246,7 +275,7 @@
246
275
  // `exported` = an SVG export file exists (from the last export listing); best-known from
247
276
  // exportState, which renderExports() populates. Unknown before Exports is opened → false.
248
277
  const exported = !!(exportState && exportState.svg && exportState.svg.exportedAt);
249
- bridge.setWorkspaceGuide({ app: current.app, name: current.name, displayName: appDisplayName(current.app), approved: !!current.approvedAt, exported });
278
+ bridge.setWorkspaceGuide({ app: current.app, name: current.name, displayName: projectAppName(current), approved: !!current.approvedAt, exported });
250
279
  }
251
280
 
252
281
  // ── mode ────────────────────────────────────────────────────────────────────
@@ -357,35 +386,53 @@
357
386
  }
358
387
  if (archivedSig(archived) !== archivedBefore) renderLanding();
359
388
  // Which workspace apps to offer a create card for: those flagged workspace===true on /api/apps
360
- // that we ALSO know how to render (have a WORKSPACE_APPS descriptor). Keep descriptor order for a
361
- // stable card order. A load failure RE-WIDENS wsAppIds to the descriptor keys (the catch assigns
362
- // them): still usable, and a card for something uninstalled is refused by the server on click.
363
- const cardsBefore = wsAppIds.join(',');
389
+ // whose LINEAGE ROOT we also know how to render (have a WORKSPACE_APPS descriptor). Matching on
390
+ // the root, not the raw id, is what keeps the cards alive across a rename — a renamed steel-model
391
+ // is still flagged workspace, but under a key no descriptor answers to. /api/apps already carries
392
+ // `templateId` per app (the picker's fork/update badges read the same field), so no extra call.
393
+ // Keep descriptor order for a stable card order. A load failure RE-WIDENS the entries to the
394
+ // descriptor keys (the catch assigns them): still usable, and a card for something uninstalled is
395
+ // refused by the server on click.
396
+ const cardsSig = (entries) => entries.map((e) => `${e.appId}>${e.templateId}${e.ambiguous ? '?' : ''}`).join(',');
397
+ const cardsBefore = cardsSig(wsAppEntries);
364
398
  try {
365
399
  const { apps } = await api('/api/apps');
366
400
  if (stale()) return;
367
- const flagged = new Set((apps || []).filter((a) => a && a.workspace === true).map((a) => a.id));
368
- wsAppIds = Object.keys(WORKSPACE_APPS).filter((id) => flagged.has(id));
401
+ // Group the live workspace apps by lineage root, so one descriptor yields one card even when
402
+ // several installed apps share a root (an original plus a duplicate, say).
403
+ const byRoot = new Map();
404
+ for (const a of apps || []) {
405
+ if (!a || a.workspace !== true) continue;
406
+ const root = a.templateId || a.id;
407
+ if (!WORKSPACE_APPS[root]) {
408
+ console.warn(`[workspaces] app "${a.id}" is flagged workspace but its lineage root "${root}" has no client descriptor — skipping its create card`);
409
+ continue;
410
+ }
411
+ if (!byRoot.has(root)) byRoot.set(root, []);
412
+ byRoot.get(root).push(a.id);
413
+ }
414
+ wsAppEntries = Object.keys(WORKSPACE_APPS).filter((root) => byRoot.has(root)).map((root) => {
415
+ // Sorted, so which app a card targets is stable across loads rather than dependent on the
416
+ // order `aware app list` happened to return. The canonical install wins when present: it is
417
+ // the one the user has not deliberately made a variant of.
418
+ const ids = byRoot.get(root).slice().sort();
419
+ return { appId: ids.indexOf(root) >= 0 ? root : ids[0], templateId: root, ambiguous: ids.length > 1 };
420
+ });
369
421
  // Hardening: /api/apps loaded but flagged NONE of our known workspace apps (a transient
370
422
  // appWorkspace read blip returning false for all). Rather than render zero create cards, fall
371
423
  // back to the descriptor keys — the same usable default a full /api/apps failure lands on.
372
- if (wsAppIds.length === 0 && Object.keys(WORKSPACE_APPS).length > 0) {
373
- wsAppIds = Object.keys(WORKSPACE_APPS);
374
- }
375
- for (const a of apps || []) {
376
- if (a && a.workspace === true && !WORKSPACE_APPS[a.id]) {
377
- console.warn(`[workspaces] app "${a.id}" is flagged workspace but has no client descriptor — skipping its create card`);
378
- }
424
+ if (wsAppEntries.length === 0 && Object.keys(WORKSPACE_APPS).length > 0) {
425
+ wsAppEntries = wsDefaultAppEntries();
379
426
  }
380
427
  } catch {
381
428
  if (stale()) return;
382
429
  // /api/apps failed — fall back to the descriptor keys so the create cards still work.
383
- wsAppIds = Object.keys(WORKSPACE_APPS);
430
+ wsAppEntries = wsDefaultAppEntries();
384
431
  }
385
432
  // Second paint ONLY if /api/apps actually changed the card set. It usually confirms what the
386
433
  // previous answer already showed, and a blind repaint seconds later would blow away whatever the
387
434
  // user has since touched in the landing — an open kebab menu, the expanded Archived section.
388
- if (wsAppIds.join(',') !== cardsBefore) {
435
+ if (cardsSig(wsAppEntries) !== cardsBefore) {
389
436
  // #ws-proj-menu lives outside $landing, so the rebuild below does NOT close it — it would stay
390
437
  // pinned at the coordinates of the kebab that opened it while the grid reflows under it
391
438
  // (dropping create cards shifts every project card up), leaving it beside a different project
@@ -451,11 +498,11 @@
451
498
  `<button type="button" class="ws-import-btn" id="ws-import-project" data-tip="Restore a project from an exported .zip file">↓ Import project…</button></div>`;
452
499
  // Create affordances stay docked at the top, separate from existing projects. Drawing-first
453
500
  // entries lead; importing the current Workflows model stays last because it is a different mode.
454
- const createEntries = wsAppIds
455
- .flatMap((id) => {
456
- const d = WORKSPACE_APPS[id];
501
+ const createEntries = wsAppEntries
502
+ .flatMap((entry) => {
503
+ const d = WORKSPACE_APPS[entry.templateId];
457
504
  const actions = d && Array.isArray(d.createActions) ? d.createActions : [];
458
- return actions.map((action) => ({ id, d, action }));
505
+ return actions.map((action) => ({ entry, d, action }));
459
506
  })
460
507
  .sort((a, b) => {
461
508
  if (a.action.kind === 'current' && b.action.kind !== 'current') return 1;
@@ -464,31 +511,53 @@
464
511
  });
465
512
  if (createEntries.length) {
466
513
  html += `<div class="ws-create-grid">`;
467
- for (const { id, action } of createEntries) {
514
+ for (const { entry, action } of createEntries) {
468
515
  const isDrawing = action.kind === 'drawing';
516
+ // Name the target workflow ONLY when the root has more than one live app behind it, so the
517
+ // ordinary card stays clean and the extra line means something wherever it does appear. It
518
+ // must also go on the aria-label: the button's own aria-label REPLACES the accessible name
519
+ // computed from its children, so a descendant span alone is silent to a screen reader.
520
+ const target = entry.ambiguous ? entry.appId : '';
469
521
  html += `<button type="button" class="ws-seed${isDrawing ? ' ws-seed-drop' : ''}" ` +
470
- `aria-label="${escapeAttr(action.label || action.headline)}" ` +
471
- `data-seed-app="${escapeAttr(id)}" data-seed-action="${escapeAttr(action.kind)}"` +
472
- (isDrawing ? ` data-seed-drop="${escapeAttr(id)}"` : '') +
522
+ `aria-label="${escapeAttr((action.label || action.headline) + (target ? ` (on the ${target} workflow)` : ''))}" ` +
523
+ `data-seed-app="${escapeAttr(entry.appId)}" data-seed-template="${escapeAttr(entry.templateId)}" data-seed-action="${escapeAttr(action.kind)}"` +
524
+ (isDrawing ? ` data-seed-drop="${escapeAttr(entry.appId)}"` : '') +
473
525
  `>` +
474
526
  `<span class="plus">+</span>` +
475
527
  `<span class="ws-seed-headline">${escapeHtml(action.headline)}</span>` +
476
528
  (action.capability ? `<span class="ws-seed-capability">${escapeHtml(action.capability)}</span>` : '') +
477
529
  `<span class="ws-seed-sub">${escapeHtml(action.sub)}</span>` +
530
+ (target
531
+ ? `<span class="ws-seed-target" data-tip="You have more than one of these workflows installed.\nThis card creates on:\n${escapeAttr(target)}">On ${escapeHtml(target)}</span>`
532
+ : '') +
478
533
  `</button>`;
479
534
  }
480
535
  html += `</div>`;
481
536
  }
482
537
  html += `<div class="ws-grid">`;
483
538
  for (const p of projects) {
484
- const d = WORKSPACE_APPS[p.app];
485
- const displayApp = appDisplayName(p.app);
539
+ const d = wsDescOf(p);
540
+ const displayApp = projectAppName(p);
486
541
  const projectCapability = d && d.projectCapability ? d.projectCapability : '';
542
+ // The badge says what KIND of document this is — a renamed steel-model is still a Steel model,
543
+ // so it keeps saying so. The live workflow name is added beside it only when it DIFFERS from the
544
+ // built-in, where it is the one thing the badge can no longer tell you; an ordinary card renders
545
+ // no workflow name at all and reads exactly as before (the markup around it is restructured, so
546
+ // the RENDERED TEXT is what is unchanged, not the HTML). Mono + dim is this app's established
547
+ // "technical identifier, not prose" treatment (.rtn-wf, .wf-option-meta, and the timestamp .t
548
+ // right next to it), which keeps it from reading as a second capability line. The full value
549
+ // rides in the tip because the slug is the part that gets abbreviated when room runs out.
550
+ // Every segment is its own element so the layout can say which ones may be abbreviated and which
551
+ // may not — see .ws-meta-app. The separators stay real TEXT (not CSS ::before) so the line still
552
+ // reads as "Trace · westfield-trace · 2 h ago" to a screen reader and to a copy-paste.
553
+ const wfName = wsRenamed(p)
554
+ ? `<span class="ws-sep"> · </span><span class="ws-meta-wf" data-tip="The workflow this project runs on:\n${escapeAttr(p.app)}">${escapeHtml(p.app)}</span>`
555
+ : '';
487
556
  html += `<div class="ws-card" role="button" tabindex="0" data-open="${escapeAttr(p.id)}">` +
488
557
  `<span class="ws-thumb"><span class="ws-kind">${escapeHtml(displayApp)}</span>▦</span>` +
489
558
  `<span class="ws-body"><span><span class="ws-name">${escapeHtml(p.name)}</span>` +
490
559
  (projectCapability ? `<span class="ws-meta">${escapeHtml(projectCapability)}</span>` : '') +
491
- `<span class="ws-meta">${escapeHtml(displayApp)} · <span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span></span>` +
560
+ `<span class="ws-meta ws-meta-app"><span class="ws-meta-kind">${escapeHtml(displayApp)}</span>${wfName}<span class="ws-sep"> · </span><span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span></span>` +
492
561
  `<button type="button" class="ws-kebab" data-kebab="${escapeAttr(p.id)}" aria-label="Project actions" data-tip="Rename · Duplicate · Export · Archive">⋯</button>` +
493
562
  `</span></div>`;
494
563
  }
@@ -518,11 +587,16 @@
518
587
  if (archived.length) {
519
588
  let rows = '';
520
589
  for (const p of archived) {
521
- const displayApp = appDisplayName(p.app);
590
+ const displayApp = projectAppName(p);
591
+ // Tooltip only, deliberately: the Trash is a scan-and-act list where the user's own project
592
+ // NAME is the identifier (it doesn't even carry projectCapability), and a third clause on an
593
+ // already-compact dim line works against that. The disambiguating value lands where it is
594
+ // actionable — the live grid, one Restore away.
595
+ const wfTip = wsRenamed(p) ? ` data-tip="The workflow this project runs on:\n${escapeAttr(p.app)}"` : '';
522
596
  rows += `<div class="ws-archived-row">` +
523
597
  `<span class="ws-archived-info">` +
524
598
  `<span class="ws-archived-name">${escapeHtml(p.name)}</span>` +
525
- `<span class="ws-archived-meta">${escapeHtml(displayApp)} · archived <span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span>` +
599
+ `<span class="ws-archived-meta"${wfTip}>${escapeHtml(displayApp)} · archived <span class="t">${escapeHtml(relAgo(p.updatedAt))}</span></span>` +
526
600
  `</span>` +
527
601
  `<span class="ws-archived-actions">` +
528
602
  `<button type="button" class="btn-mini ws-restore" data-restore="${escapeAttr(p.id)}" data-tip="Un-archive — returns to the live grid">↺ Restore</button>` +
@@ -552,12 +626,16 @@
552
626
  if (card) { openProject(card.dataset.open); return; }
553
627
  const seed = e.target.closest('[data-seed-app]');
554
628
  if (seed) {
555
- const id = seed.dataset.seedApp;
556
- const d = WORKSPACE_APPS[id];
557
- if (d && seed.dataset.seedAction === 'drawing') {
629
+ // Two ids, and they are not interchangeable: create on the LIVE app (`seed-app`), but look the
630
+ // descriptor up by its lineage ROOT (`seed-template`) — after a rename the live id answers to no
631
+ // descriptor, and the built-in id answers to no installed app.
632
+ const appId = seed.dataset.seedApp;
633
+ const templateId = seed.dataset.seedTemplate || appId;
634
+ if (!WORKSPACE_APPS[templateId]) return;
635
+ if (seed.dataset.seedAction === 'drawing') {
558
636
  const files = await pickDrawingFiles($seedFile); // drop-a-drawing: open the picker
559
- if (files.length) createFromDrawing(id, files);
560
- } else createSeeded(id); // takeoff import
637
+ if (files.length) createFromDrawing(appId, templateId, files);
638
+ } else createSeeded(appId, templateId); // takeoff import
561
639
  }
562
640
  });
563
641
  $landing.addEventListener('keydown', (e) => {
@@ -595,7 +673,8 @@
595
673
  e.preventDefault();
596
674
  zone.classList.remove('drag-over');
597
675
  const files = Array.from((e.dataTransfer && e.dataTransfer.files) || []);
598
- if (files.length) createFromDrawing(zone.dataset.seedDrop, files);
676
+ // Same two ids as the click path — the dropzone IS the seed button, so it carries both.
677
+ if (files.length) createFromDrawing(zone.dataset.seedDrop, zone.dataset.seedTemplate || zone.dataset.seedDrop, files);
599
678
  });
600
679
 
601
680
  async function promptName(title, label, value) {
@@ -604,14 +683,16 @@
604
683
  return res && typeof res.name === 'string' && res.name.trim() ? res.name.trim() : null;
605
684
  }
606
685
 
607
- async function createSeeded(appId) {
686
+ // `appId` is the LIVE app to create on; `templateId` its lineage root, which supplies the wording.
687
+ // They differ whenever the workflow has been renamed or duplicated — see the seed-card comment.
688
+ async function createSeeded(appId, templateId) {
608
689
  const name = await promptName('New project', 'Name this project', '');
609
690
  if (!name) return;
610
691
  try {
611
692
  const { project, seeded } = await api('/api/projects', { method: 'POST', body: JSON.stringify({ name, app: appId, seedFromApp: true }) });
612
693
  // Tell the truth about the import: seeded=false means there was no current model to copy
613
694
  // (or it was unreadable) — the project is EMPTY, don't imply the model came across.
614
- const seedLabel = (WORKSPACE_APPS[appId] && WORKSPACE_APPS[appId].seedLabel) || 'model';
695
+ const seedLabel = (WORKSPACE_APPS[templateId] && WORKSPACE_APPS[templateId].seedLabel) || 'model';
615
696
  if (seeded) showToast(`Project "${project.name}" created from the current ${seedLabel}`, 'ok');
616
697
  else showToast(`Project "${project.name}" created — empty (no current ${seedLabel} to import)`, 'warn');
617
698
  track('workspace_project_created', { app: appId }); // takeoff-import create path
@@ -625,10 +706,10 @@
625
706
  // v1. ROLLBACK on cancel/error — if the user cancels the name prompt, or the file can't be read,
626
707
  // AFTER the row is created, archive the empty project so no dead, openable project is left
627
708
  // behind (the row is created before the source exists — spec §4.1).
628
- async function createFromDrawing(appId, files) {
709
+ async function createFromDrawing(appId, templateId, files) {
629
710
  // Ask for the name FIRST (before creating a row) so the common "cancel the prompt" path never
630
711
  // creates anything to roll back.
631
- const name = await promptName(`New ${appDisplayName(appId)} project`, 'Name this project', '');
712
+ const name = await promptName(`New ${descDisplayName(templateId)} project`, 'Name this project', '');
632
713
  if (!name) return;
633
714
  let project;
634
715
  try {
@@ -676,23 +757,38 @@
676
757
  let p = projects.find((x) => x.id === id);
677
758
  if (!p) { try { p = (await api('/api/projects')).projects.find((x) => x.id === id); } catch { /* fall through */ } }
678
759
  if (!p) { showToast('Project not found — it may have been archived.', 'warn'); return loadProjects(); }
679
- // Never a broken open (spec §3.2): a project whose app has no client descriptor (uninstalled or
680
- // renamed workspace app) can't be rendered — toast and bail BEFORE mutating any view state,
681
- // matching the create-card skip. wsApp() would return null for it and the frame wiring would fail.
682
- if (!WORKSPACE_APPS[p.app]) { showToast('This project’s app isn’t available as a workspace.', 'warn'); return; }
760
+ // Never a broken open (spec §3.2): a project whose app has no client descriptor can't be rendered
761
+ // — toast and bail BEFORE mutating any view state, matching the create-card skip. wsApp() would
762
+ // return null for it and the frame wiring would fail.
763
+ //
764
+ // Resolving through the lineage root took RENAMED and DUPLICATED apps out of this branch, which is
765
+ // the whole point of that change — so what remains is the genuinely unknown app: a workspace app
766
+ // we ship no descriptor for. The copy therefore names that, and says what can be done about it,
767
+ // rather than describing a state the user can no longer get themselves into by renaming.
768
+ if (!wsDescOf(p)) {
769
+ showToast('Workspaces has no view for this project’s app yet — ask the AI to add one.', 'warn');
770
+ return;
771
+ }
683
772
  current = p;
684
773
  exportState = null;
685
774
  teklaReadinessState = null;
686
775
  track('workspace_project_opened', { app: p.app }); // a real open (card click or post-create landing)
687
776
  lastRevState = 'none'; stopRevisionPoll(); // fresh project — drop any prior revision-poll state
777
+ // Per-project, like everything above it: never let one project's answer describe another's. Not
778
+ // observable today (every history render is preceded by a fetch that sets it, and a failed fetch
779
+ // renders no rows), but leaving a stale cross-project value in place is the shape of bug this
780
+ // file resets state to avoid — and the next path that renders rows would inherit it.
781
+ histDiffSupported = false;
688
782
  $projName.textContent = p.name;
689
783
  $crumbName.textContent = p.name;
690
- $status.textContent = appDisplayName(p.app);
784
+ $status.textContent = projectAppName(p);
691
785
  // Lazily src the frames once per project; switching steps only toggles hidden so the
692
786
  // editor's state survives a Source⇄Traced round-trip. Frame URLs come from the app descriptor:
693
787
  // the 'model' frame loads the app's editor; the 'drawings' frame loads its filter (steel) OR is
694
788
  // left empty when the app has no filter step (vectorize — its Source step shows a placeholder).
695
- const d = WORKSPACE_APPS[p.app]; // guaranteed present — the guard above bailed on an unknown app
789
+ const d = wsDescOf(p); // guaranteed present — the guard above bailed on an unknown app
790
+ // The LIVE app id, deliberately: the frames address the server with it (contract reads, saves),
791
+ // and after a rename only the live id resolves. Only the descriptor came from the lineage root.
696
792
  const qs = `?app=${encodeURIComponent(p.app)}&project=${encodeURIComponent(p.id)}`;
697
793
  frames.model.dataset.want = `${d.editor}${qs}`;
698
794
  frames.drawings.dataset.want = d.filter ? `${d.filter}${qs}` : '';
@@ -792,11 +888,11 @@
792
888
  if (stillOpen && !$wsHistory.hidden && res && res.version && Number.isInteger(Number(res.version.n))) {
793
889
  expandDiffOnce = { projectId: approvingProject.id, n: Number(res.version.n) };
794
890
  }
795
- showToast(`Approved — "${approvingProject.name}" is baked into ${appDisplayName(approvingProject.app)}`, 'ok');
891
+ showToast(`Approved — "${approvingProject.name}" is baked into ${projectAppName(approvingProject)}`, 'ok');
796
892
  track('workspace_project_approved', { app: approvingProject.app }); // a successful sign-off
797
893
  // First Approve for this app calms the "✦ Start here" beacon (the document-archetype
798
894
  // analog of a workflow's first Run); ticks the Review + Approve guide rows.
799
- if (bridge.markWorkspaceApproved && WORKSPACE_APPS[approvingProject.app]?.docGuide) {
895
+ if (bridge.markWorkspaceApproved && wsDescOf(approvingProject)?.docGuide) {
800
896
  bridge.markWorkspaceApproved(approvingProject.app);
801
897
  }
802
898
  if (stillOpen) {
@@ -2606,6 +2702,12 @@
2606
2702
  };
2607
2703
 
2608
2704
  let versions = []; // last-rendered ledger (newest first)
2705
+ // Whether the semantic comparison applies to THIS project — the SERVER's answer, so the rule lives
2706
+ // in one place instead of being duplicated here. Today that answer is "is this app steel-model",
2707
+ // decided from the live app id; it is NOT contract-type aware (that work is deferred — see
2708
+ // `appSupportsDiff`'s header server-side). Set on every versions fetch; the conservative default is
2709
+ // false so a failed or never-run fetch shows no toggle rather than a dead one.
2710
+ let histDiffSupported = false;
2609
2711
  let expandDiffOnce = null; // { projectId, n }: successful Approve opens only that project's new row
2610
2712
 
2611
2713
  function changeCellHtml(v, canDiff) {
@@ -2638,11 +2740,18 @@
2638
2740
  const action = v.current
2639
2741
  ? ''
2640
2742
  : `<button type="button" class="btn-mini" data-rollback="${escapeAttr(String(v.n))}" data-tip="Restore this version as a new version">↺ Rollback</button>`;
2641
- // "What changed" disclosure — only when the app HAS a semantic diff (steel; wsApp().diff) AND the
2642
- // version has a predecessor (n>1). v1 is the baseline, and a no-diff app (vectorize) gets NO toggle
2643
- // on ANY row — an ABSENT control, never a disabled one (spec §4.4, mirroring the v1-baseline branch).
2743
+ // "What changed" disclosure — only when the semantic diff APPLIES and the version has a
2744
+ // predecessor (n>1). v1 is the baseline, and a no-diff app (vectorize) gets NO toggle on ANY row —
2745
+ // an ABSENT control, never a disabled one (spec §4.4, mirroring the v1-baseline branch).
2746
+ //
2747
+ // `histDiffSupported` is the SERVER's answer (`diffSupported` on the versions response) rather
2748
+ // than this side's own reading of the app descriptor. Not because the server currently knows
2749
+ // more — it applies the same "is this steel-model" rule — but because TWO copies of one rule
2750
+ // drift, and when they drift this way the user gets a "View detailed changes" control that then
2751
+ // answers 409: an affordance they can never satisfy. One answer, from the side that also owns the
2752
+ // refusal. Defaults to the descriptor when the field is absent (an older server).
2644
2753
  const isApprovalBaseline = v.kind === 'approve' && v.changeSummary && v.changeSummary.from == null;
2645
- const canDiff = !!(wsApp() && wsApp().diff) && Number(v.n) > 1 && !isApprovalBaseline;
2754
+ const canDiff = histDiffSupported && Number(v.n) > 1 && !isApprovalBaseline;
2646
2755
  const verRow = `<tr class="${v.current ? 'current' : ''}" data-ver="${escapeAttr(String(v.n))}">` +
2647
2756
  `<td><span class="ver${v.current ? ' cur' : ''}">v${escapeHtml(String(v.n))}</span></td>` +
2648
2757
  `<td class="htime">${escapeHtml(histWhen(v.ts))}</td>` +
@@ -2669,6 +2778,8 @@
2669
2778
  try {
2670
2779
  const r = await api(`/api/projects/${encodeURIComponent(id)}/versions`);
2671
2780
  rows = Array.isArray(r.versions) ? r.versions : [];
2781
+ // Absent on an older server → fall back to the descriptor, which is the pre-change behaviour.
2782
+ histDiffSupported = typeof r.diffSupported === 'boolean' ? r.diffSupported : !!(wsApp() && wsApp().diff);
2672
2783
  approvedAt = r.approvedAt || undefined;
2673
2784
  current.approvedAt = approvedAt; // re-sync — an in-editor autosave clears the sign-off server-side
2674
2785
  } catch (err) {
@@ -3241,7 +3352,7 @@
3241
3352
  const rows = projects.slice().sort((a, b) => a.name.localeCompare(b.name));
3242
3353
  let html = rows.map((p) => {
3243
3354
  const pid = escapeAttr(p.id);
3244
- const displayApp = appDisplayName(p.app);
3355
+ const displayApp = projectAppName(p);
3245
3356
  const meta = `${escapeHtml(displayApp)} · ${escapeHtml(relAgo(p.updatedAt))}`;
3246
3357
  // A PURE SWITCHER: no per-row Rename/Duplicate/Archive icons — project MANAGEMENT lives only on
3247
3358
  // the landing cards' ⋯ menu (a picker that only lets you switch has one predictable affordance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.105.0",
3
+ "version": "0.106.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": {