@floless/app 0.174.1 → 0.175.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 (85) hide show
  1. package/autostart.mjs +117 -10
  2. package/dist/floless-server.cjs +2 -2
  3. package/dist/pdf-engine/floless_pdf/__init__.py +7 -3
  4. package/dist/pdf-engine/floless_pdf/backend_pdfium.py +292 -13
  5. package/dist/pdf-engine/floless_pdf/backend_pymupdf.py +25 -3
  6. package/dist/pdf-engine/floless_pdf/images.py +4 -3
  7. package/dist/pdf-engine/floless_pdf/pages.py +136 -0
  8. package/dist/schemas/steel.model.v2.schema.json +44 -1
  9. package/dist/skills/floless-app-approval/SKILL.md +28 -3
  10. package/dist/skills/floless-app-knowledge/SKILL.md +3 -2
  11. package/dist/skills/floless-app-sketches/SKILL.md +71 -0
  12. package/dist/skills/floless-app-sketches/references/steel-plate.md +15 -0
  13. package/dist/skills/floless-app-steel-model/SKILL.md +11 -1
  14. package/dist/skills/floless-app-steel-model/references/elements.md +90 -23
  15. package/dist/skills/floless-app-steel-takeoff/SKILL.md +11 -6
  16. package/dist/web/agents.js +1 -1
  17. package/dist/web/app.css +120 -15
  18. package/dist/web/app.js +89 -38
  19. package/dist/web/aware-hold.js +10 -0
  20. package/dist/web/aware.js +405 -51
  21. package/dist/web/boot-watchdog.js +249 -0
  22. package/dist/web/card-details.js +88 -0
  23. package/dist/web/chat.css +29 -0
  24. package/dist/web/chat.js +430 -128
  25. package/dist/web/commands-connection-design.js +23 -0
  26. package/dist/web/commands-revit.js +3 -0
  27. package/dist/web/commands-shell.js +226 -10
  28. package/dist/web/commands-steel.js +93 -4
  29. package/dist/web/commands-tekla-parser.js +21 -1
  30. package/dist/web/connection-design-editor.html +71 -0
  31. package/dist/web/connection-design-editor.js +794 -61
  32. package/dist/web/connection-design-handles.js +9 -3
  33. package/dist/web/element-approval.js +74 -0
  34. package/dist/web/element-context.js +76 -6
  35. package/dist/web/element-geometry.js +8 -2
  36. package/dist/web/element-holds.js +68 -5
  37. package/dist/web/element-type-actions.js +22 -3
  38. package/dist/web/element-types.js +12 -5
  39. package/dist/web/element-words.js +15 -11
  40. package/dist/web/grid-place.js +51 -0
  41. package/dist/web/guide.js +2 -0
  42. package/dist/web/index.html +13 -16
  43. package/dist/web/instructor.js +5 -2
  44. package/dist/web/missed-routines.js +6 -1
  45. package/dist/web/model-change-findings.js +100 -30
  46. package/dist/web/model-change-review.js +411 -27
  47. package/dist/web/model-clash-check.css +100 -0
  48. package/dist/web/model-clash-check.js +681 -0
  49. package/dist/web/model-clip-box.js +204 -0
  50. package/dist/web/model-clip-list.js +153 -3
  51. package/dist/web/model-clip-session.js +3 -3
  52. package/dist/web/model-clip-three-overlay.js +135 -25
  53. package/dist/web/model-editor.css +2 -0
  54. package/dist/web/model-elements.js +273 -18
  55. package/dist/web/model-fit-checks.js +354 -0
  56. package/dist/web/model-spatial-panel.js +9 -3
  57. package/dist/web/model-spatial-tools.js +12 -3
  58. package/dist/web/model-tekla-selection.js +74 -0
  59. package/dist/web/model-view-query.js +70 -14
  60. package/dist/web/model-viewport-revit-adapter.js +8 -7
  61. package/dist/web/model-viewport-toolbar.js +8 -4
  62. package/dist/web/pages.js +78 -1
  63. package/dist/web/project-history.js +31 -1
  64. package/dist/web/revit-editor.css +34 -1
  65. package/dist/web/revit-editor.js +174 -55
  66. package/dist/web/run-history.js +8 -0
  67. package/dist/web/sketch-editor.js +141 -2
  68. package/dist/web/sketches.js +192 -6
  69. package/dist/web/start-place.js +46 -0
  70. package/dist/web/steel-3d-core.js +70 -0
  71. package/dist/web/steel-3d-view.js +288 -47
  72. package/dist/web/steel-change-review.css +28 -0
  73. package/dist/web/steel-custom-connection.js +6 -0
  74. package/dist/web/steel-editor.html +532 -33
  75. package/dist/web/steel-filter.html +8 -3
  76. package/dist/web/steel-model-checks.css +76 -0
  77. package/dist/web/steel-model-v2-commands.js +17 -0
  78. package/dist/web/steel-view-generation.js +6 -2
  79. package/dist/web/teams.js +259 -19
  80. package/dist/web/tekla-editor.html +1 -0
  81. package/dist/web/terminal-requests.js +6 -0
  82. package/dist/web/vendor/connection-engine.js +886 -91
  83. package/dist/web/workspaces.js +630 -48
  84. package/package.json +2 -1
  85. package/preferences-file.mjs +27 -0
@@ -1344,7 +1344,7 @@ function filterAiChatSnapshot(){
1344
1344
  const key = facetKey(dim, row[descriptor.rowKey]);
1345
1345
  if(key === undefined) continue;
1346
1346
  controls.push({ dimension:dim, value:cutName(key), label:cutName(String(row[descriptor.rowKey] ?? '')), checked:selected.has(key),
1347
- count:Number(row.count) || 0, notRead:dim === 'layer' && blockedLayerKeys.has(key) });
1347
+ count:Number.isFinite(row.count) ? row.count : null, notRead:dim === 'layer' && blockedLayerKeys.has(key) }); // #3820: no count is unknown, not 0
1348
1348
  }
1349
1349
  }
1350
1350
  const sheet = sheets[active];
@@ -2975,12 +2975,17 @@ function buildFacet(facet, items, label){
2975
2975
  // (a thickness is "0.4 pt", not its raw width). The "not read" tag is displayed text too, so
2976
2976
  // searching for it finds exactly the layers FloLess left out.
2977
2977
  wrap.dataset.q = (String(label(it)) + (notRead ? ' not read' : '')).toLowerCase();
2978
- const c = document.createElement('em'); c.textContent = it.count;
2978
+ // #3820: a published Filter that kept earlier sheets has no single count for a value both reads use (the count is
2979
+ // left off). An empty count reads as nothing at all, so it shows a dash and says why, as the sign-off list does.
2980
+ const known = Number.isFinite(it.count);
2981
+ const c = document.createElement('em'); c.textContent = known ? it.count : '—';
2979
2982
  // The count spans the WHOLE drawing set — schedule and detail sheets included — while the canvas
2980
2983
  // stat chip counts only what is shown on THIS sheet. Two numbers that count different things are
2981
2984
  // on screen together, so the one that is not obvious carries the explanation. data-tip, never
2982
2985
  // title=. (The sign-off step says the same thing about the same number.)
2983
- c.setAttribute('data-tip', 'Elements on this ' + FACET_NOUN[facet] + ' across the whole drawing set — every sheet, and lines, text and circles alike — not just the sheet on screen.');
2986
+ c.setAttribute('data-tip', known ? 'Elements on this ' + FACET_NOUN[facet] + ' across the whole drawing set — every sheet, and lines, text and circles alike — not just the sheet on screen.'
2987
+ : 'Element count unknown: this ' + FACET_NOUN[facet] + ' is on sheets from more than one drawing read, and no single count covers them.');
2988
+ if(!known) c.setAttribute('aria-label', 'element count unknown');
2984
2989
  wrap.appendChild(c);
2985
2990
  box.appendChild(wrap);
2986
2991
  }
@@ -0,0 +1,76 @@
1
+ /* #3690 E1d (plan §5.3, ruling F7): the steel editor's Model checks drawer. The fit of walls, slabs and footings is its
2
+ first group (web/model-fit-checks.js); the clash check (#4029) joins as a sibling <section>. The drawer itself reuses
3
+ .crv-drawer (steel-change-review.css). No colour or font of its own: only this page's tokens, so both themes follow.
4
+ A finding is amber (needs review) and stays amber when the person proceeds on an assumption; a note is muted. */
5
+ /* A stylesheet themes its own scrollbars (verify-scrollbars reads each sheet alone): the steel editor's rule, as it is. */
6
+ *{scrollbar-width:thin;scrollbar-color:var(--scroll) transparent}
7
+ *::-webkit-scrollbar{width:10px;height:10px}
8
+ *::-webkit-scrollbar-track{background:transparent}
9
+ *::-webkit-scrollbar-thumb{background:var(--scroll);border-radius:6px;border:2px solid transparent;background-clip:content-box}
10
+ *::-webkit-scrollbar-thumb:hover{background:var(--scroll-hover);background-clip:content-box}
11
+ *::-webkit-scrollbar-corner{background:transparent}
12
+ /* The menu item exists only with a project open (the routes are a project's). */
13
+ #moreMenu #modelChecksB{display:none}
14
+ body.has-project #moreMenu #modelChecksB{display:block}
15
+ #modelChecksHost{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 10px 12px}
16
+ .mfc-group{display:flex;flex-direction:column;gap:8px;padding-top:8px}
17
+ .mfc-h{margin:0;font-size:11px;font-weight:600;letter-spacing:.02em;color:var(--text)}
18
+ .mfc-summary{margin:0;color:var(--mut);font-size:11px;line-height:1.45}
19
+ .mfc-chips{display:flex;flex-wrap:wrap;gap:4px}
20
+ .mfc-chip{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 7px;border:1px solid var(--line);border-radius:999px;font-size:10px;line-height:16px;color:var(--mut);background:var(--btn)}
21
+ .mfc-chip.warn{border-color:var(--warn-edge);color:var(--warn-soft);background:var(--warn-bg)}
22
+ .mfc-unchecked{margin:0;padding:6px 8px;border:1px dashed var(--line);border-radius:6px;color:var(--mut);font-size:11px}
23
+ .mfc-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
24
+ .mfc-finding{display:flex;flex-direction:column;align-items:flex-start;gap:5px;padding:8px 9px;border:1px solid var(--line);border-left:3px solid var(--warn);border-radius:6px;background:var(--panel)}
25
+ .mfc-notes .mfc-finding{border-left-color:var(--line)}
26
+ .mfc-notes .mfc-sentence{color:var(--mut)}
27
+ .mfc-sentence{margin:0;color:var(--text);font-size:12px;line-height:1.45}
28
+ .mfc-measured{display:grid;grid-template-columns:auto 1fr;gap:1px 10px;margin:0;font-size:11px;font-variant-numeric:tabular-nums}
29
+ .mfc-measured>div{display:contents}
30
+ .mfc-measured dt{color:var(--mut);font-size:10px;line-height:16px}
31
+ .mfc-measured dd{margin:0;color:var(--text);line-height:16px}
32
+ .mfc-assumed{display:flex;flex-direction:column;align-items:flex-start;gap:3px;width:100%;padding:6px 8px;border-radius:5px;background:var(--sunken)}
33
+ .mfc-assumed p{margin:0;color:var(--text);font-size:11px}
34
+ .mfc-lapsed{list-style:none;margin:0;padding:0 0 0 7px;border-left:2px solid var(--text-dim);color:var(--mut);font-size:10px}
35
+ .mfc-actions{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:2px}
36
+ .mfc-group button{font:inherit;font-size:11px;color:var(--text);background:var(--btn);border:1px solid var(--ctrl-border);border-radius:6px;min-height:28px;padding:4px 10px;cursor:pointer}
37
+ .mfc-group button:hover{background:var(--btn-hover)}
38
+ .mfc-group button:disabled{cursor:not-allowed;opacity:.5}
39
+ .mfc-group button.primary{border-color:var(--brand);background:var(--brand-wash);font-weight:600}
40
+ .mfc-group button.mfc-link{min-height:24px;padding:2px 4px;border-color:transparent;background:transparent;color:var(--brand);text-decoration:underline;text-underline-offset:2px}
41
+ .mfc-group button:focus-visible,.mfc-group summary:focus-visible,.mfc-group [tabindex]:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
42
+ .mfc-note{color:var(--mut);font-size:10px}
43
+ .mfc-write,.mfc-confirm{display:flex;flex-direction:column;gap:4px;width:100%}
44
+ .mfc-write label,.mfc-limit label{font-size:10px;color:var(--mut)}
45
+ .mfc-group textarea,.mfc-group input[type=text]{box-sizing:border-box;font:inherit;font-size:12px;color:var(--text);background:var(--field);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 7px;outline:none}
46
+ .mfc-group textarea{width:100%;resize:vertical;min-height:54px}
47
+ .mfc-group textarea:focus-visible,.mfc-group input[type=text]:focus-visible{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand-wash)}
48
+ .mfc-group textarea::placeholder{color:var(--mut);opacity:.8}
49
+ .mfc-count{align-self:flex-end;color:var(--mut);font-size:10px;font-variant-numeric:tabular-nums}
50
+ .mfc-confirm{padding:7px 8px;border:1px solid var(--line);border-radius:6px;background:var(--sunken)}
51
+ .mfc-confirm b{font-size:12px;outline:none}
52
+ .mfc-q-label{margin:2px 0 0;color:var(--mut);font-size:10px}
53
+ .mfc-confirm blockquote{margin:0;padding:3px 8px;border-left:2px solid var(--brand);color:var(--text);font-size:11px}
54
+ .mfc-hint{margin:2px 0 0;color:var(--mut);font-size:10px}
55
+ .mfc-banner{margin:0;padding:5px 8px;border-left:3px solid var(--line);border-radius:4px;background:var(--sunken);color:var(--text);font-size:11px}
56
+ .mfc-error{margin:0;color:var(--err);font-size:11px}
57
+ .mfc-fold{border:1px solid var(--line);border-radius:6px;padding:0 8px}
58
+ .mfc-fold>summary{cursor:pointer;padding:6px 0;font-size:11px;font-weight:600;color:var(--text)}
59
+ .mfc-fold[open]>summary{border-bottom:1px solid var(--line);margin-bottom:6px}
60
+ .mfc-fold>.mfc-list,.mfc-fold>.mfc-cells,.mfc-fold>form{margin-bottom:8px}
61
+ .mfc-cells{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:3px;color:var(--mut);font-size:11px}
62
+ .mfc-cells b{color:var(--text);font-weight:600}
63
+ .mfc-limit{display:flex;flex-direction:column;gap:4px}
64
+ .mfc-limit-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
65
+ .mfc-deg{display:inline-flex;align-items:center;gap:3px;color:var(--mut)}
66
+ .mfc-deg input[type=text]{width:64px;text-align:right;font-variant-numeric:tabular-nums}
67
+ .mfc-source{margin:0;color:var(--mut);font-size:10px;line-height:1.45}
68
+ .mfc-state{margin:0;padding:10px 4px;color:var(--mut);font-size:11px;text-align:center}
69
+ .mfc-state p{margin:0 0 6px}
70
+ .mfc-live{margin:0;min-height:0;color:var(--mut);font-size:10px}
71
+ .mfc-live:empty{display:none}
72
+ /* Indeterminate bar: the brand tint sliding along a hairline. Still for anyone who asked for less motion. */
73
+ .mfc-progress{position:relative;height:2px;overflow:hidden;border-radius:2px;background:var(--line)}
74
+ .mfc-progress span{position:absolute;top:0;bottom:0;width:35%;background:var(--brand);animation:mfcSlide 1.1s ease-in-out infinite}
75
+ @keyframes mfcSlide{from{left:-35%}to{left:100%}}
76
+ @media (prefers-reduced-motion:reduce){.mfc-progress span{animation:none;left:0;width:100%;opacity:.5}}
@@ -960,6 +960,15 @@ export function createV2CommandSession(model, options = {}) {
960
960
  },
961
961
  // `decisionsFrom`: an undo/redo rewinds the editor's own edits, never server-owned authority — see
962
962
  // adoptWorkPointDecisions. A server document is installed without it, so its decisions stand.
963
+ // #3690 E1d: the fit setting the server committed (the fit list's fold limit; `null` after a reset removes it),
964
+ // adopted with the tag so the next save sends it back unchanged. It changes no member, so no projection row.
965
+ adoptFitSetting(value) {
966
+ return session.transact('adopt the committed fit setting', (draft) => {
967
+ if (value == null) delete draft.element_fit;
968
+ else draft.element_fit = clone(value);
969
+ return { changedIds: [] };
970
+ });
971
+ },
963
972
  restoreSnapshot(saved, { decisionsFrom } = {}) {
964
973
  return session.transact('restore undo snapshot', (draft) => {
965
974
  draft.members = Array.isArray(saved.members) ? clone(saved.members) : [];
@@ -1025,6 +1034,14 @@ export function createV2CommandSession(model, options = {}) {
1025
1034
  if (Object.hasOwn(saved, 'dim_style')) draft.dim_style = clone(saved.dim_style || {});
1026
1035
  if (Object.hasOwn(saved, 'member_styles')) draft.member_styles = clone(saved.member_styles || {});
1027
1036
  if (Object.hasOwn(saved, 'reference_models')) draft.reference_models = clone(saved.reference_models || []);
1037
+ // #3690 E1d: the fit setting (`element_fit`) is the person's, changed only by the fit list or a confirmed card,
1038
+ // so only a SERVER document carries it (memberEndSnapshot's `fitSetting`); an undo snapshot never does and
1039
+ // leaves it alone. `value: null` is its absence (FloLess's default), so a reset removes the key.
1040
+ if (Object.hasOwn(saved, 'fitSetting')) {
1041
+ const value = saved.fitSetting ? saved.fitSetting.value : null;
1042
+ if (value == null) delete draft.element_fit;
1043
+ else draft.element_fit = clone(value);
1044
+ }
1028
1045
  // Label pins are NOT in the snapshot: switches and captures are not undoable, and restoring an old id
1029
1046
  // list beside newer flags would rewind them. The members did change, though, so a pin naming a
1030
1047
  // member this snapshot does not have is dropped here — undoing a split/merge/delete returns that
@@ -7,6 +7,7 @@
7
7
  * steel-3d-view.js owns the camera/mesh intersection.
8
8
  */
9
9
  import { parseLen, fmtLen, parseSpacings, LEVEL_SAME_MM } from './grid-core.js';
10
+ import { clipBoxRotation } from './model-clip-box.js';
10
11
 
11
12
  /**
12
13
  * Display modes a saved view may carry. Must stay a superset of the 3D toolbar's `#m3dMode`
@@ -182,12 +183,15 @@ export function depthsEqual(a, b) {
182
183
  * A clip state reduced to what decides the cut, so "is the scene still showing this view" compares geometry, not
183
184
  * bookkeeping (labels, selection, sequence): each clip's kind, on/off, box or plane, and the work area's on/off,
184
185
  * whole-parts setting and box. Each is read the way the renderer reads it: `enabled` absent is off (applyClips
185
- * filters on it), `whole` absent is on (setClipState restores `whole !== false`).
186
+ * filters on it), `whole` absent is on (setClipState restores `whole !== false`). A box's rotation is part
187
+ * of its cut — absent and all-zero read the same — so turning a box alone makes it a different cut.
186
188
  */
187
189
  export function clipsKey(state) {
188
190
  const box = (b) => (b ? [b.min, b.max] : null), wa = state?.workArea;
191
+ const turn = (c) => (c?.kind === 'box' ? clipBoxRotation({ rotationDeg: c?.rotationDeg ?? c?.box?.rotationDeg }) : null);
189
192
  return JSON.stringify([
190
- (Array.isArray(state?.clips) ? state.clips : []).map((c) => [c?.id, c?.kind, !!c?.enabled, box(c?.box), c?.n || null, c?.point || null]),
193
+ (Array.isArray(state?.clips) ? state.clips : []).map((c) => [c?.id, c?.kind, !!c?.enabled, box(c?.box), turn(c), c?.n || null, c?.point || null]),
194
+
191
195
  wa ? [!!wa.enabled, wa.whole !== false, box(wa.box)] : null,
192
196
  ]);
193
197
  }
package/dist/web/teams.js CHANGED
@@ -21,6 +21,11 @@
21
21
  let busy = false;
22
22
  let armedDisconnect = false;
23
23
  let armedNewKey = false; // #3939: "Make a new Teams key" asked to confirm
24
+ let takeoverNoticed = false; // #3778: "This window answers Teams now" was shown once
25
+ let answerHereSaid = ''; // #3778: what the last Answer Teams here press said, kept beside the button across repaints
26
+ let armedTreat = null; // #3927: the change file whose Treat it as a Teams change asked to confirm
27
+ let eventsAnswer = ''; // #3927: what the last Teams record press said, kept across repaints until the dialog closes
28
+ const TAKEOVER_POLL_MS = 3000;
24
29
  let runningAsk = null; // the list waiting for "Save and stop it"
25
30
  let paintToken = 0;
26
31
  let fromIntegrations = false; // opened from the Integrations row: closing goes back there
@@ -219,8 +224,16 @@
219
224
  if (p && p.state === 'claimed' && p.pairingId !== notMine) { data = next; claimed = p; view = 'connect-confirm'; paint(); return; }
220
225
  } catch { /* floless.io could not be asked: Connect Teams is still offered */ }
221
226
  }
227
+ // A repaint replaces every control, and a status broadcast can repaint at any moment (one follows Answer Teams
228
+ // here). The person's place is kept: the control they were on gets focus back, else the top of the dialog.
229
+ const was = body.contains(document.activeElement) ? (document.activeElement.getAttribute('data-command-id') ?? '') : null;
222
230
  data = next;
223
231
  paint();
232
+ if (was !== null && !body.contains(document.activeElement)) {
233
+ // Matched by comparing the attribute, not by building a selector from it: a command id is never interpolated.
234
+ const again = was ? [...body.querySelectorAll('[data-command-id]')].find((el) => el.getAttribute('data-command-id') === was) ?? null : null;
235
+ if (again) again.focus(); else focusTop();
236
+ }
224
237
  } catch (error) {
225
238
  if (token !== paintToken || !shown()) return;
226
239
  data = null;
@@ -262,10 +275,11 @@
262
275
  box.append(make('h4', '', 'What Flo in Teams may read'));
263
276
  const ticked = new Set(policy?.floless || []);
264
277
  const groups = (data.readGroups || []).filter((g) => g.actions.some((a) => ticked.has(a))).map((g) => g.label);
265
- const accounts = (policy?.reads || []).map((r) => {
278
+ // One line per group of reads (#3742: a group such as Planner is several reads, said once).
279
+ const accounts = [...new Set((policy?.reads || []).map((r) => {
266
280
  const kind = (data.accountReads || []).find((a) => a.tool === r.tool)?.label || 'Account files';
267
281
  return r.account?.label ? `${kind} (${r.account.label})` : kind;
268
- });
282
+ }))];
269
283
  if (!groups.length && !accounts.length) box.append(make('p', 'teams-muted', 'Nothing yet. Flo can chat in Teams but can\'t look anything up until you choose what it may read.'));
270
284
  else {
271
285
  const list = make('ul', 'teams-list');
@@ -343,7 +357,24 @@
343
357
  nodes.push(head(data.headline, make('span', 'teams-pill warn', 'Needs a look')), disconnectBlock());
344
358
  body.replaceChildren(...nodes); return;
345
359
  }
360
+ // #3778: said once, at the top of the owner's dialog, when this window took Teams over from one that closed.
361
+ if (data.notice && !takeoverNoticed) {
362
+ const notice = make('p', 'teams-callout ok', data.notice);
363
+ notice.setAttribute('role', 'status');
364
+ notice.dataset.teamsNotice = '';
365
+ nodes.push(notice);
366
+ takeoverNoticed = true;
367
+ }
346
368
  nodes.push(head(data.headline, pairing?.state === 'active' ? pillFor(relay) : null));
369
+ // #3927: the shared Teams record's warning, in whichever window opens the dialog (any window may act on it).
370
+ if (data.eventsSaid || eventsAnswer) nodes.push(eventsBlock(data.eventsSaid));
371
+ // #3778: another window answers Teams, or this one could not finish taking it over: the way to answer it here.
372
+ if (data.platform !== 'unsupported' && (data.takeoverTrouble || data.owner === 'other-window')) {
373
+ nodes.push(answerHereBlock(data.takeoverTrouble === true));
374
+ body.replaceChildren(...nodes);
375
+ watchTakeover();
376
+ return;
377
+ }
347
378
  if (data.platform === 'unsupported' || data.owner !== 'this-window' || !data.signedIn) { body.replaceChildren(...nodes); return; }
348
379
  // No seat, or a confirmation still settling: nothing is answered, but the person can always disconnect.
349
380
  if (pairing && (!data.seat || pairing.state === 'confirming')) {
@@ -729,6 +760,140 @@
729
760
  return box;
730
761
  }
731
762
 
763
+ // #3927 (plan §3.4-§3.5, §7): the shared Teams record's warning: what happened, why, what to do. An unreadable record
764
+ // offers Start a new Teams record (primary: the file is kept, so no confirm) and Open the folder; an unreadable change
765
+ // file offers Treat it as a Teams change per file, which arms a one-step confirm first because the links it takes down
766
+ // can never be brought back. `info` has nothing to press. Every answer is said under the buttons, which stay enabled.
767
+ function eventsBlock(said) {
768
+ const box = make('section', 'teams-section teams-events');
769
+ if (said) {
770
+ box.dataset.teamsEvents = '';
771
+ const callout = make('div', 'teams-callout');
772
+ callout.setAttribute('role', 'status');
773
+ callout.tabIndex = -1;
774
+ callout.append(make('strong', '', said.title), make('span', '', said.detail));
775
+ box.append(callout);
776
+ if (said.kind === 'record') {
777
+ const actions = make('div', 'teams-actions');
778
+ const start = button('Start a new Teams record', 'shell.teams-events-start-new', { className: 'primary', onClick: () => void eventsPress(start, 'start-new') });
779
+ const open = button('Open the folder', 'shell.teams-events-open-folder', { onClick: () => void eventsPress(open, 'open-folder') });
780
+ actions.append(start, open);
781
+ box.append(actions);
782
+ }
783
+ if (said.kind === 'marker') for (const file of said.markers || []) box.append(markerRow(file));
784
+ }
785
+ const note = make('p', 'teams-muted teams-events-said', eventsAnswer);
786
+ note.setAttribute('role', 'status');
787
+ note.hidden = !eventsAnswer;
788
+ box.append(note);
789
+ return box;
790
+ }
791
+
792
+ function markerRow(file) {
793
+ const row = make('div', 'teams-events-marker');
794
+ const name = make('code', 'teams-events-file', file);
795
+ name.dataset.tip = file;
796
+ row.append(name);
797
+ const actions = make('div', 'teams-actions');
798
+ if (armedTreat !== file) {
799
+ actions.append(button('Treat it as a Teams change', 'shell.teams-events-treat', { onClick: () => {
800
+ armedTreat = file; paint(); body.querySelector('[data-command-id="shell.teams-events-treat-cancel"]')?.focus();
801
+ } }));
802
+ row.append(actions);
803
+ return row;
804
+ }
805
+ row.append(make('p', 'teams-muted', 'Links Flo shared from Teams before this change are taken down or asked about, and a link taken down can’t be brought back. A copy of the file is kept.'));
806
+ const confirm = button('Treat it as a Teams change', 'shell.teams-events-treat-confirm', { className: 'primary', onClick: () => void eventsPress(confirm, 'treat-as-change', file) });
807
+ actions.append(
808
+ button('Not now', 'shell.teams-events-treat-cancel', { onClick: () => {
809
+ armedTreat = null; paint(); body.querySelector('[data-command-id="shell.teams-events-treat"]')?.focus();
810
+ } }),
811
+ confirm);
812
+ row.append(actions);
813
+ return row;
814
+ }
815
+
816
+ async function eventsPress(press, which, file) {
817
+ if (busy) return; // a second press while one runs is simply ignored
818
+ busy = true; say('');
819
+ const label = press.textContent;
820
+ press.textContent = 'Working…'; press.setAttribute('aria-busy', 'true');
821
+ let out = null;
822
+ try { out = await call('POST', `/api/teams/events/${which}`, file ? { file } : {}); }
823
+ catch (error) { say(error.message, 'error'); }
824
+ finally { busy = false; press.textContent = label; press.removeAttribute('aria-busy'); }
825
+ if (!out) return;
826
+ armedTreat = null;
827
+ eventsAnswer = out.said || '';
828
+ if (which === 'open-folder' && !out.said) return; // the folder opened on screen: nothing to say
829
+ await refresh();
830
+ // Focus what now says the outcome: the warning when it is still there, else the answer, else the headline.
831
+ const top = body.querySelector('[data-teams-events] .teams-callout') || body.querySelector('.teams-events-said:not([hidden])');
832
+ if (top) { if (!top.hasAttribute('tabindex')) top.tabIndex = -1; top.focus(); } else focusTop();
833
+ }
834
+
835
+ // #3778: Answer Teams here. While the other window is open a press only warns (the button stays, never disabled), so it
836
+ // is secondary there: closing that window is the real way, and then this one takes over by itself. After a takeover
837
+ // step failed, Try again is the one way forward, so it is primary. The warning sits right under the button.
838
+ function answerHereBlock(trouble) {
839
+ const box = make('section', 'teams-section');
840
+ const actions = make('div', 'teams-actions');
841
+ const label = trouble ? 'Try again' : 'Answer Teams here';
842
+ const press = button(label, trouble ? 'shell.teams-takeover-retry' : 'shell.teams-answer-here', { className: trouble ? 'primary' : '', onClick: () => void answerHere(press, label, note) });
843
+ actions.append(press);
844
+ const note = make('p', 'teams-muted teams-answer-here-said', answerHereSaid);
845
+ note.setAttribute('role', 'status');
846
+ note.hidden = !answerHereSaid;
847
+ box.append(actions, note);
848
+ return box;
849
+ }
850
+
851
+ async function answerHere(press, label, note) {
852
+ if (busy) return; // a second press while one runs is simply ignored
853
+ busy = true; say('');
854
+ press.textContent = 'Taking over…'; press.setAttribute('aria-busy', 'true');
855
+ let out = null;
856
+ try { out = await call('POST', '/api/teams/answer-here'); }
857
+ catch (error) { say(error.message, 'error'); }
858
+ finally { busy = false; press.textContent = label; press.removeAttribute('aria-busy'); }
859
+ if (!out) return;
860
+ if (out.answering) {
861
+ answerHereSaid = '';
862
+ await refresh();
863
+ focusTop();
864
+ return;
865
+ }
866
+ // Still the other window's, or a step failed: said beside the button, in place, so a repeat press is heard again.
867
+ answerHereSaid = out.said; note.textContent = out.said; note.hidden = false;
868
+ if (out.status?.takeoverTrouble && !data?.takeoverTrouble) {
869
+ await refresh();
870
+ body.querySelector('[data-command-id="shell.teams-takeover-retry"]')?.focus();
871
+ }
872
+ }
873
+
874
+ /** Puts focus on what a repaint says first: the one-time notice, else the headline. */
875
+ function focusTop() {
876
+ const top = body.querySelector('[data-teams-notice]') || body.querySelector('.teams-head h3');
877
+ if (top) { if (!top.hasAttribute('tabindex')) top.tabIndex = -1; top.focus(); }
878
+ }
879
+
880
+ // While another window answers Teams (or a takeover step failed), this dialog re-reads the status so it notices the
881
+ // takeover by itself. It never repaints mid-press, and moves focus only if the person was still in the dialog.
882
+ function watchTakeover() {
883
+ stopTimer(); // a repaint in this state (other window -> trouble) starts it again: one re-read, never two
884
+ timer = setInterval(async () => {
885
+ if (busy || !shown() || view !== 'status' || document.hidden) return;
886
+ let next;
887
+ try { next = await call('GET', '/api/teams'); } catch { return; } // the server-offline overlay says that itself
888
+ // Repainted only when the state changed, so the warning beside the button and the person's place both stay.
889
+ if (busy || !shown() || view !== 'status' || (next.owner === data?.owner && next.takeoverTrouble === data?.takeoverTrouble)) return;
890
+ const inside = body.contains(document.activeElement);
891
+ if (next.owner === 'this-window') answerHereSaid = '';
892
+ await refresh();
893
+ if (inside && data?.owner === 'this-window') focusTop();
894
+ }, TAKEOVER_POLL_MS);
895
+ }
896
+
732
897
  async function makeNewKey() {
733
898
  if (busy) return;
734
899
  busy = true; say('Making a new Teams key…');
@@ -769,7 +934,9 @@
769
934
  try {
770
935
  const rows = await call('GET', `/api/chat/integrations?ownerKind=workspace&chatId=${encodeURIComponent(chatId)}`);
771
936
  const list = Array.isArray(rows.rows) ? rows.rows : [];
772
- return list.filter((r) => r.callable && r.binding?.bindingId && (data.accountReads || []).some((a) => a.integration === r.integration));
937
+ // #3742: an account is listed when any of its Teams reads can run, or to say why none can (never hidden for it).
938
+ return list.filter((r) => (data.accountGroups || []).some((g) => g.integration === r.integration)
939
+ && (Array.isArray(r.reads) ? r.reads.length > 0 : (r.callable && r.binding?.bindingId)));
773
940
  } catch { return null; }
774
941
  }
775
942
 
@@ -818,18 +985,84 @@
818
985
  acc.replaceChildren(make('legend', '', 'Your connected accounts'));
819
986
  if (rows === null) acc.append(make('p', 'teams-muted', 'FloLess could not list your connected accounts just now. Close this and try again.'));
820
987
  else if (!rows.length) acc.append(make('p', 'teams-muted', 'No Google or Microsoft account is connected. Connect one in ≡ → Integrations, then come back.'));
821
- for (const r of rows || []) {
822
- const read = (data.accountReads || []).find((a) => a.integration === r.integration);
988
+ // #3742: one block per kind of account. Every read of that kind uses the one account picked here; each group of
989
+ // reads is ticked whole. A group this account can't do yet stays tickable, says why, and is skipped on save.
990
+ const byKind = new Map();
991
+ for (const r of rows || []) { if (!byKind.has(r.integration)) byKind.set(r.integration, []); byKind.get(r.integration).push(r); }
992
+ for (const [integration, accounts] of byKind) acc.append(accountKind(integration, accounts));
993
+ update();
994
+ }
995
+ }
996
+
997
+ const ACCOUNT_KIND = { 'google-workspace': 'Google account', 'microsoft-365': 'Microsoft account', 'trimble-connect': 'Trimble account' };
998
+ const GROUP_NOTE = {
999
+ mail: 'Flo gets search results only, each with a link to open the email in Outlook.',
1000
+ 'teams-names': 'Names only. Flo never reads the messages.',
1001
+ };
1002
+ let describedSeq = 0;
1003
+ const accountName = (r) => r.binding?.presentationLabel || r.alias || r.label || 'this account';
1004
+
1005
+ /** One kind of account: which account (radios only when there is a choice), then its groups of reads. */
1006
+ function accountKind(integration, accounts) {
1007
+ const kind = ACCOUNT_KIND[integration] || 'Connected account';
1008
+ const saved = (data.policy?.reads || []).filter((x) => x.account?.integration === integration);
1009
+ const savedTools = new Set(saved.map((x) => x.tool));
1010
+ // /api/chat/integrations sends the account's identity as binding.principal.stableId.
1011
+ let picked = accounts.findIndex((r) => saved[0] && r.binding?.principal?.stableId === saved[0].account.principalStableId);
1012
+ if (picked < 0) picked = 0;
1013
+ const box = make('fieldset', 'teams-choice');
1014
+ box.dataset.integration = integration;
1015
+ box.append(make('legend', '', kind));
1016
+ if (accounts.length === 1) box.append(make('p', 'teams-muted', `${kind}: ${accountName(accounts[0])}`));
1017
+ else {
1018
+ const pick = make('div', 'teams-account-pick');
1019
+ pick.setAttribute('role', 'radiogroup');
1020
+ pick.setAttribute('aria-label', `Use this ${kind} for all the reads below`);
1021
+ pick.append(make('p', 'teams-muted', `Use this ${kind} for all the reads below:`));
1022
+ accounts.forEach((r, i) => {
823
1023
  const l = make('label', 'teams-check');
824
- const input = document.createElement('input'); input.type = 'checkbox';
825
- input.dataset.account = JSON.stringify({ integration: r.integration, alias: r.alias ?? null, tool: read.tool });
826
- input.dataset.commandId = `shell.teams-read-account#${r.integration}`;
827
- input.checked = (data.policy?.reads || []).some((x) => x.tool === read.tool && x.account?.bindingId === r.binding.bindingId);
828
- l.append(input, make('span', '', `${read.label} — ${r.binding.presentationLabel || r.alias || r.label}`));
829
- acc.append(l);
1024
+ const radio = document.createElement('input'); radio.type = 'radio'; radio.name = `teams-account-${integration}`;
1025
+ radio.value = String(i); radio.checked = i === picked;
1026
+ radio.dataset.commandId = `shell.teams-read-account-pick#${integration}`;
1027
+ radio.addEventListener('change', () => { picked = i; box.dataset.alias = JSON.stringify(accounts[i].alias ?? null); paintReasons(); });
1028
+ l.append(radio, make('span', '', accountName(r)));
1029
+ pick.append(l);
1030
+ });
1031
+ pick.append(make('p', 'teams-muted', 'Switching accounts replaces what was saved for the other one.'));
1032
+ box.append(pick);
1033
+ }
1034
+ box.dataset.alias = JSON.stringify(accounts[picked].alias ?? null);
1035
+ const reasons = [];
1036
+ for (const g of (data.accountGroups || []).filter((x) => x.integration === integration)) {
1037
+ const l = make('label', 'teams-check');
1038
+ const input = document.createElement('input'); input.type = 'checkbox';
1039
+ input.dataset.accountGroup = g.id;
1040
+ input.dataset.commandId = `shell.teams-read-account#${g.id}`; input.dataset.commandInstanceLabel = g.label;
1041
+ input.checked = g.tools.every((t) => savedTools.has(t));
1042
+ const text = make('span', '', g.label);
1043
+ if (GROUP_NOTE[g.id]) text.append(make('span', 'teams-muted', ` ${GROUP_NOTE[g.id]}`));
1044
+ const reason = make('span', 'teams-muted');
1045
+ reason.id = `teams-read-reason-${++describedSeq}`;
1046
+ reason.style.display = 'block';
1047
+ text.append(reason);
1048
+ l.append(input, text);
1049
+ box.append(l);
1050
+ reasons.push({ g, input, reason });
1051
+ }
1052
+ function paintReasons() {
1053
+ const r = accounts[picked];
1054
+ for (const { g, input, reason } of reasons) {
1055
+ // Per read, from AWARE (the Teams dialog asks per read); an older answer without them falls back to the account's own.
1056
+ const each = g.tools.map((t) => (Array.isArray(r.reads) ? r.reads.find((x) => x.tool === t) : null) || { callable: !!r.callable, reason: r.reason || null });
1057
+ const usable = each.filter((x) => x.callable).length;
1058
+ reason.textContent = usable === each.length ? ''
1059
+ : usable === 0 ? `Not available yet: ${each.find((x) => x.reason)?.reason || 'FloLess could not use this account for it just now.'} If you tick it, Flo skips it for now.`
1060
+ : 'Some reads in this group aren\'t available yet and will be skipped.';
1061
+ if (reason.textContent) input.setAttribute('aria-describedby', reason.id); else input.removeAttribute('aria-describedby');
830
1062
  }
831
- update();
832
1063
  }
1064
+ paintReasons();
1065
+ return box;
833
1066
  }
834
1067
 
835
1068
  /** The FloLess reads ticked on the form, as action ids. */
@@ -854,16 +1087,21 @@
854
1087
  const next = readsFrom(form);
855
1088
  // Each ticked account goes with the list: the server checks it and saves it on the Teams conversation together with
856
1089
  // what Teams may read, so it also works once Teams has answered (the accounts change with the fresh session).
857
- next.accounts = [...form.querySelectorAll('input[data-account]:checked')].map((input) => {
858
- const a = JSON.parse(input.dataset.account);
859
- return { tool: a.tool, integration: a.integration, alias: a.alias ?? null };
1090
+ // #3742: one entry per read of each ticked group, all of a kind of account on the one account picked for it.
1091
+ next.accounts = [...form.querySelectorAll('input[data-account-group]:checked')].flatMap((input) => {
1092
+ const box = input.closest('fieldset[data-integration]');
1093
+ const group = (data.accountGroups || []).find((g) => g.id === input.dataset.accountGroup);
1094
+ if (!box || !group) return [];
1095
+ const alias = JSON.parse(box.dataset.alias || 'null');
1096
+ return group.tools.map((tool) => ({ tool, integration: group.integration, alias }));
860
1097
  });
861
1098
  await putReads(next, false);
862
1099
  }
863
1100
  /** Saves the list; resolves to what happened ('saved', 'running', 'uncertain', 'not-paired', 'failed'). */
864
1101
  async function putReads(next, stopRunning) {
865
1102
  if (busy || !next) return 'failed';
866
- busy = true; say('Saving…');
1103
+ // #4092: each ticked account is checked before it is saved, which takes a few seconds; say so rather than look stuck.
1104
+ busy = true; say(next.accounts?.length ? 'Saving… FloLess checks each account you ticked, which can take a few seconds.' : 'Saving…');
867
1105
  let result = 'failed';
868
1106
  try {
869
1107
  const out = await call('PUT', '/api/teams/reads', { ...next, ...(stopRunning ? { stopRunning: true } : {}) });
@@ -871,7 +1109,9 @@
871
1109
  if (change.kind === 'running') { runningAsk = next; say(''); busy = false; paint(); return 'running'; }
872
1110
  runningAsk = null;
873
1111
  result = change.kind || 'failed';
874
- if (change.kind === 'saved' && next.offers) say(change.narrowed ? 'Saved. Flo in Teams starts a fresh conversation, and any card it showed for an offer you took away is withdrawn.' : 'Saved. Flo in Teams can offer the new list from the next message.');
1112
+ // #3742: some ticked reads could not be used now; the rest was saved, and the server's sentence names what was not.
1113
+ if (change.kind === 'saved' && out.said) say(out.said, 'error');
1114
+ else if (change.kind === 'saved' && next.offers) say(change.narrowed ? 'Saved. Flo in Teams starts a fresh conversation, and any card it showed for an offer you took away is withdrawn.' : 'Saved. Flo in Teams can offer the new list from the next message.');
875
1115
  else if (change.kind === 'saved') say(change.narrowed ? 'Saved. Flo in Teams starts a fresh conversation, so it no longer remembers what it read before.' : 'Saved. Flo in Teams can read the new list from the next message.');
876
1116
  else if (change.kind === 'uncertain') say('Flo could not confirm that the Teams answer stopped. Choose what to do below.', 'error');
877
1117
  else if (change.kind === 'not-paired') say('Teams is no longer connected, so there was nothing to change.', 'error');
@@ -1254,7 +1494,7 @@
1254
1494
  if (!d) return s('Couldn’t check', 'expired', 'Open it to see what is happening.');
1255
1495
  if (d.platform === 'unsupported') return s('Windows or Linux only', 'disconnected', 'Answered from a Windows or Linux PC.');
1256
1496
  if (d.keyDamaged) return s('Needs a look', 'expired', 'Open it to see what to fix.');
1257
- if (d.owner === 'other-window') return s('In another window', 'disconnected', 'Answered by another FloLess window on this PC.');
1497
+ if (d.owner === 'other-window') return s('In another window', 'disconnected', 'Answered by another FloLess window on this PC. Open it to answer Teams here.');
1258
1498
  if (d.ownerTrouble) return s('Needs a look', 'expired', 'Open it to see what to do.');
1259
1499
  if (!d.signedIn) return s('Sign in first', 'expired', 'Sign in to FloLess to use it.');
1260
1500
  const p = d.pairing;
@@ -1311,7 +1551,7 @@
1311
1551
  fromIntegrations = !!opts.fromIntegrations;
1312
1552
  opener = document.activeElement;
1313
1553
  modal.classList.add('show');
1314
- view = 'status'; data = null; armedDisconnect = false; armedNewKey = false; runningAsk = null;
1554
+ view = 'status'; data = null; armedDisconnect = false; armedNewKey = false; runningAsk = null; armedTreat = null; eventsAnswer = '';
1315
1555
  signIns = null; signInWait = null; signInStale = null; providerPicked = 'claude';
1316
1556
  say('');
1317
1557
  body.setAttribute('aria-busy', 'true');
@@ -14,6 +14,7 @@
14
14
  <strong id="modelName">Loading model…</strong>
15
15
  <span id="sourceName" class="source-name"></span>
16
16
  </div>
17
+ <span id="modelPropertiesOnly" class="read-only-chip" hidden data-tip="The objects were read with the properties that could be read, but their shapes can’t be drawn yet.">Properties only</span>
17
18
  <div id="authorityChoices" class="authority-choices" role="group" aria-label="Model authority"></div>
18
19
  <div id="modelUnits" class="model-display-units"></div>
19
20
  <span class="read-only-chip" data-tip="FloLess displays a copied snapshot and cannot write to the source Tekla model.">Read-only</span>
@@ -328,6 +328,9 @@
328
328
  ? [`${Who(p)} asked for this again`, 'FloLess restarted after it first asked, so the newer request is shown instead. Nothing ran.']
329
329
  : p.state === 'expired' || (p.state === 'proposed' && Date.parse(p.expiresAt) <= Date.now())
330
330
  ? ['This request expired', `It waited too long, so FloLess dropped it. Nothing ran. ${fromAddOn(p) ? 'Start the tool again' : 'Ask your terminal again'} if you still want it.`]
331
+ : p.state === 'superseded' && p.result?.code === 'changed-recompose' && typeof p.result.message === 'string'
332
+ // #3647: ended with no replacement, because what it was composed from changed: never "replaced".
333
+ ? ['This request ended because something changed', String(p.result.message)]
331
334
  : p.state === 'superseded' ? [fromAddOn(p) ? 'The add-on’s request was replaced' : 'Your terminal’s request was replaced', `${p.changedNote || 'Something changed after it was asked.'} This one can’t be run. Nothing ran.`]
332
335
  : p.state === 'declined' ? [`Not run: ${summary}`, `You chose Not now. Nothing happened. ${fromAddOn(p) ? 'The tool is told; start it again' : 'Ask your terminal again'} if you change your mind.`]
333
336
  : p.state === 'cancelled' ? [`Stopped: ${summary}`, 'Work already sent to the host may remain.']
@@ -392,6 +395,9 @@
392
395
  sum.className = 'ai-chat-action-summary';
393
396
  sum.textContent = summary;
394
397
  node.append(sum);
398
+ // Sketches S1c (#3648): every claim the card makes, uncut, exactly as on a chat card.
399
+ const details = window.flolessCardDetails?.render(p.details, p.id, { live: p.state === 'proposed' }) ?? null;
400
+ if (details) node.append(details);
395
401
  // #2521 row 3a: what confirming agrees to (a Quick model read), whole and on its own line, as on a chat card: a
396
402
  // terminal's request is consented to here, so its terms are shown here.
397
403
  if (p.terms) {