@floless/app 0.152.1 → 0.154.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 (32) hide show
  1. package/dist/floless-server.cjs +5913 -3408
  2. package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -1
  3. package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +4 -2
  4. package/dist/schemas/revit.model.v1.schema.json +5 -0
  5. package/dist/schemas/steel.model.v2.schema.json +1 -1
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -2
  7. package/dist/skills/floless-app-onboarding/SKILL.md +8 -5
  8. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -3
  9. package/dist/skills/floless-app-queue/SKILL.md +23 -4
  10. package/dist/skills/floless-app-steel-takeoff/SKILL.md +18 -2
  11. package/dist/web/agents.js +8 -1
  12. package/dist/web/app.css +107 -5
  13. package/dist/web/app.js +106 -12
  14. package/dist/web/aware.js +424 -57
  15. package/dist/web/chat.css +60 -13
  16. package/dist/web/chat.js +814 -148
  17. package/dist/web/commands-shell.js +200 -21
  18. package/dist/web/commands-steel.js +78 -3
  19. package/dist/web/guide.js +213 -13
  20. package/dist/web/index.html +16 -9
  21. package/dist/web/instructor.js +2 -1
  22. package/dist/web/leave-guard.js +51 -7
  23. package/dist/web/left-pane.js +251 -46
  24. package/dist/web/model-editor-steel-adapter.js +3 -0
  25. package/dist/web/model-viewport.js +14 -6
  26. package/dist/web/revit-editor.js +1 -0
  27. package/dist/web/steel-3d-view.js +15 -7
  28. package/dist/web/steel-editor.html +367 -54
  29. package/dist/web/tekla-structural-grid-adapter.js +7 -1
  30. package/dist/web/tool-updates.js +141 -33
  31. package/dist/web/workspaces.js +125 -21
  32. package/package.json +1 -1
package/dist/web/app.js CHANGED
@@ -812,6 +812,8 @@ function applyCollapse(focusSide = null) {
812
812
  document.querySelector(`${host} .panel-toggle[data-side="${focusSide}"]`)?.focus();
813
813
  });
814
814
  }
815
+ // Folding or opening Inspect changes the room AI Chat and Model have to sit side by side.
816
+ announcePanelRoom();
815
817
  // redraw DAG wires after layout changes
816
818
  if (isDag()) {
817
819
  const svg = document.getElementById('wires-svg');
@@ -821,6 +823,13 @@ function applyCollapse(focusSide = null) {
821
823
  }
822
824
  }
823
825
 
826
+ // The window is not the only thing that decides whether the left pane has room for two columns:
827
+ // Inspect folding, opening or changing width does too. setupResize re-fits the left width on this,
828
+ // and web/left-pane.js re-checks the layout.
829
+ function announcePanelRoom() {
830
+ window.dispatchEvent(new window.CustomEvent('floless:panel-room'));
831
+ }
832
+
824
833
  function toggleCollapse(side) {
825
834
  state.collapse[side] = !state.collapse[side];
826
835
  applyCollapse(side);
@@ -841,12 +850,19 @@ function loadWidths() {
841
850
  } catch {}
842
851
  }
843
852
 
844
- function saveWidths() {
845
- const w = {};
846
- const l = $app.style.getPropertyValue('--left-width');
847
- const r = $app.style.getPropertyValue('--right-width');
848
- if (l) w.left = parseInt(l, 10);
849
- if (r) w.right = parseInt(r, 10);
853
+ function saveWidths(side) {
854
+ // ONE side at a time: the side a person just resized. Writing every width on every save let a
855
+ // side-by-side width the window was only holding down overwrite the person's own when they resized
856
+ // Inspect. Stacked and side-by-side left panels keep separate widths (web/left-pane.js), and every
857
+ // other key in the record is carried over untouched. No side (the old call shape) saves both.
858
+ let w = {};
859
+ try {
860
+ const stored = JSON.parse(localStorage.getItem(WIDTHS_KEY) || '{}');
861
+ if (stored && typeof stored === 'object' && !Array.isArray(stored)) w = stored;
862
+ } catch { /* unreadable storage starts from an empty record */ }
863
+ const write = (key, value) => { if (value) w[key] = parseInt(value, 10); else delete w[key]; };
864
+ if (side !== 'right') write($app.classList?.contains('left-columns') ? 'leftColumns' : 'left', $app.style.getPropertyValue('--left-width'));
865
+ if (side !== 'left') write('right', $app.style.getPropertyValue('--right-width'));
850
866
  try {
851
867
  localStorage.setItem(WIDTHS_KEY, JSON.stringify(w));
852
868
  } catch (error) {
@@ -859,8 +875,24 @@ function setupResize() {
859
875
  const handles = [...document.querySelectorAll('.resize-handle')];
860
876
  let active = null;
861
877
 
878
+ // AI Chat and Model side by side (web/left-pane.js) are two columns of at least 260px plus their
879
+ // 11px divider, so that layout has its own width range. The canvas keeps at least 360px: the pane
880
+ // never grows over the model it sits beside.
881
+ const LEFT_COLUMN_MIN = 260, MIN_CANVAS = 360, MAX_LEFT_COLUMNS = 1200;
882
+ const MIN_LEFT_COLUMNS = LEFT_COLUMN_MIN * 2 + 11;
883
+ // The side-by-side width a person chose in THIS session (resized or reset). It wins over storage, so a
884
+ // profile that refuses the save cannot bring an older width back on the next fit; storage only carries
885
+ // the choice to the next session.
886
+ let sessionColumnsWidth = null;
887
+ const rememberColumnsWidth = (side) => { if (side === 'left' && leftColumns()) sessionColumnsWidth = readWidth('left'); };
888
+ const leftColumns = () => $app.classList.contains('left-columns');
889
+ const roomForLeft = (inspectFolded = state.collapse.right) => (window.innerWidth || 0) - (inspectFolded ? 36 : readWidth('right')) - MIN_CANVAS;
890
+ const maxLeftColumns = () => Math.max(MIN_LEFT_COLUMNS, Math.min(MAX_LEFT_COLUMNS, roomForLeft()));
891
+
862
892
  const config = side => side === 'left'
863
- ? { panel: document.querySelector('.chat'), cssVar: '--left-width', min: MIN_LEFT, max: MAX_LEFT, defaultWidth: 340 }
893
+ ? (leftColumns()
894
+ ? { panel: document.querySelector('.chat'), cssVar: '--left-width', min: MIN_LEFT_COLUMNS, max: maxLeftColumns(), defaultWidth: 680 }
895
+ : { panel: document.querySelector('.chat'), cssVar: '--left-width', min: MIN_LEFT, max: MAX_LEFT, defaultWidth: 340 })
864
896
  : { panel: document.querySelector('.inspect'), cssVar: '--right-width', min: MIN_RIGHT, max: MAX_RIGHT, defaultWidth: 420 };
865
897
 
866
898
  function readWidth(side) {
@@ -939,7 +971,9 @@ function setupResize() {
939
971
  syncValue(session.handle, session.startW);
940
972
  redrawDagWires();
941
973
  }
942
- if (commit) saveWidths();
974
+ // Saved only when the gesture ended somewhere other than where it began.
975
+ if (commit && readWidth(session.side) !== session.startW) { rememberColumnsWidth(session.side); saveWidths(session.side); }
976
+ if (session.side === 'right') window.dispatchEvent(new window.CustomEvent('floless:panel-room'));
943
977
  }
944
978
 
945
979
  function ownsPointer(event) {
@@ -991,9 +1025,13 @@ function setupResize() {
991
1025
 
992
1026
  function resetWidth(side, handle) {
993
1027
  if (active) endDrag({ restore: true });
1028
+ // A reset forgets the saved width, in either layout. Side by side then shows its 680px default,
1029
+ // fitted to the window and not saved, so a narrow window cannot turn its clamp into the saved width.
994
1030
  $app.style.removeProperty(config(side).cssVar);
1031
+ saveWidths(side);
1032
+ if (side === 'left' && leftColumns()) { sessionColumnsWidth = config(side).defaultWidth; fitLeftColumns(); }
995
1033
  syncValue(handle);
996
- saveWidths();
1034
+ if (side === 'right') window.dispatchEvent(new window.CustomEvent('floless:panel-room'));
997
1035
  redrawDagWires();
998
1036
  }
999
1037
 
@@ -1052,14 +1090,59 @@ function setupResize() {
1052
1090
  const physicalDirection = e.key === 'ArrowRight' ? 1 : -1;
1053
1091
  const step = e.shiftKey ? 40 : 12;
1054
1092
  const widthDirection = side === 'left' ? physicalDirection : -physicalDirection;
1055
- applyWidth(side, readWidth(side) + widthDirection * step);
1056
- saveWidths();
1093
+ const before = readWidth(side);
1094
+ // A press a limit absorbs moved nothing, so it saves nothing.
1095
+ if (applyWidth(side, before + widthDirection * step) !== before) { rememberColumnsWidth(side); saveWidths(side); }
1096
+ if (side === 'right') window.dispatchEvent(new window.CustomEvent('floless:panel-room'));
1057
1097
  });
1058
1098
 
1059
1099
  handle.addEventListener('dblclick', () => {
1060
1100
  resetWidth(side, handle);
1061
1101
  });
1062
1102
  });
1103
+
1104
+ function storedWidths() {
1105
+ try {
1106
+ const stored = JSON.parse(window.localStorage.getItem(WIDTHS_KEY) || '{}');
1107
+ return stored && typeof stored === 'object' && !Array.isArray(stored) ? stored : {};
1108
+ } catch { return {}; }
1109
+ }
1110
+ // The saved side-by-side width, held inside what this window can give it now. Nothing is saved:
1111
+ // a wider window later gets the person's own width back.
1112
+ function savedColumnsWidth() {
1113
+ if (sessionColumnsWidth !== null) return sessionColumnsWidth;
1114
+ const saved = Number(storedWidths().leftColumns);
1115
+ return Number.isFinite(saved) ? saved : config('left').defaultWidth;
1116
+ }
1117
+ function fitLeftColumns(wanted = savedColumnsWidth()) {
1118
+ applyWidth('left', wanted);
1119
+ }
1120
+ window.addEventListener('resize', () => { if (leftColumns() && !active) fitLeftColumns(); });
1121
+ window.addEventListener('floless:panel-room', () => { if (leftColumns() && active?.side !== 'left') fitLeftColumns(); });
1122
+ // Inspect's width animates (--right-width is a registered, transitioned property), so a room check made
1123
+ // as it starts to open reads a width it has not reached yet. Its end is announced too.
1124
+ $app.addEventListener('transitionend', (event) => {
1125
+ if (event.target === $app && event.propertyName === '--right-width') window.dispatchEvent(new window.CustomEvent('floless:panel-room'));
1126
+ });
1127
+
1128
+ // web/left-pane.js decides the layout; this side owns the width that goes with it.
1129
+ window.flolessPanelLayout = Object.freeze({
1130
+ // { inspectFolded: true } asks whether folding Inspect would make the room.
1131
+ canFitLeftColumns: (options = {}) => roomForLeft(options.inspectFolded ?? state.collapse.right) >= MIN_LEFT_COLUMNS,
1132
+ setLeftColumns(on) {
1133
+ on = !!on;
1134
+ if (on === leftColumns()) return;
1135
+ if (active?.side === 'left') endDrag({ restore: true });
1136
+ $app.classList.toggle('left-columns', on);
1137
+ if (on) { fitLeftColumns(); return; }
1138
+ const saved = Number(storedWidths().left);
1139
+ if (Number.isFinite(saved)) { applyWidth('left', saved); return; }
1140
+ $app.style.removeProperty('--left-width');
1141
+ const handle = handles.find(item => item.dataset.resize === 'left');
1142
+ if (handle) syncValue(handle);
1143
+ redrawDagWires();
1144
+ },
1145
+ });
1063
1146
  }
1064
1147
 
1065
1148
  /* ============= RUN ============= */
@@ -1646,8 +1729,19 @@ function showToast(msg, type, options) {
1646
1729
  x.onclick = dismiss;
1647
1730
  t.appendChild(x);
1648
1731
  }
1732
+ // A confirmation that can be taken back (Dismissed - Undo): the button runs the caller's undo, once, and closes the toast.
1733
+ const action = options?.action;
1734
+ if (action && typeof action.onClick === 'function') {
1735
+ const undo = document.createElement('button');
1736
+ undo.className = 'toast-action';
1737
+ undo.type = 'button';
1738
+ undo.textContent = String(action.label || 'Undo');
1739
+ if (action.commandId) undo.setAttribute('data-command-id', String(action.commandId));
1740
+ undo.onclick = () => { dismiss(); action.onClick(); };
1741
+ t.appendChild(undo);
1742
+ }
1649
1743
  c.appendChild(t);
1650
- if (ms > 0) setTimeout(dismiss, ms);
1744
+ if (ms > 0) setTimeout(dismiss, action ? Math.max(ms, 8000) : ms);
1651
1745
  return dismiss;
1652
1746
  }
1653
1747