@floless/app 0.108.1 → 0.109.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.
@@ -53792,7 +53792,7 @@ function appVersion() {
53792
53792
  return resolveVersion({
53793
53793
  isSea: isSea2(),
53794
53794
  sqVersionXml: readSqVersionXml(),
53795
- define: true ? "0.108.1" : void 0,
53795
+ define: true ? "0.109.0" : void 0,
53796
53796
  pkgVersion: readPkgVersion()
53797
53797
  });
53798
53798
  }
@@ -53802,7 +53802,7 @@ function resolveChannel(s) {
53802
53802
  return "dev";
53803
53803
  }
53804
53804
  function appChannel() {
53805
- return resolveChannel({ isSea: isSea2(), define: true ? "0.108.1" : void 0 });
53805
+ return resolveChannel({ isSea: isSea2(), define: true ? "0.109.0" : void 0 });
53806
53806
  }
53807
53807
 
53808
53808
  // workflow-update.ts
@@ -62454,10 +62454,25 @@ function scoreContract2(contractInput) {
62454
62454
 
62455
62455
  // revision-read-guard.ts
62456
62456
  var STEEL_TYPES = [STEEL_V1, STEEL_V2];
62457
+ function scoreOrRefusal(contract, score = scoreContract2) {
62458
+ try {
62459
+ return { score: score(contract) };
62460
+ } catch (e) {
62461
+ const v = declaredTypeOf(contract) === STEEL_V2 ? validateSteelModelV2(contract) : validateContract(contract);
62462
+ if (v.valid) throw e;
62463
+ const clipPath = (s) => s.length > 200 ? `${s.slice(0, 200)}\u2026` : s;
62464
+ const detail = v.errors.slice(0, 5).map((e2) => `${clipPath(e2.path)}: ${e2.message}`).join("; ");
62465
+ return {
62466
+ refusal: "steel-model revision-read could not read this document as a steel contract" + (detail ? ` \u2014 ${detail}` : "") + ". Fix the contract and post it again."
62467
+ };
62468
+ }
62469
+ }
62457
62470
  function revisionReadContractError(appId, contract) {
62458
62471
  if (appId !== "steel-model") return null;
62459
62472
  if (!STEEL_TYPES.includes(declaredTypeOf(contract))) return null;
62460
- const score = scoreContract2(contract);
62473
+ const scored = scoreOrRefusal(contract);
62474
+ if ("refusal" in scored) return scored.refusal;
62475
+ const score = scored.score;
62461
62476
  if (score.filterMissing) {
62462
62477
  return "steel-model revision-read requires the Steel Filter checkpoint first \u2014 populate contract.filter from the drawing layers/thicknesses/colors, have the user Save the filter, then post the member-read contract";
62463
62478
  }
package/dist/web/app.css CHANGED
@@ -3574,8 +3574,43 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
3574
3574
  .ws-card .ws-kind { position:absolute; top:8px; left:8px; font-size:9px; text-transform:uppercase; letter-spacing:.1em;
3575
3575
  color:var(--accent-bright); background:var(--surface); border:1px solid var(--accent-dim); padding:2px 7px; border-radius:4px; }
3576
3576
  .ws-card .ws-body { padding:11px 13px 13px; display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
3577
- .ws-card .ws-name { display:block; font-size:13px; font-weight:600; color:var(--text); }
3577
+ /* The project NAME is user-supplied and unbounded, and CSS Grid stretches every card in a row to the
3578
+ tallest — so one long name reflows the whole grid. Measured: a 69-character name wrapped to two
3579
+ lines and pushed all four cards in its row from 175px to 195px, while the row below stayed at 175px.
3580
+ (The "type · workflow · time" line below is already immune — see .ws-meta-app.)
3581
+ TWO lines, not one. The name is the card's primary identifier, and the discriminating part of a real
3582
+ project name is usually its TAIL — "…revision A" vs "…revision final" — which one line throws away.
3583
+ Measured on a 275px card (a 212px name box): a mixed-case name fits about 36 characters per line, so
3584
+ two lines carry ~72 against ~36 — and they absorbed the 69-character repro name in full, with no
3585
+ ellipsis at all. All-caps is the worst case at ~25 per line, and the grid's narrowest card (the 240px
3586
+ minmax floor) still holds ~30.
3587
+ CAPPED, deliberately NOT reserved. A min-height of exactly two lines was built first and rejected on
3588
+ the rendered result: it makes every card equal height, but the empty reserved line lands BETWEEN the
3589
+ name and the capability line — a gap in the middle of the card's most-scanned content — and it lands
3590
+ there on the common case, since most names are one line (6 of the 8 cards in the test workspace).
3591
+ That leaves the one long-named card looking tighter than all the ordinary ones, inverting the
3592
+ hierarchy. The bug here is a long name propagating its height onto UNRELATED cards without bound;
3593
+ grid's default align-items:stretch equalising the cards within one row is normal card-grid behaviour
3594
+ and is what the clamp now bounds to a fixed +20px. Rows no longer have to match each other.
3595
+ align-items:start was considered too and rejected: it is right for .lib-list, where a collapsed card
3596
+ next to an expanded one is a designed state, but this is a project dashboard where same-row cards are
3597
+ expected to share a bottom edge — ragged bottoms would read as more broken, not less.
3598
+ overflow-wrap:anywhere because a name need not contain spaces — a single long token would otherwise
3599
+ overflow the clamp sideways instead of wrapping into it.
3600
+ Where the clamp actually hides something, renderLanding() attaches the full name as a data-tip; it
3601
+ measures rather than guesses, so a short name never gets a tooltip that just repeats it. A truly
3602
+ clipped tail is not laid out and so cannot be drag-selected off the card — the copy path is ⋯ →
3603
+ Rename…, whose prompt prefills the full current name in a selectable input. */
3604
+ .ws-card .ws-name { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
3605
+ overflow:hidden; overflow-wrap:anywhere; line-height:1.5;
3606
+ font-size:13px; font-weight:600; color:var(--text); }
3607
+ /* The capability line, held to one line for the same reason. :not(.ws-meta-app) because the meta line
3608
+ below shares this class and owns its own, richer priority rules — see .ws-meta-app. Today it is a
3609
+ short constant from WORKSPACE_APPS, a first-party map we control, so this rule bites nothing yet; it
3610
+ is here for when that map is promoted to a .flo-declared descriptor (workspaces.js says that is the
3611
+ plan once a user-authored workspace app appears), at which point the string stops being ours. */
3578
3612
  .ws-card .ws-meta { display:block; font-size:11px; color:var(--text-muted); margin-top:4px; }
3613
+ .ws-card .ws-meta:not(.ws-meta-app) { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
3579
3614
  .ws-card .ws-meta .t { font-family:var(--mono); font-size:10px; color:var(--text-dim); }
3580
3615
  /* The "type · workflow · time" line.
3581
3616
  *
package/dist/web/app.js CHANGED
@@ -1625,7 +1625,12 @@ document.addEventListener('keydown', (e) => {
1625
1625
 
1626
1626
  document.addEventListener('mouseover', (e) => {
1627
1627
  const el = e.target.closest('[data-tip]');
1628
- if (!el || (e.relatedTarget && el.contains(e.relatedTarget))) return; // ignore moves within the same element
1628
+ // Ignore moves that stay within the SAME anchor. Comparing against the live anchor, rather than
1629
+ // asking whether el contains relatedTarget, is what makes a NESTED tip work: leaving a tipped child
1630
+ // (a project card's ⋯, a favourite chip's ×) back onto its tipped parent resolves a DIFFERENT
1631
+ // anchor, and the containment test swallowed that — the parent's tip could then not be shown again
1632
+ // without leaving the parent entirely and coming back.
1633
+ if (!el || el === anchor) return;
1629
1634
  show(el);
1630
1635
  });
1631
1636
  document.addEventListener('mouseout', (e) => {
package/dist/web/aware.js CHANGED
@@ -5474,6 +5474,12 @@
5474
5474
  } else if (m.type === 'apps-changed') {
5475
5475
  // A workflow was imported (here or in another tab) → refresh the picker (#66).
5476
5476
  loadApps().catch(() => {});
5477
+ // Relayed as a DOM event for the same reason render-progress is: workspaces.js owns the
5478
+ // Workspaces landing, is the only listener, and caches the workflow names + create-card
5479
+ // targets this event invalidates (#389). A relay rather than a wider bridge. No try/catch
5480
+ // around it: dispatchEvent contains a throwing listener itself (it reports the exception
5481
+ // globally and carries on), so this loop is already safe and a guard here would be dead code.
5482
+ window.dispatchEvent(new CustomEvent('floless:apps-changed', { detail: m }));
5477
5483
  } else if (m.type === 'baked' && m.id === currentId) {
5478
5484
  // Baked (here or in another tab) → refresh so the menu item flips to "Re-bake".
5479
5485
  loadApp(currentId).catch(() => {});
@@ -133,7 +133,26 @@
133
133
 
134
134
  // The picker menu is a `.menu` (display:none by default; `.menu.show` → display:block, which
135
135
  // OVERRIDES the `hidden` attribute). So close must clear BOTH — same idiom as the ext-menu.
136
- const closeProjMenu = () => { $projMenu.hidden = true; $projMenu.classList.remove('show'); };
136
+ // Hand focus back to the kebab BEFORE hiding, when the menu is what currently holds it. Clicking a
137
+ // menu item focuses that item (browsers focus a <button> on click), and the very next thing several
138
+ // items do is open a formModal, which on close returns focus to whatever was focused when it opened
139
+ // — by then a detached node, since hiding the menu and repainting the grid both drop it. Handing
140
+ // focus to the kebab first gives that return a live target instead of <body>, which has no
141
+ // accessible name and reads to a screen reader as nowhere.
142
+ //
143
+ // Note this does NOT make the menu keyboard-accessible: openProjMenu() never moves focus into it, so
144
+ // activating a kebab by keyboard leaves focus on the kebab, and #ws-proj-menu is the last element in
145
+ // index.html — ~730 lines after #ws-landing — so tabbing to it means traversing the rest of the
146
+ // document, and there is no Escape/Arrow handling on it. That gap is real and untouched here.
147
+ // (`menuFor` is a `let` declared further down; every call path runs after module init — the boot
148
+ // applyMode() is the last statement in this file — so it is never read in its TDZ.)
149
+ const closeProjMenu = () => {
150
+ const owner = menuFor;
151
+ const hadFocus = $projMenu.contains(document.activeElement);
152
+ $projMenu.hidden = true;
153
+ $projMenu.classList.remove('show');
154
+ if (hadFocus && owner) $landing.querySelector(`[data-kebab="${escapeAttr(owner)}"]`)?.focus({ focusVisible: true });
155
+ };
137
156
 
138
157
  const LS_MODE = 'floless:mode';
139
158
  // Per-app Workspaces presentation. The flag (floless.workspace, surfaced on /api/apps) says WHICH
@@ -463,6 +482,67 @@
463
482
  }
464
483
  }
465
484
 
485
+ // A workflow was renamed, duplicated, imported or deleted — here, in another tab, or by the terminal
486
+ // AI. aware.js relays the `apps-changed` SSE as a DOM event (the same seam as floless:render-progress:
487
+ // a relay, not a wider bridge, since this is the only listener). Without it the landing kept showing
488
+ // pre-rename workflow names on the project cards, and a stale `data-seed-app` on the create cards,
489
+ // until a manual reload — it caches `projects` and `wsAppEntries` and otherwise re-derives them only
490
+ // in loadProjects(), which applyMode() calls solely on ENTERING Workspaces mode with no project open
491
+ // (#389).
492
+ //
493
+ // Gated on the landing actually being on screen — the same `ws && !current` condition applyMode()
494
+ // uses. With a project open, or in Workflows mode, the landing is hidden and closing the project (or
495
+ // switching mode) re-runs applyMode() → loadProjects() anyway, so those paths self-heal without
496
+ // background churn. The guard also drops the broadcasts that never concern the landing: freeze and
497
+ // unfreeze fire `apps-changed` for a workflow open in Workflows mode, and the 3D render fires it
498
+ // mid-project when its companion app appears.
499
+ // True while the user is engaged with something an unprompted rebuild would pull out from under
500
+ // them. Two halves, because neither covers the other:
501
+ // - projActionBusy — an in-flight rename/duplicate/archive from the card kebab.
502
+ // - any open modal — the landing's OTHER prompts (createSeeded's and createFromDrawing's name
503
+ // boxes, deleteArchivedProject's confirm) never touch projActionBusy, and formModal returns
504
+ // focus on close to the element that opened it. Rebuild the landing underneath and that element
505
+ // is detached; promptName passes no fallback, so focus lands on <body>. Read off the shared
506
+ // .modal-backdrop.show class rather than a new bridge seam — workspaces.js already opens these
507
+ // through bridge.formModal, so it is the same surface, not a wider one.
508
+ const landingBusy = () => projActionBusy || !!document.querySelector('.modal-backdrop.show');
509
+
510
+ let appsChangedTimer = null;
511
+ function appsChangedRefresh() {
512
+ if (mode !== 'workspaces' || current) return; // re-check — the user can move on during the wait
513
+ // Same "suppress an autonomous repaint while the user is engaged" guard as kbAdjustActive().
514
+ //
515
+ // DEFER, don't drop. It is tempting to return here and let doProjectAction's trailing
516
+ // loadProjects() reconcile instead, but that call is after the try/catch/finally and the rename
517
+ // CANCEL path (`if (!name) return`) never reaches it — an event dropped during a prompt the user
518
+ // then dismissed would be lost for good, leaving exactly the stale landing this listener exists to
519
+ // fix. Re-arming keeps the guard self-sufficient instead of coupling it to another function's
520
+ // control flow. Every branch that raises either half lowers it again (a `finally` for the flag, a
521
+ // close for the modal), so this waits, it cannot spin — and the re-check is a boolean plus one
522
+ // querySelector, cheap enough to poll while a dialog sits open.
523
+ if (landingBusy()) { appsChangedTimer = setTimeout(appsChangedRefresh, 250); return; }
524
+ // #ws-proj-menu lives OUTSIDE $landing, so the repaint does NOT close it: it would stay pinned at
525
+ // the coordinates of the kebab that opened it while the grid reflows beneath it, reading as if it
526
+ // acts on whichever project slid into that spot. loadProjects()'s own second paint closes it for
527
+ // exactly this reason, and an unprompted refresh needs it more — nothing the user did started it.
528
+ closeProjMenu();
529
+ // `quiet`: the user did not ask for this load, so a surprise failure toast would be noise. A real
530
+ // failure still shows — renderLanding() paints the error banner from projectsLoadError.
531
+ loadProjects({ quiet: true }).catch((err) => {
532
+ // loadProjects swallows API failures itself, so reaching here means the RENDER threw. Nothing to
533
+ // restore (no control was put into a pending state), but never swallow it silently.
534
+ console.error('[workspaces] apps-changed refresh failed to render: ' + ((err && err.message) || err));
535
+ });
536
+ }
537
+ window.addEventListener('floless:apps-changed', () => {
538
+ if (mode !== 'workspaces' || current) return;
539
+ // Coalesce: one user action can broadcast more than once (an import that also installs a companion
540
+ // app), and every landing refresh is a full innerHTML rebuild. Same 250 ms as aware.js's fs-change
541
+ // debounce.
542
+ clearTimeout(appsChangedTimer);
543
+ appsChangedTimer = setTimeout(appsChangedRefresh, 250);
544
+ });
545
+
466
546
  // Translate the failures we can recognise into the user's language, the way kbPaintError does for
467
547
  // the Knowledge viewer. Returns '' for anything unrecognised — better to show only the raw detail
468
548
  // than to guess wrong about why. The raw string is shown either way, just demoted.
@@ -629,10 +709,84 @@
629
709
  `<div class="ws-archived-list">${rows}</div>` +
630
710
  `</details>`;
631
711
  }
712
+ // Carry the user's place across the rebuild below, which replaces the landing wholesale: that
713
+ // drops focus to <body>, collapses the Archived disclosure, and can leave a scrolled grid showing
714
+ // a different slice. Every caller used to be a click or keypress in this tab, so the user's
715
+ // attention was already on the control they had just pressed and the loss was invisible — the
716
+ // apps-changed refresh (#389) is the first caller that fires with NO local action.
717
+ const keepFocus = landingFocusKey(document.activeElement);
718
+ const keepScroll = $landing.scrollTop;
719
+ const keepArchivedOpen = !!$landing.querySelector('.ws-archived')?.open;
632
720
  $landing.innerHTML = html;
721
+ // Reapply in this order: the disclosure changes the scrollable height, so it must land before the
722
+ // offset; focus lands last, with preventScroll so its scroll-into-view can't undo that offset.
723
+ if (keepArchivedOpen) { const d = $landing.querySelector('.ws-archived'); if (d) d.open = true; }
724
+ $landing.scrollTop = keepScroll;
725
+ if (keepFocus) $landing.querySelector(keepFocus)?.focus({ focusVisible: true, preventScroll: true });
726
+ tipTruncatedNames();
633
727
  reflashCard(); // a repaint must not swallow an in-flight confirmation glow
634
728
  }
635
729
 
730
+ /** Make a clamped project name reachable: the two-line clamp on .ws-name (see app.css) can hide the
731
+ * tail, which for a real project name is often the discriminating part. Attach the full value as a
732
+ * data-tip ONLY where something is actually hidden — MEASURED (scrollHeight past clientHeight is
733
+ * exactly the clamp having dropped a line), not guessed from a character count, so a short name
734
+ * never gets a tooltip that merely repeats what is already on screen. data-tip, never title= — the
735
+ * native tooltip is light and breaks the dark theme (CI-enforced by verify:no-title). */
736
+ function tipTruncatedNames() {
737
+ for (const el of $landing.querySelectorAll('.ws-card .ws-name')) {
738
+ const card = el.closest('.ws-card');
739
+ if (!card) continue;
740
+ // +1 absorbs sub-pixel line-height rounding, which otherwise tips every name on some zoom levels.
741
+ // The tip goes on the CARD, not the name: the card is what takes focus, and the shared tooltip
742
+ // handler resolves its anchor with closest('[data-tip]'), which walks UP — so a tip on the inner
743
+ // span is reachable by hover but invisible to a keyboard user. The kebab and the workflow slug
744
+ // inside carry their own tips and still win, being nearer.
745
+ if (el.scrollHeight > el.clientHeight + 1) card.setAttribute('data-tip', el.textContent);
746
+ else card.removeAttribute('data-tip'); // no longer clipped — never leave a tip that repeats the visible name
747
+ }
748
+ }
749
+
750
+ // .ws-grid is responsive (auto-fill/minmax), so ANYTHING that changes the landing's width changes
751
+ // whether a name is clipped — without rebuilding a single node. A window resize is only one of those,
752
+ // and not the commonest: collapsing or dragging the Narrative panel rewrites --left-width on #app
753
+ // (app.js's toggleCollapse and the drag handle) and swings this column by ~292px while firing no
754
+ // resize event at all, and opening the Archived disclosure can bring in this container's own
755
+ // scrollbar. So observe the landing box instead of listening for window resizes: it is stable across
756
+ // renderLanding()'s innerHTML rebuilds (no re-observing needed) and its content box moves for all
757
+ // three causes. That makes "a tip exists exactly when something is hidden" hold continuously rather
758
+ // than only at the last paint — widening otherwise strands a tip that repeats a fully visible name,
759
+ // and narrowing leaves a freshly-clipped one with no way to read its tail.
760
+ let wsResizeTipTimer = null;
761
+ new ResizeObserver(() => {
762
+ clearTimeout(wsResizeTipTimer);
763
+ // Debounced, because a drag fires continuously and every pass is a forced layout read. The mode
764
+ // guard belongs INSIDE the timer, not at observation time: a resize followed within the debounce by
765
+ // opening a project would otherwise measure a hidden landing, where every height reads 0 and every
766
+ // tip would be stripped.
767
+ wsResizeTipTimer = setTimeout(() => { if (mode === 'workspaces' && !current) tipTruncatedNames(); }, 150);
768
+ }).observe($landing);
769
+
770
+ // A selector that re-finds the focused control after a rebuild. Identify by the attribute the
771
+ // element is ACTED on by, never by DOM position: a rebuild reorders the grid (a rename re-fronts its
772
+ // card), so an index would hand focus to a different project — worse than losing it. Returns null
773
+ // for anything unrecognised or outside the landing, which simply means "don't restore".
774
+ const FOCUS_KEY_ATTRS = ['data-open', 'data-kebab', 'data-restore', 'data-delete-archived'];
775
+ function landingFocusKey(el) {
776
+ if (!el || !$landing.contains(el)) return null;
777
+ if (el.id) return `#${el.id}`; // #ws-import-project / #ws-retry-projects
778
+ for (const a of FOCUS_KEY_ATTRS) {
779
+ const v = el.getAttribute(a);
780
+ if (v != null) return `[${a}="${escapeAttr(v)}"]`;
781
+ }
782
+ // A create card needs BOTH halves of its identity: one workflow can declare several create actions
783
+ // (steel declares two), so data-seed-app alone would match the wrong card.
784
+ const seed = el.getAttribute('data-seed-app');
785
+ if (seed != null) return `[data-seed-app="${escapeAttr(seed)}"][data-seed-action="${escapeAttr(el.getAttribute('data-seed-action') || '')}"]`;
786
+ if (el.classList.contains('ws-archived-summary')) return '.ws-archived-summary';
787
+ return null;
788
+ }
789
+
636
790
  $landing.addEventListener('click', async (e) => {
637
791
  const kebab = e.target.closest('[data-kebab]');
638
792
  if (kebab) { e.stopPropagation(); openProjMenu(kebab.dataset.kebab, kebab); return; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.108.1",
3
+ "version": "0.109.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": {