synabun 2.3.0 → 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 (367) hide show
  1. package/CHANGELOG.md +38 -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 +1174 -47
  103. package/neural-interface/i18n/pt-BR.json +1174 -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-profiles.js +1 -1
  135. package/neural-interface/lib/browser-tool-policy.js +1 -1
  136. package/neural-interface/lib/claude-account-links.js +301 -0
  137. package/neural-interface/lib/claude-accounts.js +45 -20
  138. package/neural-interface/lib/claude-agent-bridge.js +142 -10
  139. package/neural-interface/lib/claude-model-catalog.js +6 -0
  140. package/neural-interface/lib/claude-panel-session.js +33 -0
  141. package/neural-interface/lib/cli-install-api.js +23 -0
  142. package/neural-interface/lib/codex-accounts.js +67 -24
  143. package/neural-interface/lib/coordination/README.md +384 -0
  144. package/neural-interface/lib/coordination/service.js +563 -0
  145. package/neural-interface/lib/coordination/store.js +1138 -0
  146. package/neural-interface/lib/db.js +22 -1
  147. package/neural-interface/lib/editor-completion-opencode.js +4 -3
  148. package/neural-interface/lib/effort-levels.js +10 -1
  149. package/neural-interface/lib/maritaca/opencode-proxy.js +7 -2
  150. package/neural-interface/lib/maritaca/opencode.js +35 -0
  151. package/neural-interface/lib/memory-list-page.js +49 -0
  152. package/neural-interface/lib/memory-list-stamp.js +60 -0
  153. package/neural-interface/lib/morelogin-outside-close.js +186 -0
  154. package/neural-interface/lib/morelogin-profile-failures.js +206 -0
  155. package/neural-interface/lib/morelogin-start-cooldown.js +160 -0
  156. package/neural-interface/lib/morelogin.js +219 -7
  157. package/neural-interface/lib/native-loop-runtime.js +24 -1
  158. package/neural-interface/lib/opencode-build-preflight.js +116 -0
  159. package/neural-interface/lib/opencode-launch-error.js +13 -0
  160. package/neural-interface/lib/opencode-native-boundary.js +800 -84
  161. package/neural-interface/lib/opencode-serve-probe.js +426 -0
  162. package/neural-interface/lib/opencode-serve-records.js +14 -9
  163. package/neural-interface/lib/opencode-serve-scan.js +108 -0
  164. package/neural-interface/lib/page-session.js +1 -1
  165. package/neural-interface/lib/peer-identity.js +60 -21
  166. package/neural-interface/lib/process-identity.js +235 -7
  167. package/neural-interface/lib/request-gate.js +3 -0
  168. package/neural-interface/lib/screenshot-location.js +33 -0
  169. package/neural-interface/lib/skills/creation.js +1 -1
  170. package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
  171. package/neural-interface/lib/studio-attention.js +56 -0
  172. package/neural-interface/lib/teams/README.md +382 -0
  173. package/neural-interface/lib/teams/api.js +287 -0
  174. package/neural-interface/lib/teams/brief.js +185 -0
  175. package/neural-interface/lib/teams/claims.js +315 -0
  176. package/neural-interface/lib/teams/git.js +293 -0
  177. package/neural-interface/lib/teams/index.js +122 -0
  178. package/neural-interface/lib/teams/integration.js +580 -0
  179. package/neural-interface/lib/teams/landing.js +184 -0
  180. package/neural-interface/lib/teams/recovery.js +256 -0
  181. package/neural-interface/lib/teams/scheduler.js +1474 -0
  182. package/neural-interface/lib/teams/schema.js +559 -0
  183. package/neural-interface/lib/teams/state.js +181 -0
  184. package/neural-interface/lib/teams/test-runner.js +86 -0
  185. package/neural-interface/lib/teams/test-sandbox.js +99 -0
  186. package/neural-interface/lib/teams/worktrees.js +757 -0
  187. package/neural-interface/lib/tool-permission-choices.js +226 -0
  188. package/neural-interface/lib/whatsapp/cards.js +24 -10
  189. package/neural-interface/lib/worker-confinement.js +206 -6
  190. package/neural-interface/lib/worker-mcp-channel.js +38 -1
  191. package/neural-interface/package-lock.json +4 -2
  192. package/neural-interface/package.json +3 -1
  193. package/neural-interface/public/extension-setup.html +107 -0
  194. package/neural-interface/public/index.html +52 -12
  195. package/neural-interface/public/shared/agent-runtime-options.js +3 -1
  196. package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
  197. package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
  198. package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
  199. package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
  200. package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
  201. package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
  202. package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
  203. package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
  204. package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
  205. package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
  206. package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
  207. package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
  208. package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
  209. package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
  210. package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
  211. package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
  212. package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
  213. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
  214. package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
  215. package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
  216. package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
  217. package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
  218. package/neural-interface/public/shared/agy/agy-panel.js +142 -28
  219. package/neural-interface/public/shared/agy/agy-styles.js +25 -5
  220. package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
  221. package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
  222. package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
  223. package/neural-interface/public/shared/assistant/asst-control.js +3 -0
  224. package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
  225. package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
  226. package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
  227. package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
  228. package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
  229. package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
  230. package/neural-interface/public/shared/assistant/asst-render.js +36 -6
  231. package/neural-interface/public/shared/assistant/asst-route.js +78 -12
  232. package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
  233. package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
  234. package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
  235. package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
  236. package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
  237. package/neural-interface/public/shared/assistant/asst-state.js +66 -1
  238. package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
  239. package/neural-interface/public/shared/assistant/route-identity.js +16 -0
  240. package/neural-interface/public/shared/cdx/cdx-output.js +10 -0
  241. package/neural-interface/public/shared/cdx/cdx-panel.js +18 -16
  242. package/neural-interface/public/shared/cdx/cdx-plan.js +3 -2
  243. package/neural-interface/public/shared/cdx/cdx-render.js +122 -45
  244. package/neural-interface/public/shared/cdx/cdx-requests.js +4 -4
  245. package/neural-interface/public/shared/cdx/cdx-styles.js +8 -36
  246. package/neural-interface/public/shared/cdx/cdx-tabs.js +110 -42
  247. package/neural-interface/public/shared/claude-panel-lazy.js +12 -0
  248. package/neural-interface/public/shared/code-copy.js +120 -0
  249. package/neural-interface/public/shared/constants.js +7 -0
  250. package/neural-interface/public/shared/context-menu-model.js +1 -0
  251. package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
  252. package/neural-interface/public/shared/cp/cp-session-model.js +86 -5
  253. package/neural-interface/public/shared/cp/cp-session-settings.js +58 -30
  254. package/neural-interface/public/shared/cp/cp-styles.js +9 -0
  255. package/neural-interface/public/shared/dom-change-flag.js +66 -0
  256. package/neural-interface/public/shared/dom-morph.js +124 -0
  257. package/neural-interface/public/shared/extension-setup/es-page.css +134 -0
  258. package/neural-interface/public/shared/extension-setup/es-page.js +120 -0
  259. package/neural-interface/public/shared/extension-setup/es-view.js +100 -0
  260. package/neural-interface/public/shared/html-shell.js +33 -4
  261. package/neural-interface/public/shared/i18n.js +14 -1
  262. package/neural-interface/public/shared/idle-queue.js +78 -0
  263. package/neural-interface/public/shared/iface-config.js +227 -0
  264. package/neural-interface/public/shared/lazy-module.js +108 -0
  265. package/neural-interface/public/shared/memory-list.js +117 -0
  266. package/neural-interface/public/shared/morelogin-profile-choices.js +1 -1
  267. package/neural-interface/public/shared/morelogin-profile-field.js +3 -3
  268. package/neural-interface/public/shared/mtc/mtc-panel.js +3 -1
  269. package/neural-interface/public/shared/mtc/mtc-styles.js +4 -1
  270. package/neural-interface/public/shared/ocp-v2/ocp-v2-manager.js +35 -15
  271. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +77 -23
  272. package/neural-interface/public/shared/ocp-v2/ocp-v2-projectbar.js +3 -6
  273. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +24 -21
  274. package/neural-interface/public/shared/ocp-v2/ocp-v2-send-logic.js +16 -5
  275. package/neural-interface/public/shared/ocp-v2/ocp-v2-sessions-logic.js +16 -2
  276. package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -43
  277. package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +73 -9
  278. package/neural-interface/public/shared/opencode-verify-view.js +175 -0
  279. package/neural-interface/public/shared/schedules-view.js +2 -2
  280. package/neural-interface/public/shared/session-project-items.js +11 -0
  281. package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
  282. package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
  283. package/neural-interface/public/shared/settings/settings-ia.js +4 -2
  284. package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
  285. package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
  286. package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
  287. package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
  288. package/neural-interface/public/shared/sidepanel-shown.js +73 -0
  289. package/neural-interface/public/shared/storage.js +6 -1
  290. package/neural-interface/public/shared/studio-attention.js +83 -0
  291. package/neural-interface/public/shared/styles.css +713 -61
  292. package/neural-interface/public/shared/term-browser-tabs.js +34 -0
  293. package/neural-interface/public/shared/transcript-rows.js +334 -0
  294. package/neural-interface/public/shared/tray-auto-close.js +106 -0
  295. package/neural-interface/public/shared/ui-agents.js +97 -0
  296. package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
  297. package/neural-interface/public/shared/ui-automation-studio.js +3 -3
  298. package/neural-interface/public/shared/ui-claude-panel.js +162 -95
  299. package/neural-interface/public/shared/ui-code-copy.js +256 -0
  300. package/neural-interface/public/shared/ui-codex-panel.js +14 -10
  301. package/neural-interface/public/shared/ui-context-menu.js +1 -1
  302. package/neural-interface/public/shared/ui-file-explorer.js +2 -3
  303. package/neural-interface/public/shared/ui-games.js +1 -1
  304. package/neural-interface/public/shared/ui-loading.js +12 -1
  305. package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
  306. package/neural-interface/public/shared/ui-menubar.js +23 -0
  307. package/neural-interface/public/shared/ui-native-loop-router.js +1 -1
  308. package/neural-interface/public/shared/ui-navbar.js +15 -9
  309. package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
  310. package/neural-interface/public/shared/ui-opencode-verify.js +120 -0
  311. package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
  312. package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
  313. package/neural-interface/public/shared/ui-sessions.js +3 -3
  314. package/neural-interface/public/shared/ui-settings-entry.js +55 -0
  315. package/neural-interface/public/shared/ui-settings.js +372 -402
  316. package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
  317. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
  318. package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
  319. package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
  320. package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
  321. package/neural-interface/public/shared/ui-styleguide.js +10 -2
  322. package/neural-interface/public/shared/ui-sync.js +5 -0
  323. package/neural-interface/public/shared/ui-terminal.js +13 -9
  324. package/neural-interface/public/shared/ui-tooltip.js +28 -7
  325. package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
  326. package/neural-interface/public/shared/ui-tray-columns.js +375 -0
  327. package/neural-interface/public/shared/ui-whiteboard.js +51 -6
  328. package/neural-interface/public/shared/ui-worker-end.js +28 -1
  329. package/neural-interface/public/shared/ui-workspaces.js +13 -0
  330. package/neural-interface/public/shared/window-keys.js +71 -0
  331. package/neural-interface/public/variant/2d/main.js +2 -0
  332. package/neural-interface/public/variant/3d/app.js +620 -0
  333. package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
  334. package/neural-interface/public/variant/3d/main.js +21 -544
  335. package/neural-interface/public/variant/3d/map-controls.js +4 -2
  336. package/neural-interface/public/vendor/fonts/fonts.css +508 -0
  337. package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
  338. package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
  339. package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
  340. package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
  341. package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
  342. package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
  343. package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
  344. package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
  345. package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
  346. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
  347. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
  348. package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
  349. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  350. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
  351. package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
  352. package/neural-interface/public/vendor/fonts/manifest.json +142 -0
  353. package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
  354. package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
  355. package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
  356. package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
  357. package/neural-interface/scripts/boot-graph.mjs +270 -0
  358. package/neural-interface/scripts/vendor-fonts.mjs +124 -0
  359. package/neural-interface/server.js +1164 -157
  360. package/npm-shrinkwrap.json +2 -2
  361. package/package.json +3 -1
  362. package/skills/agent-forge/SKILL.md +182 -0
  363. package/skills/agent-forge/evals/evals.json +56 -0
  364. package/skills/agent-forge/references/definition-fields.md +61 -0
  365. package/skills/agent-forge/references/examples.md +105 -0
  366. package/skills/agent-forge/references/instructions.md +51 -0
  367. package/skills/agent-forge/references/review-and-export.md +84 -0
@@ -0,0 +1,375 @@
1
+ import { KEYS } from './constants.js';
2
+
3
+ const COLUMNS = [
4
+ ['running', 'Running', KEYS.TRAY_COL_RUNNING_COLLAPSED],
5
+ ['waiting', 'Waiting', KEYS.TRAY_COL_WAITING_COLLAPSED],
6
+ ['done', 'Done', KEYS.TRAY_COL_DONE_COLLAPSED],
7
+ ];
8
+ const HEADER = 'tray-col-head';
9
+ const GROUP = 'ocpv2-subagent-pills';
10
+ const PILL = 'term-minimized-pill';
11
+ const STATUS_MARKS = {
12
+ running: '<circle cx="6" cy="6" r="3" fill="currentColor" stroke="none"/>',
13
+ waiting: '<circle cx="6" cy="6" r="5"/><path d="M6 3.5v2.8m0 2.2h.01"/>',
14
+ done: '<path d="m2.5 6 2.3 2.3 4.7-4.7"/>',
15
+ };
16
+ const initialized = new WeakSet();
17
+
18
+ export function trayColumnOf(el) {
19
+ if (el.classList.contains(GROUP)) {
20
+ let parent = el.previousElementSibling;
21
+ while (parent && (!parent.classList.contains(PILL))) {
22
+ parent = parent.previousElementSibling;
23
+ }
24
+ return parent ? trayColumnOf(parent) : 'done';
25
+ }
26
+
27
+ const badgeStatus = el.querySelector('.cli-status-badge')?.dataset.status;
28
+ const status = el.dataset.status;
29
+ const classes = el.className.split(/\s+/);
30
+ if (status === 'action' || badgeStatus === 'action' || classes.some(name => /-pill-(attention|waiting)$/.test(name))) {
31
+ return 'waiting';
32
+ }
33
+ if (status === 'working' || badgeStatus === 'working' || classes.some(name => name.endsWith('-pill-running'))) {
34
+ return 'running';
35
+ }
36
+ return 'done';
37
+ }
38
+
39
+ function setAttribute(el, name, value) {
40
+ if (el.getAttribute(name) !== value) el.setAttribute(name, value);
41
+ }
42
+
43
+ function isProducerVisible(el) {
44
+ return !el.hidden && el.style.display !== 'none';
45
+ }
46
+
47
+ // Fill downward before borrowing room to the left of the heading.
48
+ export function accordionLayout(total, height) {
49
+ for (const [row, gap] of [[32, 4], [28, 2], [24, 1], [24, 0]]) {
50
+ if (total * (row + gap) - gap <= height) {
51
+ return { row, gap, rows: Math.max(1, total), columns: 1 };
52
+ }
53
+ }
54
+ const rows = Math.max(1, Math.floor(height / 24));
55
+ return { row: 24, gap: 0, rows, columns: Math.ceil(total / rows) };
56
+ }
57
+
58
+ function setStyle(el, name, value) {
59
+ if (el.style.setProperty) {
60
+ if (el.style.getPropertyValue(name) !== value) el.style.setProperty(name, value);
61
+ } else {
62
+ el.style[name] = value;
63
+ }
64
+ }
65
+
66
+ function motionAllowed() {
67
+ return globalThis.matchMedia?.('(prefers-reduced-motion: no-preference)').matches;
68
+ }
69
+
70
+ function targetOf(pill) {
71
+ return pill?.querySelector('.term-minimized-pill-label[tabindex]') || pill;
72
+ }
73
+
74
+ function control(className, label) {
75
+ const button = document.createElement('button');
76
+ button.type = 'button';
77
+ button.className = className;
78
+ if (label) button.setAttribute('aria-label', label);
79
+ return button;
80
+ }
81
+
82
+ function setText(node, text) {
83
+ if (node.textContent !== text) node.textContent = text;
84
+ }
85
+
86
+ // Keep the native close button a sibling of the keyboard opening target.
87
+ // Providers with their own keyboard handler (the Assistant) keep that handler.
88
+ function preparePill(pill) {
89
+ const label = pill.querySelector('.term-minimized-pill-label');
90
+ if (!label) return;
91
+ if (!pill.hasAttribute('tabindex') && pill.tagName !== 'BUTTON') {
92
+ setAttribute(label, 'role', 'button');
93
+ setAttribute(label, 'tabindex', '0');
94
+ }
95
+ const close = pill.querySelector('.term-minimized-pill-close');
96
+ if (close && (!close.hasAttribute('aria-label') || close.dataset.trayCloseName)) {
97
+ const name = `Close ${label.textContent.trim() || 'session'}`;
98
+ setAttribute(close, 'aria-label', name);
99
+ setAttribute(close, 'data-tray-close-name', 'true');
100
+ }
101
+ }
102
+
103
+ export function initTrayColumns(tray, preferences = globalThis.localStorage) {
104
+ if (!tray || initialized.has(tray)) return;
105
+ initialized.add(tray);
106
+ tray.classList.add('tray-columns');
107
+
108
+ let pendingFocus = null;
109
+ const motion = new WeakMap();
110
+ const folding = new Map();
111
+ const headers = COLUMNS.map(([column, label, key]) => {
112
+ const button = control(HEADER);
113
+ button.dataset.trayCol = column;
114
+ const mark = document.createElement('span');
115
+ mark.className = 'tray-col-mark';
116
+ mark.setAttribute('aria-hidden', 'true');
117
+ mark.innerHTML = `<svg viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round">${STATUS_MARKS[column]}</svg>`;
118
+ const name = document.createElement('span');
119
+ name.className = 'tray-col-label';
120
+ name.textContent = label;
121
+ const count = document.createElement('span');
122
+ count.className = 'tray-col-count';
123
+ const chevron = document.createElement('span');
124
+ chevron.className = 'tray-col-chevron';
125
+ chevron.setAttribute('aria-hidden', 'true');
126
+ button.append(mark, name, ' ', count, chevron);
127
+
128
+ const group = { column, label, key, button, count, items: [] };
129
+ const saved = preferences?.getItem(key);
130
+ setCollapsed(group, saved == null ? column === 'done' : saved === 'true');
131
+ button.addEventListener('click', () => toggle(group));
132
+ return group;
133
+ });
134
+ const firstPill = tray.firstElementChild;
135
+ for (const { button } of headers) tray.insertBefore(button, firstPill);
136
+
137
+ function setCollapsed({ column, label, button }, collapsed) {
138
+ setAttribute(tray, `data-tray-${column}-collapsed`, String(collapsed));
139
+ setAttribute(button, 'aria-expanded', String(!collapsed));
140
+ setAttribute(button, 'data-tooltip', `${collapsed ? 'Expand' : 'Collapse'} ${label}`);
141
+ }
142
+
143
+ function stopFold(pill) {
144
+ const animation = folding.get(pill);
145
+ if (!animation) return;
146
+ folding.delete(pill);
147
+ animation.cancel();
148
+ motion.delete(pill);
149
+ pill.removeAttribute('inert');
150
+ }
151
+
152
+ function animateFromHeading(pill, button, closing = false) {
153
+ motion.get(pill)?.cancel();
154
+ const from = button.getBoundingClientRect();
155
+ const to = pill.getBoundingClientRect();
156
+ const x = from.right - to.right;
157
+ const y = from.top + (from.height - to.height) / 2 - to.top;
158
+ const frames = [{ translate: `${x}px ${y}px`, opacity: 0 }, { translate: 'none', opacity: 1 }];
159
+ const animation = pill.animate(closing ? frames.reverse() : frames, {
160
+ duration: closing ? 150 : 200, easing: 'cubic-bezier(0.2, 0.8, 0.2, 1)',
161
+ });
162
+ motion.set(pill, animation);
163
+ return animation;
164
+ }
165
+
166
+ function toggle(group) {
167
+ const { button, key, items } = group;
168
+ const collapsed = button.getAttribute('aria-expanded') === 'true';
169
+ if (collapsed && items.some(pill => pill.contains(document.activeElement))) {
170
+ button.focus({ preventScroll: true });
171
+ }
172
+ setCollapsed(group, collapsed);
173
+ preferences?.setItem(key, String(collapsed));
174
+ const animate = motionAllowed();
175
+ if (collapsed && animate) {
176
+ for (const pill of items) {
177
+ if (!pill.animate) continue;
178
+ const animation = animateFromHeading(pill, button, true);
179
+ folding.set(pill, animation);
180
+ setAttribute(pill, 'inert', '');
181
+ setAttribute(pill, 'data-tray-view', 'folding');
182
+ animation.onfinish = () => {
183
+ if (folding.get(pill) !== animation) return;
184
+ stopFold(pill);
185
+ setAttribute(pill, 'data-tray-view', 'hidden');
186
+ schedule();
187
+ };
188
+ }
189
+ }
190
+ update();
191
+ if (!collapsed && animate) {
192
+ for (const pill of group.items) {
193
+ if (pill.animate) animateFromHeading(pill, button);
194
+ }
195
+ }
196
+ }
197
+
198
+ tray.addEventListener('keydown', event => {
199
+ if (event.defaultPrevented) return;
200
+ const pill = event.target.closest(`.${PILL}`);
201
+ const head = event.target.closest(`.${HEADER}`);
202
+ const group = headers.find(({ column }) => column === (pill || head)?.dataset.trayCol);
203
+ if (!group || group.button.getAttribute('aria-expanded') !== 'true') return;
204
+ const index = group.items.indexOf(pill);
205
+ if (event.key === 'Escape' && (head || index >= 0)) {
206
+ event.preventDefault();
207
+ event.stopPropagation();
208
+ group.button.focus({ preventScroll: true });
209
+ toggle(group);
210
+ } else if (index >= 0 && event.key === 'Delete') {
211
+ event.preventDefault();
212
+ pill.querySelector('.term-minimized-pill-close')?.click();
213
+ } else if (index >= 0 && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
214
+ event.preventDefault();
215
+ const next = Math.max(0, Math.min(group.items.length - 1, index + (event.key === 'ArrowUp' ? -1 : 1)));
216
+ targetOf(group.items[next]).focus({ preventScroll: true });
217
+ } else if (index >= 0 && (event.key === 'Enter' || event.key === ' ') &&
218
+ event.target.classList.contains('term-minimized-pill-label') && event.target.getAttribute('role') === 'button') {
219
+ event.preventDefault();
220
+ pill.click();
221
+ }
222
+ });
223
+ tray.addEventListener('focusin', event => { pendingFocus = event.target.closest(`.${PILL}`); });
224
+
225
+ function update() {
226
+ const blocks = { running: [], waiting: [], done: [] };
227
+ let parentBlock;
228
+ const moves = [];
229
+ const focusedGroup = headers.find(group => group.items.includes(pendingFocus));
230
+ const focusIndex = focusedGroup?.items.indexOf(pendingFocus) ?? -1;
231
+ const animate = motionAllowed();
232
+ for (const node of tray.children) {
233
+ const group = node.classList.contains(GROUP);
234
+ if (!group && !node.classList.contains(PILL)) continue;
235
+ const column = trayColumnOf(node);
236
+ const items = group ? node.querySelectorAll(`:scope > .${PILL}`) : [node];
237
+ const visible = [];
238
+ for (const pill of items) {
239
+ const previous = pill.dataset.trayCol;
240
+ if (animate && pill.animate && previous && previous !== column && pill.dataset.trayView === 'open') {
241
+ const origin = pill.getBoundingClientRect();
242
+ if (origin.width && origin.height) moves.push({ pill, origin });
243
+ }
244
+ setAttribute(pill, 'data-tray-col', column);
245
+ if (isProducerVisible(node) && isProducerVisible(pill)) {
246
+ preparePill(pill);
247
+ visible.push(pill);
248
+ if (!animate || previous !== column) stopFold(pill);
249
+ } else {
250
+ stopFold(pill);
251
+ setAttribute(pill, 'data-tray-view', 'hidden');
252
+ }
253
+ }
254
+ if (group) {
255
+ setAttribute(node, 'data-tray-col', column);
256
+ setAttribute(node, 'data-tray-group-empty', String(visible.length === 0));
257
+ if (parentBlock) parentBlock.push(...visible);
258
+ else blocks[column].push(visible);
259
+ } else {
260
+ parentBlock = visible;
261
+ blocks[column].push(parentBlock);
262
+ }
263
+ }
264
+ // Producers append sessions in creation order. Reverse the parent blocks,
265
+ // keeping each provider's sub-agent order directly after its parent.
266
+ const columns = Object.fromEntries(Object.entries(blocks).map(([column, list]) => [column, list.reverse().flat()]));
267
+ for (const pill of folding.keys()) {
268
+ if (!tray.contains(pill)) stopFold(pill);
269
+ }
270
+
271
+ const groups = Object.values(columns).filter(items => items.length).length;
272
+ setAttribute(tray, 'data-tray-groups', String(groups));
273
+ setAttribute(tray, 'data-tray-empty', String(groups === 0));
274
+ const top = tray.getBoundingClientRect?.().top || 0;
275
+ const headingHeight = globalThis.matchMedia?.('(pointer: coarse)').matches ? 44 : 28;
276
+ const firstRow = headingHeight + 4;
277
+ const available = (globalThis.innerHeight || 800) - top - firstRow - 8;
278
+ let slot = 0;
279
+ for (const { column, button, count } of headers) {
280
+ const total = columns[column].length;
281
+ setAttribute(button, 'data-tray-count', String(total));
282
+ setAttribute(button, 'data-tray-slot', String(total ? ++slot : 1));
283
+ setText(count, String(total));
284
+ }
285
+
286
+ // Allocate each open group's overflow lanes immediately to its left. Separate lanes
287
+ // keep sessions and headings from overlapping when multiple groups are open.
288
+ let lane = 0;
289
+ let bottom = headingHeight;
290
+ for (const group of headers.slice().reverse()) {
291
+ const { column, button } = group;
292
+ const items = columns[column];
293
+ const open = button.getAttribute('aria-expanded') === 'true';
294
+ group.items = open ? items : [];
295
+ if (!items.length) continue;
296
+ setStyle(button, '--tray-lane', String(lane));
297
+ const shown = open || items.some(pill => folding.has(pill));
298
+ const { row, gap, rows, columns: lanes } = accordionLayout(shown ? items.length : 0, available);
299
+ items.forEach((pill, index) => {
300
+ if (open) stopFold(pill);
301
+ const fold = folding.has(pill);
302
+ setAttribute(pill, 'data-tray-slot', button.dataset.traySlot);
303
+ setAttribute(pill, 'data-tray-view', open ? 'open' : fold ? 'folding' : 'hidden');
304
+ if (!open && !fold) return;
305
+ setStyle(pill, '--tray-lane', String(lane + Math.floor(index / rows)));
306
+ const y = firstRow + (index % rows) * (row + gap);
307
+ setStyle(pill, '--tray-top', `${y}px`);
308
+ bottom = Math.max(bottom, y + row);
309
+ setStyle(pill, '--tray-row', `${row}px`);
310
+ });
311
+ lane += lanes;
312
+ }
313
+ setStyle(tray, '--tray-tracks', String(Math.max(1, lane)));
314
+ setStyle(tray, '--tray-height', `${bottom}px`);
315
+ setStyle(tray, '--tray-head-height', `${headingHeight}px`);
316
+
317
+ for (const { pill, origin } of moves) {
318
+ motion.get(pill)?.cancel();
319
+ const destination = pill.getBoundingClientRect();
320
+ if (!destination.width || !destination.height) continue;
321
+ const x = origin.left - destination.left;
322
+ const y = origin.top - destination.top;
323
+ if (x || y) {
324
+ motion.set(pill, pill.animate([{ translate: `${x}px ${y}px` }, { translate: 'none' }], {
325
+ duration: 200, easing: 'cubic-bezier(0.2, 0.8, 0.2, 1)',
326
+ }));
327
+ }
328
+ }
329
+
330
+ if (pendingFocus && (!tray.contains(pendingFocus) || pendingFocus.dataset.trayView === 'hidden')) {
331
+ const old = pendingFocus;
332
+ pendingFocus = null;
333
+ if (document.activeElement === document.body || old.contains(document.activeElement)) {
334
+ const current = headers.find(group => group.column === old.dataset.trayCol);
335
+ const next = current?.items[Math.min(Math.max(0, focusIndex), current.items.length - 1)];
336
+ const fallback = headers.find(group => group.button.dataset.trayCount !== '0');
337
+ (targetOf(next) || (current?.button.dataset.trayCount !== '0' && current?.button) ||
338
+ fallback?.button)?.focus({ preventScroll: true });
339
+ }
340
+ }
341
+ }
342
+
343
+ let queued = false;
344
+ function schedule() {
345
+ if (queued) return;
346
+ queued = true;
347
+ requestAnimationFrame(() => { queued = false; update(); });
348
+ }
349
+ update();
350
+ new MutationObserver(records => {
351
+ if (records.some(record => {
352
+ const target = record.target.nodeType === 1 ? record.target : record.target.parentElement;
353
+ if (!target || target.closest(`.${HEADER}`)) return false;
354
+ if (record.type === 'attributes') {
355
+ if (target === tray) return false;
356
+ if (record.attributeName === 'style') {
357
+ // Positioning is ours. Only a provider changing display affects membership.
358
+ const wasHidden = /(?:^|;)\s*display:\s*none\b/i.test(record.oldValue || '');
359
+ return wasHidden !== (target.style.display === 'none');
360
+ }
361
+ return true;
362
+ }
363
+ return target === tray || !!target.closest(`.${PILL}`) || target.classList.contains(GROUP);
364
+ })) schedule();
365
+ }).observe(tray, {
366
+ childList: true, characterData: true, subtree: true, attributes: true, attributeOldValue: true,
367
+ attributeFilter: ['class', 'data-status', 'style', 'hidden'],
368
+ });
369
+ if (globalThis.ResizeObserver) {
370
+ const resize = new ResizeObserver(schedule);
371
+ resize.observe(tray);
372
+ if (tray.parentElement) resize.observe(tray.parentElement);
373
+ }
374
+ globalThis.addEventListener?.('resize', schedule);
375
+ }
@@ -11,11 +11,11 @@ import { state, emit, on } from './state.js';
11
11
  import { KEYS } from './constants.js';
12
12
  import { storage } from './storage.js';
13
13
  import { isGuest, hasPermission } from './ui-sync.js';
14
- import { openSettingsModal } from './ui-settings.js';
14
+ import { openSettingsModal } from './ui-settings-entry.js';
15
15
  import { fetchRulesStatus } from './api.js';
16
16
  import { registerContextMenuArea } from './context-menu-areas.js';
17
17
  import { frameRect } from './app-frame.js';
18
- import { windowTakesKey } from './window-keys.js';
18
+ import { windowTakesKey, escapeBelongsElsewhere } from './window-keys.js';
19
19
  import { readListItems, writeListItems, fitListLevels, indentListItem, outdentListItem, listMarkers } from './whiteboard-list.js';
20
20
 
21
21
  // ── Helpers ──
@@ -938,7 +938,12 @@ function updateElementDOM(dom, el) {
938
938
  }
939
939
  } else if (el.type === 'image') {
940
940
  const img = dom.querySelector('img');
941
- if (img && img.src !== el.dataUrl) img.src = el.dataUrl;
941
+ // Reading img.src makes the engine parse the whole data URL (megabytes for a photo) to hand it back: once
942
+ // per image per update, so on every frame of any drag. The last value written is remembered instead.
943
+ if (img && dom._wbImgSrc !== el.dataUrl) {
944
+ if (img.src !== el.dataUrl) img.src = el.dataUrl;
945
+ dom._wbImgSrc = el.dataUrl;
946
+ }
942
947
  } else if (el.type === 'section') {
943
948
  const def = SECTION_TYPES[el.sectionType] || SECTION_TYPES.content;
944
949
  const color = el.color || def.color;
@@ -2604,8 +2609,10 @@ function onMouseMove(e) {
2604
2609
 
2605
2610
  // While actively dragging/drawing, suppress ambient transitions + glow/pulse
2606
2611
  // animations (consumed by the body.ui-interacting CSS kill-switch at
2607
- // styles.css:7231). classList.add is idempotent — cheap to call each move.
2608
- if (_drag || _marquee || _shapeCreating || _sectionCreating || _penPoints) {
2612
+ // styles.css:7231). Set once per gesture: adding a class that is already there still tells every
2613
+ // observer of <body>'s class that it changed, so each move of a gesture woke them all.
2614
+ if ((_drag || _marquee || _shapeCreating || _sectionCreating || _penPoints)
2615
+ && !document.body.classList.contains('ui-interacting')) {
2609
2616
  document.body.classList.add('ui-interacting');
2610
2617
  }
2611
2618
 
@@ -3069,6 +3076,29 @@ export function isEditorPanelKeyTarget(el) {
3069
3076
  return !!el?.closest?.('#fe-editor-panel');
3070
3077
  }
3071
3078
 
3079
+ /**
3080
+ * Whether the board has something an Escape would cancel, from a reading of its state (tests/whiteboard-escape.test.mjs):
3081
+ * a tool other than select, a selection, multi-select mode, something being drawn (a shape, a section, an arrow, a
3082
+ * pen stroke), a drag or a marquee, a text or list left in edit, its context menu or its handles.
3083
+ */
3084
+ export function boardEscapeWork(s) {
3085
+ return !!(s && (
3086
+ (s.tool && s.tool !== 'select') || s.selected > 0 || s.multiSelect || s.creating || s.gesture || s.editing || s.menu
3087
+ ));
3088
+ }
3089
+
3090
+ function boardHasEscapeWork() {
3091
+ return boardEscapeWork({
3092
+ tool: _activeTool,
3093
+ selected: _selectedIds.size + (_selectedId ? 1 : 0),
3094
+ multiSelect: _multiSelectMode,
3095
+ creating: !!(_shapeCreating || _sectionCreating || _arrowCreating || _penPoints),
3096
+ gesture: !!(_drag || _marquee),
3097
+ editing: !!_root?.querySelector?.('.wb-text.editing, .wb-list.editing'),
3098
+ menu: !!(_ctxMenu || _rotateEl || _moveEl),
3099
+ });
3100
+ }
3101
+
3072
3102
  function onKeyDown(e) {
3073
3103
  if (!isWhiteboardActive()) return;
3074
3104
 
@@ -3185,6 +3215,12 @@ function onKeyDown(e) {
3185
3215
  return;
3186
3216
  }
3187
3217
  if (e.key === 'Escape') {
3218
+ // Escape is the board's only when it has something of its own to cancel (a tool, a selection, a shape, a
3219
+ // section or an arrow being drawn, a drag, its menu or handles), and not while a dialog, picker, menu or
3220
+ // dropdown outside the board is open: those close on Escape first (window-keys.js). Otherwise the key goes
3221
+ // on, untouched, to whoever listens for it (the terminal's folder picker, the workspaces dropdown and its
3222
+ // dialogs used to never hear it while the board showed).
3223
+ if (!boardHasEscapeWork() || escapeBelongsElsewhere(e, ae)) return;
3188
3224
  if (_shapeCreating) {
3189
3225
  _elements = _elements.filter(el => el.id !== _shapeCreating.id);
3190
3226
  _shapeCreating = null;
@@ -3651,6 +3687,15 @@ const focusMenuArea = {
3651
3687
  // INIT
3652
3688
  // ═══════════════════════════════════════════
3653
3689
 
3690
+ // The saved board's first load (initWhiteboard → loadPersisted, which never rejects). Focus Mode's first view is this
3691
+ // board: the 3D page shows itself once it is drawn (variant/3d/app.js boot).
3692
+ let _boardLoaded = null;
3693
+
3694
+ /** Resolves once the saved board was read and drawn (or could not be read); at once before initWhiteboard. */
3695
+ export function whiteboardLoaded() {
3696
+ return _boardLoaded || Promise.resolve();
3697
+ }
3698
+
3654
3699
  export function initWhiteboard() {
3655
3700
  _root = $('wb-root');
3656
3701
  _toolbar = $('wb-toolbar');
@@ -3679,7 +3724,7 @@ export function initWhiteboard() {
3679
3724
  // server returns the saved board (loadPersisted is async — fetches /api/whiteboard).
3680
3725
  renderAll();
3681
3726
  updateUndoButtons();
3682
- loadPersisted().then(() => { renderAll(); updateUndoButtons(); });
3727
+ _boardLoaded = loadPersisted().then(() => { renderAll(); updateUndoButtons(); });
3683
3728
 
3684
3729
  // Mouse events
3685
3730
  _root.addEventListener('mousedown', onMouseDown);
@@ -182,13 +182,40 @@ export function endWorkerRunOnClose(runId, stop, { busy = false } = {}) {
182
182
  /**
183
183
  * Show the Assistant session that dispatched a run: focused where it is open
184
184
  * (the terminal tab or the sidepanel), else opened in the Assistant sidepanel.
185
+ * A run that names no session still goes back to the Assistant: the one last
186
+ * used, else one in the Assistant sidepanel (`assistant:open`).
185
187
  */
186
188
  export function backToAssistant(assistantSessionId) {
187
- if (!assistantSessionId) return false;
189
+ if (!assistantSessionId) {
190
+ emit('assistant:open', { host: 'sidepanel' });
191
+ return false;
192
+ }
188
193
  emit('assistant:show', { sessionId: assistantSessionId, host: 'sidepanel' });
189
194
  return true;
190
195
  }
191
196
 
197
+ /**
198
+ * The card's button, in every panel: close the worker's tab with `close` (the
199
+ * panel's own close, what its X runs: the run is completed or stopped there,
200
+ * and a panel left with no tab hides, with no new session in it), then bring
201
+ * the Assistant that dispatched the run to the front. Nothing is shown when
202
+ * `close` answers `false` (the panel asked first and the user kept the tab).
203
+ *
204
+ * `close` must have put the panel where it stays before it returns: the
205
+ * Assistant takes the screen right after, and a panel that showed or hid
206
+ * itself later (an await between the decision and the change) would take the
207
+ * slot back from it.
208
+ *
209
+ * @param {{ assistantSessionId?: string|null }} view a workerEndView() result
210
+ * @param {() => (void | boolean | Promise<void | boolean>)} close
211
+ * @returns {Promise<boolean>} whether the tab closed
212
+ */
213
+ export async function leaveWorkerTab(view, close) {
214
+ if ((await close()) === false) return false;
215
+ backToAssistant(view?.assistantSessionId || null);
216
+ return true;
217
+ }
218
+
192
219
  /**
193
220
  * The card. Every element takes the owning panel's classes, so it is drawn in
194
221
  * that panel's type and colours; `data-tone` (ok, warn, err, off) is what the
@@ -314,6 +314,8 @@ function showClearDialog() {
314
314
 
315
315
  // Keyboard
316
316
  const onKey = (e) => {
317
+ // Closed by a button or a click outside: the listener goes with the dialog instead of staying for good.
318
+ if (!overlay.isConnected) { document.removeEventListener('keydown', onKey); return; }
317
319
  if (e.key === 'Escape') {
318
320
  dismiss();
319
321
  document.removeEventListener('keydown', onKey);
@@ -383,6 +385,8 @@ function confirmDeleteWorkspace(id, name) {
383
385
  });
384
386
 
385
387
  const onKey = (e) => {
388
+ // Closed by a button or a click outside: the listener goes with the dialog instead of staying for good.
389
+ if (!overlay.isConnected) { document.removeEventListener('keydown', onKey); return; }
386
390
  if (e.key === 'Escape') { dismiss(); document.removeEventListener('keydown', onKey); }
387
391
  };
388
392
  document.addEventListener('keydown', onKey);
@@ -719,6 +723,15 @@ export function initWorkspaces() {
719
723
  }
720
724
  });
721
725
 
726
+ // Escape closes the dropdown, as every other dropdown of the bar, and gives the focus back to its button. A dialog
727
+ // it opened on top (delete, save, clear: .tag-delete-overlay) takes that Escape first, with its own listener.
728
+ document.addEventListener('keydown', (e) => {
729
+ if (e.key !== 'Escape' || !_isOpen || e.defaultPrevented) return;
730
+ if (document.querySelector('.tag-delete-overlay')) return;
731
+ closeDropdown();
732
+ $('ws-indicator')?.focus({ preventScroll: true });
733
+ });
734
+
722
735
  // Close on global dropdown close event
723
736
  on('panel:close-all-dropdowns', () => closeDropdown());
724
737
  on('panel:close-all-dropdowns-except', (name) => {
@@ -36,3 +36,74 @@ export function windowTakesKey(event, active = globalThis.document?.activeElemen
36
36
  if (inside(active, BOARD)) return false;
37
37
  return escapeWindowOpen(doc);
38
38
  }
39
+
40
+ // ── Escape and everything else that opens over the page ──
41
+ //
42
+ // The two windows above were found one at a time; the terminal's folder picker and the workspaces dropdown (and
43
+ // its dialogs) had the same fate: they close on Escape from a listener at the document, and the board, listening
44
+ // ahead of them, stopped every Escape. The rule now: the board takes Escape only when it has something of its own
45
+ // to cancel (ui-whiteboard.js, boardHasEscapeWork), and not even then while any of these shows outside the board.
46
+ // They are SynaBun's pickers, dialogs, dropdowns and menus by name, and anything the page marks as a dialog, a menu
47
+ // or a list of choices (ARIA roles, <dialog open>, aria-modal) while it is on screen. Shown means rendered: an
48
+ // element hidden by `hidden`, display:none, visibility:hidden, opacity 0 or a skipped subtree (a closed side panel)
49
+ // is not open.
50
+
51
+ /** What takes Escape from the board while it shows outside the board. */
52
+ export const ESCAPE_OVERLAYS = Object.freeze([
53
+ ...ESCAPE_WINDOWS,
54
+ '#settings-panel',
55
+ '.term-picker-overlay', // the terminal's folder and project pickers (ui-terminal.js)
56
+ '#ws-dropdown', // the workspaces dropdown (ui-workspaces.js)
57
+ '.tag-delete-overlay', // the shared confirm dialogs: the workspaces' save / clear / delete, and more
58
+ '.fe-modal-overlay', '.fe-ctx-flyout', '.fe-git-popover',
59
+ '.studio-backdrop', '.resume-prompt-overlay', '.sched-prompt-backdrop', '.kb-backdrop', '.ig-backdrop', '.sm-backdrop',
60
+ '.ss-dlg-overlay', '.ss-fd-backdrop', '.ocpv2-name-modal-overlay', '.mtc-settings-overlay', '.cr-modal-overlay',
61
+ '.menubar-item.open', '#topright-overflow-menu', '.cc-dropdown.open',
62
+ 'dialog[open]', '[aria-modal="true"]', '[role="dialog"]', '[role="alertdialog"]', '[role="menu"]', '[role="listbox"]',
63
+ ]);
64
+
65
+ /** Whether `el` is on screen (see above). Without layout (node --test) an element counts when it is not hidden. */
66
+ export function isShown(el, view = globalThis) {
67
+ if (!el || el.isConnected === false) return false;
68
+ try {
69
+ if (typeof el.closest === 'function' && el.closest('[hidden], [inert]')) return false;
70
+ if (typeof el.checkVisibility === 'function') {
71
+ return el.checkVisibility({ checkOpacity: true, checkVisibilityCSS: true, contentVisibilityAuto: false });
72
+ }
73
+ if (typeof el.getClientRects === 'function' && !el.getClientRects().length) return false;
74
+ const style = typeof view.getComputedStyle === 'function' ? view.getComputedStyle(el) : null;
75
+ if (style && (style.visibility === 'hidden' || style.display === 'none' || Number(style.opacity) === 0)) return false;
76
+ return true;
77
+ } catch {
78
+ return false;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * The first overlay of ESCAPE_OVERLAYS shown outside the board, or null.
84
+ * @param {Document} [doc]
85
+ * @param {{ selectors?: readonly string[], view?: any }} [options]
86
+ */
87
+ export function openEscapeOverlay(doc = globalThis.document, { selectors = ESCAPE_OVERLAYS, view = globalThis } = {}) {
88
+ if (!doc || typeof doc.querySelectorAll !== 'function') return null;
89
+ for (const selector of selectors) {
90
+ let found;
91
+ try { found = doc.querySelectorAll(selector); } catch { continue; } // a selector an older engine cannot read
92
+ for (const el of found) {
93
+ if (inside(el, BOARD)) continue; // the board's own menus are the board's to close
94
+ if (isShown(el, view)) return el;
95
+ }
96
+ }
97
+ return null;
98
+ }
99
+
100
+ /**
101
+ * Whether the board leaves this Escape to something else: an open window (windowTakesKey) or an overlay shown
102
+ * outside the board, wherever the focus is. The board asks only when no text or list of its own is being edited
103
+ * (an edit in progress still ends on Escape: ui-whiteboard.js handles that before it asks).
104
+ */
105
+ export function escapeBelongsElsewhere(event, active = globalThis.document?.activeElement, doc = globalThis.document, view = globalThis) {
106
+ if (!event || event.key !== 'Escape') return false;
107
+ if (windowTakesKey(event, active, doc)) return true;
108
+ return !!openEscapeOverlay(doc, { view });
109
+ }
@@ -39,6 +39,7 @@ import { updateStats, initStats } from '../../shared/ui-stats.js';
39
39
  import { initExplorer } from '../../shared/ui-explorer.js';
40
40
  import { initFileExplorer } from '../../shared/ui-file-explorer.js';
41
41
  import { initSkillsStudio } from '../../shared/ui-skills.js';
42
+ import { initAgentsStudio } from '../../shared/ui-agents.js';
42
43
  import { initStyleGuide } from '../../shared/ui-styleguide.js';
43
44
  import { initTerminal } from '../../shared/ui-terminal.js';
44
45
  import { initLink } from '../../shared/ui-link.js';
@@ -482,6 +483,7 @@ initStats();
482
483
  initExplorer();
483
484
  initFileExplorer();
484
485
  initSkillsStudio();
486
+ initAgentsStudio();
485
487
  initStyleGuide();
486
488
  initAutomationStudio();
487
489
  initSchedulesStudio();