@floless/app 0.132.1 → 0.133.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.
@@ -994,6 +994,133 @@
994
994
  why: 'A mostly-horizontal beam should run left to right, a steep one bottom to top. Press P to swap the ones it finds.',
995
995
  });
996
996
 
997
+ def('steel.check-member-ends', {
998
+ label: 'Member ends short of supports',
999
+ actsOn: 'Reviews beam and brace endpoints that may stop at a support face instead of its centerline',
1000
+ group: 'In the ⋯ menu — Model checks',
1001
+ persistence: 'working',
1002
+ interaction: 'mode',
1003
+ risk: [],
1004
+ guidance: 'on-demand',
1005
+ why: 'Diagnosis never edits. You choose the endpoints and intended support before one conditional, undoable batch extends them.',
1006
+ });
1007
+
1008
+ def('steel.member-end-review-close', {
1009
+ label: 'Done reviewing member ends',
1010
+ actsOn: 'Closes the member-end review without changing any remaining endpoints',
1011
+ group: 'In the Inspect panel',
1012
+ persistence: 'none',
1013
+ interaction: 'instant',
1014
+ risk: [],
1015
+ guidance: 'on-demand',
1016
+ });
1017
+
1018
+ def('steel.member-end-retry', {
1019
+ label: 'Check member ends again',
1020
+ actsOn: 'Retries the member-end scan after a recoverable failure',
1021
+ group: 'In the Inspect panel',
1022
+ persistence: 'none',
1023
+ interaction: 'instant',
1024
+ risk: [],
1025
+ guidance: 'on-demand',
1026
+ });
1027
+
1028
+ def('steel.member-end-select', {
1029
+ label: 'Include in member-end change',
1030
+ actsOn: 'Chooses which reviewed endpoints the next centerline extension will change',
1031
+ group: 'In the Inspect panel',
1032
+ persistence: 'none',
1033
+ interaction: 'instant',
1034
+ risk: [],
1035
+ guidance: 'on-demand',
1036
+ why: 'Selection is only a pending review choice; the model changes when you apply the batch.',
1037
+ });
1038
+
1039
+ def('steel.member-end-select-all', {
1040
+ label: 'Select all reviewed ends',
1041
+ actsOn: 'Includes every actionable endpoint in the pending centerline extension',
1042
+ group: 'In the Inspect panel',
1043
+ persistence: 'none',
1044
+ interaction: 'instant',
1045
+ risk: [],
1046
+ guidance: 'on-demand',
1047
+ why: 'This changes only the pending review selection; the model remains unchanged until you apply the batch.',
1048
+ });
1049
+
1050
+ def('steel.member-end-select-clear', {
1051
+ label: 'Clear selected ends',
1052
+ actsOn: 'Removes every endpoint from the pending centerline extension',
1053
+ group: 'In the Inspect panel',
1054
+ persistence: 'none',
1055
+ interaction: 'instant',
1056
+ risk: [],
1057
+ guidance: 'on-demand',
1058
+ });
1059
+
1060
+ def('steel.member-end-target', {
1061
+ label: 'Choose intended support',
1062
+ actsOn: 'Chooses the support centerline an ambiguous endpoint should reach',
1063
+ group: 'In the Inspect panel',
1064
+ persistence: 'none',
1065
+ interaction: 'instant',
1066
+ risk: [],
1067
+ guidance: 'on-demand',
1068
+ });
1069
+
1070
+ def('steel.member-end-keep-short', {
1071
+ label: 'Keep endpoint short',
1072
+ actsOn: 'Records that the reviewed endpoint is intentionally short in the current model context',
1073
+ group: 'In the Inspect panel',
1074
+ persistence: 'working',
1075
+ interaction: 'instant',
1076
+ risk: [],
1077
+ guidance: 'on-demand',
1078
+ why: 'The decision is evidence-bound and undoable; it becomes stale if the relevant model context changes.',
1079
+ });
1080
+
1081
+ def('steel.member-end-restore', {
1082
+ label: 'Restore traced endpoint',
1083
+ actsOn: 'Restores the immutable endpoint traced from the drawing',
1084
+ group: 'In the Inspect panel',
1085
+ persistence: 'working',
1086
+ interaction: 'instant',
1087
+ risk: [],
1088
+ guidance: 'on-demand',
1089
+ why: 'This reverses a centerline normalization only when its original drawing evidence is still valid. Undoable.',
1090
+ });
1091
+
1092
+ def('steel.member-end-review-nav', {
1093
+ label: 'Move through member-end findings',
1094
+ actsOn: 'Focuses another endpoint in the current review',
1095
+ group: 'In the Inspect panel',
1096
+ persistence: 'none',
1097
+ interaction: 'instant',
1098
+ risk: [],
1099
+ guidance: 'on-demand',
1100
+ });
1101
+
1102
+ def('steel.member-end-history', {
1103
+ label: 'Member-end history',
1104
+ actsOn: '{instance} the newest member-end resolution',
1105
+ group: 'In the Inspect panel',
1106
+ persistence: 'working',
1107
+ interaction: 'instant',
1108
+ risk: [],
1109
+ guidance: 'on-demand',
1110
+ why: 'The server authorizes exactly one direction at a time with the current durable history token.',
1111
+ });
1112
+
1113
+ def('steel.member-end-apply', {
1114
+ label: 'Extend selected ends to centerlines',
1115
+ actsOn: 'Extends the selected reviewed endpoints to their chosen support centerlines',
1116
+ group: 'In the Inspect panel',
1117
+ persistence: 'working',
1118
+ interaction: 'instant',
1119
+ risk: [],
1120
+ guidance: 'on-demand',
1121
+ why: 'The server rechecks every finding and commits the selected changes as one conditional, undoable batch.',
1122
+ });
1123
+
997
1124
  def('steel.merge-collinear', {
998
1125
  label: 'Merge collinear beams',
999
1126
  actsOn: 'Joins straight end-to-end runs into one beam',
@@ -1690,6 +1817,22 @@
1690
1817
  def('steel.dimension-chain', { label: 'Chain', actsOn: 'Keeps placing dimensions from the previous endpoint', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Enter or Esc ends the chain while leaving the dimensions already placed.' });
1691
1818
  def('steel.dimension-pin', { label: 'Pin to steel', actsOn: 'Links or unlinks the selected dimension from its member or grid anchors', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Unpinning keeps the link dormant, so it can be restored without picking the anchors again.' });
1692
1819
  def('steel.add-profile', { label: 'Current profile', actsOn: 'Sets the profile future members will use', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This changes the Add tool preset; it does not re-profile members already in the model.' });
1820
+ def('steel.add-material', { label: 'Material grade', actsOn: 'Sets the material future members will use', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This changes the Add tool preset; it does not alter members already in the model.' });
1821
+ def('steel.browse-profile-catalog', { label: 'Browse profiles', actsOn: 'Opens the active environment\'s profile catalog', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Choosing a supported row applies its designation to the current member scope; unsupported rows remain visible but cannot be applied.' });
1822
+ def('steel.browse-material-catalog', { label: 'Browse materials', actsOn: 'Opens the active environment\'s material catalog', group: 'In the Inspect panel', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Choosing a row applies that grade to the current member scope.' });
1823
+ def('steel.catalog-search', { label: 'Search catalog', actsOn: 'Filters the open catalog to names and aliases matching {instance}', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1824
+ def('steel.catalog-category', { label: 'Catalog category', actsOn: 'Shows or hides the catalog rows under {instance}', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1825
+ def('steel.catalog-profile', { label: 'Profile choice', actsOn: 'Stages {instance} and shows its section facts before anything is applied', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The model stays unchanged until Apply is pressed; unsupported joists can be inspected but not applied.' });
1826
+ def('steel.catalog-material', { label: 'Material choice', actsOn: 'Stages {instance} and shows its provider facts before anything is applied', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The model stays unchanged until Apply is pressed.' });
1827
+ def('steel.catalog-material-default', { label: 'Use profile default', actsOn: 'Stages omission of an explicit grade so each member follows its profile', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The model stays unchanged until the choice is applied.' });
1828
+ def('steel.catalog-material-current', { label: 'Keep current material', actsOn: 'Stages the project material that is not present in this provider catalog', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1829
+ def('steel.catalog-custom', { label: 'Custom designation', actsOn: 'Edits a catalog-independent {instance} value for this choice', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1830
+ def('steel.catalog-use-custom', { label: 'Stage custom value', actsOn: 'Stages the typed {instance} designation without changing the model yet', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1831
+ def('steel.catalog-apply', { label: 'Apply catalog choice', actsOn: 'Writes {instance} to the member scope named at the top of this picker', group: 'In the steel editor dialogs', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
1832
+ def('steel.catalog-cancel', { label: 'Cancel catalog choice', actsOn: 'Closes the picker and leaves the model unchanged', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1833
+ def('steel.catalog-clear-search', { label: 'Clear catalog search', actsOn: 'Restores every available {instance} row in this picker', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1834
+ def('steel.catalog-retry', { label: 'Retry catalog load', actsOn: 'Requests the {instance} provider again after a load failure', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1835
+ def('steel.catalog-show-more', { label: 'Show more catalog rows', actsOn: 'Reveals the next page of matching {instance}', group: 'In the steel editor dialogs', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
1693
1836
  def('steel.detail-placement-coordinate', { label: 'Detail coordinate', actsOn: 'Moves the selected reference detail along {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
1694
1837
  def('steel.detail-placement-rotation', { label: 'Detail rotation', actsOn: 'Rotates the selected reference detail on its image plane', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
1695
1838
  def('steel.detail-placement-size', { label: 'Detail size', actsOn: 'Sets the displayed size of the selected reference detail', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The placed image is reference-only; changing its size does not build steel.' });
@@ -1718,6 +1861,7 @@
1718
1861
  def('steel.end-connection', { label: 'Connection recipe', actsOn: 'Chooses the connection-library row for {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Once chosen, the library row supplies the type and detail instead of the fallback text fields.' });
1719
1862
  def('steel.ends-match', { label: 'Match both ends', actsOn: 'Copies the start-end settings to the other end of each selected beam', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Braces are skipped because matching their elevations would flatten the slope.' });
1720
1863
  def('steel.selection-profile', { label: 'Profile', actsOn: 'Sets one profile on every selected member', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
1864
+ def('steel.selection-material', { label: 'Material grade', actsOn: 'Sets one material on every selected member', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
1721
1865
  def('steel.selection-verified', { label: 'Verify selected members', actsOn: 'Marks or unmarks every selected member as human-confirmed', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Human confirmation contributes full confidence but does not invent a missing AISC size.' });
1722
1866
  def('steel.ends-swap', { label: 'Swap start and end', actsOn: 'Reverses the eligible selected beam members', group: 'In the Inspect panel', key: 'Also: P', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Columns stay base-to-top, and braces use their separate lower-end display control.' });
1723
1867
  def('steel.quick-dimension-anchor', { label: 'Spacing point', actsOn: 'Measures each selected beam at its {instance}', group: 'In the Inspect panel', persistence: 'local', interaction: 'instant', risk: [], guidance: 'on-demand' });
@@ -1744,6 +1888,7 @@
1744
1888
  def('steel.member-line-weight', { label: 'Line weight', actsOn: 'Draws this member type with {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This is a 2D style shared by every member of the same type.' });
1745
1889
  def('steel.member-line-dash', { label: 'Line pattern', actsOn: 'Draws this member type as {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'This is a 2D style shared by every member of the same type.' });
1746
1890
  def('steel.member-profile', { label: 'Profile', actsOn: 'Changes the profile of the selected member', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Unlike Current profile in Add mode, this edits steel already in the model.' });
1891
+ def('steel.member-material', { label: 'Material grade', actsOn: 'Changes the selected member\'s explicit material', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'Unlike the Add preset, this edits steel already in the model.' });
1747
1892
  def('steel.member-verified', { label: 'Mark verified', actsOn: 'Marks or unmarks the selected member as human-confirmed', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand' });
1748
1893
  def('steel.member-profile-suggestion', { label: 'Moment-frame profile', actsOn: 'Applies the scheduled profile for {instance}', group: 'In the Inspect panel', persistence: 'working', interaction: 'instant', risk: [], guidance: 'on-demand', why: 'The suggestion comes from the imported moment-frame schedule and records that provenance.' });
1749
1894
  def('steel.properties-pin', { label: 'Pin Properties', actsOn: 'Keeps the Properties popup open while the selection changes', group: 'In the Properties popup', persistence: 'none', interaction: 'instant', risk: [], guidance: 'on-demand' });
@@ -1780,7 +1925,7 @@
1780
1925
  interaction: 'instant',
1781
1926
  risk: [],
1782
1927
  guidance: 'on-demand',
1783
- why: 'The named face decides which way is positive, so the same number moves the member the other way once the opposite face is picked.',
1928
+ why: 'The value follows the Edit frame shown above Profile Position. The named face decides which way is positive, so the same number moves the member the other way once the opposite face is picked.',
1784
1929
  });
1785
1930
 
1786
1931
  /* The FACE buttons and the rotation, added to match the two definitions #785
@@ -1802,7 +1947,7 @@
1802
1947
  interaction: 'instant',
1803
1948
  risk: [],
1804
1949
  guidance: 'on-demand',
1805
- why: 'These name envelope planes, not bearing faces, so Top and Left can leave the line in an angle’s empty corner. The steel moves; the reference line stays where it was drawn.',
1950
+ why: 'The face is interpreted in the Edit frame shown above Profile Position. These name envelope planes, not bearing faces, so Top and Left can leave the line in an angle’s empty corner. The steel moves; the reference line stays where it was drawn.',
1806
1951
  });
1807
1952
 
1808
1953
  def('steel.position-rotation', {
@@ -1813,7 +1958,7 @@
1813
1958
  interaction: 'instant',
1814
1959
  risk: [],
1815
1960
  guidance: 'on-demand',
1816
- why: '0° is as drawn. The axis itself is fixed — a positive angle follows the right-hand rule about the member’s own axis, looking from the yellow start dot to the magenta end dot.',
1961
+ why: '0° is as drawn in the Edit frame shown above Profile Position. The axis itself is fixed — a positive angle follows the right-hand rule about the member’s own axis, looking from the yellow start dot to the magenta end dot.',
1817
1962
  });
1818
1963
 
1819
1964
  def('steel.position-section-view', {
@@ -126,7 +126,10 @@
126
126
 
127
127
  <aside class="chat" id="chat-panel" data-group="In the Narrative panel">
128
128
  <div class="panel-label">
129
- <span>Narrative</span>
129
+ <span class="narrative-tabs" role="tablist" aria-label="Left panel content">
130
+ <button data-command-id="shell.narrative-tab" type="button" class="narrative-tab active" id="narrative-tab" role="tab" aria-selected="true" aria-controls="messages">Narrative</button>
131
+ <button data-command-id="shell.ai-answers-tab" type="button" class="narrative-tab" id="ai-answers-tab" role="tab" aria-selected="false" aria-controls="ai-answers" tabindex="-1">AI answers <span class="answer-unread" id="answer-unread" hidden></span></button>
132
+ </span>
130
133
  <span class="label-end">
131
134
  <span class="role">curated · full chat in your terminal</span>
132
135
  <button data-command-id="shell.narrative-panel" type="button" class="panel-toggle" data-side="left" aria-label="Collapse Narrative panel" aria-controls="chat-panel" aria-expanded="true" data-tip="Collapse Narrative panel">‹</button>
@@ -140,7 +143,9 @@
140
143
  <div class="host-banner">
141
144
  <div class="host-line host-ok">✓ plugin: floless-aeco · <span id="agent-count-narr">—</span> agents available</div>
142
145
  </div>
143
- <div class="messages" id="messages"></div>
146
+ <div class="messages" id="messages" role="tabpanel" aria-labelledby="narrative-tab"></div>
147
+ <div class="messages ai-answers" id="ai-answers" role="tabpanel" aria-labelledby="ai-answers-tab" hidden></div>
148
+ <span class="sr-only" id="narrative-answer-status" role="status" aria-live="polite"></span>
144
149
  <div class="resize-handle resize-handle-right" data-resize="left" data-tip="Drag to resize · double-click to reset"></div>
145
150
  </aside>
146
151
 
@@ -325,7 +330,15 @@
325
330
  data-tip="Every command FloLess knows, with what it acts on and how to reach it">
326
331
  press <kbd>?</kbd> to explain a control<span class="ix-hint-sep">·</span><span class="ix-hint-link">see all</span>
327
332
  </button>
328
- <button data-command-id="shell.instructor-ask" type="button" class="ix-ask" data-tip="Queue this Instructor context for your terminal AI">Ask my terminal AI</button>
333
+ <span class="ix-ask-split" id="ix-ask-split" role="group" aria-label="Ask terminal AI" hidden>
334
+ <button data-command-id="shell.instructor-ask" type="button" class="ix-ask ix-ask-main" data-tip="Start a read-only answer in your terminal AI; it will appear in AI answers">Ask AI now</button>
335
+ <button data-command-id="shell.instructor-ask-options" type="button" class="ix-ask ix-ask-caret" id="ix-ask-options" aria-label="More ways to ask" aria-haspopup="menu" aria-expanded="false" aria-controls="ix-ask-menu" data-tip="More ways to ask">▾</button>
336
+ </span>
337
+ <button data-command-id="shell.instructor-ask-queue" type="button" class="ix-ask ix-ask-queue" data-tip="Queue and copy this context for your terminal AI">Queue &amp; copy</button>
338
+ </div>
339
+ <div class="ix-ask-menu" id="ix-ask-menu" role="menu" hidden>
340
+ <button data-command-id="shell.instructor-ask-runtime" type="button" role="menuitem">Choose terminal AI…</button>
341
+ <button data-command-id="shell.instructor-ask-queue" type="button" role="menuitem">Queue &amp; copy for terminal</button>
329
342
  </div>
330
343
 
331
344
 
@@ -237,7 +237,7 @@
237
237
 
238
238
  function focusFor(el) {
239
239
  if (!el || el === document.body) return null;
240
- var target = el.closest('button, [role="button"], a[href], input, select, textarea');
240
+ var target = el.closest('button, [role="button"], [role="treeitem"], a[href], input, select, textarea');
241
241
  if (!target) return null;
242
242
 
243
243
  var tip = target.getAttribute('data-tip') || '';
@@ -279,10 +279,11 @@
279
279
  The only place that touches the DOM. Paints exactly what the producer
280
280
  returned; authors nothing. */
281
281
 
282
- var $band, $chip, $parts, $ask, $toggle;
282
+ var $band, $chip, $parts, $ask, $askQueue, $askSplit, $askOptions, $askMenu, $toggle;
283
283
  var snapshot = { surface: 'shell', workflow: null, workspace: null, focus: null, child: null };
284
284
  var collapsed = false;
285
285
  var enabled = true;
286
+ var directAskAvailable = false;
286
287
 
287
288
  function seg(cls, text) {
288
289
  var el = document.createElement('span');
@@ -309,8 +310,12 @@
309
310
  $parts.appendChild(seg(i === 0 ? 'ix-val' : 'ix-seg', part));
310
311
  });
311
312
 
312
- $ask.hidden = !g.ask;
313
- if (g.ask) $ask.dataset.subject = g.ask;
313
+ $askSplit.hidden = !g.ask || !directAskAvailable;
314
+ $askQueue.hidden = !g.ask || directAskAvailable;
315
+ if (g.ask) {
316
+ $ask.dataset.subject = g.ask;
317
+ $askQueue.dataset.subject = g.ask;
318
+ }
314
319
  }
315
320
 
316
321
  function setCollapsed(next) {
@@ -531,7 +536,7 @@
531
536
  'In the Narrative panel', 'In the node Inspect panel', 'In the Instructor strip',
532
537
  'In the ≡ menu', 'In the footer',
533
538
  'In the contract editor', 'In the report viewer', 'In the guide',
534
- 'In the agent library', 'In the requests list', 'In the Routines dialog',
539
+ 'In the agent library', 'In the requests list', 'In the run request dialog', 'In the Routines dialog',
535
540
  'In the Report an issue dialog', 'In the Build an agent dialog', 'In the Bake dialog',
536
541
  'In the FloLess dialogs',
537
542
  /* the steel editor — read top-left down, then the menus, then the dialogs.
@@ -765,7 +770,7 @@
765
770
  live.focus();
766
771
  /* FALLS THROUGH when the control cannot be described, rather than returning.
767
772
  focusFor() resolves upward through
768
- `closest('button, [role="button"], a[href], input, select, textarea')`, and
773
+ `closest('button, [role="button"], [role="treeitem"], a[href], input, select, textarea')`, and
769
774
  three registered commands carry their id on a <label> whose <input> is a
770
775
  DESCENDANT — filter.match-on and vector.show-kind — so the walk finds
771
776
  nothing and it returns null. (That shape is deliberate: the id sits on the
@@ -1078,7 +1083,11 @@
1078
1083
  if (!$band) return;
1079
1084
  $chip = $band.querySelector('.ix-chip');
1080
1085
  $parts = $band.querySelector('.ix-parts');
1081
- $ask = $band.querySelector('.ix-ask');
1086
+ $ask = $band.querySelector('.ix-ask-main');
1087
+ $askQueue = $band.querySelector('.ix-ask-queue');
1088
+ $askSplit = $band.querySelector('.ix-ask-split');
1089
+ $askOptions = document.getElementById('ix-ask-options');
1090
+ $askMenu = document.getElementById('ix-ask-menu');
1082
1091
  $toggle = $band.querySelector('.ix-toggle');
1083
1092
 
1084
1093
  // Default ON: only the literal '0' turns it off, so a brand-new user (no key
@@ -1091,39 +1100,113 @@
1091
1100
 
1092
1101
  $toggle.addEventListener('click', function () { setCollapsed(!collapsed); });
1093
1102
 
1094
- $ask.addEventListener('click', async function () {
1095
- if ($ask.getAttribute('aria-busy') === 'true') return;
1096
- var bridge = window.flolessBridge;
1097
- if (!bridge || typeof bridge.requestInstructorHelp !== 'function') return;
1098
-
1099
- // Capture the producer's complete answer at click time. Duplicate labels are common, so the
1100
- // terminal AI gets the resolved command/instance and every visible fact, not a label-only ask.
1103
+ function currentAskContext(subjectButton) {
1101
1104
  var g = guidanceFor(snapshot);
1102
1105
  if (g.tone === 'silent' && g.fallback) g = g.fallback;
1103
- var context = {
1104
- subject: g.ask || g.chip || $ask.dataset.subject || 'this FloLess context',
1106
+ return {
1107
+ subject: g.ask || g.chip || subjectButton.dataset.subject || 'this FloLess context',
1105
1108
  commandId: g.commandId || undefined,
1106
1109
  instance: g.instance || undefined,
1107
1110
  tone: g.tone,
1108
1111
  facts: g.parts.slice(),
1109
1112
  surface: g.surface || snapshot.surface || 'shell',
1110
1113
  };
1111
- var idleLabel = $ask.textContent;
1112
- $ask.setAttribute('aria-busy', 'true');
1113
- $ask.setAttribute('data-blocked-reason', 'Sending this request…');
1114
- $ask.disabled = true;
1115
- $ask.textContent = 'Sending…';
1114
+ }
1115
+
1116
+ var askBusy = false;
1117
+ async function withAskBusy(button, label, action) {
1118
+ if (askBusy) return;
1119
+ var bridge = window.flolessBridge;
1120
+ if (!bridge || typeof bridge.requestInstructorHelp !== 'function') return;
1121
+ var context = currentAskContext(button);
1122
+ var idleLabel = button.textContent;
1123
+ var askControls = [$ask, $askQueue, $askOptions].concat(Array.from($askMenu.querySelectorAll('button')));
1124
+ var priorDisabled = askControls.map(function (control) { return !!control.disabled; });
1125
+ askBusy = true;
1126
+ askControls.forEach(function (control) { control.disabled = true; });
1127
+ button.setAttribute('aria-busy', 'true');
1128
+ button.setAttribute('data-blocked-reason', 'Starting this request…');
1129
+ button.disabled = true;
1130
+ button.textContent = label;
1116
1131
  try {
1117
- await bridge.requestInstructorHelp(context);
1132
+ await action(bridge, context);
1118
1133
  } finally {
1119
- $ask.disabled = false;
1120
- $ask.removeAttribute('aria-busy');
1121
- $ask.removeAttribute('data-blocked-reason');
1122
- $ask.textContent = idleLabel;
1123
- try { $ask.focus(); } catch (e) { /* focus restoration is best-effort */ }
1134
+ askControls.forEach(function (control, index) { control.disabled = priorDisabled[index]; });
1135
+ askBusy = false;
1136
+ button.removeAttribute('aria-busy');
1137
+ button.removeAttribute('data-blocked-reason');
1138
+ button.textContent = idleLabel;
1139
+ try { button.focus(); } catch (e) { /* focus restoration is best-effort */ }
1124
1140
  }
1141
+ }
1142
+
1143
+ $ask.addEventListener('click', function () {
1144
+ return withAskBusy($ask, 'Starting…', function (bridge, context) {
1145
+ return bridge.requestInstructorHelp(context, { mode: 'direct' });
1146
+ });
1147
+ });
1148
+ $askQueue.addEventListener('click', function () {
1149
+ return withAskBusy($askQueue, 'Sending…', function (bridge, context) {
1150
+ return bridge.requestInstructorHelp(context, { mode: 'queue' });
1151
+ });
1125
1152
  });
1126
1153
 
1154
+ function closeAskMenu(restore) {
1155
+ $askMenu.hidden = true;
1156
+ $askOptions.setAttribute('aria-expanded', 'false');
1157
+ if (restore) $askOptions.focus();
1158
+ }
1159
+ function openAskMenu() {
1160
+ if (askBusy) return;
1161
+ var rect = $askOptions.getBoundingClientRect();
1162
+ $askMenu.hidden = false;
1163
+ $askMenu.style.left = Math.max(8, rect.right - $askMenu.offsetWidth) + 'px';
1164
+ $askMenu.style.top = Math.max(8, rect.top - $askMenu.offsetHeight - 5) + 'px';
1165
+ $askOptions.setAttribute('aria-expanded', 'true');
1166
+ $askMenu.querySelector('button').focus();
1167
+ }
1168
+ $askOptions.addEventListener('click', function () { $askMenu.hidden ? openAskMenu() : closeAskMenu(true); });
1169
+ $askOptions.addEventListener('keydown', function (e) {
1170
+ if (e.key === 'ArrowDown') { e.preventDefault(); openAskMenu(); }
1171
+ });
1172
+ $askMenu.addEventListener('keydown', function (e) {
1173
+ var items = Array.from($askMenu.querySelectorAll('button'));
1174
+ var at = items.indexOf(document.activeElement);
1175
+ if (e.key === 'Escape') { e.preventDefault(); closeAskMenu(true); }
1176
+ else if (e.key === 'Tab') closeAskMenu(false);
1177
+ else if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
1178
+ e.preventDefault();
1179
+ items[(at + (e.key === 'ArrowDown' ? 1 : -1) + items.length) % items.length].focus();
1180
+ } else if (e.key === 'Home' || e.key === 'End') {
1181
+ e.preventDefault(); items[e.key === 'Home' ? 0 : items.length - 1].focus();
1182
+ }
1183
+ });
1184
+ document.addEventListener('pointerdown', function (e) {
1185
+ if (!$askMenu.hidden && !$askMenu.contains(e.target) && e.target !== $askOptions) closeAskMenu(false);
1186
+ }, true);
1187
+ $askMenu.querySelector('[data-command-id="shell.instructor-ask-runtime"]').addEventListener('click', function () {
1188
+ var context = currentAskContext($ask);
1189
+ closeAskMenu(true);
1190
+ var bridge = window.flolessBridge;
1191
+ if (bridge && typeof bridge.chooseInstructorRuntime === 'function') bridge.chooseInstructorRuntime(context);
1192
+ });
1193
+ $askMenu.querySelector('[data-command-id="shell.instructor-ask-queue"]').addEventListener('click', function (event) {
1194
+ var item = event.currentTarget;
1195
+ closeAskMenu(false);
1196
+ return Promise.resolve(withAskBusy(item, 'Sending…', function (bridge, context) {
1197
+ return bridge.requestInstructorHelp(context, { mode: 'queue' });
1198
+ })).finally(function () { try { $askOptions.focus(); } catch (e) { /* best-effort */ } });
1199
+ });
1200
+
1201
+ var askBridge = window.flolessBridge;
1202
+ if (askBridge && typeof askBridge.instructorAskOptions === 'function') {
1203
+ askBridge.instructorAskOptions().then(function (options) {
1204
+ var enhance = function () { directAskAvailable = !!(options && options.found && options.found.length); paint(); };
1205
+ if (document.activeElement === $askQueue) $askQueue.addEventListener('blur', enhance, { once: true });
1206
+ else enhance();
1207
+ }).catch(function () { directAskAvailable = false; paint(); });
1208
+ }
1209
+
1127
1210
  document.addEventListener('mouseover', function (e) {
1128
1211
  var t = e.target instanceof Element ? e.target : null;
1129
1212
  if (t) { lastHovered = t; lastHoveredAt = Date.now(); }