synabun 2.2.1 → 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 (365) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +1 -1
  3. package/docs/whatsapp.md +52 -20
  4. package/hooks/claude-code/pre-websearch.mjs +4 -1
  5. package/hooks/claude-code/prompt-submit.mjs +7 -0
  6. package/lib/mcp-build.js +519 -0
  7. package/lib/mcp-dist.js +10 -4
  8. package/lib/release-scan.mjs +23 -10
  9. package/lib/server-supervisor.js +7 -1
  10. package/lib/virustotal.mjs +146 -40
  11. package/mcp-server/dist/http.d.ts +57 -0
  12. package/mcp-server/dist/http.d.ts.map +1 -1
  13. package/mcp-server/dist/http.js +128 -18
  14. package/mcp-server/dist/http.js.map +1 -1
  15. package/mcp-server/dist/index.d.ts.map +1 -1
  16. package/mcp-server/dist/index.js +14 -9
  17. package/mcp-server/dist/index.js.map +1 -1
  18. package/mcp-server/dist/services/browser-route-flow.d.ts +119 -0
  19. package/mcp-server/dist/services/browser-route-flow.d.ts.map +1 -0
  20. package/mcp-server/dist/services/browser-route-flow.js +340 -0
  21. package/mcp-server/dist/services/browser-route-flow.js.map +1 -0
  22. package/mcp-server/dist/services/desktop-client.js +2 -2
  23. package/mcp-server/dist/services/desktop-client.js.map +1 -1
  24. package/mcp-server/dist/services/embedding-service.d.ts.map +1 -1
  25. package/mcp-server/dist/services/embedding-service.js +2 -1
  26. package/mcp-server/dist/services/embedding-service.js.map +1 -1
  27. package/mcp-server/dist/services/identity.d.ts +66 -3
  28. package/mcp-server/dist/services/identity.d.ts.map +1 -1
  29. package/mcp-server/dist/services/identity.js +61 -4
  30. package/mcp-server/dist/services/identity.js.map +1 -1
  31. package/mcp-server/dist/services/neural-interface.d.ts +133 -1
  32. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  33. package/mcp-server/dist/services/neural-interface.js +630 -64
  34. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  35. package/mcp-server/dist/services/tool-catalog.js +2 -2
  36. package/mcp-server/dist/services/tool-catalog.js.map +1 -1
  37. package/mcp-server/dist/tools/agents.d.ts +3 -2
  38. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  39. package/mcp-server/dist/tools/agents.js +6 -4
  40. package/mcp-server/dist/tools/agents.js.map +1 -1
  41. package/mcp-server/dist/tools/bluesky.d.ts +20 -7
  42. package/mcp-server/dist/tools/bluesky.d.ts.map +1 -1
  43. package/mcp-server/dist/tools/bluesky.js +147 -45
  44. package/mcp-server/dist/tools/bluesky.js.map +1 -1
  45. package/mcp-server/dist/tools/browser-advanced.d.ts +13 -2
  46. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  47. package/mcp-server/dist/tools/browser-advanced.js +153 -18
  48. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  49. package/mcp-server/dist/tools/browser-cheatsheet.d.ts +2 -0
  50. package/mcp-server/dist/tools/browser-cheatsheet.d.ts.map +1 -1
  51. package/mcp-server/dist/tools/browser-cheatsheet.js +3 -0
  52. package/mcp-server/dist/tools/browser-cheatsheet.js.map +1 -1
  53. package/mcp-server/dist/tools/browser-navigate.d.ts +3 -3
  54. package/mcp-server/dist/tools/browser-navigate.d.ts.map +1 -1
  55. package/mcp-server/dist/tools/browser-navigate.js +19 -16
  56. package/mcp-server/dist/tools/browser-navigate.js.map +1 -1
  57. package/mcp-server/dist/tools/browser-observe.d.ts +2 -1
  58. package/mcp-server/dist/tools/browser-observe.d.ts.map +1 -1
  59. package/mcp-server/dist/tools/browser-observe.js +61 -20
  60. package/mcp-server/dist/tools/browser-observe.js.map +1 -1
  61. package/mcp-server/dist/tools/morelogin.d.ts +13 -3
  62. package/mcp-server/dist/tools/morelogin.d.ts.map +1 -1
  63. package/mcp-server/dist/tools/morelogin.js +82 -19
  64. package/mcp-server/dist/tools/morelogin.js.map +1 -1
  65. package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
  66. package/mcp-server/dist/tools/youtube/helpers.d.ts +1 -0
  67. package/mcp-server/dist/tools/youtube/helpers.d.ts.map +1 -1
  68. package/mcp-server/dist/tools/youtube/helpers.js +1 -1
  69. package/mcp-server/dist/tools/youtube/helpers.js.map +1 -1
  70. package/mcp-server/dist/tools/youtube/upload.d.ts.map +1 -1
  71. package/mcp-server/dist/tools/youtube/upload.js +225 -88
  72. package/mcp-server/dist/tools/youtube/upload.js.map +1 -1
  73. package/mcp-server/package-lock.json +2 -2
  74. package/mcp-server/package.json +1 -1
  75. package/mcp-server/src/http.ts +135 -17
  76. package/mcp-server/src/index.ts +15 -9
  77. package/mcp-server/src/services/browser-route-flow.ts +403 -0
  78. package/mcp-server/src/services/desktop-client.ts +2 -2
  79. package/mcp-server/src/services/embedding-service.ts +2 -1
  80. package/mcp-server/src/services/identity.ts +80 -4
  81. package/mcp-server/src/services/neural-interface.ts +648 -73
  82. package/mcp-server/src/services/tool-catalog.ts +2 -2
  83. package/mcp-server/src/tools/agents.ts +8 -4
  84. package/mcp-server/src/tools/bluesky.ts +164 -51
  85. package/mcp-server/src/tools/browser-advanced.ts +142 -17
  86. package/mcp-server/src/tools/browser-cheatsheet.ts +3 -0
  87. package/mcp-server/src/tools/browser-navigate.ts +19 -16
  88. package/mcp-server/src/tools/browser-observe.ts +62 -20
  89. package/mcp-server/src/tools/morelogin.ts +82 -19
  90. package/mcp-server/src/tools/youtube/helpers.ts +2 -2
  91. package/mcp-server/src/tools/youtube/upload.ts +218 -99
  92. package/neural-interface/i18n/en.json +655 -123
  93. package/neural-interface/i18n/pt-BR.json +542 -10
  94. package/neural-interface/lib/assistant-api.js +90 -23
  95. package/neural-interface/lib/assistant-brains/claude.js +5 -0
  96. package/neural-interface/lib/assistant-catalog.js +134 -3
  97. package/neural-interface/lib/assistant-dispatch.js +97 -1
  98. package/neural-interface/lib/assistant-persona.js +15 -7
  99. package/neural-interface/lib/assistant-router.js +6 -4
  100. package/neural-interface/lib/assistant-runtime.js +18 -1
  101. package/neural-interface/lib/assistant-task-prompt.js +5 -0
  102. package/neural-interface/lib/assistant-tools.js +10 -1
  103. package/neural-interface/lib/automation-approval.js +249 -0
  104. package/neural-interface/lib/automation-browser-owner-access.js +82 -0
  105. package/neural-interface/lib/backup-service.js +16 -1
  106. package/neural-interface/lib/browser-automation-routes.js +84 -0
  107. package/neural-interface/lib/browser-background-tab.js +72 -3
  108. package/neural-interface/lib/browser-execution.js +16 -3
  109. package/neural-interface/lib/browser-extraction.js +106 -45
  110. package/neural-interface/lib/browser-owner.js +48 -0
  111. package/neural-interface/lib/browser-profile-choices.js +143 -0
  112. package/neural-interface/lib/browser-profiles.js +142 -0
  113. package/neural-interface/lib/browser-session-close.js +84 -0
  114. package/neural-interface/lib/browser-start-handoff.js +202 -0
  115. package/neural-interface/lib/browser-tab-recovery.js +153 -0
  116. package/neural-interface/lib/browser-tool-policy.js +23 -4
  117. package/neural-interface/lib/browser-wedge-retire.js +64 -0
  118. package/neural-interface/lib/chromium-on-device-model.js +67 -0
  119. package/neural-interface/lib/claude-agent-bridge.js +43 -5
  120. package/neural-interface/lib/claude-background-hold.js +239 -0
  121. package/neural-interface/lib/claude-model-catalog.js +12 -0
  122. package/neural-interface/lib/effort-levels.js +28 -2
  123. package/neural-interface/lib/exec-loop-command.js +8 -0
  124. package/neural-interface/lib/http-guards.js +11 -6
  125. package/neural-interface/lib/local-profile-proxy.js +362 -0
  126. package/neural-interface/lib/local-profiles.js +929 -0
  127. package/neural-interface/lib/loop-logger.js +31 -5
  128. package/neural-interface/lib/maritaca/api.js +179 -0
  129. package/neural-interface/lib/maritaca/attachments.js +44 -0
  130. package/neural-interface/lib/maritaca/client.js +362 -0
  131. package/neural-interface/lib/maritaca/key-store.js +122 -0
  132. package/neural-interface/lib/maritaca/models.js +181 -0
  133. package/neural-interface/lib/maritaca/modes.js +39 -0
  134. package/neural-interface/lib/maritaca/opencode-proxy.js +236 -0
  135. package/neural-interface/lib/maritaca/opencode-stream.js +345 -0
  136. package/neural-interface/lib/maritaca/opencode.js +218 -0
  137. package/neural-interface/lib/maritaca/panel-bridge.js +273 -0
  138. package/neural-interface/lib/maritaca/sessions.js +198 -0
  139. package/neural-interface/lib/mcp-external-servers.js +37 -10
  140. package/neural-interface/lib/morelogin-agent-profiles.js +149 -0
  141. package/neural-interface/lib/morelogin.js +278 -14
  142. package/neural-interface/lib/native-loop-providers.js +124 -11
  143. package/neural-interface/lib/native-loop-runtime.js +112 -11
  144. package/neural-interface/lib/owner-authority.js +137 -43
  145. package/neural-interface/lib/page-session.js +111 -27
  146. package/neural-interface/lib/peer-identity.js +263 -43
  147. package/neural-interface/lib/provider-panel-api-key-auth.js +7 -2
  148. package/neural-interface/lib/pty-host/core.js +36 -0
  149. package/neural-interface/lib/pty-host/protocol.js +2 -0
  150. package/neural-interface/lib/request-gate.js +2 -0
  151. package/neural-interface/lib/skills/api-v2.js +13 -2
  152. package/neural-interface/lib/skills/creation-api.js +3 -1
  153. package/neural-interface/lib/skills/evals-api.js +5 -1
  154. package/neural-interface/lib/social-write-pacing.js +151 -0
  155. package/neural-interface/lib/system-activity.js +1 -1
  156. package/neural-interface/lib/terminal-token-redaction.js +293 -0
  157. package/neural-interface/lib/terminal-tokens.js +436 -0
  158. package/neural-interface/lib/worker-mcp-channel.js +45 -10
  159. package/neural-interface/package-lock.json +3 -2
  160. package/neural-interface/package.json +2 -1
  161. package/neural-interface/public/assets/mascot/README.md +11 -0
  162. package/neural-interface/public/assets/mascot/ask.gif +0 -0
  163. package/neural-interface/public/assets/mascot/ask.png +0 -0
  164. package/neural-interface/public/assets/mascot/blocked.gif +0 -0
  165. package/neural-interface/public/assets/mascot/blocked.png +0 -0
  166. package/neural-interface/public/assets/mascot/budget.gif +0 -0
  167. package/neural-interface/public/assets/mascot/budget.png +0 -0
  168. package/neural-interface/public/assets/mascot/computer.gif +0 -0
  169. package/neural-interface/public/assets/mascot/computer.png +0 -0
  170. package/neural-interface/public/assets/mascot/edit.gif +0 -0
  171. package/neural-interface/public/assets/mascot/edit.png +0 -0
  172. package/neural-interface/public/assets/mascot/error.gif +0 -0
  173. package/neural-interface/public/assets/mascot/error.png +0 -0
  174. package/neural-interface/public/assets/mascot/hover-attention.gif +0 -0
  175. package/neural-interface/public/assets/mascot/hover-attention.png +0 -0
  176. package/neural-interface/public/assets/mascot/idle-hero.gif +0 -0
  177. package/neural-interface/public/assets/mascot/idle-hero.png +0 -0
  178. package/neural-interface/public/assets/mascot/idle.gif +0 -0
  179. package/neural-interface/public/assets/mascot/idle.png +0 -0
  180. package/neural-interface/public/assets/mascot/manifest.json +254 -0
  181. package/neural-interface/public/assets/mascot/mcp.gif +0 -0
  182. package/neural-interface/public/assets/mascot/mcp.png +0 -0
  183. package/neural-interface/public/assets/mascot/memory.gif +0 -0
  184. package/neural-interface/public/assets/mascot/memory.png +0 -0
  185. package/neural-interface/public/assets/mascot/offline.gif +0 -0
  186. package/neural-interface/public/assets/mascot/offline.png +0 -0
  187. package/neural-interface/public/assets/mascot/pick.gif +0 -0
  188. package/neural-interface/public/assets/mascot/pick.png +0 -0
  189. package/neural-interface/public/assets/mascot/plan.gif +0 -0
  190. package/neural-interface/public/assets/mascot/plan.png +0 -0
  191. package/neural-interface/public/assets/mascot/present.gif +0 -0
  192. package/neural-interface/public/assets/mascot/present.png +0 -0
  193. package/neural-interface/public/assets/mascot/project.gif +0 -0
  194. package/neural-interface/public/assets/mascot/project.png +0 -0
  195. package/neural-interface/public/assets/mascot/read.gif +0 -0
  196. package/neural-interface/public/assets/mascot/read.png +0 -0
  197. package/neural-interface/public/assets/mascot/runs.gif +0 -0
  198. package/neural-interface/public/assets/mascot/runs.png +0 -0
  199. package/neural-interface/public/assets/mascot/scenes/automation.gif +0 -0
  200. package/neural-interface/public/assets/mascot/scenes/automation.png +0 -0
  201. package/neural-interface/public/assets/mascot/scenes/browser.gif +0 -0
  202. package/neural-interface/public/assets/mascot/scenes/browser.png +0 -0
  203. package/neural-interface/public/assets/mascot/scenes/code.gif +0 -0
  204. package/neural-interface/public/assets/mascot/scenes/code.png +0 -0
  205. package/neural-interface/public/assets/mascot/scenes/complex.gif +0 -0
  206. package/neural-interface/public/assets/mascot/scenes/complex.png +0 -0
  207. package/neural-interface/public/assets/mascot/scenes/computer.gif +0 -0
  208. package/neural-interface/public/assets/mascot/scenes/computer.png +0 -0
  209. package/neural-interface/public/assets/mascot/scenes/design.gif +0 -0
  210. package/neural-interface/public/assets/mascot/scenes/design.png +0 -0
  211. package/neural-interface/public/assets/mascot/scenes/edit.gif +0 -0
  212. package/neural-interface/public/assets/mascot/scenes/edit.png +0 -0
  213. package/neural-interface/public/assets/mascot/scenes/generic.gif +0 -0
  214. package/neural-interface/public/assets/mascot/scenes/generic.png +0 -0
  215. package/neural-interface/public/assets/mascot/scenes/image_gen.gif +0 -0
  216. package/neural-interface/public/assets/mascot/scenes/image_gen.png +0 -0
  217. package/neural-interface/public/assets/mascot/scenes/manifest.json +173 -0
  218. package/neural-interface/public/assets/mascot/scenes/memory.gif +0 -0
  219. package/neural-interface/public/assets/mascot/scenes/memory.png +0 -0
  220. package/neural-interface/public/assets/mascot/scenes/quick.gif +0 -0
  221. package/neural-interface/public/assets/mascot/scenes/quick.png +0 -0
  222. package/neural-interface/public/assets/mascot/scenes/read.gif +0 -0
  223. package/neural-interface/public/assets/mascot/scenes/read.png +0 -0
  224. package/neural-interface/public/assets/mascot/scenes/research.gif +0 -0
  225. package/neural-interface/public/assets/mascot/scenes/research.png +0 -0
  226. package/neural-interface/public/assets/mascot/scenes/review.gif +0 -0
  227. package/neural-interface/public/assets/mascot/scenes/review.png +0 -0
  228. package/neural-interface/public/assets/mascot/scenes/search.gif +0 -0
  229. package/neural-interface/public/assets/mascot/scenes/search.png +0 -0
  230. package/neural-interface/public/assets/mascot/scenes/shell.gif +0 -0
  231. package/neural-interface/public/assets/mascot/scenes/shell.png +0 -0
  232. package/neural-interface/public/assets/mascot/scenes/thinking.gif +0 -0
  233. package/neural-interface/public/assets/mascot/scenes/thinking.png +0 -0
  234. package/neural-interface/public/assets/mascot/scenes/video_gen.gif +0 -0
  235. package/neural-interface/public/assets/mascot/scenes/video_gen.png +0 -0
  236. package/neural-interface/public/assets/mascot/scenes/web.gif +0 -0
  237. package/neural-interface/public/assets/mascot/scenes/web.png +0 -0
  238. package/neural-interface/public/assets/mascot/search.gif +0 -0
  239. package/neural-interface/public/assets/mascot/search.png +0 -0
  240. package/neural-interface/public/assets/mascot/shell.gif +0 -0
  241. package/neural-interface/public/assets/mascot/shell.png +0 -0
  242. package/neural-interface/public/assets/mascot/skill.gif +0 -0
  243. package/neural-interface/public/assets/mascot/skill.png +0 -0
  244. package/neural-interface/public/assets/mascot/sleep.gif +0 -0
  245. package/neural-interface/public/assets/mascot/sleep.png +0 -0
  246. package/neural-interface/public/assets/mascot/subagent.gif +0 -0
  247. package/neural-interface/public/assets/mascot/subagent.png +0 -0
  248. package/neural-interface/public/assets/mascot/success.gif +0 -0
  249. package/neural-interface/public/assets/mascot/success.png +0 -0
  250. package/neural-interface/public/assets/mascot/think.gif +0 -0
  251. package/neural-interface/public/assets/mascot/think.png +0 -0
  252. package/neural-interface/public/assets/mascot/wait.gif +0 -0
  253. package/neural-interface/public/assets/mascot/wait.png +0 -0
  254. package/neural-interface/public/assets/mascot/watch.gif +0 -0
  255. package/neural-interface/public/assets/mascot/watch.png +0 -0
  256. package/neural-interface/public/assets/mascot/web.gif +0 -0
  257. package/neural-interface/public/assets/mascot/web.png +0 -0
  258. package/neural-interface/public/onboarding.html +14 -1
  259. package/neural-interface/public/shared/agent-runtime-options.js +49 -8
  260. package/neural-interface/public/shared/agy/agy-panel.js +2 -2
  261. package/neural-interface/public/shared/agy/agy-render.js +41 -1
  262. package/neural-interface/public/shared/agy/agy-styles.js +5 -0
  263. package/neural-interface/public/shared/api.js +5 -4
  264. package/neural-interface/public/shared/assistant/asst-ask-styles.js +8 -8
  265. package/neural-interface/public/shared/assistant/asst-ask.js +1 -1
  266. package/neural-interface/public/shared/assistant/asst-brain-picker.js +99 -9
  267. package/neural-interface/public/shared/assistant/asst-computer.js +47 -2
  268. package/neural-interface/public/shared/assistant/asst-control.js +1 -1
  269. package/neural-interface/public/shared/assistant/asst-limit-wait.js +7 -5
  270. package/neural-interface/public/shared/assistant/asst-panel.js +13 -5
  271. package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -4
  272. package/neural-interface/public/shared/assistant/asst-render.js +16 -10
  273. package/neural-interface/public/shared/assistant/asst-route-models.js +64 -4
  274. package/neural-interface/public/shared/assistant/asst-route.js +24 -7
  275. package/neural-interface/public/shared/assistant/asst-routes-editor.js +154 -39
  276. package/neural-interface/public/shared/assistant/asst-run-stage.js +3 -3
  277. package/neural-interface/public/shared/assistant/asst-scene-styles.js +8 -111
  278. package/neural-interface/public/shared/assistant/asst-scenes.js +46 -318
  279. package/neural-interface/public/shared/assistant/asst-sidepanel.js +2 -2
  280. package/neural-interface/public/shared/assistant/asst-state.js +72 -2
  281. package/neural-interface/public/shared/assistant/asst-styles.js +60 -15
  282. package/neural-interface/public/shared/automation-approval-view.js +75 -0
  283. package/neural-interface/public/shared/cdx/cdx-panel.js +2 -2
  284. package/neural-interface/public/shared/cdx/cdx-render.js +73 -7
  285. package/neural-interface/public/shared/cdx/cdx-tabs.js +3 -3
  286. package/neural-interface/public/shared/context-menu-model.js +2 -0
  287. package/neural-interface/public/shared/cp/cp-agents.js +8 -0
  288. package/neural-interface/public/shared/cp/cp-permissions.js +6 -2
  289. package/neural-interface/public/shared/cp/cp-rehydrate.js +25 -1
  290. package/neural-interface/public/shared/cp/cp-tasks-model.js +33 -0
  291. package/neural-interface/public/shared/editor/editor-panel-logic.js +10 -0
  292. package/neural-interface/public/shared/editor/editor-panel.js +10 -2
  293. package/neural-interface/public/shared/html-shell.js +30 -22
  294. package/neural-interface/public/shared/judgments-log-origins.js +29 -0
  295. package/neural-interface/public/shared/morelogin-profile-choices.js +107 -0
  296. package/neural-interface/public/shared/morelogin-profile-field.js +186 -0
  297. package/neural-interface/public/shared/mtc/mtc-client.js +181 -0
  298. package/neural-interface/public/shared/mtc/mtc-compose.js +40 -0
  299. package/neural-interface/public/shared/mtc/mtc-copy.js +253 -0
  300. package/neural-interface/public/shared/mtc/mtc-logic.js +478 -0
  301. package/neural-interface/public/shared/mtc/mtc-panel.js +1354 -0
  302. package/neural-interface/public/shared/mtc/mtc-render.js +172 -0
  303. package/neural-interface/public/shared/mtc/mtc-styles.js +437 -0
  304. package/neural-interface/public/shared/ocp-v2/ocp-v2-automation-ownership.js +23 -0
  305. package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +13 -0
  306. package/neural-interface/public/shared/ocp-v2/ocp-v2-icons.js +3 -1
  307. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +10 -4
  308. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +6 -86
  309. package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +5 -2
  310. package/neural-interface/public/shared/owner-access.js +134 -0
  311. package/neural-interface/public/shared/owner-authority-view.js +92 -0
  312. package/neural-interface/public/shared/page-session.js +143 -14
  313. package/neural-interface/public/shared/poll-backoff.js +59 -0
  314. package/neural-interface/public/shared/provider-icons.js +3 -0
  315. package/neural-interface/public/shared/schedules-view.js +7 -0
  316. package/neural-interface/public/shared/server-back.js +50 -0
  317. package/neural-interface/public/shared/settings/settings-browser-owner-access.js +72 -0
  318. package/neural-interface/public/shared/settings/settings-data.js +7 -1
  319. package/neural-interface/public/shared/settings/settings-ia.js +3 -1
  320. package/neural-interface/public/shared/settings/settings-kit.js +11 -3
  321. package/neural-interface/public/shared/settings/settings-local-profiles.js +153 -0
  322. package/neural-interface/public/shared/settings/settings-maritaca-opencode.js +105 -0
  323. package/neural-interface/public/shared/settings/settings-shell.js +7 -0
  324. package/neural-interface/public/shared/shown-children.js +72 -0
  325. package/neural-interface/public/shared/sidepanel-session-status.js +16 -2
  326. package/neural-interface/public/shared/state.js +1 -1
  327. package/neural-interface/public/shared/static-bg-state.js +22 -0
  328. package/neural-interface/public/shared/styles.css +457 -164
  329. package/neural-interface/public/shared/synabun-mascot-assets.js +67 -0
  330. package/neural-interface/public/shared/synabun-mascot.js +136 -12
  331. package/neural-interface/public/shared/synabun-ticker.js +3 -0
  332. package/neural-interface/public/shared/synabun-tools.js +173 -0
  333. package/neural-interface/public/shared/tool-heartbeat.js +43 -0
  334. package/neural-interface/public/shared/tool-list-picker.js +3 -1
  335. package/neural-interface/public/shared/tool-list-view.js +23 -4
  336. package/neural-interface/public/shared/topright-overflow-logic.js +1 -0
  337. package/neural-interface/public/shared/ui-automation-approval.js +188 -0
  338. package/neural-interface/public/shared/ui-automation-studio.js +138 -91
  339. package/neural-interface/public/shared/ui-claude-panel.js +209 -31
  340. package/neural-interface/public/shared/ui-judgments.js +37 -10
  341. package/neural-interface/public/shared/ui-maritaca-panel.js +15 -0
  342. package/neural-interface/public/shared/ui-navbar.js +23 -0
  343. package/neural-interface/public/shared/ui-owner-access.js +191 -0
  344. package/neural-interface/public/shared/ui-owner-authority.js +162 -0
  345. package/neural-interface/public/shared/ui-panels.js +3 -1
  346. package/neural-interface/public/shared/ui-schedules-studio.js +118 -17
  347. package/neural-interface/public/shared/ui-scroll-follow.js +3 -0
  348. package/neural-interface/public/shared/ui-sessions.js +45 -16
  349. package/neural-interface/public/shared/ui-settings.js +676 -42
  350. package/neural-interface/public/shared/ui-sidepanel-session-entry.js +8 -2
  351. package/neural-interface/public/shared/ui-sidepanel-sessions.js +3 -3
  352. package/neural-interface/public/shared/ui-sidepanel-tray.js +24 -0
  353. package/neural-interface/public/shared/ui-sidepanel-windows.js +1 -1
  354. package/neural-interface/public/shared/ui-terminal.js +15 -7
  355. package/neural-interface/public/shared/ui-tutorial-preview.js +4 -0
  356. package/neural-interface/public/shared/ui-update.js +3 -0
  357. package/neural-interface/public/shared/ui-whiteboard.js +4 -0
  358. package/neural-interface/public/shared/window-keys.js +38 -0
  359. package/neural-interface/scripts/build-mascot-assets.mjs +30 -0
  360. package/neural-interface/server.js +2903 -359
  361. package/npm-shrinkwrap.json +5 -17
  362. package/package.json +5 -6
  363. package/postinstall.js +38 -39
  364. package/setup.js +33 -31
  365. package/skills/synabun/modules/changelog.md +14 -0
@@ -19,6 +19,8 @@ import { getSessionPolicy, requiresHumanApproval } from './remote-policy.js';
19
19
  import { clampPlanDispatch, PLAN_DISPATCH_NOTE, runCanChangeCode } from './assistant-plan-permissions.js';
20
20
  import { noStore, requireJson, requireLocal, requireLocalHost, sendGuardError } from './http-guards.js';
21
21
  import { setUntrustedFileHeaders } from './untrusted-file-headers.js';
22
+ import { PEER_VERDICT, peerAuthority } from './peer-identity.js';
23
+ import { sendPeerUnavailable } from './owner-authority.js';
22
24
 
23
25
  /** The header whatsapp_send_file's caller proves it is the WhatsApp conversation's own brain with (assistant-runtime.js BRAIN_CREDENTIAL_RE). */
24
26
  export const BRAIN_CREDENTIAL_HEADER = 'x-synabun-brain-token';
@@ -157,9 +159,16 @@ export function createAssistantApi({
157
159
  adminSandbox = null,
158
160
  // Protect workers (lib/worker-guard-setting.js): what capability read-only / workspace means for every worker.
159
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,
160
164
  // The page secret (lib/page-session.js): a request without an agent pin is the owner's page only when it carries
161
165
  // this boot's cookie; a local process that merely sends no headers is nobody (never 'ui').
162
166
  pageSession = null,
167
+ // Whether a pin counts (lib/terminal-tokens.js verdict, server.js): (pin, req) → { accepted, code, error, httpStatus }.
168
+ // A pin SynaBun gave a proof to (a run's terminal token, a brain's launch credential) counts only with it: a request
169
+ // that names a worker's run, or a brain's id, without it is refused (403 TERMINAL_TOKEN_REQUIRED / _INVALID) instead
170
+ // of reading that run as its own worker. Without it (a test, an older host) every pin is taken as it is said.
171
+ terminalVerdict = null,
163
172
  } = {}) {
164
173
  if (!dispatcher) throw new Error('createAssistantApi requires a dispatcher');
165
174
  const router = Router();
@@ -182,10 +191,18 @@ export function createAssistantApi({
182
191
  const bodySession = req.body?.assistantSessionId || req.body?.assistant_session_id || req.query?.assistantSessionId || null;
183
192
  if (!pin) {
184
193
  // The page: this boot's page secret cookie (the browser sends it by itself). Without a page session wired
185
- // (a test, an older host) every pinless request is the page, as before.
194
+ // (a test, an older host) every pinless request is the page, as before. A request whose peer could not be
195
+ // identified (macOS, the lookup failed) never verifies: it is nobody here, and its refusals say 503
196
+ // PEER_UNAVAILABLE (uiOnly, refuseRunRead) rather than a 403 the page could not cure.
186
197
  if (pageSession && typeof pageSession.verify === 'function' && !pageSession.verify(req)) return { kind: 'unknown', assistantSessionId: bodySession ? String(bodySession) : null, pin: '', pageless: true };
187
198
  return { kind: 'ui', assistantSessionId: bodySession ? String(bodySession) : null };
188
199
  }
200
+ // The pin counts only with its proof: a forged one names nobody here, not even for attribution.
201
+ let verdict = null;
202
+ try { verdict = typeof terminalVerdict === 'function' ? terminalVerdict(pin, req) : null; } catch { verdict = { accepted: false, code: 'TERMINAL_TOKEN_INVALID', error: 'The run this request names could not be checked.', httpStatus: 403 }; }
203
+ if (verdict && verdict.accepted === false) {
204
+ return { kind: 'refused', forbidden: true, pin, refusal: { status: Number(verdict.httpStatus) || 403, code: String(verdict.code || 'TERMINAL_TOKEN_INVALID'), error: String(verdict.error || 'This request names a run it cannot prove it is.') } };
205
+ }
189
206
  if (dispatcher.get(pin)) return { kind: 'worker', forbidden: true, pin };
190
207
  // The session a request claims, for attribution once a credential has proven it a brain: a Claude brain's
191
208
  // pin resolves to its session; the OpenCode brain pins assistant-oc-<24> (never taken as an id) and names
@@ -229,6 +246,7 @@ export function createAssistantApi({
229
246
  }
230
247
  function orchestrationGuard(req, res, next) {
231
248
  const caller = callerContext(req);
249
+ if (caller.refusal) return refusePin(res, caller.refusal);
232
250
  if (caller.forbidden) return res.status(403).json({ ok: false, code: 'AGENTS_NOT_PERMITTED', error: 'Dispatched workers cannot orchestrate other agents.' });
233
251
  // The user's own page (this boot's page secret cookie): the only caller that orchestrates without being a brain.
234
252
  if (caller.kind === 'ui') { req.assistantCaller = caller; return next(); }
@@ -238,7 +256,7 @@ export function createAssistantApi({
238
256
  // `X-Synabun-Terminal: assistant-*` header, or a real live session id, used to pass here as the brain.
239
257
  const brain = brainCaller(req);
240
258
  if (brain) { req.assistantCaller = brain; return next(); }
241
- return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Orchestration is the user\'s (from SynaBun\'s own page) and the Assistant\'s brain\'s: this request is neither (no page secret, no brain launch credential a live session knows).' });
259
+ return uiOnly(req, res, 'Orchestration is the user\'s (from SynaBun\'s own page) and the Assistant\'s brain\'s: this request is neither (no page secret, no brain launch credential a live session knows).');
242
260
  }
243
261
  /**
244
262
  * The caller when it is an assistant brain, else null. The one proof is the per-launch credential
@@ -255,6 +273,8 @@ export function createAssistantApi({
255
273
  try { session = runtime?.sessionForBrainCredential?.(req.get('x-synabun-brain-token')) || null; } catch { session = null; }
256
274
  if (!session) return null;
257
275
  const caller = req.assistantCaller || callerContext(req);
276
+ // A pin the request cannot prove (another brain's, a worker's, an ended one) is refused, credential or not.
277
+ if (caller.refusal) return null;
258
278
  return { ...caller, kind: 'assistant', assistantSessionId: String(session), credentialed: true };
259
279
  }
260
280
  /**
@@ -278,9 +298,34 @@ export function createAssistantApi({
278
298
  if (caller.kind === 'worker' && caller.pin && String(caller.pin) === String(runId)) return true;
279
299
  return false;
280
300
  }
281
- function refuseRunRead(res) {
301
+ /**
302
+ * The request's peer could not be identified (lib/peer-identity.js, macOS: the lookup failed), so neither the page
303
+ * secret nor a brain credential could count: the peer verdict's own reading (peerAuthority), or the page session's
304
+ * (a request that carries the secret and was never identified). → { retryable, reason } or null.
305
+ */
306
+ function peerDown(req) {
307
+ const auth = peerAuthority(req?.[PEER_VERDICT]);
308
+ if (auth.decision === 'unavailable') return auth;
309
+ try { return typeof pageSession?.peerUnavailable === 'function' ? (pageSession.peerUnavailable(req) || null) : null; } catch { return null; }
310
+ }
311
+ /** "Only the owner's page": 403 UI_ONLY, or 503 PEER_UNAVAILABLE when the caller could not be identified (a reload,
312
+ * or the brain's retry, may cure that; a refusal would not). */
313
+ function uiOnly(req, res, error) {
314
+ const down = peerDown(req);
315
+ if (down) return sendPeerUnavailable(res, req, down);
316
+ return res.status(403).json({ ok: false, code: 'UI_ONLY', error });
317
+ }
318
+ function refuseRunRead(req, res) {
319
+ const down = peerDown(req);
320
+ if (down) return sendPeerUnavailable(res, req, down);
321
+ const refused = callerContext(req).refusal;
322
+ if (refused) return refusePin(res, refused);
282
323
  return res.status(403).json({ ok: false, code: 'RUN_FORBIDDEN', error: 'This run is readable by the owner (from SynaBun\'s own page), its own worker and the Assistant brain of its session only.' });
283
324
  }
325
+ /** A request that names a run or a brain it cannot prove it is: 403 TERMINAL_TOKEN_REQUIRED / _INVALID (never a token). */
326
+ function refusePin(res, refusal) {
327
+ return res.status(refusal.status || 403).json({ ok: false, code: refusal.code, error: refusal.error });
328
+ }
284
329
  /** A remote session whose workers only a person may answer (strict worker approvals below autonomous). */
285
330
  function humanApprovalRequired(assistantSessionId) {
286
331
  if (!assistantSessionId) return false;
@@ -423,6 +468,8 @@ export function createAssistantApi({
423
468
  maxMinutes: body.maxMinutes ?? body.max_minutes,
424
469
  budgetUsd: body.budgetUsd ?? body.budget_usd,
425
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,
426
473
  workflowId: body.workflowId || body.workflow_id,
427
474
  parentRunId: body.parentRunId || body.parent_run_id,
428
475
  outputSchema: body.outputSchema || body.output_schema,
@@ -514,7 +561,7 @@ export function createAssistantApi({
514
561
  router.put('/routing', async (req, res) => {
515
562
  if (!requireRouter(res)) return;
516
563
  if (!configStore?.patchRouting) return res.status(503).json({ ok: false, code: 'CONFIG_UNAVAILABLE', error: 'Routing settings are read-only' });
517
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Routing settings are changed from the assistant panel only.' });
564
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Routing settings are changed from the assistant panel only.');
518
565
  try {
519
566
  const body = req.body || {};
520
567
  const patch = body.routing && typeof body.routing === 'object' ? body.routing : body;
@@ -555,7 +602,7 @@ export function createAssistantApi({
555
602
  });
556
603
  router.delete('/routing/preferences/:key', (req, res) => {
557
604
  if (!requireRouter(res)) return;
558
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Routing settings are changed from the assistant panel only.' });
605
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Routing settings are changed from the assistant panel only.');
559
606
  try {
560
607
  configStore.patchRouting({ preferences: { [req.params.key]: null } }, { taskClasses: [...Object.keys(taskClasses || {}), 'vision'] });
561
608
  broadcastSync({ type: 'assistant:routing-changed', version: configStore.version() });
@@ -600,7 +647,7 @@ export function createAssistantApi({
600
647
  router.put('/user-context', (req, res) => {
601
648
  if (!userContextReady(res)) return;
602
649
  if (!configStore.patchUserContext) return res.status(503).json({ ok: false, code: 'CONFIG_UNAVAILABLE', error: 'User context settings are read-only' });
603
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'User context settings are changed from Settings only.' });
650
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'User context settings are changed from Settings only.');
604
651
  try {
605
652
  const body = req.body || {};
606
653
  const { project: _project, ...patch } = body.settings && typeof body.settings === 'object' ? body.settings : body;
@@ -620,7 +667,7 @@ export function createAssistantApi({
620
667
  });
621
668
  router.put('/budget', (req, res) => {
622
669
  if (!configStore?.patchBudget) return res.status(503).json({ ok: false, code: 'CONFIG_UNAVAILABLE', error: 'Budget settings are read-only' });
623
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Budget settings are changed from the assistant panel only.' });
670
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Budget settings are changed from the assistant panel only.');
624
671
  try {
625
672
  const body = req.body || {};
626
673
  const patch = body.budget && typeof body.budget === 'object' && !Array.isArray(body.budget) ? body.budget : null;
@@ -738,7 +785,7 @@ export function createAssistantApi({
738
785
  }
739
786
  router.post('/clarify/:requestId/answer', (req, res) => {
740
787
  if (!requireClarifier(res)) return;
741
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Clarify cards are answered by the user.' });
788
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Clarify cards are answered by the user.');
742
789
  try { res.json(clarifier.answer(req.params.requestId, cardAnswer(req), { origin: 'rest' })); } catch (error) { sendError(res, error); }
743
790
  });
744
791
  router.get('/briefs/:briefId', (req, res) => {
@@ -760,7 +807,7 @@ export function createAssistantApi({
760
807
  });
761
808
  router.post('/routes/:routeId/answer', async (req, res) => {
762
809
  if (!requireRouter(res)) return;
763
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Route cards are answered by the user.' });
810
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Route cards are answered by the user.');
764
811
  try { res.json(await assistantRouter.answer(req.params.routeId, cardAnswer(req), { origin: 'rest' })); } catch (error) { sendError(res, error); }
765
812
  });
766
813
  router.get('/sessions/:id/routes', (req, res) => {
@@ -780,7 +827,7 @@ export function createAssistantApi({
780
827
  // Listing is owner-or-brain only: a worker reads its own run by id, never the roster of every run.
781
828
  const caller = callerContext(req);
782
829
  const brain = brainCaller(req);
783
- if (caller.kind !== 'ui' && !brain) return refuseRunRead(res);
830
+ if (caller.kind !== 'ui' && !brain) return refuseRunRead(req, res);
784
831
  try {
785
832
  const active = req.query.active === '1' || req.query.activeOnly === '1';
786
833
  // A brain sees only its OWN session's runs (its session id forced over whatever the query asks); the owner's
@@ -840,7 +887,7 @@ export function createAssistantApi({
840
887
  });
841
888
 
842
889
  router.get('/runs/:runId', (req, res) => {
843
- if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
890
+ if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
844
891
  const run = dispatcher.get(req.params.runId);
845
892
  if (!run) return res.status(404).json({ ok: false, code: 'RUN_NOT_FOUND', error: `Unknown run ${req.params.runId}` });
846
893
  const brain = brainCaller(req);
@@ -848,7 +895,7 @@ export function createAssistantApi({
848
895
  res.json({ ok: true, run: brain ? slimRunView(run) : run });
849
896
  });
850
897
  router.get('/runs/:runId/result', (req, res) => {
851
- if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
898
+ if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
852
899
  try {
853
900
  const out = dispatcher.transcript(req.params.runId, { format: 'result' });
854
901
  if (out?.result) {
@@ -859,7 +906,7 @@ export function createAssistantApi({
859
906
  } catch (error) { sendError(res, error); }
860
907
  });
861
908
  router.get('/runs/:runId/transcript', (req, res) => {
862
- if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
909
+ if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
863
910
  try {
864
911
  const format = req.query.format || 'tail';
865
912
  const out = dispatcher.transcript(req.params.runId, {
@@ -880,7 +927,7 @@ export function createAssistantApi({
880
927
  // path from the request; owner-only like everything here. sendFile answers
881
928
  // Range requests, so a video seeks.
882
929
  router.get('/runs/:runId/media/:n', async (req, res) => {
883
- if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(res);
930
+ if (!runReadAllowed(req, req.params.runId)) return refuseRunRead(req, res);
884
931
  const notFound = () => res.status(404).json({ ok: false, code: 'MEDIA_NOT_FOUND', error: `No media ${req.params.n} for run ${req.params.runId}` });
885
932
  if (!/^\d{1,4}$/.test(String(req.params.n))) return notFound();
886
933
  let file = null;
@@ -975,7 +1022,7 @@ export function createAssistantApi({
975
1022
  router.delete('/runs/:runId', async (req, res) => {
976
1023
  const caller = callerContext(req);
977
1024
  const brain = brainCaller(req);
978
- if (caller.kind !== 'ui' && !brain) return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Finished runs are removed by the owner (from SynaBun\'s own page) or the Assistant brain of the run\'s session.' });
1025
+ if (caller.kind !== 'ui' && !brain) return uiOnly(req, res, 'Finished runs are removed by the owner (from SynaBun\'s own page) or the Assistant brain of the run\'s session.');
979
1026
  if (brain && caller.kind !== 'ui') {
980
1027
  // A brain removes only the runs of its own session: another session's run is left untouched.
981
1028
  const runSession = dispatcher.get(req.params.runId)?.assistantSessionId || null;
@@ -989,7 +1036,7 @@ export function createAssistantApi({
989
1036
  try { res.json(await dispatcher.remove(req.params.runId, { assistantSessionId })); } catch (error) { sendError(res, error); }
990
1037
  });
991
1038
  router.post('/runs/clear-finished', async (req, res) => {
992
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Finished runs are removed from the assistant panel only.' });
1039
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Finished runs are removed from the assistant panel only.');
993
1040
  const body = req.body || {};
994
1041
  const assistantSessionId = body.assistantSessionId || body.assistant_session_id || null;
995
1042
  const workflowId = body.workflowId || body.workflow_id || null;
@@ -1003,7 +1050,7 @@ export function createAssistantApi({
1003
1050
  // The user closed the sidepanel tab of a worker that finished its task: completed, never "stopped
1004
1051
  // by the user" (409 RUN_NOT_FINISHED for any other run, which the tab then stops as before).
1005
1052
  router.post('/runs/:runId/tab-closed', (req, res) => {
1006
- if (callerContext(req).kind !== 'ui') return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the sidepanel that closed the tab reports it.' });
1053
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the sidepanel that closed the tab reports it.');
1007
1054
  try { res.json(dispatcher.completeClosedTab(req.params.runId)); } catch (error) { sendError(res, error); }
1008
1055
  });
1009
1056
  router.post('/runs/:runId/focus', (req, res) => {
@@ -1338,9 +1385,8 @@ export function createAssistantApi({
1338
1385
  });
1339
1386
  router.put('/admin-sandbox', requireJson, (req, res) => {
1340
1387
  if (!adminSandbox) return res.status(503).json({ ok: false, code: 'ADMIN_SANDBOX_UNAVAILABLE', error: 'The Admin sandbox setting is not available on this server' });
1341
- if (callerContext(req).kind !== 'ui' || req.get('x-synabun-desktop-grant')) {
1342
- return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can change the Admin sandbox.' });
1343
- }
1388
+ if (req.get('x-synabun-desktop-grant')) return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can change the Admin sandbox.' });
1389
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the user can change the Admin sandbox.');
1344
1390
  const value = req.body?.adminSandbox;
1345
1391
  if (typeof value !== 'boolean') return res.status(400).json({ ok: false, code: 'INVALID_VALUE', error: 'adminSandbox must be true or false.' });
1346
1392
  try { res.json({ ok: true, ...adminSandbox.set(value) }); } catch (error) { sendError(res, error); }
@@ -1355,9 +1401,8 @@ export function createAssistantApi({
1355
1401
  });
1356
1402
  router.put('/worker-guard', requireJson, (req, res) => {
1357
1403
  if (!workerGuard) return res.status(503).json({ ok: false, code: 'WORKER_GUARD_UNAVAILABLE', error: 'The Protect workers setting is not available on this server' });
1358
- if (callerContext(req).kind !== 'ui' || req.get('x-synabun-desktop-grant') || req.get('x-synabun-role')) {
1359
- return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can change Protect workers.' });
1360
- }
1404
+ if (req.get('x-synabun-desktop-grant') || req.get('x-synabun-role')) return res.status(403).json({ ok: false, code: 'UI_ONLY', error: 'Only the user can change Protect workers.' });
1405
+ if (callerContext(req).kind !== 'ui') return uiOnly(req, res, 'Only the user can change Protect workers.');
1361
1406
  const value = req.body?.mode;
1362
1407
  if (typeof value !== 'string' || !workerGuard.view().modes.includes(value)) return res.status(400).json({ ok: false, code: 'INVALID_VALUE', error: `mode must be one of ${workerGuard.view().modes.join(', ')}.` });
1363
1408
  try { res.json({ ok: true, ...workerGuard.set(value) }); } catch (error) { sendError(res, error); }
@@ -1381,6 +1426,28 @@ export function createAssistantApi({
1381
1426
  if (uiTabs.size > 50) uiTabs.delete(uiTabs.keys().next().value);
1382
1427
  res.json({ ok: true, windows: uiTabs.size });
1383
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
+ });
1384
1451
  router.get('/ui/tabs', (req, res) => res.json({ ok: true, windows: listTabs() }));
1385
1452
  router.post('/ui/focus', (req, res) => {
1386
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;
@@ -1,4 +1,4 @@
1
- import { EXTERNAL_SERVER_LIMITATIONS } from './mcp-external-servers.js';
1
+ import { EXTERNAL_SERVER_LIMITATIONS, externalDiscoveryError } from './mcp-external-servers.js';
2
2
  import { toolCatalogView } from '../../mcp-server/dist/services/tool-catalog.js';
3
3
  // ═══════════════════════════════════════════
4
4
  // SynaBun — Assistant model catalog (providers · models · tier · price · vision)
@@ -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]);
@@ -681,6 +776,21 @@ export function createAssistantCatalog({
681
776
  let epoch = 0; // bumped by invalidate(): a build that began before it is not kept
682
777
  let lastListed = null; // provider → signature of the rows the last build listed
683
778
 
779
+ // External servers are read degraded here (the catalog only lists): a provider whose MCP configuration
780
+ // cannot be read is reported in `errors`, its rows say `unknown`, and every other provider's servers and
781
+ // every model stay listed. Dispatch and worker launch read their own strict inventories and refuse.
782
+ // getExternalServers answers { servers, errors } or plain rows (older form).
783
+ function externalServersReport(projectRows) {
784
+ try {
785
+ const answer = getExternalServers(projectRows);
786
+ if (Array.isArray(answer)) return { servers: answer, errors: [] };
787
+ return { servers: Array.isArray(answer?.servers) ? answer.servers : [], errors: Array.isArray(answer?.errors) ? answer.errors : [] };
788
+ } catch (error) {
789
+ log('catalog:external-servers-error', error?.code || error?.message || String(error));
790
+ return { servers: [], errors: [externalDiscoveryError(error?.provider || null, error)] };
791
+ }
792
+ }
793
+
684
794
  const pickArray = (value, keys = []) => {
685
795
  if (Array.isArray(value)) return value;
686
796
  for (const key of keys) if (Array.isArray(value?.[key])) return value[key];
@@ -721,11 +831,13 @@ export function createAssistantCatalog({
721
831
  async function build({ deep = false } = {}) {
722
832
  // `deep` also drops the providers' own discovery caches (a CLI or app-server round trip).
723
833
  const fresh = deep ? '?refresh=1' : '';
724
- const [claudeModels, codexModels, opencodeProviders, antigravityModels, projects] = await Promise.all([
834
+ const [claudeModels, codexModels, opencodeProviders, antigravityModels, projects, maritacaModels] = await Promise.all([
725
835
  fetchJson(`/api/claude/models${fresh}`), fetchJson(`/api/codex/models${fresh}`), fetchJson('/api/opencode/providers/full'),
726
836
  // A provider that does not answer is unavailable for this build, never a failed build.
727
837
  Promise.resolve().then(() => fetchJson(`/api/antigravity/models${fresh}`)).catch(() => null),
728
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),
729
841
  ]);
730
842
  const filter = (() => { try { return readFilter() || {}; } catch { return {}; } })();
731
843
  let accounts = {};
@@ -748,7 +860,10 @@ export function createAssistantCatalog({
748
860
  codex: codex.state,
749
861
  opencode: opencodeProviders && opencodeProviders.ok !== false ? 'live' : 'unavailable',
750
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',
751
865
  };
866
+ const chat = { maritaca: maritacaModels && maritacaModels.ok !== false ? normalizeMaritacaRows(pickArray(maritacaModels, ['models'])) : [] };
752
867
  for (const p of ['claude-code', 'codex']) if (sources[p] !== 'live') log('catalog:source', `${p}: ${sources[p]}`);
753
868
  const all = {
754
869
  'claude-code': withClaudeContextVariants(normalizeClaudeRows(claude.list, { pricing: claudePricing })),
@@ -783,11 +898,22 @@ export function createAssistantCatalog({
783
898
  const listedNow = Object.fromEntries(CATALOG_PROVIDERS.map((p) => [p, listedSignature(all[p])]));
784
899
  const changed = lastListed ? CATALOG_PROVIDERS.filter((p) => listedNow[p] !== lastListed[p]) : [];
785
900
  lastListed = listedNow;
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 });
786
906
  return {
787
907
  generatedAt: new Date(now()).toISOString(),
908
+ // Providers whose MCP server list could not be checked: { provider, code, reason, errno? }, no paths.
909
+ externalServerErrors: external.errors,
788
910
  // Providers whose listed models differ from the build before (not part of the value's meaning: full() reports it).
789
911
  changedProviders: changed,
790
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 },
791
917
  hidden,
792
918
  // provider → { hidden id (lower-case) → { model, variant, label, at, … } }: the entries that hide one row only.
793
919
  hiddenPins,
@@ -801,7 +927,7 @@ export function createAssistantCatalog({
801
927
  opencodeListed: listedCounts.opencode,
802
928
  opencodeHidden: hidden.opencode,
803
929
  projects: pickArray(projects, ['projects']),
804
- tools: { ...toolCatalogView(), servers: getExternalServers(pickArray(projects, ['projects'])), externalServerLimitations: EXTERNAL_SERVER_LIMITATIONS },
930
+ tools: { ...toolCatalogView(), servers: external.servers, externalServerErrors: external.errors, externalServerLimitations: EXTERNAL_SERVER_LIMITATIONS },
805
931
  accounts,
806
932
  // Efforts are per model (row.efforts); a provider's list is the union of its rows'.
807
933
  providers: [
@@ -811,6 +937,11 @@ export function createAssistantCatalog({
811
937
  // A brain and a worker. No accounts (Antigravity signs in with Google in its own CLI: `signedIn` and `tier`
812
938
  // say what its last model listing found) and unpriced (tokens, not prices).
813
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 },
814
945
  ],
815
946
  };
816
947
  }