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 { t } from './i18n.js';
2
3
  import { answerWorkerQuestion, syncWorkerQuestionQueue } from './worker-questions.js';
3
4
  import { providerAuthSnapshot } from './ui-provider-auth.js';
@@ -23,9 +24,12 @@ import { registerSidepanel, setSidepanelVisible, syncSidepanelLayout, focusSidep
23
24
  import { mountCliBanner } from './ui-cli-banner.js';
24
25
  import { nativeLoopWindowId } from './ui-native-window-id.js';
25
26
  import { createStickyScrollController } from './ui-scroll-follow.js';
27
+ import { createDomChangeFlag } from './dom-change-flag.js';
28
+ import { isFarRowStyleRecord, watchTranscriptRows } from './transcript-rows.js';
26
29
  import { requestGeneratedSessionTitle } from './session-title.js';
27
30
  import { wireFileLinks } from './ui-file-links.js';
28
- import { WORKER_END_CLASS, backToAssistant, buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd, trackWorkerEnd, updateWorkerEndBusy } from './ui-worker-end.js';
31
+ import { decorateCodeBlocks, installCodeCopy } from './ui-code-copy.js';
32
+ import { WORKER_END_CLASS, buildWorkerEndCard, endWorkerRunOnClose, forgetWorkerEnd, leaveWorkerTab, trackWorkerEnd, updateWorkerEndBusy } from './ui-worker-end.js';
29
33
  import { isDispatchedRun, isEndOfRunAbort, workerEndView } from './worker-end.js';
30
34
  import { runAwaitsAnswer, runTurnLive } from './sidepanel-session-status.js';
31
35
  // ── cp/ feature modules (SDK-engine CLI parity: diffs, agents, bash, perms, statusline) ──
@@ -35,7 +39,7 @@ import { buildBashCard, updateBashResult, handleBgToolUse, handleBgToolResult, r
35
39
  import { decorateToolCard, applyStructuredResult, appendResultText, buildHistoryAskCard, buildHistoryPlanCard, fillHistoryCard, settleReplayedCards, planCardSummaryHtml } from './cp/cp-tool-cards.js';
36
40
  import { buildAgentCard, ensureAgentScope, noteAgentActivity, updateAgentTodoBadge, finalizeAgentCard, markAgentBackground } from './cp/cp-agents.js';
37
41
  import { renderPermissionCard, renderPlanApprovalCard, renderElicitationCard, decorateAskCard, askAnnotations, markAskAnswered, PERMISSION_MODES, MODE_LABELS } from './cp/cp-permissions.js';
38
- import { normalizeSession, changedStartSettings, sessionFlags, sessionRows, fastModeSupported, fastModeReason, mergeSessionModels, parseMcpServerLines, formatMcpServerLines } from './cp/cp-session-model.js';
42
+ import { normalizeSession, changedStartSettings, sessionFlags, sessionRows, fastModeSupported, fastModeReason, mergeSessionModels, parseMcpServerLines, formatMcpServerLines, thinkingAlwaysOn, thinkToggleView, thinkWireEffort, sessionWireSettings, THINKING_ALWAYS_ON_NOTE } from './cp/cp-session-model.js';
39
43
  import { renderSessionSettingsCard } from './cp/cp-session-settings.js';
40
44
  import { describeOrigin, reconcileTasks, adoptLiveTasks, describeHistorySystemRow, workEndedByRestart, isTaskRunning, endRunningTasks, backgroundWaitLine } from './cp/cp-tasks-model.js';
41
45
  import { renderTasksCard } from './cp/cp-tasks.js';
@@ -484,10 +488,6 @@ function injectStyles() {
484
488
  opacity: 1;
485
489
  overflow: visible;
486
490
  }
487
- /* Windows: the shell is 92% opaque, so the blur behind it barely shows, yet Chromium recomputes it on every repaint
488
- inside the panel (a transcript rendering, a stream). There it goes; the colour stays. */
489
- html.platform-win32 .claude-panel,
490
- html.desktop-titlebar--win32 .claude-panel { backdrop-filter: none; -webkit-backdrop-filter: none; }
491
491
  /* Raise panel above floating terminal windows while a dropdown is open
492
492
  so project/branch/recall menus aren't clipped behind them. */
493
493
  .claude-panel:has(.cp-dropdown.open) { z-index: 99999; }
@@ -700,16 +700,7 @@ function injectStyles() {
700
700
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
701
701
  color: var(--t-primary); background: none; border: none; padding: 0;
702
702
  }
703
- .cp-copy-btn {
704
- position: absolute; top: 6px; right: 8px;
705
- background: none; border: none; cursor: pointer;
706
- font-family: 'JetBrains Mono', monospace; font-size: 9px;
707
- color: var(--t-faint); text-transform: uppercase; letter-spacing: 0.04em;
708
- padding: 2px 6px; border-radius: 4px; opacity: 0.6;
709
- transition: opacity 0.15s, color 0.15s, background 0.15s;
710
- }
711
- .cp-copy-btn:hover { opacity: 1; color: var(--t-bright); background: rgba(255,255,255,0.06); }
712
- .cp-copy-btn.copied { color: #6ec96e; opacity: 1; }
703
+ /* A block's Copy button is the shared one (../code-copy.js, ui-code-copy.js): its styles come with it. */
713
704
  .cp-messages .msg-body a { color: var(--t-bright); text-decoration: none; }
714
705
  .cp-messages .msg-body a:hover { text-decoration: underline; }
715
706
  .cp-messages .msg-body strong { color: var(--t-bright); }
@@ -1595,7 +1586,7 @@ function injectStyles() {
1595
1586
  }
1596
1587
  .cp-thumb img {
1597
1588
  height: 48px; width: auto; max-width: 80px;
1598
- object-fit: cover; display: block;
1589
+ object-fit: contain; display: block;
1599
1590
  }
1600
1591
  .cp-thumb-x {
1601
1592
  position: absolute; top: 1px; right: 1px;
@@ -1801,14 +1792,6 @@ function injectStyles() {
1801
1792
  backdrop-filter: blur(60px) saturate(1.5);
1802
1793
  -webkit-backdrop-filter: blur(60px) saturate(1.5);
1803
1794
  }
1804
- html.platform-win32 .cp-todo-tag,
1805
- html.desktop-titlebar--win32 .cp-todo-tag,
1806
- html.platform-win32 .cp-todo-dock.is-open .cp-todo-drawer,
1807
- html.desktop-titlebar--win32 .cp-todo-dock.is-open .cp-todo-drawer {
1808
- background: rgba(18, 18, 20, 0.96);
1809
- backdrop-filter: none;
1810
- -webkit-backdrop-filter: none;
1811
- }
1812
1795
  .cp-todo-dock.is-open .cp-todo-tag { display: none; }
1813
1796
 
1814
1797
  .cp-todo-drawer .cp-todo-head {
@@ -1920,7 +1903,7 @@ function injectStyles() {
1920
1903
 
1921
1904
  /* ── Tool result images ── */
1922
1905
  .tool-result-content img {
1923
- max-width: 100%; max-height: 300px;
1906
+ max-width: 100%; max-height: 300px; width: auto; height: auto; object-fit: contain;
1924
1907
  border-radius: 6px; margin: 4px 0; display: block;
1925
1908
  }
1926
1909
 
@@ -2366,18 +2349,8 @@ function injectStyles() {
2366
2349
  rgba(212,162,127,0.0) 100%
2367
2350
  );
2368
2351
  }
2369
- html.platform-win32 .cp-session-pill.cp-pill-running,
2370
- html.desktop-titlebar--win32 .cp-session-pill.cp-pill-running {
2371
- border-color: rgba(212, 162, 127, 0.42);
2372
- }
2373
- html.platform-win32 .cp-session-pill.cp-pill-running:hover,
2374
- html.desktop-titlebar--win32 .cp-session-pill.cp-pill-running:hover {
2375
- border-color: rgba(212, 162, 127, 0.62);
2376
- }
2377
- html.platform-win32 .cp-session-pill.cp-pill-running .cp-pill-ring,
2378
- html.desktop-titlebar--win32 .cp-session-pill.cp-pill-running .cp-pill-ring {
2379
- display: none;
2380
- }
2352
+ /* The ring turns on Windows as everywhere (it was a still border there until 2026-11-15): the turn is
2353
+ the compositor's, nothing is restyled or repainted per frame (tests/windows-visuals.test.mjs). */
2381
2354
  body.ui-interacting .cp-pill-ring > i { animation-play-state: paused; }
2382
2355
  .cp-session-pill .term-minimized-pill-icon { color: rgba(212, 162, 127, 0.45); transition: color 0.2s; }
2383
2356
  .cp-session-pill.cp-pill-running .term-minimized-pill-icon { color: rgba(212, 162, 127, 1); }
@@ -2693,6 +2666,8 @@ function injectStyles() {
2693
2666
  .cp-send.queue-mode svg { opacity: 0.9; }
2694
2667
  `;
2695
2668
  document.head.appendChild(style);
2669
+ // The Copy button of every code block: its stylesheet and its one click listener, in this document.
2670
+ installCodeCopy(document);
2696
2671
  }
2697
2672
 
2698
2673
  // ── Custom dropdown helpers ──
@@ -2706,6 +2681,9 @@ function ddSetup(dd) {
2706
2681
  });
2707
2682
  }
2708
2683
  function ddPopulate(dd, items, selectedValue) {
2684
+ dd._value = '';
2685
+ dd.querySelector('.cp-dd-label').textContent = dd.dataset.placeholder || 'select...';
2686
+ dd.classList.remove('has-value');
2709
2687
  const menu = dd.querySelector('.cp-dd-menu');
2710
2688
  menu.innerHTML = '';
2711
2689
  for (const item of items) {
@@ -2830,7 +2808,9 @@ function _setEffort(btn, level) {
2830
2808
  btn.dataset.effort = level;
2831
2809
  const label = btn.querySelector('.cp-think-label');
2832
2810
  if (label) label.textContent = EFFORT_LABELS[level] || 'Think';
2833
- btn.setAttribute('data-tooltip', EFFORT_TITLES[level] || '');
2811
+ // On a model that always thinks the first stop is the model's default, never "Thinking off".
2812
+ const view = thinkToggleView(level, _getSelectedModel());
2813
+ btn.setAttribute('data-tooltip', view.corrected ? view.title : (EFFORT_TITLES[level] || ''));
2834
2814
  // Light up dots based on level
2835
2815
  const dots = btn.querySelectorAll('.cp-think-dots i');
2836
2816
  const count = { off: 0, low: 1, medium: 2, high: 3, xhigh: 4, max: 5 }[level] || 0;
@@ -2841,6 +2821,14 @@ function _getEffort() {
2841
2821
  const val = btn?.dataset.effort || 'off';
2842
2822
  return val === 'off' ? null : val;
2843
2823
  }
2824
+ // Whether thinking blocks are drawn: a level is picked, or the model always thinks (Off cannot hide what runs).
2825
+ function _showsThinking() {
2826
+ return !!_getEffort() || thinkingAlwaysOn(_getSelectedModel());
2827
+ }
2828
+ // The selected effort in words for /doctor and /status: Off reads as the model default where it cannot be off.
2829
+ function _effortWord() {
2830
+ return _getEffort() || (thinkingAlwaysOn(_getSelectedModel()) ? 'model default' : 'off');
2831
+ }
2844
2832
 
2845
2833
  // Levels the currently selected model advertises, in CLI order, always led by 'off'.
2846
2834
  // Falls back to the full ladder for models the CLI didn't describe (legacy saved ids).
@@ -2858,9 +2846,15 @@ function _modelSupportsEffort(tab) {
2858
2846
  return !Array.isArray(model?.effortLevels) || model.effortLevels.some(id => id !== 'off');
2859
2847
  }
2860
2848
 
2849
+ // The tab's model row (the selector's, for the active tab), or null.
2850
+ function _tabModelRow(tab) {
2851
+ if (tab === activeTab()) return _getSelectedModel();
2852
+ return tab?.model ? _models.find(m => m.id === tab.model) || null : null;
2853
+ }
2854
+
2861
2855
  // Some models have no thinking at all (Haiku). Disable the toggle and force 'off'
2862
2856
  // rather than passing a --effort the CLI will ignore.
2863
- function _syncThinkAvailability() {
2857
+ function _syncThinkAvailability({ announce = false } = {}) {
2864
2858
  const $think = _panel?.querySelector('#cp-think-toggle');
2865
2859
  if (!$think) return;
2866
2860
  const supported = _effortLevelsForModel().length > 1;
@@ -2871,7 +2865,22 @@ function _syncThinkAvailability() {
2871
2865
  storage.setItem(STOR.effort, 'off');
2872
2866
  const tab = activeTab();
2873
2867
  if (tab) { tab.effort = 'off'; saveTabs(); }
2868
+ } else {
2869
+ // The tooltip follows the model: on one that always thinks, Off reads as the model default.
2870
+ _setEffort($think, $think.dataset.effort || 'off');
2874
2871
  }
2872
+ if (announce) _noteThinkingAlwaysOn(activeTab());
2873
+ }
2874
+
2875
+ // Off picked (the Think toggle's first stop, or /session's Thinking) and a model picked that cannot turn its
2876
+ // thinking off (cp-session-model.js thinkingAlwaysOn): said once per tab and model, so Off is never only implied.
2877
+ function _noteThinkingAlwaysOn(tab) {
2878
+ const model = _getSelectedModel();
2879
+ if (!tab || !thinkingAlwaysOn(model) || tab._thinkOnNoted === model.id) return;
2880
+ const toggleOff = (tab.effort || 'off') === 'off' && _effortLevelsForModel().length > 1;
2881
+ if (!toggleOff && tab.session?.thinking !== 'off') return;
2882
+ tab._thinkOnNoted = model.id;
2883
+ appendStatus(tab, `Thinking off is not available on ${model.label || model.id}: ${THINKING_ALWAYS_ON_NOTE}. It runs at the model's default effort.`);
2875
2884
  }
2876
2885
 
2877
2886
  // Close dropdowns on outside click
@@ -2993,6 +3002,10 @@ function createTab(sessionId = null, label = 'New chat', { autoSwitch = true, id
2993
3002
  msgDiv.innerHTML = `<div class="cp-empty"><div class="cp-empty-logo">${CLAUDE_ICON}</div><span class="cp-empty-name">Claude</span><span class="cp-empty-hint">Send a message to start</span></div>`;
2994
3003
  tab.messagesEl = msgDiv;
2995
3004
  tab.scrollController = createStickyScrollController(msgDiv, { active: false });
3005
+ // Rows far from the screen are skipped by the engine, at their exact size (transcript-rows.js): a long
3006
+ // session's thousands of elements are no longer restyled with every change of the page, nor laid out on
3007
+ // every frame of a resize. What is on screen, or within a screen of it, is untouched.
3008
+ tab.rowWatcher = watchTranscriptRows(msgDiv);
2996
3009
  // Connect WebSocket (every tab, active or not: a restored tab reattaches to the background agents,
2997
3010
  // shells and wakeups its session kept on the server).
2998
3011
  connectTab(tab);
@@ -3068,7 +3081,9 @@ function switchTab(idx) {
3068
3081
  const prev = activeTab();
3069
3082
  if (prev && prev !== _tabs[idx]) {
3070
3083
  prev.scrollController?.setActive(false);
3071
- flushSessionSnapshotSave(prev);
3084
+ // Only when the stored snapshot is behind what the tab shows: writing it serialises the whole transcript
3085
+ // and uploads it, inside the click that opens the next session.
3086
+ if (_snapshotBehind(prev)) flushSessionSnapshotSave(prev);
3072
3087
  const $input = _panel?.querySelector('#cp-input');
3073
3088
  if ($input) prev.draft = $input.value;
3074
3089
  // Animate out, then hide + DETACH from the document
@@ -3143,12 +3158,13 @@ function switchTab(idx) {
3143
3158
  const $model = _panel?.querySelector('#cp-model');
3144
3159
  const $think = _panel?.querySelector('#cp-think-toggle');
3145
3160
  if ($project && tab.project) {
3146
- const items = _projects.map(p => ({ value: p.path, label: p.label || p.path.split(/[/\\]/).pop() }));
3161
+ const items = sessionProjectItems(_projects, tab.project);
3147
3162
  ddPopulate($project, items, tab.project);
3148
3163
  loadBranches(tab.project);
3149
3164
  } else if ($project && !tab.project) {
3150
- const items = _projects.map(p => ({ value: p.path, label: p.label || p.path.split(/[/\\]/).pop() }));
3165
+ const items = sessionProjectItems(_projects, tab.project);
3151
3166
  ddPopulate($project, items, '');
3167
+ loadBranches('');
3152
3168
  }
3153
3169
  if ($model) {
3154
3170
  const items = _models.map(m => ({ value: m.id, label: m.label }));
@@ -3227,6 +3243,8 @@ function closeTab(idx, { detachAutomation = false } = {}) {
3227
3243
  if (tab.sessionId && !keepsNothing(tab)) _releaseSessionLock(tab.sessionId);
3228
3244
  tab.scrollController?.destroy();
3229
3245
  tab.scrollController = null;
3246
+ tab.rowWatcher?.disconnect();
3247
+ tab.rowWatcher = null;
3230
3248
  tab.messagesEl.remove();
3231
3249
  if (tab.pillEl) tab.pillEl.remove();
3232
3250
  _tabs.splice(idx, 1);
@@ -3234,7 +3252,10 @@ function closeTab(idx, { detachAutomation = false } = {}) {
3234
3252
  _activeTabIdx = -1;
3235
3253
  saveTabs();
3236
3254
  renderPills();
3237
- if (_visible) toggleClaudePanel();
3255
+ // Hidden now, never after an await: Back on a worker's card shows the Assistant right after this, and a
3256
+ // toggle that read _visible later saw the panel the Assistant had just hidden and showed it again, with a
3257
+ // new chat in it (applyClaudeVisibility makes one for a panel with no tab).
3258
+ if (_visible) setSidepanelVisible(PANEL_OWNER, false);
3238
3259
  return;
3239
3260
  }
3240
3261
  if (_activeTabIdx === idx) {
@@ -3895,10 +3916,11 @@ function cpSessRenderItem(s, projectPath, menu) {
3895
3916
  selectSession(sid, clickLabel);
3896
3917
  const $project = _panel?.querySelector('#cp-project');
3897
3918
  if ($project && item.dataset.cwd) {
3898
- ddPopulate($project, _projects.map(p => ({ value: p.path, label: p.label || p.path.split(/[/\\]/).pop() })), item.dataset.cwd);
3919
+ ddPopulate($project, sessionProjectItems(_projects, item.dataset.cwd), item.dataset.cwd);
3899
3920
  storage.setItem(STOR.project, item.dataset.cwd);
3900
3921
  const tab = activeTab();
3901
3922
  if (tab) { tab.project = item.dataset.cwd; saveTabs(); }
3923
+ loadBranches(item.dataset.cwd);
3902
3924
  }
3903
3925
  menu.classList.remove('open');
3904
3926
  });
@@ -4647,6 +4669,39 @@ function writeSessionSnapshot(tab) {
4647
4669
  results: tab._historyResults || _sessionSnapshots[sid]?.results ? 1 : 0,
4648
4670
  };
4649
4671
  _persistSessionSnapshots(sid);
4672
+ // What is stored now is what the tab shows (_snapshotBehind).
4673
+ _snapshotFlag(tab)?.clear();
4674
+ tab._snapshotMetaKey = _snapshotMetaKey(tab);
4675
+ }
4676
+
4677
+ // ── Is the stored snapshot behind the tab? ──
4678
+ // The transcript is watched for any change (dom-change-flag.js); the fields stored next to it are compared.
4679
+ function _snapshotFlag(tab) {
4680
+ const el = tab?.messagesEl;
4681
+ if (!el) return null;
4682
+ if (tab._snapshotFlagEl !== el) {
4683
+ tab._snapshotFlag?.disconnect();
4684
+ // The far-row declarations (transcript-rows.js) are not part of what is stored: scrolling is no change.
4685
+ tab._snapshotFlag = createDomChangeFlag(el, { ignore: (record) => isFarRowStyleRecord(record, el) });
4686
+ tab._snapshotFlagEl = el;
4687
+ }
4688
+ return tab._snapshotFlag;
4689
+ }
4690
+
4691
+ function _snapshotMetaKey(tab) {
4692
+ return JSON.stringify([
4693
+ tab.sessionId || '', tab.label || '', tab.usage || null,
4694
+ Array.isArray(tab.todos) && tab.todos.length ? tab.todos : null,
4695
+ tab.contextWindow || 0, tab.turns || 0, tab.sessionCost || 0, tab._historyResults ? 1 : 0,
4696
+ ]);
4697
+ }
4698
+
4699
+ function _snapshotBehind(tab) {
4700
+ if (tab?._agentScope) tab = tab._rootTab || Object.getPrototypeOf(tab);
4701
+ if (!tab) return false;
4702
+ if (tab._snapshotDirty) return true;
4703
+ const flag = _snapshotFlag(tab);
4704
+ return !flag || flag.changed() || tab._snapshotMetaKey !== _snapshotMetaKey(tab);
4650
4705
  }
4651
4706
 
4652
4707
  // ── Snapshot scheduling — boundary writes, not per-append ──
@@ -4731,8 +4786,7 @@ function renderStoredSession(snapshot, $msgs, tab) {
4731
4786
  _addHistoryPager(tab, $msgs, sid, _historyProject(tab) || undefined, { total: state.total, start: state.start, messages: { length: state.total - state.start } });
4732
4787
  },
4733
4788
  });
4734
- // Re-attach copy buttons + file path links — innerHTML wipes their listeners
4735
- $msgs.querySelectorAll('pre .cp-copy-btn').forEach(btn => btn.remove());
4789
+ // Copy buttons (an older snapshot's are replaced) + file path links
4736
4790
  addCopyButtons($msgs);
4737
4791
  linkifyFilePaths($msgs);
4738
4792
  if (tab) {
@@ -5158,7 +5212,11 @@ async function _loadSessionHistoryNow(sid, $msgs, ownerTab, stale, ticket) {
5158
5212
  const live = liveRows($msgs.children);
5159
5213
  const liveAnchor = live[0] || null;
5160
5214
  const liveSet = new Set(live);
5161
- const { head, tail } = !restored ? splitHistoryTail(data.messages, 40) : { head: [], tail: data.messages };
5215
+ // Newest rows first, whether a stored snapshot was on screen or not: the end of the conversation is
5216
+ // drawn in this task and the earlier rows go in above it, a chunk per task. A snapshot that turned out
5217
+ // to be behind used to be taken out and the whole session drawn again from its first message down, so
5218
+ // the panel showed the oldest rows and reached the newest last, a dozen tasks later.
5219
+ const { head, tail } = splitHistoryTail(data.messages, 40);
5162
5220
  // Renders rows at the end, marks them as this load's, and moves them before `before`.
5163
5221
  const renderRows = (rows, before) => renderHistoryRowsInto($msgs, rows, (m) => _renderHistoryRow(ownerTab, $msgs, m), { before, ticket, skip: liveSet });
5164
5222
  // Replay goes through the live renderers (tool cards, typed results), marked
@@ -5246,15 +5304,14 @@ async function _loadSessionHistoryNow(sid, $msgs, ownerTab, stale, ticket) {
5246
5304
  }
5247
5305
 
5248
5306
  // ── Copy buttons on pre blocks ──
5307
+ // The shared Copy button (code-copy.js, ui-code-copy.js) on every block under `el`
5308
+ // that has none: a tool result, a block of a restored snapshot. A Markdown block
5309
+ // already has it (renderMarkdown writes it in, also while a reply streams). One
5310
+ // listener per document (installCodeCopy) takes every click, so a button put back
5311
+ // from a snapshot works as it is.
5249
5312
  function addCopyButtons(el) {
5313
+ decorateCodeBlocks(el);
5250
5314
  el.querySelectorAll('pre').forEach(pre => {
5251
- if (pre.querySelector('.cp-copy-btn')) return;
5252
- const btn = document.createElement('button');
5253
- btn.className = 'cp-copy-btn';
5254
- btn.textContent = 'Copy';
5255
- // No per-button listener — clicks are handled by _onMessagesClick
5256
- // (delegation), which also revives buttons on snapshot-restored DOM.
5257
- pre.appendChild(btn);
5258
5315
  // Colorize diff lines inline when the code block is a diff
5259
5316
  const code = pre.querySelector('code');
5260
5317
  if (code && /\bdiff\b/i.test(code.className) && !code.dataset.diffWrapped) {
@@ -5392,7 +5449,7 @@ function _contextMenuData(tab, { full = false } = {}) {
5392
5449
  // The mode as the project bar words it (it knows Bypass and "from settings").
5393
5450
  mode: ($mode && !$mode.hidden && $mode.querySelector('.cp-dd-label')?.textContent) || tab.permissionMode || '',
5394
5451
  account: [tab.accountInfo?.authMethod === 'apiKey' ? 'API key' : tab.accountInfo?.email, tab.accountInfo?.organization].filter(Boolean).join(' · '),
5395
- flags: sessionFlags(tab.session, { toolPolicy: tab.toolPolicy, fastModeState: tab.fastModeState, account: tab.accountId }),
5452
+ flags: sessionFlags(tab.session, { toolPolicy: tab.toolPolicy, fastModeState: tab.fastModeState, account: tab.accountId, thinkingAlwaysOn: thinkingAlwaysOn(_tabModelRow(tab)) }),
5396
5453
  limit: tab.rateLimit?.text || '',
5397
5454
  backgroundTasks: (tab.backgroundWork || []).length,
5398
5455
  scheduled: Array.isArray(tab.sessionCrons) ? tab.sessionCrons.length : 0,
@@ -6383,7 +6440,7 @@ function handleStreamDelta(tab, apiEvent) {
6383
6440
  // renderAssistant. Text blocks defer row/body creation to content_block_delta
6384
6441
  // so a model that opens a text block and pivots to a tool call without
6385
6442
  // emitting visible text doesn't leave a blank avatar row behind.
6386
- const isThinkingRenderable = tab._stream.blockType === 'thinking' && _getEffort();
6443
+ const isThinkingRenderable = tab._stream.blockType === 'thinking' && _showsThinking();
6387
6444
  if (!isThinkingRenderable) return;
6388
6445
 
6389
6446
  if (!tab._stream.el) {
@@ -6788,8 +6845,8 @@ function renderAssistant(tab, msg) {
6788
6845
  const tools = content.filter(b => b.type === 'tool_use');
6789
6846
  // Server-side tool calls and results, citations, redacted thinking.
6790
6847
  const extras = splitAssistantBlocks(content);
6791
- const showThinks = !!_getEffort();
6792
- // Suppress thinking display when Think toggle is off
6848
+ const showThinks = _showsThinking();
6849
+ // Suppress thinking display when Think toggle is off (a model that always thinks shows what it thought)
6793
6850
  if (!showThinks) thinks.length = 0;
6794
6851
  if (!texts.length && !tools.length && !thinks.length && !extras.any) return;
6795
6852
 
@@ -7882,10 +7939,17 @@ function _applySessionOptions(tab, msg) {
7882
7939
  if (statementSent(tab, { ..._modeBridge(tab), counted: msg.type === 'query' || msg.type === 'warm' })) saveTabs();
7883
7940
  if (hasCapability(tab, 'tool_policy')) msg.toolPolicy = tab.toolPolicy || 'full';
7884
7941
  // The tab's session settings (/session): the bridge validates them again.
7885
- if (hasCapability(tab, 'session_settings')) msg.session = normalizeSession(tab.session);
7942
+ // A saved Off goes only to a model that can turn thinking off; one that always thinks is named as such
7943
+ // (`thinkingAlwaysOn`), so the bridge restarts nothing for the Off it does not get. The tab keeps its Off.
7944
+ // (A bridge without 'thinking_effective' gets the settings as saved; sessionWireSettings in cp/cp-session-model.js.)
7945
+ const wire = sessionWireSettings(tab.session, _tabModelRow(tab), { effective: hasCapability(tab, 'thinking_effective') });
7946
+ if (hasCapability(tab, 'session_settings')) msg.session = wire.session;
7947
+ if (wire.thinkingAlwaysOn) msg.thinkingAlwaysOn = true;
7886
7948
  // Think off on a model with effort levels is a pick of its own: sent as 'off'
7887
7949
  // so the bridge disables thinking, or the user's settings' effortLevel applies.
7888
- if (!msg.effort && hasCapability(tab, 'effort_off') && _modelSupportsEffort(tab)) msg.effort = 'off';
7950
+ // (Not on a model that always thinks: the CLI would send adaptive thinking anyway, so the model default is
7951
+ // asked for, which is what runs; thinkWireEffort in cp/cp-session-model.js.)
7952
+ if (!msg.effort) msg.effort = thinkWireEffort('off', _tabModelRow(tab), { effortOff: hasCapability(tab, 'effort_off'), modelHasEffort: _modelSupportsEffort(tab) });
7889
7953
  // The Claude account this tab runs under (the default account sends nothing).
7890
7954
  if (hasCapability(tab, 'accounts')) msg.accountId = tab.accountId || 'default';
7891
7955
  // A name typed before the first message becomes the new session's title.
@@ -7933,6 +7997,8 @@ function _afterTemporary(tab, sid, label) {
7933
7997
  try { ws?.close(); } catch {}
7934
7998
  // So does its scroll controller, which watches every row of the transcript.
7935
7999
  tab.scrollController?.destroy();
8000
+ tab.rowWatcher?.disconnect();
8001
+ tab.rowWatcher = null;
7936
8002
  // What the conversation left running or waiting stops with it.
7937
8003
  clearInterval(tab.thinkTimerInterval);
7938
8004
  for (const key of ['_idleStateTimer', '_runningTimeout', '_snapshotTimer', '_compactTimer']) clearTimeout(tab[key]);
@@ -8620,7 +8686,7 @@ function appendUser(tab, text, images, files) {
8620
8686
  for (const img of images) {
8621
8687
  const imgEl = document.createElement('img');
8622
8688
  imgEl.src = `data:${img.mediaType};base64,${img.base64}`;
8623
- imgEl.style.cssText = 'max-width:200px;max-height:150px;border-radius:6px;margin-bottom:4px;display:block;';
8689
+ imgEl.style.cssText = 'max-width:min(200px,100%);max-height:150px;object-fit:contain;border-radius:6px;margin-bottom:4px;display:block;';
8624
8690
  bubble.appendChild(imgEl);
8625
8691
  }
8626
8692
  }
@@ -9457,7 +9523,7 @@ function runSlashCommand(tab, raw) {
9457
9523
  const wsOk = tab.ws && tab.ws.readyState === WebSocket.OPEN;
9458
9524
  const proj = tab.project || '(none)';
9459
9525
  const model = _getModelId() || '(default)';
9460
- const effort = _getEffort() || 'off';
9526
+ const effort = _effortWord();
9461
9527
  const ctxw = _contextWindowFor(tab);
9462
9528
  const rows = [
9463
9529
  ['WebSocket', wsOk ? 'connected' : 'disconnected', wsOk ? 'ok' : 'warn'],
@@ -9593,6 +9659,8 @@ function runSlashCommand(tab, raw) {
9593
9659
  agents: info.agents || [],
9594
9660
  outputStyles: info.availableOutputStyles || [],
9595
9661
  fastSupported: fastModeSupported(info.models, tab.mainModel || _getModelId()),
9662
+ // A model whose CLI says it cannot run with thinking off: no Off, and a saved one shows as the default.
9663
+ thinkingAlwaysOn: thinkingAlwaysOn(_tabModelRow(tab)),
9596
9664
  // Tools, MCP servers, agents, skills, settings overrides, the debug log:
9597
9665
  // only on a server whose bridge reads them.
9598
9666
  advanced: hasCapability(tab, 'session_settings_v2'),
@@ -9639,9 +9707,9 @@ function runSlashCommand(tab, raw) {
9639
9707
  const rows = statusRows({ init: tab.init || null, account: tab.accountInfo || null, tab });
9640
9708
  if (!tab.init) {
9641
9709
  rows.push(['Model (selected)', _getModelId() || '(default)', '']);
9642
- rows.push(['Effort (selected)', _getEffort() || 'off', '']);
9710
+ rows.push(['Effort (selected)', _effortWord(), '']);
9643
9711
  }
9644
- for (const [k, v] of sessionRows(tab.session)) rows.push([k, v, '']);
9712
+ for (const [k, v] of sessionRows(tab.session, { thinkingAlwaysOn: thinkingAlwaysOn(_tabModelRow(tab)) })) rows.push([k, v, '']);
9645
9713
  if (tab.sessionState) rows.push(['Session state', { running: 'running', idle: 'idle', requires_action: 'waiting for your answer' }[tab.sessionState] || tab.sessionState]);
9646
9714
  if (tab.fastModeState && tab.fastModeState !== 'off') rows.push(['Fast mode state', `${tab.fastModeState}${tab.fastModeReason ? ` (${fastModeReason(tab.fastModeReason)})` : ''}`, tab.fastModeState === 'on' ? 'ok' : 'warn']);
9647
9715
  if (tab.toolPolicy && tab.toolPolicy !== 'full') rows.push(['Tools', TOOL_POLICIES[tab.toolPolicy]?.label || tab.toolPolicy, 'warn']);
@@ -10413,8 +10481,8 @@ async function loadConfig() {
10413
10481
  const $model = _panel?.querySelector('#cp-model');
10414
10482
 
10415
10483
  if ($project) {
10416
- const items = _projects.map(p => ({ value: p.path, label: p.label || p.path.split(/[/\\]/).pop() }));
10417
- const saved = storage.getItem(STOR.project);
10484
+ const saved = activeTab()?.project ?? storage.getItem(STOR.project);
10485
+ const items = sessionProjectItems(_projects, saved);
10418
10486
  ddPopulate($project, items, saved || '');
10419
10487
  if (saved) loadBranches(saved);
10420
10488
  }
@@ -10488,25 +10556,26 @@ function refreshModels() {
10488
10556
  const _branchCache = new Map(); // path → { at, branches, current }
10489
10557
  const BRANCH_CACHE_MS = 60_000;
10490
10558
 
10559
+ let _branchRequest = 0;
10491
10560
  async function loadBranches(path) {
10561
+ const request = ++_branchRequest;
10492
10562
  const $branch = _panel?.querySelector('#cp-branch');
10493
10563
  if (!$branch) return;
10494
- if (!path) { ddPopulate($branch, [], ''); return; }
10564
+ ddPopulate($branch, [], '');
10565
+ if (!path) return;
10566
+ const current = () => request === _branchRequest && (!activeTab() || activeTab().project === path);
10495
10567
  const cached = _branchCache.get(path);
10496
10568
  if (cached && Date.now() - cached.at < BRANCH_CACHE_MS) {
10497
- if (cached.branches?.length) {
10498
- ddPopulate($branch, cached.branches.map(b => ({ value: b, label: b })), cached.current || '');
10499
- }
10569
+ if (current()) ddPopulate($branch, cached.branches.map(b => ({ value: b, label: b })), cached.current || '');
10500
10570
  return;
10501
10571
  }
10502
10572
  try {
10503
10573
  const res = await fetch(`/api/terminal/branches?path=${encodeURIComponent(path)}`).then(r => r.json());
10504
- if (res.branches?.length) {
10505
- _branchCache.set(path, { at: Date.now(), branches: res.branches, current: res.current });
10506
- const items = res.branches.map(b => ({ value: b, label: b }));
10507
- ddPopulate($branch, items, res.current || '');
10508
- }
10509
- } catch {}
10574
+ if (!current()) return;
10575
+ const branches = Array.isArray(res.branches) ? res.branches : [];
10576
+ _branchCache.set(path, { at: Date.now(), branches, current: res.current });
10577
+ ddPopulate($branch, branches.map(b => ({ value: b, label: b })), res.current || '');
10578
+ } catch { /* keep the cleared selector; never show another checkout's branch */ }
10510
10579
  }
10511
10580
 
10512
10581
  // ── Recall Profile ──
@@ -10639,18 +10708,7 @@ function _ensureCliSubscription() {
10639
10708
  // Specialized cards (cp-bash/cp-diff/cp-agent + interactive perm/ask/plan
10640
10709
  // widgets) keep their own listeners — the delegate skips them.
10641
10710
  function _onMessagesClick(e) {
10642
- const copy = e.target.closest('.cp-copy-btn');
10643
- if (copy) {
10644
- const pre = copy.closest('pre');
10645
- if (!pre) return;
10646
- const text = pre.querySelector('code')?.textContent || pre.textContent;
10647
- navigator.clipboard.writeText(text).then(() => {
10648
- copy.textContent = 'Copied!';
10649
- copy.classList.add('copied');
10650
- setTimeout(() => { copy.textContent = 'Copy'; copy.classList.remove('copied'); }, 1500);
10651
- });
10652
- return;
10653
- }
10711
+ // A code block's Copy button is taken by ui-code-copy.js before this listener sees the click.
10654
10712
  // A run of repeated MCP calls: its badge shows or folds the calls after the first.
10655
10713
  const mcpBadge = e.target.closest('.tool-mcp-badge');
10656
10714
  if (mcpBadge) {
@@ -10728,16 +10786,21 @@ async function _ensureClaudePanelReady() {
10728
10786
  }
10729
10787
 
10730
10788
  export async function toggleClaudePanel() {
10789
+ // Decided by what was on screen when it was asked: another panel taking the slot during the wait (the
10790
+ // Assistant, shown by a worker card's Back) must not turn a hide into a show.
10791
+ const show = !_visible;
10731
10792
  await _ensureClaudePanelReady();
10732
- setSidepanelVisible(PANEL_OWNER, !_visible);
10793
+ setSidepanelVisible(PANEL_OWNER, show);
10733
10794
  }
10734
10795
 
10735
10796
  function applyClaudeVisibility(visible) {
10736
10797
  _visible = visible;
10737
10798
  if (_visible) {
10799
+ // On screen first. The shared controller has already reserved this panel's width (the dock moved left
10800
+ // for it): if making a tab threw before the class was set, the reservation stayed with no panel in it.
10801
+ _panel.classList.add('open');
10738
10802
  if (_tabs.length === 0) createTab(null, 'New chat');
10739
10803
  state.lastActivePanel = 'claude';
10740
- _panel.classList.add('open');
10741
10804
  syncReservedWidth();
10742
10805
  _panel.querySelector('#cp-input')?.focus();
10743
10806
  _refreshCliBanners();
@@ -10874,6 +10937,11 @@ export async function attachClaudeAutomation(run, { focus = !!run?.focus, isCanc
10874
10937
  placeWorkerEnd(tab);
10875
10938
  // The mode control is hidden while the run is active and back when it ended.
10876
10939
  if (tab === activeTab()) populateModeDropdown(_panel?.querySelector('#cp-mode'), tab);
10940
+ if (tab === activeTab()) {
10941
+ const project = _panel?.querySelector('#cp-project');
10942
+ if (project) ddPopulate(project, sessionProjectItems(_projects, tab.project), tab.project);
10943
+ loadBranches(tab.project);
10944
+ }
10877
10945
  const idx = _tabs.indexOf(tab);
10878
10946
  if (focus) {
10879
10947
  if (!_visible) await toggleClaudePanel();
@@ -11012,11 +11080,10 @@ function showWorkerEnd(tab, view) {
11012
11080
  if (!view) return;
11013
11081
  $msgs.appendChild(buildWorkerEndCard(view, {
11014
11082
  classes: { card: 'cp-worker-end', title: 'post-plan-header', actions: 'post-plan-actions', button: 'post-plan-action pp-primary' },
11015
- onBack: () => {
11083
+ onBack: () => leaveWorkerTab(view, () => {
11016
11084
  const idx = _tabs.indexOf(tab);
11017
11085
  if (idx >= 0) closeTab(idx);
11018
- backToAssistant(view.assistantSessionId);
11019
- },
11086
+ }),
11020
11087
  }));
11021
11088
  if (tab === activeTab()) scrollEnd(true);
11022
11089
  }
@@ -12082,7 +12149,7 @@ function wireEvents() {
12082
12149
  }
12083
12150
 
12084
12151
  // Effort support is per-model — re-gate the Think toggle when the model changes.
12085
- $model?.addEventListener('change', () => _syncThinkAvailability());
12152
+ $model?.addEventListener('change', () => _syncThinkAvailability({ announce: true }));
12086
12153
 
12087
12154
  // Plan mode toggle
12088
12155
  const $plan = _panel.querySelector('#cp-plan-toggle');