@aiworker/web 1.22.0 → 1.22.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 (354) hide show
  1. package/README.md +4 -4
  2. package/bin/cli.js +7 -4
  3. package/bin/cli.test.js +165 -73
  4. package/bin/lib/cli-api-target.js +2 -2
  5. package/bin/lib/cli-args.js +119 -119
  6. package/bin/lib/cli-lifecycle.js +9 -9
  7. package/bin/lib/cli-network.js +3 -3
  8. package/bin/lib/cli-paths.js +3 -3
  9. package/bin/lib/cli-ports.js +2 -2
  10. package/bin/lib/cli-process.js +4 -4
  11. package/bin/lib/cli-startup.js +64 -15
  12. package/bin/lib/cli-tunnel-profiles.js +1 -1
  13. package/bin/lib/cli-tunnel-utils.js +2 -2
  14. package/bin/lib/commands-connect-url.js +19 -19
  15. package/bin/lib/commands-lifecycle.js +27 -27
  16. package/bin/lib/commands-logs.js +5 -5
  17. package/bin/lib/commands-models.js +1 -1
  18. package/bin/lib/commands-projects.js +1 -1
  19. package/bin/lib/commands-schedule.js +1 -1
  20. package/bin/lib/commands-serve.js +29 -29
  21. package/bin/lib/commands-session.js +1 -1
  22. package/bin/lib/commands-startup.js +45 -10
  23. package/bin/lib/commands-status.js +1 -1
  24. package/bin/lib/commands-tunnel.js +40 -40
  25. package/bin/lib/commands-update.js +1 -1
  26. package/bin/lib/commands-update.test.js +6 -6
  27. package/dist/assets/{CodeMirrorCommentWidgets-B3u7UIcE.js → CodeMirrorCommentWidgets-CSICpWQD.js} +1 -1
  28. package/dist/assets/{DiffView-DluiRSla.js → DiffView-hDBKesA_.js} +3 -3
  29. package/dist/assets/DirtyBranchSwitchDialog-C22HdWj4.js +1 -0
  30. package/dist/assets/FilesView-CdWzeOp9.js +17 -0
  31. package/dist/assets/GitView-VQQkYuUw.js +6 -0
  32. package/dist/assets/{JsonTreeView-B0BdZEHG.js → JsonTreeView-6lrhwD3q.js} +1 -1
  33. package/dist/assets/LinearIssuesView-Ba6Q9569.js +1 -0
  34. package/dist/assets/{MarkdownImageGallery-ClOvuZxC.js → MarkdownImageGallery-Czv_mhvS.js} +1 -1
  35. package/dist/assets/MarkdownRendererImpl-BrMcswiy.js +12 -0
  36. package/dist/assets/{OnboardingScreen-D2DG7K6b.js → OnboardingScreen-ChxQoAkx.js} +1 -1
  37. package/dist/assets/{PatchDiff-DvfqDql7.js → PatchDiff-BzcZPlOq.js} +1 -1
  38. package/dist/assets/{PierreDiffViewer-B7m3f0d7.js → PierreDiffViewer-BchBtZlp.js} +2 -2
  39. package/dist/assets/PlanView-DyDt_nZ_.js +5 -0
  40. package/dist/assets/SettingsView-BKf5xBsP.js +28 -0
  41. package/dist/assets/{SettingsWindow-i45U1Cy1.js → SettingsWindow-DDQYaKWQ.js} +1 -1
  42. package/dist/assets/{ToolOutputDialog-BTwyh5OF.js → ToolOutputDialog-iYF8Y2bz.js} +6 -6
  43. package/dist/assets/ToolPartDiffPreview-CdjbOVMM.js +8 -0
  44. package/dist/assets/{VirtualizedFileDiff-DD8lDVej.js → VirtualizedFileDiff-fFFm2QgH.js} +1 -1
  45. package/dist/assets/{WalkthroughView-egQgxel3.js → WalkthroughView-DOeCsMju.js} +2 -2
  46. package/dist/assets/{computeVirtualFileMetrics-BMIRgMHv.js → computeVirtualFileMetrics-CzgLum_K.js} +2 -2
  47. package/dist/assets/{contextPanelEmbeddedChat-C3fjDbdg.js → contextPanelEmbeddedChat-C0ZLAepL.js} +1 -1
  48. package/dist/assets/{de-C1P6X5Rs.js → de-B5JaA3SA.js} +6 -5
  49. package/dist/assets/{es-CDgaF1_t.js → es-EPIH88ii.js} +6 -5
  50. package/dist/assets/{fr-Bgxqvvz_.js → fr-CAMfxUdZ.js} +6 -5
  51. package/dist/assets/{index-CODwDsU_.js → index-Bl3LSbjn.js} +1 -1
  52. package/dist/assets/index-DF5kMP-i.js +39 -0
  53. package/dist/assets/index-Dl3xbAB_.css +1 -0
  54. package/dist/assets/{isDiffPlainText-BqayB8d3.js → isDiffPlainText-Dx-dB_8l.js} +1 -1
  55. package/dist/assets/{isFilePlainText-QfoiKJNY.js → isFilePlainText-CWFPwmnU.js} +1 -1
  56. package/dist/assets/{ja-BDRrEcNP.js → ja-CifOE1VN.js} +7 -6
  57. package/dist/assets/{ko-Ba8sQV79.js → ko-BBDyAyYQ.js} +7 -6
  58. package/dist/assets/{main-C5DVOxc6.js → main-DnBAoktx.js} +2 -2
  59. package/dist/assets/main-MhSaOZoB.js +930 -0
  60. package/dist/assets/{markdownCore-CZwzz5gw.js → markdownCore-BrBwOOMn.js} +2 -2
  61. package/dist/assets/{miniChat-DUJ4irZc.js → miniChat-BKyvLseN.js} +2 -2
  62. package/dist/assets/{mobile-CcaxB0n4.js → mobile-DKjeFgMN.js} +2 -2
  63. package/dist/assets/{patchFileDiff-yNfWXN4E.js → patchFileDiff-o8ms1me8.js} +1 -1
  64. package/dist/assets/pl-DgEHYfFM.js +16 -0
  65. package/dist/assets/{pt-BR-DIs6ElwV.js → pt-BR-DuWHojUw.js} +6 -5
  66. package/dist/assets/{renderElectronMiniChatApp-BcKLHXKe.js → renderElectronMiniChatApp-CDgBwwCS.js} +2 -2
  67. package/dist/assets/renderMobileApp-DJIKIK1r.js +25 -0
  68. package/dist/assets/runtimeEndpointReset-CYJ9O_xX.js +17 -0
  69. package/dist/assets/{scheduledTasksApi-DLW0mkQK.js → scheduledTasksApi-D8yamh1b.js} +1 -1
  70. package/dist/assets/{shikiHighlight-DYOWuY65.js → shikiHighlight-TEQCmzW8.js} +1 -1
  71. package/dist/assets/tr-D5m2yIWL.js +7 -0
  72. package/dist/assets/{uk-ZrCNjM7Y.js → uk-D_q60oog.js} +6 -5
  73. package/dist/assets/{useAppFontEffects-CjrntdL0.js → useAppFontEffects-D7sNpuL2.js} +161 -190
  74. package/dist/assets/useInlineCommentController-Brz_cLcQ.js +2 -0
  75. package/dist/assets/{useRootScrollLock-BHYPkrLv.js → useRootScrollLock-lXEnWlaU.js} +1 -1
  76. package/dist/assets/{vendor-codemirror-language-data-DFZik9R2.js → vendor-codemirror-language-data-Dp3KMRQG.js} +2 -2
  77. package/dist/assets/vendor-zod-CK21ihK-.js +39 -0
  78. package/dist/assets/{web-components-Bhg83tjf.js → web-components-_mNEMjFY.js} +1 -1
  79. package/dist/assets/{zh-CN-iv_AV4EC.js → zh-CN-D8QvsVeg.js} +6 -5
  80. package/dist/assets/{zh-TW-CzEUk38j.js → zh-TW-B9t7rQQO.js} +6 -5
  81. package/dist/index.html +22 -22
  82. package/dist/mini-chat.html +7 -7
  83. package/dist/mobile.html +5 -5
  84. package/package.json +3 -3
  85. package/server/index.js +118 -85
  86. package/server/lib/agent-memory/actions.js +2 -2
  87. package/server/lib/agent-memory/feature-flag.js +1 -1
  88. package/server/lib/agent-memory/feature-flag.test.js +8 -8
  89. package/server/lib/agent-memory/routes.js +2 -2
  90. package/server/lib/agent-tool/runtime.js +37 -54
  91. package/server/lib/agent-tool/runtime.test.js +59 -59
  92. package/server/lib/browser-control/broker.js +3 -3
  93. package/server/lib/browser-control/broker.test.js +1 -1
  94. package/server/lib/changelog/update-notes.js +82 -0
  95. package/server/lib/changelog/update-notes.test.js +59 -0
  96. package/server/lib/client-auth/remote-clients.test.js +5 -5
  97. package/server/lib/context-obligatory/runtime.js +7 -7
  98. package/server/lib/context-obligatory/runtime.test.js +5 -5
  99. package/server/lib/dev-servers/parse.js +2 -2
  100. package/server/lib/dev-servers/parse.test.js +2 -2
  101. package/server/lib/dev-servers/routes.js +1 -1
  102. package/server/lib/dev-tunnel/DOCUMENTATION.md +13 -4
  103. package/server/lib/dev-tunnel/client.js +1 -1
  104. package/server/lib/dev-tunnel/runtime.js +5 -5
  105. package/server/lib/dev-tunnel/tunnel.test.js +21 -1
  106. package/server/lib/dictation/local/model-catalog.js +1 -1
  107. package/server/lib/dictation/local/worker-process.js +2 -2
  108. package/server/lib/event-stream/directory-ws-bridge.js +1 -1
  109. package/server/lib/event-stream/global-ws-bridge.js +1 -1
  110. package/server/lib/event-stream/protocol.test.js +4 -4
  111. package/server/lib/event-stream/runtime.test.js +6 -6
  112. package/server/lib/fs/DOCUMENTATION.md +2 -0
  113. package/server/lib/fs/routes.js +37 -26
  114. package/server/lib/fs/routes.test.js +98 -21
  115. package/server/lib/git/DOCUMENTATION.md +3 -1
  116. package/server/lib/git/identity-storage.js +1 -1
  117. package/server/lib/git/issue-2746-longpaths.test.js +4 -4
  118. package/server/lib/git/routes.js +17 -1
  119. package/server/lib/git/service.js +116 -26
  120. package/server/lib/git/service.test.js +174 -3
  121. package/server/lib/github/auth.js +8 -8
  122. package/server/lib/github/pr-status.js +1 -1
  123. package/server/lib/github/routes.js +2 -2
  124. package/server/lib/inherited-env.js +1 -1
  125. package/server/lib/inherited-env.test.js +2 -2
  126. package/server/lib/linear/auth.js +8 -8
  127. package/server/lib/linear/auth.test.js +24 -24
  128. package/server/lib/linear/issues.test.js +6 -6
  129. package/server/lib/linear/mapping.test.js +4 -4
  130. package/server/lib/linear/oauth.js +2 -2
  131. package/server/lib/linear/oauth.test.js +14 -14
  132. package/server/lib/linear/routes.js +5 -5
  133. package/server/lib/linear/routes.test.js +16 -16
  134. package/server/lib/linear/status-runtime.test.js +9 -9
  135. package/server/lib/linear/status.js +1 -1
  136. package/server/lib/linear/status.test.js +15 -15
  137. package/server/lib/linear/teams.test.js +4 -4
  138. package/server/lib/magic-prompts/routes.js +2 -2
  139. package/server/lib/mcp-reconnect/DOCUMENTATION.md +55 -0
  140. package/server/lib/mcp-reconnect/runtime.js +122 -0
  141. package/server/lib/mcp-reconnect/runtime.test.js +140 -0
  142. package/server/lib/message-queue/DOCUMENTATION.md +158 -0
  143. package/server/lib/message-queue/runtime.js +870 -0
  144. package/server/lib/message-queue/runtime.test.js +482 -0
  145. package/server/lib/notifications/apns-runtime.js +17 -17
  146. package/server/lib/notifications/apns-runtime.test.js +11 -11
  147. package/server/lib/notifications/emitter-runtime.js +1 -1
  148. package/server/lib/notifications/emitter-runtime.test.js +1 -1
  149. package/server/lib/notifications/push-runtime.js +7 -7
  150. package/server/lib/notifications/routes.js +1 -1
  151. package/server/lib/notifications/runtime.js +1 -1
  152. package/server/lib/openchamber-control/action-resolution.test.js +10 -10
  153. package/server/lib/openchamber-control/actions.js +24 -24
  154. package/server/lib/openchamber-control/error.js +4 -4
  155. package/server/lib/openchamber-control/routes.js +2 -2
  156. package/server/lib/openchamber-control/routes.test.js +5 -5
  157. package/server/lib/openchamber-control/screenshots.js +1 -1
  158. package/server/lib/openchamber-control/screenshots.test.js +1 -1
  159. package/server/lib/openchamber-control/service.js +50 -50
  160. package/server/lib/openchamber-control/service.test.js +5 -5
  161. package/server/lib/openchamber-sessions/routes.js +124 -22
  162. package/server/lib/openchamber-sessions/routes.test.js +99 -11
  163. package/server/lib/opencode/DOCUMENTATION.md +13 -5
  164. package/server/lib/opencode/auth.js +1 -1
  165. package/server/lib/opencode/bootstrap-runtime.js +6 -6
  166. package/server/lib/opencode/cli-options.js +8 -8
  167. package/server/lib/opencode/config-paths.test.js +116 -0
  168. package/server/lib/opencode/core-routes.js +8 -7
  169. package/server/lib/opencode/core-routes.test.js +11 -11
  170. package/server/lib/opencode/env-config.js +5 -5
  171. package/server/lib/opencode/env-config.test.js +7 -7
  172. package/server/lib/opencode/env-runtime.js +10 -10
  173. package/server/lib/opencode/env-runtime.test.js +18 -18
  174. package/server/lib/opencode/feature-routes-runtime.js +17 -12
  175. package/server/lib/opencode/hmr-state-runtime.js +2 -2
  176. package/server/lib/opencode/hmr-state-runtime.test.js +1 -1
  177. package/server/lib/opencode/input-history-scope.js +14 -0
  178. package/server/lib/opencode/lifecycle.js +8 -8
  179. package/server/lib/opencode/lifecycle.test.js +4 -4
  180. package/server/lib/opencode/managed-plugin-config.js +35 -0
  181. package/server/lib/opencode/managed-process-registry.js +3 -3
  182. package/server/lib/opencode/mcp-oauth-callback.test.js +2 -2
  183. package/server/lib/opencode/openchamber-routes.js +15 -15
  184. package/server/lib/opencode/openchamber-routes.test.js +11 -11
  185. package/server/lib/opencode/plugins.js +2 -2
  186. package/server/lib/opencode/plugins.test.js +1 -1
  187. package/server/lib/opencode/project-icon-routes.js +2 -2
  188. package/server/lib/opencode/project-icon-routes.test.js +1 -1
  189. package/server/lib/opencode/providers.js +44 -2
  190. package/server/lib/opencode/providers.test.js +131 -4
  191. package/server/lib/opencode/proxy.js +2 -2
  192. package/server/lib/opencode/pwa-manifest-routes.js +1 -1
  193. package/server/lib/opencode/restart-session-recovery.test.js +1 -1
  194. package/server/lib/opencode/routes-upgrade.test.js +4 -4
  195. package/server/lib/opencode/routes.js +14 -14
  196. package/server/lib/opencode/server-startup-runtime.js +6 -6
  197. package/server/lib/opencode/session-runtime.js +3 -3
  198. package/server/lib/opencode/session-runtime.test.js +6 -6
  199. package/server/lib/opencode/settings-helpers.js +31 -3
  200. package/server/lib/opencode/settings-helpers.test.js +189 -12
  201. package/server/lib/opencode/settings-runtime.js +2 -2
  202. package/server/lib/opencode/settings-runtime.test.js +29 -0
  203. package/server/lib/opencode/shared.js +5 -2
  204. package/server/lib/opencode/shared.test.js +7 -7
  205. package/server/lib/opencode/shutdown-runtime.js +2 -0
  206. package/server/lib/opencode/skill-routes.js +2 -1
  207. package/server/lib/opencode/snippets.js +1 -2
  208. package/server/lib/opencode/startup-performance.js +1 -1
  209. package/server/lib/opencode/startup-performance.test.js +6 -6
  210. package/server/lib/opencode/static-routes-runtime.js +8 -8
  211. package/server/lib/opencode/static-routes-runtime.test.js +7 -7
  212. package/server/lib/opencode/upgrade-capability.js +2 -2
  213. package/server/lib/opencode/upgrade-capability.test.js +3 -3
  214. package/server/lib/package-manager.js +17 -42
  215. package/server/lib/package-manager.test.js +19 -19
  216. package/server/lib/permission-auto-accept/runtime.js +1 -1
  217. package/server/lib/project-context/routes.js +1 -1
  218. package/server/lib/projects/project-config.js +2 -2
  219. package/server/lib/quota/DOCUMENTATION.md +9 -1
  220. package/server/lib/quota/credentials/providers.js +4 -0
  221. package/server/lib/quota/credentials/store.js +4 -4
  222. package/server/lib/quota/credentials/store.test.js +8 -8
  223. package/server/lib/quota/index.js +1 -0
  224. package/server/lib/quota/providers/exe-dev.js +75 -0
  225. package/server/lib/quota/providers/exe-dev.test.js +47 -0
  226. package/server/lib/quota/providers/hyper.js +118 -0
  227. package/server/lib/quota/providers/hyper.test.js +126 -0
  228. package/server/lib/quota/providers/index.js +15 -0
  229. package/server/lib/quota/providers/ollama-cloud.js +1 -1
  230. package/server/lib/quota/providers/opencode-go.js +2 -1
  231. package/server/lib/quota/providers/opencode-go.test.js +9 -5
  232. package/server/lib/quota/providers/xai.js +1 -1
  233. package/server/lib/quota/routes.js +2 -0
  234. package/server/lib/quota/utils/auth.js +1 -1
  235. package/server/lib/relay/DOCUMENTATION.md +1 -1
  236. package/server/lib/relay/host-client.js +1 -1
  237. package/server/lib/relay/host-client.test.js +9 -1
  238. package/server/lib/relay/host-lock.js +1 -1
  239. package/server/lib/relay/service.js +5 -5
  240. package/server/lib/relay/tunnel-host.js +3 -1
  241. package/server/lib/relay/tunnel-host.test.js +9 -1
  242. package/server/lib/scheduled-tasks/issue-2710-double-execution.test.js +2 -2
  243. package/server/lib/scheduled-tasks/routes.js +5 -5
  244. package/server/lib/scheduled-tasks/service.js +25 -25
  245. package/server/lib/scheduled-tasks/service.test.js +1 -1
  246. package/server/lib/security/bind-host.js +4 -4
  247. package/server/lib/security/bind-host.test.js +1 -1
  248. package/server/lib/security/request-security.js +11 -5
  249. package/server/lib/security/request-security.test.js +14 -14
  250. package/server/lib/session-assist/runtime.js +10 -9
  251. package/server/lib/session-folders/routes.js +2 -2
  252. package/server/lib/session-folders/routes.test.js +8 -8
  253. package/server/lib/session-goal/DOCUMENTATION.md +20 -7
  254. package/server/lib/session-goal/create.js +4 -2
  255. package/server/lib/session-goal/create.test.js +1 -1
  256. package/server/lib/session-goal/objectives.js +4 -4
  257. package/server/lib/session-goal/routes.js +1 -1
  258. package/server/lib/session-goal/runtime.js +88 -22
  259. package/server/lib/session-goal/runtime.test.js +428 -2
  260. package/server/lib/session-knowledge/runtime.js +11 -11
  261. package/server/lib/session-knowledge/runtime.test.js +5 -5
  262. package/server/lib/skills-catalog/DOCUMENTATION.md +1 -1
  263. package/server/lib/skills-catalog/cache.test.js +2 -2
  264. package/server/lib/skills-catalog/disk-cache.js +5 -5
  265. package/server/lib/skills-catalog/github-meta.test.js +2 -2
  266. package/server/lib/skills-catalog/install.js +3 -2
  267. package/server/lib/small-model/DOCUMENTATION.md +4 -0
  268. package/server/lib/small-model/call.js +9 -3
  269. package/server/lib/small-model/call.test.js +29 -6
  270. package/server/lib/small-model/index.js +8 -7
  271. package/server/lib/small-model/index.test.js +1 -1
  272. package/server/lib/small-model/resolve.js +1 -1
  273. package/server/lib/small-model/resolve.test.js +1 -1
  274. package/server/lib/small-model/routes.js +2 -1
  275. package/server/lib/system-prompt/runtime.js +3 -22
  276. package/server/lib/system-prompt/runtime.test.js +3 -3
  277. package/server/lib/terminal/DOCUMENTATION.md +11 -7
  278. package/server/lib/terminal/runtime.js +180 -26
  279. package/server/lib/terminal/runtime.test.js +554 -27
  280. package/server/lib/terminal/shells.js +20 -3
  281. package/server/lib/terminal/shells.test.js +33 -2
  282. package/server/lib/tts/base-url.js +3 -3
  283. package/server/lib/tts/routes.test.js +20 -20
  284. package/server/lib/ui-auth/ui-auth.js +12 -9
  285. package/server/lib/ui-auth/ui-auth.test.js +19 -3
  286. package/server/lib/ui-auth/ui-passkeys.js +7 -7
  287. package/server/lib/walkthrough/index.js +1 -0
  288. package/server/lib/walkthrough/jobs.test.js +1 -1
  289. package/server/lib/walkthrough/language.test.js +1 -1
  290. package/server/lib/walkthrough/model-settings.js +3 -3
  291. package/server/lib/walkthrough/model-settings.test.js +1 -1
  292. package/server/lib/walkthrough/pull-request.test.js +5 -5
  293. package/server/lib/walkthrough/reproduce-2607.test.js +2 -2
  294. package/server/lib/walkthrough/routes.test.js +26 -5
  295. package/server/lib/walkthrough/store.js +3 -3
  296. package/server/lib/walkthrough/store.test.js +1 -1
  297. package/server/opencode-proxy.test.js +2 -2
  298. package/server/proxy-headers.js +1 -1
  299. package/server/sse-routes.test.js +4 -4
  300. package/README.md.bak +0 -250
  301. package/bin/lib/DOCUMENTATION.md.bak +0 -163
  302. package/dist/assets/CommitSection-SGBCAW0w.js +0 -1
  303. package/dist/assets/FilesView-Bdq8ppva.js +0 -17
  304. package/dist/assets/GitView-Znn7VJcP.js +0 -6
  305. package/dist/assets/LinearIssuesView-jP-hXyac.js +0 -1
  306. package/dist/assets/MarkdownRendererImpl-Dt9mjTRN.js +0 -12
  307. package/dist/assets/PlanView-B0F3BtPZ.js +0 -5
  308. package/dist/assets/SettingsView-BBW-S-gh.js +0 -28
  309. package/dist/assets/ToolPartDiffPreview-CUNe28U1.js +0 -8
  310. package/dist/assets/index-C57jT0Sa.css +0 -1
  311. package/dist/assets/index-DW_E3rnL.js +0 -7
  312. package/dist/assets/main-Bv5Pkngh.js +0 -928
  313. package/dist/assets/pl-Dioz29BI.js +0 -15
  314. package/dist/assets/renderMobileApp-D9yQJy0L.js +0 -25
  315. package/dist/assets/runtimeEndpointReset-CjhvxLH0.js +0 -16
  316. package/dist/assets/tr-DFnMlPxY.js +0 -6
  317. package/dist/assets/useInlineCommentController-CDEuSlPH.js +0 -2
  318. package/dist/assets/vendor-zod-BLfBSgBh.js +0 -39
  319. package/server/index.d.ts.bak +0 -39
  320. package/server/lib/agent-tool/DOCUMENTATION.md.bak +0 -119
  321. package/server/lib/browser-control/DOCUMENTATION.md.bak +0 -50
  322. package/server/lib/context-obligatory/DOCUMENTATION.md.bak +0 -19
  323. package/server/lib/dev-tunnel/DOCUMENTATION.md.bak +0 -57
  324. package/server/lib/dictation/DOCUMENTATION.md.bak +0 -100
  325. package/server/lib/event-stream/DOCUMENTATION.md.bak +0 -62
  326. package/server/lib/fs/DOCUMENTATION.md.bak +0 -47
  327. package/server/lib/git/DOCUMENTATION.md.bak +0 -193
  328. package/server/lib/github/DOCUMENTATION.md.bak +0 -183
  329. package/server/lib/linear/DOCUMENTATION.md.bak +0 -97
  330. package/server/lib/linear/OAUTH-BROKER-HANDOFF.md.bak +0 -91
  331. package/server/lib/markdown-image-grants/DOCUMENTATION.md.bak +0 -40
  332. package/server/lib/notifications/APNS.md.bak +0 -135
  333. package/server/lib/notifications/DOCUMENTATION.md.bak +0 -138
  334. package/server/lib/openchamber-control/DOCUMENTATION.md.bak +0 -64
  335. package/server/lib/opencode/DOCUMENTATION.md.bak +0 -431
  336. package/server/lib/opencode/managed-process-registry.d.ts.bak +0 -13
  337. package/server/lib/opencode/provider-env-aliases.d.ts.bak +0 -3
  338. package/server/lib/permission-auto-accept/DOCUMENTATION.md.bak +0 -34
  339. package/server/lib/project-context/DOCUMENTATION.md.bak +0 -160
  340. package/server/lib/quota/DOCUMENTATION.md.bak +0 -123
  341. package/server/lib/relay/DOCUMENTATION.md.bak +0 -100
  342. package/server/lib/scheduled-tasks/DOCUMENTATION.md.bak +0 -182
  343. package/server/lib/session-assist/DOCUMENTATION.md.bak +0 -66
  344. package/server/lib/session-goal/DOCUMENTATION.md.bak +0 -213
  345. package/server/lib/session-knowledge/DOCUMENTATION.md.bak +0 -89
  346. package/server/lib/skills-catalog/DOCUMENTATION.md.bak +0 -151
  347. package/server/lib/small-model/DOCUMENTATION.md.bak +0 -212
  348. package/server/lib/system-prompt/DOCUMENTATION.md.bak +0 -36
  349. package/server/lib/terminal/DOCUMENTATION.md.bak +0 -50
  350. package/server/lib/text/DOCUMENTATION.md.bak +0 -35
  351. package/server/lib/tts/DOCUMENTATION.md.bak +0 -147
  352. package/server/lib/tunnels/DOCUMENTATION.md.bak +0 -21
  353. package/server/lib/ui-auth/DOCUMENTATION.md.bak +0 -44
  354. package/server/lib/walkthrough/DOCUMENTATION.md.bak +0 -411
@@ -1,411 +0,0 @@
1
- # Walkthrough
2
-
3
- Generates a guided, ordered reading path through a diff: the small model groups
4
- related hunks into stops and chapters and explains each group, and the UI
5
- renders those stops interleaved with the code they describe.
6
-
7
- Generation is **always user-initiated**. Nothing here runs on a timer, on a file
8
- change, or as a side effect of opening a panel — it spends tokens, so a person
9
- has to ask for it.
10
-
11
- ## Files
12
-
13
- - `hunks.js` — parses a unified diff into files and hunks and assigns each hunk
14
- a stable id.
15
- - `generated.js` — recognises tool-produced files that are kept out of the
16
- model's input.
17
- - `sources.js` — turns a source descriptor into diff *sections*.
18
- - `digest.js` — builds the model-facing digest and the alias↔id mapping.
19
- - `prompt.js` — system prompt, size guidance, previous-walkthrough section, and
20
- `PROMPT_VERSION`.
21
- - `schema.js` — response schema, response normalization, tolerant JSON parsing.
22
- - `store.js` — content-addressed cache entries plus mutable pointers.
23
- - `pull-request.js` — PR diffs via the shared GitHub octokit helper.
24
- - `model-settings.js` — the feature's own model override.
25
- - `languages.js` — the languages the prose may be written in.
26
- - `index.js` — orchestration.
27
- - `routes.js` — `/api/walkthrough*`.
28
-
29
- ## Hunk identity
30
-
31
- `hunks.js` is the only place that decides what a hunk is or what its id is. The
32
- client never recomputes ids; it receives the current hunk index (id → patch)
33
- alongside the walkthrough and matches ids to ids. Two implementations of the
34
- same hash would have to agree byte-for-byte forever, and the first one to drift
35
- would silently mis-anchor every stop.
36
-
37
- An id is `<scope>:<path>:<sha1(header + body)[:8]>`, with a `-2`, `-3`, … suffix
38
- for byte-identical hunks repeated inside one file.
39
-
40
- Two consequences fall out of hashing the content:
41
-
42
- - Editing a hunk changes its id, so an anchor that no longer resolves is
43
- **proof** the code it described changed. Staleness needs no heuristics.
44
- - Editing one hunk does not disturb its neighbours, so a small edit invalidates
45
- only the stops that actually covered it.
46
-
47
- `scope` keeps staged and unstaged versions of the same lines apart, so a stop
48
- written against staged code never silently re-anchors onto an unstaged edit.
49
-
50
- ## Sources
51
-
52
- | Kind | Sections | Notes |
53
- |---|---|---|
54
- | `working-tree` (`all` \| `staged` \| `working`) | `staged`, `working` | Untracked files are fetched individually because `git diff` omits them |
55
- | `branch` | `branch` | `getRangeDiff` uses three-dot `base...head`, so work merged in from the base branch is excluded |
56
- | `pr` | `pr:<number>` | GitHub returns the merge-base diff, matching the branch semantics |
57
-
58
- For the current-branch source, the UI takes the base from the default branch of
59
- the current branch's tracking remote (`defaultBranches` in the branches
60
- response), and only then falls back to the conventional names. It does not offer
61
- the source at all when the chosen base exists neither locally nor on a remote —
62
- a repository whose default is neither `main`, `master` nor `develop` used to be
63
- handed `main...<head>`, which git rejects outright.
64
-
65
- A base that exists only on a remote still works: `getRangeDiff` prefers
66
- `origin/<base>` when it exists, and otherwise resolves the base through whichever
67
- remote carries it, because a bare branch name git cannot find in `refs/heads`
68
- fails the same way.
69
-
70
- The panel offers the current branch's pull request on its own: it registers with
71
- the shared GitHub PR status store (`useGitHubPrStatusStore`) rather than waiting
72
- for the pull request panel to have been visited. That store already dedupes
73
- concurrent requests by signature and throttles by TTL, so several panels asking
74
- the same question produce one call to GitHub.
75
-
76
- ## No truncation
77
-
78
- Within what it covers, the digest is complete. When it does not fit the resolved
79
- model's context, generation is **refused** (`409`, `code: 'context-too-small'`)
80
- so the user can pick a roomier model. A walkthrough written against a silently
81
- clipped diff is confidently wrong in a way no reader can detect, which is worse
82
- than no walkthrough.
83
-
84
- ## Generated files
85
-
86
- `generated.js` excludes tool-produced files — lockfiles, minified bundles,
87
- codegen, snapshots — from the digest by **name, never by size**. A lockfile can
88
- be larger than the entire change around it and carries no intent, so sending it
89
- wastes context that real code needs.
90
-
91
- They are excluded, not hidden: they carry no hunk aliases (so nothing can anchor
92
- to them), but they are still parsed, still returned to the client, and still
93
- appear in the uncovered tail. The matcher is deliberately conservative —
94
- `src/lock.ts` and `src/generator.ts` are authored code — because a false
95
- positive silently drops real code from a review, which is the exact failure this
96
- feature exists to prevent.
97
-
98
- When a change consists only of generated files, generation is refused with
99
- `code: 'only-generated'` rather than the misleading "nothing changed".
100
-
101
- ## Model selection
102
-
103
- The walkthrough has its own model setting (Settings → Sessions → Changes
104
- Walkthrough Model), read by `model-settings.js`:
105
-
106
- `walkthroughModelOverride` (`provider/model`) is the whole contract: set, that
107
- model is used for this feature and nothing else; unset or empty, generation
108
- falls back to whatever the small-model chain resolves to. Choosing a model *is*
109
- the opt-out, so there is no separate toggle to disagree with the picker — the
110
- settings picker simply shows "Small model will be used" until a choice is made,
111
- and clearing it restores the fallback.
112
-
113
- The separation exists because the two roles pull in opposite directions: the
114
- small model is chosen to be cheap and fast for recaps and commit messages, while
115
- this one needs schema-shaped output and enough context for a whole diff. Forcing
116
- one setting to serve both means degrading one feature to fix the other.
117
-
118
- A review can also override the model for itself: `GET`/`POST` accept a `model`
119
- (`provider/model`) that outranks both the setting and the small-model chain.
120
- That choice is panel state, not a settings edit — picking a roomier model for
121
- one risky change should not silently redefine the default for every future one.
122
- It needs no storage: the model that produced a walkthrough is already recorded
123
- in its cache entry, so reopening a panel resolves the picker as *explicit choice
124
- → model that generated what is on screen → settings*. Because the model is part
125
- of the cache key, switching models and back returns the earlier review for free.
126
-
127
- The picker hides models the catalog reports as `structured_output: false` —
128
- offering them would move the same refusal one click later — and, like the small
129
- model picker, only shows providers with a usable login. The in-panel picker on a
130
- blocked walkthrough writes this setting too, so recovering from a refusal never
131
- silently changes the model behind commit messages.
132
-
133
- A settings or `opencode.json` `small_model` override can still name a provider
134
- with no usable login (neither `auth.json` nor `provider.<id>.options.apiKey`).
135
- `describeSmallModel` reports that as `hasLogin: false`, readiness refuses with
136
- `reason: 'no-provider-login'` and omits the unusable model so the panel cannot
137
- present it as selected, and generation maps the same code to HTTP 401. The UI
138
- disables Generate and keeps the picker on authenticated providers only — it does
139
- not surface a raw auth error or a special login blocker for this case.
140
-
141
- ## Output language
142
-
143
- A walkthrough its reader cannot read is worth nothing, so the prose language is
144
- a per-review choice in the panel header, defaulting to the interface language.
145
- Like the model it is request state rather than a setting: it travels as
146
- `language` on `GET` and `POST`, and it is not persisted, because the language a
147
- walkthrough was written in is already recorded in its cache entry and returned
148
- as `language` — which makes it the better default on reopen than any remembered
149
- preference. Resolution is *explicit choice → language of what is on screen →
150
- interface locale*.
151
-
152
- Only prose is translated. Hunk aliases are keys that resolve back to hunk ids,
153
- and `icon`/`importance` are validated against fixed English values, so a
154
- translated one is dropped by the normalizer — losing an anchor or a style
155
- silently. The prompt says so explicitly.
156
-
157
- `languages.js` owns the accepted tags; they match the UI's `Locale` union, and
158
- anything else — unknown, malformed, absent — resolves to English rather than
159
- failing the request. The two lists cannot be one, because the server cannot
160
- import from `packages/ui`, so `languages.test.js` reads `i18n/runtime.ts` and
161
- compares them. That test exists because a locale added to the interface alone
162
- fails silently in the worst way: the picker offers the language, the tag
163
- resolves to English, and the reader pays for a walkthrough written in the wrong
164
- one while the picker still names theirs. The default language adds no instruction at all, since the
165
- system prompt is already English.
166
-
167
- The language is part of the cache key. Without that, asking for a translation
168
- would be answered with the untranslated entry that was already there; with it,
169
- switching language and back returns the earlier walkthrough for free, exactly as
170
- switching models does.
171
-
172
- The read follows the same rule: `GET` builds the cache key for the language and
173
- model being asked for and answers from that entry when it exists, before
174
- consulting the pointer. The pointer alone was not enough — it records what was
175
- generated here *last*, which after a switch is the answer to a different
176
- question, and the panel kept showing the English review while the picker said
177
- Ukrainian and the Ukrainian one sat unused in the cache. The key is computed
178
- from the diff the read already parsed, so this costs one file read and no extra
179
- git work.
180
-
181
- Falling back to the pointer still happens when nothing exists in the requested
182
- language: an English review beats an empty panel, and the response says which
183
- language it is in so the panel can say so too — it shows a banner naming what is
184
- on screen versus what was asked for, and only once a read has settled, because
185
- claiming something is missing while still looking for it is the same flicker in
186
- another place. Serving an entry makes it the last
187
- one shown here, so the pointer follows it — otherwise a regeneration would
188
- re-author from a walkthrough the reader is not looking at.
189
-
190
- Attaching to a running job still ignores the language of the second request,
191
- because the job already has one. That matches how the model behaves.
192
-
193
- ## Structured output, and what happens when it is refused
194
-
195
- `structured_output: false` in the catalog blocks generation up front. A
196
- **missing** capability field does not block — the catalog omits it for roughly
197
- half of all models, and treating unknown as unsupported would hide models that
198
- work.
199
-
200
- Providers that do not declare the capability sometimes reject the schema at
201
- request time (a plain `400`, or Alibaba/Qwen's "'messages' must contain the word
202
- 'json'"). A rejected request shape is not a dead end, so a `4xx` on a schema
203
- request triggers exactly one retry with the schema moved into the prompt and the
204
- tolerant parser handling the result. Only if *that* fails to yield usable JSON is
205
- `structured-output-unsupported` reported — at which point it is a real capability
206
- problem the user can fix by switching model.
207
-
208
- The refusal is then remembered per `provider/model` and the fallback goes first
209
- from then on. Without that, every generation on such a provider pays for a call
210
- whose failure is already known. The memory is process-lifetime only on purpose:
211
- a provider that gains structured-output support should not need a settings
212
- change to be tried again, and one wasted first attempt after a restart is cheap.
213
-
214
- The system prompt states "respond with a single JSON object" explicitly, which
215
- also satisfies the providers that scan the request for the word `json` before
216
- honouring `response_format`. That keeps them on the fast path instead of paying
217
- for a wasted first call.
218
-
219
- ## Output budget
220
-
221
- A walkthrough itself is only a few thousand tokens of JSON. The budget exists
222
- for what comes before it: reasoning models spend the same allowance thinking and
223
- return nothing when it runs out, which is a bill for no answer.
224
-
225
- The ask is therefore derived from the resolved model rather than fixed:
226
- `min(96k, max(24k, a quarter of the context))`, then capped by the catalog's
227
- `limit.output`. A flat 24k was the same number for a 64k-context model and for
228
- one that admits to 384k output tokens and a million of context — and on the
229
- latter it was the only reason generation failed.
230
-
231
- The bounds are not arbitrary. The **same number is reserved from the input
232
- allowance**, so the ceiling and the context share are what stop a generous
233
- answer budget from eating the diff it is supposed to describe; the 24k floor is
234
- what this feature always asked for, so no model gets less room than before. A
235
- model whose own `limit.output` is below the floor gets its limit, because asking
236
- for more than a provider allows is rejected by some and ignored by others.
237
-
238
- `describeSmallModel` decides this once — the walkthrough hands it the rule as a
239
- function and reads back `outputTokens` — so the reserve and the request cannot
240
- drift apart.
241
-
242
- When a model exhausts even that, `code: 'output-exhausted'` reports it as what
243
- it is: this model cannot finish this job, so pick another or review a narrower
244
- scope.
245
-
246
- ## Caching and staleness
247
-
248
- **Cache entries** (`entries/<sha256>.json`) are immutable and content-addressed.
249
- The key covers walkthrough version, prompt version, repo root, source, provider,
250
- model, output language, and every file's path/status/hunk-ids. The key is computed from the
251
- *current* diff, so a hit means the walkthrough was written about exactly this
252
- code; there is no freshness question to ask of an entry, because staleness is a
253
- miss. Returning the working tree to an earlier state therefore costs nothing.
254
-
255
- **Pointers** (`pointers/<sha256(repoRoot + source)>.json`) are mutable and hold
256
- `{ cacheKey, generatedAt, repoRoot, sourceKey }`. They answer what the cache
257
- cannot: which walkthrough was last shown here, and has the code moved since. A
258
- pointer whose entry has been evicted reads as "no walkthrough" — truthful, and
259
- the next generation overwrites it.
260
-
261
- A pointer is a *fallback*, not the primary lookup. A read that can name the
262
- entry it wants — same diff, same model, same language — goes straight to it and
263
- moves the pointer there; the pointer answers only when nothing matches the
264
- request exactly.
265
-
266
- Regeneration is manual and re-authors rather than merges: the previous
267
- walkthrough goes into the prompt as prose so the model can keep what is still
268
- true, with its anchors deliberately stripped so everything is re-anchored
269
- against the current digest. Splicing partially-regenerated chapters into an old
270
- narrative was considered and rejected — the seams produce stops that contradict
271
- each other, and the failure is invisible.
272
-
273
- ## Hygiene
274
-
275
- - Entries are bounded by count and total size (200 / 50 MB) and evicted
276
- least-recently-used after a write that crosses a limit. Nothing is dropped for
277
- being merely old: an entry costs kilobytes and stays reachable if the working
278
- tree ever returns to that state.
279
- - Writes are tmp+rename; reads enforce a size limit and validate the version, so
280
- a corrupt file is a miss rather than a crash.
281
- - Pointers are never evicted by size. They are pruned only when their repository
282
- is **provably gone**, deferred off the request path, fully asynchronous, and
283
- capped.
284
-
285
- That last point is deliberate rather than incidental. The desktop app hosts this
286
- server inside the Electron main process, so a synchronous loop here would stall
287
- IPC and the window rather than a single request — and the paths being checked
288
- are user repositories, where a worktree on an unplugged drive or an unreachable
289
- share can make one existence check hang for seconds. Only `ENOENT` deletes a
290
- pointer: unreachable is not the same as gone, and a dead share must not cost the
291
- user their walkthroughs.
292
-
293
- ## Coverage
294
-
295
- The model is told it may leave mechanical changes out. Whatever it does not
296
- anchor is computed as `uncoveredHunkIds` and rendered as a collapsed tail, so
297
- the reader can always answer "have I seen everything that changed". No hunk
298
- disappears from the view.
299
-
300
- ## Cost of reading
301
-
302
- Opening the panel is a `GET` that runs the whole git pipeline, so it is kept as
303
- cheap as the data allows:
304
-
305
- - Untracked files come from `listUntrackedPaths` (a plain `ls-files`) rather
306
- than `getStatus`, which also computes ahead/behind, diff stats, and merge
307
- state — roughly 180ms of work for an answer this module discards.
308
- - Their diffs go through `getUntrackedDiffs`, which resolves the repository once
309
- for the whole batch and bounds concurrency, instead of one `getDiff` per file
310
- each re-resolving the repository.
311
- - Readiness is computed from the same diff as the walkthrough itself. It used to
312
- be its own endpoint that the client called in parallel, which meant every
313
- panel open ran the entire pipeline twice.
314
-
315
- On a working tree of 80 files and 138 hunks this took a panel open from ~800ms
316
- to ~340ms. Parsing and digest building are ~3ms of that; everything else is git.
317
-
318
- ## Generation outlives its request
319
-
320
- A dropped connection and a deliberate cancel are indistinguishable at the
321
- socket, so tying generation to the request lifetime meant an accidental refresh
322
- threw away a minute of paid-for work. Instead:
323
-
324
- - Jobs live in a module-level map keyed by repository + source. A second
325
- `generate` for the same source **attaches to the running job** rather than
326
- starting a rival one — pressing the button again after a refresh costs
327
- nothing extra.
328
- - Leaving the page detaches the client; the job finishes and writes its cache
329
- entry, so coming back finds the result waiting.
330
- - `GET /api/walkthrough` reports `generating`, letting a returning client show
331
- progress instead of an empty panel, and the client re-attaches so the result
332
- lands somewhere.
333
- - Stopping is an explicit `POST /api/walkthrough/cancel`. That is the only thing
334
- that aborts the model call.
335
-
336
- The cost of this is that a job everyone abandoned keeps spending until it
337
- finishes; the generation timeout bounds it.
338
-
339
- That timeout is a hang guard, not a pace-setter, and it scales with the diff:
340
- 120s plus 1s per hunk, capped at 15 minutes. A fixed number made a three-hunk
341
- edit and a 500-hunk pull request wait the same, which guarded nothing in the
342
- small case and risked killing the big one just short of the finish line. It errs
343
- long on purpose — losing a nearly-complete generation costs real money, while an
344
- over-long deadline only holds a job slot. Note that the schema fallback can use
345
- the deadline twice, once per attempt.
346
-
347
- ## Progress
348
-
349
- A running job records a coarse stage: `collecting` (reading the diff, which for
350
- a pull request is seconds of network), `asking`, `retrying` when a provider
351
- rejects the schema and the prompt-side fallback runs, and `assembling`.
352
-
353
- Only phases a person can wait on are named. Building the digest and reading the
354
- cache take single-digit milliseconds; giving them rows would imply progress that
355
- is not happening.
356
-
357
- `retrying` exists for diagnostics but is **not shown**: from outside it is the
358
- same wait on the same model, and naming our fallback only raises the question of
359
- what it is. The client folds it into `asking`.
360
-
361
- The client also paces the display, holding each step for a floor before
362
- revealing the next and keeping the list on screen briefly after the work ends.
363
- Assembling takes milliseconds, so without that the result replaces the list
364
- before the final step is ever seen finishing — naming a step the user never
365
- observes is worse than not naming it. The cost is well under a second at the end
366
- of a wait measured in minutes.
367
-
368
- `GET /api/walkthrough/progress` reads the job registry and nothing else — no git,
369
- no network — so the client can poll it once a second. The full read must never
370
- be used for this: it re-runs the whole git pipeline.
371
-
372
- ## Routes
373
-
374
- - `GET /api/walkthrough?directory&source&model&language` — last walkthrough, the
375
- current hunk index, staleness, and `readiness`. Never generates. `language`
376
- matters here because readiness is measured against the prompt that would be
377
- sent, and the language instruction is part of it.
378
- - `POST /api/walkthrough/generate` — `{ directory, source, force, model, language }`. Survives
379
- client disconnects; a concurrent call for the same source joins the running
380
- job.
381
- - `GET /api/walkthrough/progress?directory&source` — the current stage, or
382
- `null`. Memory-only and safe to poll.
383
- - `POST /api/walkthrough/cancel` — `{ directory, source }`; aborts a running
384
- generation.
385
-
386
- There is deliberately no delete route: regeneration covers the need, and an
387
- endpoint nothing calls is a maintenance surface that rots untested.
388
-
389
- Registered lazily from `feature-routes-runtime.js`. `/api/walkthrough` is in the
390
- JSON body-parser allowlist in `core-routes.js`.
391
-
392
- ## A server that does not have these routes
393
-
394
- An `/api/*` path no AiWorker route claims reaches the OpenCode proxy, and
395
- OpenCode answers any path it does not know with its embedded web UI — HTML, with
396
- status **200**. So a client newer than the server it is connected to is not told
397
- "no such route"; it is handed a web page. Parsing that as JSON is where
398
- `Unexpected token '<', "<!doctype "...` came from, a message that names neither
399
- the cause nor the remedy.
400
-
401
- The client therefore checks the content type before parsing. A non-JSON answer
402
- on 2xx or 404 becomes `server-unsupported`, which the panel renders as "this
403
- server is older than the app, update it". A non-JSON **5xx** keeps its own
404
- failure: a server that answered badly is not a server missing the feature, and
405
- telling someone to upgrade would send them after the wrong thing.
406
-
407
- ## Runtime availability
408
-
409
- Web, desktop, and hosted mobile reach these routes normally. VS Code serves Git
410
- through its own bridge rather than the AiWorker Git routes, so the feature is
411
- not offered there; the surface is also gated to tablet width and above.