synabun 2.3.1 → 2.4.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 (356) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +1 -1
  3. package/browser-extension/content.js +169 -0
  4. package/browser-extension/engine.js +477 -0
  5. package/browser-extension/icons/icon-128.png +0 -0
  6. package/browser-extension/icons/icon-16.png +0 -0
  7. package/browser-extension/icons/icon-32.png +0 -0
  8. package/browser-extension/icons/icon-48.png +0 -0
  9. package/browser-extension/icons/status-off-16.png +0 -0
  10. package/browser-extension/icons/status-off-32.png +0 -0
  11. package/browser-extension/icons/status-off-48.png +0 -0
  12. package/browser-extension/icons/status-on-16.png +0 -0
  13. package/browser-extension/icons/status-on-32.png +0 -0
  14. package/browser-extension/icons/status-on-48.png +0 -0
  15. package/browser-extension/manifest.json +56 -0
  16. package/browser-extension/popup-strings.js +244 -0
  17. package/browser-extension/popup-view.js +151 -0
  18. package/browser-extension/popup.css +165 -0
  19. package/browser-extension/popup.html +105 -0
  20. package/browser-extension/popup.js +347 -0
  21. package/browser-extension/protocol.js +226 -0
  22. package/browser-extension/service-worker.js +267 -0
  23. package/browser-extension/setup-content.js +36 -0
  24. package/browser-extension/tokens.css +326 -0
  25. package/docs/browser-extension-bridge.md +84 -0
  26. package/docs/whatsapp.md +1 -1
  27. package/mcp-server/dist/http.d.ts +2 -0
  28. package/mcp-server/dist/http.d.ts.map +1 -1
  29. package/mcp-server/dist/http.js +9 -1
  30. package/mcp-server/dist/http.js.map +1 -1
  31. package/mcp-server/dist/index.d.ts +11 -0
  32. package/mcp-server/dist/index.d.ts.map +1 -1
  33. package/mcp-server/dist/index.js +38 -3
  34. package/mcp-server/dist/index.js.map +1 -1
  35. package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
  36. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
  37. package/mcp-server/dist/services/browser-route-flow.js +10 -3
  38. package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
  39. package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
  40. package/mcp-server/dist/services/codex-config-heal.js +7 -0
  41. package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
  42. package/mcp-server/dist/services/neural-interface.d.ts +94 -3
  43. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  44. package/mcp-server/dist/services/neural-interface.js +168 -23
  45. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  46. package/mcp-server/dist/services/team-context.d.ts +18 -0
  47. package/mcp-server/dist/services/team-context.d.ts.map +1 -0
  48. package/mcp-server/dist/services/team-context.js +29 -0
  49. package/mcp-server/dist/services/team-context.js.map +1 -0
  50. package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
  51. package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
  52. package/mcp-server/dist/services/tool-catalog.js +22 -6
  53. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  54. package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
  55. package/mcp-server/dist/services/tool-list.js +4 -0
  56. package/mcp-server/dist/services/tool-list.js.map +1 -1
  57. package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
  58. package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
  59. package/mcp-server/dist/services/tool-runtime.js +18 -1
  60. package/mcp-server/dist/services/tool-runtime.js.map +1 -1
  61. package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
  62. package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
  63. package/mcp-server/dist/tools/agent-definition.js +483 -0
  64. package/mcp-server/dist/tools/agent-definition.js.map +1 -0
  65. package/mcp-server/dist/tools/agents.d.ts +91 -9
  66. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  67. package/mcp-server/dist/tools/agents.js +161 -20
  68. package/mcp-server/dist/tools/agents.js.map +1 -1
  69. package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
  70. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  71. package/mcp-server/dist/tools/browser-advanced.js +70 -6
  72. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  73. package/mcp-server/dist/tools/git-tools.d.ts +4 -2
  74. package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
  75. package/mcp-server/dist/tools/git-tools.js +283 -2
  76. package/mcp-server/dist/tools/git-tools.js.map +1 -1
  77. package/mcp-server/dist/tools/morelogin.d.ts +8 -2
  78. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  79. package/mcp-server/dist/tools/morelogin.js +22 -5
  80. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  81. package/mcp-server/dist/tools/team.d.ts +32 -0
  82. package/mcp-server/dist/tools/team.d.ts.map +1 -0
  83. package/mcp-server/dist/tools/team.js +87 -0
  84. package/mcp-server/dist/tools/team.js.map +1 -0
  85. package/mcp-server/package-lock.json +2 -2
  86. package/mcp-server/package.json +1 -1
  87. package/mcp-server/src/http.ts +9 -1
  88. package/mcp-server/src/index.ts +34 -4
  89. package/mcp-server/src/services/browser-route-flow.ts +12 -5
  90. package/mcp-server/src/services/codex-config-heal.ts +7 -0
  91. package/mcp-server/src/services/neural-interface.ts +190 -29
  92. package/mcp-server/src/services/team-context.ts +27 -0
  93. package/mcp-server/src/services/tool-catalog.ts +26 -8
  94. package/mcp-server/src/services/tool-list.ts +4 -0
  95. package/mcp-server/src/services/tool-runtime.ts +21 -2
  96. package/mcp-server/src/tools/agent-definition.ts +458 -0
  97. package/mcp-server/src/tools/agents.ts +175 -19
  98. package/mcp-server/src/tools/browser-advanced.ts +60 -6
  99. package/mcp-server/src/tools/git-tools.ts +249 -3
  100. package/mcp-server/src/tools/morelogin.ts +20 -5
  101. package/mcp-server/src/tools/team.ts +97 -0
  102. package/neural-interface/i18n/en.json +1117 -47
  103. package/neural-interface/i18n/pt-BR.json +1117 -47
  104. package/neural-interface/lib/account-usage.js +1 -1
  105. package/neural-interface/lib/agents/density.js +101 -0
  106. package/neural-interface/lib/agents/forge-host.js +223 -0
  107. package/neural-interface/lib/agents/native-export-targets.js +190 -0
  108. package/neural-interface/lib/agents/native-export.js +365 -0
  109. package/neural-interface/lib/agents/registry.js +840 -0
  110. package/neural-interface/lib/agents/resolve.js +544 -0
  111. package/neural-interface/lib/agents/schema.js +642 -0
  112. package/neural-interface/lib/agents/split.js +37 -0
  113. package/neural-interface/lib/agents-studio-api.js +591 -0
  114. package/neural-interface/lib/assistant-api.js +76 -7
  115. package/neural-interface/lib/assistant-catalog.js +2 -0
  116. package/neural-interface/lib/assistant-continuity.js +49 -0
  117. package/neural-interface/lib/assistant-dispatch.js +229 -102
  118. package/neural-interface/lib/assistant-persona.js +105 -8
  119. package/neural-interface/lib/assistant-route-gate.js +24 -9
  120. package/neural-interface/lib/assistant-router.js +384 -42
  121. package/neural-interface/lib/assistant-run-tail.js +151 -0
  122. package/neural-interface/lib/assistant-run-wait.js +183 -0
  123. package/neural-interface/lib/assistant-runtime.js +440 -93
  124. package/neural-interface/lib/assistant-task-prompt.js +11 -2
  125. package/neural-interface/lib/assistant-usage.js +3 -2
  126. package/neural-interface/lib/automation-approval.js +2 -2
  127. package/neural-interface/lib/browser-close-evidence.js +80 -0
  128. package/neural-interface/lib/browser-default.js +210 -0
  129. package/neural-interface/lib/browser-extension-adapter.js +255 -0
  130. package/neural-interface/lib/browser-extension-bridge.js +418 -0
  131. package/neural-interface/lib/browser-extension-folder.js +116 -0
  132. package/neural-interface/lib/browser-extension-setup.js +140 -0
  133. package/neural-interface/lib/browser-profile-choices.js +3 -3
  134. package/neural-interface/lib/browser-tool-policy.js +1 -1
  135. package/neural-interface/lib/claude-account-links.js +301 -0
  136. package/neural-interface/lib/claude-accounts.js +45 -20
  137. package/neural-interface/lib/claude-agent-bridge.js +142 -10
  138. package/neural-interface/lib/claude-model-catalog.js +6 -0
  139. package/neural-interface/lib/claude-panel-session.js +33 -0
  140. package/neural-interface/lib/codex-accounts.js +67 -24
  141. package/neural-interface/lib/coordination/README.md +384 -0
  142. package/neural-interface/lib/coordination/service.js +563 -0
  143. package/neural-interface/lib/coordination/store.js +1138 -0
  144. package/neural-interface/lib/db.js +22 -1
  145. package/neural-interface/lib/effort-levels.js +10 -1
  146. package/neural-interface/lib/memory-list-page.js +49 -0
  147. package/neural-interface/lib/memory-list-stamp.js +60 -0
  148. package/neural-interface/lib/morelogin-outside-close.js +186 -0
  149. package/neural-interface/lib/morelogin-profile-failures.js +206 -0
  150. package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
  151. package/neural-interface/lib/morelogin.js +194 -8
  152. package/neural-interface/lib/native-loop-runtime.js +20 -0
  153. package/neural-interface/lib/opencode-build-preflight.js +16 -1
  154. package/neural-interface/lib/opencode-native-boundary.js +83 -13
  155. package/neural-interface/lib/opencode-serve-records.js +14 -9
  156. package/neural-interface/lib/page-session.js +1 -1
  157. package/neural-interface/lib/peer-identity.js +60 -21
  158. package/neural-interface/lib/process-identity.js +68 -7
  159. package/neural-interface/lib/request-gate.js +3 -0
  160. package/neural-interface/lib/screenshot-location.js +33 -0
  161. package/neural-interface/lib/skills/creation.js +1 -1
  162. package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
  163. package/neural-interface/lib/studio-attention.js +56 -0
  164. package/neural-interface/lib/teams/README.md +382 -0
  165. package/neural-interface/lib/teams/api.js +287 -0
  166. package/neural-interface/lib/teams/brief.js +185 -0
  167. package/neural-interface/lib/teams/claims.js +315 -0
  168. package/neural-interface/lib/teams/git.js +293 -0
  169. package/neural-interface/lib/teams/index.js +122 -0
  170. package/neural-interface/lib/teams/integration.js +580 -0
  171. package/neural-interface/lib/teams/landing.js +184 -0
  172. package/neural-interface/lib/teams/recovery.js +256 -0
  173. package/neural-interface/lib/teams/scheduler.js +1474 -0
  174. package/neural-interface/lib/teams/schema.js +559 -0
  175. package/neural-interface/lib/teams/state.js +181 -0
  176. package/neural-interface/lib/teams/test-runner.js +86 -0
  177. package/neural-interface/lib/teams/test-sandbox.js +99 -0
  178. package/neural-interface/lib/teams/worktrees.js +757 -0
  179. package/neural-interface/lib/tool-permission-choices.js +226 -0
  180. package/neural-interface/lib/whatsapp/cards.js +24 -10
  181. package/neural-interface/lib/worker-confinement.js +206 -6
  182. package/neural-interface/package-lock.json +2 -2
  183. package/neural-interface/package.json +1 -1
  184. package/neural-interface/public/extension-setup.html +107 -0
  185. package/neural-interface/public/index.html +52 -12
  186. package/neural-interface/public/shared/agent-runtime-options.js +3 -1
  187. package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
  188. package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
  189. package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
  190. package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
  191. package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
  192. package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
  193. package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
  194. package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
  195. package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
  196. package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
  197. package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
  198. package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
  199. package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
  200. package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
  201. package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
  202. package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
  203. package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
  204. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
  205. package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
  206. package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
  207. package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
  208. package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
  209. package/neural-interface/public/shared/agy/agy-panel.js +142 -28
  210. package/neural-interface/public/shared/agy/agy-styles.js +25 -5
  211. package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
  212. package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
  213. package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
  214. package/neural-interface/public/shared/assistant/asst-control.js +3 -0
  215. package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
  216. package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
  217. package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
  218. package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
  219. package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
  220. package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
  221. package/neural-interface/public/shared/assistant/asst-render.js +36 -6
  222. package/neural-interface/public/shared/assistant/asst-route.js +78 -12
  223. package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
  224. package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
  225. package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
  226. package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
  227. package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
  228. package/neural-interface/public/shared/assistant/asst-state.js +66 -1
  229. package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
  230. package/neural-interface/public/shared/assistant/route-identity.js +16 -0
  231. package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
  232. package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
  233. package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
  234. package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
  235. package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
  236. package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
  237. package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
  238. package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
  239. package/neural-interface/public/shared/code-copy.js +120 -0
  240. package/neural-interface/public/shared/constants.js +7 -0
  241. package/neural-interface/public/shared/context-menu-model.js +1 -0
  242. package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
  243. package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
  244. package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
  245. package/neural-interface/public/shared/cp/cp-styles.js +9 -0
  246. package/neural-interface/public/shared/dom-change-flag.js +66 -0
  247. package/neural-interface/public/shared/dom-morph.js +124 -0
  248. package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
  249. package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
  250. package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
  251. package/neural-interface/public/shared/html-shell.js +33 -4
  252. package/neural-interface/public/shared/i18n.js +14 -1
  253. package/neural-interface/public/shared/idle-queue.js +78 -0
  254. package/neural-interface/public/shared/iface-config.js +227 -0
  255. package/neural-interface/public/shared/lazy-module.js +108 -0
  256. package/neural-interface/public/shared/memory-list.js +117 -0
  257. package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
  258. package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
  259. package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
  260. package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
  261. package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
  262. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
  263. package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
  264. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
  265. package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
  266. package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
  267. package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
  268. package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
  269. package/neural-interface/public/shared/schedules-view.js +2 -2
  270. package/neural-interface/public/shared/session-project-items.js +11 -0
  271. package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
  272. package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
  273. package/neural-interface/public/shared/settings/settings-ia.js +4 -2
  274. package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
  275. package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
  276. package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
  277. package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
  278. package/neural-interface/public/shared/sidepanel-shown.js +73 -0
  279. package/neural-interface/public/shared/storage.js +6 -1
  280. package/neural-interface/public/shared/studio-attention.js +83 -0
  281. package/neural-interface/public/shared/styles.css +682 -50
  282. package/neural-interface/public/shared/term-browser-tabs.js +34 -0
  283. package/neural-interface/public/shared/transcript-rows.js +334 -0
  284. package/neural-interface/public/shared/tray-auto-close.js +106 -0
  285. package/neural-interface/public/shared/ui-agents.js +97 -0
  286. package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
  287. package/neural-interface/public/shared/ui-automation-studio.js +3 -3
  288. package/neural-interface/public/shared/ui-claude-panel.js +162 -95
  289. package/neural-interface/public/shared/ui-code-copy.js +256 -0
  290. package/neural-interface/public/shared/ui-codex-panel.js +14 -10
  291. package/neural-interface/public/shared/ui-context-menu.js +1 -1
  292. package/neural-interface/public/shared/ui-file-explorer.js +2 -3
  293. package/neural-interface/public/shared/ui-games.js +1 -1
  294. package/neural-interface/public/shared/ui-loading.js +12 -1
  295. package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
  296. package/neural-interface/public/shared/ui-menubar.js +23 -0
  297. package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
  298. package/neural-interface/public/shared/ui-navbar.js +15 -9
  299. package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
  300. package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
  301. package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
  302. package/neural-interface/public/shared/ui-sessions.js +3 -3
  303. package/neural-interface/public/shared/ui-settings-entry.js +55 -0
  304. package/neural-interface/public/shared/ui-settings.js +355 -400
  305. package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
  306. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
  307. package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
  308. package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
  309. package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
  310. package/neural-interface/public/shared/ui-styleguide.js +10 -2
  311. package/neural-interface/public/shared/ui-sync.js +5 -0
  312. package/neural-interface/public/shared/ui-terminal.js +13 -9
  313. package/neural-interface/public/shared/ui-tooltip.js +28 -7
  314. package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
  315. package/neural-interface/public/shared/ui-tray-columns.js +375 -0
  316. package/neural-interface/public/shared/ui-whiteboard.js +51 -6
  317. package/neural-interface/public/shared/ui-worker-end.js +28 -1
  318. package/neural-interface/public/shared/ui-workspaces.js +13 -0
  319. package/neural-interface/public/shared/window-keys.js +71 -0
  320. package/neural-interface/public/variant/2d/main.js +2 -0
  321. package/neural-interface/public/variant/3d/app.js +620 -0
  322. package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
  323. package/neural-interface/public/variant/3d/main.js +21 -544
  324. package/neural-interface/public/variant/3d/map-controls.js +4 -2
  325. package/neural-interface/public/vendor/fonts/fonts.css +508 -0
  326. package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
  327. package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
  328. package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
  329. package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
  330. package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
  331. package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
  332. package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
  333. package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
  334. package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
  335. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
  336. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
  337. package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
  338. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  339. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
  340. package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
  341. package/neural-interface/public/vendor/fonts/manifest.json +142 -0
  342. package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
  343. package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
  344. package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
  345. package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
  346. package/neural-interface/scripts/boot-graph.mjs +270 -0
  347. package/neural-interface/scripts/vendor-fonts.mjs +124 -0
  348. package/neural-interface/server.js +1050 -140
  349. package/npm-shrinkwrap.json +2 -2
  350. package/package.json +3 -1
  351. package/skills/agent-forge/SKILL.md +182 -0
  352. package/skills/agent-forge/evals/evals.json +56 -0
  353. package/skills/agent-forge/references/definition-fields.md +61 -0
  354. package/skills/agent-forge/references/examples.md +105 -0
  355. package/skills/agent-forge/references/instructions.md +51 -0
  356. package/skills/agent-forge/references/review-and-export.md +84 -0
@@ -0,0 +1,108 @@
1
+ // SynaBun — a module the page loads when it is first used instead of at boot (shared/claude-panel-lazy.js and the
2
+ // side panel barrels ui-codex-panel.js, ui-opencode-panel-v2.js, ui-antigravity-panel.js, ui-maritaca-panel.js).
3
+ //
4
+ // The boot used to load every side panel (about 200 modules, 5 MB) before the first frame. They now load on first
5
+ // use, or in an idle moment after the page is shown (a launch step, launch-prefetch.js), whichever comes first, so:
6
+ // - every module-level effect of a panel still runs in every session (the Claude, Codex and OpenCode panels prune
7
+ // the stale window keys of closed windows at load "even if the user never opens the panel");
8
+ // - the first open is as quick as before once the idle load has run.
9
+ //
10
+ // A facade keeps the panel's export names. An async export loads and then calls. A sync export answers from the
11
+ // loaded module, or with the answer that is true while the panel is not loaded (a panel that is not loaded is not
12
+ // open). Calls made while the load is pending are made in order, after it. An event a panel listens to at module
13
+ // level (`claude-panel:show`, `opencode-panel:show`, …) that fires before it loaded loads it and is emitted again,
14
+ // once, for the listener the load registered (forwardEvents).
15
+ //
16
+ // No imports and no DOM globals: tests/lazy-module.test.mjs runs it under node.
17
+
18
+ /**
19
+ * @template M
20
+ * @param {() => Promise<M>} load `() => import('./the-module.js')`
21
+ * @param {{ name?: string, onError?: (err: unknown) => void }} [options]
22
+ */
23
+ export function createLazyModule(load, { name = 'module', onError } = {}) {
24
+ /** @type {M|null} */
25
+ let mod = null;
26
+ /** @type {Promise<M>|null} */
27
+ let loading = null;
28
+ let queued = 0;
29
+ const listeners = [];
30
+
31
+ function ensure() {
32
+ if (mod) return Promise.resolve(mod);
33
+ if (!loading) {
34
+ loading = Promise.resolve()
35
+ .then(load)
36
+ .then((m) => {
37
+ mod = m;
38
+ for (const fn of listeners.splice(0)) { try { fn(m); } catch (err) { report(err); } }
39
+ return m;
40
+ }, (err) => {
41
+ // A failed load is tried again by the next use (a server restart can refuse one request).
42
+ loading = null;
43
+ report(err);
44
+ throw err;
45
+ });
46
+ }
47
+ return loading;
48
+ }
49
+
50
+ function report(err) {
51
+ if (onError) onError(err);
52
+ else if (globalThis.console) console.warn(`[lazy] ${name} could not load:`, err);
53
+ }
54
+
55
+ /** Call an export: at once when loaded (and nothing is waiting before it), else after the load, in order. */
56
+ function call(exportName, args) {
57
+ if (mod && !queued) return mod[exportName](...args);
58
+ queued += 1;
59
+ return ensure().then((m) => m[exportName](...args)).finally(() => { queued -= 1; });
60
+ }
61
+
62
+ return {
63
+ name,
64
+ /** The module, or null before it loaded. */
65
+ get module() { return mod; },
66
+ get loaded() { return !!mod; },
67
+ load: ensure,
68
+ call,
69
+ /**
70
+ * An async export: a promise of its result. Once loaded it runs in the caller's task, as the original async
71
+ * function did (its body up to the first await runs at once).
72
+ */
73
+ asyncExport(exportName) {
74
+ return (...args) => {
75
+ try { return Promise.resolve(call(exportName, args)); } catch (err) { return Promise.reject(err); }
76
+ };
77
+ },
78
+ /** A sync export: the module's answer once loaded, `whenUnloaded(...args)` before. */
79
+ syncExport(exportName, whenUnloaded) {
80
+ return (...args) => (mod ? mod[exportName](...args) : (typeof whenUnloaded === 'function' ? whenUnloaded(...args) : whenUnloaded));
81
+ },
82
+ /** An export that may be called before the load and must not be lost: at once when loaded, else after it. */
83
+ deferredExport(exportName) {
84
+ return (...args) => call(exportName, args);
85
+ },
86
+ /** Run `fn(module)` once it has loaded (at once when it has). */
87
+ whenLoaded(fn) {
88
+ if (mod) fn(mod);
89
+ else listeners.push(fn);
90
+ },
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Bus events a lazy module listens to at module level: one that fires before the module loaded loads it and is
96
+ * emitted again once, after the load, so the listener the module registered sees it.
97
+ * @param {ReturnType<typeof createLazyModule>} lazy
98
+ * @param {string[]} events
99
+ * @param {{ on: (event: string, fn: (data: any) => void) => void, emit: (event: string, data: any) => void }} bus
100
+ */
101
+ export function forwardEvents(lazy, events, bus) {
102
+ for (const event of events) {
103
+ bus.on(event, (data) => {
104
+ if (lazy.loaded) return;
105
+ lazy.load().then(() => bus.emit(event, data), () => {});
106
+ });
107
+ }
108
+ }
@@ -0,0 +1,117 @@
1
+ // SynaBun — the page's memory list, read in pages (server: lib/memory-list-page.js).
2
+ //
3
+ // The 3D page needs every memory (the sidebar's counts, the explorer, search, the cards, the map's tooltips) and
4
+ // used to read them in one answer: about 32 MB, parsed in one long task. It now reads pages of MEMORY_PAGE_SIZE
5
+ // memories, the first one fetched by index.html before any module loads, the others one or two at a time; each
6
+ // parse is a short task between frames. Nothing is shown from a part of the list: the caller gets the whole list,
7
+ // in the order the single answer had (newest first, the bridge's nodes last), the same nodes, and the same shape
8
+ // ({ nodes, links, totalVectors, openclawNodes }).
9
+ //
10
+ // Every page has an ETag of its own, so a reload of an unchanged list is answered 304 page by page (the browser's
11
+ // cache keeps each page by its URL; the URL of a page never changes while its place does not). A page carries the
12
+ // version of the list it was cut from: two versions in one read mean the list changed while it was read, and the
13
+ // read starts again (twice at most, then the list is read in one answer, as before). A server from before pages
14
+ // answers the first request with the whole list (no `page`): that is the list.
15
+ //
16
+ // No imports and no DOM: tests/memory-list.test.mjs runs it under node with a fake fetch.
17
+
18
+ /** Memories per page: about 2.7 MB of JSON, a 20–30 ms parse. */
19
+ export const MEMORY_PAGE_SIZE = 2500;
20
+ /** The whole list in one answer (the shape every reader already knows, and the last resort here). */
21
+ export const MEMORY_LIST_URL = '/api/memories?links=false&fields=graph';
22
+
23
+ /** The address of one page. index.html fetches memoryPageUrl(0) itself, before any module loads. */
24
+ export function memoryPageUrl(offset, limit = MEMORY_PAGE_SIZE) {
25
+ return `${MEMORY_LIST_URL}&offset=${offset}&limit=${limit}`;
26
+ }
27
+
28
+ async function getJson(fetchFn, url) {
29
+ const res = await fetchFn(url);
30
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
31
+ return res.json();
32
+ }
33
+
34
+ /** The pages after the first, as offsets. */
35
+ export function remainingOffsets(page) {
36
+ const out = [];
37
+ if (!page || !Number.isInteger(page.limit) || page.limit < 1) return out;
38
+ for (let offset = page.offset + page.limit; offset < page.total; offset += page.limit) out.push(offset);
39
+ return out;
40
+ }
41
+
42
+ /**
43
+ * Join pages read in order into the single answer's shape. Nodes are kept once (by id), in page order.
44
+ * @param {Array<{ nodes: any[], totalVectors?: number, openclawNodes?: number, page?: any }>} pages
45
+ */
46
+ export function joinPages(pages) {
47
+ const seen = new Set();
48
+ const nodes = [];
49
+ for (const data of pages) {
50
+ for (const node of data?.nodes || []) {
51
+ const id = node?.id;
52
+ if (id != null) {
53
+ if (seen.has(id)) continue;
54
+ seen.add(id);
55
+ }
56
+ nodes.push(node);
57
+ }
58
+ }
59
+ const last = pages[pages.length - 1] || {};
60
+ const first = pages[0] || {};
61
+ return {
62
+ nodes,
63
+ links: [],
64
+ totalVectors: Number.isFinite(first.page?.total) ? first.page.total : (first.totalVectors ?? nodes.length),
65
+ openclawNodes: last.openclawNodes ?? first.openclawNodes ?? 0,
66
+ };
67
+ }
68
+
69
+ /**
70
+ * Read the whole memory list in pages. Never throws: a failure comes back as `{ error }`, as the old prefetch did.
71
+ * @param {{
72
+ * fetch?: typeof fetch,
73
+ * first?: Promise<any> | null, the first page, already asked for (index.html); its answer or `{ error }`
74
+ * pageSize?: number,
75
+ * concurrency?: number, pages in flight at once after the first
76
+ * attempts?: number, reads of the pages before the one-answer fallback
77
+ * }} [options]
78
+ */
79
+ export async function loadMemoryList({
80
+ fetch: fetchFn = globalThis.fetch?.bind(globalThis),
81
+ first = null,
82
+ pageSize = MEMORY_PAGE_SIZE,
83
+ concurrency = 1,
84
+ attempts = 2,
85
+ } = {}) {
86
+ try {
87
+ for (let attempt = 0; attempt < attempts; attempt++) {
88
+ let head = attempt === 0 && first ? await first : null;
89
+ if (head?.error) throw head.error;
90
+ if (!head) head = await getJson(fetchFn, memoryPageUrl(0, pageSize));
91
+ // A server from before pages: the whole list, in one answer.
92
+ if (!head?.page) return head;
93
+ const offsets = remainingOffsets(head.page);
94
+ const pages = new Array(offsets.length);
95
+ let next = 0;
96
+ let changed = false;
97
+ const worker = async () => {
98
+ while (!changed && next < offsets.length) {
99
+ const index = next++;
100
+ const data = await getJson(fetchFn, memoryPageUrl(offsets[index], head.page.limit));
101
+ if (!data?.page || data.page.version !== head.page.version || data.page.total !== head.page.total) {
102
+ changed = true;
103
+ return;
104
+ }
105
+ pages[index] = data;
106
+ }
107
+ };
108
+ await Promise.all(Array.from({ length: Math.max(1, Math.min(concurrency, offsets.length)) }, worker));
109
+ if (!changed) return joinPages([head, ...pages]);
110
+ // The list changed while it was read: read it again from the first page.
111
+ }
112
+ // It kept changing: one answer, which is one moment of the list.
113
+ return await getJson(fetchFn, MEMORY_LIST_URL);
114
+ } catch (error) {
115
+ return { error };
116
+ }
117
+ }
@@ -69,7 +69,7 @@ export function sameMoreLoginProfiles(a, b) {
69
69
  * ml the list as readMoreLoginProfiles gives it (or the loading placeholder)
70
70
  * chosenId the field's value ('' = the default); chosenName its display name
71
71
  * context 'schedule' | 'group' | 'run'
72
- * inheritLabel the first choice's label when an empty value is not the Browser settings default
72
+ * inheritLabel the first choice's label when an empty value is not the default AI browser
73
73
  * say (key, params) → text
74
74
  * → { entries, helpKey, helpParams, warn, firefox, missing }; entries are cc-dropdown's ({ value, label, selected,
75
75
  * disabled }). The chosen profile is always among them and selected, usable or not: it is never dropped quietly.
@@ -1,6 +1,6 @@
1
1
  // The "MoreLogin profile" field of everything that starts a browser run: a schedule, a schedule group, a quick timer
2
2
  // and a manual launch (Schedules window, Automation Studio). One list (GET /api/browser/morelogin-envs, the one
3
- // Settings → Browser reads), one field, drawn in the look of the form it sits in.
3
+ // MoreLogin tab of Settings reads), one field, drawn in the look of the form it sits in.
4
4
  //
5
5
  // 1. Markup: moreLoginFieldHTML({ id, value, savedName, context, variant, ... }) where the form's rows are built.
6
6
  // 2. Wiring: wireMoreLoginFields(root, { signal }) once per window (the Refresh button; cc-dropdown.js wires the popup).
@@ -9,7 +9,7 @@
9
9
  // The field shows where MoreLogin is in use (it is the default browser, or installed) and for a record that has a
10
10
  // profile saved; until then it is an empty hidden element that fills in when the list arrives. A saved profile
11
11
  // MoreLogin no longer lists stays selected and is said as such: it is never dropped quietly. The first choice is
12
- // always "Browser settings default" (or what the record inherits): an empty value, which is what every record without
12
+ // always "Default AI browser" (or what the record inherits): an empty value, which is what every record without
13
13
  // the field means. When the list arrives or is refreshed, each field on screen is redrawn in place with the choice it
14
14
  // shows, so the form around it keeps its focus, its scroll and what was typed.
15
15
  //
@@ -100,7 +100,7 @@ export function moreLoginProfileName(id, savedName = null) {
100
100
  * variant 'sched' (the Schedules window's form rows) | 'as' (Automation Studio's labelled blocks)
101
101
  * wrapClass 'as' only: the block's own class (as-launch-section, as-qt-group)
102
102
  * dropdownClasses extra classes of the popup
103
- * inheritLabel the first choice's label when an empty value is not the Browser settings default (a group's profile)
103
+ * inheritLabel the first choice's label when an empty value is not the default AI browser (a group's profile)
104
104
  */
105
105
  export function moreLoginFieldHTML(options) {
106
106
  const previous = _fields.get(options.id);
@@ -749,7 +749,9 @@ function renderPills() {
749
749
  pill.tabIndex = 0;
750
750
  pill.setAttribute('role', 'button');
751
751
  pill.innerHTML = `<span class="mtc-pill-ring" aria-hidden="true"><i></i></span><span class="term-minimized-pill-icon mtc-mark">${ICON}</span><span class="term-minimized-pill-label"></span><button class="term-minimized-pill-close" data-tooltip="${esc(T('closeTab'))}" aria-label="${esc(T('closeTab'))}">&times;</button>`;
752
- const openIt = () => { const idx = _tabs.indexOf(tab); if (idx < 0) return; if (!_visible) setVisible(true); switchTab(idx); try { focusSidepanel(PANEL_OWNER); } catch {} };
752
+ // A closed panel goes to this tab first and is shown after: showing it first drew, and loaded the session
753
+ // of, the tab it was left on before the one that was clicked.
754
+ const openIt = () => { const idx = _tabs.indexOf(tab); if (idx < 0) return; switchTab(idx); if (!_visible) setVisible(true); try { focusSidepanel(PANEL_OWNER); } catch {} };
753
755
  pill.addEventListener('click', openIt);
754
756
  pill.addEventListener('keydown', (event) => { if (event.target !== pill) return; if (event.key === 'Enter' || event.key === ' ') { event.preventDefault(); openIt(); } });
755
757
  pill.querySelector('.term-minimized-pill-close')?.addEventListener('click', (event) => { event.stopPropagation(); const idx = _tabs.indexOf(tab); if (idx >= 0) closeTab(idx); });
@@ -5,7 +5,11 @@
5
5
  // values. The one colour of its own is the provider's (provider-icons.js PROVIDER_META.maritaca, Maritaca's green):
6
6
  // its mark and nothing else. Every rule below uses a token; add a value to the block first.
7
7
 
8
+ import { installCodeCopy } from '../ui-code-copy.js';
9
+
8
10
  export function injectMaritacaStyles() {
11
+ // The Copy button of every code block: its stylesheet and its one click listener, in this document.
12
+ installCodeCopy(document);
9
13
  if (document.getElementById('maritaca-panel-styles')) return;
10
14
  const style = document.createElement('style');
11
15
  style.id = 'maritaca-panel-styles';
@@ -74,7 +78,6 @@ export function injectMaritacaStyles() {
74
78
  font-family: var(--mtc-font); font-size: var(--mtc-fs-md); color: var(--mtc-text);
75
79
  }
76
80
  .mtc-panel.open { transform: translateX(0); opacity: 1; overflow: visible; }
77
- html.platform-win32 .mtc-panel, html.desktop-titlebar--win32 .mtc-panel { backdrop-filter: none; -webkit-backdrop-filter: none; }
78
81
  .mtc-panel:has(.cc-dropdown.open) { z-index: 99999; }
79
82
  .mtc-panel :is(a, button, input, textarea, summary, [tabindex]):focus-visible, .mtc-pop :is(a, button, input, textarea, summary, [tabindex]):focus-visible, .mtc-session-pill:focus-visible { outline: 2px solid var(--mtc-focus); outline-offset: 2px; }
80
83
  .mtc-panel input::placeholder, .mtc-panel textarea::placeholder, .mtc-pop input::placeholder, .mtc-pop textarea::placeholder { color: var(--mtc-text-3); opacity: 1; }
@@ -115,8 +115,8 @@ export function registerMainView({ owner, isVisible }) {
115
115
  // keepPrompts(items, label)
116
116
  // prompts that were waiting in a sub-agent panel that
117
117
  // went away by itself: kept for the user on notices
118
- export function registerPrimaryPanel({ panelId, store, getSessionId, ownsSession, keepPrompts }) {
119
- _primary = { panelId, store, getSessionId, ownsSession, keepPrompts };
118
+ export function registerPrimaryPanel({ panelId, store, getSessionId, ownsSession, keepPrompts, onChildWaitingChange }) {
119
+ _primary = { panelId, store, getSessionId, ownsSession, keepPrompts, onChildWaitingChange };
120
120
  startManager();
121
121
  syncSubagentTray();
122
122
  // Retroactive scan: sub-agent sessions may already exist server-side
@@ -838,6 +838,11 @@ let _summaryEl = null;
838
838
  let _traySyncQueued = false;
839
839
  let _groupLayoutKey = ''; // what the group's height was last measured for
840
840
  let _groupHeight; // the height the group may take (trayGroupHeight), once measured
841
+ let _waitingParents = new Set();
842
+
843
+ export function subagentNeedsYou(sessionId) {
844
+ return _waitingParents.has(sessionId);
845
+ }
841
846
 
842
847
  // Store events come in bursts (every streamed token): one tray pass per tick.
843
848
  function scheduleTraySync() {
@@ -846,8 +851,8 @@ function scheduleTraySync() {
846
851
  setTimeout(() => { _traySyncQueued = false; syncSubagentTray(); }, 0);
847
852
  }
848
853
 
849
- function tabPillOf(tray, sessionId) {
850
- for (const node of tray.children || []) {
854
+ function tabPillOf(items, sessionId) {
855
+ for (const node of items) {
851
856
  if (node?.dataset?.sessionId !== sessionId) continue;
852
857
  if (String(node.dataset.owner || '').startsWith('ocp-v2-child-')) continue;
853
858
  if (node.classList?.contains('ocpv2-session-pill')) return node;
@@ -865,6 +870,7 @@ function tabPillOf(tray, sessionId) {
865
870
  export function syncSubagentTray() {
866
871
  const tray = typeof document !== 'undefined' ? document.getElementById('term-minimized-tray') : null;
867
872
  if (!tray) return;
873
+ const items = Array.from(tray.children).filter((node) => node !== _groupEl && !node.classList.contains('tray-col-head'));
868
874
  const shownRoot = _primary?.getSessionId?.() || '';
869
875
  const entries = _panels.all();
870
876
  const byId = new Map(entries.map((entry) => [entry.sessionId, entry]));
@@ -874,6 +880,11 @@ export function syncSubagentTray() {
874
880
  visiblePanelId: visibleEntry()?.panelId || '',
875
881
  stateOf: (entry) => entry.instance?.pillState?.() || { state: 'idle' },
876
882
  });
883
+ const waitingParents = new Set([...plan.parents].filter(([, flags]) => flags.waiting).map(([sessionId]) => sessionId));
884
+ if (waitingParents.size !== _waitingParents.size || [...waitingParents].some((sid) => !_waitingParents.has(sid))) {
885
+ _waitingParents = waitingParents;
886
+ _primary?.onChildWaitingChange?.();
887
+ }
877
888
 
878
889
  if (!_groupEl) {
879
890
  _groupEl = document.createElement('div');
@@ -882,6 +893,15 @@ export function syncSubagentTray() {
882
893
  _summaryEl.classList.add('ocpv2-subagent-summary');
883
894
  _summaryEl.hidden = true;
884
895
  _groupEl.appendChild(_summaryEl);
896
+ if (typeof MutationObserver !== 'undefined') {
897
+ // The columns controller moves the group after the pill's state changes.
898
+ const placement = new MutationObserver((changes) => {
899
+ if (changes.every(({ oldValue }) => oldValue === _groupEl.getAttribute('data-tray-col'))) return;
900
+ _groupLayoutKey = '';
901
+ scheduleTraySync();
902
+ });
903
+ placement.observe(_groupEl, { attributes: true, attributeOldValue: true, attributeFilter: ['data-tray-col'] });
904
+ }
885
905
  }
886
906
 
887
907
  // The pills of this session, in order; every other pill leaves the group.
@@ -898,9 +918,10 @@ export function syncSubagentTray() {
898
918
 
899
919
  // The group sits right under its parent session's pill (or stands alone
900
920
  // while that pill is hidden because the main panel is on screen).
901
- const parentPill = shownRoot ? tabPillOf(tray, shownRoot) : null;
921
+ const parentPill = shownRoot ? tabPillOf(items, shownRoot) : null;
902
922
  if (!wanted.length) {
903
923
  if (_groupEl.parentNode) _groupEl.remove();
924
+ _groupLayoutKey = '';
904
925
  } else if (parentPill) {
905
926
  if (parentPill.nextSibling !== _groupEl) tray.insertBefore(_groupEl, parentPill.nextSibling);
906
927
  } else if (_groupEl.parentNode !== tray) {
@@ -908,17 +929,16 @@ export function syncSubagentTray() {
908
929
  }
909
930
  const docked = !!wanted.length && !!parentPill && parentPill.style?.display !== 'none';
910
931
  _groupEl.classList.toggle('ocpv2-pills-docked', docked);
911
- // The tray ends inside the window: the group takes the room the other pills
912
- // leave (trayGroupHeight), however little that is, and scrolls inside it.
913
- // Measured when the pills or their place changed, not on every state change
914
- // of a sub-agent.
915
- const layoutKey = `${wanted.length}|${shownRoot}|${docked}|${tray.children.length}`;
932
+ // Use the parent as the viewport anchor. A taller neighboring column
933
+ // doesn't take vertical space from this group.
934
+ const layoutKey = `${wanted.length}|${shownRoot}|${docked}|${items.length}|${plan.summary.waiting}`;
916
935
  if (wanted.length && layoutKey !== _groupLayoutKey) {
917
936
  _groupLayoutKey = layoutKey;
918
937
  try {
919
- const trayBox = tray.getBoundingClientRect();
920
- _groupHeight = trayGroupHeight({ trayTop: trayBox.top, othersHeight: trayBox.height - _groupEl.getBoundingClientRect().height, viewportHeight: window.innerHeight });
921
- _groupEl.style.maxHeight = `${_groupHeight}px`;
938
+ const parentBox = docked ? parentPill.getBoundingClientRect() : null;
939
+ const top = parentBox?.height ? parentBox.bottom : _groupEl.getBoundingClientRect().top;
940
+ _groupHeight = trayGroupHeight({ trayTop: top, viewportHeight: window.innerHeight });
941
+ if (_groupEl.style.maxHeight !== `${_groupHeight}px`) _groupEl.style.maxHeight = `${_groupHeight}px`;
922
942
  } catch { /* the stylesheet's bound holds */ }
923
943
  }
924
944
  // More pills than the group shows at once (its rows, or the room it got):
@@ -928,9 +948,9 @@ export function syncSubagentTray() {
928
948
  wanted.forEach((pill, index) => pill.classList.toggle('ocpv2-pill-docked', docked && index === 0 && !scrolls));
929
949
 
930
950
  // What each parent session's own pill says about its sub-agents.
931
- for (const node of tray.children || []) {
951
+ for (const node of items) {
932
952
  const sessionId = node?.dataset?.sessionId;
933
- if (!sessionId || node === _groupEl || String(node.dataset.owner || '').startsWith('ocp-v2-child-')) continue;
953
+ if (!sessionId || String(node.dataset.owner || '').startsWith('ocp-v2-child-')) continue;
934
954
  if (!node.classList?.contains('ocpv2-session-pill')) continue;
935
955
  const flags = plan.parents.get(sessionId) || { hasChild: false, running: false, waiting: false };
936
956
  node.classList.toggle('ocpv2-pill-has-child', flags.hasChild);
@@ -16,10 +16,13 @@ import { storage } from '../storage.js';
16
16
  import { frameRect } from '../app-frame.js';
17
17
  import { fetchProjects } from '../api.js';
18
18
  import { injectStyles } from './ocp-v2-styles.js';
19
- import { connect, api, hasSessionStore, onSessionCompacted, onEvent, onReconnect, supports, isDescendantSession } from './ocp-v2-ws.js';
19
+ import {
20
+ connect, api, hasSessionStore, onSessionCompacted, onEvent, onReconnect, supports, isDescendantSession,
21
+ sessionHasOpenAsks, onAsksChanged, trackTabAsks,
22
+ } from './ocp-v2-ws.js';
20
23
  import {
21
24
  menuSessions, pickReusableEmptySession, createPendingRenames,
22
- sessionBusyFromEvent, sessionBusyFromStatus, tabPillState, automationTurnPhase,
25
+ sessionBusyFromEvent, sessionBusyFromStatus, tabPillState as classifyTabPill, automationTurnPhase, readSavedTabs,
23
26
  } from './ocp-v2-sessions-logic.js';
24
27
  import {
25
28
  forkSession, undoLastTurn, restoreReverted,
@@ -57,7 +60,7 @@ import { nativeLoopWindowId } from '../ui-native-window-id.js';
57
60
  import { requestGeneratedSessionTitle } from '../session-title.js';
58
61
  import { wireFileLinks } from '../ui-file-links.js';
59
62
  import { mountCliBanner } from '../ui-cli-banner.js';
60
- import { backToAssistant, buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd, trackWorkerEnd } from '../ui-worker-end.js';
63
+ import { buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd, leaveWorkerTab, trackWorkerEnd } from '../ui-worker-end.js';
61
64
  import { isDispatchedRun } from '../worker-end.js';
62
65
  import {
63
66
  registerAutomationSession, unregisterAutomationSession, stopAutomationRun, isAutomationSession, liveAutomationSessions,
@@ -65,6 +68,7 @@ import {
65
68
  import {
66
69
  registerPrimaryPanel, bindPrimarySession, isChildPanelOpen, getVisibleChildPanel, openChildSession,
67
70
  registerMainView, requestOpencodeView, MAIN_VIEW, releaseSubagentPanels, subagentPromptsWaiting, syncSubagentTray,
71
+ subagentNeedsYou,
68
72
  } from './ocp-v2-manager.js';
69
73
 
70
74
  const PANEL_ID = 'ocp-v2-panel';
@@ -112,6 +116,7 @@ const _automationTurn = new Map();
112
116
  // and session:status answers say it (noteSessionBusy); the session on screen leaves its own run state
113
117
  // here when the user moves on (renderPill), so its pill keeps moving while its turn goes on.
114
118
  const _sessionBusy = new Map();
119
+ let _savedTabWaiting = new Map();
115
120
  const _automationContinuedManually = new Set();
116
121
  const _automationManualSendInFlight = new Set();
117
122
  const _foreignActiveAutomationSessions = new Set();
@@ -166,16 +171,16 @@ function forkClonedOpenCodePersistence() {
166
171
  .filter((row) => row?.running && row?.sessionId && row.ownerId !== nativeLoopWindowId)
167
172
  .map((row) => row.sessionId));
168
173
  if (!foreignActiveIds.size) return;
169
- const savedTabs = JSON.parse(storage.getItem(STOR_TABS) || '[]');
170
- const transferableTabs = (Array.isArray(savedTabs) ? savedTabs : [])
171
- .filter((sessionId) => !foreignActiveIds.has(sessionId));
174
+ const transferableTabs = readSavedTabs(JSON.parse(storage.getItem(STOR_TABS) || '[]'))
175
+ .filter(({ sessionId }) => !foreignActiveIds.has(sessionId));
176
+ const transferableIds = new Set(transferableTabs.map(({ sessionId }) => sessionId));
172
177
  const transferableRows = (Array.isArray(rows) ? rows : [])
173
178
  .filter((row) => !foreignActiveIds.has(row?.sessionId));
174
179
  let transferableTitleStates = {};
175
180
  try {
176
181
  const savedTitleStates = JSON.parse(storage.getItem(STOR_TITLE_STATES) || '{}');
177
182
  transferableTitleStates = Object.fromEntries(Object.entries(savedTitleStates)
178
- .filter(([sessionId]) => transferableTabs.includes(sessionId)));
183
+ .filter(([sessionId]) => transferableIds.has(sessionId)));
179
184
  } catch {}
180
185
  OCP_WINDOW_ID = crypto.randomUUID();
181
186
  sessionStorage.setItem('ocp-window-id', OCP_WINDOW_ID);
@@ -651,6 +656,7 @@ function buildPanel() {
651
656
 
652
657
  // Header reflects state
653
658
  _unsubHeader = subscribe(handleStoreEvent);
659
+ onAsksChanged(queueHeaderSync);
654
660
  syncHeader();
655
661
 
656
662
  // Sessions change outside this panel too (another window, the CLI, a title
@@ -660,6 +666,8 @@ function buildPanel() {
660
666
  const run = sessionBusyFromEvent(eventType, ev);
661
667
  if (run && run.sessionId !== getState().sessionId && _tabSessionIds.includes(run.sessionId)) noteSessionBusy(run.sessionId, run.busy);
662
668
  if (eventType !== 'session.updated' && eventType !== 'session.deleted' && eventType !== 'session.created') return;
669
+ // The session event can be the first one linking an already-waiting child to its parent.
670
+ queueHeaderSync();
663
671
  if (eventType === 'session.deleted') {
664
672
  const sid = ev?.info?.id || ev?.sessionID || ev?.sessionId;
665
673
  if (sid && _tabSessionIds.includes(sid)) {
@@ -712,10 +720,28 @@ function handleStoreEvent(event, stateSnapshot) {
712
720
  _titleNeedsReassert(nextState.sessionId);
713
721
  }
714
722
  if (event?.type === 'session:info') keepOwnSessionTitle(nextState);
715
- syncHeader();
723
+ if (TRANSCRIPT_EVENTS.has(event?.type)) queueHeaderSync();
724
+ else syncHeader();
716
725
  maybeScheduleAutoHeal(event, nextState);
717
726
  }
718
727
 
728
+ // A message, a part or a streamed chunk changes nothing the header or the pills show (headerStatus and the tab
729
+ // states read the run state, the requests and the session, never the transcript). Opening a session puts its
730
+ // whole transcript into the store one item at a time, and each item is an event: the header and every pill of
731
+ // the tray were redrawn once per message and per part, and once per chunk of a stream. For these events one
732
+ // pass per frame is enough; every other event still redraws at once.
733
+ const TRANSCRIPT_EVENTS = new Set(['message:upsert', 'message:remove', 'part:upsert', 'part:delta', 'part:remove']);
734
+ let _headerSyncQueued = false;
735
+ function queueHeaderSync() {
736
+ if (_headerSyncQueued) return;
737
+ _headerSyncQueued = true;
738
+ const run = () => { _headerSyncQueued = false; syncHeader(); };
739
+ // A hidden page draws no frame: there the pass runs at the end of the task.
740
+ const framed = typeof requestAnimationFrame === 'function' && !(typeof document !== 'undefined' && document.hidden);
741
+ if (framed) requestAnimationFrame(run);
742
+ else queueMicrotask(run);
743
+ }
744
+
719
745
  function syncHeader() {
720
746
  if (!_statusEl) return;
721
747
  const s = getState();
@@ -737,6 +763,7 @@ function syncHeader() {
737
763
  _renameBtnEl.disabled = !s.sessionId;
738
764
  }
739
765
  renderPill();
766
+ syncSavedTabWaiting();
740
767
  }
741
768
 
742
769
  function maybeScheduleAutoHeal(event, s) {
@@ -1576,6 +1603,7 @@ async function boot() {
1576
1603
  ownsSession: (sessionId) => _tabSessionIds.includes(sessionId),
1577
1604
  // Prompts of a sub-agent panel that went away with its session.
1578
1605
  keepPrompts: (items, label) => _composer?.keep?.(items, label),
1606
+ onChildWaitingChange: queueHeaderSync,
1579
1607
  });
1580
1608
  // 3. Kick off project load in parallel — used by promptNameNewSession modal
1581
1609
  loadProjectsOnce().catch(() => {});
@@ -1677,7 +1705,7 @@ function otherWindowTabIds() {
1677
1705
  for (const windowId of Object.keys(registry)) {
1678
1706
  if (windowId === OCP_WINDOW_ID) continue;
1679
1707
  const tabs = JSON.parse(storage.getItem(`opencode-v2-tabs-${windowId}`) || '[]');
1680
- if (Array.isArray(tabs)) ids.push(...tabs);
1708
+ ids.push(...readSavedTabs(tabs).map(({ sessionId }) => sessionId));
1681
1709
  }
1682
1710
  } catch {}
1683
1711
  return ids;
@@ -2124,27 +2152,52 @@ function loadTabSessions() {
2124
2152
  try {
2125
2153
  const raw = storage.getItem(STOR_TABS);
2126
2154
  if (!raw) return [];
2127
- const parsed = JSON.parse(raw);
2128
- return Array.isArray(parsed)
2129
- ? parsed.filter((s) => typeof s === 'string' && s && !_foreignActiveAutomationSessions.has(s))
2130
- : [];
2155
+ return readSavedTabs(JSON.parse(raw))
2156
+ .map(({ sessionId }) => sessionId)
2157
+ .filter((sessionId) => !_foreignActiveAutomationSessions.has(sessionId));
2131
2158
  } catch { return []; }
2132
2159
  }
2133
2160
 
2134
2161
  function saveTabSessions() {
2162
+ trackTabAsks(new Map(_tabSessionIds.map((sid) => [sid, _tabInfoCache.get(sid)?.directory])));
2135
2163
  try {
2136
- const existingIds = JSON.parse(storage.getItem(STOR_TABS) || '[]');
2164
+ const existing = readSavedTabs(JSON.parse(storage.getItem(STOR_TABS) || '[]'));
2165
+ const savedById = new Map(existing.map((row) => [row.sessionId, row]));
2137
2166
  const automationRows = JSON.parse(storage.getItem(STOR_AUTOMATIONS) || '[]');
2138
2167
  const foreignSessionIds = new Set((Array.isArray(automationRows) ? automationRows : [])
2139
2168
  .filter((row) => row?.sessionId && row.ownerId !== nativeLoopWindowId)
2140
2169
  .map((row) => row.sessionId));
2141
- const preserved = (Array.isArray(existingIds) ? existingIds : [])
2142
- .filter((sessionId) => foreignSessionIds.has(sessionId) && !_tabSessionIds.includes(sessionId));
2143
- storage.setItem(STOR_TABS, JSON.stringify([..._tabSessionIds, ...preserved]));
2170
+ const preserved = existing.filter(({ sessionId }) => foreignSessionIds.has(sessionId) && !_tabSessionIds.includes(sessionId));
2171
+ const tabs = _tabSessionIds.map((sessionId) => ({
2172
+ ...savedById.get(sessionId), sessionId, needsYou: tabNeedsYou(sessionId),
2173
+ }));
2174
+ storage.setItem(STOR_TABS, JSON.stringify([...tabs, ...preserved]));
2175
+ _savedTabWaiting = new Map(tabs.map(({ sessionId, needsYou }) => [sessionId, needsYou]));
2144
2176
  touchOpenCodeWindow();
2145
2177
  } catch {}
2146
2178
  }
2147
2179
 
2180
+ function tabPillState(options) {
2181
+ const { sessionId, activeSessionId } = options;
2182
+ const active = sessionId === activeSessionId ? getState() : null;
2183
+ return classifyTabPill({
2184
+ ...options,
2185
+ pendingPermissions: active?.pendingPermissions,
2186
+ pendingQuestions: active?.pendingQuestions,
2187
+ familyWaiting: sessionHasOpenAsks(sessionId) || subagentNeedsYou(sessionId),
2188
+ });
2189
+ }
2190
+
2191
+ function tabNeedsYou(sessionId) {
2192
+ return tabPillState({
2193
+ sessionId, activeSessionId: getState().sessionId, automation: _automationTurn.get(sessionId),
2194
+ }) === 'waiting';
2195
+ }
2196
+
2197
+ function syncSavedTabWaiting() {
2198
+ if (_tabSessionIds.some((sid) => _savedTabWaiting.get(sid) !== tabNeedsYou(sid))) saveTabSessions();
2199
+ }
2200
+
2148
2201
  function ensureTab(sessionId, info = null) {
2149
2202
  if (!sessionId) return;
2150
2203
  if (info) _tabInfoCache.set(sessionId, info);
@@ -2334,11 +2387,7 @@ function workerEndCard(sessionId) {
2334
2387
  card: 'ocpv2-post-plan-card ocpv2-worker-end', title: 'ocpv2-post-plan-header', detail: 'ocpv2-post-plan-body',
2335
2388
  meta: 'ocpv2-post-plan-saved', note: 'ocpv2-post-plan-note', actions: 'ocpv2-post-plan-actions', button: 'ocpv2-post-plan-btn primary',
2336
2389
  },
2337
- onBack: async () => {
2338
- if (!(await closeTabByUser(sessionId, 'worker end close'))) return false;
2339
- backToAssistant(view.assistantSessionId);
2340
- return true;
2341
- },
2390
+ onBack: () => leaveWorkerTab(view, () => closeTabByUser(sessionId, 'worker end close')),
2342
2391
  }),
2343
2392
  };
2344
2393
  }
@@ -2377,7 +2426,10 @@ function renderPill() {
2377
2426
  _tabPills.set(sid, pill);
2378
2427
  }
2379
2428
  const labelEl = pill.querySelector('.term-minimized-pill-label');
2380
- if (labelEl) labelEl.textContent = tabLabelFor(sid);
2429
+ // Written only when it changed: the same text again is still a new text node, which the tray's
2430
+ // observer (ui-navbar.js) answers by going through every pill.
2431
+ const label = tabLabelFor(sid);
2432
+ if (labelEl && labelEl.textContent !== label) labelEl.textContent = label;
2381
2433
  const isActive = sid === activeSid;
2382
2434
  pill.classList.toggle('ocpv2-pill-active', isActive);
2383
2435
  // One pill per session, each with its own state: a tab the user left goes on showing its turn, an
@@ -2589,6 +2641,7 @@ export async function attachOpenCodeAutomation(run, { focus = !!run?.focus, isCa
2589
2641
  return { ok: true, sessionId, released: true };
2590
2642
  }
2591
2643
  ensureTab(sessionId, info);
2644
+ if (getState().sessionId === sessionId && info.directory && info.directory !== getState().cwd) setCwd(info.directory);
2592
2645
  if (focus && _nav.latest() === attachBegan) {
2593
2646
  // (Its own navigation, observed after boot landed: a click made while the
2594
2647
  // panel opens still wins.)
@@ -2613,6 +2666,7 @@ export async function attachOpenCodeAutomation(run, { focus = !!run?.focus, isCa
2613
2666
  }
2614
2667
  trackWorkerEnd(run, { apply: (view) => showWorkerEnd(sessionId, view) });
2615
2668
  renderPill();
2669
+ syncSavedTabWaiting();
2616
2670
  return { ok: true, sessionId };
2617
2671
  }
2618
2672