@openchamber/web 1.18.4 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (251) hide show
  1. package/README.md +1 -0
  2. package/dist/assets/{CodeMirrorCommentWidgets-4qZbrEXU.js → CodeMirrorCommentWidgets-C36E738Y.js} +1 -1
  3. package/dist/assets/{CommitSection-MJmntVPJ.js → CommitSection-C-F3AX6D.js} +1 -1
  4. package/dist/assets/{DiagramEditor-jnG3Hbxg.js → DiagramEditor-BPECg1jS.js} +1 -1
  5. package/dist/assets/DiagramView-D0YNMix8.js +1 -0
  6. package/dist/assets/DiffView-BHWaMYCC.js +4 -0
  7. package/dist/assets/FilesView-NMBCW2Tm.js +14 -0
  8. package/dist/assets/{GitView-DBFrDDBv.js → GitView-Rp8P1KEI.js} +4 -4
  9. package/dist/assets/{JsonTreeView-DLW2Wy1g.js → JsonTreeView-KnXFN2A-.js} +1 -1
  10. package/dist/assets/MarkdownImageGallery-BMn3mtor.js +1 -0
  11. package/dist/assets/MarkdownRendererImpl-kD6N03pH.js +12 -0
  12. package/dist/assets/OnboardingScreen-CenIeD4v.js +1 -0
  13. package/dist/assets/{PatchDiff-BuLPx7AN.js → PatchDiff-BzVOVog8.js} +1 -1
  14. package/dist/assets/{PierreDiffViewer-BHm4Yr0X.js → PierreDiffViewer-Dlby4XqT.js} +2 -2
  15. package/dist/assets/PlanView-Czu1KMJa.js +4 -0
  16. package/dist/assets/SessionSwitcherDropdown-IETz58DB.js +1 -0
  17. package/dist/assets/SettingsView-B6vmuf-c.js +28 -0
  18. package/dist/assets/SettingsWindow-CauZpdD3.js +1 -0
  19. package/dist/assets/ToolOutputDialog-BB1c--Zr.js +15 -0
  20. package/dist/assets/ToolPartDiffPreview-DaOIDISD.js +8 -0
  21. package/dist/assets/{VirtualizedFileDiff-CwGocYQd.js → VirtualizedFileDiff-lESMT-2b.js} +4 -4
  22. package/dist/assets/{WalkthroughView-5DyvN03T.js → WalkthroughView-CaSYE0lw.js} +2 -2
  23. package/dist/assets/{computeVirtualFileMetrics-Da00Jg7M.js → computeVirtualFileMetrics-DkRR5b75.js} +2 -2
  24. package/dist/assets/contextPanelEmbeddedChat-BEARQjgn.js +1 -0
  25. package/dist/assets/de-DFdX3ABv.js +9 -0
  26. package/dist/assets/document-attachments-DFAWlG3U.js +31 -0
  27. package/dist/assets/es-iC-FKvV9.js +15 -0
  28. package/dist/assets/fr-BBbi_1AL.js +13 -0
  29. package/dist/assets/index-BiEgzzkg.js +1 -0
  30. package/dist/assets/index-Cwmuwk3V.js +7 -0
  31. package/dist/assets/index-GNm1wgUH.css +1 -0
  32. package/dist/assets/{isDiffPlainText-D9YpoLrV.js → isDiffPlainText-BG53Ixxy.js} +1 -1
  33. package/dist/assets/{isFilePlainText-gTibdNIe.js → isFilePlainText-BbV-39jl.js} +1 -1
  34. package/dist/assets/ja-DQLQJL2J.js +15 -0
  35. package/dist/assets/ko-BeElEB4Y.js +15 -0
  36. package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
  37. package/dist/assets/main-Dpzo18z7.js +2 -0
  38. package/dist/assets/main-WMjtYzJs.js +921 -0
  39. package/dist/assets/markdownCore--tDmyI_v.js +2 -0
  40. package/dist/assets/miniChat-ldEghBLB.js +2 -0
  41. package/dist/assets/mobile-Dk-VGreF.js +2 -0
  42. package/dist/assets/{patchFileDiff-KNkxM1C1.js → patchFileDiff-BcFaMtMu.js} +1 -1
  43. package/dist/assets/pl-CLHt2_vV.js +15 -0
  44. package/dist/assets/pt-BR-C_MPUq7e.js +15 -0
  45. package/dist/assets/renderElectronMiniChatApp-DIgCOmXY.js +2 -0
  46. package/dist/assets/renderMobileApp-CDfHS5rr.js +25 -0
  47. package/dist/assets/runtimeEndpointReset-ovNbaZ-x.js +15 -0
  48. package/dist/assets/scheduledTasksApi-BFSlqgnG.js +1 -0
  49. package/dist/assets/{shikiHighlight-C7LTbwFx.js → shikiHighlight-DCT2Sq_z.js} +1 -1
  50. package/dist/assets/uk-PhsC-c4-.js +15 -0
  51. package/dist/assets/{useAppFontEffects-BikB6enL.js → useAppFontEffects-B53Rb6m7.js} +168 -164
  52. package/dist/assets/useInlineCommentController-DSfrIBKT.js +2 -0
  53. package/dist/assets/{vendor-base-ui-D_V6hAcE.js → vendor-base-ui-DsHmyMwp.js} +1 -1
  54. package/dist/assets/vendor-codemirror-autocomplete-DzPz9Wgq.js +1 -0
  55. package/dist/assets/vendor-codemirror-commands-B7H_j0iU.js +1 -0
  56. package/dist/assets/{vendor-codemirror-lang-angular-CgY7_gQ1.js → vendor-codemirror-lang-angular-DEPs2M5t.js} +1 -1
  57. package/dist/assets/{vendor-codemirror-lang-cpp-B5Ta4enQ.js → vendor-codemirror-lang-cpp-DhkseaMo.js} +1 -1
  58. package/dist/assets/{vendor-codemirror-lang-css-VgNqFSH-.js → vendor-codemirror-lang-css-O0cZX78y.js} +1 -1
  59. package/dist/assets/{vendor-codemirror-lang-go-LxLz62pp.js → vendor-codemirror-lang-go-fMdQYcON.js} +1 -1
  60. package/dist/assets/vendor-codemirror-lang-html-CfgK872x.js +1 -0
  61. package/dist/assets/{vendor-codemirror-lang-java-Bksi1PH4.js → vendor-codemirror-lang-java-CQj4S3zl.js} +1 -1
  62. package/dist/assets/vendor-codemirror-lang-javascript-Cc2ZYbgX.js +13 -0
  63. package/dist/assets/{vendor-codemirror-lang-jinja-C7npuDD7.js → vendor-codemirror-lang-jinja-BmZZv8g-.js} +1 -1
  64. package/dist/assets/{vendor-codemirror-lang-json-ryCw7nab.js → vendor-codemirror-lang-json-CMBS2tG9.js} +1 -1
  65. package/dist/assets/{vendor-codemirror-lang-less-BxsZJD6N.js → vendor-codemirror-lang-less-C6Eo8hVS.js} +1 -1
  66. package/dist/assets/{vendor-codemirror-lang-liquid-De6qch10.js → vendor-codemirror-lang-liquid-DSTR47-H.js} +1 -1
  67. package/dist/assets/vendor-codemirror-lang-markdown-BPGOH9ye.js +1 -0
  68. package/dist/assets/{vendor-codemirror-lang-php-Cm1es33p.js → vendor-codemirror-lang-php-DD9udfPH.js} +1 -1
  69. package/dist/assets/{vendor-codemirror-lang-python-N414WYK-.js → vendor-codemirror-lang-python-HahnQaAS.js} +1 -1
  70. package/dist/assets/{vendor-codemirror-lang-rust-C_WuUStH.js → vendor-codemirror-lang-rust-nLTovbjv.js} +1 -1
  71. package/dist/assets/{vendor-codemirror-lang-sass-8UHTCAOM.js → vendor-codemirror-lang-sass-pL2Yc72v.js} +1 -1
  72. package/dist/assets/{vendor-codemirror-lang-sql-CV3sMA5D.js → vendor-codemirror-lang-sql-BVBnan19.js} +1 -1
  73. package/dist/assets/{vendor-codemirror-lang-vue-DzvC1Dhk.js → vendor-codemirror-lang-vue-BqGzJVm1.js} +1 -1
  74. package/dist/assets/{vendor-codemirror-lang-wast-jlr-LDdA.js → vendor-codemirror-lang-wast-B0_m5DqU.js} +1 -1
  75. package/dist/assets/{vendor-codemirror-lang-xml-CrO63OVp.js → vendor-codemirror-lang-xml-Dj3voadT.js} +1 -1
  76. package/dist/assets/{vendor-codemirror-lang-yaml-dxi6CISW.js → vendor-codemirror-lang-yaml-yu-9Z5u7.js} +1 -1
  77. package/dist/assets/vendor-codemirror-language-BgPj_McA.js +3 -0
  78. package/dist/assets/{vendor-codemirror-language-data-CLHw8NWn.js → vendor-codemirror-language-data-vch3tJ4c.js} +2 -2
  79. package/dist/assets/vendor-codemirror-search-BmS-GmcX.js +2 -0
  80. package/dist/assets/{vendor-codemirror-state-CNWM3Q8V.js → vendor-codemirror-state-C9awkmn-.js} +5 -5
  81. package/dist/assets/vendor-codemirror-view-CiLROUVV.js +4 -0
  82. package/dist/assets/vendor-replit-codemirror-vim-B2DJlAhT.js +6 -0
  83. package/dist/assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js +34 -0
  84. package/dist/assets/vendor-zod-C9ioTTSo.js +39 -0
  85. package/dist/assets/{web-components-GMc3oR3i.js → web-components-pcwCTWjC.js} +4 -4
  86. package/dist/assets/zh-CN-wF-NOFHM.js +15 -0
  87. package/dist/assets/zh-TW-4m4-A7rT.js +15 -0
  88. package/dist/index.html +5 -4
  89. package/dist/mini-chat.html +4 -3
  90. package/dist/mobile.html +4 -3
  91. package/package.json +3 -5
  92. package/server/index.js +152 -3
  93. package/server/lib/agent-memory/actions.js +243 -0
  94. package/server/lib/agent-memory/actions.test.js +343 -0
  95. package/server/lib/agent-memory/feature-flag.js +19 -0
  96. package/server/lib/agent-memory/feature-flag.test.js +38 -0
  97. package/server/lib/agent-memory/project-resolution.js +65 -0
  98. package/server/lib/agent-memory/project-resolution.test.js +94 -0
  99. package/server/lib/agent-memory/routes.http.test.js +270 -0
  100. package/server/lib/agent-memory/routes.js +169 -0
  101. package/server/lib/agent-memory/runtime.js +432 -0
  102. package/server/lib/agent-memory/runtime.test.js +344 -0
  103. package/server/lib/agent-memory/threat-patterns.js +61 -0
  104. package/server/lib/agent-memory/threat-patterns.test.js +61 -0
  105. package/server/lib/agent-tool/DOCUMENTATION.md +14 -0
  106. package/server/lib/agent-tool/runtime.js +63 -13
  107. package/server/lib/agent-tool/runtime.test.js +85 -2
  108. package/server/lib/context-obligatory/runtime.js +34 -3
  109. package/server/lib/context-obligatory/runtime.test.js +114 -0
  110. package/server/lib/dictation/DOCUMENTATION.md +32 -8
  111. package/server/lib/dictation/local/sherpa-recognizer.js +35 -78
  112. package/server/lib/dictation/local/worker-process.js +2 -2
  113. package/server/lib/dictation/openai-compatible-session.js +3 -2
  114. package/server/lib/dictation/stream-manager.js +77 -34
  115. package/server/lib/dictation/stream-manager.test.js +60 -2
  116. package/server/lib/fs/DOCUMENTATION.md +3 -0
  117. package/server/lib/fs/routes.js +149 -32
  118. package/server/lib/fs/routes.test.js +301 -0
  119. package/server/lib/git/DOCUMENTATION.md +8 -0
  120. package/server/lib/git/routes.js +43 -0
  121. package/server/lib/git/service.js +206 -72
  122. package/server/lib/git/service.test.js +222 -0
  123. package/server/lib/github/DOCUMENTATION.md +14 -3
  124. package/server/lib/github/pr-status.js +188 -83
  125. package/server/lib/github/pr-status.test.js +182 -0
  126. package/server/lib/github/routes.js +36 -30
  127. package/server/lib/notifications/template-runtime.js +2 -3
  128. package/server/lib/openchamber-control/action-resolution.test.js +65 -0
  129. package/server/lib/openchamber-control/actions.js +78 -0
  130. package/server/lib/openchamber-control/service.js +7 -0
  131. package/server/lib/openchamber-sessions/routes.js +14 -0
  132. package/server/lib/opencode/DOCUMENTATION.md +12 -6
  133. package/server/lib/opencode/claude-cli-auth.js +60 -0
  134. package/server/lib/opencode/claude-cli-auth.test.js +54 -0
  135. package/server/lib/opencode/feature-routes-runtime.js +16 -9
  136. package/server/lib/opencode/lifecycle.js +202 -26
  137. package/server/lib/opencode/lifecycle.test.js +179 -1
  138. package/server/lib/opencode/plugins.js +12 -3
  139. package/server/lib/opencode/plugins.test.js +18 -0
  140. package/server/lib/opencode/providers.js +9 -4
  141. package/server/lib/opencode/providers.test.js +27 -0
  142. package/server/lib/opencode/proxy-agent-wiring.test.js +152 -0
  143. package/server/lib/opencode/proxy.js +116 -6
  144. package/server/lib/opencode/proxy.test.js +158 -1
  145. package/server/lib/opencode/restart-session-recovery.test.js +59 -0
  146. package/server/lib/opencode/routes.js +4 -1
  147. package/server/lib/opencode/session-runtime.js +39 -2
  148. package/server/lib/opencode/session-runtime.test.js +74 -0
  149. package/server/lib/opencode/settings-helpers.js +26 -0
  150. package/server/lib/opencode/settings-helpers.test.js +57 -0
  151. package/server/lib/opencode/settings-normalization-runtime.js +3 -0
  152. package/server/lib/opencode/settings-normalization-runtime.test.js +16 -0
  153. package/server/lib/opencode/settings-runtime.js +83 -10
  154. package/server/lib/opencode/settings-runtime.test.js +85 -0
  155. package/server/lib/opencode/shared.js +120 -16
  156. package/server/lib/opencode/shared.test.js +185 -1
  157. package/server/lib/opencode/skill-routes.js +29 -73
  158. package/server/lib/opencode/skill-routes.test.js +2 -5
  159. package/server/lib/project-context/DOCUMENTATION.md +160 -0
  160. package/server/lib/project-context/routes.http.test.js +264 -0
  161. package/server/lib/project-context/routes.js +237 -0
  162. package/server/lib/project-context/runtime.js +672 -0
  163. package/server/lib/project-context/runtime.test.js +498 -0
  164. package/server/lib/projects/project-config.js +7 -2
  165. package/server/lib/quota/DOCUMENTATION.md +17 -2
  166. package/server/lib/quota/providers/claude/auth.js +113 -0
  167. package/server/lib/quota/providers/claude/auth.test.js +117 -0
  168. package/server/lib/quota/providers/claude/index.js +151 -0
  169. package/server/lib/quota/providers/claude/index.test.js +147 -0
  170. package/server/lib/quota/providers/claude/transforms.js +127 -0
  171. package/server/lib/quota/providers/claude/transforms.test.js +82 -0
  172. package/server/lib/quota/providers/command-code.js +90 -0
  173. package/server/lib/quota/providers/command-code.test.js +85 -0
  174. package/server/lib/quota/providers/index.js +30 -2
  175. package/server/lib/quota/providers/index.test.js +10 -1
  176. package/server/lib/quota/providers/zai.js +26 -6
  177. package/server/lib/quota/providers/zai.test.js +33 -0
  178. package/server/lib/quota/utils/formatters.js +2 -1
  179. package/server/lib/scheduled-tasks/runtime.js +21 -2
  180. package/server/lib/session-knowledge/DOCUMENTATION.md +89 -0
  181. package/server/lib/session-knowledge/routes.js +107 -0
  182. package/server/lib/session-knowledge/runtime.js +331 -0
  183. package/server/lib/session-knowledge/runtime.test.js +275 -0
  184. package/server/lib/skills-catalog/DOCUMENTATION.md +18 -45
  185. package/server/lib/skills-catalog/cache.js +120 -1
  186. package/server/lib/skills-catalog/cache.test.js +77 -0
  187. package/server/lib/skills-catalog/curated-sources.js +21 -5
  188. package/server/lib/skills-catalog/curated-sources.test.js +10 -0
  189. package/server/lib/skills-catalog/disk-cache.js +52 -0
  190. package/server/lib/skills-catalog/github-meta.js +139 -0
  191. package/server/lib/skills-catalog/github-meta.test.js +71 -0
  192. package/server/lib/skills-catalog/source.js +0 -5
  193. package/server/lib/small-model/DOCUMENTATION.md +74 -6
  194. package/server/lib/small-model/call.js +46 -12
  195. package/server/lib/small-model/call.test.js +79 -0
  196. package/server/lib/small-model/index.js +57 -6
  197. package/server/lib/small-model/index.test.js +102 -2
  198. package/server/lib/small-model/routes.js +4 -2
  199. package/server/lib/small-model/runtime-providers.js +156 -0
  200. package/server/lib/small-model/runtime-providers.test.js +112 -0
  201. package/dist/assets/DiagramView-CFXxgg_a.js +0 -1
  202. package/dist/assets/DiffView-DZIoOnV7.js +0 -4
  203. package/dist/assets/FilesView-BKL6YlKG.js +0 -14
  204. package/dist/assets/MarkdownImageGallery-DKIylIK7.js +0 -1
  205. package/dist/assets/MarkdownRendererImpl-CLv8hxvv.js +0 -12
  206. package/dist/assets/OnboardingScreen-D2Y6djMw.js +0 -1
  207. package/dist/assets/PlanView-ZYEJn8A_.js +0 -4
  208. package/dist/assets/SessionSwitcherDropdown-rro-SsaO.js +0 -1
  209. package/dist/assets/SettingsView-5RmswFZe.js +0 -28
  210. package/dist/assets/SettingsWindow-BZhAYFdS.js +0 -1
  211. package/dist/assets/ToolOutputDialog-Za6V4VMJ.js +0 -15
  212. package/dist/assets/ToolPartDiffPreview-BL-9ixyC.js +0 -8
  213. package/dist/assets/contextPanelEmbeddedChat-B-bSg3P5.js +0 -1
  214. package/dist/assets/de-u7gSnqWs.js +0 -9
  215. package/dist/assets/document-attachments-CX_YaDsu.js +0 -30
  216. package/dist/assets/es-T9O7aAOr.js +0 -15
  217. package/dist/assets/fr-Oor7ewbE.js +0 -13
  218. package/dist/assets/index-BzIpNlNE.css +0 -1
  219. package/dist/assets/index-C0yNhuZw.js +0 -1
  220. package/dist/assets/index-DRpChWux.js +0 -7
  221. package/dist/assets/ja-DHpqbVmr.js +0 -15
  222. package/dist/assets/ko-CwLkS3nx.js +0 -15
  223. package/dist/assets/main-D7UcL3VQ.js +0 -2
  224. package/dist/assets/main-DPMd2iKS.js +0 -915
  225. package/dist/assets/markdownCore-DDrHVneM.js +0 -2
  226. package/dist/assets/miniChat-O_GVoEbc.js +0 -2
  227. package/dist/assets/mobile-Br4TtAqc.js +0 -2
  228. package/dist/assets/pl-CcZILN8q.js +0 -15
  229. package/dist/assets/pt-BR-DYHhVK6o.js +0 -15
  230. package/dist/assets/renderElectronMiniChatApp-CJpdxTT1.js +0 -2
  231. package/dist/assets/renderMobileApp-toj9cXoh.js +0 -25
  232. package/dist/assets/runtimeEndpointReset-BVmispdD.js +0 -13
  233. package/dist/assets/scheduledTasksApi-ByKya3Un.js +0 -1
  234. package/dist/assets/uk-BA2kZR38.js +0 -15
  235. package/dist/assets/useInlineCommentController-CYPvYJDt.js +0 -2
  236. package/dist/assets/vendor-codemirror-autocomplete-BjbBRsUA.js +0 -1
  237. package/dist/assets/vendor-codemirror-commands-ARAOgp1x.js +0 -1
  238. package/dist/assets/vendor-codemirror-lang-html-B3Qe3OpS.js +0 -1
  239. package/dist/assets/vendor-codemirror-lang-javascript-Bbw3D7r0.js +0 -13
  240. package/dist/assets/vendor-codemirror-lang-markdown-FGQydhTc.js +0 -1
  241. package/dist/assets/vendor-codemirror-language-DUOssd4j.js +0 -3
  242. package/dist/assets/vendor-codemirror-search-8kyQdB3f.js +0 -2
  243. package/dist/assets/vendor-codemirror-view-DSzLbZiS.js +0 -4
  244. package/dist/assets/vendor-replit-codemirror-vim-B0Ecqnlh.js +0 -39
  245. package/dist/assets/zh-CN-dlOQK6v9.js +0 -15
  246. package/dist/assets/zh-TW-BnqQ-WL5.js +0 -15
  247. package/server/lib/quota/providers/claude.js +0 -107
  248. package/server/lib/skills-catalog/clawdhub/api.js +0 -126
  249. package/server/lib/skills-catalog/clawdhub/install.js +0 -238
  250. package/server/lib/skills-catalog/clawdhub/install.test.js +0 -100
  251. package/server/lib/skills-catalog/clawdhub/scan.js +0 -61
@@ -15,6 +15,15 @@ other runtime API.
15
15
  ## Files
16
16
 
17
17
  - `index.js` — orchestration: `generateSmallModelText()` / `describeSmallModel()`.
18
+ - `runtime-providers.js` — provider state that exists only inside the running
19
+ OpenCode process. A plugin registers its provider from the `config` hook and
20
+ supplies the credential from its `auth` loader, so neither reaches
21
+ `opencode.json` nor `auth.json`; `GET /provider` is the only place they
22
+ become visible. The module caches one snapshot (30s TTL, shared in-flight
23
+ request) and answers `null` — never an empty provider list — when OpenCode is
24
+ unreachable, so a momentary outage cannot retract providers. It is wired once
25
+ from `server/index.js` and reset on OpenCode restart, which reloads plugins
26
+ and can move their ports and keys.
18
27
  - `resolve.js` — model selection, mirroring OpenCode's `getSmallModel` chain:
19
28
  0. OpenChamber's own settings override (Settings → Sessions → Small Model):
20
29
  when `smallModelUseDefault` is `false`, `smallModelOverride`
@@ -100,9 +109,17 @@ other runtime API.
100
109
  - Everything else: OpenAI-compatible `/chat/completions` against the
101
110
  provider's base URL, resolved from (1) `provider.<id>.options.baseURL`
102
111
  in the OpenCode config, (2) the hardcoded `https://api.openai.com/v1`
103
- endpoint, or (3) the provider's `api` field from the models.dev catalog.
104
- Configured API keys honor OpenCode's `{env:NAME}` and `{file:path}`
105
- substitutions; file contents and resolved credentials remain server-side.
112
+ endpoint, (3) the endpoint OpenCode resolved at runtime, or (4) the
113
+ provider's `api` field from the models.dev catalog. The credential follows
114
+ the same shape: config `options.apiKey`, then the runtime credential, then
115
+ the auth.json entry. Configured API keys honor OpenCode's `{env:NAME}` and
116
+ `{file:path}` substitutions; file contents and resolved credentials remain
117
+ server-side.
118
+ - The runtime credential is refused for providers listed in
119
+ `OWN_CREDENTIAL_HANDLING`. Their branches need the stored entry rather than
120
+ a bearer token: the clearest case is the ChatGPT-plan `openai` login, whose
121
+ runtime `options.apiKey` is an OAuth access token that `api.openai.com`
122
+ answers with 401.
106
123
  - `[small-model:diagnostic]` logs record provider/model, input character
107
124
  counts, output budget, thinking toggle, HTTP/finish status, and
108
125
  content/reasoning lengths without logging prompts, response text, or
@@ -110,11 +127,59 @@ other runtime API.
110
127
  `[session-goal:diagnostic]` structural verdict metadata.
111
128
  - `catalog.js` — models.dev catalog via the shared in-process cache
112
129
  (`../opencode/models-metadata.js`, also serving
113
- `/api/openchamber/models-metadata`).
130
+ `/api/openchamber/models-metadata`).
114
131
  - `routes.js` — `GET /api/small-model` (resolution preview) and
115
132
  `POST /api/small-model/generate` (`{ prompt, system?, maxOutputTokens?,
116
133
  model?, directory? }` → `{ text, providerID, modelID, source }`).
117
134
 
135
+ ## Which providers the pickers may offer
136
+
137
+ `listAuthenticatedProviders()` answers one question for the Small Model and
138
+ Changes Walkthrough pickers alike: which providers can this module actually
139
+ call. One rule decides it, applied the same way to every provider — **a
140
+ credential we are allowed to use, and an endpoint to send it to.** The
141
+ auth.json scan as before, plus the credential and endpoint OpenCode resolved
142
+ for a plugin provider.
143
+
144
+ **opencode zen is excluded without a real login.** When the user has no zen
145
+ credential, OpenCode substitutes the sentinel `options.apiKey = "public"` and
146
+ trims its catalog to the free models. Those run on OpenCode's own subsidised
147
+ infrastructure and are meant to be reached through OpenCode, so the sentinel is
148
+ never accepted as a credential — see `ZEN_ANONYMOUS_API_KEY`.
149
+
150
+ ### Why there is no capability probe
151
+
152
+ A plugin may implement its whole integration inside `options.fetch` —
153
+ rewriting the path, signing the request, translating the payload — and OpenCode
154
+ cannot serialise a function. Such a provider advertises an ordinary base URL
155
+ that answers nothing we know how to ask, and no reported field distinguishes it
156
+ from a plain one.
157
+
158
+ Asking the endpoint (`GET /models`) does identify that case correctly. It was
159
+ measured against all 166 providers carrying an `api` URL in the models.dev
160
+ catalog, and it also denies six of them — `cloudflare-workers-ai`,
161
+ `infomaniak`, `iflowcn`, `inference`, `kuae-cloud-coding-plan`,
162
+ `thinkingmachines` — which work fine and simply have no `/models` route. At a
163
+ 3.6% false-negative rate on providers known to work, the probe removes more
164
+ working models from the picker than broken ones, and a provider that silently
165
+ vanishes explains nothing while one that fails on use says why.
166
+
167
+ So availability stops at credential and endpoint, and the protocol verdict is
168
+ left to the call. A provider whose protocol lives in a plugin's `fetch` stays
169
+ selectable and fails when used — which is what it did before this resolution
170
+ existed.
171
+
172
+ Claude Code is refused unconditionally. A plugin can publish an
173
+ OpenAI-compatible endpoint for it, but that endpoint is a façade over the
174
+ Claude Agent SDK, which spawns the Claude Code CLI per request and spends the
175
+ user's Claude subscription rate limit. Paying that for a session title or a
176
+ summary is the wrong trade, so an available endpoint does not lift the
177
+ refusal — the cost is the reason, not the transport.
178
+
179
+ The result is served as `authenticatedProviders` on `GET /api/small-model`.
180
+ The field name predates the runtime resolution; it now means "callable", which
181
+ is a superset of "has an auth.json entry".
182
+
118
183
  ## Registration
119
184
 
120
185
  Mounted lazily from `feature-routes-runtime.js` (same pattern as quota): the
@@ -125,9 +190,12 @@ module is imported on first request, not at server startup.
125
190
  - OpenCode's free models (`opencode/big-pickle`, `*-free`) work without a
126
191
  token only through OpenCode's own server — direct calls are rejected, and
127
192
  piggybacking on their subsidized infra is out of bounds by design. Every
128
- resolution step therefore requires a usable auth entry for the provider:
193
+ resolution step therefore requires a credential we are allowed to use:
129
194
  a session on an unauthenticated `opencode` provider falls through to the
130
- global scan (or a clean 404 on a vanilla setup with no logins).
195
+ global scan (or a clean 404 on a vanilla setup with no logins). The runtime
196
+ snapshot does not weaken this — OpenCode reports the sentinel
197
+ `apiKey: "public"` for that state, and this module refuses to read it as a
198
+ credential.
131
199
 
132
200
  - Anthropic OAuth (Claude Pro/Max) entries are not supported — OpenCode itself
133
201
  keeps those outside `auth.json` in this generation; only `type: api` keys
@@ -5,6 +5,7 @@ import { readAuthFile, writeAuthFile } from '../opencode/auth.js';
5
5
  import { readConfig, readConfigLayers } from '../opencode/shared.js';
6
6
  import { getCatalogProvider } from './catalog.js';
7
7
  import { getAuthEntryForProvider } from './resolve.js';
8
+ import { getRuntimeProvider } from './runtime-providers.js';
8
9
 
9
10
  // Direct, non-streaming text generation against the provider APIs, replicating
10
11
  // how OpenCode authenticates each of them (see the plugin auth loaders in the
@@ -566,23 +567,52 @@ const readProviderConfig = (workingDirectory, providerID) => {
566
567
  // Dispatch
567
568
  // ---------------------------------------------------------------------------
568
569
 
570
+ /**
571
+ * Providers reached through a dedicated wire format below: a token exchange,
572
+ * an OAuth refresh, or a non-bearer header. OpenCode's runtime
573
+ * `options.apiKey` is not the value those branches need — the ChatGPT-plan
574
+ * `openai` login is the clearest case, where the runtime key is an OAuth
575
+ * access token that api.openai.com answers with 401 — so the runtime
576
+ * credential never stands in for them, and the runtime listing skips them
577
+ * because the auth.json scan already covers them.
578
+ */
579
+ export const DEDICATED_WIRE_FORMAT_PROVIDERS = new Set(['github-copilot', 'copilot', 'openai', 'anthropic', 'google']);
580
+
581
+ /**
582
+ * The runtime credential shaped as an auth entry, or `null` when the provider
583
+ * owns its credential handling or OpenCode reports nothing usable.
584
+ */
585
+ const runtimeCredential = (providerID, runtime) => (
586
+ !DEDICATED_WIRE_FORMAT_PROVIDERS.has(providerID) && runtime?.apiKey
587
+ ? { type: 'api', key: runtime.apiKey }
588
+ : null
589
+ );
590
+
569
591
  /**
570
592
  * Same credential resolution the request path uses: config
571
- * `provider.<id>.options.apiKey` wins, then the auth.json entry.
593
+ * `provider.<id>.options.apiKey` wins, then the runtime credential OpenCode
594
+ * resolved for a plugin provider, then the auth.json entry.
572
595
  * Callers that need to refuse before spending a request (walkthrough readiness)
573
596
  * must use this rather than inventing a second rule.
574
597
  */
575
- export function resolveProviderLogin({ auth, workingDirectory, providerID }) {
598
+ export async function resolveProviderLogin({ auth, workingDirectory, providerID }) {
576
599
  const providerConfig = readProviderConfig(workingDirectory, providerID);
577
- return providerConfig?.auth || getAuthEntryForProvider(auth, providerID) || null;
600
+ return providerConfig?.auth
601
+ || runtimeCredential(providerID, await getRuntimeProvider(providerID))
602
+ || getAuthEntryForProvider(auth, providerID)
603
+ || null;
578
604
  }
579
605
 
580
606
  export async function callSmallModel({ auth, catalog, workingDirectory, providerID, modelID, prompt, system, maxOutputTokens, responseSchema, timeoutMs, signal }) {
581
607
  const tokens = Number(maxOutputTokens) > 0 ? Number(maxOutputTokens) : DEFAULT_MAX_OUTPUT_TOKENS;
582
608
  const providerConfig = readProviderConfig(workingDirectory, providerID);
583
- // Match OpenCode's resolveSDK precedence:
584
- // config provider.<id>.options.apiKey wins; the auth.json entry is only a fallback.
585
- const entry = providerConfig?.auth || getAuthEntryForProvider(auth, providerID);
609
+ const runtimeProvider = await getRuntimeProvider(providerID);
610
+ // Match OpenCode's resolveSDK precedence: config `provider.<id>.options`
611
+ // wins, then what OpenCode itself resolved at runtime (the only place a
612
+ // plugin's credential exists), and the auth.json entry last.
613
+ const entry = providerConfig?.auth
614
+ || runtimeCredential(providerID, runtimeProvider)
615
+ || getAuthEntryForProvider(auth, providerID);
586
616
  if (!entry) {
587
617
  // Structured so the walkthrough (and any other caller) can show a blocker
588
618
  // instead of a raw 500 banner with this developer-oriented sentence.
@@ -685,9 +715,12 @@ export async function callSmallModel({ auth, catalog, workingDirectory, provider
685
715
  // Everything else: OpenAI-compatible chat completions against the catalog's
686
716
  // base URL for that provider (openai itself included). When a custom provider
687
717
  // is not in the catalog (e.g. a user-configured OpenAI-compatible proxy),
688
- // fall back to its baseURL from the OpenCode provider config. The openai
689
- // provider also respects provider.openai.options.baseURL — OpenCode itself
690
- // uses the same config for all providers including openai.
718
+ // fall back to its baseURL from the OpenCode provider config, then to the
719
+ // endpoint OpenCode resolved at runtime — which for a plugin provider is the
720
+ // only place it exists, and for several of them is a local proxy the plugin
721
+ // itself runs. The openai provider also respects
722
+ // provider.openai.options.baseURL — OpenCode itself uses the same config for
723
+ // all providers including openai.
691
724
  const provider = getCatalogProvider(catalog, providerID);
692
725
  const providerConfigUrl = providerConfig?.baseURL;
693
726
  const defaultOpenaiUrl = 'https://api.openai.com/v1';
@@ -695,9 +728,10 @@ export async function callSmallModel({ auth, catalog, workingDirectory, provider
695
728
  ? providerConfigUrl
696
729
  : providerID === 'openai'
697
730
  ? defaultOpenaiUrl
698
- : typeof provider?.api === 'string' && provider.api
699
- ? provider.api
700
- : null;
731
+ : runtimeProvider?.baseURL
732
+ ?? (typeof provider?.api === 'string' && provider.api
733
+ ? provider.api
734
+ : null);
701
735
  if (!baseURL) {
702
736
  throw new Error(`Provider "${providerID}" has no known API base URL`);
703
737
  }
@@ -12,8 +12,11 @@ vi.mock('../opencode/shared.js', () => ({
12
12
  readConfigLayers: vi.fn(),
13
13
  }));
14
14
 
15
+ vi.mock('./runtime-providers.js', () => ({ getRuntimeProvider: vi.fn(async () => null) }));
16
+
15
17
  const { callSmallModel } = await import('./call.js');
16
18
  const { readConfig, readConfigLayers } = await import('../opencode/shared.js');
19
+ const { getRuntimeProvider } = await import('./runtime-providers.js');
17
20
 
18
21
  // Minimal catalog fragment used by the catalog-based base URL resolution case.
19
22
  const CATALOG = {
@@ -55,6 +58,9 @@ describe('callSmallModel — custom provider config', () => {
55
58
  globalThis.fetch = fetchMock;
56
59
  readConfig.mockReset();
57
60
  readConfigLayers.mockReset();
61
+ // Default: OpenCode knows nothing, so resolution stays file-based.
62
+ getRuntimeProvider.mockReset();
63
+ getRuntimeProvider.mockResolvedValue(null);
58
64
  });
59
65
 
60
66
  afterEach(() => {
@@ -341,6 +347,79 @@ describe('callSmallModel — custom provider config', () => {
341
347
  prompt: 'hi',
342
348
  })).rejects.toThrow('Provider "custom" has no known API base URL');
343
349
  });
350
+
351
+ // A plugin registers its provider inside the running OpenCode process, so
352
+ // neither the config nor auth.json knows anything about it. This is the
353
+ // case that used to fail with "has no known API base URL" (#2666).
354
+ it('uses the endpoint and credential OpenCode resolved for a plugin provider', async () => {
355
+ readConfig.mockReturnValue({});
356
+ getRuntimeProvider.mockResolvedValue({
357
+ id: 'llmapi',
358
+ apiKey: 'plugin-key',
359
+ baseURL: 'https://api.llmapi.ai/v1',
360
+ anonymousZen: false,
361
+ });
362
+ const fetchMock = vi.fn(async () => ok('done'));
363
+ vi.stubGlobal('fetch', fetchMock);
364
+
365
+ await callSmallModel({
366
+ auth: {},
367
+ catalog: {},
368
+ workingDirectory: '/proj',
369
+ providerID: 'llmapi',
370
+ modelID: 'claude-opus-4-8',
371
+ prompt: 'hi',
372
+ });
373
+
374
+ const { url, init } = lastCall(fetchMock);
375
+ expect(url).toBe('https://api.llmapi.ai/v1/chat/completions');
376
+ expect(init.headers.Authorization).toBe('Bearer plugin-key');
377
+ });
378
+
379
+ it('keeps the ChatGPT-plan login on its own transport instead of the runtime key', async () => {
380
+ readConfig.mockReturnValue({});
381
+ // OpenCode reports an OAuth access token as `options.apiKey` for openai;
382
+ // api.openai.com answers it with 401, so it must not stand in for the
383
+ // codex path.
384
+ getRuntimeProvider.mockResolvedValue({
385
+ id: 'openai',
386
+ apiKey: 'oauth-access-token',
387
+ baseURL: null,
388
+ anonymousZen: false,
389
+ });
390
+
391
+ await expect(callSmallModel({
392
+ auth: {},
393
+ catalog: {},
394
+ workingDirectory: '/proj',
395
+ providerID: 'openai',
396
+ modelID: 'gpt-5.4-mini',
397
+ prompt: 'hi',
398
+ })).rejects.toMatchObject({ code: 'no-provider-login' });
399
+ });
400
+
401
+ it('prefers an explicit config baseURL over the runtime endpoint', async () => {
402
+ readConfig.mockReturnValue({ provider: { custom: { options: { baseURL: 'https://configured.example/v1' } } } });
403
+ getRuntimeProvider.mockResolvedValue({
404
+ id: 'custom',
405
+ apiKey: 'runtime-key',
406
+ baseURL: 'https://runtime.example/v1',
407
+ anonymousZen: false,
408
+ });
409
+ const fetchMock = vi.fn(async () => ok('done'));
410
+ vi.stubGlobal('fetch', fetchMock);
411
+
412
+ await callSmallModel({
413
+ auth: { custom: { type: 'api', key: 'auth-key' } },
414
+ catalog: {},
415
+ workingDirectory: '/proj',
416
+ providerID: 'custom',
417
+ modelID: 'm',
418
+ prompt: 'hi',
419
+ });
420
+
421
+ expect(lastCall(fetchMock).url).toBe('https://configured.example/v1/chat/completions');
422
+ });
344
423
  });
345
424
 
346
425
  describe('config-supplied key does not leak', () => {
@@ -5,7 +5,16 @@ import { readAuthFile } from '../opencode/auth.js';
5
5
  import { readConfigLayers } from '../opencode/shared.js';
6
6
  import { getModelCatalog } from './catalog.js';
7
7
  import { resolveSmallModel, parseModelRef, isUsableAuthEntry, getAuthEntryForProvider } from './resolve.js';
8
- import { callSmallModel, resolveProviderLogin } from './call.js';
8
+ import { DEDICATED_WIRE_FORMAT_PROVIDERS, callSmallModel, resolveProviderLogin } from './call.js';
9
+ import { getRuntimeProviderSnapshot } from './runtime-providers.js';
10
+
11
+ // Never a small model, whatever the transport looks like. A plugin can publish
12
+ // an OpenAI-compatible endpoint for Claude Code, but it is a façade over the
13
+ // Claude Agent SDK, which spawns the Claude Code CLI per request and spends
14
+ // the user's Claude subscription rate limit. Paying that for a session title
15
+ // or a summary is the wrong trade, so the refusal is unconditional rather than
16
+ // conditional on an endpoint existing.
17
+ const CLAUDE_CODE_PROVIDER = 'claude-code';
9
18
 
10
19
  const OPENCHAMBER_SETTINGS_FILE = path.join(
11
20
  process.env.OPENCHAMBER_DATA_DIR
@@ -120,6 +129,13 @@ export async function generateSmallModelText({ prompt, system, maxOutputTokens,
120
129
  );
121
130
  }
122
131
 
132
+ if (resolved.providerID === CLAUDE_CODE_PROVIDER) {
133
+ throw Object.assign(
134
+ new Error('Claude Code cannot be used for background small-model actions. Choose another Small Model in Settings → Sessions.'),
135
+ { statusCode: 422, code: 'small-model-provider-unsupported' },
136
+ );
137
+ }
138
+
123
139
  // Callers with a session context can forbid silently switching providers:
124
140
  // an explicit user choice (settings override, opencode config, request
125
141
  // model) is always allowed, anything else must stay on the session's
@@ -173,11 +189,12 @@ export async function generateSmallModelText({ prompt, system, maxOutputTokens,
173
189
  }
174
190
 
175
191
  /**
176
- * Provider ids with a usable OpenCode login — the set the small model can
177
- * actually call. Used by the settings override picker to hide providers that
178
- * would only ever fail (e.g. opencode free models without a token).
192
+ * Provider ids the small model can actually call — an auth.json login, or a
193
+ * credential and endpoint the running OpenCode resolved for a plugin. Used by
194
+ * the Small Model and Changes Walkthrough pickers to hide providers that would
195
+ * only ever fail (e.g. opencode free models without a token).
179
196
  */
180
- export function listAuthenticatedProviders() {
197
+ export async function listAuthenticatedProviders() {
181
198
  try {
182
199
  const auth = readAuthFile();
183
200
  const ids = new Set(
@@ -188,12 +205,46 @@ export function listAuthenticatedProviders() {
188
205
  if (isUsableAuthEntry(getAuthEntryForProvider(auth, 'github-copilot'))) {
189
206
  ids.add('github-copilot');
190
207
  }
208
+ // Kept separate so a runtime lookup that goes wrong costs the providers it
209
+ // would have added, never the logins already established from disk.
210
+ try {
211
+ for (const providerID of await listRuntimeCallableProviders()) ids.add(providerID);
212
+ } catch {
213
+ // The auth.json set below stands on its own.
214
+ }
215
+ ids.delete(CLAUDE_CODE_PROVIDER);
191
216
  return Array.from(ids);
192
217
  } catch {
193
218
  return [];
194
219
  }
195
220
  }
196
221
 
222
+ /**
223
+ * Providers that only the running OpenCode knows about — plugin-registered
224
+ * ones, and any whose endpoint is resolved at startup.
225
+ *
226
+ * The test is the same one applied to an auth.json login: a credential we may
227
+ * use and somewhere to send it. Whether the endpoint answers the protocol we
228
+ * speak is not knowable from any field OpenCode reports, and guessing it wrong
229
+ * removes a working model from the picker with nothing to explain it.
230
+ */
231
+ async function listRuntimeCallableProviders() {
232
+ const snapshot = await getRuntimeProviderSnapshot();
233
+ if (!snapshot) return [];
234
+ const ids = [];
235
+ for (const id of snapshot.connected) {
236
+ const provider = snapshot.providers.get(id);
237
+ // No credential we may use — including the zen sentinel, whose free models
238
+ // belong to OpenCode's own server.
239
+ if (!provider?.apiKey || !provider.baseURL) continue;
240
+ // Reached through a dedicated wire format and already covered by the
241
+ // auth.json scan above.
242
+ if (DEDICATED_WIRE_FORMAT_PROVIDERS.has(id)) continue;
243
+ ids.push(id);
244
+ }
245
+ return ids;
246
+ }
247
+
197
248
  /**
198
249
  * Reports which model would be used, without calling it.
199
250
  *
@@ -254,7 +305,7 @@ export async function describeSmallModel({ directory, preferredProviderID, prefe
254
305
 
255
306
  // Settings/config/request overrides can name a provider with no usable login.
256
307
  // Report that here so readiness can refuse before the user pays for a 401.
257
- const hasLogin = Boolean(resolveProviderLogin({
308
+ const hasLogin = Boolean(await resolveProviderLogin({
258
309
  auth,
259
310
  workingDirectory: directory,
260
311
  providerID: resolved.providerID,
@@ -19,19 +19,119 @@ vi.mock('./catalog.js', () => ({
19
19
  getCatalogProvider: vi.fn(),
20
20
  }));
21
21
  vi.mock('./call.js', () => ({
22
+ DEDICATED_WIRE_FORMAT_PROVIDERS: new Set(['github-copilot', 'copilot', 'openai', 'anthropic', 'google']),
22
23
  callSmallModel: vi.fn(),
23
- resolveProviderLogin: vi.fn(({ auth, providerID }) => {
24
+ resolveProviderLogin: vi.fn(async ({ auth, providerID }) => {
24
25
  const entry = auth?.[providerID];
25
26
  return entry && typeof entry === 'object' ? entry : null;
26
27
  }),
27
28
  }));
29
+ vi.mock('./runtime-providers.js', () => ({
30
+ getRuntimeProviderSnapshot: vi.fn(async () => null),
31
+ }));
28
32
 
29
- const { generateSmallModelText, describeSmallModel } = await import('./index.js');
33
+ const { generateSmallModelText, describeSmallModel, listAuthenticatedProviders } = await import('./index.js');
30
34
  const { readAuthFile } = await import('../opencode/auth.js');
35
+ const { getRuntimeProviderSnapshot } = await import('./runtime-providers.js');
31
36
  const { readConfigLayers } = await import('../opencode/shared.js');
32
37
  const { getModelCatalog } = await import('./catalog.js');
33
38
  const { callSmallModel } = await import('./call.js');
34
39
 
40
+ describe('unsupported small-model providers', () => {
41
+ beforeEach(() => {
42
+ readAuthFile.mockReturnValue({
43
+ 'claude-code': {
44
+ type: 'oauth',
45
+ access: 'claude-cli-managed',
46
+ refresh: 'claude-cli-managed',
47
+ },
48
+ });
49
+ readConfigLayers.mockReturnValue({ mergedConfig: {} });
50
+ getModelCatalog.mockResolvedValue({});
51
+ callSmallModel.mockReset();
52
+ getRuntimeProviderSnapshot.mockResolvedValue(null);
53
+ });
54
+
55
+ it('rejects Claude Code with an actionable error before transport dispatch', async () => {
56
+ await expect(generateSmallModelText({
57
+ prompt: 'summarize this',
58
+ model: 'claude-code/haiku',
59
+ })).rejects.toMatchObject({
60
+ statusCode: 422,
61
+ code: 'small-model-provider-unsupported',
62
+ });
63
+ expect(callSmallModel).not.toHaveBeenCalled();
64
+ });
65
+
66
+ it('does not offer Claude Code in the Small Model picker', async () => {
67
+ expect(await listAuthenticatedProviders()).not.toContain('claude-code');
68
+ });
69
+
70
+ // A plugin can publish an OpenAI-compatible endpoint for Claude Code, but it
71
+ // is a façade over the Claude Agent SDK: every call spawns the CLI and
72
+ // spends the user's Claude subscription. The refusal is about that cost, so
73
+ // an available endpoint must not lift it.
74
+ it('still refuses Claude Code when a plugin publishes an HTTP endpoint for it', async () => {
75
+ getRuntimeProviderSnapshot.mockResolvedValue({
76
+ providers: new Map([['claude-code', { id: 'claude-code', apiKey: 'plugin-key', baseURL: 'http://127.0.0.1:60668/v1', anonymousZen: false }]]),
77
+ connected: new Set(['claude-code']),
78
+ });
79
+
80
+ await expect(generateSmallModelText({
81
+ prompt: 'summarize this',
82
+ model: 'claude-code/haiku',
83
+ })).rejects.toMatchObject({ code: 'small-model-provider-unsupported' });
84
+ expect(await listAuthenticatedProviders()).not.toContain('claude-code');
85
+
86
+ getRuntimeProviderSnapshot.mockResolvedValue(null);
87
+ });
88
+ });
89
+
90
+ describe('provider availability for the model pickers', () => {
91
+ beforeEach(() => {
92
+ readAuthFile.mockReturnValue({ openai: { type: 'api', key: 'sk-test' } });
93
+ readConfigLayers.mockReturnValue({ mergedConfig: {} });
94
+ getModelCatalog.mockResolvedValue({});
95
+ getRuntimeProviderSnapshot.mockResolvedValue(null);
96
+ });
97
+
98
+ const snapshot = (providers, connected) => ({
99
+ providers: new Map(providers.map((provider) => [provider.id, provider])),
100
+ connected: new Set(connected ?? providers.map((provider) => provider.id)),
101
+ });
102
+
103
+ it('offers a plugin provider that OpenCode resolved at runtime', async () => {
104
+ getRuntimeProviderSnapshot.mockResolvedValue(snapshot([
105
+ { id: 'llmapi', apiKey: 'plugin-key', baseURL: 'https://api.llmapi.ai/v1', anonymousZen: false },
106
+ ]));
107
+
108
+ expect(await listAuthenticatedProviders()).toEqual(expect.arrayContaining(['openai', 'llmapi']));
109
+ });
110
+
111
+ it('hides a provider with no endpoint to send a request to', async () => {
112
+ getRuntimeProviderSnapshot.mockResolvedValue(snapshot([
113
+ { id: 'endpointless', apiKey: 'plugin-key', baseURL: null, anonymousZen: false },
114
+ ]));
115
+
116
+ expect(await listAuthenticatedProviders()).not.toContain('endpointless');
117
+ });
118
+
119
+ it('never offers opencode zen without a real login', async () => {
120
+ // The zen sentinel is not a credential, so the snapshot carries no apiKey.
121
+ getRuntimeProviderSnapshot.mockResolvedValue(snapshot([
122
+ { id: 'opencode', apiKey: null, baseURL: 'https://opencode.ai/zen/v1', anonymousZen: true },
123
+ ]));
124
+
125
+ expect(await listAuthenticatedProviders()).not.toContain('opencode');
126
+ });
127
+
128
+ it('keeps the auth.json providers when OpenCode cannot be reached', async () => {
129
+ getRuntimeProviderSnapshot.mockResolvedValue(null);
130
+
131
+ expect(await listAuthenticatedProviders()).toContain('openai');
132
+ });
133
+ });
134
+
35
135
  // 8k context leaves 4k input tokens after the output reserve → 16k chars.
36
136
  const CATALOG = {
37
137
  anthropic: {
@@ -10,7 +10,7 @@ export function registerSmallModelRoutes(app, { getSmallModelService }) {
10
10
  res.json({
11
11
  available: Boolean(resolved),
12
12
  model: resolved,
13
- authenticatedProviders: listAuthenticatedProviders(),
13
+ authenticatedProviders: await listAuthenticatedProviders(),
14
14
  });
15
15
  } catch (error) {
16
16
  console.error('Failed to resolve small model:', error);
@@ -39,7 +39,9 @@ export function registerSmallModelRoutes(app, { getSmallModelService }) {
39
39
  console.error('Small model generation failed:', error);
40
40
  }
41
41
  res.status(statusCode).json({
42
- error: error.message || 'Small model generation failed',
42
+ error: statusCode === 404
43
+ ? (error.message || 'No small model is available')
44
+ : 'The selected Small Model could not complete this action. Choose another model in Settings → Sessions → Small Model and try again.',
43
45
  ...(error?.code ? { code: error.code } : {}),
44
46
  });
45
47
  }