synabun 2.3.1 → 2.4.1

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 (370) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +1 -1
  3. package/browser-extension/content.js +189 -0
  4. package/browser-extension/engine.js +508 -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 +250 -0
  17. package/browser-extension/popup-view.js +151 -0
  18. package/browser-extension/popup.css +166 -0
  19. package/browser-extension/popup.html +108 -0
  20. package/browser-extension/popup.js +359 -0
  21. package/browser-extension/protocol.js +232 -0
  22. package/browser-extension/service-worker.js +275 -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/lib/data-home-files.js +45 -0
  28. package/lib/data-home-migration.js +34 -58
  29. package/mcp-server/dist/http.d.ts +2 -0
  30. package/mcp-server/dist/http.d.ts.map +1 -1
  31. package/mcp-server/dist/http.js +9 -1
  32. package/mcp-server/dist/http.js.map +1 -1
  33. package/mcp-server/dist/index.d.ts +11 -0
  34. package/mcp-server/dist/index.d.ts.map +1 -1
  35. package/mcp-server/dist/index.js +38 -3
  36. package/mcp-server/dist/index.js.map +1 -1
  37. package/mcp-server/dist/services/browser-route-flow.d.ts +6 -2
  38. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
  39. package/mcp-server/dist/services/browser-route-flow.js +10 -3
  40. package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
  41. package/mcp-server/dist/services/codex-config-heal.d.ts.map +1 -1
  42. package/mcp-server/dist/services/codex-config-heal.js +7 -0
  43. package/mcp-server/dist/services/codex-config-heal.js.map +1 -1
  44. package/mcp-server/dist/services/neural-interface.d.ts +95 -3
  45. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  46. package/mcp-server/dist/services/neural-interface.js +168 -23
  47. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  48. package/mcp-server/dist/services/team-context.d.ts +18 -0
  49. package/mcp-server/dist/services/team-context.d.ts.map +1 -0
  50. package/mcp-server/dist/services/team-context.js +29 -0
  51. package/mcp-server/dist/services/team-context.js.map +1 -0
  52. package/mcp-server/dist/services/tool-catalog.d.ts +5 -2
  53. package/mcp-server/dist/services/tool-catalog.d.ts.map +1 -1
  54. package/mcp-server/dist/services/tool-catalog.js +22 -6
  55. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  56. package/mcp-server/dist/services/tool-list.d.ts.map +1 -1
  57. package/mcp-server/dist/services/tool-list.js +4 -0
  58. package/mcp-server/dist/services/tool-list.js.map +1 -1
  59. package/mcp-server/dist/services/tool-runtime.d.ts +8 -1
  60. package/mcp-server/dist/services/tool-runtime.d.ts.map +1 -1
  61. package/mcp-server/dist/services/tool-runtime.js +18 -1
  62. package/mcp-server/dist/services/tool-runtime.js.map +1 -1
  63. package/mcp-server/dist/tools/agent-definition.d.ts +133 -0
  64. package/mcp-server/dist/tools/agent-definition.d.ts.map +1 -0
  65. package/mcp-server/dist/tools/agent-definition.js +483 -0
  66. package/mcp-server/dist/tools/agent-definition.js.map +1 -0
  67. package/mcp-server/dist/tools/agents.d.ts +92 -9
  68. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  69. package/mcp-server/dist/tools/agents.js +163 -20
  70. package/mcp-server/dist/tools/agents.js.map +1 -1
  71. package/mcp-server/dist/tools/browser-advanced.d.ts +8 -1
  72. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  73. package/mcp-server/dist/tools/browser-advanced.js +70 -6
  74. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  75. package/mcp-server/dist/tools/git-tools.d.ts +4 -2
  76. package/mcp-server/dist/tools/git-tools.d.ts.map +1 -1
  77. package/mcp-server/dist/tools/git-tools.js +283 -2
  78. package/mcp-server/dist/tools/git-tools.js.map +1 -1
  79. package/mcp-server/dist/tools/morelogin.d.ts +8 -2
  80. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  81. package/mcp-server/dist/tools/morelogin.js +22 -5
  82. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  83. package/mcp-server/dist/tools/team.d.ts +32 -0
  84. package/mcp-server/dist/tools/team.d.ts.map +1 -0
  85. package/mcp-server/dist/tools/team.js +87 -0
  86. package/mcp-server/dist/tools/team.js.map +1 -0
  87. package/mcp-server/package-lock.json +2 -2
  88. package/mcp-server/package.json +1 -1
  89. package/mcp-server/src/http.ts +9 -1
  90. package/mcp-server/src/index.ts +34 -4
  91. package/mcp-server/src/services/browser-route-flow.ts +12 -5
  92. package/mcp-server/src/services/codex-config-heal.ts +7 -0
  93. package/mcp-server/src/services/neural-interface.ts +191 -29
  94. package/mcp-server/src/services/team-context.ts +27 -0
  95. package/mcp-server/src/services/tool-catalog.ts +26 -8
  96. package/mcp-server/src/services/tool-list.ts +4 -0
  97. package/mcp-server/src/services/tool-runtime.ts +21 -2
  98. package/mcp-server/src/tools/agent-definition.ts +458 -0
  99. package/mcp-server/src/tools/agents.ts +177 -19
  100. package/mcp-server/src/tools/browser-advanced.ts +60 -6
  101. package/mcp-server/src/tools/git-tools.ts +249 -3
  102. package/mcp-server/src/tools/morelogin.ts +20 -5
  103. package/mcp-server/src/tools/team.ts +97 -0
  104. package/neural-interface/i18n/en.json +1119 -47
  105. package/neural-interface/i18n/pt-BR.json +1119 -47
  106. package/neural-interface/lib/account-usage.js +1 -1
  107. package/neural-interface/lib/agents/builtins.json +207 -0
  108. package/neural-interface/lib/agents/density.js +101 -0
  109. package/neural-interface/lib/agents/forge-host.js +223 -0
  110. package/neural-interface/lib/agents/native-export-targets.js +190 -0
  111. package/neural-interface/lib/agents/native-export.js +365 -0
  112. package/neural-interface/lib/agents/registry.js +885 -0
  113. package/neural-interface/lib/agents/resolve.js +603 -0
  114. package/neural-interface/lib/agents/schema.js +642 -0
  115. package/neural-interface/lib/agents/split.js +37 -0
  116. package/neural-interface/lib/agents-studio-api.js +591 -0
  117. package/neural-interface/lib/assistant-api.js +76 -7
  118. package/neural-interface/lib/assistant-brains/opencode.js +60 -11
  119. package/neural-interface/lib/assistant-catalog.js +2 -0
  120. package/neural-interface/lib/assistant-continuity.js +49 -0
  121. package/neural-interface/lib/assistant-dispatch.js +351 -121
  122. package/neural-interface/lib/assistant-persona.js +105 -8
  123. package/neural-interface/lib/assistant-route-gate.js +24 -9
  124. package/neural-interface/lib/assistant-router.js +432 -47
  125. package/neural-interface/lib/assistant-run-tail.js +151 -0
  126. package/neural-interface/lib/assistant-run-wait.js +183 -0
  127. package/neural-interface/lib/assistant-runtime.js +449 -94
  128. package/neural-interface/lib/assistant-task-prompt.js +11 -2
  129. package/neural-interface/lib/assistant-usage.js +3 -2
  130. package/neural-interface/lib/automation-approval.js +2 -2
  131. package/neural-interface/lib/backup-service.js +64 -105
  132. package/neural-interface/lib/browser-close-evidence.js +80 -0
  133. package/neural-interface/lib/browser-default.js +210 -0
  134. package/neural-interface/lib/browser-extension-adapter.js +264 -0
  135. package/neural-interface/lib/browser-extension-bridge.js +441 -0
  136. package/neural-interface/lib/browser-extension-folder.js +116 -0
  137. package/neural-interface/lib/browser-extension-setup.js +140 -0
  138. package/neural-interface/lib/browser-profile-choices.js +3 -3
  139. package/neural-interface/lib/browser-tool-policy.js +1 -1
  140. package/neural-interface/lib/claude-account-links.js +301 -0
  141. package/neural-interface/lib/claude-accounts.js +45 -20
  142. package/neural-interface/lib/claude-agent-bridge.js +142 -10
  143. package/neural-interface/lib/claude-model-catalog.js +6 -0
  144. package/neural-interface/lib/claude-panel-session.js +33 -0
  145. package/neural-interface/lib/codex-accounts.js +67 -24
  146. package/neural-interface/lib/coordination/README.md +384 -0
  147. package/neural-interface/lib/coordination/service.js +563 -0
  148. package/neural-interface/lib/coordination/store.js +1138 -0
  149. package/neural-interface/lib/db.js +22 -1
  150. package/neural-interface/lib/effort-levels.js +10 -1
  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 +194 -8
  157. package/neural-interface/lib/native-loop-runtime.js +26 -7
  158. package/neural-interface/lib/opencode-build-preflight.js +28 -8
  159. package/neural-interface/lib/opencode-native-boundary.js +83 -13
  160. package/neural-interface/lib/opencode-serve-records.js +14 -9
  161. package/neural-interface/lib/page-session.js +1 -1
  162. package/neural-interface/lib/peer-identity.js +73 -29
  163. package/neural-interface/lib/process-identity.js +68 -7
  164. package/neural-interface/lib/request-gate.js +3 -0
  165. package/neural-interface/lib/screenshot-location.js +33 -0
  166. package/neural-interface/lib/session-cache-builder.js +41 -3
  167. package/neural-interface/lib/skills/creation.js +1 -1
  168. package/neural-interface/lib/skills/known-bridge-digests.json +40 -0
  169. package/neural-interface/lib/studio-attention.js +56 -0
  170. package/neural-interface/lib/teams/README.md +382 -0
  171. package/neural-interface/lib/teams/api.js +287 -0
  172. package/neural-interface/lib/teams/brief.js +185 -0
  173. package/neural-interface/lib/teams/claims.js +315 -0
  174. package/neural-interface/lib/teams/git.js +293 -0
  175. package/neural-interface/lib/teams/index.js +122 -0
  176. package/neural-interface/lib/teams/integration.js +580 -0
  177. package/neural-interface/lib/teams/landing.js +184 -0
  178. package/neural-interface/lib/teams/recovery.js +256 -0
  179. package/neural-interface/lib/teams/scheduler.js +1474 -0
  180. package/neural-interface/lib/teams/schema.js +559 -0
  181. package/neural-interface/lib/teams/state.js +181 -0
  182. package/neural-interface/lib/teams/test-runner.js +86 -0
  183. package/neural-interface/lib/teams/test-sandbox.js +99 -0
  184. package/neural-interface/lib/teams/worktrees.js +757 -0
  185. package/neural-interface/lib/tool-permission-choices.js +226 -0
  186. package/neural-interface/lib/whatsapp/cards.js +24 -10
  187. package/neural-interface/lib/worker-confinement.js +206 -6
  188. package/neural-interface/package-lock.json +2 -2
  189. package/neural-interface/package.json +1 -1
  190. package/neural-interface/public/extension-setup.html +107 -0
  191. package/neural-interface/public/index.html +103 -12
  192. package/neural-interface/public/offline.html +4 -3
  193. package/neural-interface/public/shared/agent-runtime-options.js +3 -1
  194. package/neural-interface/public/shared/agents/studio/ax-agent-view.js +614 -0
  195. package/neural-interface/public/shared/agents/studio/ax-api.js +198 -0
  196. package/neural-interface/public/shared/agents/studio/ax-create-view.js +221 -0
  197. package/neural-interface/public/shared/agents/studio/ax-diff.js +143 -0
  198. package/neural-interface/public/shared/agents/studio/ax-editor-view.js +392 -0
  199. package/neural-interface/public/shared/agents/studio/ax-export-view.js +94 -0
  200. package/neural-interface/public/shared/agents/studio/ax-form.js +191 -0
  201. package/neural-interface/public/shared/agents/studio/ax-icons.js +87 -0
  202. package/neural-interface/public/shared/agents/studio/ax-library-view.js +158 -0
  203. package/neural-interface/public/shared/agents/studio/ax-library.js +162 -0
  204. package/neural-interface/public/shared/agents/studio/ax-main.js +712 -0
  205. package/neural-interface/public/shared/agents/studio/ax-native-export.js +35 -0
  206. package/neural-interface/public/shared/agents/studio/ax-options.js +198 -0
  207. package/neural-interface/public/shared/agents/studio/ax-review-view.js +175 -0
  208. package/neural-interface/public/shared/agents/studio/ax-revisions-view.js +189 -0
  209. package/neural-interface/public/shared/agents/studio/ax-runs-view.js +202 -0
  210. package/neural-interface/public/shared/agents/studio/ax-runs.js +82 -0
  211. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +256 -0
  212. package/neural-interface/public/shared/agents/studio/ax-teams.js +200 -0
  213. package/neural-interface/public/shared/agents/studio/ax-templates.js +50 -0
  214. package/neural-interface/public/shared/agents/studio/ax-ui.js +194 -0
  215. package/neural-interface/public/shared/agents/studio/ax-views.js +170 -0
  216. package/neural-interface/public/shared/agy/agy-panel.js +142 -28
  217. package/neural-interface/public/shared/agy/agy-styles.js +25 -5
  218. package/neural-interface/public/shared/api.js +2 -1
  219. package/neural-interface/public/shared/assistant/asst-account-menu.js +13 -13
  220. package/neural-interface/public/shared/assistant/asst-ask-styles.js +2 -3
  221. package/neural-interface/public/shared/assistant/asst-brain-picker.js +91 -9
  222. package/neural-interface/public/shared/assistant/asst-control.js +3 -0
  223. package/neural-interface/public/shared/assistant/asst-interaction-hold.js +99 -0
  224. package/neural-interface/public/shared/assistant/asst-limit-dismissals.js +111 -0
  225. package/neural-interface/public/shared/assistant/asst-limit-dock.js +37 -3
  226. package/neural-interface/public/shared/assistant/asst-limit-wait.js +30 -7
  227. package/neural-interface/public/shared/assistant/asst-panel.js +177 -30
  228. package/neural-interface/public/shared/assistant/asst-rack-styles.js +15 -8
  229. package/neural-interface/public/shared/assistant/asst-render.js +37 -6
  230. package/neural-interface/public/shared/assistant/asst-route.js +80 -12
  231. package/neural-interface/public/shared/assistant/asst-routes-editor.js +148 -70
  232. package/neural-interface/public/shared/assistant/asst-roving.js +17 -1
  233. package/neural-interface/public/shared/assistant/asst-scene-styles.js +7 -2
  234. package/neural-interface/public/shared/assistant/asst-scenes.js +12 -1
  235. package/neural-interface/public/shared/assistant/asst-sidepanel.js +12 -2
  236. package/neural-interface/public/shared/assistant/asst-state.js +66 -1
  237. package/neural-interface/public/shared/assistant/asst-styles.js +98 -44
  238. package/neural-interface/public/shared/assistant/route-identity.js +16 -0
  239. package/neural-interface/public/shared/cc-dropdown.js +21 -15
  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 +34 -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/owner-authority-view.js +4 -10
  279. package/neural-interface/public/shared/page-session.js +1 -1
  280. package/neural-interface/public/shared/schedules-view.js +2 -2
  281. package/neural-interface/public/shared/session-project-items.js +11 -0
  282. package/neural-interface/public/shared/settings/settings-ai-browser.js +119 -0
  283. package/neural-interface/public/shared/settings/settings-browser-extension.js +446 -0
  284. package/neural-interface/public/shared/settings/settings-ia.js +4 -2
  285. package/neural-interface/public/shared/settings/settings-morelogin-cooldown.js +63 -0
  286. package/neural-interface/public/shared/settings/settings-tool-permissions.js +70 -0
  287. package/neural-interface/public/shared/sidepanel-lazy.js +40 -0
  288. package/neural-interface/public/shared/sidepanel-session-status.js +8 -14
  289. package/neural-interface/public/shared/sidepanel-shown.js +73 -0
  290. package/neural-interface/public/shared/start-bridge.js +2 -2
  291. package/neural-interface/public/shared/storage.js +6 -1
  292. package/neural-interface/public/shared/studio-attention.js +83 -0
  293. package/neural-interface/public/shared/styles.css +694 -50
  294. package/neural-interface/public/shared/term-browser-tabs.js +34 -0
  295. package/neural-interface/public/shared/transcript-rows.js +334 -0
  296. package/neural-interface/public/shared/tray-auto-close.js +106 -0
  297. package/neural-interface/public/shared/ui-agents.js +97 -0
  298. package/neural-interface/public/shared/ui-antigravity-panel.js +16 -14
  299. package/neural-interface/public/shared/ui-automation-studio.js +3 -3
  300. package/neural-interface/public/shared/ui-claude-panel.js +162 -95
  301. package/neural-interface/public/shared/ui-code-copy.js +256 -0
  302. package/neural-interface/public/shared/ui-codex-panel.js +14 -10
  303. package/neural-interface/public/shared/ui-context-menu.js +1 -1
  304. package/neural-interface/public/shared/ui-file-explorer.js +2 -3
  305. package/neural-interface/public/shared/ui-games.js +1 -1
  306. package/neural-interface/public/shared/ui-loading.js +83 -19
  307. package/neural-interface/public/shared/ui-maritaca-panel.js +12 -11
  308. package/neural-interface/public/shared/ui-menubar.js +23 -0
  309. package/neural-interface/public/shared/ui-native-loop-router.js +50 -21
  310. package/neural-interface/public/shared/ui-navbar.js +15 -9
  311. package/neural-interface/public/shared/ui-opencode-panel-v2.js +13 -11
  312. package/neural-interface/public/shared/ui-owner-authority.js +48 -25
  313. package/neural-interface/public/shared/ui-schedules-studio.js +3 -3
  314. package/neural-interface/public/shared/ui-scroll-follow.js +39 -0
  315. package/neural-interface/public/shared/ui-sessions.js +3 -3
  316. package/neural-interface/public/shared/ui-settings-entry.js +55 -0
  317. package/neural-interface/public/shared/ui-settings.js +363 -400
  318. package/neural-interface/public/shared/ui-sidepanel-layout.js +44 -25
  319. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +22 -9
  320. package/neural-interface/public/shared/ui-sidepanel-sessions.js +10 -2
  321. package/neural-interface/public/shared/ui-sidepanel-tray.js +36 -41
  322. package/neural-interface/public/shared/ui-sidepanel-windows.js +14 -1
  323. package/neural-interface/public/shared/ui-styleguide.js +10 -2
  324. package/neural-interface/public/shared/ui-sync.js +6 -0
  325. package/neural-interface/public/shared/ui-terminal.js +13 -9
  326. package/neural-interface/public/shared/ui-tooltip.js +28 -7
  327. package/neural-interface/public/shared/ui-topright-overflow.js +26 -4
  328. package/neural-interface/public/shared/ui-tray-columns.js +375 -0
  329. package/neural-interface/public/shared/ui-whiteboard.js +51 -6
  330. package/neural-interface/public/shared/ui-worker-end.js +28 -1
  331. package/neural-interface/public/shared/ui-workspaces.js +13 -0
  332. package/neural-interface/public/shared/window-keys.js +71 -0
  333. package/neural-interface/public/sw.js +4 -3
  334. package/neural-interface/public/variant/2d/main.js +2 -0
  335. package/neural-interface/public/variant/3d/app.js +620 -0
  336. package/neural-interface/public/variant/3d/boot-reveal.js +47 -0
  337. package/neural-interface/public/variant/3d/main.js +30 -544
  338. package/neural-interface/public/variant/3d/map-controls.js +4 -2
  339. package/neural-interface/public/vendor/fonts/fonts.css +508 -0
  340. package/neural-interface/public/vendor/fonts/inter-OFL.txt +93 -0
  341. package/neural-interface/public/vendor/fonts/inter-cyrillic-ext.woff2 +0 -0
  342. package/neural-interface/public/vendor/fonts/inter-cyrillic.woff2 +0 -0
  343. package/neural-interface/public/vendor/fonts/inter-greek-ext.woff2 +0 -0
  344. package/neural-interface/public/vendor/fonts/inter-greek.woff2 +0 -0
  345. package/neural-interface/public/vendor/fonts/inter-latin-ext.woff2 +0 -0
  346. package/neural-interface/public/vendor/fonts/inter-latin.woff2 +0 -0
  347. package/neural-interface/public/vendor/fonts/inter-vietnamese.woff2 +0 -0
  348. package/neural-interface/public/vendor/fonts/jetbrains-mono-OFL.txt +93 -0
  349. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic-ext.woff2 +0 -0
  350. package/neural-interface/public/vendor/fonts/jetbrains-mono-cyrillic.woff2 +0 -0
  351. package/neural-interface/public/vendor/fonts/jetbrains-mono-greek.woff2 +0 -0
  352. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  353. package/neural-interface/public/vendor/fonts/jetbrains-mono-latin.woff2 +0 -0
  354. package/neural-interface/public/vendor/fonts/jetbrains-mono-vietnamese.woff2 +0 -0
  355. package/neural-interface/public/vendor/fonts/manifest.json +142 -0
  356. package/neural-interface/public/vendor/fonts/space-grotesk-OFL.txt +93 -0
  357. package/neural-interface/public/vendor/fonts/space-grotesk-latin-ext.woff2 +0 -0
  358. package/neural-interface/public/vendor/fonts/space-grotesk-latin.woff2 +0 -0
  359. package/neural-interface/public/vendor/fonts/space-grotesk-vietnamese.woff2 +0 -0
  360. package/neural-interface/scripts/boot-graph.mjs +270 -0
  361. package/neural-interface/scripts/vendor-fonts.mjs +124 -0
  362. package/neural-interface/server.js +1083 -164
  363. package/npm-shrinkwrap.json +2 -2
  364. package/package.json +4 -1
  365. package/skills/agent-forge/SKILL.md +182 -0
  366. package/skills/agent-forge/evals/evals.json +56 -0
  367. package/skills/agent-forge/references/definition-fields.md +61 -0
  368. package/skills/agent-forge/references/examples.md +105 -0
  369. package/skills/agent-forge/references/instructions.md +51 -0
  370. package/skills/agent-forge/references/review-and-export.md +84 -0
@@ -1,3 +1,4 @@
1
+ import { sessionProjectItems } from '../session-project-items.js';
1
2
  import { answerWorkerQuestion } from '../worker-questions.js';
2
3
  import { cxpText, cxpSessionLabel } from './cdx-copy.js';
3
4
  import { codexWantsRolloutPreview, rolloutPreviewApplies } from './cdx-preview.js';
@@ -38,9 +39,11 @@ import { skillHintEntries, skillsForPrompt, skillsListRequest } from './cdx-skil
38
39
  import { syncSidepanelLayout, focusSidepanel, isHostedSessionFocused } from '../ui-sidepanel-windows.js';
39
40
  import { notify, NOTIF_TYPE } from '../ui-notifications.js';
40
41
  import { createStickyScrollController } from '../ui-scroll-follow.js';
42
+ import { createDomChangeFlag } from '../dom-change-flag.js';
43
+ import { isFarRowStyleRecord, stripFarRowStyles, watchTranscriptRows } from '../transcript-rows.js';
41
44
  import { requestGeneratedSessionTitle } from '../session-title.js';
42
45
  import { fileLinkText } from '../ui-file-links.js';
43
- import { WORKER_END_CLASS, backToAssistant, buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd } from '../ui-worker-end.js';
46
+ import { WORKER_END_CLASS, buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd, leaveWorkerTab } from '../ui-worker-end.js';
44
47
  import {
45
48
  CODEX_COMMANDS, CODEX_COMMAND_BY_NAME, parseCodexCommand, codexCommandHints,
46
49
  capabilityAvailability, latestCompletedCodexText, configValue,
@@ -595,8 +598,14 @@ function buildWsCallbacks(tab, options = {}) {
595
598
  registerOwnedThreadFromItem(_boundTab, msg.params.item);
596
599
  }
597
600
  if (shouldBufferSocketMessage('notify', msg)) {
598
- bufferSocketMessage('notify', msg);
599
- return;
601
+ const completedTurnId = msg.method === 'turn/completed' && msg.params?.turn?.id;
602
+ if (completedTurnId && completedTurnId === _activeTurnId
603
+ && (!msg.threadId || msg.threadId === _threadId)) {
604
+ resolveBlockedTurn(msg.params.turn.status === 'interrupted' ? 'cancelled' : 'resolved');
605
+ } else {
606
+ bufferSocketMessage('notify', msg);
607
+ return;
608
+ }
600
609
  }
601
610
  if (msg.method && msg.params !== undefined) {
602
611
  handleNotify(msg.method, msg.params);
@@ -723,12 +732,9 @@ function buildWsCallbacks(tab, options = {}) {
723
732
  resolveGenericRequest(msg);
724
733
  },
725
734
 
726
- onClosed(msg) {
727
- if (shouldBufferSocketMessage('closed', msg)) {
728
- bufferSocketMessage('closed', msg);
729
- return;
730
- }
731
- applySocketClosed(msg);
735
+ onClosed() {
736
+ if (hasBlockingServerRequests()) resolveBlockedTurn('cancelled');
737
+ applySocketClosed();
732
738
  },
733
739
 
734
740
  onMessageError(err, raw) {
@@ -1012,7 +1018,7 @@ function shouldBufferSocketMessage(kind, payload) {
1012
1018
  if (kind === 'error' && payload?.requestId && (_renameRequests.has(payload.requestId)
1013
1019
  || _sessionListRequest?.requestId === payload.requestId || _threadStartRequest?.requestId === payload.requestId
1014
1020
  || _pendingQueryRequestId === payload.requestId)) return false;
1015
- return kind === 'notify' || kind === 'error' || kind === 'closed';
1021
+ return kind === 'notify' || kind === 'error';
1016
1022
  }
1017
1023
 
1018
1024
  function bufferSocketMessage(kind, payload) {
@@ -1096,11 +1102,7 @@ function applyBufferedSocketMessage(entry) {
1096
1102
  handleNotify(entry.payload.method, entry.payload.params);
1097
1103
  return;
1098
1104
  }
1099
- if (entry.kind === 'error') {
1100
- applySocketError(entry.payload);
1101
- return;
1102
- }
1103
- if (entry.kind === 'closed') applySocketClosed(entry.payload);
1105
+ if (entry.kind === 'error') applySocketError(entry.payload);
1104
1106
  }
1105
1107
 
1106
1108
  function flushBufferedSocketMessages() {
@@ -1110,6 +1112,18 @@ function flushBufferedSocketMessages() {
1110
1112
  for (const entry of queued) applyBufferedSocketMessage(entry);
1111
1113
  }
1112
1114
 
1115
+ function resolveBlockedTurn(label) {
1116
+ // A terminal event can arrive without a separate serverRequest/resolved for each card.
1117
+ for (const requestId of _blockingServerRequests.keys()) {
1118
+ resolveRequestCard(requestId, label);
1119
+ clearCodexRequestNotif(requestId, _boundTab);
1120
+ }
1121
+ _blockingServerRequests.clear();
1122
+ flushBufferedSocketMessages();
1123
+ updateTrayPillRunning();
1124
+ saveTabs();
1125
+ }
1126
+
1113
1127
 
1114
1128
  // ── Storage/Snapshot utils (lines 123-386) ──
1115
1129
  export function parseStoredJson(key, fallback) {
@@ -1298,6 +1312,7 @@ function writeThreadSnapshot(tab, { force = false } = {}) {
1298
1312
  return;
1299
1313
  }
1300
1314
  const snapshotEl = messagesEl.cloneNode(true);
1315
+ stripFarRowStyles(snapshotEl); // the sizes of rows far from the screen are today's, not the transcript's
1301
1316
  stripMcpAppRuntime(snapshotEl);
1302
1317
  // A worker's end card is drawn again from its run, never restored from markup.
1303
1318
  snapshotEl.querySelectorAll(`.${WORKER_END_CLASS}`).forEach((node) => node.remove());
@@ -1331,6 +1346,9 @@ function writeThreadSnapshot(tab, { force = false } = {}) {
1331
1346
  };
1332
1347
  persistThreadSnapshots(threadId);
1333
1348
  tab._lastSnapshotWriteAt = Date.now();
1349
+ // What is stored now is what the tab shows (threadSnapshotBehind).
1350
+ threadSnapshotFlag(tab)?.clear();
1351
+ tab._snapshotMetaKey = threadSnapshotMetaKey(tab);
1334
1352
  if (t0) codexPerfLog('snapshot:write', {
1335
1353
  force,
1336
1354
  ms: Math.round((performance.now() - t0) * 10) / 10,
@@ -1340,6 +1358,39 @@ function writeThreadSnapshot(tab, { force = false } = {}) {
1340
1358
  });
1341
1359
  }
1342
1360
 
1361
+ // ── Is the stored snapshot behind the tab? ──
1362
+ // The transcript is watched for any change (dom-change-flag.js); the fields stored next to it are compared.
1363
+ function threadSnapshotFlag(tab) {
1364
+ const el = tab?.messagesEl;
1365
+ if (!el) return null;
1366
+ if (tab._snapshotFlagEl !== el) {
1367
+ tab._snapshotFlag?.disconnect();
1368
+ // The far-row declarations (transcript-rows.js) are not part of what is stored: scrolling is no change.
1369
+ tab._snapshotFlag = createDomChangeFlag(el, { ignore: (record) => isFarRowStyleRecord(record, el) });
1370
+ tab._snapshotFlagEl = el;
1371
+ }
1372
+ return tab._snapshotFlag;
1373
+ }
1374
+
1375
+ function threadSnapshotMetaKey(tab) {
1376
+ return JSON.stringify([
1377
+ tab.threadId || '', String(tab.accountId || 'default'), normalizeSessionLabel(tab.sessionLabel || ''),
1378
+ normalizeThreadTokenUsage(tab.threadTokenUsage), normalizeContextTrackerMeta(tab.threadContextMeta),
1379
+ normalizeSnapshotSourceType(tab.transcriptSourceType), normalizeSnapshotItemCount(tab.transcriptItemCount),
1380
+ Number(tab.transcriptSourceUpdatedAt) || null,
1381
+ ]);
1382
+ }
1383
+
1384
+ export function threadSnapshotBehind(tab) {
1385
+ if (!tab) return false;
1386
+ if (tab.snapshotTimer || tab.snapshotIdleHandle) return true; // a write is due
1387
+ if (tab.items instanceof Map) {
1388
+ for (const itemState of tab.items.values()) if (itemState?._bodyDirty) return true; // a card not drawn yet
1389
+ }
1390
+ const flag = threadSnapshotFlag(tab);
1391
+ return !flag || flag.changed() || tab._snapshotMetaKey !== threadSnapshotMetaKey(tab);
1392
+ }
1393
+
1343
1394
  export function scheduleThreadSnapshotSave(tab = _boundTab, { force = false } = {}) {
1344
1395
  if (!tab?.threadId || !tab?.messagesEl) return;
1345
1396
  if (tab.snapshotTimer) clearTimeout(tab.snapshotTimer);
@@ -1532,6 +1583,7 @@ function setPlanApprovalPending(tab = _boundTab, value) {
1532
1583
  if (!tab) return;
1533
1584
  tab.planApprovalPending = !!value;
1534
1585
  syncPlanHandoffFlags(tab);
1586
+ paintTrayPill(tab.pillEl, tab);
1535
1587
  }
1536
1588
 
1537
1589
  function shouldHoldForPlanApproval(tab = activeTab()) {
@@ -1580,7 +1632,6 @@ export function clearPlanHandoffState(tab = _boundTab, { keepFilePath = false }
1580
1632
  tab.showPostPlanActions = false;
1581
1633
  tab.postPlanHeader = 'PLAN COMPLETE';
1582
1634
  tab.planTurnActive = false;
1583
- tab.planApprovalPending = false;
1584
1635
  tab.lastPlanTurnId = '';
1585
1636
  tab.planRequestId = null;
1586
1637
  if (!keepFilePath) tab.planFilePath = '';
@@ -1590,10 +1641,10 @@ export function clearPlanHandoffState(tab = _boundTab, { keepFilePath = false }
1590
1641
  _showPostPlanActions = false;
1591
1642
  _postPlanHeader = 'PLAN COMPLETE';
1592
1643
  _planTurnActive = false;
1593
- _planApprovalPending = false;
1594
1644
  _lastPlanTurnId = '';
1595
1645
  if (!keepFilePath) _planFilePath = '';
1596
1646
  }
1647
+ setPlanApprovalPending(tab, false);
1597
1648
  removePostPlanCards(tab.messagesEl);
1598
1649
  tab.messagesEl?.querySelectorAll('.cxp-plan-document-msg, .cxp-plan-draft-msg').forEach((node) => node.remove());
1599
1650
  tab.messagesEl?.querySelectorAll('[data-plan-source-hidden]').forEach((node) => {
@@ -1729,8 +1780,7 @@ export function extractLatestPlanText(tab = _boundTab) {
1729
1780
 
1730
1781
  export function capturePlanContent(tab = _boundTab) {
1731
1782
  if (!tab) return '';
1732
- syncPlanMirrors(tab);
1733
- if (tab === _boundTab) _planContent = tab.planContent;
1783
+ syncCanonicalPlan(tab);
1734
1784
  return getPlanMarkdown(tab);
1735
1785
  }
1736
1786
 
@@ -1745,6 +1795,7 @@ function syncCanonicalPlan(tab) {
1745
1795
  _planTurnActive = tab.planTurnActive;
1746
1796
  _lastPlanTurnId = tab.lastPlanTurnId || '';
1747
1797
  }
1798
+ paintTrayPill(tab.pillEl, tab);
1748
1799
  }
1749
1800
 
1750
1801
  async function planRequest(body) {
@@ -2051,11 +2102,7 @@ export function projectItems() {
2051
2102
  }
2052
2103
 
2053
2104
  export function projectItemsForValue(value) {
2054
- const items = projectItems();
2055
- if (value && !items.some((item) => item.value === value)) {
2056
- items.unshift({ value, label: basenamePath(value) || value });
2057
- }
2058
- return items;
2105
+ return sessionProjectItems(_projects, value);
2059
2106
  }
2060
2107
 
2061
2108
  function persistProjectThreads() {
@@ -2600,6 +2647,8 @@ function createMessagesEl(tab) {
2600
2647
  messages.style.display = 'none';
2601
2648
  container.appendChild(messages);
2602
2649
  tab.scrollController = createStickyScrollController(messages, { active: false });
2650
+ // Rows far from the screen are skipped by the engine, at their exact size (transcript-rows.js).
2651
+ tab.rowWatcher = watchTranscriptRows(messages);
2603
2652
  return messages;
2604
2653
  }
2605
2654
 
@@ -2657,6 +2706,8 @@ function disposeDiscardedTab(tab) {
2657
2706
  }
2658
2707
  tab.scrollController?.destroy();
2659
2708
  tab.scrollController = null;
2709
+ tab.rowWatcher?.disconnect();
2710
+ tab.rowWatcher = null;
2660
2711
  disposeOutputBlocks(tab.messagesEl);
2661
2712
  tab.messagesEl?.remove();
2662
2713
  tab.pillEl?.remove();
@@ -2708,8 +2759,15 @@ function createTrayPill(tab) {
2708
2759
  pill.addEventListener('click', async () => {
2709
2760
  const idx = _tabs.indexOf(tab);
2710
2761
  if (idx < 0) return;
2711
- if (!_getVisible()) _setVisible(true);
2712
- switchTab(idx);
2762
+ // A closed panel goes to this tab first and is shown after: showing it first connected the tab it was
2763
+ // left on (a Codex process started for a session nobody asked for, released a moment later), and the
2764
+ // session that was clicked waited behind it.
2765
+ if (!_getVisible()) {
2766
+ switchTab(idx);
2767
+ _setVisible(true);
2768
+ } else {
2769
+ switchTab(idx);
2770
+ }
2713
2771
  focusSidepanel(PANEL_OWNER);
2714
2772
  });
2715
2773
  pill.querySelector('.term-minimized-pill-close')?.addEventListener('click', (event) => {
@@ -2733,7 +2791,10 @@ export function renderPills() {
2733
2791
  if (!tab.pillEl) continue;
2734
2792
  // Read directly from tab to avoid nested withTab clobbering uncommitted state
2735
2793
  const label = tab.pillEl.querySelector('.term-minimized-pill-label');
2736
- if (label) label.textContent = tab.sessionLabel || 'New session';
2794
+ // Written only when it changed: the same text again is still a new text node, which the tray's
2795
+ // observer (ui-navbar.js) answers by going through every pill.
2796
+ const name = tab.sessionLabel || 'New session';
2797
+ if (label && label.textContent !== name) label.textContent = name;
2737
2798
  paintTrayPill(tab.pillEl, tab);
2738
2799
  const shouldShow = hasMeaningfulTrayState(tab) && (!_getVisible() || tab !== active);
2739
2800
  tab.pillEl.style.display = shouldShow ? '' : 'none';
@@ -2812,7 +2873,9 @@ export function switchTab(idx) {
2812
2873
  if (previous && input) {
2813
2874
  previous.draft = input.value;
2814
2875
  commitBoundState();
2815
- flushThreadSnapshotSave(previous);
2876
+ // Only when the stored snapshot is behind what the tab shows: writing it clones and serialises the whole
2877
+ // transcript and uploads it, inside the click that opens the next session.
2878
+ if (threadSnapshotBehind(previous)) flushThreadSnapshotSave(previous);
2816
2879
  }
2817
2880
  if (previous && previous !== next && !tabHasActiveWriterWork(previous)) {
2818
2881
  disconnectTab(previous);
@@ -2998,6 +3061,7 @@ export function closeTab(idx, { detachAutomation = false } = {}) {
2998
3061
  if (tab.automationRunId) forgetWorkerEnd(tab.automationRunId);
2999
3062
  wsDisconnectTab(tab, { releaseWriter: !tabHasActiveWriterWork(tab) });
3000
3063
  tab.closed = true;
3064
+ tab.planApprovalPending = false;
3001
3065
  tab.titleRequestController?.abort();
3002
3066
  tab.titleRequestController = null;
3003
3067
  tab.authView?.dispose();
@@ -3024,6 +3088,8 @@ export function closeTab(idx, { detachAutomation = false } = {}) {
3024
3088
  }
3025
3089
  tab.scrollController?.destroy();
3026
3090
  tab.scrollController = null;
3091
+ tab.rowWatcher?.disconnect();
3092
+ tab.rowWatcher = null;
3027
3093
  disposeOutputBlocks(tab.messagesEl);
3028
3094
  if (tab.messagesEl) retireMcpAppNode(tab.messagesEl, () => tab.messagesEl.remove());
3029
3095
  tab.pillEl?.remove();
@@ -3063,11 +3129,10 @@ export function placeWorkerEnd(tab) {
3063
3129
  if (!view) return;
3064
3130
  messagesEl.appendChild(buildWorkerEndCard(view, {
3065
3131
  classes: { card: 'cxp-worker-end', title: 'cxp-post-plan-header', detail: 'cxp-post-plan-note', button: 'cxp-request-btn' },
3066
- onBack: () => {
3132
+ onBack: () => leaveWorkerTab(view, () => {
3067
3133
  const idx = _tabs.indexOf(tab);
3068
3134
  if (idx >= 0) closeTab(idx);
3069
- backToAssistant(view.assistantSessionId);
3070
- },
3135
+ }),
3071
3136
  }));
3072
3137
  if (isActiveTab(tab)) scrollEnd(true);
3073
3138
  }
@@ -3129,11 +3194,10 @@ export function saveTabs() {
3129
3194
  releasedRunId: tab.releasedRunId || null,
3130
3195
  // Whether it was working when this was written: after a reload its placeholder pill says so and
3131
3196
  // the panel boots to ask (ui-sidepanel-tray.js), and the tab reattaches at once (restoreTabs).
3132
- // Never restored as running: only the reattach's answer says that. `needsYou`: an approval or a
3133
- // question card waited on the user; the reattach replays the request the bridge still holds.
3197
+ // Reattach confirms running and replays requests. A completed plan is saved with the tab.
3134
3198
  running: !!tab.running,
3135
3199
  startingThread: !!tab.startingThread,
3136
- needsYou: tab.blockingServerRequests?.size > 0 || !!tab.automationAwaits,
3200
+ needsYou: tab.blockingServerRequests?.size > 0 || !!tab.automationAwaits || !!tab.planApprovalPending,
3137
3201
  };
3138
3202
  });
3139
3203
  const localRunIds = new Set(localTabs.map((tab) => tab.automationRunId).filter(Boolean));
@@ -3267,21 +3331,23 @@ export function updateTrayPillLabel() {
3267
3331
  }
3268
3332
 
3269
3333
  /**
3270
- * What a tab's tray pill says: it needs you while an approval or a question card waits on your answer
3271
- * (its blocking server requests), or, for a dispatched worker, while its turn ended asking you something
3272
- * (the run's outcome: automationAwaits), else it works while a turn runs or a thread is being made.
3334
+ * A request, dispatched worker question, or plan review takes priority over running.
3273
3335
  * sidepanel-session-status.js reads the same classes for a detached window's pill.
3274
3336
  */
3275
- function paintTrayPill(pill, { running, startingThread, blockingServerRequests, automationAwaits }) {
3337
+ function paintTrayPill(pill, { running, startingThread, blockingServerRequests, automationAwaits, planApprovalPending }) {
3276
3338
  if (!pill) return;
3277
- const needsYou = blockingServerRequests?.size > 0 || !!automationAwaits;
3339
+ const needsYou = blockingServerRequests?.size > 0 || !!automationAwaits || !!planApprovalPending;
3278
3340
  pill.classList.toggle('cxp-pill-attention', needsYou);
3279
3341
  pill.classList.toggle('cxp-pill-running', !needsYou && !!(running || startingThread));
3280
3342
  }
3281
3343
 
3282
3344
  export function updateTrayPillRunning() {
3283
3345
  paintTrayPill(_trayPill, {
3284
- running: _running, startingThread: _startingThread, blockingServerRequests: _blockingServerRequests, automationAwaits: _boundTab?.automationAwaits,
3346
+ running: _running,
3347
+ startingThread: _startingThread,
3348
+ blockingServerRequests: _blockingServerRequests,
3349
+ automationAwaits: _boundTab?.automationAwaits,
3350
+ planApprovalPending: _boundTab?.planApprovalPending,
3285
3351
  });
3286
3352
  }
3287
3353
 
@@ -3440,7 +3506,7 @@ export function renderStoredTranscript(snapshot, emptyText = freshThreadText())
3440
3506
  removePostCompactionCards(_messagesEl);
3441
3507
  _messagesEl.querySelectorAll('button,input,select,textarea').forEach((node) => { node.disabled = true; });
3442
3508
  // Presentation controls remain useful in an idle saved transcript.
3443
- _messagesEl.querySelectorAll('.cxp-output-control, .cxp-copy-btn').forEach(node => { node.disabled = false; });
3509
+ _messagesEl.querySelectorAll('.cxp-output-control, .sb-code-copy').forEach(node => { node.disabled = false; });
3444
3510
  hydrateOutputControls(_messagesEl);
3445
3511
  // Restore expansion state when present; old snapshots default to collapsed cards.
3446
3512
  _messagesEl.querySelectorAll('.cxp-card').forEach((card) => {
@@ -5005,6 +5071,7 @@ export function setRunning(next, turnId = null) {
5005
5071
  resetStallTimer();
5006
5072
  }
5007
5073
  if (!next) {
5074
+ if (wasRunning && _boundTab?.planApprovalPending) setPlanApprovalPending(_boundTab, false);
5008
5075
  _pendingQueryRequestId = null;
5009
5076
  _activeTurnId = null;
5010
5077
  _turnStartedAt = null;
@@ -7860,7 +7927,8 @@ export function initContextBridge() {
7860
7927
  setShowPostPlanActions: (v) => { _showPostPlanActions = v; if (_boundTab) _boundTab.showPostPlanActions = !!v; },
7861
7928
  setPlanFeedbackDraft: (v) => { if (_boundTab) _boundTab.planFeedbackDraft = v || ''; },
7862
7929
  setPlanTurnActive: (v) => { _planTurnActive = !!v; if (_boundTab) _boundTab.planTurnActive = !!v; },
7863
- setPlanApprovalPending: (v) => { _planApprovalPending = !!v; if (_boundTab) _boundTab.planApprovalPending = !!v; },
7930
+ syncCanonicalPlan,
7931
+ setPlanApprovalPending: (v) => setPlanApprovalPending(_boundTab, v),
7864
7932
  setLastPlanTurnId: (v) => { _lastPlanTurnId = v || ''; if (_boundTab) _boundTab.lastPlanTurnId = v || ''; },
7865
7933
  setShowPostCompactionPrompt: (v) => { _showPostCompactionPrompt = !!v; },
7866
7934
  setPostCompactionPending: (v) => { _postCompactionPending = !!v; },
@@ -0,0 +1,12 @@
1
+ // SynaBun — the Claude Code side panel's facade (ui-claude-panel.js loads on first use: sidepanel-lazy.js).
2
+ // The names are the panel's own. A panel that has not loaded is not open.
3
+
4
+ import { claudePanelModule as panel } from './sidepanel-lazy.js';
5
+
6
+ export const toggleClaudePanel = panel.asyncExport('toggleClaudePanel');
7
+ export const bootClaudePanel = panel.asyncExport('bootClaudePanel');
8
+ export const sendToPanel = panel.asyncExport('sendToPanel');
9
+ export const attachClaudeAutomation = panel.asyncExport('attachClaudeAutomation');
10
+ export const detachClaudeAutomation = panel.asyncExport('detachClaudeAutomation');
11
+ export const handleClaudeAutomationEvent = panel.deferredExport('handleClaudeAutomationEvent');
12
+ export const isClaudePanelOpen = panel.syncExport('isClaudePanelOpen', false);
@@ -0,0 +1,120 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — the Copy button of a code block: the decisions
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // Every block an agent shows for the user to copy (a fenced code block, any <pre> of a reply, a plan or a tool
6
+ // result) carries one Copy button, in all six side panels (Assistant, Claude Code, Codex, OpenCode, Antigravity,
7
+ // Maritaca). This module is what they share and what can be decided without a page: the words, the button's
8
+ // markup (put into a panel's sanitised Markdown, so a stream, a re-render, a stored transcript and a string-keyed
9
+ // transcript all keep it), the text a block copies, and the copy with its fallback. ui-code-copy.js gives it the
10
+ // page: the stylesheet, the one click listener per document, and the button on a block drawn some other way.
11
+ //
12
+ // The button holds no text: its label is drawn by CSS from `data-label`, its name is `aria-label`. So a block's
13
+ // textContent is its code and nothing else, whoever reads it (a panel's own copy of a whole answer, Codex's
14
+ // output cleaner, a text selection).
15
+ //
16
+ // No imports and no `document`: loaded by `node --test` as it is, and by the Markdown renderers.
17
+
18
+ /** The English of `codeCopy.*` in i18n/en.json (tests/code-copy.test.mjs keeps them equal). */
19
+ export const CODE_COPY_COPY = Object.freeze({
20
+ copy: 'Copy',
21
+ copied: 'Copied',
22
+ failed: 'Not copied',
23
+ label: 'Copy code',
24
+ copiedLabel: 'Code copied',
25
+ failedLabel: 'Could not copy. The code is selected: press Ctrl+C or ⌘C.',
26
+ });
27
+
28
+ /** The class of the button. The Claude, Codex and OpenCode panels had buttons of their own before: see LEGACY. */
29
+ export const CODE_COPY_CLASS = 'sb-code-copy';
30
+
31
+ /** The panels' earlier buttons, still in stored transcripts: replaced by the shared one, and working until then. */
32
+ export const LEGACY_CODE_COPY_SELECTOR = '.cp-copy-btn, .cxp-copy-btn, .ocpv2-code-copy';
33
+
34
+ /** Any Copy button of a code block, the shared one or an earlier one. */
35
+ export const ANY_CODE_COPY_SELECTOR = `.${CODE_COPY_CLASS}, ${LEGACY_CODE_COPY_SELECTOR}`;
36
+
37
+ /** How long "Copied" (and the failure) stays on the button. */
38
+ export const CODE_COPY_FEEDBACK_MS = Object.freeze({ copied: 1500, failed: 4000 });
39
+
40
+ let translate = null;
41
+
42
+ /**
43
+ * Where a sentence comes from in the active locale: `fn(key, params)` returns it, or a falsy value for the English.
44
+ * Set by ui-code-copy.js once the app's i18n is there; a detached window or a test keeps the English.
45
+ */
46
+ export function setCodeCopyTranslator(fn) { translate = typeof fn === 'function' ? fn : null; }
47
+
48
+ /** A `codeCopy.*` sentence in the active locale, else the English. */
49
+ export function codeCopyText(key, params = {}) {
50
+ let text = '';
51
+ try { text = translate?.(key, params) || ''; } catch { text = ''; }
52
+ if (!text || typeof text !== 'string') text = CODE_COPY_COPY[key] ?? key;
53
+ return text.replace(/\{(\w+)\}/g, (whole, name) => (params[name] != null ? String(params[name]) : whole));
54
+ }
55
+
56
+ const escAttr = (value) => String(value ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
57
+
58
+ /** The button as markup: no text inside, the label in `data-label` (drawn by CSS) and the name in `aria-label`. */
59
+ export function codeCopyButtonHtml() {
60
+ return `<button type="button" class="${CODE_COPY_CLASS}" data-label="${escAttr(codeCopyText('copy'))}" aria-label="${escAttr(codeCopyText('label'))}"></button>`;
61
+ }
62
+
63
+ // A shared button already written before a closing tag, to be written again: the result is the same however often
64
+ // it runs. In a serialised (sanitised) document `</pre>` is only ever a closing tag: the same text inside a block
65
+ // is `&lt;/pre&gt;`.
66
+ const BUTTON_BEFORE_CLOSE_RE = new RegExp(`(?:<button type="button" class="${CODE_COPY_CLASS}"[^>]*></button>)?</pre>`, 'gi');
67
+
68
+ /**
69
+ * Sanitised HTML with one Copy button at the end of every <pre>. Run it on the sanitiser's output, never before:
70
+ * the allowlist takes buttons out of what a model writes, so a reply cannot forge one.
71
+ */
72
+ export function withCodeCopyButtons(html) {
73
+ const source = typeof html === 'string' ? html : '';
74
+ if (!/<\/pre>/i.test(source)) return source;
75
+ const button = codeCopyButtonHtml();
76
+ return source.replace(BUTTON_BEFORE_CLOSE_RE, `${button}</pre>`);
77
+ }
78
+
79
+ const tagOf = (node) => String(node?.localName || node?.nodeName || '').toLowerCase();
80
+
81
+ /**
82
+ * The text a block copies: everything it shows, newlines and indentation as written, without a button's label,
83
+ * and without the one line break a code block ends with (marked writes the code with a trailing "\n"; pasted into
84
+ * a terminal that would run the command).
85
+ */
86
+ export function codeBlockText(pre) {
87
+ if (!pre) return '';
88
+ let out = '';
89
+ const walk = (node) => {
90
+ for (const child of node.childNodes || []) {
91
+ if (child.nodeType === 3 || child.nodeType === 4) { out += child.data ?? child.nodeValue ?? ''; continue; }
92
+ if (child.nodeType !== 1) continue;
93
+ const tag = tagOf(child);
94
+ if (tag === 'button') continue;
95
+ if (tag === 'br') { out += '\n'; continue; }
96
+ walk(child);
97
+ }
98
+ };
99
+ walk(pre);
100
+ return out.replace(/\r?\n$/, '');
101
+ }
102
+
103
+ /**
104
+ * Put `text` on the clipboard: the Clipboard API first, then `fallback(text)` (the page's `execCommand('copy')`)
105
+ * when the API is missing (a page that is not a secure context) or refuses (a frame without the permission).
106
+ * @returns {Promise<'clipboard' | 'fallback' | null>} how it was copied, or null when nothing could copy it
107
+ */
108
+ export async function writeClipboard(text, { clipboard = globalThis.navigator?.clipboard, fallback = null } = {}) {
109
+ const value = String(text ?? '');
110
+ if (clipboard && typeof clipboard.writeText === 'function') {
111
+ try {
112
+ await clipboard.writeText(value);
113
+ return 'clipboard';
114
+ } catch { /* refused: the fallback below */ }
115
+ }
116
+ if (typeof fallback === 'function') {
117
+ try { if (fallback(value) === true) return 'fallback'; } catch { /* nothing copied */ }
118
+ }
119
+ return null;
120
+ }
@@ -66,6 +66,10 @@ export const KEYS = {
66
66
  ACTIVE_WORKSPACE: 'neural-active-workspace', // sessionStorage
67
67
  GRID_SNAP: 'neural-grid-snap',
68
68
  TOPRIGHT_TOOLS_HIDDEN: 'neural-topright-tools-hidden', // the workspace tools toggle is off ('true')
69
+ TRAY_AUTO_CLOSE: 'neural-tray-auto-close',
70
+ TRAY_COL_RUNNING_COLLAPSED: 'neural-tray-col-running-collapsed',
71
+ TRAY_COL_WAITING_COLLAPSED: 'neural-tray-col-waiting-collapsed',
72
+ TRAY_COL_DONE_COLLAPSED: 'neural-tray-col-done-collapsed',
69
73
  WHITEBOARD_TOOLBAR_HIDDEN: 'neural-whiteboard-toolbar-hidden', // the whiteboard rail (#wb-toolbar) is hidden behind the logo button ('true')
70
74
  CATEGORIES_VISIBLE: 'neural-categories-visible',
71
75
  WHITEBOARD: 'neural-whiteboard',
@@ -106,6 +110,7 @@ export const KEYS = {
106
110
  ASSISTANT_DOCK_SHOW_ALL:'neural-assistant-dock-show-all',
107
111
  ASSISTANT_ROUTE_MODE: 'neural-assistant-route-mode', // last-used route mode (always-ask|ask-unsure|never)
108
112
  ASSISTANT_TEST_DENSITY: 'neural-assistant-test-density', // last-used test density (none|light|standard|thorough)
113
+ ASSISTANT_AGENT_DENSITY: 'neural-assistant-agent-density', // agents-p4: last-used Agent density (solo|pair|team|swarm)
109
114
  // Assistant sidepanel — open tabs {v:1, activeIdx, tabs:[{sessionId,label,userRenamed}]}
110
115
  ASSISTANT_PANEL_TABS: 'synabun-assistant-panel-tabs',
111
116
  };
@@ -117,6 +122,7 @@ export const DEFAULT_KEYBINDS = {
117
122
  'toggle-categories': 'c',
118
123
  'open-skills': 'k',
119
124
  'open-automations': 'z',
125
+ 'open-agents': 'g',
120
126
  'toggle-terminal': 't',
121
127
  'toggle-terminal-alt': 'Ctrl+`',
122
128
  'focus-search': '/',
@@ -142,6 +148,7 @@ export const KEYBIND_META = {
142
148
  'toggle-categories': { label: 'Toggle Categories', group: 'Navigation' },
143
149
  'open-skills': { label: 'Open Skills Studio', group: 'Navigation' },
144
150
  'open-automations': { label: 'Open Automation Studio', group: 'Navigation' },
151
+ 'open-agents': { label: 'Open Agents Studio', group: 'Navigation' },
145
152
  'toggle-terminal': { label: 'Toggle Terminal', group: 'Navigation' },
146
153
  'toggle-terminal-alt': { label: 'Toggle Terminal (alt)', group: 'Navigation' },
147
154
  'focus-search': { label: 'Focus Search', group: 'Navigation' },
@@ -103,6 +103,7 @@ export const OPEN_ENTRIES = [
103
103
  { id: 'open-categories', key: 'categories', action: 'toggle-categories', active: 'menu-toggle-categories', icon: 'tag' },
104
104
  { id: 'open-focus-mode', key: 'focusMode', action: 'toggle-focus-mode', active: '!titlebar-viz-toggle', perm: 'whiteboard', icon: 'pen' },
105
105
  null,
106
+ { id: 'open-agents', key: 'agents', event: ['agents:open'], perm: 'agents', icon: 'panel' },
106
107
  { id: 'open-skills', key: 'skills', action: 'open-skills', perm: 'skills', icon: 'star' },
107
108
  { id: 'open-automations', key: 'automations', action: 'open-automations', perm: 'automations', icon: 'zap' },
108
109
  { id: 'open-schedules', key: 'schedules', event: ['schedules:toggle'], active: 'menubar-schedules-btn', perm: 'automations', icon: 'clock' },
@@ -8,6 +8,7 @@
8
8
  // OpenCode panel use. Nothing here touches `document` at import time.
9
9
 
10
10
  import { sanitizeHtmlString } from '../assistant/asst-sanitize.js';
11
+ import { withCodeCopyButtons } from '../code-copy.js';
11
12
 
12
13
  // ── The panel's one escaper ──
13
14
  // Every value the panel puts into markup it builds itself (a session's title or
@@ -34,13 +35,17 @@ const plain = (text) => escapeHtml(text).replace(/\n/g, '<br>');
34
35
  * Markdown text → sanitised HTML string, safe to assign to innerHTML.
35
36
  * `parse` is marked's parser (absent until it has loaded). Any failure, in the
36
37
  * parser or in the sanitiser, falls back to escaped text: never to raw HTML.
38
+ * Every code block carries the shared Copy button (../code-copy.js), written in
39
+ * after the sanitiser: a stream, a re-render and a string-keyed transcript keep
40
+ * it, and a model cannot write one. `codeCopy: false` leaves it out.
37
41
  */
38
- export function renderMarkdown(text, { parse = null, sanitize = sanitizeHtmlString, doc = globalThis.document } = {}) {
42
+ export function renderMarkdown(text, { parse = null, sanitize = sanitizeHtmlString, doc = globalThis.document, codeCopy = true } = {}) {
39
43
  const src = String(text ?? '');
40
44
  if (typeof parse !== 'function') return plain(src);
41
45
  try {
42
46
  const html = sanitize(parse(src), doc);
43
- return typeof html === 'string' ? html : plain(src);
47
+ if (typeof html !== 'string') return plain(src);
48
+ return codeCopy ? withCodeCopyButtons(html) : html;
44
49
  } catch {
45
50
  return plain(src);
46
51
  }