@floless/app 0.149.0 → 0.150.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 (48) hide show
  1. package/dist/floless-server.cjs +102295 -88314
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +45 -2
  3. package/dist/schemas/steel.model.v2.schema.json +9 -0
  4. package/dist/skills/floless-app-approval/SKILL.md +79 -4
  5. package/dist/skills/floless-app-onboarding/SKILL.md +4 -4
  6. package/dist/skills/floless-app-onboarding/references/aware-runtime.md +1 -1
  7. package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +15 -13
  8. package/dist/skills/floless-app-routines/SKILL.md +4 -1
  9. package/dist/skills/floless-app-routines/references/routines-api.md +14 -2
  10. package/dist/skills/floless-app-steel-model/SKILL.md +4 -2
  11. package/dist/skills/floless-app-steel-takeoff/SKILL.md +14 -9
  12. package/dist/skills/floless-app-workflows/SKILL.md +2 -2
  13. package/dist/templates/tekla-parser.flo +13 -3
  14. package/dist/web/agents.js +887 -0
  15. package/dist/web/app.css +458 -23
  16. package/dist/web/app.js +20 -5
  17. package/dist/web/aware.js +1339 -134
  18. package/dist/web/chat.css +68 -4
  19. package/dist/web/chat.js +1770 -55
  20. package/dist/web/commands-drawing-check.js +15 -0
  21. package/dist/web/commands-revit.js +5 -0
  22. package/dist/web/commands-shell.js +785 -50
  23. package/dist/web/commands-tekla-parser.js +8 -1
  24. package/dist/web/connections.js +57 -14
  25. package/dist/web/drawing-check-editor.html +10 -2
  26. package/dist/web/drawing-check-editor.js +569 -40
  27. package/dist/web/drawing-check-overlay.js +45 -2
  28. package/dist/web/index.html +102 -27
  29. package/dist/web/instructor.js +85 -8
  30. package/dist/web/leave-guard.js +1 -0
  31. package/dist/web/left-pane.js +20 -1
  32. package/dist/web/local-discovery.js +12 -2
  33. package/dist/web/model-editor.css +32 -32
  34. package/dist/web/model-panel-bridge.js +11 -3
  35. package/dist/web/model-viewport-lighting.js +4 -2
  36. package/dist/web/model-viewport-revit-adapter.js +3 -0
  37. package/dist/web/model-viewport-toolbar.js +6 -3
  38. package/dist/web/model-viewport.js +11 -1
  39. package/dist/web/revit-editor.css +14 -14
  40. package/dist/web/revit-editor.js +64 -12
  41. package/dist/web/steel-3d-core.js +133 -0
  42. package/dist/web/steel-3d-view.js +10 -0
  43. package/dist/web/steel-editor.html +171 -39
  44. package/dist/web/steel-model-v2-client-validation.js +11 -0
  45. package/dist/web/steel-model-v2-commands.js +80 -5
  46. package/dist/web/tool-updates.js +367 -0
  47. package/dist/web/workspaces.js +679 -59
  48. package/package.json +1 -1
@@ -2,10 +2,50 @@
2
2
  // server-built run report, so the two can never draw a different markup for the same result.
3
3
  /** @type {Readonly<Record<'pass' | 'fail' | 'dont-know', string>>} */
4
4
  export const DEFAULT_COLOURS = Object.freeze({ pass: 'hsl(142 71% 45%)', fail: 'hsl(0 72% 56%)', 'dont-know': 'hsl(38 92% 50%)' });
5
- const STYLE = { pass: { w: 1.2, dash: '' }, fail: { w: 2.4, dash: '' }, 'dont-know': { w: 1.6, dash: '3 2' } };
5
+ // `accepted`: a finding a person accepted as drawn — wrong or couldn't tell alike — is drawn in the FAIL colour
6
+ // with a dash-dot line (spec §5), so it never reads as an open fail or a pass, in colour or in black and white.
7
+ const STYLE = { pass: { w: 1.2, dash: '' }, fail: { w: 2.4, dash: '' }, 'dont-know': { w: 1.6, dash: '3 2' }, accepted: { w: 2.4, dash: '6 2 1 2' } };
6
8
  const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
7
9
  const num = (v) => (Number.isFinite(v) ? Math.round(v * 10) / 10 : 0);
8
10
 
11
+ const boxKey = (e) => `${e.drawing || ''}|${e.page}|${(e.bbox || []).map(num).join(',')}`;
12
+
13
+ /**
14
+ * The sheet with every evidence box of an ACCEPTED finding flagged `accepted: true`, so it is drawn in the
15
+ * accepted style (fail colour, dash-dot). A box several findings share is flagged only when every
16
+ * one of them is accepted: an accepted decision never makes an open fail look settled. The result itself
17
+ * is never changed; this is a display-time copy.
18
+ * @param {*} sheet
19
+ * @param {Iterable<string>} acceptedIds finding ids whose latest decision is "accept as drawn"
20
+ */
21
+ export function withAccepted(sheet, acceptedIds) {
22
+ const accepted = new Set(acceptedIds);
23
+ if (!accepted.size) return sheet;
24
+ // Ownership is decided across EVERY item of the sheet: two checklist items can draw the same evidence box, and
25
+ // accepting one must not make the box look settled while another item's finding there is still OPEN (a fail
26
+ // or couldn't-tell nobody accepted). A passing finding on the same box is settled already, so it does not
27
+ // block; and only the accepting item's own boxes take the accepted style (the passing item keeps its own).
28
+ const open = new Set(); // boxes an unaccepted fail / couldn't-tell finding draws
29
+ for (const it of sheet.items || []) {
30
+ for (const f of it.findings || []) {
31
+ if (f.status === 'pass' || accepted.has(f.id)) continue;
32
+ for (const e of f.evidence || []) open.add(boxKey(e));
33
+ }
34
+ }
35
+ let any = false;
36
+ const items = (sheet.items || []).map((it) => {
37
+ const mine = new Set();
38
+ for (const f of it.findings || []) {
39
+ if (!accepted.has(f.id)) continue;
40
+ for (const e of f.evidence || []) if (!open.has(boxKey(e))) mine.add(boxKey(e));
41
+ }
42
+ if (!mine.size) return it;
43
+ any = true;
44
+ return { ...it, evidence: (it.evidence || []).map((e) => (mine.has(boxKey(e)) ? { ...e, accepted: true } : e)) };
45
+ });
46
+ return any ? { ...sheet, items } : sheet;
47
+ }
48
+
9
49
  export function hatchDefs() {
10
50
  return '<defs><pattern id="dc-hatch" width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">'
11
51
  + '<line x1="0" y1="0" x2="0" y2="6" stroke="hsl(217 16% 45%)" stroke-width="0.8" opacity="0.5"/></pattern></defs>';
@@ -23,9 +63,12 @@ export function overlaySvg(sheet, colours = DEFAULT_COLOURS, opts = { selectedN:
23
63
  out += `<rect class="dc-uncovered" x="${num(u[0])}" y="${num(u[1])}" width="${num(u[2] - u[0])}" height="${num(u[3] - u[1])}" fill="url(#dc-hatch)" stroke="hsl(217 16% 45%)" stroke-width="0.6" stroke-dasharray="2 2"/>`;
24
64
  }
25
65
  for (const it of sheet.items) {
26
- const colour = colours[it.status] || DEFAULT_COLOURS[it.status]; const st = STYLE[it.status];
27
66
  const sel = opts.selectedN === it.n ? ' data-selected="true"' : '';
28
67
  for (const e of it.evidence) {
68
+ if (e.drawing && sheet.drawing && e.drawing !== sheet.drawing) continue; // the other half of a cross-sheet finding
69
+ const status = e.status || it.status;
70
+ const shown = e.accepted ? 'fail' : status;
71
+ const colour = colours[shown] || DEFAULT_COLOURS[shown]; const st = e.accepted ? STYLE.accepted : STYLE[status];
29
72
  const [x0, y0, x1, y1] = e.bbox.map(num); const pad = 2;
30
73
  out += `<rect data-n="${it.n}"${sel} x="${x0 - pad}" y="${y0 - pad}" width="${x1 - x0 + 2 * pad}" height="${y1 - y0 + 2 * pad}" rx="2" fill="none" stroke="${esc(colour)}" stroke-width="${st.w}"${st.dash ? ` stroke-dasharray="${st.dash}"` : ''} vector-effect="non-scaling-stroke"/>`;
31
74
  out += `<g class="dc-tag" data-n="${it.n}"><circle cx="${x1 + pad}" cy="${y0 - pad}" r="7" fill="white" stroke="${esc(colour)}" stroke-width="1.4"/>`
@@ -12,7 +12,12 @@
12
12
  <script>
13
13
  // Workspaces has no workflow Inspector. Apply that persisted mode before CSS paints so the old
14
14
  // workflow pane cannot flash while the workspace shell and Revit frame are still starting.
15
- try { if (localStorage.getItem('floless:mode') === 'workspaces') document.documentElement.classList.add('mode-workspaces-boot'); }
15
+ try {
16
+ const savedMode = localStorage.getItem('floless:mode');
17
+ if (savedMode === 'workspaces') document.documentElement.classList.add('mode-workspaces-boot');
18
+ // #2007: Agents has no workflow canvas or Inspector either; same reason, same early class.
19
+ if (savedMode === 'agents') document.documentElement.classList.add('mode-agents-boot');
20
+ }
16
21
  catch { /* private or locked-down storage falls back to the normal boot path */ }
17
22
  </script>
18
23
  <link rel="stylesheet" href="app.css">
@@ -54,6 +59,8 @@
54
59
  here; they are deliberately parallel in shape so they read as two answers to it. -->
55
60
  <button data-command-id="shell.mode-workspaces" type="button" data-mode="workspaces" role="tab" aria-selected="false" data-tip="One project at a time — its drawings, the model built from them, and what comes out. Open this to work on a job.">Workspaces</button>
56
61
  <button data-command-id="shell.mode-workflows" type="button" data-mode="workflows" class="active" role="tab" aria-selected="true" data-tip="A repeatable process — pick one, set its inputs, compile it, then run it against your project. Open this to build or run an automation.">Workflows</button>
62
+ <!-- #2007: delegated responsibilities run by hand (web/agents.js). The AWARE library is Tools, in the ≡ menu. -->
63
+ <button data-command-id="shell.mode-agents" type="button" data-mode="agents" role="tab" aria-selected="false" data-tip="A responsibility you hand over — what to check, and on which projects. Open this to set one up or run it by hand.">Agents</button>
57
64
  </div>
58
65
  <!-- Workspace view switch (Canvas = the workflow topology; Dashboard = the user's
59
66
  custom panels from ~/.floless/ui/extensions.json) moved into the ≡ menu in #149.
@@ -133,7 +140,7 @@
133
140
  <button data-command-id="shell.restore-workflow" id="restore-btn" type="button" hidden data-tip="Restore the official workflow — undoes any out-of-band edits and re-arms Run">↺ Restore</button>
134
141
  <button data-command-id="shell.customize-workflow" id="customize-btn" type="button" hidden data-tip="Fork this workflow to edit it yourself — takes it off the FloLess update channel">Customize…</button>
135
142
  <button id="compile-btn" data-command-id="workflow.compile" data-acts="Acts on the whole workflow" data-tip="Compile + approve → freeze the .lock">⎙ Compile</button>
136
- <button id="sim-btn" data-command-id="workflow.simulate" data-acts="Acts on the workflow only — never the live host" data-tip="Simulate: stub every node from its output schema — no live host is contacted. Validates the workflow's composition end-to-end, even when the real agents aren't connected yet.">Simulate</button>
143
+ <button id="sim-btn" data-command-id="workflow.simulate" data-acts="Acts on the workflow only — never the live host" data-tip="Simulate: stub every node from its output schema — no live host is contacted. Validates the workflow's composition end-to-end, even when the real tools aren't connected yet.">Simulate</button>
137
144
  <button id="run-btn" data-command-id="workflow.run" data-acts="Acts on the approved lock, against the live host" data-blocked-reason="Blocked until the workflow is compiled" data-tip="Run the workflow for real against the live host (uses the inputs; renders the report node in the HTML Viewer)">▶ Run workflow</button>
138
145
  <button id="stop-run-btn" class="run-stop-btn" type="button" data-command-id="workflow.stop" aria-label="Stop the current run" data-tip="Stop the in-flight run (always reachable, even with the HTML Viewer closed)" hidden>■ Stop run</button>
139
146
  </div>
@@ -186,6 +193,8 @@
186
193
  <button data-command-id="shell.chat-effort" type="button" class="ai-chat-setting" id="chat-effort" aria-haspopup="listbox" aria-expanded="false" data-tip="Choose how much reasoning the AI uses for future messages."><span>Effort</span><strong>Medium</strong></button>
187
194
  <button data-command-id="shell.chat-permission" type="button" class="ai-chat-setting" id="chat-permission" aria-haspopup="listbox" aria-expanded="false" data-tip="Access controls what the AI may change: Read only, Working folder write, or Full access."><span>Access</span><strong>Read only</strong></button>
188
195
  <button data-command-id="shell.chat-integrations" type="button" class="ai-chat-setting ai-chat-integration-setting" id="chat-integrations" aria-haspopup="listbox" aria-expanded="false"><span>Connected accounts</span><strong>Choose a connected account</strong></button>
196
+ <!-- #1907 (owner ruling 2026-10-03): the AI's own connectors are off in every new conversation; this turns them on for this one. -->
197
+ <button data-command-id="shell.chat-own-connectors" type="button" class="ai-chat-setting ai-chat-own-connectors" id="chat-own-connectors" role="switch" aria-checked="false"><span>Use my connectors in this chat</span><strong aria-hidden="true">Off</strong></button>
189
198
  <div class="ai-chat-desktop-status" id="chat-desktop-status">
190
199
  <div><span>Continue in desktop app</span><strong id="chat-desktop-value">—</strong></div>
191
200
  <small id="chat-desktop-reason" aria-live="polite">Open a conversation to check whether the desktop app can continue it.</small>
@@ -203,13 +212,31 @@
203
212
  <button data-command-id="shell.chat-stop" type="button" id="chat-recovery-stop">Stop response</button>
204
213
  <button data-command-id="shell.chat-reconcile" type="button" id="chat-reconcile">Check again</button>
205
214
  </div>
215
+ <!-- #1890 PR 3b: a conversation moving into the workflow it built — where it went, or why it is still here, with the choices. -->
216
+ <div class="ai-chat-recovery ai-chat-move-notice" id="chat-move-notice" role="status" aria-live="polite" hidden>
217
+ <span id="chat-move-copy"></span>
218
+ <button data-command-id="shell.chat-move-retry" type="button" id="chat-move-primary" class="primary" aria-describedby="chat-move-copy"></button>
219
+ <button data-command-id="shell.chat-move-keep" type="button" id="chat-move-secondary" aria-describedby="chat-move-copy" hidden></button>
220
+ <button data-command-id="shell.chat-move-dismiss" type="button" id="chat-move-dismiss" class="ai-chat-move-dismiss" aria-label="Dismiss" data-tip="Dismiss" hidden>×</button>
221
+ </div>
206
222
  <div class="ai-chat-attachments" id="chat-attachments" hidden></div>
207
223
  <div class="ai-chat-skills" id="chat-skills" role="listbox" hidden></div>
208
224
  <div class="ai-chat-approval-tray" id="chat-approval-tray"></div>
209
225
  <div class="ai-chat-composer" id="chat-composer">
226
+ <div class="ai-chat-scope-controls" id="chat-scope-controls" hidden>
227
+ <button type="button" id="chat-scope-toggle" data-command-id="shell.chat-scope-open" aria-expanded="false" aria-controls="chat-scope-picker">Scope</button>
228
+ <span id="chat-scope-disclosure" aria-live="polite"></span>
229
+ <section class="ai-chat-picker ai-chat-scope-picker" id="chat-scope-picker" role="dialog" aria-label="Conversation scope" hidden></section>
230
+ </div>
210
231
  <!-- #1890: a workspace conversation's units question, and then its "Units: … · Change" line. -->
211
232
  <div class="ai-chat-units" id="chat-units" hidden></div>
233
+ <!-- #1890 PR4: one Revoke ends all global file-change grants; legacy owner grants appear only without a global allowance (web/chat.js). -->
234
+ <div class="ai-chat-connectors" id="chat-change-allowance" role="group" aria-label="Changes allowed for this chat" hidden></div>
235
+ <!-- #1900: the connection checks this chat may run without asking, each with Revoke (web/chat.js). -->
236
+ <div class="ai-chat-connectors" id="chat-check-allowance" role="group" aria-label="Connection checks allowed for this chat" hidden></div>
212
237
  <div class="ai-chat-tekla-context" id="chat-tekla-context" hidden></div>
238
+ <!-- #1907: shown only while this chat uses the person's own connectors: "on · Turn off", then each allowed one with Revoke (web/chat.js). -->
239
+ <div class="ai-chat-connectors" id="chat-connectors" role="group" aria-label="Your connectors in this chat" hidden></div>
213
240
  <textarea data-command-id="shell.chat-input" id="chat-input" rows="1" maxlength="131072" placeholder="Message AI…" aria-label="Message AI"></textarea>
214
241
  <!-- The data-handling disclosure gets its OWN node in the composer, not a line in
215
242
  #chat-compose-hint: that hint is one mutable string chosen by a priority chain,
@@ -301,11 +328,15 @@
301
328
  </div>
302
329
  <input data-command-id="menu.import" type="file" id="import-file" accept=".flo,.app,.flow,.aware" hidden>
303
330
  <div class="find-overlay" id="find-overlay">
304
- <input data-command-id="shell.find-input" aria-label="Find agent" type="text" id="find-input" placeholder="Find agent…">
331
+ <input data-command-id="shell.find-input" aria-label="Find tool" type="text" id="find-input" placeholder="Find tool…">
305
332
  <span class="find-count" id="find-count"></span>
306
333
  <button data-command-id="shell.find-close" class="find-close" id="find-close" data-tip="Close">×</button>
307
334
  </div>
308
335
  <div class="notes-strip" id="notes-strip" hidden></div>
336
+ <!-- #1998: "Needs you" when the exact tool version this workflow was approved with cannot run (choose:
337
+ reinstall it, or Compile again), or a quiet note that its approval was carried over to a newer tool
338
+ version, with AWARE's own record in the details. Painted by paintApprovalStrip (web/aware.js). -->
339
+ <div class="approval-strip" id="approval-strip" hidden></div>
309
340
  <!-- Which of the firm's own knowledge this workflow was built from, and whether it has changed
310
341
  since. Deliberately NOT in the header beside the run-state pill: that pill's "Needs refresh"
311
342
  state is amber and means Run is blocked, and a second amber chip inches away saying the
@@ -336,6 +367,9 @@
336
367
  <div class="ws-landing" id="ws-landing" hidden></div>
337
368
  <!-- #1890: the Workflows tab's landing (web/aware.js renders it): a New workflow card and one card per workflow. -->
338
369
  <div class="ws-landing wf-landing" id="wf-landing" hidden></div>
370
+ <div class="ws-landing wf-draft" id="wf-draft" hidden></div>
371
+ <!-- #2007: the Agents tab — the list of agents and an agent's page (web/agents.js renders both). -->
372
+ <div class="ws-landing ag-surface" id="agents-surface" hidden></div>
339
373
  <div class="ws-project" id="ws-project" hidden>
340
374
  <!-- The step tabs ARE the project header. A 45px breadcrumb row used to sit above them saying
341
375
  "Workspaces › <project>" plus the app type, and every word of it was already on screen: the
@@ -427,7 +461,7 @@
427
461
  <div class="panel-label">
428
462
  <span>Inspect</span>
429
463
  <span class="label-end">
430
- <span class="role" id="inspect-role">click an agent</span>
464
+ <span class="role" id="inspect-role">click a tool</span>
431
465
  <button data-command-id="shell.debug-node" id="debug-btn" class="tweak-btn" data-tip="Re-run this exec node with the .NET debugger attached (Visual Studio)" hidden>⊟ Debug in VS</button>
432
466
  <button data-command-id="shell.tweak-node" id="tweak-btn" class="tweak-btn" data-tip="Ask the terminal AI to change just this node" hidden>✎ Tweak</button>
433
467
  </span>
@@ -529,7 +563,7 @@
529
563
  <span class="sep" aria-hidden="true">·</span>
530
564
  <span class="stat"><span class="dot"></span><span class="stat-val">runtime online</span></span>
531
565
  <span class="sep">·</span>
532
- <span class="stat"><span class="stat-key">agents</span><span class="stat-val" id="agents-count">—</span></span>
566
+ <span class="stat"><span class="stat-key">tools</span><span class="stat-val" id="agents-count">—</span></span>
533
567
  <span class="sep">·</span>
534
568
  <span id="wf-templates-stats">
535
569
  <span class="stat"><span class="stat-key">workflows</span><span class="stat-val" id="apps-count">—</span></span>
@@ -542,6 +576,8 @@
542
576
  <span class="version-info">
543
577
  <span class="aware-version" id="aware-version" data-tip="AWARE runtime version — the aware CLI/npm package this app drives"></span>
544
578
  <button data-command-id="shell.aware-update" id="aware-update" class="app-update" hidden data-tip="An AWARE runtime upgrade is available — reinstalls in place, no relaunch"></button>
579
+ <button data-command-id="shell.tool-updates" id="tool-updates" type="button" class="app-update tool-updates-pill" hidden
580
+ aria-haspopup="dialog" aria-controls="tool-updates-modal" data-tip="Review workflows whose tools have new versions"></button>
545
581
  <span class="sep ver-sep" id="ver-sep" hidden>·</span>
546
582
  <span class="app-version" id="app-version" data-tip="floless.app build serving this window (installed build, or the dev build when run from source)"></span>
547
583
  <button data-command-id="shell.app-update" id="app-update" class="app-update" hidden></button>
@@ -635,6 +671,26 @@
635
671
  </div>
636
672
  </div>
637
673
 
674
+ <!-- #1997 Approve updated workflows: tools downloaded in the background, each affected approved
675
+ workflow prepared by AWARE, and ONE person click that carries their approvals forward. The
676
+ server owns every decision (tool-updates-service.ts); tool-updates.js only renders its view
677
+ and sends the click. -->
678
+ <div class="modal-backdrop" id="tool-updates-modal" role="dialog" aria-modal="true"
679
+ aria-labelledby="tool-updates-title" aria-describedby="tool-updates-sub" aria-busy="false">
680
+ <div class="modal tool-updates-dialog" tabindex="-1">
681
+ <div class="modal-title" id="tool-updates-title" tabindex="-1">Approve updated workflows</div>
682
+ <div class="modal-sub" id="tool-updates-sub">Your workflows keep running on the tool versions you approved until you approve a change.</div>
683
+ <div class="tool-updates-body" id="tool-updates-body"></div>
684
+ <div class="tool-updates-live" id="tool-updates-live" role="status" aria-live="polite" aria-atomic="true"></div>
685
+ <div class="tool-updates-foot" id="tool-updates-foot"></div>
686
+ <div class="modal-actions">
687
+ <button data-command-id="shell.tool-updates-check" id="tool-updates-check" type="button">Check for updates</button>
688
+ <button data-command-id="shell.dialog-cancel#the workflow updates" id="tool-updates-cancel" type="button">Not now</button>
689
+ <button data-command-id="shell.tool-updates-approve" id="tool-updates-approve" type="button" class="primary" hidden>Approve</button>
690
+ </div>
691
+ </div>
692
+ </div>
693
+
638
694
  <!-- Import failed: `aware app install` refused the .flo. It says exactly what is wrong on stderr —
639
695
  which agent isn't runnable, which node id is duplicated — and the plain "import failed …
640
696
  (exit N)" toast this replaces could carry none of it (#314). Shows what happened in plain
@@ -695,24 +751,28 @@
695
751
  <span class="view-dot" id="dash-dot" hidden aria-label="Dashboard updated">●</span>
696
752
  </button>
697
753
  <div class="menu-divider"></div>
698
- <!-- Agents library (was the header ⊞ Agents button, #149). Heads the agent group
699
- (Agents / Graft into agent / Bake into agent). Ctrl+G. -->
754
+ <!-- Tools library (was the header ⊞ Agents button, #149; renamed Tools in #2007). Heads the tool group
755
+ (Tools / Graft into tool / Bake into tool). Ctrl+G. -->
700
756
  <button class="menu-item" data-action="agents" data-command-id="menu.agents" role="menuitem">
701
757
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg></span>
702
- <span class="menu-label">Agents</span>
758
+ <span class="menu-label">Tools</span>
703
759
  <span class="menu-kbd">Ctrl+G</span>
704
760
  </button>
705
761
  <button class="menu-item" data-action="graft" data-command-id="menu.graft" role="menuitem">
706
762
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M12 22v-5"/><path d="M15 8V2"/><path d="M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z"/><path d="M9 8V2"/></svg></span>
707
- <span class="menu-label">Graft into agent</span>
763
+ <span class="menu-label">Graft into tool</span>
708
764
  </button>
709
765
  <button class="menu-item" data-action="discover-local" data-command-id="menu.discover-local" role="menuitem">
710
766
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="7"/><path d="m16 16 5 5M8 11h6m-3-3v6"/></svg></span>
711
767
  <span class="menu-label">Discover local tools…</span>
712
768
  </button>
769
+ <button class="menu-item" data-action="tool-updates" data-command-id="menu.tool-updates" role="menuitem">
770
+ <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-3-6.7L21 8"/><path d="M21 3v5h-5"/><path d="M12 8v5l3 2"/></svg></span>
771
+ <span class="menu-label">Tool updates…</span>
772
+ </button>
713
773
  <button class="menu-item" data-action="bake" data-command-id="menu.bake" id="menu-bake-item" role="menuitem">
714
774
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/><path d="M12 22V12"/><polyline points="3.29 7 12 12 20.71 7"/><path d="m7.5 4.27 9 5.15"/></svg></span>
715
- <span class="menu-label" id="menu-bake-label">Bake into agent</span>
775
+ <span class="menu-label" id="menu-bake-label">Bake into tool</span>
716
776
  </button>
717
777
  <div class="menu-divider"></div>
718
778
  <button class="menu-item" data-action="integrations" data-command-id="menu.integrations" role="menuitem">
@@ -724,6 +784,10 @@
724
784
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M3 7h6l2 2h10v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><path d="M3 7V5a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v2"/></svg></span>
725
785
  <span class="menu-label">Workspace directory…</span>
726
786
  </button>
787
+ <button class="menu-item" data-action="tool-update-policy" data-command-id="menu.tool-update-policy" role="menuitem">
788
+ <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-3-6.7"/><polyline points="21 3 21 9 15 9"/></svg></span>
789
+ <span class="menu-label">Automatic tool updates…</span>
790
+ </button>
727
791
  <button class="menu-item" data-action="routines" data-command-id="menu.routines" role="menuitem">
728
792
  <span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><line x1="10" x2="14" y1="2" y2="2"/><line x1="12" x2="15" y1="14" y2="11"/><circle cx="12" cy="14" r="8"/></svg></span>
729
793
  <span class="menu-label">Routines</span>
@@ -1183,29 +1247,29 @@
1183
1247
 
1184
1248
  <div class="modal-backdrop" id="lib-modal">
1185
1249
  <div class="modal library">
1186
- <div class="modal-title">Agent Library</div>
1187
- <div class="tabs lib-tabs" id="lib-tabs" role="tablist" aria-label="Agent Library tabs">
1250
+ <div class="modal-title">Tools</div>
1251
+ <div class="tabs lib-tabs" id="lib-tabs" role="tablist" aria-label="Tools library tabs">
1188
1252
  <button data-command-id="shell.library-tab#installed" data-libtab="installed" class="active" role="tab" aria-selected="true" aria-controls="lib-pane-installed">Installed</button>
1189
1253
  <button data-command-id="shell.library-tab#available" data-libtab="available" role="tab" aria-selected="false" aria-controls="lib-pane-available">Available</button>
1190
1254
  </div>
1191
1255
 
1192
- <div class="lib-pane" id="lib-pane-installed" role="tabpanel" aria-label="Installed agents">
1193
- <div class="modal-sub">All installed agents · star a command to save it as a Template.</div>
1194
- <input data-command-id="shell.library-search#installed" id="lib-search" class="lib-search" type="text" placeholder="Search (tekla, slack, file, …)" aria-label="Search installed agents">
1256
+ <div class="lib-pane" id="lib-pane-installed" role="tabpanel" aria-label="Installed tools">
1257
+ <div class="modal-sub">All installed tools · star a command to save it as a Template.</div>
1258
+ <input data-command-id="shell.library-search#installed" id="lib-search" class="lib-search" type="text" placeholder="Search (tekla, slack, file, …)" aria-label="Search installed tools">
1195
1259
  <div class="lib-list" id="lib-list"></div>
1196
1260
  </div>
1197
1261
 
1198
- <div class="lib-pane" id="lib-pane-available" role="tabpanel" aria-label="Available agents" hidden>
1199
- <div class="modal-sub">Every agent in the AWARE registry · install one to add it to your library.</div>
1200
- <input data-command-id="shell.library-search#available" id="lib-avail-search" class="lib-search" type="text" placeholder="Search available agents (revit, ifc, slack, …)" aria-label="Search available agents">
1262
+ <div class="lib-pane" id="lib-pane-available" role="tabpanel" aria-label="Available tools" hidden>
1263
+ <div class="modal-sub">Every tool in the AWARE registry · install one to add it to your library.</div>
1264
+ <input data-command-id="shell.library-search#available" id="lib-avail-search" class="lib-search" type="text" placeholder="Search available tools (revit, ifc, slack, …)" aria-label="Search available tools">
1201
1265
  <span class="sr-only" aria-live="polite" id="lib-avail-count"></span>
1202
1266
  <div class="lib-list" id="lib-avail-list"></div>
1203
1267
  </div>
1204
1268
 
1205
1269
  <div class="modal-actions">
1206
1270
  <button data-command-id="menu.discover-local" id="lib-discover-local" style="margin-right:auto;" data-tip="Look for installed apps and file names in folders you choose">Discover local tools…</button>
1207
- <button data-command-id="menu.graft" id="lib-graft" style="margin-right:auto;" data-tip="Build a new agent from a tool you own — a DLL, C# source, NuGet package, or API spec.">⊕ Graft new agent</button>
1208
- <button data-command-id="shell.dialog-close#the agent library" id="lib-close">Close</button>
1271
+ <button data-command-id="menu.graft" id="lib-graft" style="margin-right:auto;" data-tip="Build a new tool from software you own — a DLL, C# source, NuGet package, or API spec.">⊕ Graft new tool</button>
1272
+ <button data-command-id="shell.dialog-close#the agent library" data-command-instance-label="the Tools library" id="lib-close">Close</button>
1209
1273
  </div>
1210
1274
  </div>
1211
1275
  </div>
@@ -1544,13 +1608,13 @@
1544
1608
  model-plugin recipe); floless only stages, previews, and surfaces it. -->
1545
1609
  <div class="modal-backdrop" id="graft-modal">
1546
1610
  <div class="modal graft">
1547
- <div class="modal-title" id="graft-title">Graft into agent</div>
1548
- <div class="modal-sub" id="graft-sub">Point at a DLL, package, or API spec — AWARE reads it and builds an agent you can drop into any workflow.</div>
1611
+ <div class="modal-title" id="graft-title">Graft into tool</div>
1612
+ <div class="modal-sub" id="graft-sub">Point at a DLL, package, or API spec — AWARE reads it and builds a tool you can drop into any workflow.</div>
1549
1613
  <div id="graft-body"></div>
1550
1614
  <div id="graft-instructor-note" role="note" aria-label="Instructor guidance" aria-live="polite" tabindex="0" hidden></div>
1551
1615
  <div class="modal-actions">
1552
1616
  <button data-command-id="shell.graft-back" id="graft-back" style="margin-right:auto;" hidden>‹ Back</button>
1553
- <button data-command-id="shell.dialog-cancel#building an agent" id="graft-cancel">Cancel</button>
1617
+ <button data-command-id="shell.dialog-cancel#building an agent" data-command-instance-label="building a tool" id="graft-cancel">Cancel</button>
1554
1618
  <button data-command-id="shell.graft-inspect-source" id="graft-primary" class="primary" disabled>Inspect source</button>
1555
1619
  </div>
1556
1620
  </div>
@@ -1595,19 +1659,28 @@
1595
1659
  </div>
1596
1660
  </div>
1597
1661
 
1662
+ <!-- #1998: the one-time carry-forward policy — asked at a person's first approval, and ≡ → Automatic tool updates….
1663
+ Filled by renderPolicyModal (web/aware.js); the words come from the server, which hashes them. -->
1664
+ <div class="modal-backdrop" id="policy-modal" role="dialog" aria-modal="true" aria-labelledby="policy-title" aria-describedby="policy-body">
1665
+ <div class="modal policy-modal">
1666
+ <div class="modal-title" id="policy-title" tabindex="-1">Automatic tool updates</div>
1667
+ <div class="policy-body" id="policy-body"></div>
1668
+ <div class="modal-actions" id="policy-actions"></div>
1669
+ </div>
1670
+ </div>
1598
1671
  <!-- Bake into agent — preview + confirm. Packages the workflow as a reusable
1599
1672
  agent (exposes-as-agent) and reinstalls so AWARE synthesizes it. -->
1600
1673
  <div class="modal-backdrop" id="bake-modal">
1601
1674
  <div class="modal">
1602
- <div class="modal-title" id="bake-title">Bake into agent</div>
1603
- <div class="modal-sub">Packages this workflow as a reusable agent. AWARE reinstalls it with an exposed interface, then it appears in the Agents library as a single callable node.</div>
1675
+ <div class="modal-title" id="bake-title">Bake into tool</div>
1676
+ <div class="modal-sub">Packages this workflow as a reusable tool. AWARE reinstalls it with an exposed interface, then it appears in the Tools library as a single callable node.</div>
1604
1677
  <div id="bake-body">
1605
1678
  <div class="modal-field">
1606
- <label>Agent name</label>
1679
+ <label>Tool name</label>
1607
1680
  <div id="bake-name" class="bake-name"></div>
1608
1681
  </div>
1609
1682
  <div class="modal-field">
1610
- <label>Agent inputs</label>
1683
+ <label>Tool inputs</label>
1611
1684
  <div id="bake-inputs" class="bake-inputs"></div>
1612
1685
  </div>
1613
1686
  </div>
@@ -1628,11 +1701,13 @@
1628
1701
  <script src="aware-update-client.js"></script>
1629
1702
  <script src="leave-guard.js"></script>
1630
1703
  <script src="aware.js"></script>
1704
+ <script src="tool-updates.js"></script>
1631
1705
  <script src="panels.js"></script>
1632
1706
  <script src="filter-guidance.js"></script>
1633
1707
  <script src="workspaces.js"></script>
1634
1708
  <script src="left-pane.js"></script>
1635
1709
  <script src="chat.js"></script>
1710
+ <script src="agents.js"></script>
1636
1711
  <script src="connections.js"></script>
1637
1712
  <script src="local-discovery.js"></script>
1638
1713
  <script src="account-menu.js"></script>
@@ -101,6 +101,10 @@
101
101
  }
102
102
 
103
103
  function workspaceGuidance(workspace) {
104
+ // #2007: the Agents tab shares this seam; it is its own module, never "Workspaces".
105
+ if (workspace.kind === 'agents') {
106
+ return { tone: 'idle', chip: 'Agents', parts: ['Create an agent, or open one to run it by hand'], ask: 'Agents', surface: 'shell' };
107
+ }
104
108
  var landing = workspace.landing === true;
105
109
  return {
106
110
  tone: 'idle',
@@ -132,6 +136,48 @@
132
136
  parts.push(wf.name);
133
137
  parts.push('changed since the last Compile, so its approved lock is out of date');
134
138
  parts.push('Compile to re-enable Run');
139
+ } else if (wf.runState === 'agent-changed' && wf.remedy === 'publish') {
140
+ // #1996: a published workflow whose approval changed outside FloLess. Compile is refused for it.
141
+ tone = 'blocked';
142
+ chip = 'Needs publishing';
143
+ parts.push(wf.name);
144
+ parts.push('changed outside FloLess since it was published');
145
+ parts.push('Ask AI Chat to publish it again');
146
+ } else if (wf.runState === 'agent-changed' && wf.remedy === 'update-aware') {
147
+ // #1996: its approval was carried forward by a newer AWARE than the one installed.
148
+ tone = 'blocked';
149
+ chip = 'Needs compile';
150
+ parts.push(wf.name);
151
+ parts.push('its approval needs a newer AWARE');
152
+ parts.push('Update AWARE, or Compile');
153
+ } else if (wf.runState === 'agent-changed' && wf.remedy === 'unconfirmed') {
154
+ // #1996: a carried-forward approval FloLess could not confirm just now. Nothing is known to have changed.
155
+ tone = 'blocked';
156
+ chip = 'Needs compile';
157
+ parts.push(wf.name);
158
+ parts.push('its approval could not be confirmed just now');
159
+ parts.push('Reopen it, or Compile');
160
+ } else if (wf.runState === 'agent-changed' && wf.remedy === 'needs-you') {
161
+ // #1998: the exact tool version it was approved with cannot run. FloLess never picks another one.
162
+ tone = 'blocked';
163
+ chip = 'Needs you';
164
+ parts.push(wf.name);
165
+ parts.push('a tool version it was approved with is not available');
166
+ parts.push('Reinstall that version, or Compile again');
167
+ } else if (wf.runState === 'agent-changed') {
168
+ // #1912: the .flo still matches its approval, but a tool it uses was updated since, so the run
169
+ // would be refused. Not "in sync · Next: Run".
170
+ tone = 'blocked';
171
+ chip = 'Needs compile';
172
+ parts.push(wf.name);
173
+ parts.push('a tool it uses has changed since it was approved');
174
+ parts.push('Compile, then Run');
175
+ } else if (wf.runState === 'draft') {
176
+ // #1890 PR 3b-0: a draft has no installed copy yet — there is nothing to run, only something to compile.
177
+ chip = 'Draft';
178
+ parts.push(wf.name);
179
+ parts.push('not compiled yet');
180
+ parts.push(wf.hasSource ? 'Next: Compile' : 'Next: ask AI Chat to write its workflow file');
135
181
  } else if (wf.runState === 'uncompiled') {
136
182
  tone = 'blocked';
137
183
  chip = 'Not set up';
@@ -147,7 +193,8 @@
147
193
  : wf.inputsSet + ' of ' + wf.totalInputs + ' inputs set'
148
194
  );
149
195
  }
150
- parts.push('in sync');
196
+ // #1996: it runs, but part of its approval record is missing — say so instead of "in sync".
197
+ parts.push(wf.recordIncomplete ? 'part of its approval record is missing' : 'in sync');
151
198
  parts.push(nextStep(wf));
152
199
  }
153
200
 
@@ -755,6 +802,28 @@
755
802
  internal vocabulary (id, persistence, interaction, guidance) is NOT: those
756
803
  are our words, and matching them would surface hits a user cannot explain to
757
804
  themselves. Risk flags are in, so "destructive" finds what it should. */
805
+ /* #1890 PR 3b-0: a search puts the groups holding a command NAMED by the query first — "Compile" lands on a Compile
806
+ button, not on a tab whose description merely mentions compiling. Still on-screen first, and a group's commands
807
+ stay together (one heading each); only the order of groups within each half changes. */
808
+ function rankByLabel(hits, q, visibleTemplates) {
809
+ function tier(cmd) {
810
+ var label = String(cmd.label || '').toLowerCase();
811
+ return label === q ? 0 : label.indexOf(q) === 0 ? 1 : label.indexOf(q) !== -1 ? 2 : 3;
812
+ }
813
+ var best = {};
814
+ var rows = hits.map(function (cmd, index) {
815
+ var half = onScreen(cmd, visibleTemplates) ? 0 : 1;
816
+ var key = half + '|' + (cmd.group || 'Elsewhere');
817
+ var t = tier(cmd);
818
+ if (!(key in best) || t < best[key]) best[key] = t;
819
+ return { cmd: cmd, index: index, half: half, key: key };
820
+ });
821
+ rows.sort(function (a, b) {
822
+ return (a.half - b.half) || (best[a.key] - best[b.key]) || (a.index - b.index);
823
+ });
824
+ return rows.map(function (row) { return row.cmd; });
825
+ }
826
+
758
827
  function matches(cmd, q) {
759
828
  if (!q) return true;
760
829
  var hay = [cmd.label, cmd.instanceLabel, cmd.actsOn, cmd.group, cmd.key, cmd.why]
@@ -773,17 +842,20 @@
773
842
  a static array cannot express that, because "active" is runtime state. */
774
843
  var GROUP_ORDER = [
775
844
  // the shell
776
- 'In the header', 'In the workflow picker', 'In the project picker', 'In the project list', 'On the Workflows page',
845
+ 'In the header', 'In the workflow picker', 'In the project picker', 'In the project list', 'On the Workflows page', 'In the workflow picker and on a draft workflow',
846
+ 'On the Agents page', 'On an agent',
777
847
  'In the Workspace directory dialog', 'In Tekla source selection', 'In the new project dialog', 'In the project workspace', 'In the Revit workspace', 'In the Tekla Parser workspace', 'In the Drawing Checker profile', 'In Company knowledge',
778
848
  'On the workflow canvas', 'In workflow setup dialogs',
779
849
  // The Informed by row sits at the top of the canvas column, so it is read right after the canvas.
850
+ // #1998: the approval notices sit above the canvas with the Informed by row.
851
+ 'In the Needs you notice', 'In the Approval carried over row',
780
852
  'In the Informed by row', 'In Set inputs',
781
853
  'At the left edge of the workspace', 'At the edge of the left or Inspect panel', 'In the left panel', 'Between AI Chat and Model', 'In the Model section of the left panel', 'In the Grid object in the Model section',
782
854
  'In AI Chat', 'In AI Chat history', 'In AI Chat settings', 'In the node Inspect panel', 'In the Instructor strip',
783
855
  'In the ≡ menu', 'In the account menu', 'In the footer',
784
856
  'In the contract editor', 'In the report viewer', 'In the Knowledge Base viewer', 'In the guide',
785
- 'In the agent library', 'In Discover local tools', 'In the requests list', 'In the revision review', 'In the run request dialog', 'In the Integrations dialog', 'In the Routines dialog',
786
- 'In the Report an issue dialog', 'In the Build an agent dialog', 'In the Bake dialog', 'In the CAD send review',
857
+ 'In the Tools library', 'In Discover local tools', 'In the requests list', 'In the revision review', 'In the run request dialog', 'In the Integrations dialog', 'In the Routines dialog', 'In the Automatic tool updates dialog',
858
+ 'In the Report an issue dialog', 'In the Build a tool dialog', 'In the Bake dialog', 'In the CAD send review',
787
859
  'In the FloLess dialogs', 'On the FloLess has stopped screen',
788
860
  /* the steel editor — read top-left down, then the menus, then the dialogs.
789
861
  The ⋯ menu is six groups rather than one because it is six accordion
@@ -802,8 +874,8 @@
802
874
  'In the Connections dialog', 'In the reference-model dialogs', 'In the connection-import dialog',
803
875
  'In the confidence report', 'In the Ask AI panel', 'In the Ask AI dialog', 'In the Favourites dialog',
804
876
  // the read-only Revit model editor
805
- 'In the Revit model header', 'In the Revit model toolbar', 'In the Revit model coordinate HUD', 'In the Revit model selection bar', 'In the Revit model snapping bar', 'In the Revit spatial controls',
806
- 'In the Tekla Parser header', 'In the Tekla Parser model toolbar', 'In the Tekla Parser coordinate HUD', 'In the Tekla Parser selection bar', 'In the Tekla Parser snapping bar', 'In the Tekla Parser spatial controls', 'In the Tekla Parser Audit pane',
877
+ 'In the Revit model header', 'In the Revit model toolbar', 'In the Revit Saved views panel', 'In the Revit model coordinate HUD', 'In the Revit model selection bar', 'In the Revit model snapping bar', 'In the Revit spatial controls',
878
+ 'In the Tekla Parser header', 'In the Tekla Parser model toolbar', 'In the Tekla Parser Saved views panel', 'In the Tekla Parser coordinate HUD', 'In the Tekla Parser selection bar', 'In the Tekla Parser snapping bar', 'In the Tekla Parser spatial controls', 'In the Tekla Parser Audit pane',
807
879
  // the drawing filter
808
880
  'In the Drawing Filter header', 'In a Drawing Filter message',
809
881
  'In the Drawing Filter panel', 'On the Drawing Filter canvas',
@@ -899,7 +971,9 @@
899
971
  choosing it already reads "Hidden on this screen right now" (#1545), so ranking it above
900
972
  the divider was the one place the sheet still claimed otherwise. */
901
973
  if (snapshot.child && surface === snapshot.child.surface) return carriers !== false;
902
- return surface === activeSurface();
974
+ /* #1890 PR 3b-0: the same rule on the shell — a command whose every control is hidden here (the header Compile on
975
+ the Workflows page or a draft's view) is not "this screen", so a draft's own Compile is the one ranked first. */
976
+ return surface === activeSurface() && carriers !== false;
903
977
  }
904
978
 
905
979
  function renderSheet() {
@@ -907,6 +981,7 @@
907
981
  var visibleTemplates = visibleCarrierTemplates();
908
982
  var all = sheetEntries(visibleTemplates);
909
983
  var hits = all.filter(function (c) { return matches(c, q); });
984
+ if (q) hits = rankByLabel(hits, q, visibleTemplates);
910
985
 
911
986
  $sheetList.textContent = '';
912
987
  sheetRows = [];
@@ -1565,11 +1640,13 @@
1565
1640
  },
1566
1641
  setWorkspace: function (context) {
1567
1642
  var next = context && context.name
1568
- ? { name: context.name, landing: context.landing === true, projectId: context.projectId || null }
1643
+ ? { name: context.name, landing: context.landing === true, projectId: context.projectId || null,
1644
+ kind: context.kind === 'agents' ? 'agents' : null }
1569
1645
  : null;
1570
1646
  var was = snapshot.workspace;
1571
1647
  snapshot.workspace = next;
1572
1648
  if ((was && was.name) !== (next && next.name)
1649
+ || (was && was.kind) !== (next && next.kind)
1573
1650
  || (was && was.landing) !== (next && next.landing)
1574
1651
  || (was && was.projectId) !== (next && next.projectId)) snapshot.focus = null;
1575
1652
  paint();
@@ -51,6 +51,7 @@
51
51
  { match: /steel-filter\.html/, label: 'The Drawing Filter' },
52
52
  { match: /steel-editor\.html/, label: 'The model editor' },
53
53
  { match: /vector-editor\.html/, label: 'The drawing editor' },
54
+ { match: /drawing-check-editor\.html/, label: 'The Drawing Checker' },
54
55
  ];
55
56
  var STATE_DETAIL = {
56
57
  dirty: 'has changes that are not saved yet.',
@@ -886,11 +886,18 @@
886
886
  const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
887
887
  if (!uuid.test(String(data.chatId)) || !uuid.test(String(data.messageEventId))
888
888
  || typeof data.projectId !== 'string' || !data.projectId || data.projectId.length > 200) return;
889
+ const validId = (id) => typeof id === 'string' && !!id && id.length <= 200;
890
+ const owner = data.owner;
891
+ if (owner !== undefined && (!owner || typeof owner !== 'object'
892
+ || !(owner.kind === 'workspace' || owner.kind === 'project' && validId(owner.projectId)
893
+ || owner.kind === 'workflow' && validId(owner.workflowId)))) return;
894
+ const home = owner === undefined ? null : owner.kind === 'workspace' ? { kind: 'workspace' }
895
+ : owner.kind === 'project' ? { kind: 'project', projectId: owner.projectId } : { kind: 'workflow', workflowId: owner.workflowId };
889
896
  // Said where a sighted person looks, not only to a screen reader: the click happened in the model panel.
890
897
  const refuse = (message) => { status.textContent = message; window.showToast?.(message, 'info'); };
891
898
  const open = window.flolessChat?.openConversation;
892
899
  if (typeof open !== 'function') { refuse('AI Chat is not ready yet. Try Show in chat again in a moment.'); return; }
893
- Promise.resolve().then(() => open(data.chatId, { messageEventId: data.messageEventId, projectId: data.projectId }))
900
+ Promise.resolve().then(() => open(data.chatId, { messageEventId: data.messageEventId, projectId: data.projectId, ...(home ? { owner: home } : {}) }))
894
901
  .catch((error) => refuse(error?.message || 'That conversation could not be opened. Try Show in chat again.'));
895
902
  return;
896
903
  }
@@ -925,6 +932,18 @@
925
932
  if (!available(key)) return false;
926
933
  const changed = !shown(key); sessionVisible[key] = true; reflect(); return changed;
927
934
  },
935
+ // Show one of the model editor's tabs from the main window (the approval review's "Open Audit tab",
936
+ // #1840) — what the editor's own `reveal` message does, but the editor may not have loaded yet: the
937
+ // choice is parked in `displacedTab`, which `renderModel` applies as soon as the editor offers it.
938
+ showModelTab(key) {
939
+ if (typeof key !== 'string' || !key) return false;
940
+ displacedTab = key; state.tab = key; save();
941
+ sessionVisible.model = true;
942
+ reflect();
943
+ if (state.snapshot) renderModel();
944
+ if (document.getElementById('app')?.classList.contains('left-collapsed')) document.querySelector('.pane-rail-left .panel-toggle[data-side="left"]')?.click();
945
+ return true;
946
+ },
928
947
  setWorkspaceModelVisible(visible) {
929
948
  if (overlayFrame) { state.workspaceModelVisible = !!visible; return; } // the overlay's editor has the section until it closes
930
949
  if (!visible && state.workspaceModelVisible) send({ type: 'release' });