synabun 2.4.1 → 2.4.3

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 (345) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -1
  3. package/docs/browser-extension-bridge.md +46 -6
  4. package/lib/data-home-files.js +4 -2
  5. package/lib/first-launch-protection.js +8 -2
  6. package/lib/release-npm-ci.mjs +23 -1
  7. package/lib/update-snapshot.js +11 -4
  8. package/mcp-server/dist/http.d.ts.map +1 -1
  9. package/mcp-server/dist/http.js +25 -2
  10. package/mcp-server/dist/http.js.map +1 -1
  11. package/mcp-server/dist/index.d.ts.map +1 -1
  12. package/mcp-server/dist/index.js +62 -17
  13. package/mcp-server/dist/index.js.map +1 -1
  14. package/mcp-server/dist/services/browser-bench.d.ts +22 -22
  15. package/mcp-server/dist/services/memory-maintenance.d.ts +1 -0
  16. package/mcp-server/dist/services/memory-maintenance.d.ts.map +1 -1
  17. package/mcp-server/dist/services/memory-maintenance.js +34 -45
  18. package/mcp-server/dist/services/memory-maintenance.js.map +1 -1
  19. package/mcp-server/dist/services/memory-migration-copy.d.ts +144 -0
  20. package/mcp-server/dist/services/memory-migration-copy.d.ts.map +1 -0
  21. package/mcp-server/dist/services/memory-migration-copy.js +467 -0
  22. package/mcp-server/dist/services/memory-migration-copy.js.map +1 -0
  23. package/mcp-server/dist/services/memory-migration-worker.d.ts +2 -0
  24. package/mcp-server/dist/services/memory-migration-worker.d.ts.map +1 -0
  25. package/mcp-server/dist/services/memory-migration-worker.js +60 -0
  26. package/mcp-server/dist/services/memory-migration-worker.js.map +1 -0
  27. package/mcp-server/dist/services/memory-retrieval.d.ts +4 -0
  28. package/mcp-server/dist/services/memory-retrieval.d.ts.map +1 -1
  29. package/mcp-server/dist/services/memory-retrieval.js +188 -40
  30. package/mcp-server/dist/services/memory-retrieval.js.map +1 -1
  31. package/mcp-server/dist/services/memory-schema.d.ts +58 -2
  32. package/mcp-server/dist/services/memory-schema.d.ts.map +1 -1
  33. package/mcp-server/dist/services/memory-schema.js +190 -13
  34. package/mcp-server/dist/services/memory-schema.js.map +1 -1
  35. package/mcp-server/dist/services/memory-sessions.d.ts +19 -1
  36. package/mcp-server/dist/services/memory-sessions.d.ts.map +1 -1
  37. package/mcp-server/dist/services/memory-sessions.js +56 -20
  38. package/mcp-server/dist/services/memory-sessions.js.map +1 -1
  39. package/mcp-server/dist/services/memory-verification.d.ts.map +1 -1
  40. package/mcp-server/dist/services/memory-verification.js +8 -5
  41. package/mcp-server/dist/services/memory-verification.js.map +1 -1
  42. package/mcp-server/dist/services/neural-interface.d.ts +5 -0
  43. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  44. package/mcp-server/dist/services/neural-interface.js +19 -2
  45. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  46. package/mcp-server/dist/services/retrieval-reader-worker.d.ts +2 -0
  47. package/mcp-server/dist/services/retrieval-reader-worker.d.ts.map +1 -0
  48. package/mcp-server/dist/services/retrieval-reader-worker.js +76 -0
  49. package/mcp-server/dist/services/retrieval-reader-worker.js.map +1 -0
  50. package/mcp-server/dist/services/retrieval-reader.d.ts +38 -0
  51. package/mcp-server/dist/services/retrieval-reader.d.ts.map +1 -0
  52. package/mcp-server/dist/services/retrieval-reader.js +145 -0
  53. package/mcp-server/dist/services/retrieval-reader.js.map +1 -0
  54. package/mcp-server/dist/services/sqlite-write.d.ts +14 -0
  55. package/mcp-server/dist/services/sqlite-write.d.ts.map +1 -0
  56. package/mcp-server/dist/services/sqlite-write.js +94 -0
  57. package/mcp-server/dist/services/sqlite-write.js.map +1 -0
  58. package/mcp-server/dist/services/sqlite.d.ts +39 -0
  59. package/mcp-server/dist/services/sqlite.d.ts.map +1 -1
  60. package/mcp-server/dist/services/sqlite.js +249 -8
  61. package/mcp-server/dist/services/sqlite.js.map +1 -1
  62. package/mcp-server/dist/services/tool-catalog.d.ts +1 -1
  63. package/mcp-server/dist/services/typesafe-config.d.ts +7 -1
  64. package/mcp-server/dist/services/typesafe-config.d.ts.map +1 -1
  65. package/mcp-server/dist/services/typesafe-config.js +32 -10
  66. package/mcp-server/dist/services/typesafe-config.js.map +1 -1
  67. package/mcp-server/dist/services/typesafe.d.ts.map +1 -1
  68. package/mcp-server/dist/services/typesafe.js +9 -7
  69. package/mcp-server/dist/services/typesafe.js.map +1 -1
  70. package/mcp-server/dist/services/vector-cache.d.ts +32 -0
  71. package/mcp-server/dist/services/vector-cache.d.ts.map +1 -1
  72. package/mcp-server/dist/services/vector-cache.js +161 -8
  73. package/mcp-server/dist/services/vector-cache.js.map +1 -1
  74. package/mcp-server/dist/tools/agent-definition.d.ts +2 -2
  75. package/mcp-server/dist/tools/agents.d.ts +11 -7
  76. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  77. package/mcp-server/dist/tools/agents.js +27 -9
  78. package/mcp-server/dist/tools/agents.js.map +1 -1
  79. package/mcp-server/dist/tools/browser-advanced.d.ts +1 -1
  80. package/mcp-server/dist/tools/browser-advanced.d.ts.map +1 -1
  81. package/mcp-server/dist/tools/browser-advanced.js +10 -3
  82. package/mcp-server/dist/tools/browser-advanced.js.map +1 -1
  83. package/mcp-server/dist/tools/browser-extension-setup.d.ts +5 -0
  84. package/mcp-server/dist/tools/browser-extension-setup.d.ts.map +1 -0
  85. package/mcp-server/dist/tools/browser-extension-setup.js +29 -0
  86. package/mcp-server/dist/tools/browser-extension-setup.js.map +1 -0
  87. package/mcp-server/dist/tools/browser-interact.d.ts.map +1 -1
  88. package/mcp-server/dist/tools/browser-interact.js +6 -1
  89. package/mcp-server/dist/tools/browser-interact.js.map +1 -1
  90. package/mcp-server/dist/tools/fb-groups.d.ts +2 -2
  91. package/mcp-server/dist/tools/skill-tools.d.ts +4 -4
  92. package/mcp-server/dist/tools/tool-groups.d.ts +1 -1
  93. package/mcp-server/package-lock.json +5 -5
  94. package/mcp-server/package.json +1 -1
  95. package/mcp-server/src/http.ts +20 -2
  96. package/mcp-server/src/index.ts +59 -17
  97. package/mcp-server/src/services/memory-maintenance.ts +31 -28
  98. package/mcp-server/src/services/memory-migration-copy.ts +419 -0
  99. package/mcp-server/src/services/memory-migration-worker.ts +55 -0
  100. package/mcp-server/src/services/memory-retrieval.ts +173 -32
  101. package/mcp-server/src/services/memory-schema.ts +194 -12
  102. package/mcp-server/src/services/memory-sessions.ts +54 -21
  103. package/mcp-server/src/services/memory-verification.ts +7 -4
  104. package/mcp-server/src/services/neural-interface.ts +22 -2
  105. package/mcp-server/src/services/retrieval-reader-worker.ts +67 -0
  106. package/mcp-server/src/services/retrieval-reader.ts +131 -0
  107. package/mcp-server/src/services/sqlite-write.ts +60 -0
  108. package/mcp-server/src/services/sqlite.ts +246 -8
  109. package/mcp-server/src/services/typesafe-config.ts +25 -6
  110. package/mcp-server/src/services/typesafe.ts +9 -7
  111. package/mcp-server/src/services/vector-cache.ts +154 -9
  112. package/mcp-server/src/tools/agents.ts +26 -9
  113. package/mcp-server/src/tools/browser-advanced.ts +10 -3
  114. package/mcp-server/src/tools/browser-extension-setup.ts +36 -0
  115. package/mcp-server/src/tools/browser-interact.ts +5 -1
  116. package/neural-interface/i18n/en.json +313 -2
  117. package/neural-interface/i18n/pt-BR.json +321 -10
  118. package/neural-interface/lib/agents/split.js +32 -4
  119. package/neural-interface/lib/assistant-api.js +52 -8
  120. package/neural-interface/lib/assistant-brains/claude.js +2 -0
  121. package/neural-interface/lib/assistant-brains/opencode.js +121 -7
  122. package/neural-interface/lib/assistant-catalog.js +2 -2
  123. package/neural-interface/lib/assistant-config.js +0 -7
  124. package/neural-interface/lib/assistant-dispatch.js +281 -95
  125. package/neural-interface/lib/assistant-envelope.js +40 -0
  126. package/neural-interface/lib/assistant-persona.js +16 -4
  127. package/neural-interface/lib/assistant-pricing.js +65 -14
  128. package/neural-interface/lib/assistant-router.js +131 -47
  129. package/neural-interface/lib/assistant-run-wait.js +45 -28
  130. package/neural-interface/lib/assistant-runtime.js +133 -42
  131. package/neural-interface/lib/backup-contents.js +158 -0
  132. package/neural-interface/lib/backup-crypto-io.js +330 -0
  133. package/neural-interface/lib/backup-crypto-worker.js +130 -0
  134. package/neural-interface/lib/backup-crypto.js +525 -0
  135. package/neural-interface/lib/backup-download.js +268 -0
  136. package/neural-interface/lib/backup-encryption.js +318 -0
  137. package/neural-interface/lib/backup-groups.js +287 -0
  138. package/neural-interface/lib/backup-restore-session.js +176 -0
  139. package/neural-interface/lib/backup-restore-stage.js +60 -0
  140. package/neural-interface/lib/backup-service.js +788 -233
  141. package/neural-interface/lib/backup-zip-reader.js +30 -18
  142. package/neural-interface/lib/backup-zip-writer.js +34 -10
  143. package/neural-interface/lib/browser-extension-adapter.js +89 -15
  144. package/neural-interface/lib/browser-extension-archive.js +149 -0
  145. package/neural-interface/lib/browser-extension-bridge.js +24 -10
  146. package/neural-interface/lib/browser-extension-folder.js +596 -76
  147. package/neural-interface/lib/browser-extension-package.js +200 -0
  148. package/neural-interface/lib/browser-extension-pin.js +84 -0
  149. package/neural-interface/lib/browser-extension-pin.json +33 -0
  150. package/{browser-extension/protocol.js → neural-interface/lib/browser-extension-protocol.js} +91 -6
  151. package/neural-interface/lib/browser-extension-setup.js +105 -18
  152. package/neural-interface/lib/claude-agent-bridge.js +1 -0
  153. package/neural-interface/lib/claude-session-cleanup.js +5 -1
  154. package/neural-interface/lib/cli-install.js +23 -3
  155. package/neural-interface/lib/cli-update-planner.js +171 -9
  156. package/neural-interface/lib/client-diagnostics.js +42 -0
  157. package/neural-interface/lib/confined-fs.js +7 -2
  158. package/neural-interface/lib/coordination/README.md +8 -2
  159. package/neural-interface/lib/coordination/contract.js +161 -0
  160. package/neural-interface/lib/coordination/database.js +999 -0
  161. package/neural-interface/lib/coordination/operations.js +436 -0
  162. package/neural-interface/lib/coordination/service.js +68 -537
  163. package/neural-interface/lib/coordination/storage-worker.js +101 -0
  164. package/neural-interface/lib/coordination/store.js +219 -1111
  165. package/neural-interface/lib/db.js +70 -32
  166. package/neural-interface/lib/health-count.js +37 -0
  167. package/neural-interface/lib/loop-stall.js +139 -0
  168. package/neural-interface/lib/maritaca/client.js +2 -2
  169. package/neural-interface/lib/maritaca/models.js +12 -17
  170. package/neural-interface/lib/maritaca/opencode.js +4 -2
  171. package/neural-interface/lib/memory-api.js +9 -1
  172. package/neural-interface/lib/memory-session-capture.js +42 -10
  173. package/neural-interface/lib/memory-store-gate.js +313 -0
  174. package/neural-interface/lib/memory-store-migrate.js +65 -0
  175. package/neural-interface/lib/memory-timers.js +7 -7
  176. package/neural-interface/lib/native-loop-providers.js +23 -17
  177. package/neural-interface/lib/native-loop-runtime.js +48 -9
  178. package/neural-interface/lib/opencode-build-preflight.js +18 -1
  179. package/neural-interface/lib/opencode-native-boundary.js +69 -8
  180. package/neural-interface/lib/opencode-provider-view.js +14 -3
  181. package/neural-interface/lib/opencode-shell-read.js +107 -0
  182. package/neural-interface/lib/opencode-stop-failures.js +40 -0
  183. package/neural-interface/lib/opencode-turn-release.js +173 -0
  184. package/neural-interface/lib/opencode-v2-client.js +4 -1
  185. package/neural-interface/lib/opencode-v2-ws-requests.js +65 -1
  186. package/neural-interface/lib/opencode2-client.js +343 -7
  187. package/neural-interface/lib/opencode2-translate.js +161 -4
  188. package/neural-interface/lib/recall-impact.js +122 -0
  189. package/neural-interface/lib/scratch-evidence.js +420 -0
  190. package/neural-interface/lib/scratch-process-guard.js +139 -0
  191. package/neural-interface/lib/scratch-references.js +279 -0
  192. package/neural-interface/lib/scratch-retention-core.js +385 -0
  193. package/neural-interface/lib/scratch-retention-worker.js +37 -0
  194. package/neural-interface/lib/scratch-retention.js +151 -0
  195. package/neural-interface/lib/session-cache-builder.js +31 -43
  196. package/neural-interface/lib/session-cache-worker.js +157 -0
  197. package/neural-interface/lib/session-indexer.js +28 -21
  198. package/neural-interface/lib/session-search-index.js +85 -0
  199. package/neural-interface/lib/skills/creation.js +1 -1
  200. package/neural-interface/lib/sqlite-integrity-worker.js +3 -1
  201. package/neural-interface/lib/style-guide/store.js +43 -3
  202. package/neural-interface/lib/system-restore.js +50 -0
  203. package/neural-interface/lib/teams/api.js +15 -6
  204. package/neural-interface/lib/teams/claims.js +67 -31
  205. package/neural-interface/lib/teams/index.js +7 -7
  206. package/neural-interface/lib/teams/integration.js +40 -40
  207. package/neural-interface/lib/teams/landing.js +6 -6
  208. package/neural-interface/lib/teams/recovery.js +24 -23
  209. package/neural-interface/lib/teams/scheduler.js +194 -95
  210. package/neural-interface/lib/teams/state.js +14 -14
  211. package/neural-interface/lib/teams/worktrees.js +27 -27
  212. package/neural-interface/lib/terminal-token-redaction.js +83 -0
  213. package/neural-interface/lib/whatsapp/bridge.js +54 -7
  214. package/neural-interface/lib/worker-confinement.js +47 -2
  215. package/neural-interface/lib/worker-mcp-channel.js +2 -0
  216. package/neural-interface/lib/worker-resume.js +5 -0
  217. package/neural-interface/lib/worker-stop.js +86 -0
  218. package/neural-interface/package-lock.json +5 -5
  219. package/neural-interface/package.json +1 -1
  220. package/neural-interface/public/extension-setup.html +5 -2
  221. package/neural-interface/public/index.html +233 -24
  222. package/neural-interface/public/onboarding.html +259 -34
  223. package/neural-interface/public/shared/agents/studio/ax-library.js +0 -6
  224. package/neural-interface/public/shared/agents/studio/ax-main.js +14 -7
  225. package/neural-interface/public/shared/agy/agy-options.js +11 -0
  226. package/neural-interface/public/shared/agy/agy-panel.js +67 -20
  227. package/neural-interface/public/shared/agy/agy-styles.js +14 -12
  228. package/neural-interface/public/shared/agy/agy-tabs-logic.js +4 -1
  229. package/neural-interface/public/shared/api.js +1 -1
  230. package/neural-interface/public/shared/assistant/asst-api.js +28 -3
  231. package/neural-interface/public/shared/assistant/asst-brain-picker.js +13 -6
  232. package/neural-interface/public/shared/assistant/asst-control.js +2 -0
  233. package/neural-interface/public/shared/assistant/asst-motion-gate.js +78 -4
  234. package/neural-interface/public/shared/assistant/asst-panel.js +87 -3
  235. package/neural-interface/public/shared/assistant/asst-rack-styles.js +27 -0
  236. package/neural-interface/public/shared/assistant/asst-render.js +243 -44
  237. package/neural-interface/public/shared/assistant/asst-route.js +100 -21
  238. package/neural-interface/public/shared/assistant/asst-routes-editor.js +1 -1
  239. package/neural-interface/public/shared/assistant/asst-shell-logic.js +200 -0
  240. package/neural-interface/public/shared/assistant/asst-shell.js +111 -0
  241. package/neural-interface/public/shared/assistant/asst-sidepanel.js +4 -2
  242. package/neural-interface/public/shared/assistant/asst-state.js +11 -0
  243. package/neural-interface/public/shared/assistant/asst-styles.js +11 -23
  244. package/neural-interface/public/shared/assistant/route-identity.js +2 -1
  245. package/neural-interface/public/shared/cdx/cdx-render.js +9 -0
  246. package/neural-interface/public/shared/cdx/cdx-settings.js +3 -1
  247. package/neural-interface/public/shared/cdx/cdx-styles.js +6 -0
  248. package/neural-interface/public/shared/cdx/cdx-tabs.js +54 -9
  249. package/neural-interface/public/shared/client-diagnostics.js +94 -0
  250. package/neural-interface/public/shared/cp/cp-markdown.js +7 -2
  251. package/neural-interface/public/shared/cp/cp-styles.js +1 -1
  252. package/neural-interface/public/shared/effort-i18n.js +118 -0
  253. package/neural-interface/public/shared/extension-setup/es-page.js +10 -4
  254. package/neural-interface/public/shared/extension-setup/es-view.js +25 -10
  255. package/neural-interface/public/shared/html-shell.js +4 -52
  256. package/neural-interface/public/shared/loading-diagnostic-entry.js +64 -0
  257. package/neural-interface/public/shared/memory-store-wait.js +52 -0
  258. package/neural-interface/public/shared/morelogin-profile-field.js +1 -1
  259. package/neural-interface/public/shared/mtc/mtc-logic.js +2 -1
  260. package/neural-interface/public/shared/mtc/mtc-panel.js +25 -3
  261. package/neural-interface/public/shared/mtc/mtc-styles.js +13 -12
  262. package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +7 -0
  263. package/neural-interface/public/shared/ocp-v2/ocp-v2-events.js +5 -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-manager.js +1 -0
  266. package/neural-interface/public/shared/ocp-v2/ocp-v2-modelpicker.js +8 -1
  267. package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +152 -8
  268. package/neural-interface/public/shared/ocp-v2/ocp-v2-rehydrate.js +7 -1
  269. package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +53 -4
  270. package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +52 -6
  271. package/neural-interface/public/shared/ocp-v2/ocp-v2-session-actions.js +22 -2
  272. package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-block.js +165 -0
  273. package/neural-interface/public/shared/ocp-v2/ocp-v2-shell-logic.js +346 -0
  274. package/neural-interface/public/shared/ocp-v2/ocp-v2-shell.js +108 -0
  275. package/neural-interface/public/shared/ocp-v2/ocp-v2-state.js +49 -3
  276. package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +67 -93
  277. package/neural-interface/public/shared/ocp-v2/ocp-v2-tools-logic.js +20 -5
  278. package/neural-interface/public/shared/ocp-v2/ocp-v2-tools.js +7 -1
  279. package/neural-interface/public/shared/ocp-v2/ocp-v2-variantpicker.js +17 -6
  280. package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +7 -2
  281. package/neural-interface/public/shared/output-format.js +294 -0
  282. package/neural-interface/public/shared/provider-icons.js +6 -0
  283. package/neural-interface/public/shared/schedules-view.js +2 -1
  284. package/neural-interface/public/shared/server-presence.js +77 -0
  285. package/neural-interface/public/shared/settings/settings-backup-contents.js +241 -0
  286. package/neural-interface/public/shared/settings/settings-backup-download.js +298 -0
  287. package/neural-interface/public/shared/settings/settings-backup-encryption-pane.js +335 -0
  288. package/neural-interface/public/shared/settings/settings-backup-encryption.js +545 -0
  289. package/neural-interface/public/shared/settings/settings-browser-extension.js +54 -12
  290. package/neural-interface/public/shared/settings/settings-ia.js +1 -1
  291. package/neural-interface/public/shared/shell-stop-view.js +83 -0
  292. package/neural-interface/public/shared/skills/studio/sx-geometry.js +12 -3
  293. package/neural-interface/public/shared/skills/studio/sx-main.js +14 -7
  294. package/neural-interface/public/shared/studio-attention.js +6 -0
  295. package/neural-interface/public/shared/styles.css +341 -437
  296. package/neural-interface/public/shared/tour/tour-actor.js +14 -3
  297. package/neural-interface/public/shared/transcript-rows.js +28 -3
  298. package/neural-interface/public/shared/tray-auto-close.js +49 -6
  299. package/neural-interface/public/shared/ui-agents.js +1 -2
  300. package/neural-interface/public/shared/ui-automation-studio.js +168 -108
  301. package/neural-interface/public/shared/ui-claude-panel.js +62 -65
  302. package/neural-interface/public/shared/ui-loading.js +124 -17
  303. package/neural-interface/public/shared/ui-native-loop-router.js +52 -0
  304. package/neural-interface/public/shared/ui-navbar.js +2 -1
  305. package/neural-interface/public/shared/ui-output.js +533 -0
  306. package/neural-interface/public/shared/ui-schedules-studio.js +165 -128
  307. package/neural-interface/public/shared/ui-scroll-follow.js +101 -6
  308. package/neural-interface/public/shared/ui-sessions.js +2 -2
  309. package/neural-interface/public/shared/ui-settings-entry.js +18 -0
  310. package/neural-interface/public/shared/ui-settings.js +224 -65
  311. package/neural-interface/public/shared/ui-sidepanel-tray.js +3 -2
  312. package/neural-interface/public/shared/ui-tooltip.js +16 -0
  313. package/neural-interface/public/shared/ui-tutorial.js +5 -6
  314. package/neural-interface/public/shared/ui-worker-end.js +27 -8
  315. package/neural-interface/public/shared/worker-end.js +9 -4
  316. package/neural-interface/public/variant/2d/main.js +5 -0
  317. package/neural-interface/public/variant/3d/app.js +10 -0
  318. package/neural-interface/public/variant/3d/main.js +5 -1
  319. package/neural-interface/scripts/scratch-retention.mjs +20 -0
  320. package/neural-interface/server.js +725 -173
  321. package/npm-shrinkwrap.json +5 -5
  322. package/package.json +1 -2
  323. package/scripts/restore-data-home-from-backup.mjs +175 -8
  324. package/setup.js +18 -4
  325. package/browser-extension/content.js +0 -189
  326. package/browser-extension/engine.js +0 -508
  327. package/browser-extension/icons/icon-128.png +0 -0
  328. package/browser-extension/icons/icon-16.png +0 -0
  329. package/browser-extension/icons/icon-32.png +0 -0
  330. package/browser-extension/icons/icon-48.png +0 -0
  331. package/browser-extension/icons/status-off-16.png +0 -0
  332. package/browser-extension/icons/status-off-32.png +0 -0
  333. package/browser-extension/icons/status-off-48.png +0 -0
  334. package/browser-extension/icons/status-on-16.png +0 -0
  335. package/browser-extension/icons/status-on-32.png +0 -0
  336. package/browser-extension/icons/status-on-48.png +0 -0
  337. package/browser-extension/manifest.json +0 -56
  338. package/browser-extension/popup-strings.js +0 -250
  339. package/browser-extension/popup-view.js +0 -151
  340. package/browser-extension/popup.css +0 -166
  341. package/browser-extension/popup.html +0 -108
  342. package/browser-extension/popup.js +0 -359
  343. package/browser-extension/service-worker.js +0 -275
  344. package/browser-extension/setup-content.js +0 -36
  345. package/browser-extension/tokens.css +0 -326
@@ -44,8 +44,8 @@
44
44
  // open is the character on screen, its face a live rig (liveAsk,
45
45
  // activateRigs); every other card's face is a painted still.
46
46
 
47
- import { assistantEventKey, fmtCost, fmtElapsed, isRemovableRun, isTerminalRunStatus, modelShortName, providerShortLabel, routeTargetLabel, runTone, summarizeMailbox } from './asst-state.js';
48
- import { createRouteLine } from './asst-route.js';
47
+ import { assistantEventKey, displayProvider, fmtCost, fmtElapsed, isRemovableRun, isTerminalRunStatus, modelShortName, providerShortLabel, routeTargetLabel, runTone, summarizeMailbox } from './asst-state.js';
48
+ import { createRouteLine, routeClassLabel } from './asst-route.js';
49
49
  import { closeMenu, isMenuOpen } from './asst-menu.js';
50
50
  import { computerToolName, describeComputerAction, frameUrls, markerPercent, openFrameLightbox, parseComputerResult, swapImage } from './asst-computer.js';
51
51
  import * as mascotLib from '../synabun-mascot.js';
@@ -55,11 +55,12 @@ import { injectRackStyles } from './asst-rack-styles.js';
55
55
  import { injectSceneStyles } from './asst-scene-styles.js';
56
56
  import { activityScene, compactActivity, isLivePhase, runChip, sceneOfClass, sceneSvg, stagePhase } from './asst-scenes.js';
57
57
  import { STAGE_TIMING, createWorkerStage } from './asst-run-stage.js';
58
- import { createMotionGate } from './asst-motion-gate.js';
58
+ import { SETTLE_FRAMES, createMotionGate } from './asst-motion-gate.js';
59
59
  import { createStyleCache } from './asst-style-cache.js';
60
60
  import { formatRunTokens } from './asst-usage.js';
61
61
  import { sanitizeHtmlString, sanitizeInto } from './asst-sanitize.js';
62
62
  import { decorateCodeBlocks } from '../ui-code-copy.js';
63
+ import { decorateOutput } from '../ui-output.js';
63
64
  import { renderStreamingMarkdown } from '../streaming-markdown.js';
64
65
  import { automationView } from './asst-automation.js';
65
66
  import { guessFollowups, splitFollowups } from './asst-followups.js';
@@ -70,7 +71,8 @@ import { createLimitDock } from './asst-limit-dock.js';
70
71
  import { createLimitWait } from './asst-limit-wait.js';
71
72
  import { synabunToolKey, synabunToolLabel } from '../synabun-tools.js';
72
73
  import { normalizeToolHeartbeat } from '../tool-heartbeat.js';
73
- import { closedSidepanelOf, createShownGate } from '../sidepanel-shown.js';
74
+ import { createStickyScrollController } from '../ui-scroll-follow.js';
75
+ import { createShownGate } from '../sidepanel-shown.js';
74
76
 
75
77
  // ── Markdown (lazy marked, the vendored build the sidepanels use too) ───────────────
76
78
  let _marked = null;
@@ -221,8 +223,9 @@ export function updateRunCard(card, run, opts = {}) {
221
223
  const provider = run.provider || 'claude-code';
222
224
  const icon = card.querySelector('.asst-run-icon');
223
225
  if (icon) {
224
- icon.innerHTML = typeof opts.providerIcon === 'function' ? (opts.providerIcon(provider) || '') : '';
225
- const color = typeof opts.providerColor === 'function' ? opts.providerColor(provider) : '';
226
+ const brand = displayProvider(run) || provider;
227
+ icon.innerHTML = typeof opts.providerIcon === 'function' ? (opts.providerIcon(brand) || '') : '';
228
+ const color = typeof opts.providerColor === 'function' ? opts.providerColor(brand) : '';
226
229
  if (color) card.style.setProperty('--asst-provider-color', color);
227
230
  }
228
231
  const title = card.querySelector('.asst-run-title');
@@ -257,7 +260,7 @@ export function updateRunCard(card, run, opts = {}) {
257
260
  if (run.agentRef) bits.push(`<span>${esc(run.agentRef)}</span>`);
258
261
  if (run.route && typeof run.route === 'object') {
259
262
  const r = run.route;
260
- const routeBits = [r.taskClassLabel || r.taskClass || t('assistant.routes.task', 'task')];
263
+ const routeBits = [(r.taskClass ? routeClassLabel(r.taskClass, r.taskClassLabel || r.taskClass, t) : r.taskClassLabel) || t('assistant.routes.task', 'task')];
261
264
  if (r.status === 'pending') routeBits.push(t('assistant.routes.state.pending', 'waiting for your choice'));
262
265
  else if (r.decidedBy === 'budget' || r.source === 'budget') routeBits.push(t('assistant.routes.budgetDecision', 'budget re-route'));
263
266
  else if (r.decidedBy === 'user') routeBits.push(t('assistant.routes.youChose', 'you chose'));
@@ -496,6 +499,8 @@ const PREVIEW_LINES = 5;
496
499
  const THINK_PREVIEW_LINES = 10;
497
500
  const MAX_DIFF_LINES = 400; // an edit's mini diff draws this many lines; "Show full input" draws the rest
498
501
  // The empty state's suggestions (asst-panel.js ids) and the kind each one is about.
502
+ // A tool result that only says its command went on in the background (OpenCode 2.3): none of the output is in it.
503
+ const isBackgroundNotice = (result) => typeof result === 'string' && /^Command moved to the background \(shell ID: /.test(result);
499
504
  const SUGGESTION_KINDS = { computer: 'computer', web: 'web', fix: 'edit', skill: 'skill', schedule: 'plan', remember: 'memory' };
500
505
 
501
506
  /**
@@ -511,7 +516,11 @@ const SUGGESTION_KINDS = { computer: 'computer', web: 'web', fix: 'edit', skill:
511
516
  * ({ status, resetsAt } | null), brainProvider() → the brain's provider id, onLimitRetry(text)
512
517
  * (Retry now on the Assistant's own limit card: send `text`), onSwitchProvider(anchorEl, { excludeProvider, retryText })
513
518
  * (Continue with another provider on the Assistant's own limit card: the host opens its own
514
- * provider picker anchored on anchorEl and decides what a pick does) }
519
+ * provider picker anchored on anchorEl and decides what a pick does),
520
+ * onMotionMark(holderEl, off) (a holder's off-screen mark changed, asst-motion-gate.js: a host that
521
+ * skips far rows keeps the holder's row plain until the mark is styled),
522
+ * onRackFolded(rackRow) (a rack's stage has folded and its row was measured: `is-folding` just left
523
+ * the row, which a host that skips far rows kept plain while it carried it) }
515
524
  */
516
525
  export function createRenderer(transcriptEl, hooks = {}) {
517
526
  loadMarked();
@@ -530,8 +539,22 @@ export function createRenderer(transcriptEl, hooks = {}) {
530
539
  // The open card's slot under every row (asst-ask-tail.js): a card that waits on the user is drawn
531
540
  // there, above the "Working…" row, until it is answered; rows appended meanwhile go above it.
532
541
  const askTail = createAskTail($msgs, { anchor: () => (working?.parentNode === $msgs ? working : null) });
533
- let followTail = true;
534
- let scrollFrame = 0;
542
+ // The transcript follows its bottom through the shared sidepanel controller (ui-scroll-follow.js), as
543
+ // the Claude, Codex, OpenCode and Maritaca panels do: one follow state, detached only by a real upward
544
+ // movement or wheel/keyboard/touch intent (never by the controller's own scroll events), reattached at
545
+ // the bottom, and a MutationObserver/ResizeObserver watch that follows late layout (an image arriving, a
546
+ // font swap, a highlight pass) and a message area whose height changes. Its writes are instant: the
547
+ // transcript's smooth scroll-behavior is for the reader's own scrolling, not for the follow. A closed
548
+ // side panel's transcript is not laid out: the controller keeps the scroll until the panel is shown.
549
+ const scrollFollow = createStickyScrollController($msgs);
550
+ let followHeld = false; // the empty state is up: nothing follows (holdFollow)
551
+ // A cleared transcript's old offset outlives its rows until the next layout: an empty state drawn now would
552
+ // open part-way down, off its character. Back to the top, when the panel is shown if it is closed (no layout
553
+ // there); rows that arrived meanwhile are the follow's.
554
+ const topGate = createShownGate($msgs, () => {
555
+ if (!followHeld && $msgs.firstElementChild) return;
556
+ try { $msgs.scrollTo({ top: 0, behavior: 'instant' }); } catch { $msgs.scrollTop = 0; }
557
+ });
535
558
  let emptyEl = null;
536
559
  let hero = null; // the empty state's character: { rig, el, box, parked, leaving, held, dock, egg, target }
537
560
  const mcpWarned = new Set();
@@ -589,7 +612,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
589
612
  try { fontSet?.addEventListener?.('loadingdone', onFontsLoaded); } catch { /* no FontFaceSet events */ }
590
613
  const stopFontWatch = () => { try { fontSet?.removeEventListener?.('loadingdone', onFontsLoaded); } catch { /* gone */ } };
591
614
  // The transcript's loops run only while their holder is on screen (run cards, racks, route lines).
592
- const motion = createMotionGate();
615
+ const motion = createMotionGate({ onMark: hooks.onMotionMark });
593
616
  const stageResizes = typeof ResizeObserver === 'function' ? new ResizeObserver((entries) => {
594
617
  for (const entry of entries) {
595
618
  const seen = stageWidths.get(entry.target);
@@ -620,13 +643,6 @@ export function createRenderer(transcriptEl, hooks = {}) {
620
643
  const SEEN_MAX = 5000;
621
644
  let snapshot = null;
622
645
 
623
- $msgs.addEventListener('scroll', () => {
624
- // Inside a closed side panel nobody scrolls: the follow stays what it was, and no height is read
625
- // (reading it lays the hidden panel out; sidepanel-shown.js).
626
- if (closedSidepanelOf($msgs)) return;
627
- followTail = isNearBottom();
628
- }, { passive: true });
629
-
630
646
  const t = (key, fallback, params) => {
631
647
  const v = typeof hooks.t === 'function' ? hooks.t(key, params) : undefined;
632
648
  if (v && v !== key && typeof v === 'string') return v;
@@ -665,22 +681,23 @@ export function createRenderer(transcriptEl, hooks = {}) {
665
681
  return $msgs.scrollHeight - $msgs.scrollTop - $msgs.clientHeight < 48;
666
682
  }
667
683
 
668
- // The scroll to the newest row, on the next frame. A transcript inside a closed side panel has no layout:
669
- // scrolling it there read its height, which made the engine lay the whole hidden panel out, at every load
670
- // and for every row a session added meanwhile. The scroll is kept and made when the panel is shown.
671
- const endGate = createShownGate($msgs, () => {
672
- if (scrollFrame) return;
673
- scrollFrame = requestAnimationFrame(() => {
674
- scrollFrame = 0;
675
- if (closedSidepanelOf($msgs)) { endGate.request(); return; } // closed again before the frame
676
- $msgs.scrollTop = $msgs.scrollHeight;
677
- });
678
- });
679
-
684
+ // The scroll to the newest row: the shared controller's follow write, on its generation-checked frame.
685
+ // A transcript inside a closed side panel has no layout: scrolling it there read its height, which made
686
+ // the engine lay the whole hidden panel out, at every load and for every row a session added meanwhile.
687
+ // The controller keeps the scroll and makes it when the panel is shown (ui-scroll-follow.js).
680
688
  function scrollEnd(force = false) {
681
- if (!force && !followTail) return;
682
- if (scrollFrame) return;
683
- endGate.request();
689
+ scrollFollow.scrollToBottom({ force });
690
+ }
691
+
692
+ // The empty state is not a transcript to follow: its bottom is the starters, and following it when a long
693
+ // draft grows the composer pushed the character out of view (parkHero then has no hero to hand off). The
694
+ // controller is off while it is the only thing here, and the first real row starts the follow, whatever
695
+ // the reader did to the empty state's scroll meanwhile.
696
+ function holdFollow(held) {
697
+ if (followHeld === held) return;
698
+ followHeld = held;
699
+ if (!held) scrollFollow.setFollowing(true);
700
+ scrollFollow.setActive(!held);
684
701
  }
685
702
 
686
703
  function root() { return { container: $msgs, stream: null, key: null, msgId: null, lastAt: 0 }; }
@@ -710,6 +727,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
710
727
  closeEmptyMenu();
711
728
  emptyEl.remove();
712
729
  emptyEl = null;
730
+ holdFollow(false);
713
731
  }
714
732
 
715
733
  /** A menu opened from the empty state's project picker does not outlive it. */
@@ -975,6 +993,8 @@ export function createRenderer(transcriptEl, hooks = {}) {
975
993
  mdInto(body, text);
976
994
  // Every code block gets the shared Copy button (../ui-code-copy.js), also each piece a stream draws.
977
995
  decorateCodeBlocks(body);
996
+ // The reading layer all six panels share (../ui-output.js): a table's frame, task items, a diff's lines.
997
+ decorateOutput(body);
978
998
  body.querySelectorAll('pre code').forEach((code) => {
979
999
  const lang = (code.className || '').replace('language-', '').trim();
980
1000
  if (lang) code.parentElement.dataset.lang = lang;
@@ -1428,6 +1448,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
1428
1448
  step.endedAt = nowMs();
1429
1449
  step.timed = step.timed && isTimed();
1430
1450
  if (step.kind === 'runs') noteAgentResult(text);
1451
+ if (step.shell) applyShellOutcome(step);
1431
1452
  refreshStep(step);
1432
1453
  if (step.bodyBuilt) fillCallBody(step);
1433
1454
  if (step.state === 'error') onFailure(step);
@@ -1455,9 +1476,89 @@ export function createRenderer(transcriptEl, hooks = {}) {
1455
1476
  placeStep(rack, step);
1456
1477
  if (!muted && turnActive && !step.auto) { turn.calls += 1; turn.last = step; }
1457
1478
  if (rack.steps.length === 1 && !muted && turnActive) announce(rack, stepSentence(step, step.state === 'running'));
1479
+ if (step.kind === 'shell') syncShell(step); // its command may be known already (a panel that attached mid-run)
1458
1480
  return step;
1459
1481
  }
1460
1482
 
1483
+ // ── A shell call's command (an OpenCode brain: asst-shell-logic.js) ──
1484
+ /** What the runtime says about the call's command: the row's state word, its failure, its terminal block. */
1485
+ function syncShell(step) {
1486
+ const shell = hooks.shells?.forCall?.(step.id) || null;
1487
+ if (!shell) return;
1488
+ const wasRunning = step.shell?.status === 'running';
1489
+ step.shell = shell;
1490
+ if (wasRunning && shell.status !== 'running' && step.state !== 'running') step.endedAt = nowMs();
1491
+ // OpenCode announces a call before its input: the row and the stage read the command from here then.
1492
+ const learned = !commandOf(step.input || {}) && !!shell.command;
1493
+ if (learned) step.input = canonicalToolInput({ ...(step.input || {}), command: shell.command });
1494
+ applyShellOutcome(step);
1495
+ refreshStep(step);
1496
+ if (learned && step.bodyBuilt) fillCallBody(step);
1497
+ // The turn was told over before its command (a Stop): the row settles now, as it would have at the turn's end.
1498
+ if (wasRunning && shell.status !== 'running' && !turnActive) foldShellRows();
1499
+ if (shell.status === 'running' && (shell.waited || turnActive)) openForShell(step);
1500
+ syncTerminal(step);
1501
+ }
1502
+
1503
+ /** A command that failed after its tool call had answered (it went on in the background) fails the call. */
1504
+ function applyShellOutcome(step) {
1505
+ if (step.state !== 'ok' || !hooks.shells?.failedLate?.(step.shell)) return;
1506
+ step.state = 'error';
1507
+ step.code = typeof step.shell.exit === 'number' ? step.shell.exit : null;
1508
+ onFailure(step);
1509
+ }
1510
+
1511
+ /** A running command's output is on screen without a click, unless the reader closed that row. */
1512
+ function openForShell(step) {
1513
+ const { rack, station: st } = step;
1514
+ if (!st || st.userSet || rack.userSet) return;
1515
+ if (!st.open) { st.autoOpened = true; setStationOpen(rack, st, true); }
1516
+ if (!rack.open && !rack.staged) { rack.autoOpened = true; setRackOpen(rack, true); }
1517
+ }
1518
+
1519
+ /** A block exists only while its row is open: a closed row costs no text in the page and no polling. */
1520
+ function syncTerminal(step) {
1521
+ if (!step.shell || !step.station?.open) {
1522
+ if (step.terminal) { step.terminal.dispose(); step.terminal = null; }
1523
+ return;
1524
+ }
1525
+ if (!step.bodyBuilt) buildCallBody(step);
1526
+ else if (!step.terminal) fillCallBody(step);
1527
+ }
1528
+
1529
+ /** The block of a shell call whose row is open (made once; a rebuilt body takes the same one). */
1530
+ function terminalOf(step) {
1531
+ if (!step.shell || !step.station?.open || !hooks.shells?.terminal) return null;
1532
+ step.terminal ||= hooks.shells.terminal(step.shell.id, {
1533
+ onDraw: () => scrollEnd(),
1534
+ onGone: () => { if (step.bodyBuilt) fillCallBody(step); },
1535
+ });
1536
+ return step.terminal;
1537
+ }
1538
+
1539
+ /** The turn ended: rows opened for a command fold again, unless one failed or the model still waits for it. */
1540
+ function foldShellRows() {
1541
+ for (const rack of racks) {
1542
+ for (const st of rack.stations.values()) {
1543
+ if (!st.autoOpened) continue;
1544
+ if (st.userSet || rack.userSet) { st.autoOpened = false; continue; }
1545
+ if (st.steps.some(s => s.shell?.status === 'running' && s.shell.waited)) continue;
1546
+ st.autoOpened = false;
1547
+ if (st.steps.some(s => s.state === 'error')) { if (!rack.open) setRackOpen(rack, true); continue; }
1548
+ setStationOpen(rack, st, false);
1549
+ if (rack.autoOpened) { rack.autoOpened = false; setRackOpen(rack, false); }
1550
+ }
1551
+ }
1552
+ }
1553
+
1554
+ /** The runtime's word on a command changed (asst-panel.js): its call's row follows, wherever it is. */
1555
+ function noteShell(shell) {
1556
+ const step = shell?.callID ? stepsById.get(shell.callID) : null;
1557
+ if (!step || step.type !== 'call' || step.kind !== 'shell') return;
1558
+ syncShell(step);
1559
+ renderRack(step.rack);
1560
+ }
1561
+
1461
1562
  /** The final block of a streamed call, or the same block replayed: the step learns its input, nothing is added. */
1462
1563
  function updateCall(step, block) {
1463
1564
  if (block.name) step.name = block.name;
@@ -1642,12 +1743,12 @@ export function createRenderer(transcriptEl, hooks = {}) {
1642
1743
  receipt: { btn: q('.asst-rack-receipt'), face: q('.asst-rack-receipt-face'), text: q('.asst-rack-receipt-text'), failed: q('.asst-rack-receipt-failed'), clock: q('.asst-rack-receipt-clock'), faceBuilt: false, pose: '', svg: null },
1643
1744
  ledger: q('.asst-rack-ledger'), statusEl: q('.asst-rack-status'), alertEl: q('.asst-rack-alert'), timelineEl: null, timelineSig: '',
1644
1745
  rig: null, target: null, held: false, holdUntil: 0, holdTimer: 0, pose: null, awake: null, awakeKey: null,
1645
- bubble: { step: null, since: 0, key: '', open: false }, stageTimer: 0, clearTimer: 0,
1746
+ bubble: { step: null, since: 0, key: '', open: false }, stageTimer: 0, clearTimer: 0, foldFrame: 0,
1646
1747
  sr: { last: 0, timer: 0, pending: '' },
1647
1748
  };
1648
1749
  row._rack = rack;
1649
1750
  motion.watch(row); // its sweep, ticks and scene loop only while it is on screen
1650
- rack.receipt.btn.addEventListener('click', () => setRackOpen(rack, !rack.open));
1751
+ rack.receipt.btn.addEventListener('click', () => { rack.userSet = true; setRackOpen(rack, !rack.open); });
1651
1752
  row.querySelector('.asst-rack-view').addEventListener('click', (e) => {
1652
1753
  const btn = e.target.closest('button[data-view]');
1653
1754
  if (btn) setRackView(rack, btn.dataset.view);
@@ -1655,7 +1756,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
1655
1756
  rack.ledger.addEventListener('click', (e) => {
1656
1757
  const hdr = e.target.closest('.asst-station-hdr');
1657
1758
  const owner = hdr ? headers.get(hdr) : null;
1658
- if (owner?.rack === rack) setStationOpen(rack, owner.st, !owner.st.open);
1759
+ if (owner?.rack === rack) { owner.st.userSet = true; setStationOpen(rack, owner.st, !owner.st.open); }
1659
1760
  });
1660
1761
  rack.ledger.addEventListener('keydown', (e) => onLedgerKey(rack, e));
1661
1762
  rack.stage.subject.addEventListener('click', () => setBubbleOpen(rack, !rack.bubble.open));
@@ -1694,6 +1795,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
1694
1795
  st.hdr.setAttribute('aria-expanded', st.open ? 'true' : 'false');
1695
1796
  st.log.hidden = !st.open && st.kind !== 'computer';
1696
1797
  if (st.open) for (const step of st.steps) buildCallBody(step);
1798
+ for (const step of st.steps) if (step.kind === 'shell') syncTerminal(step);
1697
1799
  renderStationFace(rack, st);
1698
1800
  }
1699
1801
 
@@ -1726,8 +1828,8 @@ export function createRenderer(transcriptEl, hooks = {}) {
1726
1828
  else if (e.key === 'ArrowUp') next = list[Math.max(0, at - 1)];
1727
1829
  else if (e.key === 'Home') next = list[0];
1728
1830
  else if (e.key === 'End') next = list[list.length - 1];
1729
- else if (e.key === 'ArrowRight') { e.preventDefault(); if (!owner.st.open) setStationOpen(rack, owner.st, true); return; }
1730
- else if (e.key === 'ArrowLeft') { e.preventDefault(); if (owner.st.open) setStationOpen(rack, owner.st, false); return; }
1831
+ else if (e.key === 'ArrowRight') { e.preventDefault(); owner.st.userSet = true; if (!owner.st.open) setStationOpen(rack, owner.st, true); return; }
1832
+ else if (e.key === 'ArrowLeft') { e.preventDefault(); owner.st.userSet = true; if (owner.st.open) setStationOpen(rack, owner.st, false); return; }
1731
1833
  else return;
1732
1834
  e.preventDefault();
1733
1835
  if (!next) return;
@@ -1868,6 +1970,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
1868
1970
  if (staged) {
1869
1971
  clearTimeout(rack.clearTimer);
1870
1972
  rack.clearTimer = 0;
1973
+ foldMeasured(rack, true); // a fold that was still being measured is over: the stage is back
1871
1974
  rack.row.classList.add('is-staged');
1872
1975
  watchStageWidth(rack, true);
1873
1976
  if (!rack.rig) {
@@ -1882,6 +1985,11 @@ export function createRenderer(transcriptEl, hooks = {}) {
1882
1985
  // Fold the stage into the receipt; a rack above the viewport folds at once and the scroll position absorbs it.
1883
1986
  // Keyboard focus inside the stage (the bubble, its Copy) moves to the receipt, which takes the stage's place.
1884
1987
  const row = rack.row;
1988
+ // From here until the fold has been measured (foldMeasured) the row is laid out for real, wherever it is.
1989
+ // A settled rack is skipped off screen (asst-rack-styles.js; as a transcript row, transcript-rows.js), and
1990
+ // a skipped box keeps the height it was skipped at: a rack that settled off screen, or left the screen
1991
+ // while it folded, stayed as tall as its stage (or half folded) until the reader came back to it.
1992
+ row.classList.add('is-folding');
1885
1993
  const focused = rack.stage.el.contains(document.activeElement);
1886
1994
  let above = false;
1887
1995
  if (!calm() && row.isConnected) {
@@ -1894,7 +2002,14 @@ export function createRenderer(transcriptEl, hooks = {}) {
1894
2002
  row.classList.remove('is-staged');
1895
2003
  void row.offsetHeight; // apply without the transition
1896
2004
  row.classList.remove('is-instant');
1897
- if (h) $msgs.scrollTop = Math.max(0, $msgs.scrollTop - h);
2005
+ if (h) {
2006
+ if (scrollFollow.isFollowing()) {
2007
+ scrollFollow.scrollToBottom({ immediate: true });
2008
+ } else {
2009
+ const top = Math.max(0, $msgs.scrollTop - h);
2010
+ try { $msgs.scrollTo({ top, behavior: 'instant' }); } catch { $msgs.scrollTop = top; }
2011
+ }
2012
+ }
1898
2013
  } else {
1899
2014
  row.classList.remove('is-staged');
1900
2015
  }
@@ -1937,6 +2052,34 @@ export function createRenderer(transcriptEl, hooks = {}) {
1937
2052
  s.err.hidden = true;
1938
2053
  s.bubble.querySelector('.asst-bubble-copy')?.remove();
1939
2054
  rack.bubble = { step: null, since: 0, key: '', open: false };
2055
+ // A settled rack scrolled offscreen (content-visibility: auto) can freeze its
2056
+ // fold transitions in WebKit; clear any still-running fold transitions once folded.
2057
+ try {
2058
+ for (const a of rack.row.getAnimations?.() || []) a.cancel();
2059
+ for (const a of s.el.getAnimations?.() || []) a.cancel();
2060
+ } catch { /* ignore */ }
2061
+ foldMeasured(rack);
2062
+ }
2063
+
2064
+ /**
2065
+ * The fold is over. Its row stays laid out (`is-folding`) for SETTLE_FRAMES more frames: the first may be the
2066
+ * one the fold ended in, so by the last the folded height has been laid out and reported to whoever measures
2067
+ * rows (the size a skipped box is given). Then the mark goes and the host is told (`onRackFolded`), so a row
2068
+ * it kept plain meanwhile may be skipped again. `now`: the stage is back, the mark goes at once. Nothing is
2069
+ * read here, and a page that draws no frame keeps the row laid out until it draws again.
2070
+ */
2071
+ function foldMeasured(rack, now = false) {
2072
+ if (rack.foldFrame) { cancelAnimationFrame(rack.foldFrame); rack.foldFrame = 0; }
2073
+ const { row } = rack;
2074
+ if (!row.classList.contains('is-folding')) return;
2075
+ let left = now || typeof requestAnimationFrame !== 'function' ? 0 : SETTLE_FRAMES;
2076
+ const frame = () => {
2077
+ rack.foldFrame = 0;
2078
+ if (left-- > 0) { rack.foldFrame = requestAnimationFrame(frame); return; }
2079
+ row.classList.remove('is-folding');
2080
+ if (typeof hooks.onRackFolded === 'function') { try { hooks.onRackFolded(row); } catch { /* the fold stands */ } }
2081
+ };
2082
+ frame();
1940
2083
  }
1941
2084
 
1942
2085
  /**
@@ -2722,8 +2865,12 @@ export function createRenderer(transcriptEl, hooks = {}) {
2722
2865
  else if (step.state === 'error') state = t('assistant.tool.error', 'error');
2723
2866
  else if (step.state === 'neutral') state = t('assistant.rack.state.noMatches', 'no matches');
2724
2867
  else if (step.state === 'ok') state = t('assistant.tool.done', 'done');
2868
+ if (step.shell) {
2869
+ state = hooks.shells?.label?.(step.shell) || state;
2870
+ li.dataset.shell = step.shell.status;
2871
+ }
2725
2872
  q('.asst-tool-state').textContent = state;
2726
- q('.asst-tool-time').textContent = step.endedAt && step.timed ? fmtDuration(step.endedAt - step.startedAt, t) : '';
2873
+ q('.asst-tool-time').textContent = step.endedAt && step.timed && step.shell?.status !== 'running' ? fmtDuration(step.endedAt - step.startedAt, t) : '';
2727
2874
  }
2728
2875
 
2729
2876
  /** Bodies are built on first expand: a replayed history costs a header per call. */
@@ -2752,6 +2899,8 @@ export function createRenderer(transcriptEl, hooks = {}) {
2752
2899
  }
2753
2900
  // Keep a Show toggle's keyboard focus across the rebuild below.
2754
2901
  const refocus = body.contains(document.activeElement) && document.activeElement.classList.contains('asst-reveal');
2902
+ // The reader's place in a terminal block survives it too (the block goes back in below).
2903
+ const inTerminal = step.terminal?.el.contains(document.activeElement) ? document.activeElement : null;
2755
2904
  body.textContent = '';
2756
2905
  const input = step.input || {};
2757
2906
  const say = sayOf(step);
@@ -2798,10 +2947,21 @@ export function createRenderer(transcriptEl, hooks = {}) {
2798
2947
  default:
2799
2948
  inputSection(body, step, red);
2800
2949
  }
2801
- if (step.result && step.kind !== 'plan') {
2950
+ // A command with a terminal block shows what it printed there; the call's own result is the fallback once
2951
+ // OpenCode no longer has that output.
2952
+ const terminal = step.kind === 'shell' ? terminalOf(step) : null;
2953
+ if (terminal) body.appendChild(terminal.el);
2954
+ const outputGone = !!terminal && !!hooks.shells?.view?.(step.shell.id)?.gone;
2955
+ if (step.result && step.kind !== 'plan' && (!terminal || (outputGone && !isBackgroundNotice(step.result)))) {
2802
2956
  const output = hidden ? maskEcho(step.result, hidden, t) : step.result;
2803
2957
  section(body, t('assistant.rack.body.output', 'Output'), output, { copy: true });
2958
+ // The result only says the command went on, and nobody can read what it printed any more.
2959
+ if (!terminal && step.kind === 'shell' && hooks.shells?.supported?.() && isBackgroundNotice(step.result)) {
2960
+ body.appendChild(el('div', 'asst-term-note', t('assistant.rack.shell.gone', 'OpenCode no longer keeps the output of this command.')));
2961
+ }
2804
2962
  }
2963
+ terminal?.show();
2964
+ inTerminal?.focus({ preventScroll: true });
2805
2965
  if (!body.children.length) { body.remove(); return; }
2806
2966
  if (refocus) body.querySelector('.asst-reveal')?.focus({ preventScroll: true });
2807
2967
  }
@@ -3003,10 +3163,13 @@ export function createRenderer(transcriptEl, hooks = {}) {
3003
3163
  clearTimeout(rack.clearTimer);
3004
3164
  clearTimeout(rack.sr.timer);
3005
3165
  clearTimeout(rack.holdTimer);
3166
+ if (rack.foldFrame) cancelAnimationFrame(rack.foldFrame);
3167
+ rack.foldFrame = 0;
3006
3168
  rack.stageTimer = 0;
3007
3169
  rack.clearTimer = 0;
3008
3170
  rack.sr.timer = 0;
3009
3171
  rack.holdTimer = 0;
3172
+ for (const step of rack.steps) if (step.terminal) { step.terminal.dispose(); step.terminal = null; }
3010
3173
  const had = !!rack.rig;
3011
3174
  rack.rig?.destroy?.();
3012
3175
  rack.rig = null;
@@ -3112,6 +3275,31 @@ export function createRenderer(transcriptEl, hooks = {}) {
3112
3275
  return row;
3113
3276
  }
3114
3277
 
3278
+ /**
3279
+ * A Stop that could not end a command in the background (the runtime's `stop_failed`): the reason as an error row,
3280
+ * and from the second failure of the turn a "Stop anyway" button (`onForce`). The row of an earlier failure goes:
3281
+ * one row says what holds now.
3282
+ */
3283
+ let stopFailureRow = null;
3284
+ function appendStopFailure(text, { forceLabel = '', onForce = null } = {}) {
3285
+ clearStopFailure();
3286
+ const row = appendStatus(text, 'error');
3287
+ if (!row) return null;
3288
+ row.classList.add('asst-stop-failed');
3289
+ if (forceLabel && typeof onForce === 'function') {
3290
+ const button = el('button', 'asst-btn asst-btn-secondary asst-stop-anyway', forceLabel);
3291
+ button.type = 'button';
3292
+ button.addEventListener('click', () => { button.disabled = true; onForce(); });
3293
+ row.appendChild(button);
3294
+ }
3295
+ stopFailureRow = row;
3296
+ return row;
3297
+ }
3298
+ function clearStopFailure() {
3299
+ stopFailureRow?.remove?.();
3300
+ stopFailureRow = null;
3301
+ }
3302
+
3115
3303
  function appendDivider(label) {
3116
3304
  return append(el('div', 'asst-divider', label || ''));
3117
3305
  }
@@ -3381,6 +3569,9 @@ export function createRenderer(transcriptEl, hooks = {}) {
3381
3569
  function revealRun(runId) {
3382
3570
  const card = runCards.get(runId);
3383
3571
  if (!card?.isConnected) return false;
3572
+ // Leaving the bottom on purpose: detach first, so the follow does not read this jump's own mutations
3573
+ // as new content and write the bottom back over the smooth scroll before its first scroll event.
3574
+ scrollFollow.setFollowing(false);
3384
3575
  const top = card.getBoundingClientRect().top - $msgs.getBoundingClientRect().top + $msgs.scrollTop - 16;
3385
3576
  try { $msgs.scrollTo({ top: Math.max(0, top), behavior: calm() ? 'auto' : 'smooth' }); } catch { $msgs.scrollTop = Math.max(0, top); }
3386
3577
  card.classList.remove('is-revealed');
@@ -3625,6 +3816,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
3625
3816
  if (ended) row.atEnd = true;
3626
3817
  prune();
3627
3818
  if (racks.size) syncRacks();
3819
+ holdFollow(false); // a real row, even when the empty state stays above it
3628
3820
  scrollEnd();
3629
3821
  }
3630
3822
  return row.el;
@@ -3633,6 +3825,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
3633
3825
  // ── Empty state ──
3634
3826
  function showEmpty() {
3635
3827
  if (emptyEl || $msgs.querySelector(':scope > :not(.asst-working)')) return;
3828
+ holdFollow(true);
3636
3829
  emptyEl = el('div', 'asst-empty');
3637
3830
  // One column, one hierarchy: the character and the heading, the greeting when there is one,
3638
3831
  // the starters, then the context line (Project · Budget). No lead: the starters say what it can do.
@@ -4094,6 +4287,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
4094
4287
  else if (!stage.holdTimer) stage.holdUntil = 0; // a hold already running (the `done` after a result) keeps its time
4095
4288
  }
4096
4289
  endBursts(rootScope);
4290
+ foldShellRows();
4097
4291
  for (const rack of [...racks]) {
4098
4292
  const tail = liveTail(rack.scope) === rack;
4099
4293
  rack.closed = true;
@@ -4166,7 +4360,7 @@ export function createRenderer(transcriptEl, hooks = {}) {
4166
4360
  }
4167
4361
 
4168
4362
  function clear() {
4169
- if (scrollFrame) { cancelAnimationFrame(scrollFrame); scrollFrame = 0; }
4363
+ scrollFollow.setFollowing(true);
4170
4364
  clearTimeout(recutTimer);
4171
4365
  recutTimer = 0;
4172
4366
  toRecut.clear();
@@ -4208,17 +4402,20 @@ export function createRenderer(transcriptEl, hooks = {}) {
4208
4402
  closeEmptyMenu();
4209
4403
  $msgs.innerHTML = '';
4210
4404
  emptyEl = null;
4211
- followTail = true;
4405
+ holdFollow(false);
4406
+ topGate.request();
4212
4407
  }
4213
4408
 
4214
4409
  return {
4215
4410
  el: $msgs,
4216
4411
  clear,
4217
- destroy: () => { clear(); endGate.cancel(); stageResizes?.disconnect(); limitDock.destroy(); stopFontWatch(); },
4412
+ destroy: () => { clear(); scrollFollow.destroy(); topGate.cancel(); stageResizes?.disconnect(); limitDock.destroy(); stopFontWatch(); },
4218
4413
  appendUser,
4219
4414
  appendAssistantMarkdown,
4220
4415
  appendStatus,
4221
4416
  appendError,
4417
+ appendStopFailure,
4418
+ clearStopFailure,
4222
4419
  appendDivider,
4223
4420
  appendNode,
4224
4421
  appendMemoryChips,
@@ -4253,6 +4450,8 @@ export function createRenderer(transcriptEl, hooks = {}) {
4253
4450
  forgetSeen: () => { seen.clear(); snapshot = null; },
4254
4451
  /** A card waits on the user: `toolUseId` names the call it holds (the newest live stage when unknown); false clears it. */
4255
4452
  setWaiting,
4453
+ /** A shell command of the brain changed: its call's row and terminal block follow (asst-shell-logic.js). */
4454
+ noteShell,
4256
4455
  /** The session's usage-limit report changed: this turn's waiting card counts to its reset time. */
4257
4456
  noteLimit,
4258
4457
  /** Dismiss the Assistant's own limit-wait card (a provider switch already decided what follows). */