synabun 2.4.0 → 2.4.2

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 (319) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +1 -1
  3. package/browser-extension/content.js +73 -11
  4. package/browser-extension/engine.js +196 -15
  5. package/browser-extension/manifest.json +4 -2
  6. package/browser-extension/popup-strings.js +10 -4
  7. package/browser-extension/popup-view.js +1 -1
  8. package/browser-extension/popup.css +1 -0
  9. package/browser-extension/popup.html +4 -1
  10. package/browser-extension/popup.js +22 -10
  11. package/browser-extension/protocol.js +102 -11
  12. package/browser-extension/service-worker.js +20 -4
  13. package/browser-extension/tokens.css +1 -1
  14. package/docs/browser-extension-bridge.md +25 -5
  15. package/lib/data-home-files.js +47 -0
  16. package/lib/data-home-migration.js +34 -58
  17. package/lib/first-launch-protection.js +8 -2
  18. package/lib/update-snapshot.js +11 -4
  19. package/mcp-server/dist/http.d.ts.map +1 -1
  20. package/mcp-server/dist/http.js +25 -2
  21. package/mcp-server/dist/http.js.map +1 -1
  22. package/mcp-server/dist/index.d.ts.map +1 -1
  23. package/mcp-server/dist/index.js +62 -17
  24. package/mcp-server/dist/index.js.map +1 -1
  25. package/mcp-server/dist/services/browser-bench.d.ts +22 -22
  26. package/mcp-server/dist/services/memory-maintenance.d.ts +1 -0
  27. package/mcp-server/dist/services/memory-maintenance.d.ts.map +1 -1
  28. package/mcp-server/dist/services/memory-maintenance.js +34 -45
  29. package/mcp-server/dist/services/memory-maintenance.js.map +1 -1
  30. package/mcp-server/dist/services/memory-migration-copy.d.ts +144 -0
  31. package/mcp-server/dist/services/memory-migration-copy.d.ts.map +1 -0
  32. package/mcp-server/dist/services/memory-migration-copy.js +467 -0
  33. package/mcp-server/dist/services/memory-migration-copy.js.map +1 -0
  34. package/mcp-server/dist/services/memory-migration-worker.d.ts +2 -0
  35. package/mcp-server/dist/services/memory-migration-worker.d.ts.map +1 -0
  36. package/mcp-server/dist/services/memory-migration-worker.js +60 -0
  37. package/mcp-server/dist/services/memory-migration-worker.js.map +1 -0
  38. package/mcp-server/dist/services/memory-retrieval.d.ts +4 -0
  39. package/mcp-server/dist/services/memory-retrieval.d.ts.map +1 -1
  40. package/mcp-server/dist/services/memory-retrieval.js +188 -40
  41. package/mcp-server/dist/services/memory-retrieval.js.map +1 -1
  42. package/mcp-server/dist/services/memory-schema.d.ts +58 -2
  43. package/mcp-server/dist/services/memory-schema.d.ts.map +1 -1
  44. package/mcp-server/dist/services/memory-schema.js +190 -13
  45. package/mcp-server/dist/services/memory-schema.js.map +1 -1
  46. package/mcp-server/dist/services/memory-sessions.d.ts +19 -1
  47. package/mcp-server/dist/services/memory-sessions.d.ts.map +1 -1
  48. package/mcp-server/dist/services/memory-sessions.js +56 -20
  49. package/mcp-server/dist/services/memory-sessions.js.map +1 -1
  50. package/mcp-server/dist/services/memory-verification.d.ts.map +1 -1
  51. package/mcp-server/dist/services/memory-verification.js +8 -5
  52. package/mcp-server/dist/services/memory-verification.js.map +1 -1
  53. package/mcp-server/dist/services/neural-interface.d.ts +6 -0
  54. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  55. package/mcp-server/dist/services/neural-interface.js +19 -2
  56. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  57. package/mcp-server/dist/services/retrieval-reader-worker.d.ts +2 -0
  58. package/mcp-server/dist/services/retrieval-reader-worker.d.ts.map +1 -0
  59. package/mcp-server/dist/services/retrieval-reader-worker.js +76 -0
  60. package/mcp-server/dist/services/retrieval-reader-worker.js.map +1 -0
  61. package/mcp-server/dist/services/retrieval-reader.d.ts +38 -0
  62. package/mcp-server/dist/services/retrieval-reader.d.ts.map +1 -0
  63. package/mcp-server/dist/services/retrieval-reader.js +145 -0
  64. package/mcp-server/dist/services/retrieval-reader.js.map +1 -0
  65. package/mcp-server/dist/services/sqlite-write.d.ts +14 -0
  66. package/mcp-server/dist/services/sqlite-write.d.ts.map +1 -0
  67. package/mcp-server/dist/services/sqlite-write.js +94 -0
  68. package/mcp-server/dist/services/sqlite-write.js.map +1 -0
  69. package/mcp-server/dist/services/sqlite.d.ts +39 -0
  70. package/mcp-server/dist/services/sqlite.d.ts.map +1 -1
  71. package/mcp-server/dist/services/sqlite.js +249 -8
  72. package/mcp-server/dist/services/sqlite.js.map +1 -1
  73. package/mcp-server/dist/services/tool-catalog.d.ts +1 -1
  74. package/mcp-server/dist/services/typesafe-config.d.ts +7 -1
  75. package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -1
  76. package/mcp-server/dist/services/typesafe-config.js +32 -10
  77. package/mcp-server/dist/services/typesafe-config.js.map +1 -1
  78. package/mcp-server/dist/services/typesafe.d.ts.map +1 -1
  79. package/mcp-server/dist/services/typesafe.js +9 -7
  80. package/mcp-server/dist/services/typesafe.js.map +1 -1
  81. package/mcp-server/dist/services/vector-cache.d.ts +32 -0
  82. package/mcp-server/dist/services/vector-cache.d.ts.map +1 -1
  83. package/mcp-server/dist/services/vector-cache.js +161 -8
  84. package/mcp-server/dist/services/vector-cache.js.map +1 -1
  85. package/mcp-server/dist/tools/agent-definition.d.ts +2 -2
  86. package/mcp-server/dist/tools/agents.d.ts +13 -8
  87. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  88. package/mcp-server/dist/tools/agents.js +35 -15
  89. package/mcp-server/dist/tools/agents.js.map +1 -1
  90. package/mcp-server/dist/tools/browser-advanced.d.ts +1 -1
  91. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  92. package/mcp-server/dist/tools/browser-advanced.js +10 -3
  93. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  94. package/mcp-server/dist/tools/browser-extension-setup.d.ts +5 -0
  95. package/mcp-server/dist/tools/browser-extension-setup.d.ts.map +1 -0
  96. package/mcp-server/dist/tools/browser-extension-setup.js +23 -0
  97. package/mcp-server/dist/tools/browser-extension-setup.js.map +1 -0
  98. package/mcp-server/dist/tools/browser-interact.d.ts.map +1 -1
  99. package/mcp-server/dist/tools/browser-interact.js +6 -1
  100. package/mcp-server/dist/tools/browser-interact.js.map +1 -1
  101. package/mcp-server/dist/tools/fb-groups.d.ts +2 -2
  102. package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
  103. package/mcp-server/dist/tools/tool-groups.d.ts +1 -1
  104. package/mcp-server/package-lock.json +2 -2
  105. package/mcp-server/package.json +1 -1
  106. package/mcp-server/src/http.ts +20 -2
  107. package/mcp-server/src/index.ts +59 -17
  108. package/mcp-server/src/services/memory-maintenance.ts +31 -28
  109. package/mcp-server/src/services/memory-migration-copy.ts +419 -0
  110. package/mcp-server/src/services/memory-migration-worker.ts +55 -0
  111. package/mcp-server/src/services/memory-retrieval.ts +173 -32
  112. package/mcp-server/src/services/memory-schema.ts +194 -12
  113. package/mcp-server/src/services/memory-sessions.ts +54 -21
  114. package/mcp-server/src/services/memory-verification.ts +7 -4
  115. package/mcp-server/src/services/neural-interface.ts +23 -2
  116. package/mcp-server/src/services/retrieval-reader-worker.ts +67 -0
  117. package/mcp-server/src/services/retrieval-reader.ts +131 -0
  118. package/mcp-server/src/services/sqlite-write.ts +60 -0
  119. package/mcp-server/src/services/sqlite.ts +246 -8
  120. package/mcp-server/src/services/typesafe-config.ts +25 -6
  121. package/mcp-server/src/services/typesafe.ts +9 -7
  122. package/mcp-server/src/services/vector-cache.ts +154 -9
  123. package/mcp-server/src/tools/agents.ts +33 -14
  124. package/mcp-server/src/tools/browser-advanced.ts +10 -3
  125. package/mcp-server/src/tools/browser-extension-setup.ts +30 -0
  126. package/mcp-server/src/tools/browser-interact.ts +5 -1
  127. package/neural-interface/i18n/en.json +266 -2
  128. package/neural-interface/i18n/pt-BR.json +267 -3
  129. package/neural-interface/lib/agents/builtins.json +207 -0
  130. package/neural-interface/lib/agents/registry.js +60 -15
  131. package/neural-interface/lib/agents/resolve.js +69 -10
  132. package/neural-interface/lib/agents/split.js +32 -4
  133. package/neural-interface/lib/assistant-api.js +19 -8
  134. package/neural-interface/lib/assistant-brains/claude.js +2 -0
  135. package/neural-interface/lib/assistant-brains/opencode.js +60 -11
  136. package/neural-interface/lib/assistant-catalog.js +2 -2
  137. package/neural-interface/lib/assistant-config.js +0 -7
  138. package/neural-interface/lib/assistant-dispatch.js +384 -119
  139. package/neural-interface/lib/assistant-persona.js +17 -5
  140. package/neural-interface/lib/assistant-pricing.js +65 -14
  141. package/neural-interface/lib/assistant-router.js +181 -54
  142. package/neural-interface/lib/assistant-run-wait.js +45 -28
  143. package/neural-interface/lib/assistant-runtime.js +48 -34
  144. package/neural-interface/lib/backup-contents.js +158 -0
  145. package/neural-interface/lib/backup-crypto-io.js +330 -0
  146. package/neural-interface/lib/backup-crypto-worker.js +130 -0
  147. package/neural-interface/lib/backup-crypto.js +525 -0
  148. package/neural-interface/lib/backup-download.js +268 -0
  149. package/neural-interface/lib/backup-encryption.js +318 -0
  150. package/neural-interface/lib/backup-groups.js +287 -0
  151. package/neural-interface/lib/backup-restore-session.js +176 -0
  152. package/neural-interface/lib/backup-restore-stage.js +60 -0
  153. package/neural-interface/lib/backup-service.js +836 -322
  154. package/neural-interface/lib/backup-zip-reader.js +30 -18
  155. package/neural-interface/lib/backup-zip-writer.js +34 -10
  156. package/neural-interface/lib/browser-extension-adapter.js +109 -24
  157. package/neural-interface/lib/browser-extension-bridge.js +42 -8
  158. package/neural-interface/lib/claude-agent-bridge.js +1 -0
  159. package/neural-interface/lib/claude-session-cleanup.js +5 -1
  160. package/neural-interface/lib/cli-update-planner.js +105 -6
  161. package/neural-interface/lib/client-diagnostics.js +42 -0
  162. package/neural-interface/lib/confined-fs.js +7 -2
  163. package/neural-interface/lib/coordination/README.md +8 -2
  164. package/neural-interface/lib/coordination/contract.js +161 -0
  165. package/neural-interface/lib/coordination/database.js +999 -0
  166. package/neural-interface/lib/coordination/operations.js +436 -0
  167. package/neural-interface/lib/coordination/service.js +68 -537
  168. package/neural-interface/lib/coordination/storage-worker.js +101 -0
  169. package/neural-interface/lib/coordination/store.js +219 -1111
  170. package/neural-interface/lib/db.js +70 -32
  171. package/neural-interface/lib/health-count.js +37 -0
  172. package/neural-interface/lib/loop-stall.js +139 -0
  173. package/neural-interface/lib/maritaca/client.js +2 -2
  174. package/neural-interface/lib/maritaca/models.js +12 -17
  175. package/neural-interface/lib/maritaca/opencode.js +4 -2
  176. package/neural-interface/lib/memory-api.js +9 -1
  177. package/neural-interface/lib/memory-session-capture.js +42 -10
  178. package/neural-interface/lib/memory-store-gate.js +313 -0
  179. package/neural-interface/lib/memory-store-migrate.js +65 -0
  180. package/neural-interface/lib/memory-timers.js +7 -7
  181. package/neural-interface/lib/native-loop-providers.js +13 -16
  182. package/neural-interface/lib/native-loop-runtime.js +34 -14
  183. package/neural-interface/lib/opencode-build-preflight.js +30 -8
  184. package/neural-interface/lib/opencode-native-boundary.js +69 -8
  185. package/neural-interface/lib/opencode-provider-view.js +14 -3
  186. package/neural-interface/lib/opencode-v2-ws-requests.js +31 -1
  187. package/neural-interface/lib/opencode2-client.js +2 -1
  188. package/neural-interface/lib/peer-identity.js +13 -8
  189. package/neural-interface/lib/recall-impact.js +122 -0
  190. package/neural-interface/lib/scratch-evidence.js +420 -0
  191. package/neural-interface/lib/scratch-process-guard.js +139 -0
  192. package/neural-interface/lib/scratch-references.js +279 -0
  193. package/neural-interface/lib/scratch-retention-core.js +385 -0
  194. package/neural-interface/lib/scratch-retention-worker.js +37 -0
  195. package/neural-interface/lib/scratch-retention.js +151 -0
  196. package/neural-interface/lib/session-cache-builder.js +70 -44
  197. package/neural-interface/lib/session-cache-worker.js +157 -0
  198. package/neural-interface/lib/session-indexer.js +28 -21
  199. package/neural-interface/lib/session-search-index.js +85 -0
  200. package/neural-interface/lib/skills/creation.js +1 -1
  201. package/neural-interface/lib/sqlite-integrity-worker.js +3 -1
  202. package/neural-interface/lib/style-guide/store.js +43 -3
  203. package/neural-interface/lib/system-restore.js +50 -0
  204. package/neural-interface/lib/teams/api.js +15 -6
  205. package/neural-interface/lib/teams/claims.js +67 -31
  206. package/neural-interface/lib/teams/index.js +7 -7
  207. package/neural-interface/lib/teams/integration.js +40 -40
  208. package/neural-interface/lib/teams/landing.js +6 -6
  209. package/neural-interface/lib/teams/recovery.js +24 -23
  210. package/neural-interface/lib/teams/scheduler.js +196 -97
  211. package/neural-interface/lib/teams/schema.js +1 -1
  212. package/neural-interface/lib/teams/state.js +14 -14
  213. package/neural-interface/lib/teams/worktrees.js +27 -27
  214. package/neural-interface/lib/whatsapp/bridge.js +2 -1
  215. package/neural-interface/lib/worker-confinement.js +47 -2
  216. package/neural-interface/lib/worker-mcp-channel.js +2 -0
  217. package/neural-interface/lib/worker-resume.js +5 -0
  218. package/neural-interface/lib/worker-stop.js +86 -0
  219. package/neural-interface/package-lock.json +2 -2
  220. package/neural-interface/package.json +1 -1
  221. package/neural-interface/public/index.html +260 -0
  222. package/neural-interface/public/offline.html +4 -3
  223. package/neural-interface/public/onboarding.html +259 -34
  224. package/neural-interface/public/shared/agents/studio/ax-agent-view.js +2 -2
  225. package/neural-interface/public/shared/agents/studio/ax-editor-view.js +1 -1
  226. package/neural-interface/public/shared/agents/studio/ax-library.js +0 -6
  227. package/neural-interface/public/shared/agents/studio/ax-main.js +14 -7
  228. package/neural-interface/public/shared/agents/studio/ax-ui.js +2 -2
  229. package/neural-interface/public/shared/agy/agy-options.js +11 -0
  230. package/neural-interface/public/shared/agy/agy-panel.js +29 -10
  231. package/neural-interface/public/shared/agy/agy-styles.js +14 -12
  232. package/neural-interface/public/shared/agy/agy-tabs-logic.js +4 -1
  233. package/neural-interface/public/shared/api.js +3 -2
  234. package/neural-interface/public/shared/assistant/asst-api.js +3 -3
  235. package/neural-interface/public/shared/assistant/asst-brain-picker.js +13 -6
  236. package/neural-interface/public/shared/assistant/asst-control.js +2 -0
  237. package/neural-interface/public/shared/assistant/asst-motion-gate.js +78 -4
  238. package/neural-interface/public/shared/assistant/asst-panel.js +18 -2
  239. package/neural-interface/public/shared/assistant/asst-rack-styles.js +4 -0
  240. package/neural-interface/public/shared/assistant/asst-render.js +106 -38
  241. package/neural-interface/public/shared/assistant/asst-route.js +102 -21
  242. package/neural-interface/public/shared/assistant/asst-routes-editor.js +1 -1
  243. package/neural-interface/public/shared/assistant/asst-sidepanel.js +4 -2
  244. package/neural-interface/public/shared/assistant/asst-state.js +11 -0
  245. package/neural-interface/public/shared/assistant/asst-styles.js +10 -23
  246. package/neural-interface/public/shared/assistant/route-identity.js +2 -1
  247. package/neural-interface/public/shared/cc-dropdown.js +21 -15
  248. package/neural-interface/public/shared/cdx/cdx-render.js +9 -0
  249. package/neural-interface/public/shared/cdx/cdx-settings.js +3 -1
  250. package/neural-interface/public/shared/cdx/cdx-styles.js +6 -0
  251. package/neural-interface/public/shared/cdx/cdx-tabs.js +29 -9
  252. package/neural-interface/public/shared/client-diagnostics.js +94 -0
  253. package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
  254. package/neural-interface/public/shared/cp/cp-styles.js +1 -1
  255. package/neural-interface/public/shared/effort-i18n.js +118 -0
  256. package/neural-interface/public/shared/html-shell.js +4 -51
  257. package/neural-interface/public/shared/loading-diagnostic-entry.js +64 -0
  258. package/neural-interface/public/shared/memory-store-wait.js +52 -0
  259. package/neural-interface/public/shared/morelogin-profile-field.js +1 -1
  260. package/neural-interface/public/shared/mtc/mtc-logic.js +2 -1
  261. package/neural-interface/public/shared/mtc/mtc-panel.js +8 -1
  262. package/neural-interface/public/shared/mtc/mtc-styles.js +13 -12
  263. package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +7 -0
  264. package/neural-interface/public/shared/ocp-v2/ocp-v2-location-logic.js +109 -0
  265. package/neural-interface/public/shared/ocp-v2/ocp-v2-modelpicker.js +8 -1
  266. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +118 -6
  267. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +27 -3
  268. package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +13 -0
  269. package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +2 -1
  270. package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +27 -93
  271. package/neural-interface/public/shared/ocp-v2/ocp-v2-variantpicker.js +17 -6
  272. package/neural-interface/public/shared/output-format.js +294 -0
  273. package/neural-interface/public/shared/owner-authority-view.js +4 -10
  274. package/neural-interface/public/shared/page-session.js +1 -1
  275. package/neural-interface/public/shared/provider-icons.js +6 -0
  276. package/neural-interface/public/shared/schedules-view.js +2 -1
  277. package/neural-interface/public/shared/server-presence.js +77 -0
  278. package/neural-interface/public/shared/settings/settings-ai-browser.js +5 -5
  279. package/neural-interface/public/shared/settings/settings-backup-contents.js +241 -0
  280. package/neural-interface/public/shared/settings/settings-backup-download.js +298 -0
  281. package/neural-interface/public/shared/settings/settings-backup-encryption-pane.js +335 -0
  282. package/neural-interface/public/shared/settings/settings-backup-encryption.js +545 -0
  283. package/neural-interface/public/shared/settings/settings-ia.js +1 -1
  284. package/neural-interface/public/shared/skills/studio/sx-geometry.js +12 -3
  285. package/neural-interface/public/shared/skills/studio/sx-main.js +14 -7
  286. package/neural-interface/public/shared/start-bridge.js +2 -2
  287. package/neural-interface/public/shared/studio-attention.js +6 -0
  288. package/neural-interface/public/shared/styles.css +354 -438
  289. package/neural-interface/public/shared/transcript-rows.js +28 -3
  290. package/neural-interface/public/shared/tray-auto-close.js +18 -5
  291. package/neural-interface/public/shared/ui-agents.js +1 -2
  292. package/neural-interface/public/shared/ui-automation-studio.js +168 -108
  293. package/neural-interface/public/shared/ui-claude-panel.js +42 -65
  294. package/neural-interface/public/shared/ui-loading.js +185 -25
  295. package/neural-interface/public/shared/ui-native-loop-router.js +59 -20
  296. package/neural-interface/public/shared/ui-navbar.js +2 -1
  297. package/neural-interface/public/shared/ui-output.js +533 -0
  298. package/neural-interface/public/shared/ui-owner-authority.js +48 -25
  299. package/neural-interface/public/shared/ui-schedules-studio.js +165 -128
  300. package/neural-interface/public/shared/ui-scroll-follow.js +97 -6
  301. package/neural-interface/public/shared/ui-sessions.js +2 -2
  302. package/neural-interface/public/shared/ui-settings-entry.js +18 -0
  303. package/neural-interface/public/shared/ui-settings.js +234 -67
  304. package/neural-interface/public/shared/ui-sidepanel-tray.js +3 -2
  305. package/neural-interface/public/shared/ui-sync.js +1 -0
  306. package/neural-interface/public/shared/ui-tooltip.js +16 -0
  307. package/neural-interface/public/shared/ui-tutorial.js +5 -6
  308. package/neural-interface/public/shared/ui-worker-end.js +27 -8
  309. package/neural-interface/public/shared/worker-end.js +9 -4
  310. package/neural-interface/public/sw.js +4 -3
  311. package/neural-interface/public/variant/2d/main.js +5 -0
  312. package/neural-interface/public/variant/3d/app.js +10 -0
  313. package/neural-interface/public/variant/3d/main.js +17 -4
  314. package/neural-interface/scripts/scratch-retention.mjs +20 -0
  315. package/neural-interface/server.js +507 -160
  316. package/npm-shrinkwrap.json +2 -2
  317. package/package.json +2 -1
  318. package/scripts/restore-data-home-from-backup.mjs +175 -8
  319. package/setup.js +18 -4
@@ -0,0 +1,118 @@
1
+ // Reasoning-effort words in the user's language. DOM-free, no imports (node --test and the panels load it).
2
+ // Display only: the id a panel stores or sends is never translated, and no code reads a label back.
3
+ //
4
+ // Words: `assistant.routes.effortWord.<id>`; menu descriptions: `assistant.routes.effortDesc.<slug>`.
5
+ // A locale that only repeats the English word, a key it lacks, an unknown id (an OpenCode variant name) and
6
+ // a missing translator all keep the text the caller had.
7
+
8
+ const lower = (value) => String(value ?? '').trim().toLowerCase();
9
+
10
+ /** The English forms a standard level goes by, so a label a provider wrote itself ("Balanced") is left alone. */
11
+ export const EFFORT_ENGLISH_FORMS = Object.freeze({
12
+ none: ['none', 'off'],
13
+ minimal: ['minimal'],
14
+ low: ['low', 'lo'],
15
+ medium: ['medium', 'med'],
16
+ high: ['high', 'hi'],
17
+ xhigh: ['xhigh', 'x-high', 'extra high', 'extra-high', 'xhi'],
18
+ max: ['max', 'maximum'],
19
+ ultra: ['ultra'],
20
+ });
21
+
22
+ /** The menu descriptions the effort lists carry, by their exact English text (the key under `effortDesc`). */
23
+ export const EFFORT_DESC_SLUGS = Object.freeze({
24
+ Minimal: 'minimal',
25
+ Light: 'light',
26
+ Balanced: 'balanced',
27
+ Deep: 'deep',
28
+ 'Very deep': 'veryDeep',
29
+ Maximum: 'maximum',
30
+ 'Maximum, with delegation': 'maximumDelegation',
31
+ 'Config default': 'configDefault',
32
+ 'Model default': 'modelDefault',
33
+ 'No thinking': 'noThinking',
34
+ });
35
+
36
+ /** The translated word for a level id, or null when there is none to show (Auto / Default `off`, unknown, English). */
37
+ export function translatedEffortWord(id, t) {
38
+ const key = lower(id);
39
+ // Only the standard ids have a word: an unknown id never asks the translator (it would log a missing key).
40
+ if (!key || key === 'off' || !EFFORT_ENGLISH_FORMS[key] || typeof t !== 'function') return null;
41
+ const path = `assistant.routes.effortWord.${key}`;
42
+ const value = t(path);
43
+ const english = key === 'none' ? 'off' : key;
44
+ return typeof value === 'string' && value && value !== path && value !== english ? value : null;
45
+ }
46
+
47
+ /**
48
+ * The word for a level whose label is a standard English one (or the id itself); any other label is the
49
+ * provider's own and stays as it is.
50
+ */
51
+ export function effortLabelFor(id, label, t) {
52
+ const key = lower(id);
53
+ const forms = EFFORT_ENGLISH_FORMS[key];
54
+ if (!forms) return label;
55
+ const shown = lower(label);
56
+ if (shown && !forms.includes(shown)) return label;
57
+ return translatedEffortWord(key, t) ?? label;
58
+ }
59
+
60
+ /** A menu description in the user's language when it is one of the standard English ones. */
61
+ export function effortDescFor(desc, t) {
62
+ const slug = EFFORT_DESC_SLUGS[desc];
63
+ if (!slug || typeof t !== 'function') return desc;
64
+ const path = `assistant.routes.effortDesc.${slug}`;
65
+ const value = t(path);
66
+ return typeof value === 'string' && value && value !== path ? value : desc;
67
+ }
68
+
69
+ // ── Claude Code panel: the Think toggle ──
70
+
71
+ /** The toggle's English text, per level: the button's short label and its tooltip. */
72
+ export const THINK_TOGGLE_ENGLISH = Object.freeze({
73
+ label: Object.freeze({ off: 'Think', low: 'lo', medium: 'med', high: 'hi', xhigh: 'xhi', max: 'max' }),
74
+ title: Object.freeze({
75
+ off: 'Thinking off',
76
+ low: 'Thinking: low',
77
+ medium: 'Thinking: medium',
78
+ high: 'Thinking: high',
79
+ xhigh: 'Thinking: extra high',
80
+ max: 'Thinking: max',
81
+ }),
82
+ });
83
+
84
+ /** The Think toggle's `label` or `title` for a level in the user's language (`effortUi.think.<part>.<level>`). */
85
+ export function thinkToggleText(part, level, t) {
86
+ const english = THINK_TOGGLE_ENGLISH[part]?.[level];
87
+ if (english === undefined) return part === 'label' ? THINK_TOGGLE_ENGLISH.label.off : '';
88
+ if (typeof t !== 'function') return english;
89
+ const path = `effortUi.think.${part}.${level}`;
90
+ const value = t(path);
91
+ return typeof value === 'string' && value && value !== path ? value : english;
92
+ }
93
+
94
+ // ── Codex panel: its own words (codexPanel.effort_<id>, so the button and the menu agree) ──
95
+
96
+ const CODEX_STANDARD_LABELS = Object.freeze({
97
+ off: 'Default', minimal: 'Minimal', low: 'Low', medium: 'Medium', high: 'High', xhigh: 'Extra high', max: 'Max', ultra: 'Ultra',
98
+ });
99
+
100
+ /**
101
+ * A Codex effort row's label through `text(key, english)` (cxpText). A label the model supplied itself, or any
102
+ * other level id, stays as it is; the raw id counts as the standard label (Settings lists `reasoningEffort`).
103
+ */
104
+ export function codexEffortLabel(id, label, text) {
105
+ const standard = CODEX_STANDARD_LABELS[id];
106
+ if (!standard || typeof text !== 'function' || (label !== standard && label !== id)) return label;
107
+ const word = text(id === 'off' ? 'default' : `effort_${id}`, standard);
108
+ return word === standard ? label : word;
109
+ }
110
+
111
+ /**
112
+ * A Codex effort row's description. The Default row's text comes from the panel's own words (the protocol
113
+ * helper only carries the English one); a description the model list supplied stays as it is.
114
+ */
115
+ export function codexEffortDesc(id, description, text) {
116
+ if (id === 'off') return typeof text === 'function' ? text('effortDefaultDesc', 'Use the model default') : 'Use the model default';
117
+ return description || '';
118
+ }
@@ -97,56 +97,6 @@ export function getSharedHTML() {
97
97
  <div id="app-frame-surface" aria-hidden="true"></div>
98
98
  <div id="app-frame" aria-hidden="true"></div>
99
99
 
100
- <!-- Loading Overlay -->
101
- <div id="loading-overlay">
102
- <div id="loading-mascot" data-state="asleep">
103
- <svg viewBox="0 0 280 140" width="160" height="80" style="overflow:visible" aria-hidden="true">
104
- <g class="syna-eye">
105
- <g class="syna-lid" transform="translate(0,60) scale(1,0.08) translate(0,-60)">
106
- <rect x="80" y="24" width="38" height="72" rx="19" fill="#ffffff"/>
107
- </g>
108
- </g>
109
- <g class="syna-eye">
110
- <g class="syna-lid" transform="translate(0,60) scale(1,0.08) translate(0,-60)">
111
- <rect x="162" y="24" width="38" height="72" rx="19" fill="#ffffff"/>
112
- </g>
113
- </g>
114
- <path d="M125,112 Q140,118 155,112" fill="none" stroke="rgba(255,255,255,0.15)" stroke-width="2.5" stroke-linecap="round"/>
115
- </svg>
116
- <span id="loading-zzz">z</span>
117
- </div>
118
- <img src="synabun.png?v=2" alt="SynaBun" class="loading-logo">
119
- <div id="loading-text">${t('loading.connecting')}</div>
120
- <div id="loading-sub">${t('loading.initializingNeural')}</div>
121
- <div id="loading-action">
122
- <button id="loading-action-btn" type="button">
123
- <svg viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round"><polygon points="5 3 19 12 5 21 5 3"/></svg>
124
- <span id="loading-action-label">${t('loading.startServer')}</span>
125
- </button>
126
- <div id="loading-action-status" role="status" aria-live="polite" aria-atomic="true"></div>
127
- <div id="loading-action-elapsed" role="timer" aria-live="off"></div>
128
- <div id="loading-action-hint"></div>
129
- <ul id="loading-action-trail"></ul>
130
- <div id="loading-action-log"></div>
131
- </div>
132
- <div id="loading-server-cmd">
133
- <div id="loading-server-cmd-hint">${t('loading.runCommand')}</div>
134
- <div id="loading-server-cmd-box">
135
- <code id="loading-cmd-text">npm start</code>
136
- <button id="loading-cmd-copy" title="${t('loading.copyToClipboard')}">
137
- <svg viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
138
- </button>
139
- </div>
140
- <br>
141
- <button id="loading-retry-btn" type="button">
142
- <svg viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
143
- ${t('loading.retryConnection')}
144
- </button>
145
- <div id="loading-retry-status"></div>
146
- <img src="synabun.png?v=2" alt="SynaBun" style="margin-top:6px;height:32px;width:auto;filter:grayscale(0.5);opacity:0.18;">
147
- </div>
148
- </div>
149
-
150
100
  <!-- Node Hover Tooltip -->
151
101
  <div id="tooltip" class="glass">
152
102
  <div id="tooltip-category"></div>
@@ -914,5 +864,8 @@ export function injectSharedHTML() {
914
864
  // The workspace sits in the inset rounded frame (app-frame.js): set before the shell lands, so nothing is laid
915
865
  // out once without it.
916
866
  document.documentElement.classList.add(FRAMED_CLASS);
917
- document.body.insertAdjacentHTML('afterbegin', getSharedHTML());
867
+ // Once per document: a second call would duplicate every id. The loading overlay is never part of the shell: the
868
+ // first frame (index.html) owns it and the shell takes that one over.
869
+ if (!document.getElementById('app-frame')) document.body.insertAdjacentHTML('afterbegin', getSharedHTML());
870
+ window.synabunAdoptLoading?.(t);
918
871
  }
@@ -0,0 +1,64 @@
1
+ // The complete wire format. Neither a health body, a translated subtitle, a URL,
2
+ // nor an exception/refusal message belongs in the trail or the server log.
3
+ export const DIAGNOSTIC_BATCH = 20;
4
+ const loadingTitles = [
5
+ 'loading.serverOffline', 'loading.connectionFailed', 'loading.health.databaseUnreachable.title',
6
+ 'loading.health.remoteUnreachable.title', 'loading.health.authError.title', 'loading.health.connectionError.title',
7
+ ];
8
+
9
+ const bool = value => typeof value === 'boolean';
10
+ const count = value => Number.isInteger(value) && value >= 1 && value <= 20;
11
+ const oneOf = (...values) => value => values.includes(value);
12
+ const states = oneOf('idle', 'launching', 'starting', 'waiting', 'stalled', 'failed', 'online', 'restarting', 'refused');
13
+ const moduleName = oneOf('entry', 'app');
14
+ const bootTag = value => typeof value === 'string' && /^(?:[0-9a-f]{8})?$/.test(value);
15
+ const events = {
16
+ 'startup-shown': {},
17
+ 'startup-status': { reason: oneOf('offline', 'loading', 'manual-retry') },
18
+ 'boot-complete': {},
19
+ // The first frame's overlay handed to the app's shell (taken over, or a shell's own overlay replaced it), and the
20
+ // first frame's fallback ended by the app's boot.
21
+ 'startup-adopt': { mode: oneOf('adopted', 'duplicate') },
22
+ 'boot-cleanup': { adopted: bool, removed: bool, hidden: bool, aborted: bool },
23
+ 'overlay-dedupe': { removed: count },
24
+ 'overlay-error': { title: oneOf(...loadingTitles, 'other'), serverOffline: bool },
25
+ 'overlay-reveal': { reason: oneOf('init', 'show', 'restart', 'probe') },
26
+ 'overlay-conceal': { reason: oneOf('hide', 'recovered', 'dismissed') },
27
+ 'hide-skipped': { state: states },
28
+ 'bridge-created': { reason: oneOf('restart', 'offline'), state: states },
29
+ 'bridge-stopped': { state: states },
30
+ 'bridge-state': { state: states },
31
+ 'bridge-probe': { result: oneOf('healthy', 'stopping', 'unhealthy', 'unreachable'), seenBoot: bootTag },
32
+ 'restart-request': { asked: bool, announced: bool, restartShown: bool, hasBridge: bool },
33
+ 'restart-snapshot': { asked: bool, accepted: bool, down: bool, refused: bool },
34
+ 'recover': { seenBoot: bootTag, needsReload: bool, appWasVisible: bool, restartShown: bool, reloadPending: bool },
35
+ 'reload-scheduled': { reason: oneOf('startup', 'restart', 'boot-changed', 'unknown-boot') },
36
+ 'probe-miss': { reason: oneOf('unreachable', 'unhealthy', 'stopping', 'boot-changed'), confirmation: bool },
37
+ // Probes went unanswered and the offline screen was held back (server-presence.js): the server is only slow, or
38
+ // the tab is hidden and cannot tell. Then the answer that ended that row, with how long it lasted.
39
+ 'probe-held': { reason: oneOf('slow', 'hidden'), misses: count },
40
+ 'probe-answered': { misses: count, seconds: value => Number.isInteger(value) && value >= 0 && value <= 3600 },
41
+ 'import-failed': { module: moduleName },
42
+ 'import-retry': { module: moduleName },
43
+ };
44
+
45
+ function matches(object, fields) {
46
+ return object !== null && typeof object === 'object' && !Array.isArray(object)
47
+ && Object.keys(object).length === Object.keys(fields).length
48
+ && Object.entries(fields).every(([key, accepts]) => Object.hasOwn(object, key) && accepts(object[key]));
49
+ }
50
+
51
+ const envelope = {
52
+ iso: s => typeof s === 'string' && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(s)
53
+ && Number.isFinite(Date.parse(s)) && new Date(s).toISOString() === s,
54
+ pageId: s => typeof s === 'string' && /^[a-f0-9]{12}$/.test(s),
55
+ currentBoot: bootTag,
56
+ visibility: oneOf('visible', 'hidden', 'prerender'),
57
+ event: s => typeof s === 'string' && Object.hasOwn(events, s),
58
+ data: value => value !== null && typeof value === 'object',
59
+ };
60
+
61
+ export function validDiagnosticEntry(entry) {
62
+ return matches(entry, envelope) && matches(entry.data, events[entry.event]);
63
+ }
64
+
@@ -0,0 +1,52 @@
1
+ // SynaBun — the page while the memory database is being upgraded.
2
+ //
3
+ // /api/health answers `ok: true` with a `store` block while the store is migrating (or its upgrade failed): the server
4
+ // is up, so this is never the offline screen. A page that starts then waits here, says what is happening, and goes on
5
+ // with its normal boot when the store is back, instead of reading a 503 as "connection failed".
6
+ //
7
+ // No imports and no DOM unless `show` touches it: tests/memory-store-wait.test.mjs runs it under node.
8
+
9
+ /** What a health answer asks the page to show, or null when the store can be read. */
10
+ export function memoryStoreHold(health) {
11
+ const state = health?.store?.state;
12
+ if (state === 'migrating') return { state, titleKey: 'loading.memoryStore.migratingTitle', subKey: 'loading.memoryStore.migratingSub' };
13
+ if (state === 'failed') return { state, titleKey: 'loading.memoryStore.failedTitle', detail: String(health.store.note || '') };
14
+ return null;
15
+ }
16
+
17
+ /**
18
+ * Wait until the store can be read. Resolves true when it had to wait (what was fetched meanwhile is stale), false
19
+ * when it did not. A health request that fails is not a verdict: the page's own presence check decides about offline.
20
+ * @param {object} health the answer the page already has
21
+ * @param {{ fetchHealth: () => Promise<object>, show: (hold: object) => void, sleep?: (ms: number) => Promise<void>, intervalMs?: number }} io
22
+ */
23
+ export async function waitForMemoryStore(health, { fetchHealth, show, sleep = (ms) => new Promise((done) => setTimeout(done, ms)), intervalMs = 2000 }) {
24
+ let hold = memoryStoreHold(health);
25
+ if (!hold) return false;
26
+ let shown = '';
27
+ while (hold) {
28
+ const key = `${hold.state}\n${hold.detail || ''}`;
29
+ if (key !== shown) { shown = key; show(hold); }
30
+ await sleep(intervalMs);
31
+ const next = await fetchHealth().catch(() => null);
32
+ // No answer, or an answer without the block from a server that is restarting: keep what is shown and ask again.
33
+ if (next?.ok === true) hold = memoryStoreHold(next);
34
+ }
35
+ return true;
36
+ }
37
+
38
+ /** The page's side: the loading overlay says it, in the page's language. */
39
+ export function holdForMemoryStore(health, { fetchHealth, t, showLoadingError, document: doc = globalThis.document }) {
40
+ return waitForMemoryStore(health, {
41
+ fetchHealth,
42
+ show(hold) {
43
+ if (hold.state === 'failed') { showLoadingError(t(hold.titleKey), hold.detail, false); return; }
44
+ const overlay = doc?.getElementById('loading-overlay');
45
+ overlay?.classList.remove('error', 'server-offline');
46
+ const text = doc?.getElementById('loading-text');
47
+ const sub = doc?.getElementById('loading-sub');
48
+ if (text) text.textContent = t(hold.titleKey);
49
+ if (sub) sub.textContent = t(hold.subKey);
50
+ },
51
+ });
52
+ }
@@ -178,7 +178,7 @@ function fieldHTML(field) {
178
178
  <div class="sched-form-stack">
179
179
  <div class="sched-form-control">
180
180
  ${popup}
181
- ${refresh('sched-icon-btn')}
181
+ ${refresh('sx-icon-btn sched-icon-btn')}
182
182
  </div>
183
183
  <p class="sched-help${warn ? ' sched-help--warn' : ''}" id="${esc(id)}-help"${status}>${help}</p>
184
184
  </div>
@@ -416,7 +416,8 @@ export function usageParts(usage, costBrl, T) {
416
416
  if (output) parts.push(T('usage_out', { value: fmt(output) }));
417
417
  if (cached) parts.push(T('usage_cached', { value: fmt(cached) }));
418
418
  }
419
- // A cost of exactly 0 is a free model's answer (S5-free) and is shown as R$ 0,00; null is "no price known".
419
+ // A cost of exactly 0 is a free model's answer (none is listed since S5-free was retired on 2026-11-18) and is
420
+ // shown as R$ 0,00; null is "no price known".
420
421
  if (costBrl !== null && costBrl !== undefined && Number.isFinite(Number(costBrl)) && (Number(costBrl) > 0 || usage)) parts.push(T('costBrl', { value: formatBrl(costBrl) }));
421
422
  return parts;
422
423
  }
@@ -1164,7 +1164,14 @@ function wire() {
1164
1164
  transcript?.addEventListener('keydown', (event) => {
1165
1165
  if (event.target.matches?.('.mtc-plan-feedback') && event.key === 'Enter' && (event.metaKey || event.ctrlKey)) { event.preventDefault(); runPlanAction('feedback'); }
1166
1166
  });
1167
- $('.mtc-jump')?.addEventListener('click', () => { const rt = runtimeOf(activeTab()); if (rt) rt.scrolledUp = false; if (transcript) transcript.scrollTop = transcript.scrollHeight; renderTranscript(); });
1167
+ $('.mtc-jump')?.addEventListener('click', () => {
1168
+ const rt = runtimeOf(activeTab());
1169
+ if (rt) rt.scrolledUp = false;
1170
+ _scroll?.scrollToBottom({ force: true, immediate: true });
1171
+ const jump = $('.mtc-jump');
1172
+ if (jump) jump.hidden = true;
1173
+ updateScrollEdges();
1174
+ });
1168
1175
  const form = $('.mtc-composer');
1169
1176
  const input = $('.mtc-input');
1170
1177
  form?.addEventListener('submit', (event) => { event.preventDefault(); if (activeTab()?.running) stop(); else send(); });
@@ -6,10 +6,13 @@
6
6
  // its mark and nothing else. Every rule below uses a token; add a value to the block first.
7
7
 
8
8
  import { installCodeCopy } from '../ui-code-copy.js';
9
+ import { installOutput } from '../ui-output.js';
9
10
 
10
11
  export function injectMaritacaStyles() {
11
12
  // The Copy button of every code block: its stylesheet and its one click listener, in this document.
12
13
  installCodeCopy(document);
14
+ // The reading layer of an agent's answer (prose, tables, code): one stylesheet for the six panels.
15
+ installOutput(document);
13
16
  if (document.getElementById('maritaca-panel-styles')) return;
14
17
  const style = document.createElement('style');
15
18
  style.id = 'maritaca-panel-styles';
@@ -146,18 +149,9 @@ export function injectMaritacaStyles() {
146
149
  .mtc-msg-user .mtc-msg-card { max-width: 85%; border-radius: var(--mtc-radius-lg); background: var(--mtc-surface-2); padding: var(--mtc-space-2) var(--mtc-space-3); }
147
150
  .mtc-msg-text { white-space: pre-wrap; word-break: break-word; font-size: var(--mtc-fs-md); line-height: var(--mtc-lh); }
148
151
  .mtc-msg-agent { flex-direction: column; color: var(--mtc-text); word-break: break-word; gap: 4px; }
149
- .mtc-md { font-size: var(--mtc-fs-md); line-height: var(--mtc-lh); color: var(--mtc-text); min-width: 0; overflow-wrap: anywhere; }
150
- .mtc-md > :first-child { margin-top: 0; } .mtc-md > :last-child { margin-bottom: 0; }
151
- .mtc-md :is(p, ul, ol, pre, blockquote, table) { margin: 0 0 8px; }
152
- .mtc-md :is(h1, h2, h3, h4) { margin: 12px 0 6px; font-size: var(--mtc-fs-lg); font-weight: 600; line-height: var(--mtc-lh-tight); }
153
- .mtc-md :is(ul, ol) { padding-left: 18px; }
154
- .mtc-md a { color: var(--mtc-link); }
155
- .mtc-md code { font-family: var(--mtc-mono); font-size: 0.92em; background: var(--mtc-surface-2); padding: 1px 4px; border-radius: var(--mtc-radius-sm); }
156
- .mtc-md pre { background: var(--mtc-surface-1); border-radius: var(--mtc-radius-md); padding: 8px 10px; overflow-x: auto; font: var(--mtc-fs-sm)/1.55 var(--mtc-mono); }
157
- .mtc-md pre code { background: none; padding: 0; }
158
- .mtc-md blockquote { border-left: 2px solid var(--mtc-border-strong); padding-left: 10px; color: var(--mtc-text-2); }
159
- .mtc-md table { border-collapse: collapse; display: block; overflow-x: auto; }
160
- .mtc-md :is(th, td) { border: 1px solid var(--mtc-border); padding: 3px 8px; text-align: left; }
152
+ /* An answer's prose, tables and code are the shared reading layer (../ui-output.js): one system for the six
153
+ side panels. A tag is never styled here again; this panel's voice is its link colour. */
154
+ .mtc-md { --sbo-link: var(--mtc-link); }
161
155
  .mtc-thought { margin: 2px 0; font-size: var(--mtc-fs-sm); color: var(--mtc-text-3); flex-shrink: 0; }
162
156
  .mtc-thought summary { cursor: pointer; list-style: none; padding: 4px 0; display: inline-flex; align-items: center; gap: 6px; }
163
157
  .mtc-thought summary::-webkit-details-marker { display: none; }
@@ -435,6 +429,13 @@ export function injectMaritacaStyles() {
435
429
  @media (prefers-reduced-motion: reduce) {
436
430
  .mtc-panel, .mtc-panel *, .mtc-panel *::before, .mtc-panel *::after, .mtc-session-pill, .mtc-session-pill *, .mtc-pop, .mtc-pop * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
437
431
  }
432
+
433
+ /* ── Reading pass (2026-11-21) ──
434
+ An answer's prose, tables and code are ../ui-output.js. Here: what the user wrote reads at the answer's size,
435
+ a turn's footer is legible, and a touch screen (no hover) always shows a message's Copy / Edit / Retry. */
436
+ .mtc-msg-text { font-size: var(--mtc-fs-lg); }
437
+ .mtc-turn-foot { font-size: var(--mtc-fs-sm); }
438
+ @media (hover: none) { .mtc-turn-actions { opacity: 1; } }
438
439
  `;
439
440
  document.head.appendChild(style);
440
441
  }
@@ -16,6 +16,8 @@
16
16
  // shown: a session with many sub-agents costs a store and a pill each.
17
17
  // ─────────────────────────────────────────────────────────────────────────────
18
18
 
19
+ import { getProviderMeta, isMaritacaModel } from '../provider-icons.js';
20
+
19
21
  import { state, emit } from '../state.js';
20
22
  import { injectStyles } from './ocp-v2-styles.js';
21
23
  import { getDefaultStore } from './ocp-v2-state.js';
@@ -547,6 +549,11 @@ export function createChildPanel({
547
549
  function renderPill() {
548
550
  if (!_trayPill || _destroyed) return;
549
551
  const s = store.getState();
552
+ const brand = isMaritacaModel(s.model || s.sessionInfo?.model) ? 'maritaca' : 'opencode';
553
+ if (_trayPill.dataset.modelBrand !== brand) {
554
+ _trayPill.querySelector('.term-minimized-pill-icon').innerHTML = brand === 'maritaca' ? getProviderMeta(brand).icon : OPENCODE_ICON;
555
+ _trayPill.dataset.modelBrand = brand;
556
+ }
550
557
  const said = pillState(s, { visible: _visible, started });
551
558
  const arrows = '↳'.repeat(Math.max(1, Math.min(3, (Number(depth) || 0) + 1)));
552
559
  _pillLabel.textContent = `${arrows} ${sessionTitleFor(store)}`;
@@ -0,0 +1,109 @@
1
+ // ─────────────────────────────────────────────────────────────────────────────
2
+ // OpenCode V2 — a session whose folder is gone
3
+ //
4
+ // OpenCode binds a session to the folder it was created in, for good. When that
5
+ // folder no longer exists (a worktree that was removed, a project that was
6
+ // moved), OpenCode 2 still lists the session and even creates a new one there,
7
+ // and then refuses every prompt of it: 404 "Location not found: <folder>".
8
+ // Sending another folder with the prompt changes nothing.
9
+ //
10
+ // So the panel cannot repair such a session: it moves on. This module decides
11
+ // (DOM-free, unit-tested; the server imports the message and the code):
12
+ // • which folder an error says is gone, and whether it is this panel's;
13
+ // • where to go instead: the registered project the folder was inside (the
14
+ // project root of a removed worktree), else no project at all, which is the
15
+ // folder SynaBun's OpenCode serve runs in;
16
+ // • what to tell the user.
17
+ // ocp-v2-panel.js does the moving (a new session in the other folder).
18
+ // ─────────────────────────────────────────────────────────────────────────────
19
+
20
+ /** The `code` of a refusal SynaBun's server makes for a folder that does not exist. */
21
+ export const LOCATION_MISSING_CODE = 'LOCATION_MISSING';
22
+
23
+ /** OpenCode's own sentence for it; SynaBun's server refuses in the same words, so one reading covers both. */
24
+ export function locationNotFoundMessage(directory) {
25
+ return `Location not found: ${String(directory || '').trim()}`;
26
+ }
27
+
28
+ const LOCATION_NOT_FOUND_RE = /Location not found:\s*(\S.*?)\s*$/i;
29
+
30
+ /** The folder an error message says is gone, or null when it says nothing of the kind. */
31
+ export function missingLocationOf(message) {
32
+ const text = typeof message === 'string' ? message : String(message?.message || message?.error || '');
33
+ const match = text.match(LOCATION_NOT_FOUND_RE);
34
+ return match ? match[1] : null;
35
+ }
36
+
37
+ // A folder as it is compared: one kind of separator, no trailing one, and no
38
+ // letter case on a Windows drive path.
39
+ function folderKey(folder) {
40
+ let key = String(folder || '').trim().replace(/\\/g, '/');
41
+ if (key.length > 1) key = key.replace(/\/+$/, '') || '/';
42
+ if (/^[A-Za-z]:(\/|$)/.test(key)) key = key.toLowerCase();
43
+ return key;
44
+ }
45
+
46
+ /** Whether two paths name the same folder (separators, a trailing slash, a Windows drive's case). */
47
+ export function sameFolder(a, b) {
48
+ const left = folderKey(a);
49
+ return !!left && left === folderKey(b);
50
+ }
51
+
52
+ /** Whether `folder` is `parent` or inside it. */
53
+ export function folderInside(folder, parent) {
54
+ const inner = folderKey(folder);
55
+ const outer = folderKey(parent);
56
+ if (!inner || !outer) return false;
57
+ if (inner === outer) return true;
58
+ return inner.startsWith(outer.endsWith('/') ? outer : `${outer}/`);
59
+ }
60
+
61
+ const projectPathOf = (project) => (typeof project === 'string' ? project : String(project?.path || ''));
62
+
63
+ /**
64
+ * Where to work instead of a folder that is gone: the deepest registered
65
+ * project that contains it (and is not one of `avoid`, the folders already
66
+ * found gone), else '' — no project, the folder the serve itself runs in.
67
+ */
68
+ export function fallbackProjectFor(missing, projects, { avoid = [] } = {}) {
69
+ const gone = [missing, ...avoid].filter(Boolean);
70
+ let best = '';
71
+ for (const project of Array.isArray(projects) ? projects : []) {
72
+ const path = projectPathOf(project);
73
+ if (!path || !folderInside(missing, path)) continue;
74
+ if (gone.some((folder) => sameFolder(folder, path))) continue;
75
+ if (folderKey(path).length > folderKey(best).length) best = path;
76
+ }
77
+ return best;
78
+ }
79
+
80
+ /**
81
+ * The folder an error names as gone, when it is this panel's: the project it
82
+ * is on, or the folder of the session on screen. Null otherwise (an error about
83
+ * something else, or about a folder that is not this panel's to leave).
84
+ */
85
+ export function missingPanelLocation({ message, cwd = '', sessionDirectory = '' } = {}) {
86
+ const missing = missingLocationOf(message);
87
+ if (!missing) return null;
88
+ return sameFolder(missing, cwd) || sameFolder(missing, sessionDirectory) ? missing : null;
89
+ }
90
+
91
+ /** What the user is told once the panel has moved on. */
92
+ export function locationRecoveryNotice({ missing, fallback } = {}) {
93
+ const gone = `The folder ${missing} no longer exists, so OpenCode cannot run a session there.`;
94
+ return fallback
95
+ ? `${gone} A new session was started in ${fallback}. Send your message again.`
96
+ : `${gone} A new session was started without a project: choose one in the project menu, then send your message again.`;
97
+ }
98
+
99
+ /**
100
+ * The move for a folder that is gone: `{ missing, fallback, notice }`, or null
101
+ * when there is nowhere better to go (the panel is already on no project, and
102
+ * no registered project holds the folder: moving again would change nothing).
103
+ */
104
+ export function planLocationRecovery({ missing, cwd = '', projects = [], avoid = [] } = {}) {
105
+ if (!missing) return null;
106
+ const fallback = fallbackProjectFor(missing, projects, { avoid });
107
+ if (!fallback && !folderKey(cwd)) return null;
108
+ return { missing, fallback, notice: locationRecoveryNotice({ missing, fallback }) };
109
+ }
@@ -5,6 +5,8 @@
5
5
  // as { providerID, modelID } so api.send() can pass it through to OpenCode.
6
6
  // ─────────────────────────────────────────────────────────────────────────────
7
7
 
8
+ import { getProviderMeta, isMaritacaModel } from '../provider-icons.js';
9
+
8
10
  import { fetchProvidersFull } from './ocp-v2-providers.js';
9
11
  import { opencodeProviders } from '../opencode-providers.js';
10
12
  import { modelRowMeta } from './ocp-v2-status-logic.js';
@@ -219,6 +221,7 @@ function applyLabelFromState() {
219
221
  }
220
222
  const label = m.modelID || '';
221
223
  _label.textContent = label || _dd?.dataset.placeholder || 'model...';
224
+ if (isMaritacaModel(m)) _label.insertAdjacentHTML('afterbegin', maritacaMark());
222
225
  _dd?.classList.add('has-value');
223
226
  }
224
227
 
@@ -615,6 +618,10 @@ function connectProviderOption() {
615
618
  return opt;
616
619
  }
617
620
 
621
+ function maritacaMark() {
622
+ return `<span class="ocpv2-model-mark" aria-hidden="true">${getProviderMeta('maritaca').icon}</span>`;
623
+ }
624
+
618
625
  function makeOption(provId, entry, currentFull, favorites) {
619
626
  const fullId = `${provId}/${entry.id}`;
620
627
  const badges = capBadgesHtml(entry._obj);
@@ -631,7 +638,7 @@ function makeOption(provId, entry, currentFull, favorites) {
631
638
  // every row maps onto the same 4-column grid (name | meta | caps | star).
632
639
  const meta = modelRowMeta(entry._obj);
633
640
  opt.innerHTML =
634
- `<span class="ocpv2-dd-model-name">${escHtml(entry.id)}</span>`
641
+ `<span class="ocpv2-dd-model-name">${isMaritacaModel(fullId) ? maritacaMark() : ''}${escHtml(entry.id)}</span>`
635
642
  + `<span class="ocpv2-dd-model-meta">${meta.status ? `<span class="ocpv2-dd-model-status">${escHtml(meta.status)}</span>` : ''}${escHtml(meta.price)}</span>`
636
643
  + `<span class="ocpv2-dd-caps">${badges}</span>`;
637
644