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
@@ -32,6 +32,16 @@ export function isBrowserStarting(result) {
32
32
  * "Failed to auto-create session: …" and agents gave up or reached for another browser.
33
33
  */
34
34
  export const AUTO_CREATE_STARTING = 'The browser is still starting (a cold MoreLogin start can take about two minutes); nothing failed. Call browser_navigate again in a moment: it opens the page in that browser as soon as it is ready and never starts a second one.';
35
+ /**
36
+ * A browser start the server refused because the user has to act first (`needsUser`: a MoreLogin profile closed outside
37
+ * SynaBun, MORELOGIN_CLOSED_OUTSIDE; a start MoreLogin refused for its plan): its sentence as it is, with no "call
38
+ * browser_session create" after it (a create is refused the same way) and never announced as a replacement tab.
39
+ */
40
+ export function userBlockedStart(result) {
41
+ if (!result || result.needsUser !== true || typeof result.error !== 'string' || !result.error)
42
+ return null;
43
+ return { error: result.error, ...(typeof result.code === 'string' ? { code: result.code } : {}), needsUser: true };
44
+ }
35
45
  // Existing engagement spacing can consume 90 seconds before the click begins.
36
46
  const CLICK_TIMEOUT = 120_000;
37
47
  export function isBrowserV2Enabled() {
@@ -93,7 +103,7 @@ export function isBrowserFastMode() {
93
103
  export function isBrowserCompactMode() {
94
104
  return process.env.SYNABUN_BROWSER_COMPACT === '1' || isBrowserFastMode();
95
105
  }
96
- async function requestOnce(method, path, body, timeout = DEFAULT_TIMEOUT, extraHeaders = {}) {
106
+ async function requestOnce(method, path, body, timeout = DEFAULT_TIMEOUT, extraHeaders = {}, preserveJson = false) {
97
107
  const cancellation = browserCancellation.getStore();
98
108
  const callerSignal = cancellation?.signal;
99
109
  const cancellationCode = cancellation?.scope === 'batch' ? 'BATCH_CANCELLED' : 'BROWSER_CANCELLED';
@@ -165,7 +175,7 @@ async function requestOnce(method, path, body, timeout = DEFAULT_TIMEOUT, extraH
165
175
  const { image: _image, screenshot: _screenshot, data: _data, ...textFields } = data;
166
176
  estimatedTextTokens = Math.ceil(JSON.stringify(textFields).length / 4);
167
177
  }
168
- if (!res.ok && !data.error) {
178
+ if (!res.ok && !data.error && !preserveJson) {
169
179
  data.error = `HTTP ${res.status}`;
170
180
  }
171
181
  return data;
@@ -211,7 +221,7 @@ async function request(method, path, body, timeout = DEFAULT_TIMEOUT, opts = {})
211
221
  const guarded = !!flow && flow.policy !== 'follow' && !!match;
212
222
  if (guarded && flow.loss)
213
223
  throw new BrowserRouteLost(flow.loss);
214
- const result = await requestOnce(method, path, body, timeout);
224
+ const result = await requestOnce(method, path, body, timeout, {}, opts.preserveJson);
215
225
  const context = batchContext.getStore();
216
226
  const missingRoute = isMissingRoute(result);
217
227
  const routeOf = () => {
@@ -276,15 +286,18 @@ async function request(method, path, body, timeout = DEFAULT_TIMEOUT, opts = {})
276
286
  // Recovery failed: report why (e.g. "MoreLogin connect failed: …"), not the
277
287
  // bare "Session not found" that triggered it. Nothing was started.
278
288
  const starting = refreshed.starting === true;
289
+ // Refused until the user acts (a MoreLogin profile closed outside SynaBun): no replacement, no create advice.
290
+ const needsUser = refreshed.needsUser === true;
291
+ const refusedCode = needsUser ? refreshed.code : undefined;
279
292
  if (guarded) {
280
293
  // Every later step of this tool would find the same dead route: the call stops here and says what happened
281
- // (routeLossMessage: still starting, or create a tab of your own).
294
+ // (routeLossMessage: still starting, refused until the user acts, or create a tab of your own).
282
295
  // The loss message says what to do; the hint the recovery's error carries would say it twice.
283
296
  const why = refreshed.error.replace(`\n${LOST_ROUTE_HINT}`, '').trim();
284
- flow.loss = { reason: 'gone', step: stepOf(), from: routeOf(), recovery: { error: why, ...(starting && { starting: true }) } };
297
+ flow.loss = { reason: 'gone', step: stepOf(), from: routeOf(), recovery: { error: why, ...(starting && { starting: true }), ...(needsUser && { needsUser: true, ...(refusedCode && { code: refusedCode }) }) } };
285
298
  throw new BrowserRouteLost(flow.loss);
286
299
  }
287
- return { ...result, error: refreshed.error, recoveryFailed: true, ...(starting && { starting: true }) };
300
+ return { ...result, error: refreshed.error, recoveryFailed: true, ...(starting && { starting: true }), ...(needsUser && { needsUser: true, ...(refusedCode && { code: refusedCode }) }) };
288
301
  }
289
302
  }
290
303
  if (guarded && !context && missingRoute && opts.recover !== false) {
@@ -394,17 +407,22 @@ export async function reportRuntimeTools(groups, options) {
394
407
  // of cross-automation tab collisions: every HTTP caller shared them.
395
408
  // Join the ONE shared browser with a dedicated, owned tab (instead of launching a
396
409
  // second browser on a persistent profile, which fails with "profile is locked").
397
- async function acquireInteractive(id, url) {
410
+ async function acquireInteractive(id, url, takeOverTab) {
398
411
  // The tab is owned by the id this caller routes as (X-Synabun-Terminal): the server checks an explicit tab against
399
412
  // that header, so a tab filed under the process's client id was refused to a run with a terminal pin and no browser
400
413
  // pin (a native run without a browser, a brain's MCP child) as "another owner's".
401
414
  const resp = await request('POST', '/api/browser/acquire', {
402
415
  clientId: terminalIdFor(id),
403
416
  url: url || 'about:blank',
417
+ ...(takeOverTab && { takeOverTab }),
404
418
  }, SESSION_CREATE_TIMEOUT);
405
419
  // Still starting (a cold MoreLogin start): nothing failed, and the tab is kept for this caller's next request.
406
420
  if (isBrowserStarting(resp))
407
421
  return { error: String(resp.error || 'The browser is still starting. Call the browser tool again in a moment.'), starting: true };
422
+ // Refused until the user acts (a profile closed outside SynaBun): said as it is, and no replacement is announced.
423
+ const blocked = userBlockedStart(resp);
424
+ if (blocked)
425
+ return blocked;
408
426
  if (resp.error || !resp.sessionId) {
409
427
  return { error: `Failed to acquire a shared browser tab: ${resp.error || 'no session returned'}` };
410
428
  }
@@ -414,7 +432,7 @@ async function acquireInteractive(id, url) {
414
432
  // A tab of its own again, after the one it had went away: the call says so.
415
433
  if (id.state.lostRoute)
416
434
  announceReplacement(id, { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId });
417
- return { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId || undefined };
435
+ return { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId || undefined, ...(resp.profileMode === 'extension' && typeof resp.url === 'string' ? { openedUrl: resp.url } : {}) };
418
436
  }
419
437
  function adoptCreatedSession(id, created, tabId) {
420
438
  const sessionId = created.sessionId;
@@ -497,7 +515,9 @@ function ownedTabIn(listing, sessionId, id, tabId) {
497
515
  if (!session || !servesDefault(session))
498
516
  return null;
499
517
  const owners = session.tabOwners || {};
500
- const mine = [owners[terminalIdFor(id)], owners[id.clientId]].filter((t) => typeof t === 'string' && t.length > 0);
518
+ const mine = session.profileMode === 'extension' && session.ownTabsOnly === true
519
+ ? (session.tabs || []).map(t => t.id)
520
+ : [owners[terminalIdFor(id)], owners[id.clientId]].filter((t) => typeof t === 'string' && t.length > 0);
501
521
  const open = (t) => !session.tabs || session.tabs.some(x => x.id === t);
502
522
  if (tabId && mine.includes(tabId) && open(tabId))
503
523
  return tabId;
@@ -526,7 +546,7 @@ async function recordOwnRoute(id, listing, sessionId, tabId) {
526
546
  * open, e.g. after another MCP process of the run recovered first). `reason: 'create'`: the run's own
527
547
  * browser_session create, always a new tab. The server records the move on the run (state file, run record).
528
548
  */
529
- async function recoverRunBrowser(id, lost, reason) {
549
+ async function recoverRunBrowser(id, lost, reason, takeOverTab) {
530
550
  const pins = effectivePins(id);
531
551
  const terminalSessionId = pins.terminalSessionId || id.state.ancestorPinnedTerminal || undefined;
532
552
  const body = {};
@@ -534,6 +554,9 @@ async function recoverRunBrowser(id, lost, reason) {
534
554
  body.terminalSessionId = terminalSessionId;
535
555
  if (reason)
536
556
  body.reason = reason;
557
+ // A create that takes over one of the owner's tabs in the everyday browser (extension mode, full control).
558
+ if (reason === 'create' && takeOverTab)
559
+ body.takeOverTab = takeOverTab;
537
560
  if (lost?.sessionId)
538
561
  body.lost = { sessionId: lost.sessionId, tabId: lost.tabId || null };
539
562
  const recovered = await request('POST', '/api/loop/recover-browser', body, SESSION_CREATE_TIMEOUT);
@@ -743,6 +766,25 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
743
766
  // this caller to a specific browser session (multi-session isolation).
744
767
  // If pinned session died, check recovery cache first, then auto-create.
745
768
  const pinnedSession = pins.browserSessionId || id.state.ancestorPinnedSession || undefined;
769
+ // Extension ownership is per tab, even for a pinned run. Reuse its normal liveness read to verify explicit ids.
770
+ const explicitExtensionTab = async (listing) => {
771
+ if (!pinnedSession || !tabId)
772
+ return null;
773
+ const targetSession = sessionId || id.state.recoveredSessionId || pinnedSession;
774
+ const target = (listing.sessions || []).find(s => s.id === targetSession);
775
+ if (target?.profileMode !== 'extension' || target.ownTabsOnly !== true)
776
+ return null;
777
+ if (!target.tabs?.some(t => t.id === tabId))
778
+ return { error: 'NOT_OWNED: This is not an open tab owned by this caller.' };
779
+ repin(id, targetSession, tabId);
780
+ await recordOwnRoute(id, listing, targetSession, tabId);
781
+ return { sessionId: targetSession, tabId };
782
+ };
783
+ if (namedListing) {
784
+ const explicit = await explicitExtensionTab(namedListing);
785
+ if (explicit)
786
+ return explicit;
787
+ }
746
788
  // A pinned run that names a session of its own by hand (the one its browser_session create returned, or one it
747
789
  // recovered into in an earlier process): that session and its own open tab there, never the dead pinned tab paired
748
790
  // with it. The run's route moves there, here and on the server (recordOwnRoute). A session that is not the run's
@@ -772,6 +814,9 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
772
814
  // Return the RECOVERED tab, never the stale pinned tab (which 404s).
773
815
  if (id.state.recoveredSessionId) {
774
816
  const recheck = await request('GET', '/api/browser/sessions');
817
+ const explicit = await explicitExtensionTab(recheck);
818
+ if (explicit)
819
+ return explicit;
775
820
  const alive = (recheck.sessions || []).find(s => s.id === id.state.recoveredSessionId);
776
821
  // The recovered TAB must still be there too: one closed while its session lives was returned forever
777
822
  // ("Tab … not found in session" on every call, 2026-10-04).
@@ -783,7 +828,14 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
783
828
  id.state.recoveredTabId = null;
784
829
  }
785
830
  const check = await request('GET', '/api/browser/sessions');
831
+ const explicit = await explicitExtensionTab(check);
832
+ if (explicit)
833
+ return explicit;
786
834
  const listed = (check.sessions || []);
835
+ // Extension tabs are never silently replaced after close/revoke/browser restart. The adapter returns TAB_CLOSED.
836
+ if (check.defaultBrowser?.connectMode === 'extension') {
837
+ return { sessionId: id.state.recoveredSessionId || pinnedSession, tabId: id.state.recoveredTabId || resolvedTabId };
838
+ }
787
839
  // The route the server recorded for this run (yourRoute): where a recovery or the run's own browser_session
788
840
  // create moved it, also when that happened in an earlier MCP process of the run (a Codex turn, a restarted
789
841
  // stdio child) that this one never heard of. Used while its tab is open; the pin otherwise.
@@ -820,6 +872,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
820
872
  const recovered = await recoverRunBrowser(id, { sessionId: pinnedSession, tabId: resolvedTabId });
821
873
  if (isBrowserStarting(recovered))
822
874
  return { error: String(recovered.error), starting: true };
875
+ if (userBlockedStart(recovered))
876
+ return userBlockedStart(recovered);
823
877
  if (!recovered.error && recovered.sessionId) {
824
878
  return { sessionId: recovered.sessionId, tabId: recovered.tabId || undefined };
825
879
  }
@@ -838,6 +892,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
838
892
  const recovered = await recoverRunBrowser(id, { sessionId: pinnedSession, tabId: resolvedTabId });
839
893
  if (isBrowserStarting(recovered))
840
894
  return { error: String(recovered.error), starting: true };
895
+ if (userBlockedStart(recovered))
896
+ return userBlockedStart(recovered);
841
897
  if (!recovered.error && recovered.sessionId) {
842
898
  return { sessionId: recovered.sessionId, tabId: recovered.tabId || undefined };
843
899
  }
@@ -852,6 +908,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
852
908
  const recovered = await recoverRunBrowser(id, { sessionId: pinnedSession, tabId: resolvedTabId });
853
909
  if (isBrowserStarting(recovered))
854
910
  return { error: String(recovered.error), starting: true };
911
+ if (userBlockedStart(recovered))
912
+ return userBlockedStart(recovered);
855
913
  if (recovered.error || !recovered.sessionId) {
856
914
  return { error: `Pinned browser session ${pinnedSession} is no longer available and recovery failed: ${recovered.error || 'no session returned'}\n${LOST_ROUTE_HINT}` };
857
915
  }
@@ -888,6 +946,9 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
888
946
  }
889
947
  const check = await request('GET', '/api/browser/sessions');
890
948
  const alive = (check.sessions || []).find(s => s.id === id.state.interactiveSessionId);
949
+ if (check.defaultBrowser?.connectMode === 'extension') {
950
+ return { sessionId: id.state.interactiveSessionId, tabId: resolvedTabId || id.state.interactiveTabId || undefined };
951
+ }
891
952
  if (alive && servesDefault(alive))
892
953
  return { sessionId: id.state.interactiveSessionId, tabId: resolvedTabId || id.state.interactiveTabId || undefined };
893
954
  id.state.lostRoute = { sessionId: id.state.interactiveSessionId, tabId: id.state.interactiveTabId };
@@ -905,6 +966,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
905
966
  // Still starting: not a failure (the server keeps the start for this caller's next call).
906
967
  if (isBrowserStarting(created))
907
968
  return { error: AUTO_CREATE_STARTING, starting: true };
969
+ if (userBlockedStart(created))
970
+ return userBlockedStart(created);
908
971
  if (created.error) {
909
972
  if (/lock/i.test(created.error))
910
973
  return acquireInteractive(id, autoCreate.url);
@@ -944,6 +1007,8 @@ async function resolveSessionUncached(sessionId, autoCreate, tabId, platform = f
944
1007
  // Still starting: not a failure (the server keeps the start for this caller's next call).
945
1008
  if (isBrowserStarting(created))
946
1009
  return { error: AUTO_CREATE_STARTING, starting: true };
1010
+ if (userBlockedStart(created))
1011
+ return userBlockedStart(created);
947
1012
  if (created.error) {
948
1013
  if (/lock/i.test(created.error))
949
1014
  return acquireInteractive(id, autoCreate?.url);
@@ -1044,7 +1109,9 @@ export async function resolveBatchRoute(sessionId, tabId) {
1044
1109
  return { error: result.error };
1045
1110
  const session = result.sessions?.find(s => s.id === resolved.sessionId);
1046
1111
  const id = getIdentity();
1047
- const ownedTabs = [session?.tabOwners?.[terminalIdFor(id)], session?.tabOwners?.[id.clientId]].filter(Boolean);
1112
+ const ownedTabs = session?.profileMode === 'extension' && session.ownTabsOnly === true
1113
+ ? (session.tabs || []).map(t => t.id)
1114
+ : [session?.tabOwners?.[terminalIdFor(id)], session?.tabOwners?.[id.clientId]].filter(Boolean);
1048
1115
  const ownedTab = resolved.tabId || ownedTabs[0];
1049
1116
  if (!ownedTab || !ownedTabs.includes(ownedTab)) {
1050
1117
  return { error: 'browser_batch requires a tab owned by this caller. Use browser_navigate to acquire a tab first.' };
@@ -1081,12 +1148,16 @@ export async function browserRouteStatus() {
1081
1148
  if (listing.error)
1082
1149
  return { ...empty, error: listing.error };
1083
1150
  const raw = (listing.sessions || []);
1151
+ const extensionTabs = listing.extensionTabs;
1152
+ const ownerTabs = Array.isArray(extensionTabs?.tabs)
1153
+ ? extensionTabs.tabs.filter(t => typeof t?.id === 'string').map(t => ({ id: t.id, url: typeof t.url === 'string' ? t.url : '', title: typeof t.title === 'string' ? t.title : '', ...(t.owner === null || typeof t.owner === 'string' ? { owner: t.owner } : {}) }))
1154
+ : undefined;
1084
1155
  const keys = [terminalIdFor(id), id.clientId];
1085
1156
  const sessions = raw.map((s) => {
1086
1157
  const owners = s.tabOwners || {};
1087
1158
  const mine = new Set(keys.map(k => owners[k]).filter((t) => typeof t === 'string' && t.length > 0));
1088
1159
  const all = s.tabs || [];
1089
- const tabs = all.filter(t => mine.has(t.id)).map(t => ({ id: t.id, url: t.url || '', title: t.title || '' }));
1160
+ const tabs = all.filter(t => s.ownTabsOnly === true || mine.has(t.id)).map(t => ({ id: t.id, url: t.url || '', title: t.title || '' }));
1090
1161
  const otherTabs = typeof s.otherTabs === 'number' ? s.otherTabs : all.length - tabs.length;
1091
1162
  return { id: s.id, tabs, otherTabs, servesDefault: servesDefault(s), profile: describeSession(s) };
1092
1163
  });
@@ -1145,7 +1216,7 @@ export async function browserRouteStatus() {
1145
1216
  const yourProfile = listing.yourProfile;
1146
1217
  const profile = yourProfile && typeof yourProfile.envId === 'string'
1147
1218
  ? { envId: yourProfile.envId, name: typeof yourProfile.name === 'string' ? yourProfile.name : null } : null;
1148
- return { sessions, current, replacedTabs, lost: id.state.lostRoute, movedFromPin, movedFrom, profile };
1219
+ return { sessions, current, replacedTabs, lost: id.state.lostRoute, movedFromPin, movedFrom, profile, ...(ownerTabs && { ownerTabs }) };
1149
1220
  }
1150
1221
  /**
1151
1222
  * browser_session create: a new browser tab of this caller's own, where it continues.
@@ -1158,7 +1229,11 @@ export async function browserRouteStatus() {
1158
1229
  * A url other than about:blank is opened in the new tab. A start the server is still running answers
1159
1230
  * BROWSER_STARTING (isBrowserStarting): the next create gets that same start, never a second browser.
1160
1231
  */
1161
- export async function createSession(url) {
1232
+ /**
1233
+ * `takeOverTab`: the id of one of the owner's open tabs in the everyday browser (browser_session list shows them in
1234
+ * full control). The new route is that tab instead of a new one; the server refuses it in any other setup.
1235
+ */
1236
+ export async function createSession(url, takeOverTab) {
1162
1237
  const id = getIdentity();
1163
1238
  const pins = effectivePins(id);
1164
1239
  const target = url || 'about:blank';
@@ -1170,7 +1245,7 @@ export async function createSession(url) {
1170
1245
  let created;
1171
1246
  let opened = false; // the new tab is already at `target`
1172
1247
  if (pinned) {
1173
- created = await recoverRunBrowser(id, null, 'create');
1248
+ created = await recoverRunBrowser(id, null, 'create', takeOverTab);
1174
1249
  if (created.error || isBrowserStarting(created) || typeof created.sessionId !== 'string')
1175
1250
  return created;
1176
1251
  created = { ...created, repinned: true };
@@ -1184,7 +1259,7 @@ export async function createSession(url) {
1184
1259
  let shared = lockRisk;
1185
1260
  created = {};
1186
1261
  if (!lockRisk) {
1187
- created = await request('POST', '/api/browser/sessions', { url: target }, SESSION_CREATE_TIMEOUT);
1262
+ created = await request('POST', '/api/browser/sessions', { url: target, ...(takeOverTab && { takeOverTab }) }, SESSION_CREATE_TIMEOUT);
1188
1263
  if (isBrowserStarting(created))
1189
1264
  return created;
1190
1265
  if (created.error && /lock/i.test(created.error))
@@ -1203,11 +1278,12 @@ export async function createSession(url) {
1203
1278
  }
1204
1279
  }
1205
1280
  if (shared) {
1206
- const acquired = await acquireInteractive(id, target);
1281
+ const acquired = await acquireInteractive(id, target, takeOverTab);
1207
1282
  if ('error' in acquired)
1208
1283
  return { error: acquired.error, ...(acquired.starting && { starting: true, code: 'BROWSER_STARTING' }) };
1209
1284
  resolvedRoutes.delete(id);
1210
- created = { ok: true, sessionId: acquired.sessionId, tabId: acquired.tabId || null, shared: true };
1285
+ opened = typeof acquired.openedUrl === 'string';
1286
+ created = { ok: true, sessionId: acquired.sessionId, tabId: acquired.tabId || null, shared: true, ...(opened ? { url: acquired.openedUrl } : {}) };
1211
1287
  }
1212
1288
  }
1213
1289
  const sessionId = created.sessionId;
@@ -1225,13 +1301,17 @@ export async function createSession(url) {
1225
1301
  * caller's own tab there (`sessionKept`). Either way this caller's cached route to it is forgotten: the next call
1226
1302
  * resolves again (a pinned run gets a tab back through its recovery).
1227
1303
  */
1228
- export async function closeSession(sessionId) {
1229
- const result = await request('DELETE', `/api/browser/sessions/${sessionId}`);
1304
+ export async function closeSession(sessionId, tabId) {
1305
+ const qs = tabId ? `?tabId=${encodeURIComponent(tabId)}` : '';
1306
+ const result = await request('DELETE', `/api/browser/sessions/${sessionId}${qs}`);
1230
1307
  if (!result.error) {
1231
1308
  const id = getIdentity();
1232
1309
  // The tab that went (the server's releasedTabId, else the one this caller routed to there): the next call that
1233
1310
  // opens a tab for this caller says it replaced this one.
1234
1311
  const cachedRoute = resolvedRoutes.get(id)?.route;
1312
+ const currentTab = cachedRoute?.tabId || id.state.recoveredTabId || id.state.interactiveTabId;
1313
+ if (tabId && result.releasedTabId === tabId && result.sessionKept === true && currentTab && currentTab !== tabId)
1314
+ return result;
1235
1315
  const closedTab = typeof result.releasedTabId === 'string' ? result.releasedTabId
1236
1316
  : cachedRoute?.sessionId === sessionId ? cachedRoute.tabId || null
1237
1317
  : id.state.recoveredSessionId === sessionId ? id.state.recoveredTabId
@@ -1632,7 +1712,7 @@ export async function moreloginStop(envId) {
1632
1712
  }
1633
1713
  /**
1634
1714
  * This caller works in a MoreLogin profile of its own from now on (POST /api/morelogin/use): `envId`, `name` or
1635
- * `profile` (either) of a profile MoreLogin lists, or `default: true` for the default of Settings → Browser. Only this
1715
+ * `profile` (either) of a profile MoreLogin lists, or `default: true` for the default AI browser (Settings → Connected tools → MoreLogin). Only this
1636
1716
  * caller moves: the default AI browser and every other session stay where they are. The server releases what the
1637
1717
  * caller owned in the browser it leaves; here every route this process knew is forgotten, so its next browser call
1638
1718
  * resolves again and gets a tab of its own in the new profile (started then). The route it left is kept as its lost
@@ -1684,6 +1764,15 @@ export async function skillsV2(method, path, body, timeout = LONG_TIMEOUT) {
1684
1764
  const credential = callerBrainCredential();
1685
1765
  return requestOnce(method, `/api/skills-studio/v2${path}`, body, timeout, credential ? { 'X-Synabun-Brain-Token': credential } : {});
1686
1766
  }
1767
+ // ── agents-p6 BEGIN: agent definitions (the `agent_definition` tool of the role-gated `skills` group) ──
1768
+ // One thin call over /api/agents-studio/v1 (neural-interface/lib/agents-studio-api.js), which owns every rule: the
1769
+ // Assistant reads, drafts, checks and submits for review; approving, deleting and writing a native export are the
1770
+ // owner's, from the app's own page, and those routes refuse a request that carries the agent headers requestOnce
1771
+ // sends. The brain credential rides along as for skillsV2: the server knows the Assistant by it, never by the role.
1772
+ export async function agentsStudio(method, path, body, timeout = LONG_TIMEOUT) {
1773
+ const credential = callerBrainCredential();
1774
+ return requestOnce(method, `/api/agents-studio/v1${path}`, body, timeout, credential ? { 'X-Synabun-Brain-Token': credential } : {});
1775
+ }
1687
1776
  // A dispatch may acquire a browser tab before the run is accepted.
1688
1777
  const ASSISTANT_DISPATCH_TIMEOUT = 90_000;
1689
1778
  // Long-poll waits block server-side for up to timeoutMs; the HTTP deadline
@@ -1737,7 +1826,7 @@ export async function assistantResult(runId) {
1737
1826
  return request('GET', assistantRunPath(runId, '/result'));
1738
1827
  }
1739
1828
  export async function assistantTranscript(runId, opts = {}) {
1740
- return request('GET', assistantRunPath(runId, `/transcript${queryString({ format: opts.format, tail: opts.tail, maxChars: opts.maxChars })}`), undefined, LONG_TIMEOUT);
1829
+ return request('GET', assistantRunPath(runId, `/transcript${queryString({ format: opts.format, tail: opts.tail, maxChars: opts.maxChars, offset: opts.offset })}`), undefined, LONG_TIMEOUT);
1741
1830
  }
1742
1831
  export async function assistantSend(runId, body) {
1743
1832
  return request('POST', assistantRunPath(runId, '/send'), body, LONG_TIMEOUT);
@@ -1746,7 +1835,8 @@ export async function assistantPermission(runId, body) {
1746
1835
  return request('POST', assistantRunPath(runId, '/permission'), body, LONG_TIMEOUT);
1747
1836
  }
1748
1837
  export async function assistantWaitRun(runId, opts) {
1749
- return request('GET', assistantRunPath(runId, `/wait${queryString({ until: opts.until, timeout: opts.timeoutMs })}`), undefined, opts.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
1838
+ const query = queryString({ until: opts.until, timeout: opts.timeoutMs, afterSeq: opts.afterSeq, kinds: opts.kinds && opts.kinds.length ? opts.kinds.join(',') : undefined });
1839
+ return request('GET', assistantRunPath(runId, `/wait${query}`), undefined, opts.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
1750
1840
  }
1751
1841
  export async function assistantWaitMany(body) {
1752
1842
  return request('POST', '/api/assistant/wait', body, body.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
@@ -1760,6 +1850,61 @@ export async function assistantKillAll(body = {}) {
1760
1850
  export async function assistantFocus(runId, focus) {
1761
1851
  return request('POST', assistantRunPath(runId, '/focus'), { focus });
1762
1852
  }
1853
+ // ── agents-p4: teams ──
1854
+ // agent_team (the Assistant's own: /api/assistant/teams/*) and a worker's `team` tool (/api/assistant/team/*, where
1855
+ // the Neural Interface takes the team from the caller's proven run, never from the request).
1856
+ const ASSISTANT_TEAM_TIMEOUT = 120_000;
1857
+ function assistantTeamPath(teamId, suffix = '') {
1858
+ return `/api/assistant/teams/${encodeURIComponent(teamId)}${suffix}`;
1859
+ }
1860
+ export async function assistantTeamList(opts = {}) {
1861
+ return request('GET', `/api/assistant/teams${queryString({ assistantSessionId: opts.assistantSessionId, open: opts.open ? '1' : undefined })}`, undefined, LONG_TIMEOUT);
1862
+ }
1863
+ export async function assistantTeamPlan(body) {
1864
+ return request('POST', '/api/assistant/teams/plan', body, LONG_TIMEOUT);
1865
+ }
1866
+ /** Creates the worktrees and dispatches the first workers: as long as a dispatch may take, and more. */
1867
+ export async function assistantTeamStart(body) {
1868
+ return request('POST', '/api/assistant/teams/start', body, ASSISTANT_TEAM_TIMEOUT);
1869
+ }
1870
+ export async function assistantTeamStatus(teamId) {
1871
+ return request('GET', assistantTeamPath(teamId), undefined, LONG_TIMEOUT);
1872
+ }
1873
+ /** A join runs the team's test command on the integration branch: the answer may take as long as the tests. */
1874
+ export async function assistantTeamIntegrate(teamId, body = {}) {
1875
+ return request('POST', assistantTeamPath(teamId, '/integrate'), body, ASSISTANT_TEAM_TIMEOUT);
1876
+ }
1877
+ export async function assistantTeamLand(teamId, body = {}) {
1878
+ return request('POST', assistantTeamPath(teamId, '/land'), body, ASSISTANT_TEAM_TIMEOUT);
1879
+ }
1880
+ export async function assistantTeamCleanup(teamId, body) {
1881
+ return request('POST', assistantTeamPath(teamId, '/cleanup'), body, ASSISTANT_TEAM_TIMEOUT, { preserveJson: true });
1882
+ }
1883
+ export async function assistantTeamDiscard(teamId, body = {}) {
1884
+ return request('POST', assistantTeamPath(teamId, '/discard'), body, ASSISTANT_TEAM_TIMEOUT);
1885
+ }
1886
+ /** Does the calling run work a team slice now? `{ ok: true, team: true, teamId, sliceId }`, or a refusal. */
1887
+ export async function teamContext(timeoutMs = 2500) {
1888
+ return requestOnce('GET', '/api/assistant/team/context', undefined, timeoutMs);
1889
+ }
1890
+ export async function teamPost(body) {
1891
+ return request('POST', '/api/assistant/team/post', body, LONG_TIMEOUT);
1892
+ }
1893
+ export async function teamRead(body) {
1894
+ return request('POST', '/api/assistant/team/read', body, LONG_TIMEOUT);
1895
+ }
1896
+ export async function teamWait(body) {
1897
+ return request('POST', '/api/assistant/team/wait', body, body.timeoutMs + ASSISTANT_WAIT_MARGIN_MS);
1898
+ }
1899
+ export async function teamAck(body) {
1900
+ return request('POST', '/api/assistant/team/ack', body, LONG_TIMEOUT);
1901
+ }
1902
+ export async function teamClaims(body = {}) {
1903
+ return request('POST', '/api/assistant/team/claims', body, LONG_TIMEOUT);
1904
+ }
1905
+ export async function teamRequest(body) {
1906
+ return request('POST', '/api/assistant/team/request', body, LONG_TIMEOUT);
1907
+ }
1763
1908
  // whatsapp_send_file: the server's own deadline for the send is 120 s (lib/whatsapp/manager.js); this
1764
1909
  // one outlives it so a server timeout is reported as the server's.
1765
1910
  const WHATSAPP_SEND_FILE_TIMEOUT = 130_000;