synabun 2.4.3 → 2.4.5

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 (177) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +1 -1
  3. package/docs/browser-extension-bridge.md +66 -36
  4. package/docs/whatsapp.md +3 -3
  5. package/mcp-server/dist/http.d.ts.map +1 -1
  6. package/mcp-server/dist/http.js +8 -1
  7. package/mcp-server/dist/http.js.map +1 -1
  8. package/mcp-server/dist/services/identity.d.ts +2 -0
  9. package/mcp-server/dist/services/identity.d.ts.map +1 -1
  10. package/mcp-server/dist/services/identity.js +4 -0
  11. package/mcp-server/dist/services/identity.js.map +1 -1
  12. package/mcp-server/dist/services/memory-client.d.ts +5 -0
  13. package/mcp-server/dist/services/memory-client.d.ts.map +1 -1
  14. package/mcp-server/dist/services/memory-client.js +21 -2
  15. package/mcp-server/dist/services/memory-client.js.map +1 -1
  16. package/mcp-server/dist/services/memory-writer.d.ts +3 -0
  17. package/mcp-server/dist/services/memory-writer.d.ts.map +1 -1
  18. package/mcp-server/dist/services/memory-writer.js +7 -1
  19. package/mcp-server/dist/services/memory-writer.js.map +1 -1
  20. package/mcp-server/dist/services/neural-interface.d.ts +12 -1
  21. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  22. package/mcp-server/dist/services/neural-interface.js +68 -17
  23. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  24. package/mcp-server/dist/services/typesafe-config.d.ts +38 -2
  25. package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -1
  26. package/mcp-server/dist/services/typesafe-config.js +260 -8
  27. package/mcp-server/dist/services/typesafe-config.js.map +1 -1
  28. package/mcp-server/dist/tools/agent-definition.d.ts +2 -2
  29. package/mcp-server/dist/tools/agents.d.ts +19 -4
  30. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  31. package/mcp-server/dist/tools/agents.js +85 -17
  32. package/mcp-server/dist/tools/agents.js.map +1 -1
  33. package/mcp-server/dist/tools/browser-observe.d.ts +11 -0
  34. package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
  35. package/mcp-server/dist/tools/browser-observe.js +113 -27
  36. package/mcp-server/dist/tools/browser-observe.js.map +1 -1
  37. package/mcp-server/dist/tools/browser-readers.d.ts +6 -0
  38. package/mcp-server/dist/tools/browser-readers.d.ts.map +1 -0
  39. package/mcp-server/dist/tools/browser-readers.js +17 -0
  40. package/mcp-server/dist/tools/browser-readers.js.map +1 -0
  41. package/mcp-server/dist/tools/remember.d.ts.map +1 -1
  42. package/mcp-server/dist/tools/remember.js +6 -2
  43. package/mcp-server/dist/tools/remember.js.map +1 -1
  44. package/mcp-server/dist/tools/youtube/analytics.d.ts +4 -0
  45. package/mcp-server/dist/tools/youtube/analytics.d.ts.map +1 -1
  46. package/mcp-server/dist/tools/youtube/analytics.js +25 -20
  47. package/mcp-server/dist/tools/youtube/analytics.js.map +1 -1
  48. package/mcp-server/dist/tools/youtube/helpers.d.ts +5 -1
  49. package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
  50. package/mcp-server/dist/tools/youtube/helpers.js +7 -3
  51. package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
  52. package/mcp-server/dist/tools/youtube/navigate.d.ts +2 -0
  53. package/mcp-server/dist/tools/youtube/navigate.d.ts.map +1 -1
  54. package/mcp-server/dist/tools/youtube/navigate.js +5 -3
  55. package/mcp-server/dist/tools/youtube/navigate.js.map +1 -1
  56. package/mcp-server/dist/tools/youtube/playlist.js +2 -2
  57. package/mcp-server/dist/tools/youtube/playlist.js.map +1 -1
  58. package/mcp-server/dist/tools/youtube/readers.d.ts +4 -0
  59. package/mcp-server/dist/tools/youtube/readers.d.ts.map +1 -0
  60. package/mcp-server/dist/tools/youtube/readers.js +15 -0
  61. package/mcp-server/dist/tools/youtube/readers.js.map +1 -0
  62. package/mcp-server/package-lock.json +2 -2
  63. package/mcp-server/package.json +1 -1
  64. package/mcp-server/src/http.ts +8 -1
  65. package/mcp-server/src/services/identity.ts +5 -0
  66. package/mcp-server/src/services/memory-client.ts +32 -12
  67. package/mcp-server/src/services/memory-writer.ts +5 -2
  68. package/mcp-server/src/services/neural-interface.ts +67 -19
  69. package/mcp-server/src/services/typesafe-config.ts +268 -7
  70. package/mcp-server/src/tools/agents.ts +79 -17
  71. package/mcp-server/src/tools/browser-observe.ts +117 -28
  72. package/mcp-server/src/tools/browser-readers.ts +19 -0
  73. package/mcp-server/src/tools/remember.ts +6 -1
  74. package/mcp-server/src/tools/youtube/analytics.ts +26 -28
  75. package/mcp-server/src/tools/youtube/helpers.ts +8 -2
  76. package/mcp-server/src/tools/youtube/navigate.ts +6 -7
  77. package/mcp-server/src/tools/youtube/playlist.ts +2 -2
  78. package/mcp-server/src/tools/youtube/readers.ts +15 -0
  79. package/neural-interface/i18n/en.json +487 -8
  80. package/neural-interface/i18n/pt-BR.json +487 -8
  81. package/neural-interface/lib/agents-studio-api.js +7 -2
  82. package/neural-interface/lib/antigravity/home.js +43 -8
  83. package/neural-interface/lib/antigravity/tool-call.js +14 -0
  84. package/neural-interface/lib/assistant-api.js +90 -0
  85. package/neural-interface/lib/assistant-brains/antigravity.js +4 -2
  86. package/neural-interface/lib/assistant-brains/claude.js +10 -0
  87. package/neural-interface/lib/assistant-dispatch.js +276 -42
  88. package/neural-interface/lib/assistant-memory.js +3 -1
  89. package/neural-interface/lib/assistant-persona.js +14 -3
  90. package/neural-interface/lib/assistant-route-gate.js +11 -2
  91. package/neural-interface/lib/assistant-router.js +18 -8
  92. package/neural-interface/lib/assistant-runtime.js +103 -6
  93. package/neural-interface/lib/assistant-spilled-output.js +53 -0
  94. package/neural-interface/lib/assistant-task-prompt.js +15 -2
  95. package/neural-interface/lib/browser-connection-state.js +20 -0
  96. package/neural-interface/lib/browser-default.js +22 -2
  97. package/neural-interface/lib/browser-extension-adapter.js +221 -15
  98. package/neural-interface/lib/browser-extension-bridge.js +89 -9
  99. package/neural-interface/lib/browser-extension-folder.js +50 -11
  100. package/neural-interface/lib/browser-extension-package.js +6 -5
  101. package/neural-interface/lib/browser-extension-pin.json +15 -13
  102. package/neural-interface/lib/browser-extension-protocol.js +141 -14
  103. package/neural-interface/lib/browser-extension-setup.js +210 -40
  104. package/neural-interface/lib/browser-extension-update.js +104 -0
  105. package/neural-interface/lib/browser-extraction.js +38 -14
  106. package/neural-interface/lib/claude-bg-tasks.js +183 -0
  107. package/neural-interface/lib/claude-history.js +12 -1
  108. package/neural-interface/lib/confined-fs.js +25 -0
  109. package/neural-interface/lib/coordination/operations.js +2 -0
  110. package/neural-interface/lib/db.js +39 -16
  111. package/neural-interface/lib/editor-completion-opencode.js +2 -2
  112. package/neural-interface/lib/git-bash/manager.js +28 -3
  113. package/neural-interface/lib/git-status-runner.js +31 -3
  114. package/neural-interface/lib/loop-inventory.js +162 -0
  115. package/neural-interface/lib/loop-stall.js +74 -4
  116. package/neural-interface/lib/memory-session-capture.js +157 -66
  117. package/neural-interface/lib/native-loop-providers.js +73 -13
  118. package/neural-interface/lib/native-loop-runtime.js +3 -0
  119. package/neural-interface/lib/opencode-protocol.js +4 -2
  120. package/neural-interface/lib/peer-identity.js +62 -16
  121. package/neural-interface/lib/remote-policy.js +24 -7
  122. package/neural-interface/lib/session-cache-builder.js +66 -18
  123. package/neural-interface/lib/session-capture-gate.js +42 -0
  124. package/neural-interface/lib/session-indexer.js +28 -20
  125. package/neural-interface/lib/teams/README.md +22 -1
  126. package/neural-interface/lib/teams/api.js +79 -6
  127. package/neural-interface/lib/teams/index.js +2 -0
  128. package/neural-interface/lib/teams/recovery.js +68 -0
  129. package/neural-interface/lib/teams/scheduler.js +352 -31
  130. package/neural-interface/lib/teams/worktrees.js +123 -30
  131. package/neural-interface/lib/ui-blob-api.js +14 -5
  132. package/neural-interface/lib/ui-blob-store.js +302 -39
  133. package/neural-interface/package-lock.json +2 -2
  134. package/neural-interface/package.json +1 -1
  135. package/neural-interface/public/extension-setup.html +7 -2
  136. package/neural-interface/public/shared/agents/studio/ax-api.js +16 -0
  137. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +318 -13
  138. package/neural-interface/public/shared/agents/studio/ax-teams.js +141 -9
  139. package/neural-interface/public/shared/assistant/asst-agents-dock.js +4 -0
  140. package/neural-interface/public/shared/assistant/asst-api.js +42 -0
  141. package/neural-interface/public/shared/assistant/asst-composer.js +85 -12
  142. package/neural-interface/public/shared/assistant/asst-panel.js +285 -10
  143. package/neural-interface/public/shared/assistant/asst-render.js +205 -4
  144. package/neural-interface/public/shared/assistant/asst-scenes.js +12 -0
  145. package/neural-interface/public/shared/assistant/asst-sidepanel.js +18 -1
  146. package/neural-interface/public/shared/assistant/asst-state.js +241 -2
  147. package/neural-interface/public/shared/assistant/asst-steer.js +294 -0
  148. package/neural-interface/public/shared/assistant/asst-styles.js +20 -0
  149. package/neural-interface/public/shared/bg-tasks/bg-tasks-claude.js +147 -0
  150. package/neural-interface/public/shared/bg-tasks/bg-tasks-model.js +527 -0
  151. package/neural-interface/public/shared/bg-tasks/bg-tasks-panel.js +161 -0
  152. package/neural-interface/public/shared/bg-tasks/bg-tasks-view.js +508 -0
  153. package/neural-interface/public/shared/browser-extension-updates.js +90 -0
  154. package/neural-interface/public/shared/cp/cp-bg-tasks.js +130 -0
  155. package/neural-interface/public/shared/extension-setup/es-page.js +41 -15
  156. package/neural-interface/public/shared/extension-setup/es-view.js +51 -11
  157. package/neural-interface/public/shared/extension-update-view.js +34 -0
  158. package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-logic.js +8 -4
  159. package/neural-interface/public/shared/settings/settings-ai-browser.js +23 -3
  160. package/neural-interface/public/shared/settings/settings-browser-extension.js +581 -197
  161. package/neural-interface/public/shared/settings/settings-extension-diagrams.js +116 -0
  162. package/neural-interface/public/shared/settings/settings-extension-guide.js +222 -0
  163. package/neural-interface/public/shared/settings/settings-extension-update.js +114 -0
  164. package/neural-interface/public/shared/settings/settings-ia.js +2 -2
  165. package/neural-interface/public/shared/settings/settings-shell.js +5 -0
  166. package/neural-interface/public/shared/styles.css +200 -13
  167. package/neural-interface/public/shared/ui-claude-panel.js +110 -1
  168. package/neural-interface/public/shared/ui-notifications.js +23 -4
  169. package/neural-interface/public/shared/ui-settings-entry.js +6 -0
  170. package/neural-interface/public/shared/ui-settings.js +48 -11
  171. package/neural-interface/public/shared/ui-tray-columns.js +9 -2
  172. package/neural-interface/public/shared/worker-end.js +18 -0
  173. package/neural-interface/scripts/patch-node-pty.mjs +151 -0
  174. package/neural-interface/scripts/rebuild-pty.js +10 -0
  175. package/neural-interface/server.js +503 -281
  176. package/npm-shrinkwrap.json +2 -2
  177. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { extensionSettingsHTML, wireExtensionSettings } from './settings/settings-browser-extension.js';
1
+ import { extensionGuideHTML, extensionSettingsHTML, wireExtensionSettings } from './settings/settings-browser-extension.js';
2
2
  import { fetchToolCatalog } from './agent-runtime-options.js';
3
3
  import { reloadAfterRestore } from './server-back.js';
4
4
  import { configureToolPickerTranslation, toolPickerHTML, readToolPicker, toolWord, toolServersNote } from './tool-list-picker.js';
@@ -28,7 +28,7 @@ import { cliInstallText, setCliInstallTranslator } from './cli-install-view.js';
28
28
  import { dropdownHTML, wireDropdowns, setDropdownItems, setDropdownValue } from './cc-dropdown.js';
29
29
  import { PROXY_TYPES, isLocalProfile, proxySummary, defaultCreateWhere, isPlanLimit, formOfProfile, readLocalProfileForm, proxyOfForm, createAction, whereOptions, passwordNeededAgain } from './settings/settings-local-profiles.js';
30
30
  import { startLimitNotes, closedOutsideNotes } from './settings/settings-morelogin-cooldown.js';
31
- import { AI_BROWSER_EVENT, LOCAL_CONNECT_OPTIONS, LOCAL_DEFAULT_MODE, aiBrowserOf, aiBrowserOfStatus, localConnectModeOf, browserSaveFields, switchRequest, pickRequest, aiBrowserLine, profileOf, aiBrowserDetail } from './settings/settings-ai-browser.js';
31
+ import { AI_BROWSER_EVENT, CONNECT_MENU_OPTIONS, LOCAL_CONNECT_OPTIONS, LOCAL_DEFAULT_MODE, connectionParts, aiBrowserOf, aiBrowserOfStatus, localConnectModeOf, browserSaveFields, switchRequest, pickRequest, aiBrowserLine, profileOf, aiBrowserDetail } from './settings/settings-ai-browser.js';
32
32
  import { IFACE_DEFAULTS, loadIfaceConfig, saveIfaceConfig, applyIfaceConfig, restoreInterfaceConfig, loadSkinStylesheet, removeSkinStylesheet, restoreSkin, setSkinsTabRefresher } from './iface-config.js';
33
33
  // The interface config and the skin, for the modules that import them from here.
34
34
  export { loadIfaceConfig, saveIfaceConfig, applyIfaceConfig, restoreInterfaceConfig, restoreSkin };
@@ -649,18 +649,29 @@ function buildBrowserTab(ownerAccess = null) {
649
649
 
650
650
  return `
651
651
  <div class="stg-pane" data-stg-pane="browser">
652
+ ${extensionGuideHTML()}
652
653
 
653
654
  ${kit.card({
654
655
  id: 'setup-browser', section: 'browser.browser_choice',
655
656
  body: `
657
+ ${/* Connection mode first (the design handoff of 2026-11-27): what follows depends on it. The third choice
658
+ only points to Connected tools; it never turns a profile on (settings-ai-browser.js connectionParts). */''}
659
+ ${kit.field('BRW011', `${dd('BRW011', 'bc-connectMode', 'connect', CONNECT_MENU_OPTIONS)}
660
+ <div class="stg-help" id="bc-connectMode-ai-note" style="display:none">${b('aiBrowser.connectionNote')}</div>`)}
656
661
  <div class="stg-field" id="bc-ai-browser-row" style="display:none">
657
662
  <div class="stg-action-row" style="align-items:center;flex-wrap:wrap;gap:8px">
658
663
  <span class="stg-inline-status" id="bc-ai-browser-text" role="status" aria-live="polite"></span>
659
664
  <button type="button" class="stg-action-btn compact" id="bc-ai-browser-open">${b('aiBrowser.open')}</button>
660
665
  </div>
661
666
  </div>
662
- ${kit.field('BRW003', `<div class="bc-inline-group">${dd('BRW003', 'bc-browser', 'browser', ['auto', 'chrome', 'msedge', 'chromium', 'custom'], { attrs: 'id="bc-browser-dropdown"' })}<input type="hidden" id="bc-channel" value=""></div>`)}
663
- <div class="stg-field bc-card-row" id="bcg-executable" ${kit.inv('BRW001')}>
667
+ <div class="stg-field bc-connection-profile" id="bc-connection-profile" hidden>
668
+ <p class="bc-connection-profile-title">${b('connection.profileTitle')}</p>
669
+ <p class="stg-help">${b('connection.profileHelp')}</p>
670
+ <div class="stg-action-row"><button type="button" class="stg-action-btn compact" id="bc-connection-profile-open">${b('connection.open')}</button></div>
671
+ </div>
672
+ ${extensionSettingsHTML(kit)}
673
+ ${kit.field('BRW003', `<div class="bc-inline-group">${dd('BRW003', 'bc-browser', 'browser', ['auto', 'chrome', 'msedge', 'chromium', 'custom'], { attrs: 'id="bc-browser-dropdown"' })}<input type="hidden" id="bc-channel" value=""></div>`, { attrs: 'id="bcg-browser-row" data-local-only="true"' })}
674
+ <div class="stg-field bc-card-row" id="bcg-executable" data-local-only="true" ${kit.inv('BRW001')}>
664
675
  <label for="bc-executablePath">${kit.L('BRW001')}</label>
665
676
  <div class="browser-cfg-input-row">
666
677
  ${text('bc-executablePath', { ph: b('ph.autoDetect') })}
@@ -687,9 +698,6 @@ function buildBrowserTab(ownerAccess = null) {
687
698
  id: 'bcg-profiles', section: 'browser.browser_profiles',
688
699
  body: `
689
700
  <input type="hidden" id="bc-userDataDir" value="">
690
- ${kit.field('BRW011', `${dd('BRW011', 'bc-connectMode', 'connect', LOCAL_CONNECT_OPTIONS)}
691
- <div class="stg-help" id="bc-connectMode-ai-note" style="display:none">${b('aiBrowser.connectionNote')}</div>`)}
692
- ${extensionSettingsHTML(kit)}
693
701
  ${kit.field('BRW012', dd('BRW012', 'bc-attachSeed', 'seed', ['real', 'fresh']), { attrs: 'id="bc-attachSeed-row" style="display:none"' })}
694
702
  <div class="stg-field bc-card-row" ${kit.inv('BRW083')}>
695
703
  <label id="bc-profile-list-label">${kit.L('BRW083')}</label>
@@ -6676,13 +6684,36 @@ async function openSettingsModalNow(options = {}) {
6676
6684
  if (row) row.style.display = on ? '' : 'none';
6677
6685
  const text = overlay.querySelector('#bc-ai-browser-text');
6678
6686
  if (text) text.textContent = on ? kit.tx(`settings.redesign.browser.aiBrowser.${line.key}`, line.params) : '';
6679
- // The Connection field is the local browser's mode: not in use while a profile is the AI browser.
6687
+ // The Connection field shows the profile, disabled, while a profile is the AI browser; the local mode the form
6688
+ // held comes back when it is turned off (in Connected tools: never from here).
6680
6689
  const mode = overlay.querySelector('#bc-connectMode');
6681
- if (mode) mode.disabled = on;
6690
+ if (mode) {
6691
+ if (on && mode.value !== 'morelogin') { _localMode = mode.value || _localMode; mode.value = 'morelogin'; }
6692
+ else if (!on && mode.value === 'morelogin' && mode.disabled) mode.value = _localMode;
6693
+ mode.disabled = on;
6694
+ }
6682
6695
  const note = overlay.querySelector('#bc-connectMode-ai-note');
6683
6696
  if (note) note.style.display = on ? '' : 'none';
6684
6697
  syncBcDropdowns();
6698
+ refreshConnectionParts();
6699
+ }
6700
+ // The local mode as the form last held it (a read of the config, or the owner's pick): what a save keeps while the
6701
+ // menu only shows the profile choice.
6702
+ let _localMode = LOCAL_DEFAULT_MODE;
6703
+ /** Connection mode first: the extension card, the local executable rows and the profile notice follow it. */
6704
+ function refreshConnectionParts() {
6705
+ const input = overlay.querySelector('#bc-connectMode');
6706
+ if (!input) return;
6707
+ if (['attach', 'extension', LOCAL_DEFAULT_MODE].includes(input.value)) _localMode = input.value;
6708
+ const parts = connectionParts(input.value, _aiBrowser);
6709
+ overlay.querySelectorAll('[data-local-only="true"]').forEach(row => { row.hidden = !parts.local; });
6710
+ const profile = overlay.querySelector('#bc-connection-profile');
6711
+ if (profile) profile.hidden = !parts.profile;
6685
6712
  }
6713
+ overlay.querySelector('#bc-connection-profile-open')?.addEventListener('click', (e) => {
6714
+ e.preventDefault();
6715
+ applySettingsOpenOptions(overlay, { tab: 'connected-tools', expand: 'stg-sec-ml-default', scrollTo: 'stg-sec-ml-default', highlight: 'stg-sec-ml-default' });
6716
+ }, { signal: panelLife.signal });
6686
6717
  /** The AI browser as last heard: the MoreLogin tab's news (with the profile's name), or a read of the config. */
6687
6718
  function noteAiBrowser(detail) {
6688
6719
  if (!detail || typeof detail !== 'object') return;
@@ -6702,6 +6733,7 @@ async function openSettingsModalNow(options = {}) {
6702
6733
  const mode = overlay.querySelector('#bc-connectMode')?.value || 'mirror';
6703
6734
  const seedRow = overlay.querySelector('#bc-attachSeed-row');
6704
6735
  if (seedRow) seedRow.style.display = mode === 'attach' ? '' : 'none';
6736
+ refreshConnectionParts();
6705
6737
  updateChromeRunningWarning();
6706
6738
  }
6707
6739
  const connectModeDd = overlay.querySelector('.bc-dropdown[data-for="bc-connectMode"]');
@@ -6994,13 +7026,16 @@ async function openSettingsModalNow(options = {}) {
6994
7026
  }
6995
7027
 
6996
7028
  // Collect all config from the form
6997
- const refreshExtensionSettings = wireExtensionSettings(overlay, { tx: kit.tx, signal: panelLife.signal });
7029
+ // Not hydrated: the menu holds its first option ("extension") until GET /api/browser/config answers, and the card
7030
+ // must not show, poll or restore a setup guide for an owner who uses another mode (applyBrowserConfig calls it).
7031
+ const refreshExtensionSettings = wireExtensionSettings(overlay, { tx: kit.tx, signal: panelLife.signal, hydrated: false,
7032
+ revealRequested: (el) => settingsRevealRequested(overlay, el) });
6998
7033
 
6999
7034
  function collectBrowserConfig() {
7000
7035
  const val = (id) => (overlay.querySelector(`#${id}`)?.value || '').trim();
7001
7036
  const num = (id, def) => { const v = parseInt(val(id), 10); return isNaN(v) ? def : v; };
7002
7037
  const numF = (id, def) => { const v = parseFloat(val(id)); return isNaN(v) ? def : v; };
7003
- const connection = browserSaveFields(val('bc-connectMode'), _aiBrowser);
7038
+ const connection = browserSaveFields(val('bc-connectMode'), _aiBrowser, _localMode);
7004
7039
 
7005
7040
  // Permissions
7006
7041
  const permissions = [];
@@ -7130,6 +7165,8 @@ async function openSettingsModalNow(options = {}) {
7130
7165
  setVal('bc-browser', cfg.browser && cfg.browser !== 'morelogin' ? cfg.browser : 'auto');
7131
7166
  setVal('bc-channel', cfg.channel || '');
7132
7167
  setVal('bc-connectMode', localConnectModeOf(cfg));
7168
+ _localMode = localConnectModeOf(cfg);
7169
+ refreshConnectionParts();
7133
7170
  refreshExtensionSettings?.();
7134
7171
  setVal('bc-attachSeed', cfg.attachSeed || 'real');
7135
7172
  const _seedRow = overlay.querySelector('#bc-attachSeed-row');
@@ -15,6 +15,12 @@ const STATUS_MARKS = {
15
15
  };
16
16
  const initialized = new WeakSet();
17
17
 
18
+ // How many background tasks (shells, Monitors: the provider-independent registry, bg-tasks/bg-tasks-model.js) a
19
+ // pill's session still runs, written on the pill by the shared "⟳ N" badge (bg-tasks-view.js paintBgBadge). A turn
20
+ // that ended with work still running in the background is not done: its pill stays in Running until the last task
21
+ // ends, is stopped or expires.
22
+ export const BG_RUNNING_ATTR = 'data-bg-running';
23
+
18
24
  export function trayColumnOf(el) {
19
25
  if (el.classList.contains(GROUP)) {
20
26
  let parent = el.previousElementSibling;
@@ -30,7 +36,8 @@ export function trayColumnOf(el) {
30
36
  if (status === 'action' || badgeStatus === 'action' || classes.some(name => /-pill-(attention|waiting)$/.test(name))) {
31
37
  return 'waiting';
32
38
  }
33
- if (status === 'working' || badgeStatus === 'working' || classes.some(name => name.endsWith('-pill-running'))) {
39
+ if (status === 'working' || badgeStatus === 'working' || classes.some(name => name.endsWith('-pill-running')) ||
40
+ Number(el.getAttribute?.(BG_RUNNING_ATTR)) > 0) {
34
41
  return 'running';
35
42
  }
36
43
  return 'done';
@@ -364,7 +371,7 @@ export function initTrayColumns(tray, preferences = globalThis.localStorage) {
364
371
  })) schedule();
365
372
  }).observe(tray, {
366
373
  childList: true, characterData: true, subtree: true, attributes: true, attributeOldValue: true,
367
- attributeFilter: ['class', 'data-status', 'style', 'hidden'],
374
+ attributeFilter: ['class', 'data-status', 'style', 'hidden', BG_RUNNING_ATTR],
368
375
  });
369
376
  if (globalThis.ResizeObserver) {
370
377
  const resize = new ResizeObserver(schedule);
@@ -97,6 +97,21 @@ export function isRunWorking(run, dispatch = null) {
97
97
  return run?.turnState !== 'idle' && run?.turnState !== 'terminal';
98
98
  }
99
99
 
100
+ /**
101
+ * The run's last turn was cut by a steer and the run goes on: it is marked steering, or its last turn ended with the
102
+ * reason 'steered' while the run itself has not ended. A run that ended after all (stopped, failed) is not this.
103
+ */
104
+ export function wasSteered(run, dispatch = null) {
105
+ const ended = TERMINAL.has(String(dispatch?.state || ''))
106
+ || (TERMINAL.has(String(run?.status || '')) && !(dispatch && run?.stoppedReason === 'steered'));
107
+ if (ended) return false;
108
+ const steered = (v) => !!v && typeof v === 'object' && (v.steering === true
109
+ || [v.turnEndReason, v.endReason, v.lastTurn?.reason, v.lastResult?.reason, v.stoppedReason].includes('steered')
110
+ // The dispatcher's record of the cut turn (lib/assistant-dispatch.js: endReason 'steered', result null).
111
+ || (Array.isArray(v.turns) && v.turns.length > 0 && v.turns[v.turns.length - 1]?.endReason === 'steered'));
112
+ return steered(dispatch) || steered(run);
113
+ }
114
+
100
115
  /** The runtime descriptor says the run may have something to show: it ended, or it waits between turns. */
101
116
  export function mayHaveEnded(run) {
102
117
  return TERMINAL.has(String(run?.status || '')) || run?.turnState === 'idle';
@@ -204,6 +219,9 @@ export function workerEndView(run, dispatch = null, { t = fillWorkerEndCopy, bus
204
219
  if (!run && !dispatch) return null;
205
220
  if (!isDispatchedRun(run, dispatch)) return null;
206
221
  if (isRunWorking(run, dispatch)) return null;
222
+ // A turn a steer cut (assistant/asst-steer.js): the steer's turn follows, so nothing ended. Never "Task complete"
223
+ // from the turn before it, never a failure.
224
+ if (wasSteered(run, dispatch)) return null;
207
225
 
208
226
  const state = String(dispatch?.state || '');
209
227
  const status = String(run?.status || '');
@@ -0,0 +1,151 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Durable patch for node-pty's Windows ConPTY console-list helper
5
+ * (lib/conpty_console_list_agent.js).
6
+ *
7
+ * In node-pty 1.1.0, WindowsPtyAgent.kill() forks conpty_console_list_agent.js
8
+ * with inherited stderr. Line 13 calls getConsoleProcessList(shellPid) without
9
+ * a try/catch; during shutdown when the shell console is already gone, Windows
10
+ * returns AttachConsole failure, printing an uncaught exception stack trace to
11
+ * server logs and stalling kill() for 5 seconds until the parent's timeout
12
+ * falls back to [shellPid].
13
+ *
14
+ * Patching the helper makes it catch the error and immediately send [shellPid]
15
+ * back over IPC with zero stderr noise and zero 5 s delay.
16
+ *
17
+ * Applied automatically by:
18
+ * - neural-interface/scripts/rebuild-pty.js (postinstall for dev & npm i -g)
19
+ * - packaging/lib/stage.mjs prepareNatives() (packaged desktop builds)
20
+ * Verified by:
21
+ * - packaging/lib/verify.mjs auditBundle() (Windows bundles)
22
+ */
23
+
24
+ import { createHash } from 'node:crypto';
25
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
26
+ import { dirname, join, resolve } from 'node:path';
27
+ import { fileURLToPath, pathToFileURL } from 'node:url';
28
+
29
+ export const PATCH_MARKER = '// synabun-patch: conpty-attach-console-fallback';
30
+ export const CONPTY_AGENT_REL = join('lib', 'conpty_console_list_agent.js');
31
+
32
+ // Exact SHA-256 of upstream node-pty@1.1.0 lib/conpty_console_list_agent.js (LF-normalized).
33
+ export const UPSTREAM_AGENT_SHA256 = '0d010879bb6680a0253d44363183d53e631f42972594eb6dcb1fb842c8c85e52';
34
+
35
+ const normalizeEol = (source) => String(source ?? '').replace(/\r\n/g, '\n');
36
+ const sha256 = (text) => createHash('sha256').update(text, 'utf8').digest('hex');
37
+
38
+ export const PATCHED_AGENT_SOURCE = `"use strict";
39
+ ${PATCH_MARKER}
40
+ /**
41
+ * Copyright (c) 2019, Microsoft Corporation (MIT License).
42
+ *
43
+ * This module fetches the console process list for a particular PID. It must be
44
+ * called from a different process (child_process.fork) as there can only be a
45
+ * single console attached to a process.
46
+ *
47
+ * Patched by SynaBun: catch AttachConsole failures during shutdown and fall
48
+ * back immediately to [shellPid] instead of crashing with stderr noise and
49
+ * waiting for the parent's 5 s timeout.
50
+ */
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ var utils_1 = require("./utils");
53
+ var shellPid = parseInt(process.argv[2], 10);
54
+ var fallbackList = Number.isInteger(shellPid) && shellPid > 0 ? [shellPid] : [];
55
+ var consoleProcessList = fallbackList;
56
+ try {
57
+ var getConsoleProcessList = utils_1.loadNativeModule('conpty_console_list').module.getConsoleProcessList;
58
+ var list = getConsoleProcessList(shellPid);
59
+ if (Array.isArray(list)) {
60
+ consoleProcessList = list;
61
+ }
62
+ }
63
+ catch (_err) {
64
+ consoleProcessList = fallbackList;
65
+ }
66
+ if (typeof process.send === 'function') {
67
+ try {
68
+ process.send({ consoleProcessList: consoleProcessList }, function () {
69
+ process.exit(0);
70
+ });
71
+ }
72
+ catch (_err) {
73
+ process.exit(0);
74
+ }
75
+ }
76
+ else {
77
+ process.exit(0);
78
+ }
79
+ //# sourceMappingURL=conpty_console_list_agent.js.map
80
+ `;
81
+
82
+ export const PATCHED_AGENT_SHA256 = sha256(normalizeEol(PATCHED_AGENT_SOURCE));
83
+
84
+ /** True ONLY when `source` matches the exact patched SynaBun helper content (by SHA-256, never marker alone). */
85
+ export function isConptyConsoleListPatched(source) {
86
+ return typeof source === 'string' && sha256(normalizeEol(source)) === PATCHED_AGENT_SHA256;
87
+ }
88
+
89
+ /**
90
+ * Transform upstream node-pty 1.1.0 conpty_console_list_agent.js by exact SHA-256 hash.
91
+ * Refuses any unrecognized or modified content with a clear reason.
92
+ * Returns { status: 'patched' | 'already-patched' | 'unmatched', changed, content, reason? }.
93
+ */
94
+ export function applyConptyConsoleListPatch(source) {
95
+ const text = String(source ?? '');
96
+ const hash = sha256(normalizeEol(text));
97
+ if (hash === PATCHED_AGENT_SHA256) {
98
+ return { status: 'already-patched', changed: false, content: text };
99
+ }
100
+ if (hash === UPSTREAM_AGENT_SHA256) {
101
+ return { status: 'patched', changed: true, content: PATCHED_AGENT_SOURCE };
102
+ }
103
+ return {
104
+ status: 'unmatched',
105
+ changed: false,
106
+ content: text,
107
+ reason: `conpty_console_list_agent.js sha256 ${hash} matches neither known upstream node-pty 1.1.0 (${UPSTREAM_AGENT_SHA256}) nor exact SynaBun patched helper (${PATCHED_AGENT_SHA256}); refusing to overwrite`,
108
+ };
109
+ }
110
+
111
+ /**
112
+ * Patch `lib/conpty_console_list_agent.js` inside a single `node-pty` package directory.
113
+ * Idempotent; refuses unknown content without overwriting.
114
+ */
115
+ export function patchNodePtyDir(ptyDir, { log = () => {} } = {}) {
116
+ const target = join(ptyDir, CONPTY_AGENT_REL);
117
+ if (!existsSync(target)) {
118
+ return { status: 'missing', path: target, reason: `missing ${target}` };
119
+ }
120
+ const source = readFileSync(target, 'utf8');
121
+ const result = applyConptyConsoleListPatch(source);
122
+ if (result.changed) {
123
+ writeFileSync(target, result.content, 'utf8');
124
+ log(`[patch-node-pty] patched ${target} (AttachConsole fallback)`);
125
+ }
126
+ return { status: result.status, path: target, ...(result.reason ? { reason: result.reason } : {}) };
127
+ }
128
+
129
+ const isMain = process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href;
130
+ if (isMain) {
131
+ const __dirname = dirname(fileURLToPath(import.meta.url));
132
+ const neuralRoot = resolve(__dirname, '..');
133
+ const packageRoot = resolve(neuralRoot, '..');
134
+ const args = process.argv.slice(2);
135
+ const dirs = args.length
136
+ ? args.map(dir => resolve(dir))
137
+ : [...new Set([
138
+ resolve(neuralRoot, 'node_modules', 'node-pty'),
139
+ resolve(packageRoot, 'node_modules', 'node-pty'),
140
+ ])];
141
+ let unmatched = false;
142
+ for (const dir of dirs) {
143
+ const res = patchNodePtyDir(dir, { log: console.log });
144
+ if (res.status === 'already-patched') console.log(`[patch-node-pty] already patched: ${res.path}`);
145
+ else if (res.status === 'unmatched') {
146
+ console.warn(`[patch-node-pty] ${res.reason || `unexpected contents, skipped: ${res.path}`}`);
147
+ unmatched = true;
148
+ }
149
+ }
150
+ if (unmatched) process.exitCode = 1;
151
+ }
@@ -17,6 +17,7 @@ import { fileURLToPath } from 'node:url';
17
17
  import { ensureVendoredExecutables } from '../lib/native-binary-runtime.js';
18
18
  import { pruneExternalTools } from '../../lib/external-tools.js';
19
19
  import { findInstalled } from '../../lib/runtime-dependencies.js';
20
+ import { patchNodePtyDir } from './patch-node-pty.mjs';
20
21
 
21
22
  const __dirname = dirname(fileURLToPath(import.meta.url));
22
23
  const neuralRoot = resolve(__dirname, '..');
@@ -70,6 +71,15 @@ if (!existsSync(ptyDir)) {
70
71
  process.exit(0);
71
72
  }
72
73
 
74
+ // Step 1a-bis: Apply SynaBun's Windows ConPTY AttachConsole fallback patch so
75
+ // shutdown never prints uncaught AttachConsole stack traces or stalls 5 s.
76
+ for (const candidate of new Set([ptyDir, resolve(neuralRoot, 'node_modules', 'node-pty'), resolve(packageRoot, 'node_modules', 'node-pty')])) {
77
+ const patched = patchNodePtyDir(candidate, { log: console.log });
78
+ if (patched.status === 'unmatched') {
79
+ console.warn(`[rebuild-pty] ${patched.reason || `node-pty conpty helper had unexpected contents: ${patched.path}`}`);
80
+ }
81
+ }
82
+
73
83
  // Step 1b: Check if node-pty actually works (spawn test, not just module load)
74
84
  try {
75
85
  const shell = process.platform === 'win32' ? 'cmd.exe' : '/bin/sh';