@floless/app 0.137.4 → 0.138.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.
Files changed (47) hide show
  1. package/dist/floless-server.cjs +47618 -26808
  2. package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -0
  3. package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +32 -0
  4. package/dist/schemas/steel.model.v2.schema.json +218 -27
  5. package/dist/skills/floless-app-knowledge/SKILL.md +5 -2
  6. package/dist/skills/floless-app-rfi/SKILL.md +410 -0
  7. package/dist/skills/floless-app-routines/SKILL.md +7 -2
  8. package/dist/skills/floless-app-routines/references/routines-api.md +14 -5
  9. package/dist/skills/floless-app-steel-model/SKILL.md +34 -32
  10. package/dist/skills/floless-app-steel-takeoff/SKILL.md +498 -34
  11. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +6 -6
  12. package/dist/skills/floless-app-tweak-contract/SKILL.md +6 -2
  13. package/dist/templates/floless-workspace-knowledge.flo +20 -4
  14. package/dist/templates/steel-model.flo +27 -15
  15. package/dist/web/app.css +559 -131
  16. package/dist/web/app.js +216 -54
  17. package/dist/web/aware.js +982 -128
  18. package/dist/web/checkpoint-standard.js +218 -0
  19. package/dist/web/commands-filter.js +23 -0
  20. package/dist/web/commands-shell.js +237 -5
  21. package/dist/web/commands-steel.js +172 -47
  22. package/dist/web/connection-review-client.js +2 -2
  23. package/dist/web/display-units.js +243 -0
  24. package/dist/web/grid-core.js +470 -56
  25. package/dist/web/grid-display.js +344 -0
  26. package/dist/web/index.html +106 -66
  27. package/dist/web/instructor-reporter.js +5 -0
  28. package/dist/web/instructor.js +175 -33
  29. package/dist/web/json-schema-subset.js +145 -25
  30. package/dist/web/steel-3d-core.js +124 -140
  31. package/dist/web/steel-3d-view.js +352 -100
  32. package/dist/web/steel-catalog-picker.js +98 -15
  33. package/dist/web/steel-detail-refs.js +1 -1
  34. package/dist/web/steel-editor.html +6458 -915
  35. package/dist/web/steel-filter.html +404 -57
  36. package/dist/web/steel-model-adapter.js +1 -1
  37. package/dist/web/steel-model-commands.js +71 -64
  38. package/dist/web/steel-model-v2-client-validation.js +10 -3
  39. package/dist/web/steel-model-v2-commands.js +268 -76
  40. package/dist/web/steel-model-v2-projection.js +18 -17
  41. package/dist/web/steel-plan-transform.js +13 -13
  42. package/dist/web/steel-plan-view-id.js +1 -7
  43. package/dist/web/steel-read-confidence.js +454 -5
  44. package/dist/web/steel-units.js +17 -3
  45. package/dist/web/steel-view-generation.js +21 -7
  46. package/dist/web/workspaces.js +2178 -497
  47. package/package.json +4 -1
package/dist/web/app.js CHANGED
@@ -899,19 +899,19 @@ function applyCollapse(focusSide = null) {
899
899
  const collapsed = state.collapse[side];
900
900
  const panelName = side === 'left' ? 'Narrative' : 'Inspect';
901
901
  const label = collapsed ? `Expand ${panelName} panel` : `Collapse ${panelName} panel`;
902
- btn.textContent = side === 'left'
903
- ? (collapsed ? '›' : '‹')
904
- : (collapsed ? '‹' : '›');
902
+ // The chevron is an SVG that CSS rotates (see .panel-toggle svg), not a text glyph swapped here.
903
+ // Writing textContent would delete that SVG on the first toggle — and the glyph it replaced it
904
+ // with rendered at a different weight from the identical control in the steel editor, which is
905
+ // what "the arrow is bigger in the Model tab" was.
905
906
  btn.setAttribute('aria-label', label);
906
907
  btn.setAttribute('aria-expanded', String(!collapsed));
907
908
  btn.dataset.tip = label;
908
909
  });
909
910
  if (focusSide) {
910
- requestAnimationFrame(() => {
911
- const collapsed = state.collapse[focusSide];
912
- const host = collapsed ? '.collapsed-stub' : '.panel-label';
913
- document.querySelector(`${host} .panel-toggle[data-side="${focusSide}"]`)?.focus();
914
- });
911
+ // ONE grip per side now, living in the pane rail rather than a copy in the panel label and
912
+ // another in the collapsed stub — so there is no longer a host to pick between, and the element
913
+ // that was activated is the element that stays focused.
914
+ document.querySelector(`.panel-toggle[data-side="${focusSide}"]`)?.focus();
915
915
  }
916
916
  // redraw DAG wires after layout changes
917
917
  if (isDag()) {
@@ -948,60 +948,217 @@ function saveWidths() {
948
948
  const r = $app.style.getPropertyValue('--right-width');
949
949
  if (l) w.left = parseInt(l, 10);
950
950
  if (r) w.right = parseInt(r, 10);
951
- localStorage.setItem(WIDTHS_KEY, JSON.stringify(w));
951
+ try {
952
+ localStorage.setItem(WIDTHS_KEY, JSON.stringify(w));
953
+ } catch (error) {
954
+ // Resizing is still useful when storage is unavailable (private mode or a locked-down host).
955
+ console.warn('[resize] Could not save panel widths.', error);
956
+ }
952
957
  }
953
958
 
954
959
  function setupResize() {
955
- document.querySelectorAll('.resize-handle').forEach(handle => {
956
- const side = handle.dataset.resize; // 'left' or 'right'
960
+ const handles = [...document.querySelectorAll('.resize-handle')];
961
+ let active = null;
962
+
963
+ const config = side => side === 'left'
964
+ ? { panel: document.querySelector('.chat'), cssVar: '--left-width', min: MIN_LEFT, max: MAX_LEFT, defaultWidth: 340 }
965
+ : { panel: document.querySelector('.inspect'), cssVar: '--right-width', min: MIN_RIGHT, max: MAX_RIGHT, defaultWidth: 420 };
966
+
967
+ function readWidth(side) {
968
+ const cfg = config(side);
969
+ const inlineWidth = parseFloat($app.style.getPropertyValue(cfg.cssVar));
970
+ if (Number.isFinite(inlineWidth)) return inlineWidth;
971
+ // The collapsed shell forces the grid track to 48px with !important. That stub is not a user
972
+ // width and must never become the separator's announced or restored expanded width.
973
+ if (state.collapse[side]) return cfg.defaultWidth;
974
+ const cssWidth = parseFloat(getComputedStyle($app).getPropertyValue(cfg.cssVar));
975
+ return Number.isFinite(cssWidth) ? cssWidth : cfg.panel.getBoundingClientRect().width;
976
+ }
977
+
978
+ function syncValue(handle, width = readWidth(handle.dataset.resize)) {
979
+ const cfg = config(handle.dataset.resize);
980
+ const rounded = Math.round(width);
981
+ handle.setAttribute('aria-valuemin', String(cfg.min));
982
+ handle.setAttribute('aria-valuemax', String(cfg.max));
983
+ handle.setAttribute('aria-valuenow', String(rounded));
984
+ handle.setAttribute('aria-valuetext', `${rounded} pixels`);
985
+ }
986
+
987
+ function redrawDagWires() {
988
+ if (!isDag()) return;
989
+ const svg = document.getElementById('wires-svg');
990
+ if (svg) drawDagWires(svg, PROMPTS[state.promptKey].connections);
991
+ }
992
+
993
+ function applyWidth(side, width) {
994
+ const cfg = config(side);
995
+ const clamped = Math.max(cfg.min, Math.min(cfg.max, width));
996
+ $app.style.setProperty(cfg.cssVar, clamped + 'px');
997
+ const handle = handles.find(item => item.dataset.resize === side);
998
+ if (handle) syncValue(handle, clamped);
999
+ redrawDagWires();
1000
+ return clamped;
1001
+ }
1002
+
1003
+ function removeSessionListeners(session) {
1004
+ window.removeEventListener('pointermove', onMove);
1005
+ window.removeEventListener('pointerup', onUp);
1006
+ window.removeEventListener('pointercancel', onCancel);
1007
+ window.removeEventListener('blur', onBlur);
1008
+ window.removeEventListener('keydown', onDragKeydown, true);
1009
+ document.removeEventListener('visibilitychange', onVisibilityChange);
1010
+ session.handle.removeEventListener('lostpointercapture', onLostPointerCapture);
1011
+ }
1012
+
1013
+ // Teardown is deliberately shared and idempotent: the old document-level mouse implementation
1014
+ // could miss mouseup over a workspace iframe, leaving both its classes and stale closures alive.
1015
+ // Pointer capture is the primary guarantee now; iframe hit-test suppression in app.css is the
1016
+ // fallback. A new press also cancels any standing session, so one missed terminal event can never
1017
+ // stack a second set of listeners on top of it. A no-buttons move proves the mouse was released and
1018
+ // commits its last sampled position; blur/hidden/capture-loss do not prove completion, so they roll
1019
+ // the abandoned gesture back instead. (Refs #1006.)
1020
+ function endDrag({ commit = false, restore = false } = {}) {
1021
+ const session = active;
1022
+ if (!session) return;
1023
+ active = null;
1024
+ removeSessionListeners(session);
1025
+ session.handle.classList.remove('dragging');
1026
+ $app.classList.remove('resizing');
1027
+ document.body.classList.remove('resizing');
1028
+ try {
1029
+ if (!session.handle.hasPointerCapture || session.handle.hasPointerCapture(session.pointerId)) {
1030
+ session.handle.releasePointerCapture(session.pointerId);
1031
+ }
1032
+ } catch (error) {
1033
+ // Capture may already have been revoked by the browser; teardown above is still complete.
1034
+ console.warn('[resize] Pointer capture was already released.', error);
1035
+ }
1036
+ if (restore) {
1037
+ const cfg = config(session.side);
1038
+ if (session.startInline) $app.style.setProperty(cfg.cssVar, session.startInline);
1039
+ else $app.style.removeProperty(cfg.cssVar);
1040
+ syncValue(session.handle, session.startW);
1041
+ redrawDagWires();
1042
+ }
1043
+ if (commit) saveWidths();
1044
+ }
1045
+
1046
+ function ownsPointer(event) {
1047
+ return active && event.pointerId === active.pointerId;
1048
+ }
1049
+
1050
+ function onMove(event) {
1051
+ if (!ownsPointer(event)) return;
1052
+ // Mouse buttons are authoritative. If the terminal pointerup was lost despite capture (browser
1053
+ // deactivation is the usual cause), the first no-button move commits the last deliberate sample
1054
+ // and cleans the session instead of letting an orphan closure move the panel later.
1055
+ if (event.pointerType === 'mouse' && event.buttons === 0) {
1056
+ endDrag({ commit: true });
1057
+ return;
1058
+ }
1059
+ const dx = event.clientX - active.startX;
1060
+ applyWidth(active.side, active.side === 'left' ? active.startW + dx : active.startW - dx);
1061
+ }
957
1062
 
958
- handle.addEventListener('mousedown', (e) => {
1063
+ function onUp(event) {
1064
+ if (!ownsPointer(event)) return;
1065
+ endDrag({ commit: true });
1066
+ }
1067
+
1068
+ function onCancel(event) {
1069
+ if (!ownsPointer(event)) return;
1070
+ endDrag({ restore: true });
1071
+ }
1072
+
1073
+ function onLostPointerCapture(event) {
1074
+ if (!ownsPointer(event)) return;
1075
+ endDrag({ restore: true });
1076
+ }
1077
+
1078
+ function onBlur() {
1079
+ endDrag({ restore: true });
1080
+ }
1081
+
1082
+ function onVisibilityChange() {
1083
+ if (document.hidden) endDrag({ restore: true });
1084
+ }
1085
+
1086
+ function onDragKeydown(event) {
1087
+ if (event.key !== 'Escape' || !active) return;
1088
+ event.preventDefault();
1089
+ event.stopPropagation();
1090
+ endDrag({ restore: true });
1091
+ }
1092
+
1093
+ function resetWidth(side, handle) {
1094
+ if (active) endDrag({ restore: true });
1095
+ $app.style.removeProperty(config(side).cssVar);
1096
+ syncValue(handle);
1097
+ saveWidths();
1098
+ redrawDagWires();
1099
+ }
1100
+
1101
+ handles.forEach(handle => {
1102
+ const side = handle.dataset.resize; // 'left' (Narrative) or 'right' (Inspect)
1103
+ syncValue(handle);
1104
+
1105
+ handle.addEventListener('pointerdown', (e) => {
1106
+ if (e.button !== 0 || e.isPrimary === false) return;
1107
+ if (active) endDrag({ restore: true });
959
1108
  e.preventDefault();
960
- const startX = e.clientX;
961
- const panel = side === 'left'
962
- ? document.querySelector('.chat')
963
- : document.querySelector('.inspect');
964
- const startW = panel.getBoundingClientRect().width;
1109
+ handle.focus({ preventScroll: true });
1110
+ const cfg = config(side);
1111
+ if (!cfg.panel) return;
1112
+ active = {
1113
+ handle,
1114
+ side,
1115
+ pointerId: e.pointerId,
1116
+ startX: e.clientX,
1117
+ startW: readWidth(side),
1118
+ startInline: $app.style.getPropertyValue(cfg.cssVar),
1119
+ };
965
1120
 
966
1121
  handle.classList.add('dragging');
967
1122
  $app.classList.add('resizing');
968
1123
  document.body.classList.add('resizing');
969
-
970
- function onMove(ev) {
971
- const dx = ev.clientX - startX;
972
- let newW;
973
- if (side === 'left') {
974
- newW = Math.max(MIN_LEFT, Math.min(MAX_LEFT, startW + dx));
975
- $app.style.setProperty('--left-width', newW + 'px');
976
- } else {
977
- newW = Math.max(MIN_RIGHT, Math.min(MAX_RIGHT, startW - dx));
978
- $app.style.setProperty('--right-width', newW + 'px');
979
- }
980
- if (isDag()) {
981
- const svg = document.getElementById('wires-svg');
982
- if (svg) drawDagWires(svg, PROMPTS[state.promptKey].connections);
983
- }
1124
+ window.addEventListener('pointermove', onMove);
1125
+ window.addEventListener('pointerup', onUp);
1126
+ window.addEventListener('pointercancel', onCancel);
1127
+ window.addEventListener('blur', onBlur);
1128
+ window.addEventListener('keydown', onDragKeydown, true);
1129
+ document.addEventListener('visibilitychange', onVisibilityChange);
1130
+ handle.addEventListener('lostpointercapture', onLostPointerCapture);
1131
+ try {
1132
+ handle.setPointerCapture(e.pointerId);
1133
+ } catch (error) {
1134
+ // The themed iframe hit-test fallback keeps the gesture usable, but leave a breadcrumb for
1135
+ // browser-specific capture failures instead of silently downgrading the primary guarantee.
1136
+ console.warn('[resize] Pointer capture unavailable; using the iframe fallback.', error);
984
1137
  }
985
- function onUp() {
986
- handle.classList.remove('dragging');
987
- $app.classList.remove('resizing');
988
- document.body.classList.remove('resizing');
989
- document.removeEventListener('mousemove', onMove);
990
- document.removeEventListener('mouseup', onUp);
991
- saveWidths();
1138
+ });
1139
+
1140
+ handle.addEventListener('keydown', (e) => {
1141
+ const isArrow = e.key === 'ArrowLeft' || e.key === 'ArrowRight';
1142
+ const isReset = e.key === 'Enter';
1143
+ if (!isArrow && !isReset) return;
1144
+ e.preventDefault();
1145
+ e.stopPropagation();
1146
+ // pointerdown focuses this same carrier. Do not let a second input path persist a width that
1147
+ // the active session can later overwrite or roll back.
1148
+ if (active) return;
1149
+ if (isReset) {
1150
+ resetWidth(side, handle);
1151
+ return;
992
1152
  }
993
- document.addEventListener('mousemove', onMove);
994
- document.addEventListener('mouseup', onUp);
1153
+ const physicalDirection = e.key === 'ArrowRight' ? 1 : -1;
1154
+ const step = e.shiftKey ? 40 : 12;
1155
+ const widthDirection = side === 'left' ? physicalDirection : -physicalDirection;
1156
+ applyWidth(side, readWidth(side) + widthDirection * step);
1157
+ saveWidths();
995
1158
  });
996
1159
 
997
1160
  handle.addEventListener('dblclick', () => {
998
- if (side === 'left') $app.style.removeProperty('--left-width');
999
- else $app.style.removeProperty('--right-width');
1000
- saveWidths();
1001
- if (isDag()) {
1002
- const svg = document.getElementById('wires-svg');
1003
- if (svg) drawDagWires(svg, PROMPTS[state.promptKey].connections);
1004
- }
1161
+ resetWidth(side, handle);
1005
1162
  });
1006
1163
  });
1007
1164
  }
@@ -1189,10 +1346,6 @@ function handleMenuAction(action) {
1189
1346
  case 'routines': openRoutines(); break;
1190
1347
  case 'report-issue': openReportIssue(); break;
1191
1348
  case 'fullscreen': toggleFullscreen(); break;
1192
- // The Instructor owns its own persisted state and the menu item's aria-checked,
1193
- // so this only asks it to flip — no read-modify-write here, and one place that
1194
- // knows whether the strip is on.
1195
- case 'toggle-instructor': if (window.Instructor) window.Instructor.toggleEnabled(); break;
1196
1349
  }
1197
1350
  }
1198
1351
 
@@ -1457,7 +1610,16 @@ function showToast(msg, type) {
1457
1610
  span.className = 'toast-msg';
1458
1611
  span.textContent = msg; // textContent — never innerHTML (msg can be a raw server error)
1459
1612
  t.appendChild(span);
1460
- const dismiss = () => {
1613
+ let dismissed = false;
1614
+ const dismiss = (options) => {
1615
+ if (dismissed) return;
1616
+ dismissed = true;
1617
+ // A progress announcement is replaced by its result, not merely followed by it. Callers that
1618
+ // are about to add the final toast can remove it synchronously; every existing no-argument call
1619
+ // keeps the same animated close. Accepting `true` as well as the named option keeps the closure
1620
+ // convenient for small browser callers without changing its old contract.
1621
+ const immediate = options === true || (options && options.immediate === true);
1622
+ if (immediate) { t.remove(); return; }
1461
1623
  t.style.transition = 'opacity 0.3s, transform 0.3s';
1462
1624
  t.style.opacity = '0';
1463
1625
  t.style.transform = 'translateY(8px)';
@@ -1828,7 +1990,7 @@ function themeSelect(sel) {
1828
1990
  // re-pointed at the trigger and read together WITH the trigger's text (which is the current
1829
1991
  // value) — the pairing a native select gives for free. A select carrying its own aria-label
1830
1992
  // (the hour/minute pair) hands that over instead.
1831
- const field = document.querySelector(`label[for="${CSS.escape(sel.id || '')}"]`);
1993
+ const field = document.querySelector(`label[for="${CSS.escape(sel.id || '\x00')}"]`);
1832
1994
  /* The command id MOVES to the trigger, for the same reason data-tip does below:
1833
1995
  from here on the <select> is display:none, so it can never be hovered, focused,
1834
1996
  or reached by the `?` sheet's "Enter - go to it". The trigger is a SIBLING, not