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
@@ -0,0 +1,59 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun Neural Interface — one gate for a poller that several places share
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // A status poller (the Computer tray's GET /api/desktop/status, asst-computer.js) can run in every Assistant tab at
6
+ // once, each on its own timer. Through one gate they make at most one request at a time and one per interval, and a
7
+ // failure is not asked again at the same pace:
8
+ // • an answer: the next is due one interval later (less a little slack, so the timers that share it do not drift
9
+ // past each other);
10
+ // • a failure: the next is due after an exponential wait, capped (base · factor^failures, at most `maxMs`);
11
+ // • a refusal (the page has no owner access: owner-access.js): no more polling at all until `resume()`, which the
12
+ // page calls when something changed (it got the owner's page secret again, or it became visible again).
13
+ // A request the user asks for (Check again) does not ask the gate; its answer still counts.
14
+ //
15
+ // No DOM: `node --test` loads this file with a test clock (tests/poll-backoff.test.mjs).
16
+
17
+ export const POLL_BACKOFF_DEFAULTS = Object.freeze({ baseMs: 3000, maxMs: 5 * 60_000, factor: 2, slackMs: 250 });
18
+
19
+ /** The wait after `failures` failures in a row: the interval itself for none, then exponential, capped. */
20
+ export function backoffDelay(failures, { baseMs = POLL_BACKOFF_DEFAULTS.baseMs, maxMs = POLL_BACKOFF_DEFAULTS.maxMs, factor = POLL_BACKOFF_DEFAULTS.factor } = {}) {
21
+ const n = Math.max(0, Math.floor(Number(failures) || 0));
22
+ const base = Math.max(0, Number(baseMs) || 0);
23
+ const cap = Math.max(base, Number(maxMs) || 0);
24
+ if (n === 0) return base;
25
+ return Math.min(cap, base * Math.pow(Math.max(1, Number(factor) || 1), n));
26
+ }
27
+
28
+ export function createPollGate({ baseMs = POLL_BACKOFF_DEFAULTS.baseMs, maxMs = POLL_BACKOFF_DEFAULTS.maxMs, factor = POLL_BACKOFF_DEFAULTS.factor, slackMs = POLL_BACKOFF_DEFAULTS.slackMs, now = () => Date.now() } = {}) {
29
+ const opts = { baseMs, maxMs, factor };
30
+ let failures = 0;
31
+ let nextAt = 0;
32
+ let halted = null; // { code, reason } while a refusal stops the polling
33
+ let inFlight = false;
34
+ return {
35
+ /** Whether a timer's tick may send the request now. */
36
+ due() { return !halted && !inFlight && now() >= nextAt; },
37
+ /** A request leaves (timer or user). */
38
+ begin() { inFlight = true; },
39
+ /** It answered. */
40
+ succeed() {
41
+ inFlight = false;
42
+ failures = 0;
43
+ halted = null;
44
+ nextAt = now() + Math.max(0, baseMs - Math.max(0, slackMs));
45
+ },
46
+ /** It failed; `refusal` (owner-access.js) stops the polling until resume(). Returns the wait before the next. */
47
+ fail(refusal = null) {
48
+ inFlight = false;
49
+ failures += 1;
50
+ if (refusal) { halted = { code: refusal.code || null, reason: refusal.reason || null }; return Infinity; }
51
+ const wait = backoffDelay(failures, opts);
52
+ nextAt = now() + wait;
53
+ return wait;
54
+ },
55
+ /** Something changed (owner access back, the page visible again): due at once, from a clean slate. */
56
+ resume() { halted = null; failures = 0; nextAt = 0; },
57
+ snapshot() { return { failures, nextAt, halted, inFlight, waitMs: halted ? Infinity : Math.max(0, nextAt - now()) }; },
58
+ };
59
+ }
@@ -7,6 +7,8 @@ const SVG_OPENAI = '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M9.205
7
7
  // A line drawing: its paths carry fill="none" themselves, because some places fill every icon they hold
8
8
  // (`.resume-provider-icon svg { fill: currentColor }`), which would turn the strokes into a solid triangle.
9
9
  const SVG_ANTIGRAVITY = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 20 12 4l7.5 16" fill="none"/><path d="M8.2 20a3.8 3.8 0 0 1 7.6 0" fill="none"/></svg>';
10
+ // Maritaca AI's mark (maritaca.ai favicon.svg, the bird), in currentColor.
11
+ const SVG_MARITACA = '<svg viewBox="0 0 12.48 13.73" fill="currentColor"><path d="M10.11 11.01h1.9S7.21 5.97 5.72 4.4a.62.62 0 0 0-.93.04c-.48.59-.76 1.33-.81 2.1-.06 1.04.32 2.06 1.04 2.8l4.35 4.4h3.1l-2.37-2.72Z"/><path d="M5.69 11 4.52 9.82c-.86-.89-1.31-2.1-1.24-3.33s.67-2.38 1.62-3.16c.35.06.71-.02 1.01-.24-.07-.24-.16-.55-.22-.75-.02-.07.06-.13.12-.09l1.16.77c.3-.61.22-1.37-.26-1.9.1-.18.06-.44-.15-.57C6.07.26 5.36 0 4.41 0 2.76 0 0 1.5 0 5.18c0 2.12 1.36 4.57 3.86 5.47l-1.43 3.08h1.05L4.8 10.9c.29.05.58.09.89.1l-1.27 2.73h1.05l.94-2.01L5.7 11ZM4.84.67c.23 0 .42.19.42.42s-.19.42-.42.42-.42-.19-.42-.42.19-.42.42-.42"/></svg>';
10
12
  const SVG_OPENCODE = '<svg viewBox="0 0 240 300" fill="currentColor"><path fill-rule="evenodd" d="M0 0h240v300H0V0zm60 60v180h120V60H60z"/><rect x="60" y="120" width="120" height="120" opacity=".45"/></svg>';
11
13
  const SVG_SHELL = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>';
12
14
  const SVG_BROWSER = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>';
@@ -18,6 +20,7 @@ const PROVIDER_META = {
18
20
  codex: { id: 'codex', label: 'Codex', shortLabel: 'Codex', icon: SVG_OPENAI, color: '#74C7A5' },
19
21
  opencode: { id: 'opencode', label: 'OpenCode', shortLabel: 'OpenCode', icon: SVG_OPENCODE, color: '#E8E0DC' },
20
22
  antigravity: { id: 'antigravity', label: 'Antigravity', shortLabel: 'Antigravity', icon: SVG_ANTIGRAVITY, color: '#669DF6' },
23
+ maritaca: { id: 'maritaca', label: 'Maritaca', shortLabel: 'Maritaca', icon: SVG_MARITACA, color: '#70d44b' },
21
24
  synabun: { id: 'synabun', label: 'SynaBun', shortLabel: 'SynaBun', icon: SVG_SYNABUN, color: '#FFD23C' },
22
25
  shell: { id: 'shell', label: 'Shell', shortLabel: 'Shell', icon: SVG_SHELL, color: '#AAAAAA' },
23
26
  browser: { id: 'browser', label: 'Browser', shortLabel: 'Browser', icon: SVG_BROWSER, color: '#4FC3F7' },
@@ -73,6 +73,7 @@ export const SCHEDULES_VIEW_COPY = Object.freeze({
73
73
  factMcp: 'Tools and MCP servers',
74
74
  factAccount: 'OpenAI account',
75
75
  factBrowser: 'Browser',
76
+ factMoreLogin: 'MoreLogin profile',
76
77
  valueDefault: 'Default',
77
78
  valueOn: 'On',
78
79
  valueOff: 'Off',
@@ -448,5 +449,11 @@ export function launchFacts(schedule, { group = null, template = null, profiles
448
449
  }
449
450
  const browser = pick('usesBrowser');
450
451
  facts.push({ key: 'usesBrowser', label: scheduleWord('factBrowser'), value: scheduleWord(browser.value === true ? 'valueOn' : 'valueOff'), source: browser.source });
452
+ // The MoreLogin profile the run opens: the schedule's own, else its group's (none: the default of Settings →
453
+ // Browser, which the list does not repeat). An automation has none.
454
+ const moreLoginOwner = schedule?.moreloginEnvId ? schedule : (group?.moreloginEnvId ? group : null);
455
+ if (moreLoginOwner) {
456
+ facts.push({ key: 'moreloginEnvId', label: scheduleWord('factMoreLogin'), value: moreLoginOwner.moreloginEnvName || String(moreLoginOwner.moreloginEnvId), source: moreLoginOwner === schedule ? 'schedule' : 'group' });
457
+ }
451
458
  return facts;
452
459
  }
@@ -0,0 +1,50 @@
1
+ // Waiting for SynaBun's server to come back after a restart it announced (an MCP build in the onboarding wizard, a
2
+ // restore in Settings). DOM-free: the page hands in fetch, the clock and what to do; tests run it under Node.
3
+
4
+ /**
5
+ * "Back" is /api/health answering with another bootId than the one the restart named (or, for a server that sends
6
+ * none, an answer after it was seen gone), never just an answer, because the old server keeps answering while it
7
+ * shuts down. Bounded: true when it came back, false when it did not in time.
8
+ */
9
+ export async function waitForServerBack(oldBootId, {
10
+ timeoutMs = 90_000, everyMs = 1000,
11
+ fetchFn = (...a) => fetch(...a), sleep = (ms) => new Promise(r => setTimeout(r, ms)), now = () => Date.now(),
12
+ } = {}) {
13
+ const until = now() + timeoutMs;
14
+ let seenGone = false;
15
+ while (now() < until) {
16
+ await sleep(everyMs);
17
+ try {
18
+ const res = await fetchFn('/api/health', { cache: 'no-store' });
19
+ if (!res.ok) { seenGone = true; continue; }
20
+ const health = await res.json();
21
+ if (health.restarting) { seenGone = true; continue; }
22
+ if (health.bootId ? health.bootId !== oldBootId : seenGone) return true;
23
+ } catch {
24
+ seenGone = true;
25
+ }
26
+ }
27
+ return false;
28
+ }
29
+
30
+ /**
31
+ * After POST /api/system/restore answered: reload the page. Without a restart, after `delayMs` as always; with one
32
+ * (the restore built a new MCP server and the server restarts to load it), only once a new server answers, since a
33
+ * reload during the restart lands on a server that is going away. Returns 'reloaded' or 'not-back' (then
34
+ * `onNotBack` ran and nothing reloads: the page says so instead).
35
+ */
36
+ export async function reloadAfterRestore(result, {
37
+ reload, onRestarting = () => {}, onNotBack = () => {}, delayMs = 2500,
38
+ wait = waitForServerBack, sleep = (ms) => new Promise(r => setTimeout(r, ms)),
39
+ } = {}) {
40
+ if (!result?.restart) {
41
+ await sleep(delayMs);
42
+ reload();
43
+ return 'reloaded';
44
+ }
45
+ onRestarting();
46
+ const back = await wait(typeof result.bootId === 'string' ? result.bootId : '');
47
+ if (!back) { onNotBack(); return 'not-back'; }
48
+ reload();
49
+ return 'reloaded';
50
+ }
@@ -0,0 +1,72 @@
1
+ // ═══════════════════════════════════════════
2
+ // SETTINGS — Let the automation browser act as owner, in words
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // What `GET /api/assistant/automation-browser-owner-access` (lib/assistant-api.js; the setting in
6
+ // lib/automation-browser-owner-access.js, enforced by lib/page-session.js and lib/owner-authority.js) says about
7
+ // Settings → Browser → Automation browser access: whether the switch is on, whether it can be changed, and what
8
+ // stands in the way. Pure: no DOM and no import, so node runs it (tests/settings-browser-owner-access-view.test.mjs).
9
+ //
10
+ // readOwnerAccessResponse({ status, body, error }) what the server answered → a reading
11
+ // describeOwnerAccess(reading, { tx }) the row as ui-settings.js draws it
12
+ // describeOwnerAccessSaveFailure(input, { tx }) the sentence for a change that could not be saved
13
+ //
14
+ // `tx(key, params)` is the caller's translate function over the settings.redesign.* strings (the kit's `tx`).
15
+ // The row never shows a healthy-looking switch for something that is not happening: a server started before the
16
+ // setting existed shows it off, disabled, and says a restart is missing.
17
+
18
+ const K = 'settings.redesign.browser.ownerAccess';
19
+
20
+ export const OWNER_ACCESS_DEFAULT = false;
21
+
22
+ const clean = (value, max = 200) => {
23
+ const text = String(value ?? '').replace(/\s+/g, ' ').trim();
24
+ return text.length > max ? `${text.slice(0, max - 1)}…` : text;
25
+ };
26
+
27
+ /**
28
+ * What the server answered.
29
+ *
30
+ * ready the setting is there: `enabled` is in effect
31
+ * old-server 404: the running server was started before the setting existed
32
+ * failed 503 OWNER_ACCESS_UNAVAILABLE: the setting did not start; `reason` is the error
33
+ * unreadable anything else (no answer, a refusal, a body that is not the payload)
34
+ */
35
+ export function readOwnerAccessResponse({ status = 0, body = null, error = null } = {}) {
36
+ const code = Number(status) || 0;
37
+ if (code === 404) return { state: 'old-server', enabled: OWNER_ACCESS_DEFAULT, reason: null };
38
+ if (code === 503) return { state: 'failed', enabled: OWNER_ACCESS_DEFAULT, reason: clean(body?.reason || body?.error) || null };
39
+ if (code >= 200 && code < 300 && body && typeof body === 'object' && body.ok !== false && typeof body.enabled === 'boolean') {
40
+ return { state: 'ready', enabled: body.enabled, reason: null };
41
+ }
42
+ return { state: 'unreadable', enabled: OWNER_ACCESS_DEFAULT, reason: clean(error || body?.error || (code ? `HTTP ${code}` : '')) || null };
43
+ }
44
+
45
+ /** The row: { ready, disabled, on, note: { text, tone } | null, warning: string | null, applies }. */
46
+ export function describeOwnerAccess(reading, { tx }) {
47
+ const r = reading || readOwnerAccessResponse({ status: 0 });
48
+ let note = null;
49
+ if (r.state === 'old-server') note = { text: tx(`${K}.restart`), tone: 'warn' };
50
+ else if (r.state === 'failed') note = { text: r.reason ? tx(`${K}.failed`, { reason: r.reason }) : tx(`${K}.failedNoReason`), tone: 'warn' };
51
+ else if (r.state === 'unreadable') note = { text: r.reason ? tx(`${K}.unreadable`, { reason: r.reason }) : tx(`${K}.unreadableNoReason`), tone: 'warn' };
52
+ const on = r.state === 'ready' && r.enabled === true;
53
+ return {
54
+ ready: r.state === 'ready',
55
+ disabled: r.state !== 'ready',
56
+ on,
57
+ note,
58
+ // While on, the row says what that means right under the switch, in the warning tone.
59
+ warning: on ? tx(`${K}.onWarning`) : null,
60
+ applies: tx(`${K}.applies`),
61
+ };
62
+ }
63
+
64
+ /** The sentence under the row when a change could not be saved: { status, body, error, enabled }. */
65
+ export function describeOwnerAccessSaveFailure({ status = 0, body = null, error = null, enabled = false } = {}, { tx }) {
66
+ const code = Number(status) || 0;
67
+ const state = tx(`${K}.${enabled ? 'stateOn' : 'stateOff'}`);
68
+ if (code === 404) return tx(`${K}.save.oldServer`, { state });
69
+ if (code === 403 && body?.code === 'WORKER_BROWSER') return tx(`${K}.save.automationBrowser`, { state });
70
+ if (!code) return tx(`${K}.save.noAnswer`, { state, reason: clean(error) || '' });
71
+ return tx(`${K}.save.failed`, { state, reason: clean(body?.error || error) || `HTTP ${code}` });
72
+ }
@@ -40,6 +40,7 @@ export const SETTINGS_READS = Object.freeze({
40
40
  typesafe: { url: '/api/typesafe/config', accept: (body) => body?.ok === true },
41
41
  userContext: { url: '/api/assistant/user-context', raw: true },
42
42
  workerGuard: { url: '/api/assistant/worker-guard', raw: true },
43
+ browserOwnerAccess: { url: '/api/assistant/automation-browser-owner-access', raw: true },
43
44
  });
44
45
 
45
46
  const caches = Object.fromEntries(Object.entries(SETTINGS_READS).map(([name, spec]) => [name, createDataCache(`settings:${name}`, {
@@ -47,7 +48,12 @@ const caches = Object.fromEntries(Object.entries(SETTINGS_READS).map(([name, spe
47
48
  load: async () => {
48
49
  const res = await fetch(spec.url);
49
50
  if (spec.raw) return { status: res.status, body: await res.json().catch(() => null) };
50
- if (!res.ok) throw new Error(`${spec.url}: HTTP ${res.status}`);
51
+ if (!res.ok) {
52
+ // The status and the server's code stay with the error: a refusal of the owner's access (403 WORKER_BROWSER…)
53
+ // is "No access" in the modal, never an empty or default setting (owner-access.js refusalOfError).
54
+ const body = await res.json().catch(() => null);
55
+ throw Object.assign(new Error(`${spec.url}: HTTP ${res.status}`), { status: res.status, code: typeof body?.code === 'string' ? body.code : null });
56
+ }
51
57
  return res.json();
52
58
  },
53
59
  accept: spec.raw ? (value) => value?.status >= 200 && value.status < 300 && !!value.body : spec.accept,
@@ -94,6 +94,7 @@ export const SETTINGS_PAGES = [
94
94
  sections: [
95
95
  { id: 'setup-browser', key: 'browser_choice', state: 'open' },
96
96
  { id: 'bcg-profiles', key: 'browser_profiles', state: 'open' },
97
+ { id: 'bcg-owner-access', key: 'automation_browser_owner_access', state: 'open' },
97
98
  { id: 'bcg-identity', key: 'identity_privacy', state: 'advanced' },
98
99
  { id: 'bcg-viewport', key: 'display', state: 'advanced' },
99
100
  { id: 'bcg-advanced', key: 'advanced_browser_behavior', state: 'advanced' },
@@ -265,13 +266,14 @@ export const SETTINGS_CONTROLS = {
265
266
  'project-storage-manager': 'PRJ001 PRJ012 PRJ002 PRJ003 PRJ004 PRJ005 PRJ006',
266
267
  'setup-browser': 'BRW003 BRW001 BRW002 BRW084 BRW004 BRW005 BRW006 BRW007 BRW008 BRW009',
267
268
  'bcg-profiles': 'BRW011 BRW012 BRW013 BRW014 BRW083 BRW010 BRW015 BRW016 BRW017 BRW018 BRW019 BRW020',
269
+ 'bcg-owner-access': 'BRW087',
268
270
  'bcg-identity': 'BRW021 BRW022 BRW023 BRW024 BRW025',
269
271
  'bcg-viewport': 'BRW026 BRW027 BRW028 BRW029 BRW030 BRW031 BRW032',
270
272
  'bcg-advanced': 'BRW033 BRW034 BRW035 BRW036 BRW037 BRW038 BRW039 BRW040 BRW041 BRW042 BRW043 BRW044 BRW045 BRW046 BRW047 BRW048 BRW049 BRW050 BRW051 BRW052 BRW053 BRW054 BRW055 BRW056 BRW057 BRW058 BRW059 BRW060 BRW061 BRW062 BRW063 BRW064 BRW065 BRW066 BRW067 BRW068 BRW069 BRW070 BRW071 BRW072 BRW073 BRW074 BRW075 BRW076 BRW077 BRW078 BRW079 BRW080',
271
273
  'stg-sec-default-tools': 'MCP022 MCP024 MCP005 MCP004',
272
274
  'stg-sec-added-servers': 'MCP026 MCP006 MCP007 MCP008 MCP009 MCP010 MCP011 MCP012 MCP013 MCP014 MCP015 MCP027 MCP016 MCP017 MCP018 MCP019 MCP020 MCP021',
273
275
  'stg-sec-ml-connection': 'ML015 ML001 ML002 ML003',
274
- 'stg-sec-ml-profiles': 'ML004 ML005 ML006 ML016 ML017 ML018 ML019',
276
+ 'stg-sec-ml-profiles': 'ML004 ML020 ML005 ML006 ML016 ML017 ML018 ML019 ML021 ML022 ML023 ML024 ML025 ML026 ML027 ML028 ML029 ML030 ML031 ML032 ML033 ML034 ML035 ML036',
275
277
  'stg-sec-ml-credentials': 'ML007 ML008 ML009 ML010 ML011',
276
278
  'stg-sec-ml-server': 'ML012 ML013 ML014',
277
279
  'stg-sec-skills': 'SKL004 SKL001',
@@ -218,8 +218,14 @@ export function paneActive(overlay, paneId) {
218
218
  * The status dot on a nav item. Several panes can share a page (WhatsApp and
219
219
  * Discord on Messages), so each reports its own status and the page shows
220
220
  * "connected" when any of them is. The word is also set for screen readers.
221
- * @param {'connected'|'disconnected'|''} status
221
+ * @param {'connected'|'disconnected'|'refused'|''} status
222
222
  */
223
+ /** "No access" in the page's language (ownerAccess.navStatus; English when the key is missing). */
224
+ function noAccessWord() {
225
+ const text = t('ownerAccess.navStatus');
226
+ return typeof text === 'string' && text && text !== 'ownerAccess.navStatus' ? text : 'No access';
227
+ }
228
+
223
229
  export function setNavStatus(overlay, paneId, status) {
224
230
  const page = pageOfPane(paneId);
225
231
  const nav = page && overlay.querySelector(`.settings-nav-item[data-tab="${page.id}"]`);
@@ -227,8 +233,10 @@ export function setNavStatus(overlay, paneId, status) {
227
233
  const sources = nav._stgStatus || (nav._stgStatus = {});
228
234
  if (status) sources[paneId] = status; else delete sources[paneId];
229
235
  const values = Object.values(sources);
230
- const next = values.includes('connected') ? 'connected' : values.includes('disconnected') ? 'disconnected' : '';
236
+ // 'refused': the page has no owner access, so the state is unknown (ui-owner-access.js): "No access", never "Off".
237
+ const next = values.includes('refused') ? 'refused' : values.includes('connected') ? 'connected' : values.includes('disconnected') ? 'disconnected' : '';
231
238
  if (next) nav.dataset.status = next; else delete nav.dataset.status;
232
239
  const word = nav.querySelector('.stg-nav-status-text');
233
- if (word) word.textContent = next ? ` (${t(next === 'connected' ? 'settings.redesign.common.connected' : 'settings.redesign.common.off')})` : '';
240
+ const label = next === 'refused' ? noAccessWord() : next ? t(next === 'connected' ? 'settings.redesign.common.connected' : 'settings.redesign.common.off') : '';
241
+ if (word) word.textContent = label ? ` (${label})` : '';
234
242
  }
@@ -0,0 +1,153 @@
1
+ // What Settings → Connected tools → MoreLogin decides about local profiles, without the page.
2
+ // No imports: `node --test` loads it (tests/settings-local-profiles.test.mjs).
3
+ //
4
+ // A local profile is a Chrome SynaBun runs itself on this computer (lib/local-profiles.js). It is listed with the
5
+ // MoreLogin profiles (`kind: 'local'` in GET /api/morelogin/profiles) and has an editor of its own, fed by
6
+ // GET /api/morelogin/local-profiles. The page draws; this module says what a row shows, where a new profile is
7
+ // created by default, and what the editor's fields mean as a request body.
8
+
9
+ export const PROXY_TYPES = Object.freeze(['none', 'http', 'https', 'socks5']);
10
+ export const DEFAULT_WINDOW = Object.freeze({ width: 1280, height: 800 });
11
+
12
+ /** Whether a listed profile is one of SynaBun's own. */
13
+ export function isLocalProfile(env) {
14
+ return !!env && env.kind === 'local';
15
+ }
16
+
17
+ /** A local row's proxy in a few words: '' for none, else `SOCKS5 host:port`. `login`: the word for "with a login". */
18
+ export function proxySummary(env, login = '') {
19
+ const proxy = env && env.proxy;
20
+ if (!proxy || !proxy.type || proxy.type === 'none') return '';
21
+ const where = [proxy.host, proxy.port].filter(Boolean).join(':');
22
+ return [String(proxy.type).toUpperCase(), where, env.proxyUsername && login ? login : ''].filter(Boolean).join(' ');
23
+ }
24
+
25
+ /**
26
+ * Where "Create" makes a profile when the owner has not chosen: 'local' while MoreLogin cannot make one (not
27
+ * installed, closed, its API refusing) or after it refused one for its plan's limit, else 'morelogin'.
28
+ * @param {{ installed?: boolean, running?: boolean, apiError?: string|null }|null} status GET /api/morelogin/status
29
+ */
30
+ export function defaultCreateWhere(status, { limitHit = false } = {}) {
31
+ if (limitHit) return 'local';
32
+ if (!status || !status.installed || !status.running || status.apiError) return 'local';
33
+ return 'morelogin';
34
+ }
35
+
36
+ /**
37
+ * What the Create button does: 'local' (a local profile), 'morelogin' (a MoreLogin profile, which takes one of the
38
+ * plan's slots) or 'restart' (nothing is created: Local was asked of a server that is older than local profiles, and
39
+ * the owner is told to restart SynaBun). A create asked as Local never becomes a MoreLogin one.
40
+ * @param {{ where?: string, localKnown?: boolean }} o `where`: the "Where" dropdown's value
41
+ */
42
+ export function createAction({ where, localKnown } = {}) {
43
+ if (where === 'local') return localKnown ? 'local' : 'restart';
44
+ return 'morelogin';
45
+ }
46
+
47
+ /** The "Where" options. Local cannot be chosen while the running server does not know local profiles. */
48
+ export function whereOptions({ localKnown, selected = 'morelogin' } = {}) {
49
+ const chosen = !localKnown && selected === 'local' ? 'morelogin' : selected;
50
+ return [
51
+ { value: 'local', disabled: !localKnown, selected: chosen === 'local' },
52
+ { value: 'morelogin', disabled: false, selected: chosen !== 'local' },
53
+ ];
54
+ }
55
+
56
+ /**
57
+ * Whether the editor has to ask for the proxy password again: the profile has a saved one, none was typed, and the
58
+ * proxy's type, host, port or username is no longer the saved one. The server drops the saved password then (it was
59
+ * typed for another server or another account), so a save or a proxy check without it would go out with no password.
60
+ * @param values the editor's fields as typed
61
+ * @param profile the row of GET /api/morelogin/local-profiles the editor was opened on
62
+ */
63
+ export function passwordNeededAgain(values, profile) {
64
+ const v = values || {};
65
+ if (!profile || !profile.hasPassword || v.passwordTouched) return false;
66
+ const type = PROXY_TYPES.includes(v.proxyType) ? v.proxyType : 'none';
67
+ if (type === 'none' || !String(v.username ?? '').trim()) return false;
68
+ const saved = formOfProfile(profile);
69
+ return type !== saved.proxyType
70
+ || String(v.host ?? '').trim() !== saved.host
71
+ || String(Number(String(v.port ?? '').trim())) !== String(Number(saved.port))
72
+ || String(v.username ?? '').trim() !== saved.username;
73
+ }
74
+
75
+ /** Whether a failed create is MoreLogin's plan limit (the server's code). */
76
+ export function isPlanLimit(answer) {
77
+ return !!answer && answer.ok === false && answer.code === 'MORELOGIN_PLAN_LIMIT';
78
+ }
79
+
80
+ /** Whether Intl knows a timezone name (an IANA name such as America/Sao_Paulo). */
81
+ export function validTimezone(name) {
82
+ const value = String(name ?? '').trim();
83
+ if (!value) return false;
84
+ try { new Intl.DateTimeFormat('en-US', { timeZone: value }); return true; } catch { return false; }
85
+ }
86
+
87
+ /** Whether a text is a language tag (pt-BR, en-US, de). */
88
+ export function validLanguage(tag) {
89
+ const value = String(tag ?? '').trim();
90
+ if (!/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/.test(value)) return false;
91
+ try { return Intl.getCanonicalLocales(value).length === 1; } catch { return false; }
92
+ }
93
+
94
+ /** The editor's fields for one profile of GET /api/morelogin/local-profiles. The password is never among them. */
95
+ export function formOfProfile(profile) {
96
+ const p = profile || {};
97
+ const proxy = p.proxy || null;
98
+ return {
99
+ name: String(p.name ?? ''),
100
+ proxyType: proxy && PROXY_TYPES.includes(proxy.type) ? proxy.type : 'none',
101
+ host: proxy ? String(proxy.host ?? '') : '',
102
+ port: proxy && proxy.port != null ? String(proxy.port) : '',
103
+ username: String(p.proxyUsername ?? ''),
104
+ password: '',
105
+ hasPassword: !!p.hasPassword,
106
+ language: String(p.language ?? ''),
107
+ timezone: String(p.timezone ?? ''),
108
+ width: String(p.window?.width ?? DEFAULT_WINDOW.width),
109
+ height: String(p.window?.height ?? DEFAULT_WINDOW.height),
110
+ notes: String(p.notes ?? ''),
111
+ };
112
+ }
113
+
114
+ /**
115
+ * The editor's fields as the body of PUT /api/morelogin/local-profiles/:id.
116
+ * → { ok: true, body } or { ok: false, errors: { field: reason } } with reasons 'name' | 'host' | 'port' | 'language'
117
+ * | 'timezone' | 'window' (the page says each in its own words).
118
+ * The password travels only when the owner typed one (`passwordTouched`): an untouched field keeps the saved one,
119
+ * which the server never sends back.
120
+ */
121
+ export function readLocalProfileForm(values) {
122
+ const v = values || {};
123
+ const errors = {};
124
+ const name = String(v.name ?? '').trim();
125
+ if (!name || name.length > 80) errors.name = 'name';
126
+ const type = PROXY_TYPES.includes(v.proxyType) ? v.proxyType : 'none';
127
+ const proxy = { type };
128
+ if (type !== 'none') {
129
+ const host = String(v.host ?? '').trim();
130
+ if (!host || /[\s/@?#]/.test(host)) errors.host = 'host';
131
+ const port = Number(String(v.port ?? '').trim());
132
+ if (!Number.isInteger(port) || port < 1 || port > 65535) errors.port = 'port';
133
+ proxy.host = host;
134
+ proxy.port = port;
135
+ proxy.username = String(v.username ?? '').trim();
136
+ if (v.passwordTouched) proxy.password = String(v.password ?? '');
137
+ }
138
+ const language = String(v.language ?? '').trim();
139
+ if (language && !validLanguage(language)) errors.language = 'language';
140
+ const timezone = String(v.timezone ?? '').trim();
141
+ if (timezone && !validTimezone(timezone)) errors.timezone = 'timezone';
142
+ const width = Number(String(v.width ?? '').trim() || DEFAULT_WINDOW.width);
143
+ const height = Number(String(v.height ?? '').trim() || DEFAULT_WINDOW.height);
144
+ if (!Number.isInteger(width) || width < 400 || width > 7680 || !Number.isInteger(height) || height < 300 || height > 4320) errors.window = 'window';
145
+ if (Object.keys(errors).length) return { ok: false, errors };
146
+ return { ok: true, body: { name, proxy, language, timezone, window: { width, height }, notes: String(v.notes ?? '').slice(0, 2000) } };
147
+ }
148
+
149
+ /** The proxy of the editor's fields as "check proxy" takes it (the unsaved values), or null when they are not usable. */
150
+ export function proxyOfForm(values) {
151
+ const read = readLocalProfileForm({ ...values, name: values?.name || 'x', language: '', timezone: '', width: '', height: '' });
152
+ return read.ok ? read.body.proxy : null;
153
+ }
@@ -0,0 +1,105 @@
1
+ // ═══════════════════════════════════════════
2
+ // SynaBun — Settings → OpenCode → Providers: the Maritaca card (DOM-free)
3
+ // ═══════════════════════════════════════════
4
+ //
5
+ // What the card next to the Ollama card says for an answer of GET /api/maritaca/opencode/status
6
+ // (lib/maritaca/opencode.js), and which actions it offers. `ui-settings.js` draws it; this decides.
7
+ // States: unavailable (an older server: 503 / no answer), no-key, not-registered, registered (in sync),
8
+ // stale (registered, but the key reference or the model list changed), configuring, error.
9
+
10
+ export const MARITACA_OPENCODE_STATES = Object.freeze(['unavailable', 'no-key', 'not-registered', 'registered', 'stale', 'configuring', 'error']);
11
+
12
+ /** The dot colours the Ollama card uses (the provider cards' own scale, not a theme token). */
13
+ const DOT = Object.freeze({ ok: '#4ade80', wait: '#facc15', off: 'rgba(248,113,113,0.7)' });
14
+
15
+ /** The i18n key (under settings.redesign.opencode) of every string the card can show. */
16
+ export const MARITACA_OPENCODE_KEYS = Object.freeze({
17
+ subname: 'maritacaSubname',
18
+ unavailableStatus: 'maritacaUnavailableStatus', unavailableNote: 'maritacaUnavailableNote',
19
+ noKeyStatus: 'maritacaNoKeyStatus', noKeyNote: 'maritacaNoKeyNote', openPanel: 'maritacaOpenPanel',
20
+ notRegisteredStatus: 'maritacaNotRegisteredStatus', notRegisteredNote: 'maritacaNotRegisteredNote', configure: 'maritacaConfigure',
21
+ registeredStatus: 'maritacaRegisteredStatus', registeredTag: 'maritacaRegisteredTag', keyFile: 'maritacaKeyFile', keyEnv: 'maritacaKeyEnv',
22
+ staleStatus: 'maritacaStaleStatus', staleNote: 'maritacaStaleNote', resync: 'maritacaResync',
23
+ configuringStatus: 'configuring', configuringNote: 'writingProviderConfig',
24
+ errorStatus: 'maritacaErrorStatus', error: 'error2',
25
+ remove: 'remove', removing: 'removing', model: 'model',
26
+ registeredToast: 'maritacaProviderRegistered', removedToast: 'maritacaProviderRemoved',
27
+ });
28
+
29
+ /**
30
+ * The card's state for a status answer. `status` is the JSON of GET /api/maritaca/opencode/status (or null when the
31
+ * request failed), `configuring` while a configure request is in flight, `error` the message of a failed configure.
32
+ */
33
+ export function maritacaOpencodeCardState(status, { configuring = false, error = '' } = {}) {
34
+ if (configuring) return 'configuring';
35
+ if (error) return 'error';
36
+ if (!status || status.ok === false || typeof status.registered !== 'boolean') return 'unavailable';
37
+ if (status.registered) return status.inSync ? 'registered' : 'stale';
38
+ return status.keyConfigured ? 'not-registered' : 'no-key';
39
+ }
40
+
41
+ /**
42
+ * Everything the card shows: `t(key, vars)` translates a `settings.redesign.opencode.*` key (the key without the prefix).
43
+ * → { state, dot, statusCls, statusText, note, tag, actions: [...'configure' | 'resync' | 'remove' | 'open-panel'], modelCount }
44
+ */
45
+ export function maritacaOpencodeCardView(status, t, { configuring = false, error = '' } = {}) {
46
+ const state = maritacaOpencodeCardState(status, { configuring, error });
47
+ const K = MARITACA_OPENCODE_KEYS;
48
+ const modelCount = Number(status?.modelCount) || 0;
49
+ const keySource = status?.keySource === 'env' ? t(K.keyEnv) : t(K.keyFile);
50
+ const view = { state, modelCount, actions: [], tag: '', note: '' };
51
+ switch (state) {
52
+ case 'configuring':
53
+ Object.assign(view, { dot: DOT.wait, statusCls: 'stg-provider-status-key', statusText: t(K.configuringStatus), note: t(K.configuringNote) });
54
+ break;
55
+ case 'unavailable':
56
+ Object.assign(view, { dot: DOT.off, statusCls: 'stg-provider-status-disconnected', statusText: t(K.unavailableStatus), note: t(K.unavailableNote) });
57
+ break;
58
+ case 'no-key':
59
+ Object.assign(view, { dot: DOT.wait, statusCls: 'stg-provider-status-key', statusText: t(K.noKeyStatus), note: t(K.noKeyNote), actions: ['open-panel'] });
60
+ break;
61
+ case 'not-registered':
62
+ Object.assign(view, { dot: DOT.wait, statusCls: 'stg-provider-status-key', statusText: t(K.notRegisteredStatus), note: t(K.notRegisteredNote, { source: keySource }), actions: ['configure'] });
63
+ break;
64
+ case 'stale':
65
+ Object.assign(view, { dot: DOT.wait, statusCls: 'stg-provider-status-key', statusText: t(K.staleStatus), note: t(K.staleNote), actions: ['resync', 'remove'] });
66
+ break;
67
+ case 'error':
68
+ Object.assign(view, { dot: DOT.off, statusCls: 'stg-provider-status-disconnected', statusText: t(K.errorStatus), note: t(K.error, { message: error }), actions: ['configure'] });
69
+ break;
70
+ default: // registered
71
+ Object.assign(view, {
72
+ dot: DOT.ok, statusCls: 'stg-provider-status-connected', statusText: t(K.registeredStatus),
73
+ tag: t(K.registeredTag, { source: keySource }), note: '', actions: ['remove'],
74
+ });
75
+ }
76
+ return view;
77
+ }
78
+
79
+ /** The OpenCode provider id the block is registered under: hidden ids are `maritaca/<model-id>`. */
80
+ export const MARITACA_OPENCODE_PROVIDER = 'maritaca';
81
+
82
+ /**
83
+ * The card's per-model visibility list, the same denylist the other provider cards write (ocp-hidden-models.js,
84
+ * "providerID/modelID"). Models come from the status answer (`status.models`, lib/maritaca/opencode.js); a server from
85
+ * before that field sends none, and then `fallback` (the model ids OpenCode lists for `maritaca`) stands in.
86
+ * Only a registered block (in sync or stale) has a list. → { rows: [{ id, fullId, name, hidden, tools }], enabled, total }
87
+ */
88
+ export function maritacaOpencodeModelRows(status, hidden = new Set(), fallback = []) {
89
+ const registered = !!status && status.ok !== false && status.registered === true;
90
+ if (!registered) return { rows: [], enabled: 0, total: 0 };
91
+ const has = (id) => (hidden && typeof hidden.has === 'function' ? hidden.has(id) : false);
92
+ const source = Array.isArray(status.models) && status.models.length
93
+ ? status.models
94
+ : (Array.isArray(fallback) ? fallback : []).map((m) => (typeof m === 'string' ? { id: m } : m));
95
+ const seen = new Set();
96
+ const rows = [];
97
+ for (const m of source) {
98
+ const id = typeof m?.id === 'string' ? m.id.trim() : '';
99
+ if (!id || seen.has(id)) continue;
100
+ seen.add(id);
101
+ const fullId = `${MARITACA_OPENCODE_PROVIDER}/${id}`;
102
+ rows.push({ id, fullId, name: typeof m.name === 'string' && m.name ? m.name : id, hidden: has(fullId), tools: typeof m.tools === 'boolean' ? m.tools : null });
103
+ }
104
+ return { rows, enabled: rows.filter((r) => !r.hidden).length, total: rows.length };
105
+ }
@@ -15,11 +15,13 @@
15
15
  import { sectionOpensByDefault } from './settings-ia.js';
16
16
  import { searchSettings, runtimeSearchEntries, highlightParts, SEARCH_LIMIT, SEARCH_QUERY_MAX } from './settings-search.js';
17
17
  import { tx, esc } from './settings-kit.js';
18
+ import { watchEmpty } from '../shown-children.js';
18
19
 
19
20
  const TOGGLE_KEYS = new Set(['Enter', ' ']);
20
21
  const KEY_ROLES = '[role="button"], [role="radio"], [role="switch"], [role="checkbox"], [role="tab"], [role="option"]';
21
22
  const NATIVE_CONTROLS = 'button, a[href], input, select, textarea, summary';
22
23
  const STATE_MIRRORS = '[data-stg-pressed], [data-stg-checked], [data-stg-selected]';
24
+ export const COLLAPSIBLE_BODY = '.stg-card[data-collapsible] > .stg-card-body';
23
25
 
24
26
  // ── Sections: which ones the user left open ──
25
27
  // One localStorage entry, { "<section id>": true | false }. A section the user never touched
@@ -217,6 +219,11 @@ export function wireSettingsShell(overlay, { activate }) {
217
219
  observer.observe(content, { subtree: true, childList: true, attributes: true, attributeFilter: ['class'] });
218
220
  overlay.addEventListener('settings-close', () => observer.disconnect());
219
221
 
222
+ // ── A collapsible card's body with nothing left to show says so (data-empty): styles.css drops its hairline
223
+ // and gap through that, never through a :has() (tests/css-has-performance.test.mjs) ──
224
+ const emptyBodies = watchEmpty(content, COLLAPSIBLE_BODY);
225
+ overlay.addEventListener('settings-close', () => emptyBodies.disconnect());
226
+
220
227
  // ── A pane's save bar sits over the bottom of the scroll area: the scroller is told how tall it is,
221
228
  // so a control that takes focus (or a deep link) never lands under the bar ──
222
229
  const syncBarRoom = () => {