synabun 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/docs/whatsapp.md +52 -20
  4. package/lib/mcp-build.js +519 -0
  5. package/lib/mcp-dist.js +10 -4
  6. package/lib/server-supervisor.js +7 -1
  7. package/lib/virustotal.mjs +4 -2
  8. package/mcp-server/dist/http.d.ts +38 -0
  9. package/mcp-server/dist/http.d.ts.map +1 -1
  10. package/mcp-server/dist/http.js +75 -7
  11. package/mcp-server/dist/http.js.map +1 -1
  12. package/mcp-server/dist/services/browser-route-flow.d.ts +3 -2
  13. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -1
  14. package/mcp-server/dist/services/browser-route-flow.js +4 -3
  15. package/mcp-server/dist/services/browser-route-flow.js.map +1 -1
  16. package/mcp-server/dist/services/embedding-service.d.ts.map +1 -1
  17. package/mcp-server/dist/services/embedding-service.js +2 -1
  18. package/mcp-server/dist/services/embedding-service.js.map +1 -1
  19. package/mcp-server/dist/services/neural-interface.d.ts +21 -0
  20. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  21. package/mcp-server/dist/services/neural-interface.js +76 -4
  22. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  23. package/mcp-server/dist/services/tool-catalog.js +2 -2
  24. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  25. package/mcp-server/dist/tools/agents.d.ts +3 -2
  26. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  27. package/mcp-server/dist/tools/agents.js +6 -4
  28. package/mcp-server/dist/tools/agents.js.map +1 -1
  29. package/mcp-server/dist/tools/browser-advanced.d.ts +3 -1
  30. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  31. package/mcp-server/dist/tools/browser-advanced.js +30 -8
  32. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  33. package/mcp-server/dist/tools/browser-navigate.d.ts +3 -3
  34. package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -1
  35. package/mcp-server/dist/tools/browser-navigate.js +19 -16
  36. package/mcp-server/dist/tools/browser-navigate.js.map +1 -1
  37. package/mcp-server/dist/tools/browser-observe.d.ts +2 -1
  38. package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
  39. package/mcp-server/dist/tools/browser-observe.js +61 -20
  40. package/mcp-server/dist/tools/browser-observe.js.map +1 -1
  41. package/mcp-server/dist/tools/morelogin.d.ts +13 -3
  42. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  43. package/mcp-server/dist/tools/morelogin.js +81 -20
  44. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  45. package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -1
  46. package/mcp-server/dist/tools/youtube/upload.js +225 -88
  47. package/mcp-server/dist/tools/youtube/upload.js.map +1 -1
  48. package/mcp-server/package-lock.json +2 -2
  49. package/mcp-server/package.json +1 -1
  50. package/mcp-server/src/http.ts +79 -7
  51. package/mcp-server/src/services/browser-route-flow.ts +4 -3
  52. package/mcp-server/src/services/embedding-service.ts +2 -1
  53. package/mcp-server/src/services/neural-interface.ts +77 -4
  54. package/mcp-server/src/services/tool-catalog.ts +2 -2
  55. package/mcp-server/src/tools/agents.ts +8 -4
  56. package/mcp-server/src/tools/browser-advanced.ts +29 -8
  57. package/mcp-server/src/tools/browser-navigate.ts +19 -16
  58. package/mcp-server/src/tools/browser-observe.ts +62 -20
  59. package/mcp-server/src/tools/morelogin.ts +81 -20
  60. package/mcp-server/src/tools/youtube/upload.ts +218 -99
  61. package/neural-interface/i18n/en.json +631 -123
  62. package/neural-interface/i18n/pt-BR.json +518 -10
  63. package/neural-interface/lib/assistant-api.js +26 -0
  64. package/neural-interface/lib/assistant-brains/claude.js +5 -0
  65. package/neural-interface/lib/assistant-catalog.js +114 -1
  66. package/neural-interface/lib/assistant-dispatch.js +71 -1
  67. package/neural-interface/lib/assistant-persona.js +14 -7
  68. package/neural-interface/lib/assistant-router.js +6 -4
  69. package/neural-interface/lib/assistant-runtime.js +3 -0
  70. package/neural-interface/lib/assistant-task-prompt.js +5 -0
  71. package/neural-interface/lib/automation-approval.js +249 -0
  72. package/neural-interface/lib/automation-browser-owner-access.js +82 -0
  73. package/neural-interface/lib/backup-service.js +16 -1
  74. package/neural-interface/lib/browser-background-tab.js +72 -3
  75. package/neural-interface/lib/browser-extraction.js +106 -45
  76. package/neural-interface/lib/browser-profile-choices.js +143 -0
  77. package/neural-interface/lib/browser-profiles.js +142 -0
  78. package/neural-interface/lib/browser-tab-recovery.js +153 -0
  79. package/neural-interface/lib/browser-tool-policy.js +2 -0
  80. package/neural-interface/lib/chromium-on-device-model.js +67 -0
  81. package/neural-interface/lib/claude-agent-bridge.js +7 -4
  82. package/neural-interface/lib/claude-model-catalog.js +12 -0
  83. package/neural-interface/lib/effort-levels.js +28 -2
  84. package/neural-interface/lib/local-profile-proxy.js +362 -0
  85. package/neural-interface/lib/local-profiles.js +929 -0
  86. package/neural-interface/lib/loop-logger.js +25 -4
  87. package/neural-interface/lib/maritaca/api.js +179 -0
  88. package/neural-interface/lib/maritaca/attachments.js +44 -0
  89. package/neural-interface/lib/maritaca/client.js +362 -0
  90. package/neural-interface/lib/maritaca/key-store.js +122 -0
  91. package/neural-interface/lib/maritaca/models.js +181 -0
  92. package/neural-interface/lib/maritaca/modes.js +39 -0
  93. package/neural-interface/lib/maritaca/opencode-proxy.js +236 -0
  94. package/neural-interface/lib/maritaca/opencode-stream.js +345 -0
  95. package/neural-interface/lib/maritaca/opencode.js +218 -0
  96. package/neural-interface/lib/maritaca/panel-bridge.js +273 -0
  97. package/neural-interface/lib/maritaca/sessions.js +198 -0
  98. package/neural-interface/lib/morelogin-agent-profiles.js +149 -0
  99. package/neural-interface/lib/morelogin.js +278 -14
  100. package/neural-interface/lib/native-loop-providers.js +3 -1
  101. package/neural-interface/lib/owner-authority.js +30 -12
  102. package/neural-interface/lib/page-session.js +43 -17
  103. package/neural-interface/lib/request-gate.js +2 -0
  104. package/neural-interface/lib/system-activity.js +1 -1
  105. package/neural-interface/lib/terminal-tokens.js +82 -5
  106. package/neural-interface/package-lock.json +3 -2
  107. package/neural-interface/package.json +2 -1
  108. package/neural-interface/public/assets/mascot/README.md +11 -0
  109. package/neural-interface/public/assets/mascot/ask.gif +0 -0
  110. package/neural-interface/public/assets/mascot/ask.png +0 -0
  111. package/neural-interface/public/assets/mascot/blocked.gif +0 -0
  112. package/neural-interface/public/assets/mascot/blocked.png +0 -0
  113. package/neural-interface/public/assets/mascot/budget.gif +0 -0
  114. package/neural-interface/public/assets/mascot/budget.png +0 -0
  115. package/neural-interface/public/assets/mascot/computer.gif +0 -0
  116. package/neural-interface/public/assets/mascot/computer.png +0 -0
  117. package/neural-interface/public/assets/mascot/edit.gif +0 -0
  118. package/neural-interface/public/assets/mascot/edit.png +0 -0
  119. package/neural-interface/public/assets/mascot/error.gif +0 -0
  120. package/neural-interface/public/assets/mascot/error.png +0 -0
  121. package/neural-interface/public/assets/mascot/hover-attention.gif +0 -0
  122. package/neural-interface/public/assets/mascot/hover-attention.png +0 -0
  123. package/neural-interface/public/assets/mascot/idle-hero.gif +0 -0
  124. package/neural-interface/public/assets/mascot/idle-hero.png +0 -0
  125. package/neural-interface/public/assets/mascot/idle.gif +0 -0
  126. package/neural-interface/public/assets/mascot/idle.png +0 -0
  127. package/neural-interface/public/assets/mascot/manifest.json +254 -0
  128. package/neural-interface/public/assets/mascot/mcp.gif +0 -0
  129. package/neural-interface/public/assets/mascot/mcp.png +0 -0
  130. package/neural-interface/public/assets/mascot/memory.gif +0 -0
  131. package/neural-interface/public/assets/mascot/memory.png +0 -0
  132. package/neural-interface/public/assets/mascot/offline.gif +0 -0
  133. package/neural-interface/public/assets/mascot/offline.png +0 -0
  134. package/neural-interface/public/assets/mascot/pick.gif +0 -0
  135. package/neural-interface/public/assets/mascot/pick.png +0 -0
  136. package/neural-interface/public/assets/mascot/plan.gif +0 -0
  137. package/neural-interface/public/assets/mascot/plan.png +0 -0
  138. package/neural-interface/public/assets/mascot/present.gif +0 -0
  139. package/neural-interface/public/assets/mascot/present.png +0 -0
  140. package/neural-interface/public/assets/mascot/project.gif +0 -0
  141. package/neural-interface/public/assets/mascot/project.png +0 -0
  142. package/neural-interface/public/assets/mascot/read.gif +0 -0
  143. package/neural-interface/public/assets/mascot/read.png +0 -0
  144. package/neural-interface/public/assets/mascot/runs.gif +0 -0
  145. package/neural-interface/public/assets/mascot/runs.png +0 -0
  146. package/neural-interface/public/assets/mascot/scenes/automation.gif +0 -0
  147. package/neural-interface/public/assets/mascot/scenes/automation.png +0 -0
  148. package/neural-interface/public/assets/mascot/scenes/browser.gif +0 -0
  149. package/neural-interface/public/assets/mascot/scenes/browser.png +0 -0
  150. package/neural-interface/public/assets/mascot/scenes/code.gif +0 -0
  151. package/neural-interface/public/assets/mascot/scenes/code.png +0 -0
  152. package/neural-interface/public/assets/mascot/scenes/complex.gif +0 -0
  153. package/neural-interface/public/assets/mascot/scenes/complex.png +0 -0
  154. package/neural-interface/public/assets/mascot/scenes/computer.gif +0 -0
  155. package/neural-interface/public/assets/mascot/scenes/computer.png +0 -0
  156. package/neural-interface/public/assets/mascot/scenes/design.gif +0 -0
  157. package/neural-interface/public/assets/mascot/scenes/design.png +0 -0
  158. package/neural-interface/public/assets/mascot/scenes/edit.gif +0 -0
  159. package/neural-interface/public/assets/mascot/scenes/edit.png +0 -0
  160. package/neural-interface/public/assets/mascot/scenes/generic.gif +0 -0
  161. package/neural-interface/public/assets/mascot/scenes/generic.png +0 -0
  162. package/neural-interface/public/assets/mascot/scenes/image_gen.gif +0 -0
  163. package/neural-interface/public/assets/mascot/scenes/image_gen.png +0 -0
  164. package/neural-interface/public/assets/mascot/scenes/manifest.json +173 -0
  165. package/neural-interface/public/assets/mascot/scenes/memory.gif +0 -0
  166. package/neural-interface/public/assets/mascot/scenes/memory.png +0 -0
  167. package/neural-interface/public/assets/mascot/scenes/quick.gif +0 -0
  168. package/neural-interface/public/assets/mascot/scenes/quick.png +0 -0
  169. package/neural-interface/public/assets/mascot/scenes/read.gif +0 -0
  170. package/neural-interface/public/assets/mascot/scenes/read.png +0 -0
  171. package/neural-interface/public/assets/mascot/scenes/research.gif +0 -0
  172. package/neural-interface/public/assets/mascot/scenes/research.png +0 -0
  173. package/neural-interface/public/assets/mascot/scenes/review.gif +0 -0
  174. package/neural-interface/public/assets/mascot/scenes/review.png +0 -0
  175. package/neural-interface/public/assets/mascot/scenes/search.gif +0 -0
  176. package/neural-interface/public/assets/mascot/scenes/search.png +0 -0
  177. package/neural-interface/public/assets/mascot/scenes/shell.gif +0 -0
  178. package/neural-interface/public/assets/mascot/scenes/shell.png +0 -0
  179. package/neural-interface/public/assets/mascot/scenes/thinking.gif +0 -0
  180. package/neural-interface/public/assets/mascot/scenes/thinking.png +0 -0
  181. package/neural-interface/public/assets/mascot/scenes/video_gen.gif +0 -0
  182. package/neural-interface/public/assets/mascot/scenes/video_gen.png +0 -0
  183. package/neural-interface/public/assets/mascot/scenes/web.gif +0 -0
  184. package/neural-interface/public/assets/mascot/scenes/web.png +0 -0
  185. package/neural-interface/public/assets/mascot/search.gif +0 -0
  186. package/neural-interface/public/assets/mascot/search.png +0 -0
  187. package/neural-interface/public/assets/mascot/shell.gif +0 -0
  188. package/neural-interface/public/assets/mascot/shell.png +0 -0
  189. package/neural-interface/public/assets/mascot/skill.gif +0 -0
  190. package/neural-interface/public/assets/mascot/skill.png +0 -0
  191. package/neural-interface/public/assets/mascot/sleep.gif +0 -0
  192. package/neural-interface/public/assets/mascot/sleep.png +0 -0
  193. package/neural-interface/public/assets/mascot/subagent.gif +0 -0
  194. package/neural-interface/public/assets/mascot/subagent.png +0 -0
  195. package/neural-interface/public/assets/mascot/success.gif +0 -0
  196. package/neural-interface/public/assets/mascot/success.png +0 -0
  197. package/neural-interface/public/assets/mascot/think.gif +0 -0
  198. package/neural-interface/public/assets/mascot/think.png +0 -0
  199. package/neural-interface/public/assets/mascot/wait.gif +0 -0
  200. package/neural-interface/public/assets/mascot/wait.png +0 -0
  201. package/neural-interface/public/assets/mascot/watch.gif +0 -0
  202. package/neural-interface/public/assets/mascot/watch.png +0 -0
  203. package/neural-interface/public/assets/mascot/web.gif +0 -0
  204. package/neural-interface/public/assets/mascot/web.png +0 -0
  205. package/neural-interface/public/onboarding.html +14 -1
  206. package/neural-interface/public/shared/agent-runtime-options.js +49 -8
  207. package/neural-interface/public/shared/agy/agy-panel.js +2 -2
  208. package/neural-interface/public/shared/api.js +4 -4
  209. package/neural-interface/public/shared/assistant/asst-ask-styles.js +8 -8
  210. package/neural-interface/public/shared/assistant/asst-ask.js +1 -1
  211. package/neural-interface/public/shared/assistant/asst-brain-picker.js +99 -9
  212. package/neural-interface/public/shared/assistant/asst-control.js +1 -1
  213. package/neural-interface/public/shared/assistant/asst-limit-wait.js +4 -4
  214. package/neural-interface/public/shared/assistant/asst-panel.js +6 -2
  215. package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
  216. package/neural-interface/public/shared/assistant/asst-render.js +6 -6
  217. package/neural-interface/public/shared/assistant/asst-route-models.js +64 -4
  218. package/neural-interface/public/shared/assistant/asst-route.js +24 -7
  219. package/neural-interface/public/shared/assistant/asst-routes-editor.js +154 -39
  220. package/neural-interface/public/shared/assistant/asst-run-stage.js +3 -3
  221. package/neural-interface/public/shared/assistant/asst-scene-styles.js +8 -111
  222. package/neural-interface/public/shared/assistant/asst-scenes.js +46 -318
  223. package/neural-interface/public/shared/assistant/asst-sidepanel.js +2 -2
  224. package/neural-interface/public/shared/assistant/asst-state.js +72 -2
  225. package/neural-interface/public/shared/assistant/asst-styles.js +58 -14
  226. package/neural-interface/public/shared/automation-approval-view.js +75 -0
  227. package/neural-interface/public/shared/cdx/cdx-panel.js +2 -2
  228. package/neural-interface/public/shared/context-menu-model.js +2 -0
  229. package/neural-interface/public/shared/editor/editor-panel-logic.js +10 -0
  230. package/neural-interface/public/shared/editor/editor-panel.js +10 -2
  231. package/neural-interface/public/shared/html-shell.js +30 -22
  232. package/neural-interface/public/shared/morelogin-profile-choices.js +107 -0
  233. package/neural-interface/public/shared/morelogin-profile-field.js +186 -0
  234. package/neural-interface/public/shared/mtc/mtc-client.js +181 -0
  235. package/neural-interface/public/shared/mtc/mtc-compose.js +40 -0
  236. package/neural-interface/public/shared/mtc/mtc-copy.js +253 -0
  237. package/neural-interface/public/shared/mtc/mtc-logic.js +478 -0
  238. package/neural-interface/public/shared/mtc/mtc-panel.js +1354 -0
  239. package/neural-interface/public/shared/mtc/mtc-render.js +172 -0
  240. package/neural-interface/public/shared/mtc/mtc-styles.js +437 -0
  241. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +6 -2
  242. package/neural-interface/public/shared/provider-icons.js +3 -0
  243. package/neural-interface/public/shared/schedules-view.js +7 -0
  244. package/neural-interface/public/shared/server-back.js +50 -0
  245. package/neural-interface/public/shared/settings/settings-browser-owner-access.js +72 -0
  246. package/neural-interface/public/shared/settings/settings-data.js +1 -0
  247. package/neural-interface/public/shared/settings/settings-ia.js +3 -1
  248. package/neural-interface/public/shared/settings/settings-local-profiles.js +153 -0
  249. package/neural-interface/public/shared/settings/settings-maritaca-opencode.js +105 -0
  250. package/neural-interface/public/shared/sidepanel-session-status.js +16 -2
  251. package/neural-interface/public/shared/state.js +1 -1
  252. package/neural-interface/public/shared/styles.css +356 -157
  253. package/neural-interface/public/shared/synabun-mascot-assets.js +67 -0
  254. package/neural-interface/public/shared/synabun-mascot.js +136 -12
  255. package/neural-interface/public/shared/synabun-ticker.js +3 -0
  256. package/neural-interface/public/shared/topright-overflow-logic.js +1 -0
  257. package/neural-interface/public/shared/ui-automation-approval.js +188 -0
  258. package/neural-interface/public/shared/ui-automation-studio.js +130 -90
  259. package/neural-interface/public/shared/ui-claude-panel.js +50 -2
  260. package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
  261. package/neural-interface/public/shared/ui-navbar.js +17 -0
  262. package/neural-interface/public/shared/ui-panels.js +3 -1
  263. package/neural-interface/public/shared/ui-schedules-studio.js +118 -17
  264. package/neural-interface/public/shared/ui-scroll-follow.js +3 -0
  265. package/neural-interface/public/shared/ui-settings.js +590 -27
  266. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +8 -2
  267. package/neural-interface/public/shared/ui-sidepanel-sessions.js +3 -3
  268. package/neural-interface/public/shared/ui-sidepanel-tray.js +24 -0
  269. package/neural-interface/public/shared/ui-sidepanel-windows.js +1 -1
  270. package/neural-interface/scripts/build-mascot-assets.mjs +30 -0
  271. package/neural-interface/server.js +1784 -195
  272. package/npm-shrinkwrap.json +5 -17
  273. package/package.json +5 -6
  274. package/postinstall.js +38 -39
  275. package/setup.js +33 -31
  276. package/skills/synabun/modules/changelog.md +14 -0
@@ -159,6 +159,8 @@ export function createAssistantApi({
159
159
  adminSandbox = null,
160
160
  // Protect workers (lib/worker-guard-setting.js): what capability read-only / workspace means for every worker.
161
161
  workerGuard = null,
162
+ // Let the automation browser act as owner (lib/automation-browser-owner-access.js): the owner's page only.
163
+ automationBrowserOwnerAccess = null,
162
164
  // The page secret (lib/page-session.js): a request without an agent pin is the owner's page only when it carries
163
165
  // this boot's cookie; a local process that merely sends no headers is nobody (never 'ui').
164
166
  pageSession = null,
@@ -466,6 +468,8 @@ export function createAssistantApi({
466
468
  maxMinutes: body.maxMinutes ?? body.max_minutes,
467
469
  budgetUsd: body.budgetUsd ?? body.budget_usd,
468
470
  usesBrowser: body.usesBrowser ?? body.uses_browser,
471
+ // The MoreLogin profile of the worker's browser tab (an id or a name); none = the default browser.
472
+ moreloginProfile: body.moreloginProfile ?? body.morelogin_profile ?? null,
469
473
  workflowId: body.workflowId || body.workflow_id,
470
474
  parentRunId: body.parentRunId || body.parent_run_id,
471
475
  outputSchema: body.outputSchema || body.output_schema,
@@ -1422,6 +1426,28 @@ export function createAssistantApi({
1422
1426
  if (uiTabs.size > 50) uiTabs.delete(uiTabs.keys().next().value);
1423
1427
  res.json({ ok: true, windows: uiTabs.size });
1424
1428
  });
1429
+
1430
+ // ── Let the automation browser act as owner (lib/automation-browser-owner-access.js) ──────────────────
1431
+ // The read is any local caller's (the page draws it; an agent may know it). The write is the owner's page alone:
1432
+ // this boot's page secret, no agent header of any kind, and never SynaBun's automation browser (its marker or its
1433
+ // peer process), whatever the setting says: a browser worker must not be able to grant itself the owner's powers.
1434
+ router.get('/automation-browser-owner-access', (req, res) => {
1435
+ if (!automationBrowserOwnerAccess) return res.status(503).json({ ok: false, code: 'OWNER_ACCESS_UNAVAILABLE', error: 'The automation-browser owner access setting is not available on this server' });
1436
+ res.json({ ok: true, ...automationBrowserOwnerAccess.view() });
1437
+ });
1438
+ router.put('/automation-browser-owner-access', requireJson, (req, res) => {
1439
+ if (!automationBrowserOwnerAccess) return res.status(503).json({ ok: false, code: 'OWNER_ACCESS_UNAVAILABLE', error: 'The automation-browser owner access setting is not available on this server' });
1440
+ if (['x-synabun-desktop-grant', 'x-synabun-role', 'x-synabun-terminal', 'x-synabun-assistant', 'x-synabun-brain-token'].some((name) => req.get(name))) {
1441
+ return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can let the automation browser act as owner.' });
1442
+ }
1443
+ let fromAutomationBrowser = false;
1444
+ try { fromAutomationBrowser = typeof pageSession?.isAutomationBrowser === 'function' && pageSession.isAutomationBrowser(req) === true; } catch { fromAutomationBrowser = true; }
1445
+ if (fromAutomationBrowser) return res.status(403).json({ ok: false, code: 'WORKER_BROWSER', error: 'This setting is changed from the owner\'s own browser or the app, never from SynaBun\'s automation browser.' });
1446
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the user can let the automation browser act as owner.');
1447
+ const value = req.body?.enabled;
1448
+ if (typeof value !== 'boolean') return res.status(400).json({ ok: false, code: 'INVALID_VALUE', error: 'enabled must be true or false.' });
1449
+ try { res.json({ ok: true, ...automationBrowserOwnerAccess.set(value) }); } catch (error) { sendError(res, error); }
1450
+ });
1425
1451
  router.get('/ui/tabs', (req, res) => res.json({ ok: true, windows: listTabs() }));
1426
1452
  router.post('/ui/focus', (req, res) => {
1427
1453
  const body = req.body || {};
@@ -190,6 +190,11 @@ export function createClaudeBrain({ session, sink, deps = {}, persona = '', hook
190
190
  if (providerSessionId) query.sessionId = providerSessionId;
191
191
  if (cwd) query.cwd = cwd;
192
192
  if (effort) query.effort = effort;
193
+ // A turn with no effort of its own (the picker's Auto, or after a routed "here" turn) runs on the
194
+ // model's default. The process may still hold a level or Off (`none`) from before: 'off' (Auto
195
+ // outside the panel) takes it back, live for a level (applyFlagSettings, effortLevel null) and by
196
+ // a resumed restart from Off (thinking is a start-up option). The conversation continues either way.
197
+ else if (inner.effort && inner.effort !== 'off') query.effort = 'off';
193
198
  if ((mode && PERMISSION_MODES.has(mode)) || typeof plan === 'boolean') query.permissionMode = applyModes(mode, plan);
194
199
  await handle(query);
195
200
  return true;
@@ -30,6 +30,12 @@ import { sortEfforts, variantNames } from './effort-levels.js';
30
30
  import { listPrice } from './assistant-pricing.js';
31
31
 
32
32
  export const CATALOG_PROVIDERS = ['claude-code', 'codex', 'opencode', 'antigravity'];
33
+ /**
34
+ * Chat-only providers: a side panel of their own and a `chat` section of the catalog, never a worker or a brain
35
+ * (nothing dispatches to them, the router never picks them). Maritaca AI (lib/maritaca/*) is a plain chat API:
36
+ * its rows carry prices in BRL (`price.unit` 'brl_per_mtok') and are listed for the record, `chat: true`.
37
+ */
38
+ export const CHAT_PROVIDERS = Object.freeze(['maritaca']);
33
39
  /** The providers an Assistant brain can run on (every provider of the catalog: each is a worker too). */
34
40
  export const BRAIN_PROVIDERS = Object.freeze(['claude-code', 'codex', 'opencode', 'antigravity']);
35
41
  export const TIERS = ['small', 'medium', 'large'];
@@ -367,6 +373,93 @@ export function normalizeAntigravityRows(rows, { via = null } = {}) {
367
373
  return out;
368
374
  }
369
375
 
376
+ /**
377
+ * Maritaca's model list (GET /api/maritaca/models: lib/maritaca/models.js rows, the API's list merged over the table)
378
+ * → catalog rows of the `chat` section. Prices stay in BRL (never converted into the USD sheet); `vision` is false
379
+ * (text only), `outputs` none, `toolcall` what the table says. A row the API lists and the table does not know keeps
380
+ * what the API said and `tier` null.
381
+ */
382
+ export function normalizeMaritacaRows(rows) {
383
+ const seen = new Set();
384
+ const out = [];
385
+ for (const raw of arr(rows)) {
386
+ const m = typeof raw === 'string' ? { id: raw } : raw;
387
+ const id = typeof m?.id === 'string' ? m.id.trim() : '';
388
+ if (!id || seen.has(id.toLowerCase())) continue;
389
+ seen.add(id.toLowerCase());
390
+ const price = m.price && typeof m.price === 'object' && (num(m.price.input) !== null || num(m.price.output) !== null)
391
+ ? { input: num(m.price.input) ?? 0, output: num(m.price.output) ?? 0, cacheRead: num(m.price.cacheRead), unit: 'brl_per_mtok', basis: m.free === true ? 'free' : 'list' }
392
+ : null;
393
+ out.push({
394
+ provider: 'maritaca', id, upstream: id, label: String(m.label || id), family: m.family || null,
395
+ tier: ['small', 'medium', 'large'].includes(m.tier) ? m.tier : null, tierSource: m.tier ? 'table' : 'unknown',
396
+ vision: false, visionSource: 'table', outputs: { image: false, video: false }, outputsSource: 'table',
397
+ reasoning: typeof m.reasoning === 'boolean' ? m.reasoning : null, toolcall: typeof m.toolcall === 'boolean' ? m.toolcall : null,
398
+ contextWindow: num(m.contextWindow), maxOutput: num(m.maxOutput), price,
399
+ efforts: arr(m.efforts).map(String), defaultEffort: m.defaultEffort || null,
400
+ isDefault: m.isDefault === true, status: m.listed === false ? 'unlisted' : 'active', chat: true, region: m.region || null,
401
+ description: m.description ? String(m.description) : null,
402
+ });
403
+ }
404
+ return out;
405
+ }
406
+
407
+ /** The OpenCode provider id Maritaca is registered under (lib/maritaca/opencode.js): its rows are `maritaca/<id>`. */
408
+ export const MARITACA_OPENCODE_PREFIX = 'maritaca/';
409
+ export const MARITACA_UNAVAILABLE_HINT = 'Register Maritaca under Settings → OpenCode → Providers';
410
+
411
+ /** True for an OpenCode row (or id) that is one of Maritaca's models run through OpenCode. */
412
+ export function isMaritacaOpenCodeId(id) { return String(id || '').toLowerCase().startsWith(MARITACA_OPENCODE_PREFIX); }
413
+
414
+ /**
415
+ * The Maritaca group of every Assistant model picker. Maritaca is chat-only by itself (CHAT_PROVIDERS); what runs is
416
+ * the OpenCode rows `maritaca/<id>`. The group shows those rows under their own heading: each one names the runnable
417
+ * spec it stands for (`target: { provider: 'opencode', model: 'maritaca/<id>' }`, `via: 'opencode'`), so a pick, a
418
+ * saved route and a dispatch keep the OpenCode spec unchanged. Order and labels / tier / BRL price are the Maritaca
419
+ * panel's (`chatRows`); efforts and context are OpenCode's (what a run can use). Rows the user hid in OpenCode stay
420
+ * out (`hiddenRows`: counted). While OpenCode lists no Maritaca model at all, the group keeps Maritaca's models
421
+ * marked `status: 'unavailable'` with a hint, never an empty or missing group.
422
+ */
423
+ export function maritacaRouteGroup({ chatRows = [], opencodeRows = [], hiddenRows = [] } = {}) {
424
+ const visible = arr(opencodeRows).filter((row) => isMaritacaOpenCodeId(row?.id));
425
+ const hidden = arr(hiddenRows).filter((row) => isMaritacaOpenCodeId(row?.id));
426
+ const available = visible.length + hidden.length > 0;
427
+ const bare = (id) => String(id).slice(MARITACA_OPENCODE_PREFIX.length);
428
+ const byBare = new Map(visible.map((row) => [bare(row.id).toLowerCase(), row]));
429
+ const hiddenBare = new Set(hidden.map((row) => bare(row.id).toLowerCase()));
430
+ const models = [];
431
+ const taken = new Set();
432
+ const make = (chat, oc) => {
433
+ const model = chat?.id || bare(oc.id);
434
+ const id = `${MARITACA_OPENCODE_PREFIX}${oc ? bare(oc.id) : model}`;
435
+ return {
436
+ provider: 'maritaca', via: 'opencode', id, model, target: { provider: 'opencode', model: id },
437
+ label: chat?.label || oc?.label || model, family: chat?.family || oc?.family || null,
438
+ tier: chat?.tier || oc?.tier || null, vision: false, outputs: { image: false, video: false },
439
+ contextWindow: oc?.contextWindow ?? chat?.contextWindow ?? null,
440
+ // BRL, the Maritaca panel's price (never converted into the USD sheet).
441
+ price: chat?.price || null,
442
+ efforts: oc ? arr(oc.efforts) : arr(chat?.efforts), defaultEffort: oc ? oc.defaultEffort || null : chat?.defaultEffort || null,
443
+ isDefault: chat?.isDefault === true,
444
+ status: oc ? (oc.status || 'active') : 'unavailable',
445
+ ...(oc ? {} : { hint: MARITACA_UNAVAILABLE_HINT }),
446
+ };
447
+ };
448
+ for (const chat of arr(chatRows)) {
449
+ const key = String(chat?.id || '').toLowerCase();
450
+ if (!key || taken.has(key)) continue;
451
+ taken.add(key);
452
+ if (hiddenBare.has(key)) continue;
453
+ const oc = byBare.get(key) || null;
454
+ // OpenCode lists Maritaca but not this model: it cannot run, so it is not offered.
455
+ if (available && !oc) continue;
456
+ models.push(make(chat, oc));
457
+ }
458
+ // OpenCode rows the Maritaca table does not know (a model added upstream) are listed after, as OpenCode names them.
459
+ for (const oc of visible) if (!taken.has(bare(oc.id).toLowerCase())) { taken.add(bare(oc.id).toLowerCase()); models.push(make(null, oc)); }
460
+ return { id: 'maritaca', label: 'Maritaca', via: 'opencode', available, hint: available ? null : MARITACA_UNAVAILABLE_HINT, hiddenCount: hidden.length, currency: 'BRL', models };
461
+ }
462
+
370
463
  /** The ids the user hid for `provider` (catalog.hidden, else the older opencodeHidden). */
371
464
  function hiddenList(catalog, provider) {
372
465
  const map = catalog?.hidden;
@@ -429,6 +522,8 @@ export function hiddenModelId(catalog, provider, id, { row = null } = {}) {
429
522
  * anything when the user hid every model of a provider that listed some.
430
523
  */
431
524
  export function findModel(catalog, provider, id) {
525
+ // A chat-only provider is never a dispatch target: nothing resolves there (the router never asks, the brain cannot route to it).
526
+ if (CHAT_PROVIDERS.includes(provider)) return null;
432
527
  if (!id) return null;
433
528
  if (hiddenModelId(catalog, provider, id)) return null;
434
529
  const rows = arr(catalog?.models?.[provider]);
@@ -736,11 +831,13 @@ export function createAssistantCatalog({
736
831
  async function build({ deep = false } = {}) {
737
832
  // `deep` also drops the providers' own discovery caches (a CLI or app-server round trip).
738
833
  const fresh = deep ? '?refresh=1' : '';
739
- const [claudeModels, codexModels, opencodeProviders, antigravityModels, projects] = await Promise.all([
834
+ const [claudeModels, codexModels, opencodeProviders, antigravityModels, projects, maritacaModels] = await Promise.all([
740
835
  fetchJson(`/api/claude/models${fresh}`), fetchJson(`/api/codex/models${fresh}`), fetchJson('/api/opencode/providers/full'),
741
836
  // A provider that does not answer is unavailable for this build, never a failed build.
742
837
  Promise.resolve().then(() => fetchJson(`/api/antigravity/models${fresh}`)).catch(() => null),
743
838
  fetchJson('/api/projects'),
839
+ // The chat-only provider (its own section): a server from before it answers nothing, and the section is empty.
840
+ Promise.resolve().then(() => fetchJson('/api/maritaca/models')).catch(() => null),
744
841
  ]);
745
842
  const filter = (() => { try { return readFilter() || {}; } catch { return {}; } })();
746
843
  let accounts = {};
@@ -763,7 +860,10 @@ export function createAssistantCatalog({
763
860
  codex: codex.state,
764
861
  opencode: opencodeProviders && opencodeProviders.ok !== false ? 'live' : 'unavailable',
765
862
  antigravity: antigravity.state,
863
+ // Maritaca: 'live' when its API listed the models, 'table' when the shipped table answered, else unavailable.
864
+ maritaca: maritacaModels && maritacaModels.ok !== false ? (maritacaModels.source === 'live' ? 'live' : 'fallback') : 'unavailable',
766
865
  };
866
+ const chat = { maritaca: maritacaModels && maritacaModels.ok !== false ? normalizeMaritacaRows(pickArray(maritacaModels, ['models'])) : [] };
767
867
  for (const p of ['claude-code', 'codex']) if (sources[p] !== 'live') log('catalog:source', `${p}: ${sources[p]}`);
768
868
  const all = {
769
869
  'claude-code': withClaudeContextVariants(normalizeClaudeRows(claude.list, { pricing: claudePricing })),
@@ -799,6 +899,10 @@ export function createAssistantCatalog({
799
899
  const changed = lastListed ? CATALOG_PROVIDERS.filter((p) => listedNow[p] !== lastListed[p]) : [];
800
900
  lastListed = listedNow;
801
901
  const external = externalServersReport(pickArray(projects, ['projects']));
902
+ // Maritaca's models run through OpenCode: its rows are marked with their picker group, and the group itself is
903
+ // built for the pickers and the routing sheet (routeGroups.maritaca).
904
+ for (const row of [...models.opencode, ...hiddenRows.opencode]) if (isMaritacaOpenCodeId(row.id)) row.group = 'maritaca';
905
+ const maritacaGroup = maritacaRouteGroup({ chatRows: chat.maritaca, opencodeRows: models.opencode, hiddenRows: hiddenRows.opencode });
802
906
  return {
803
907
  generatedAt: new Date(now()).toISOString(),
804
908
  // Providers whose MCP server list could not be checked: { provider, code, reason, errno? }, no paths.
@@ -806,6 +910,10 @@ export function createAssistantCatalog({
806
910
  // Providers whose listed models differ from the build before (not part of the value's meaning: full() reports it).
807
911
  changedProviders: changed,
808
912
  models,
913
+ // Chat-only providers (CHAT_PROVIDERS): listed, never routed to. `chat.maritaca` rows carry BRL prices.
914
+ chat,
915
+ // Picker groups that run through another provider: { maritaca: maritacaRouteGroup(...) }.
916
+ routeGroups: { maritaca: maritacaGroup },
809
917
  hidden,
810
918
  // provider → { hidden id (lower-case) → { model, variant, label, at, … } }: the entries that hide one row only.
811
919
  hiddenPins,
@@ -829,6 +937,11 @@ export function createAssistantCatalog({
829
937
  // A brain and a worker. No accounts (Antigravity signs in with Google in its own CLI: `signedIn` and `tier`
830
938
  // say what its last model listing found) and unpriced (tokens, not prices).
831
939
  { id: 'antigravity', brain: true, efforts: providerEfforts(models.antigravity), permissionPolicies: ['auto', 'ask'], accounts: false, priced: false, signedIn: antigravity.signedIn, tier: antigravity.tier },
940
+ // Chat only: a side panel, no worker, no brain, no dispatch. Prices in BRL on its rows; the key is one per SynaBun
941
+ // (`configured` says whether it is saved).
942
+ { id: 'maritaca', brain: false, worker: false, chat: true, efforts: providerEfforts(chat.maritaca), permissionPolicies: [], accounts: false, priced: true, currency: 'BRL', configured: maritacaModels?.configured === true,
943
+ // Its OpenCode-backed rows run (provider opencode, model maritaca/<id>); a direct chat pick never does.
944
+ via: 'opencode', runnable: maritacaGroup.available },
832
945
  ],
833
946
  };
834
947
  }
@@ -424,6 +424,13 @@ export function createAssistantDispatcher({
424
424
  localPortRange = null,
425
425
  toolListOptions = () => ({}),
426
426
  acquireLoopBrowserAndTab = null,
427
+ // A run's own MoreLogin profile (agent_dispatch morelogin_profile). resolveBrowserProfile(ref) → { envId, name } for
428
+ // an id or a name MoreLogin lists (it throws with status / code for an unknown, ambiguous or Firefox-type one);
429
+ // pinBrowserProfile(runId, envId, name) makes it the run's pin before its tab is acquired (server.js
430
+ // pinRunMoreLoginProfile: the pin a schedule's run is launched with). Without them a dispatch that names a
431
+ // profile is refused, never started in the default browser.
432
+ resolveBrowserProfile = null,
433
+ pinBrowserProfile = null,
427
434
  releaseSharedBrowserTab = async () => {},
428
435
  reconcileKeepAwake = () => {},
429
436
  memory = null,
@@ -919,6 +926,11 @@ export function createAssistantDispatcher({
919
926
  const usesBrowser = spec.usesBrowser === true || selection.groups.some(isBrowserGroup);
920
927
  const usesComputer = spec.usesComputer === true || spec.usesComputer === 'true';
921
928
  const tags = Array.isArray(spec.tags) ? spec.tags.map((tag) => String(tag).trim()).filter(Boolean).slice(0, 10) : [];
929
+ // The worker's own MoreLogin profile (resolved in dispatch(): withBrowserProfile) is for its browser tab.
930
+ const moreloginEnvId = spec.moreloginEnvId ? String(spec.moreloginEnvId) : null;
931
+ if (moreloginEnvId && !usesBrowser) {
932
+ throw new DispatchError('BROWSER_PROFILE_WITHOUT_BROWSER', 'morelogin_profile names the MoreLogin profile of the worker\'s browser tab: pass uses_browser: true with it, or leave it out.', { status: 400 });
933
+ }
922
934
  if ((usesBrowser || usesComputer) && capability === 'full' && !tags.includes('user-authorized-full')) {
923
935
  throw new DispatchError('QUARANTINE_VIOLATION', `${usesComputer ? 'Computer-use' : 'Browser-reading'} runs must use capability "read-only" or "workspace" unless tagged "user-authorized-full" by explicit user request.`);
924
936
  }
@@ -1033,6 +1045,7 @@ export function createAssistantDispatcher({
1033
1045
  idempotencyKey: spec.idempotencyKey || spec.idempotency_key ? String(spec.idempotencyKey || spec.idempotency_key).slice(0, 200) : null,
1034
1046
  queueIfBusy: spec.queueIfBusy !== false,
1035
1047
  requestedBrowserSessionId: spec.browserSessionId || null,
1048
+ moreloginEnvId, moreloginEnvName: moreloginEnvId && spec.moreloginEnvName ? String(spec.moreloginEnvName) : null,
1036
1049
  };
1037
1050
  }
1038
1051
 
@@ -1311,6 +1324,7 @@ export function createAssistantDispatcher({
1311
1324
  maxMinutes: spec.maxMinutes, budgetUsd: spec.budgetUsd ?? null, freeModel: spec.freeModel === true, idleTimeoutMs: spec.idleTimeoutMs, maxTurns: spec.maxTurns,
1312
1325
  outputSchema: spec.outputSchema, focus: spec.focus, workflowId: spec.workflowId, parentRunId: spec.parentRunId,
1313
1326
  idempotencyKey: spec.idempotencyKey, requestedBrowserSessionId: spec.requestedBrowserSessionId,
1327
+ moreloginEnvId: spec.moreloginEnvId || null, moreloginEnvName: spec.moreloginEnvName || null,
1314
1328
  modelInfo: spec.modelInfo || null, modelContextWindow: spec.modelContextWindow || null, pricingModel: spec.pricingModel || spec.model || null,
1315
1329
  };
1316
1330
  }
@@ -1378,6 +1392,54 @@ export function createAssistantDispatcher({
1378
1392
  * `brief`: a brief carried over from an earlier run (escalation, retry); never from a request body.
1379
1393
  * `notes`: what the caller changed in the spec (a planning brain's read-only clamp), for the run's notes.
1380
1394
  */
1395
+ /**
1396
+ * `rawSpec` with the MoreLogin profile it names resolved: `moreloginProfile` / `morelogin_profile` (an id or a name)
1397
+ * or `moreloginEnvId` become `moreloginEnvId` + `moreloginEnvName` of a Chrome-type profile MoreLogin lists. A spec
1398
+ * that names none is returned as it is. An unknown, ambiguous or Firefox-type profile is refused (the resolver's own
1399
+ * message and code), as is any profile on a server that cannot pin one.
1400
+ */
1401
+ async function withBrowserProfile(rawSpec) {
1402
+ const named = rawSpec.moreloginProfile ?? rawSpec.morelogin_profile ?? null;
1403
+ const id = rawSpec.moreloginEnvId ?? rawSpec.morelogin_env_id ?? null;
1404
+ const has = (value) => value !== null && value !== undefined && String(value).trim() !== '';
1405
+ const { moreloginProfile: _a, morelogin_profile: _b, morelogin_env_id: _c, moreloginEnvId: _d, moreloginEnvName: _e, ...rest } = rawSpec;
1406
+ if (!has(named) && !has(id)) return rest;
1407
+ if (typeof resolveBrowserProfile !== 'function' || typeof pinBrowserProfile !== 'function') {
1408
+ throw new DispatchError('BROWSER_PROFILE_UNSUPPORTED', 'This server cannot give a worker a MoreLogin profile of its own; the run was not started in the default browser instead.', { status: 400 });
1409
+ }
1410
+ let found;
1411
+ try {
1412
+ found = await resolveBrowserProfile(has(id) ? { envId: String(id).trim(), ...(has(named) ? { name: String(named).trim() } : {}) } : { profile: String(named).trim() });
1413
+ } catch (error) {
1414
+ throw new DispatchError(error?.code || 'BROWSER_PROFILE_UNAVAILABLE', `${error?.message || error} The run was not started (never in another profile or browser).`, { status: error?.status || 400 });
1415
+ }
1416
+ return { ...rest, moreloginEnvId: found.envId, moreloginEnvName: found.name || null };
1417
+ }
1418
+
1419
+ /** The run's own MoreLogin profile becomes its pin, before its browser tab is acquired (a start, a resume). */
1420
+ function pinEntryBrowserProfile(entry) {
1421
+ if (!entry?.usesBrowser || !entry.moreloginEnvId || typeof pinBrowserProfile !== 'function') return;
1422
+ pinBrowserProfile(entry.runId, entry.moreloginEnvId, entry.moreloginEnvName || null);
1423
+ }
1424
+
1425
+ /**
1426
+ * A worker chose a MoreLogin profile for itself mid-run (the morelogin tool's "use", server.js
1427
+ * chooseSessionMoreLoginProfile): its record follows, so a resume after a restart pins the same one. `profile`:
1428
+ * { envId, name }, or null for the default browser. Returns false for an unknown or browser-less run.
1429
+ */
1430
+ function noteBrowserProfile(runId, profile) {
1431
+ const entry = entries.get(runId);
1432
+ if (!entry || !entry.usesBrowser) return false;
1433
+ const envId = profile?.envId ? String(profile.envId) : null;
1434
+ if ((entry.moreloginEnvId || null) === envId) return true;
1435
+ entry.moreloginEnvId = envId;
1436
+ entry.moreloginEnvName = envId && profile?.name ? String(profile.name) : null;
1437
+ if (!Array.isArray(entry.notes)) entry.notes = [];
1438
+ entry.notes.push(`browser profile chosen by the worker: ${envId ? `MoreLogin profile ${entry.moreloginEnvName ? `"${entry.moreloginEnvName}" (${envId})` : envId}` : 'the default browser'}`);
1439
+ persist();
1440
+ return true;
1441
+ }
1442
+
1381
1443
  async function dispatch(rawSpec = {}, { assistantSessionId = null, origin = 'assistant', brief: carried = null, notes: callerNotes = null } = {}) {
1382
1444
  const sessionId = assistantSessionId ? String(assistantSessionId) : null;
1383
1445
  const idempotencyKey = rawSpec.idempotencyKey || rawSpec.idempotency_key ? String(rawSpec.idempotencyKey || rawSpec.idempotency_key).slice(0, 200) : null;
@@ -1392,6 +1454,9 @@ export function createAssistantDispatcher({
1392
1454
  refuseSessionOver(sessionId);
1393
1455
  // "true" (a string) is computer use too: normalizeSpec reads it so, and so must the gate.
1394
1456
  rawSpec = { ...rawSpec, usesComputer: rawSpec.usesComputer === true || rawSpec.usesComputer === 'true' };
1457
+ // The MoreLogin profile it names for the worker's browser tab, as MoreLogin lists it (refused here when it cannot
1458
+ // be used, before a route card or a queue slot).
1459
+ rawSpec = await withBrowserProfile(rawSpec);
1395
1460
  // A design dispatch's defaults fill what it leaves out, before any clamp; any dispatch's own browser
1396
1461
  // settings must agree before a route card is shown (normalizeSpec re-checks the final target, provider included).
1397
1462
  rawSpec = withClassDefaults(rawSpec, knownClass(rawSpec.taskClass));
@@ -1687,6 +1752,7 @@ export function createAssistantDispatcher({
1687
1752
  tools: entry.tools?.some(item => item.startsWith('mcp:')) ? retainExternalRefs(entry.toolsRequested ?? dispatchTools({}).items, entry.tools) : entry.toolsRequested ?? undefined, capability: entry.capability,
1688
1753
  permissionPolicy: entry.permissionPolicy,
1689
1754
  usesBrowser: entry.usesBrowser, usesComputer: entry.usesComputer, maxMinutes: entry.maxMinutes, budgetUsd: entry.budgetUsd,
1755
+ ...(entry.moreloginEnvId ? { moreloginEnvId: entry.moreloginEnvId, moreloginEnvName: entry.moreloginEnvName || null } : {}),
1690
1756
  outputSchema: entry.outputSchema, taskClass: entry.taskClass || null,
1691
1757
  }, { assistantSessionId: entry.assistantSessionId, origin: 'ui', brief: entry.brief || null });
1692
1758
  const child = entries.get(result?.run?.runId);
@@ -1865,6 +1931,7 @@ export function createAssistantDispatcher({
1865
1931
  let browserSessionId = null;
1866
1932
  let browserTabId = null;
1867
1933
  if (entry.usesBrowser && typeof acquireLoopBrowserAndTab === 'function') {
1934
+ pinEntryBrowserProfile(entry);
1868
1935
  const acq = await acquireLoopBrowserAndTab({ requestedBrowserSessionId: entry.requestedBrowserSessionId, terminalSessionId: entry.runId, logTag: 'assistant:browser' });
1869
1936
  if (acq?.error) {
1870
1937
  entry.state = 'failed'; entry.completionReason = 'browser_unavailable'; entry.finishedAt = iso(now()); entry.notes.push(acq.error);
@@ -1957,6 +2024,8 @@ export function createAssistantDispatcher({
1957
2024
  active: true, task: entry.task, context: entry.context, totalIterations: 1, currentIteration: 0,
1958
2025
  maxMinutes: entry.maxMinutes, startedAt, lastIterationAt: null, retries: 0, pending: false,
1959
2026
  terminalSessionId: entry.runId, usesBrowser: entry.usesBrowser, usesComputer: !!entry.usesComputer, browserSessionId, browserTabId,
2027
+ // The run's own MoreLogin profile (server.js runMoreLoginPin reads it back from the state file).
2028
+ ...(entry.usesBrowser && entry.moreloginEnvId ? { moreloginEnvId: entry.moreloginEnvId, moreloginEnvName: entry.moreloginEnvName || null } : {}),
1960
2029
  profile: entry.provider, provider: entry.provider, agent: entry.agent || null,
1961
2030
  model: entry.model, modelContextWindow: entry.modelContextWindow || null, effort: entry.effort, tools: entry.tools,
1962
2031
  codexAccountId: entry.codexAccountId, codexHome: entry.provider === 'codex' ? (entryCodexHome(entry)) : null,
@@ -3357,6 +3426,7 @@ export function createAssistantDispatcher({
3357
3426
  let browserSessionId = null;
3358
3427
  let browserTabId = null;
3359
3428
  if (entry.usesBrowser && typeof acquireLoopBrowserAndTab === 'function') {
3429
+ pinEntryBrowserProfile(entry);
3360
3430
  const acq = await acquireLoopBrowserAndTab({ requestedBrowserSessionId: entry.requestedBrowserSessionId, terminalSessionId: entry.runId, logTag: 'assistant:browser' }).catch((error) => ({ error: error?.message || String(error) }));
3361
3431
  if (acq?.error) return notResumed(entry, `no browser tab: ${acq.error}`);
3362
3432
  browserSessionId = acq.browserSessionId || null;
@@ -3996,7 +4066,7 @@ export function createAssistantDispatcher({
3996
4066
  respondPermission, subscribe, shutdown, limits, suspendForShutdown,
3997
4067
  sessionBudget, checkSession, refreshLimits, providerSpend, coverFollowUp, budget,
3998
4068
  resolveRoute, declineRoute, heldRouteRefusal, escalate,
3999
- markDelivered, deliveryState, noteBrowserRoute,
4069
+ markDelivered, deliveryState, noteBrowserRoute, noteBrowserProfile,
4000
4070
  remove, removeFinished,
4001
4071
  mediaFile,
4002
4072
  accountInUse: (provider, accountId) => activeEntries((e) => e.provider === provider && e.accountId === accountId).length > 0,
@@ -11,7 +11,7 @@ import { workerToolsLine } from './assistant-tools.js';
11
11
  // Route-mode changes after the brain started arrive as `[SynaBun Router]` lines,
12
12
  // budget changes as `[SynaBun Budget]` lines.
13
13
 
14
- import { formatModelLine } from './assistant-catalog.js';
14
+ import { formatModelLine, isMaritacaOpenCodeId } from './assistant-catalog.js';
15
15
  import { hasRouteAccounts, routeAccountText } from './assistant-route-accounts.js';
16
16
  import { browserPolicyText } from './browser-tool-policy.js';
17
17
  import { TESTS_HEADER, reportsUntested, testDensityPersonaLine } from './assistant-test-density.js';
@@ -101,11 +101,18 @@ function sheetLines(sheet, { opencodeTotal = null } = {}) {
101
101
  const lines = [];
102
102
  const labels = { 'claude-code': 'claude-code', codex: 'codex (ChatGPT plan billing)', opencode: 'opencode (providerID/modelID)', antigravity: 'antigravity (Google sign-in; unpriced: tokens, not prices)' };
103
103
  for (const provider of ['claude-code', 'codex', 'opencode', 'antigravity']) {
104
- const rows = sheet[provider] || [];
105
- if (!rows.length) continue;
106
- const suffix = provider === 'opencode' && opencodeTotal ? `, ${opencodeTotal} connected models — agent_catalog provider "opencode" search "…" lists more` : '';
107
- lines.push(` - ${labels[provider]}${suffix}:`);
108
- for (const row of rows) lines.push(` - ${formatModelLine(row)}`);
104
+ // Maritaca's OpenCode rows get a provider line of their own, after OpenCode's.
105
+ const rows = (sheet[provider] || []).filter((row) => provider !== 'opencode' || !isMaritacaOpenCodeId(row?.id));
106
+ if (rows.length) {
107
+ const suffix = provider === 'opencode' && opencodeTotal ? `, ${opencodeTotal} connected models — agent_catalog provider "opencode" search "…" lists more` : '';
108
+ lines.push(` - ${labels[provider]}${suffix}:`);
109
+ for (const row of rows) lines.push(` - ${formatModelLine(row)}`);
110
+ }
111
+ if (provider !== 'opencode') continue;
112
+ const maritaca = (sheet.opencode || []).filter((row) => isMaritacaOpenCodeId(row?.id));
113
+ if (!maritaca.length) continue;
114
+ lines.push(' - maritaca (Sabiá models; they run through OpenCode: provider "opencode", model "maritaca/<id>"):');
115
+ for (const row of maritaca) lines.push(` - ${formatModelLine(row)}`);
109
116
  }
110
117
  return lines;
111
118
  }
@@ -418,7 +425,7 @@ export function buildAssistantPersona({
418
425
  '3. Project: pick the registered project whose path contains the files in question; if the user names one, use it; if truly ambiguous, ask.',
419
426
  '4. Accounts: account_id \"auto\" chooses the signed-in subscription with most usage left (API keys excluded); agent_catalog includes each account’s usage. Limited pinned/default accounts fall back within the provider, with corrections; all limited selects the soonest reset. A direct route needing another account runs on a worker because conversation histories belong to their account. An approved route’s concrete account stays binding unless it becomes limited before dispatch. An approved route’s account is binding and overrides dispatch account_id. Without an applied saved route, a Claude Code worker runs under the account_id you name, else the user\'s Claude worker account (agent_catalog `claudeWorkerAccount`; null = Default); a Codex worker the same way with `codexWorkerAccount`. Each account uses its own mode (its Claude or ChatGPT subscription, or its API key). Never name a signed-out account: dispatch refuses it with ACCOUNT_SIGNED_OUT; tell the user to sign it in instead. Codex cannot run with permission_policy "ask"; use "restricted" for a sandbox.',
420
427
  '5. Browser/social growth work: capability read-only or workspace (never full), the platform group in tools (for example browser_facebook), fully autonomous with rails; never spend money. Long periodic work: create a loop or schedule instead of chaining follow-ups.',
421
- '6. Pages: a worker that must look at any page, public or localhost (visual QA included), gets uses_browser:true with capability workspace or read-only; SynaBun adds the browser group and its own tab. Never tell a worker to use Playwright, Chrome or another browser. A worker that finishes blocked with "needs the SynaBun browser" is dispatched again with uses_browser:true, not escalated.',
428
+ '6. Pages: a worker that must look at any page, public or localhost (visual QA included), gets uses_browser:true with capability workspace or read-only; SynaBun adds the browser group and its own tab. Never tell a worker to use Playwright, Chrome or another browser. A worker that finishes blocked with "needs the SynaBun browser" is dispatched again with uses_browser:true, not escalated. A task for a MoreLogin profile other than the default (a second account, "in P-4") gets morelogin_profile with that profile\'s name or id: the worker\'s tab opens there, next to runs in the default or other profiles. Only a profile the owner allowed agents to choose works (the morelogin tool\'s "list" says which; none until the owner switches one on): on MORELOGIN_PROFILE_NOT_ALLOWED tell the user to switch that profile on in Settings → Connected tools → MoreLogin → MoreLogin profiles, and do not dispatch the task into another profile. Never change the default AI browser for one task.',
422
429
  'A worker that finishes blocked with "needs SynaBun tools: <ids>" is dispatched again with those ids added to tools, not escalated.',
423
430
  '7. Computer work for a worker: uses_computer:true on a vision-capable model; one at a time.',
424
431
  '8. Title every dispatch in ≤ 6 words; put everything the worker needs in task + context.',
@@ -34,7 +34,7 @@
34
34
  import { randomBytes } from 'node:crypto';
35
35
  import { CATALOG_PROVIDERS, TIERS, defaultIsHidden, defaultModelRow, findModel, hiddenModelId, priceText, providerAllHidden, providerEmpty, rowIsHidden, rowMakes } from './assistant-catalog.js';
36
36
  import { effectiveRouting, normalizeRouteMode } from './assistant-config.js';
37
- import { normalizeEffort } from './effort-levels.js';
37
+ import { EFFORT_OFF, normalizeEffort } from './effort-levels.js';
38
38
  import { hasRouteAccounts, routeAccountText } from './assistant-route-accounts.js';
39
39
  import { chooseUsageAccount } from './account-usage.js';
40
40
  import { PROVIDER_LABELS, coversWork, dryProviders, isFreePrice, isUnpricedProvider, listPriceOf, rowOf } from './assistant-budget-split.js';
@@ -302,8 +302,10 @@ function preferenceTarget(pref, brain, catalog = null, { dispatchOnly = false }
302
302
  export function routeText(target) {
303
303
  if (!target) return 'none';
304
304
  const where = target.kind === 'direct' ? `here${target.model ? ` on ${target.model}` : ''}` : `${target.provider}/${target.model || 'default'}`;
305
- return `${where}${target.effort ? ` (${target.effort})` : ''}`;
305
+ return `${where}${target.effort ? ` (${effortWord(target.effort)})` : ''}`;
306
306
  }
307
+ /** An effort as people read it: `none` is thinking off. */
308
+ export function effortWord(effort) { return String(effort || '').toLowerCase() === EFFORT_OFF ? 'thinking off' : String(effort || ''); }
307
309
 
308
310
  /** Cheapest vision-capable model, same provider first. */
309
311
  function visionFallback(catalog, provider, { brain = {}, routing = {} } = {}) {
@@ -673,7 +675,7 @@ function optionFor(id, rawTarget, badge, { catalog, brain, brainInfo, needsVisio
673
675
  const target = effortChecked(rawTarget, catalog);
674
676
  const d = describeTarget(target, { catalog, brain, brainInfo });
675
677
  const here = target.kind === 'direct';
676
- const label = here ? `Do it here with ${d.label}` : `${providerLabel(target.provider)} · ${d.label}${target.effort ? ` · ${target.effort}` : ''}`;
678
+ const label = here ? `Do it here with ${d.label}` : `${providerLabel(target.provider)} · ${d.label}${target.effort ? ` · ${effortWord(target.effort)}` : ''}`;
677
679
  // Design: only a confirmed vision: true on an available row; other vision work: a confirmed false is disabled, unknown is a warning.
678
680
  const fit = visionOnly ? designFit(catalog, target, { brain, brainInfo }) : 'ok';
679
681
  const option = {
@@ -1327,7 +1329,7 @@ export function createAssistantRouter({
1327
1329
  // on another account: the card names it as a worker and says why, never "Do it here".
1328
1330
  if (option.kind === 'dispatch' && option.accountKind === 'direct') {
1329
1331
  const described = describeTarget(option, { catalog: cat, brain, brainInfo });
1330
- option.label = `${providerLabel(option.provider)} · ${described?.label || option.model || 'default'}${option.effort ? ` · ${option.effort}` : ''}`;
1332
+ option.label = `${providerLabel(option.provider)} · ${described?.label || option.model || 'default'}${option.effort ? ` · ${effortWord(option.effort)}` : ''}`;
1331
1333
  option.warning = option.accountCorrection?.message || WORKER_FOR_ACCOUNT_TEXT;
1332
1334
  }
1333
1335
  }
@@ -2972,6 +2972,9 @@ export function createAssistantRuntime({
2972
2972
  const input = { ...base, ...patch.brain, model: patch.brain.model || base.model };
2973
2973
  if (patch.brain.mcpProfile !== undefined) throw Object.assign(new Error('Use tools: [group ids].'), { code: 'MCP_PROFILE_REMOVED', status: 400 });
2974
2974
  let next = normalizeSessionBrain(input, base, { catalog: catalog?.peek?.() || null });
2975
+ // An effort the panel cleared (its Auto row: `effort: null`) is the model's default. normalizeBrain
2976
+ // would fall back to the one before it, and Off (`none`, no thinking) or a level would stay on.
2977
+ if (Object.hasOwn(patch.brain, 'effort') && (patch.brain.effort === null || patch.brain.effort === '')) next = { ...next, effort: null };
2975
2978
  next = await resolveAutoAccount(next);
2976
2979
  const modelChanged = next.model !== live.record.brain.model || next.provider !== live.record.brain.provider;
2977
2980
  if (modelChanged) next = (await enabledBrain(next)).brain;
@@ -74,6 +74,11 @@ export function browserEnforcementBlock(state = {}) {
74
74
  'This automation REQUIRES the SynaBun internal browser.',
75
75
  state.browserSessionId ? `YOUR BROWSER SESSION: ${state.browserSessionId}` : '',
76
76
  state.browserTabId ? `YOUR BROWSER TAB: ${state.browserTabId}` : '',
77
+ // A run started in a MoreLogin profile of its own (a schedule's, a dispatch's morelogin_profile): said, so the
78
+ // worker neither looks for the account in the default profile nor tries to switch to where it already is.
79
+ state.moreloginEnvId
80
+ ? `YOUR BROWSER PROFILE: MoreLogin profile ${state.moreloginEnvName ? `"${state.moreloginEnvName}" (${state.moreloginEnvId})` : state.moreloginEnvId}. This run was started in it: your browser tools already work there, not in the default profile. Stay in it unless the task names another one. If a browser call is refused because this profile is not on the owner's list of profiles agents may choose, the owner took it off: stop and report that; never continue in another profile.`
81
+ : '',
77
82
  state.browserSessionId
78
83
  ? `Pass sessionId: "${state.browserSessionId}"${state.browserTabId ? ` and tabId: "${state.browserTabId}"` : ''} to EVERY browser tool call. Omitting them can hijack another run's browser.`
79
84
  : '',