@openchamber/web 1.24.2 → 2.0.1

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 (387) hide show
  1. package/bin/lib/commands-connect-url.js +3 -8
  2. package/bin/lib/commands-tunnel.js +3 -0
  3. package/dist/assets/{CodeMirrorCommentWidgets-B_vBPQYm.js → CodeMirrorCommentWidgets-zm3C1FvM.js} +1 -1
  4. package/dist/assets/DiffView-DNExNi1z.js +4 -0
  5. package/dist/assets/FilesView-DUCLmHBi.js +17 -0
  6. package/dist/assets/{GitView-k0hUF8KB.js → GitView-Bz9z6gZA.js} +4 -4
  7. package/dist/assets/{GuestAttachDialog-DIf2U85Z.js → GuestAttachDialog-UGp4KDlK.js} +1 -1
  8. package/dist/assets/GuestSurfacePane-B3pdB_2u.js +1 -0
  9. package/dist/assets/{JsonTreeView-4AnJ04Pw.js → JsonTreeView-7lVecnZl.js} +1 -1
  10. package/dist/assets/LinearIssuesView-CTGRS9Vq.js +1 -0
  11. package/dist/assets/MarkdownImageGallery-DQk5adUs.js +1 -0
  12. package/dist/assets/MarkdownRendererImpl-DPF8fZpX.js +12 -0
  13. package/dist/assets/OnboardingScreen-CBx6cXPP.js +1 -0
  14. package/dist/assets/{PatchDiff-DpGmHRnV.js → PatchDiff-D7VVpR_l.js} +1 -1
  15. package/dist/assets/{PierreDiffViewer-CgLl_tp7.js → PierreDiffViewer-Gbfks1pk.js} +3 -3
  16. package/dist/assets/PlanView-CPSK0x97.js +5 -0
  17. package/dist/assets/PluginPane-BIGsUx69.js +3 -0
  18. package/dist/assets/SettingsView-Dql7z6Ww.js +30 -0
  19. package/dist/assets/SettingsWindow-D6oi-UmV.js +1 -0
  20. package/dist/assets/SubmoduleDiffSummary-BXA0FAWj.js +1 -0
  21. package/dist/assets/ToolOutputDialog-BQJsSbDm.js +15 -0
  22. package/dist/assets/ToolPartDiffPreview-FY9w0TVT.js +8 -0
  23. package/dist/assets/{VirtualizedFileDiff-BK4aU5qJ.js → VirtualizedFileDiff-B9YhAya5.js} +4 -4
  24. package/dist/assets/{WalkthroughView-Bk6TPNFw.js → WalkthroughView-CmFgOUFN.js} +2 -2
  25. package/dist/assets/appThemeRegistry-BebxalUt.js +1 -0
  26. package/dist/assets/changesTree-CePHbFcj.js +1 -0
  27. package/dist/assets/commitAndPush-Wfxng_IK.js +1 -0
  28. package/dist/assets/{computeVirtualFileMetrics-BVTujWSX.js → computeVirtualFileMetrics-BCOqgixN.js} +2 -2
  29. package/dist/assets/de-CMA45TC-.js +10 -0
  30. package/dist/assets/es-DPL4fBtl.js +16 -0
  31. package/dist/assets/fr-OHBKBseP.js +14 -0
  32. package/dist/assets/index-3TiDNtfN.js +1 -0
  33. package/dist/assets/index-BLUZa5u0.js +41 -0
  34. package/dist/assets/index-Cm2rrq69.css +1 -0
  35. package/dist/assets/{isDiffPlainText-D3yX_vx4.js → isDiffPlainText-DnDYQmWK.js} +1 -1
  36. package/dist/assets/{isFilePlainText-CZR9TcHV.js → isFilePlainText-BA_AHX7d.js} +1 -1
  37. package/dist/assets/ja-DvX4WSRf.js +16 -0
  38. package/dist/assets/ko-BUcLd8YZ.js +16 -0
  39. package/dist/assets/main-B_jri4i-.js +896 -0
  40. package/dist/assets/main-DtUmJp9B.js +2 -0
  41. package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
  42. package/dist/assets/markdownCore-BSnlUXBf.js +7 -0
  43. package/dist/assets/miniChat-BYfLUnDK.js +2 -0
  44. package/dist/assets/mobile-DH3hI6gd.js +2 -0
  45. package/dist/assets/patchFileDiff--L7lt_GZ.js +13 -0
  46. package/dist/assets/pl-BkI_xHqz.js +16 -0
  47. package/dist/assets/pt-BR-7wFtQlV9.js +16 -0
  48. package/dist/assets/renderElectronMiniChatApp-C7kpNW_-.js +2 -0
  49. package/dist/assets/renderMobileApp-i0nq7Dwy.js +25 -0
  50. package/dist/assets/runtimeEndpointReset-CfEYbcCc.js +27 -0
  51. package/dist/assets/scheduledTasksApi-Cy7uZCaI.js +1 -0
  52. package/dist/assets/{shikiHighlight-BfjuB3CD.js → shikiHighlight-D4vxipfr.js} +1 -1
  53. package/dist/assets/{textMateThemeFromAppTheme-BP60t9SX.js → textMateThemeFromAppTheme-BYAHtJwQ.js} +1 -1
  54. package/dist/assets/tr-TsD-AqEH.js +7 -0
  55. package/dist/assets/uk-B-qspCmD.js +16 -0
  56. package/dist/assets/useAppFontEffects-DHZ9-L30.js +7338 -0
  57. package/dist/assets/useInlineCommentController-CvpOMK-R.js +2 -0
  58. package/dist/assets/useRootScrollLock-DzNFi-fn.js +2 -0
  59. package/dist/assets/{vendor-codemirror-language-data-BFm1Ju2w.js → vendor-codemirror-language-data-j3fhlwUM.js} +2 -2
  60. package/dist/assets/vendor-cron-parser-CjvYVigk.js +2 -0
  61. package/dist/assets/vendor-opencode-client-DYdsLbCM.js +12 -0
  62. package/dist/assets/{vendor-remixicon-react-BDmGmFCA.js → vendor-remixicon-react-D6dZ0UwF.js} +1 -1
  63. package/dist/assets/vendor-zod-BSoePkpP.js +39 -0
  64. package/dist/assets/{web-components-2vo9YsZc.js → web-components-BvHNFSEG.js} +2 -2
  65. package/dist/assets/zh-CN-DYuPJV5i.js +16 -0
  66. package/dist/assets/zh-TW-BX_2D_lV.js +16 -0
  67. package/dist/index.html +13 -7
  68. package/dist/mini-chat.html +5 -5
  69. package/dist/mobile.html +5 -5
  70. package/package.json +6 -5
  71. package/server/index.d.ts +1 -0
  72. package/server/index.js +264 -91
  73. package/server/lib/agent-tool/DOCUMENTATION.md +38 -16
  74. package/server/lib/agent-tool/runtime.js +167 -58
  75. package/server/lib/agent-tool/runtime.test.js +170 -87
  76. package/server/lib/browser-control/DOCUMENTATION.md +51 -4
  77. package/server/lib/browser-control/provider.js +217 -0
  78. package/server/lib/browser-control/provider.test.js +251 -0
  79. package/server/lib/context-obligatory/runtime.js +61 -50
  80. package/server/lib/context-obligatory/runtime.test.js +62 -162
  81. package/server/lib/event-stream/DOCUMENTATION.md +12 -1
  82. package/server/lib/event-stream/delta-coalescer.js +0 -0
  83. package/server/lib/event-stream/delta-coalescer.test.js +68 -57
  84. package/server/lib/event-stream/directory-ws-bridge.js +1 -1
  85. package/server/lib/event-stream/global-hub.js +10 -1
  86. package/server/lib/event-stream/global-hub.test.js +27 -26
  87. package/server/lib/event-stream/index.js +6 -0
  88. package/server/lib/event-stream/protocol.js +26 -19
  89. package/server/lib/event-stream/protocol.test.js +18 -7
  90. package/server/lib/event-stream/rebind.test.js +5 -5
  91. package/server/lib/event-stream/runtime.test.js +17 -15
  92. package/server/lib/event-stream/translate-v2.js +313 -0
  93. package/server/lib/event-stream/translate-v2.test.js +209 -0
  94. package/server/lib/event-stream/upstream-reader.test.js +16 -16
  95. package/server/lib/fs/DOCUMENTATION.md +4 -2
  96. package/server/lib/fs/byte-range.js +35 -0
  97. package/server/lib/fs/byte-range.test.js +31 -0
  98. package/server/lib/fs/routes.js +47 -42
  99. package/server/lib/fs/routes.test.js +123 -18
  100. package/server/lib/git/DOCUMENTATION.md +1 -1
  101. package/server/lib/git/service.js +34 -0
  102. package/server/lib/git/service.test.js +8 -0
  103. package/server/lib/github/DOCUMENTATION.md +1 -1
  104. package/server/lib/github/pr-status.js +22 -2
  105. package/server/lib/github/pr-status.test.js +27 -14
  106. package/server/lib/guests/DOCUMENTATION.md +16 -2
  107. package/server/lib/guests/catalog.js +31 -1
  108. package/server/lib/guests/catalog.test.js +55 -0
  109. package/server/lib/guests/html-styles.js +5 -3
  110. package/server/lib/guests/html-styles.test.js +3 -1
  111. package/server/lib/guests/routes.js +21 -4
  112. package/server/lib/guests/service.js +197 -14
  113. package/server/lib/guests/service.test.js +201 -1
  114. package/server/lib/guests/surface.js +676 -0
  115. package/server/lib/guests/surface.test.js +536 -0
  116. package/server/lib/markdown-image-grants/routes.js +18 -5
  117. package/server/lib/markdown-image-grants/routes.test.js +9 -6
  118. package/server/lib/message-queue/DOCUMENTATION.md +33 -22
  119. package/server/lib/message-queue/runtime.js +155 -100
  120. package/server/lib/message-queue/runtime.test.js +168 -82
  121. package/server/lib/notifications/DOCUMENTATION.md +38 -0
  122. package/server/lib/notifications/control-stream.http.test.js +68 -0
  123. package/server/lib/notifications/emit-route.js +118 -0
  124. package/server/lib/notifications/emit-route.test.js +112 -0
  125. package/server/lib/notifications/emitter-runtime.js +15 -0
  126. package/server/lib/notifications/emitter-runtime.test.js +32 -0
  127. package/server/lib/notifications/push-runtime.js +5 -1
  128. package/server/lib/notifications/push-runtime.test.js +2 -2
  129. package/server/lib/notifications/routes.js +1 -1
  130. package/server/lib/notifications/runtime.js +115 -26
  131. package/server/lib/notifications/template-runtime.js +13 -15
  132. package/server/lib/notifications/template-runtime.test.js +16 -9
  133. package/server/lib/notifications/trigger-runtime.test.js +187 -0
  134. package/server/lib/openchamber-control/DOCUMENTATION.md +10 -0
  135. package/server/lib/openchamber-control/actions.js +19 -4
  136. package/server/lib/openchamber-control/error.js +1 -1
  137. package/server/lib/openchamber-control/file-open.js +59 -0
  138. package/server/lib/openchamber-control/file-open.test.js +57 -0
  139. package/server/lib/openchamber-control/routes.test.js +12 -0
  140. package/server/lib/openchamber-control/service.js +125 -49
  141. package/server/lib/openchamber-control/service.test.js +115 -44
  142. package/server/lib/openchamber-sessions/archive-store.js +224 -0
  143. package/server/lib/openchamber-sessions/archive-store.test.js +187 -0
  144. package/server/lib/openchamber-sessions/fork-inheritance.js +103 -0
  145. package/server/lib/openchamber-sessions/fork-inheritance.test.js +69 -0
  146. package/server/lib/openchamber-sessions/opencode-client.js +22 -0
  147. package/server/lib/openchamber-sessions/routes.js +409 -328
  148. package/server/lib/openchamber-sessions/routes.test.js +795 -740
  149. package/server/lib/openchamber-sessions/session-metadata-store.js +285 -0
  150. package/server/lib/openchamber-sessions/session-metadata-store.test.js +259 -0
  151. package/server/lib/opencode/DOCUMENTATION.md +458 -29
  152. package/server/lib/opencode/agents.js +233 -327
  153. package/server/lib/opencode/auth.js +41 -44
  154. package/server/lib/opencode/auth.test.js +92 -0
  155. package/server/lib/opencode/bootstrap-runtime.js +12 -0
  156. package/server/lib/opencode/cli-upgrade.d.ts +4 -0
  157. package/server/lib/opencode/cli-upgrade.js +18 -0
  158. package/server/lib/opencode/cli-upgrade.test.js +36 -0
  159. package/server/lib/opencode/commands.js +164 -145
  160. package/server/lib/opencode/compatibility.d.ts +16 -0
  161. package/server/lib/opencode/compatibility.js +91 -0
  162. package/server/lib/opencode/compatibility.test.js +70 -0
  163. package/server/lib/opencode/config-entity-routes.js +58 -29
  164. package/server/lib/opencode/config-entity-v2.test.js +290 -0
  165. package/server/lib/opencode/config-mutation-response.js +17 -7
  166. package/server/lib/opencode/config-mutation-response.test.js +4 -7
  167. package/server/lib/opencode/config-paths.test.js +2 -2
  168. package/server/lib/opencode/config-v2.d.ts +185 -0
  169. package/server/lib/opencode/config-v2.js +843 -0
  170. package/server/lib/opencode/config-v2.test.js +483 -0
  171. package/server/lib/opencode/core-routes.js +3 -0
  172. package/server/lib/opencode/core-routes.test.js +15 -0
  173. package/server/lib/opencode/credential-db.js +144 -0
  174. package/server/lib/opencode/credential-db.test.js +104 -0
  175. package/server/lib/opencode/env-runtime.js +47 -15
  176. package/server/lib/opencode/env-runtime.test.js +45 -0
  177. package/server/lib/opencode/feature-routes-runtime.js +16 -5
  178. package/server/lib/opencode/lifecycle-process.test.js +7 -4
  179. package/server/lib/opencode/lifecycle.js +113 -30
  180. package/server/lib/opencode/lifecycle.test.js +107 -8
  181. package/server/lib/opencode/login-shell-env.js +27 -0
  182. package/server/lib/opencode/managed-config-file.js +131 -0
  183. package/server/lib/opencode/managed-config-file.test.js +168 -0
  184. package/server/lib/opencode/managed-plugin-config.js +33 -13
  185. package/server/lib/opencode/mcp.js +43 -149
  186. package/server/lib/opencode/network-runtime.js +6 -7
  187. package/server/lib/opencode/openchamber-routes.js +29 -11
  188. package/server/lib/opencode/openchamber-routes.test.js +18 -1
  189. package/server/lib/opencode/plugin-routes.js +3 -3
  190. package/server/lib/opencode/plugin-routes.test.js +6 -24
  191. package/server/lib/opencode/plugins.js +91 -40
  192. package/server/lib/opencode/plugins.test.js +28 -15
  193. package/server/lib/opencode/provider-source-route.test.js +59 -0
  194. package/server/lib/opencode/providers.js +66 -83
  195. package/server/lib/opencode/providers.test.js +190 -59
  196. package/server/lib/opencode/proxy-agent-wiring.test.js +4 -2
  197. package/server/lib/opencode/proxy.js +179 -129
  198. package/server/lib/opencode/pwa-manifest-routes.js +4 -2
  199. package/server/lib/opencode/pwa-manifest-routes.test.js +3 -2
  200. package/server/lib/opencode/response-envelope.js +14 -0
  201. package/server/lib/opencode/response-envelope.test.js +23 -0
  202. package/server/lib/opencode/routes-upgrade.test.js +73 -116
  203. package/server/lib/opencode/routes.js +138 -428
  204. package/server/lib/opencode/server-utils-runtime.js +10 -4
  205. package/server/lib/opencode/session-activity.js +78 -0
  206. package/server/lib/opencode/session-runtime.js +21 -10
  207. package/server/lib/opencode/session-runtime.test.js +9 -9
  208. package/server/lib/opencode/settings-helpers.js +15 -8
  209. package/server/lib/opencode/settings-helpers.test.js +7 -12
  210. package/server/lib/opencode/settings-registry.json +20 -8
  211. package/server/lib/opencode/settings-runtime.js +19 -1
  212. package/server/lib/opencode/settings-runtime.test.js +31 -2
  213. package/server/lib/opencode/shared.js +86 -24
  214. package/server/lib/opencode/shared.test.js +87 -5
  215. package/server/lib/opencode/shutdown-runtime.js +54 -7
  216. package/server/lib/opencode/shutdown-runtime.test.js +224 -30
  217. package/server/lib/opencode/skill-routes.js +51 -36
  218. package/server/lib/opencode/skill-routes.test.js +121 -1
  219. package/server/lib/opencode/skills.js +7 -5
  220. package/server/lib/opencode/tunnel-wiring-runtime.js +2 -1
  221. package/server/lib/opencode/upgrade-capability.js +0 -14
  222. package/server/lib/opencode/upgrade-capability.test.js +1 -1
  223. package/server/lib/opencode/v1-migration-topup.js +294 -0
  224. package/server/lib/opencode/v1-migration-topup.test.js +274 -0
  225. package/server/lib/opencode/v2-install.d.ts +9 -0
  226. package/server/lib/opencode/v2-install.js +159 -0
  227. package/server/lib/opencode/v2-install.test.js +133 -0
  228. package/server/lib/opencode/watcher.js +10 -3
  229. package/server/lib/opencode/watcher.test.js +17 -21
  230. package/server/lib/opencode/websearch-config.js +78 -0
  231. package/server/lib/permission-auto-accept/runtime.js +38 -22
  232. package/server/lib/permission-auto-accept/runtime.test.js +39 -17
  233. package/server/lib/quota/DOCUMENTATION.md +4 -0
  234. package/server/lib/quota/providers/kimi.js +1 -1
  235. package/server/lib/quota/providers/xai.js +4 -4
  236. package/server/lib/relay/tunnel-host.js +4 -1
  237. package/server/lib/relay/tunnel-host.test.js +7 -0
  238. package/server/lib/routing/DOCUMENTATION.md +52 -21
  239. package/server/lib/routing/defaults.js +23 -6
  240. package/server/lib/routing/jev.js +17 -7
  241. package/server/lib/routing/routes.http.test.js +68 -33
  242. package/server/lib/routing/routes.js +65 -22
  243. package/server/lib/routing/runtime.js +145 -48
  244. package/server/lib/routing/runtime.test.js +79 -55
  245. package/server/lib/scheduled-tasks/DOCUMENTATION.md +4 -0
  246. package/server/lib/scheduled-tasks/issue-2710-double-execution.test.js +51 -46
  247. package/server/lib/scheduled-tasks/runtime.js +81 -74
  248. package/server/lib/scheduled-tasks/runtime.test.js +53 -1
  249. package/server/lib/session-assist/DOCUMENTATION.md +25 -8
  250. package/server/lib/session-assist/context.js +122 -46
  251. package/server/lib/session-assist/context.test.js +117 -49
  252. package/server/lib/session-assist/runtime.js +71 -24
  253. package/server/lib/session-assist/runtime.test.js +153 -173
  254. package/server/lib/session-goal/DOCUMENTATION.md +34 -15
  255. package/server/lib/session-goal/create.js +9 -12
  256. package/server/lib/session-goal/create.test.js +27 -28
  257. package/server/lib/session-goal/runtime.js +164 -77
  258. package/server/lib/session-goal/runtime.test.js +271 -519
  259. package/server/lib/session-knowledge/DOCUMENTATION.md +5 -0
  260. package/server/lib/session-knowledge/runtime.js +59 -41
  261. package/server/lib/session-knowledge/runtime.test.js +90 -20
  262. package/server/lib/small-model/DOCUMENTATION.md +154 -208
  263. package/server/lib/small-model/client.js +113 -0
  264. package/server/lib/small-model/index.js +296 -158
  265. package/server/lib/small-model/index.test.js +423 -256
  266. package/server/lib/small-model/routes.js +1 -1
  267. package/server/lib/spaces/DOCUMENTATION.md +807 -0
  268. package/server/lib/spaces/code-in-bait.js +185 -0
  269. package/server/lib/spaces/code-in.js +641 -0
  270. package/server/lib/spaces/code-in.test.js +1048 -0
  271. package/server/lib/spaces/errors.js +8 -0
  272. package/server/lib/spaces/exec-http.js +94 -0
  273. package/server/lib/spaces/gatekeeper-channel.js +202 -0
  274. package/server/lib/spaces/gatekeeper-channel.test.js +215 -0
  275. package/server/lib/spaces/gatekeeper-program.cjs +914 -0
  276. package/server/lib/spaces/gatekeeper-program.test.js +1391 -0
  277. package/server/lib/spaces/hardening.js +457 -0
  278. package/server/lib/spaces/hardening.test.js +368 -0
  279. package/server/lib/spaces/host-git.js +127 -0
  280. package/server/lib/spaces/host-git.test.js +137 -0
  281. package/server/lib/spaces/labels.js +234 -0
  282. package/server/lib/spaces/labels.test.js +219 -0
  283. package/server/lib/spaces/layout.js +184 -0
  284. package/server/lib/spaces/layout.test.js +30 -0
  285. package/server/lib/spaces/manager.js +82 -0
  286. package/server/lib/spaces/manager.test.js +114 -0
  287. package/server/lib/spaces/places/code-in.docker.live.test.js +216 -0
  288. package/server/lib/spaces/places/contract-suite.js +156 -0
  289. package/server/lib/spaces/places/contract.docker.live.test.js +7 -0
  290. package/server/lib/spaces/places/contract.test.js +6 -0
  291. package/server/lib/spaces/places/docker-engine.js +126 -0
  292. package/server/lib/spaces/places/docker-live-support.js +202 -0
  293. package/server/lib/spaces/places/docker-tools.js +186 -0
  294. package/server/lib/spaces/places/docker.js +587 -0
  295. package/server/lib/spaces/places/docker.test.js +1610 -0
  296. package/server/lib/spaces/places/escape-suite.js +1018 -0
  297. package/server/lib/spaces/places/escape.docker.live.test.js +7 -0
  298. package/server/lib/spaces/places/fake-docker.js +375 -0
  299. package/server/lib/spaces/places/memory-place.js +103 -0
  300. package/server/lib/spaces/places/packed.docker.live.test.js +77 -0
  301. package/server/lib/spaces/places/registry.js +43 -0
  302. package/server/lib/spaces/places/registry.test.js +50 -0
  303. package/server/lib/spaces/places/server.docker.live.test.js +225 -0
  304. package/server/lib/spaces/run-command.js +261 -0
  305. package/server/lib/spaces/run-command.test.js +396 -0
  306. package/server/lib/spaces/space-server.js +190 -0
  307. package/server/lib/spaces/space-server.test.js +335 -0
  308. package/server/lib/spaces/tools-filler.js +82 -0
  309. package/server/lib/spaces/tools-filler.test.js +148 -0
  310. package/server/lib/spaces/tools-pack.js +49 -0
  311. package/server/lib/spaces/tools-pack.test.js +57 -0
  312. package/server/lib/spaces/tools.js +137 -0
  313. package/server/lib/spaces/tools.test.js +153 -0
  314. package/server/lib/tts/openai-sdk.js +11 -0
  315. package/server/lib/tts/service.js +7 -5
  316. package/server/lib/tts/stt.js +3 -2
  317. package/server/lib/tunnels/DOCUMENTATION.md +2 -0
  318. package/server/lib/tunnels/routes.js +7 -0
  319. package/server/lib/tunnels/routes.test.js +55 -0
  320. package/server/lib/ui-auth/ui-auth.js +38 -2
  321. package/server/lib/ui-auth/ui-auth.test.js +42 -0
  322. package/server/lib/ui-auth/ui-passkeys.js +12 -10
  323. package/server/lib/walkthrough/DOCUMENTATION.md +10 -1
  324. package/server/lib/walkthrough/pull-request.js +61 -8
  325. package/server/lib/walkthrough/pull-request.test.js +54 -1
  326. package/server/lib/walkthrough/routes.js +20 -0
  327. package/server/lib/walkthrough/routes.test.js +19 -0
  328. package/server/opencode-proxy.test.js +190 -166
  329. package/server/opencode-worktree-readiness.test.js +5 -4
  330. package/dist/assets/DiffView-Ce0oBXXQ.js +0 -4
  331. package/dist/assets/FilesView-DtXueAWP.js +0 -13
  332. package/dist/assets/LinearIssuesView-z_9p2GuO.js +0 -1
  333. package/dist/assets/MarkdownImageGallery-BC-BNN-s.js +0 -1
  334. package/dist/assets/MarkdownRendererImpl-DyaBTUbH.js +0 -12
  335. package/dist/assets/OnboardingScreen-DKU_yTb6.js +0 -1
  336. package/dist/assets/PlanView-CrfB4qqY.js +0 -5
  337. package/dist/assets/PluginPane-B5cn-jPy.js +0 -3
  338. package/dist/assets/SettingsView-DMKKwezx.js +0 -29
  339. package/dist/assets/SettingsWindow-DwbnVzOC.js +0 -1
  340. package/dist/assets/SubmoduleDiffSummary-hkGcvs0E.js +0 -1
  341. package/dist/assets/ToolOutputDialog-DuoIOc0j.js +0 -15
  342. package/dist/assets/ToolPartDiffPreview-t1Bvq_2Y.js +0 -8
  343. package/dist/assets/appThemeRegistry-DnOVbJjF.js +0 -1
  344. package/dist/assets/commitAndPush-DLWNZkkY.js +0 -1
  345. package/dist/assets/de-zEHaAIi3.js +0 -10
  346. package/dist/assets/es-CBDgEzgk.js +0 -16
  347. package/dist/assets/fr-DjiTptT_.js +0 -14
  348. package/dist/assets/index-AgOdanig.css +0 -1
  349. package/dist/assets/index-B-2_X4DD.js +0 -40
  350. package/dist/assets/index-CkA4p2IK.js +0 -1
  351. package/dist/assets/ja-CerMgj3r.js +0 -16
  352. package/dist/assets/ko-DHYDAze5.js +0 -16
  353. package/dist/assets/main-BDka4W43.js +0 -896
  354. package/dist/assets/main-Dl7Dyge_.js +0 -2
  355. package/dist/assets/markdownCore-DFmr0rUR.js +0 -5
  356. package/dist/assets/miniChat-CLKQPPpO.js +0 -2
  357. package/dist/assets/mobile--giD2Q1L.js +0 -2
  358. package/dist/assets/patchFileDiff-DRh-AQvd.js +0 -13
  359. package/dist/assets/pl-BTB_93bq.js +0 -16
  360. package/dist/assets/pt-BR-BwA3oyCK.js +0 -16
  361. package/dist/assets/renderElectronMiniChatApp-DmB7zpVK.js +0 -2
  362. package/dist/assets/renderMobileApp-pMfOuQfl.js +0 -25
  363. package/dist/assets/runtimeEndpointReset-Gqhmkm3U.js +0 -25
  364. package/dist/assets/scheduledTasksApi-CeRAIUmW.js +0 -1
  365. package/dist/assets/tr-CcPsJoNM.js +0 -7
  366. package/dist/assets/uk-B68WibXi.js +0 -16
  367. package/dist/assets/useAppFontEffects-DcdrFv2Z.js +0 -7333
  368. package/dist/assets/useInlineCommentController-Cq4SUjsA.js +0 -2
  369. package/dist/assets/useRootScrollLock-CSdR6Wnm.js +0 -2
  370. package/dist/assets/vendor-cron-parser-CUcP7OfX.js +0 -2
  371. package/dist/assets/vendor-opencode-sdk-BJ73u-bH.js +0 -7
  372. package/dist/assets/vendor-zod-CgAdXWZO.js +0 -39
  373. package/dist/assets/zh-CN-DbFHYXwP.js +0 -16
  374. package/dist/assets/zh-TW-DmXAwdty.js +0 -16
  375. package/server/lib/opencode/mcp-oauth-callback.test.js +0 -111
  376. package/server/lib/routing/feature-flag.js +0 -11
  377. package/server/lib/small-model/call.js +0 -851
  378. package/server/lib/small-model/call.test.js +0 -1292
  379. package/server/lib/small-model/catalog.js +0 -13
  380. package/server/lib/small-model/resolve.js +0 -131
  381. package/server/lib/small-model/resolve.test.js +0 -197
  382. package/server/lib/small-model/runtime-providers.js +0 -164
  383. package/server/lib/small-model/runtime-providers.test.js +0 -118
  384. package/server/lib/system-prompt/DOCUMENTATION.md +0 -36
  385. package/server/lib/system-prompt/runtime.js +0 -49
  386. package/server/lib/system-prompt/runtime.test.js +0 -76
  387. package/server/lib/walkthrough/reproduce-2607.test.js +0 -148
@@ -268,10 +268,7 @@ describe('opencode plugin routes', () => {
268
268
 
269
269
  expect(response.body).toMatchObject({
270
270
  success: true,
271
- requiresReload: false,
272
- requiresRestart: true,
273
- restartDeferred: true,
274
- message: 'Plugin entry created. Restart OpenCode to apply.',
271
+ message: 'Plugin entry created.',
275
272
  });
276
273
  expect(refreshOpenCodeAfterConfigChange).not.toHaveBeenCalled();
277
274
  });
@@ -307,10 +304,7 @@ describe('opencode plugin routes', () => {
307
304
 
308
305
  expect(response.body.success).toBe(true);
309
306
  expect(response.body).toMatchObject({
310
- requiresReload: false,
311
- requiresRestart: true,
312
- restartDeferred: true,
313
- message: 'Plugin entry updated. Restart OpenCode to apply.',
307
+ message: 'Plugin entry updated.',
314
308
  });
315
309
  const after = await request(app).get('/api/config/plugins').expect(200);
316
310
  expect(after.body.entries[0]).toEqual(expect.objectContaining({ spec: 'b', scope: 'user' }));
@@ -329,10 +323,7 @@ describe('opencode plugin routes', () => {
329
323
  expect(readJson(userConfigPath).plugin).toBeUndefined();
330
324
  expect(response.body).toMatchObject({
331
325
  success: true,
332
- requiresReload: false,
333
- requiresRestart: true,
334
- restartDeferred: true,
335
- message: 'Plugin entry deleted. Restart OpenCode to apply.',
326
+ message: 'Plugin entry deleted.',
336
327
  });
337
328
  expect(refreshOpenCodeAfterConfigChange).not.toHaveBeenCalled();
338
329
  });
@@ -342,10 +333,7 @@ describe('opencode plugin routes', () => {
342
333
 
343
334
  expect(response.body).toMatchObject({
344
335
  success: true,
345
- requiresReload: false,
346
- requiresRestart: true,
347
- restartDeferred: true,
348
- message: 'Plugin file created. Restart OpenCode to apply.',
336
+ message: 'Plugin file created.',
349
337
  });
350
338
  expect(fs.readFileSync(path.join(rootDir, 'plugins', 'test.js'), 'utf8')).toBe('//x');
351
339
  expect(refreshOpenCodeAfterConfigChange).not.toHaveBeenCalled();
@@ -375,10 +363,7 @@ describe('opencode plugin routes', () => {
375
363
  expect(fs.readFileSync(path.join(rootDir, 'plugins', 'test.js'), 'utf8')).toBe('//y');
376
364
  expect(response.body).toMatchObject({
377
365
  success: true,
378
- requiresReload: false,
379
- requiresRestart: true,
380
- restartDeferred: true,
381
- message: 'Plugin file updated. Restart OpenCode to apply.',
366
+ message: 'Plugin file updated.',
382
367
  });
383
368
  expect(refreshOpenCodeAfterConfigChange).not.toHaveBeenCalled();
384
369
  });
@@ -393,10 +378,7 @@ describe('opencode plugin routes', () => {
393
378
  expect(fs.existsSync(path.join(rootDir, 'plugins', 'test.js'))).toBe(false);
394
379
  expect(response.body).toMatchObject({
395
380
  success: true,
396
- requiresReload: false,
397
- requiresRestart: true,
398
- restartDeferred: true,
399
- message: 'Plugin file deleted. Restart OpenCode to apply.',
381
+ message: 'Plugin file deleted.',
400
382
  });
401
383
  expect(refreshOpenCodeAfterConfigChange).not.toHaveBeenCalled();
402
384
  });
@@ -8,6 +8,11 @@ import {
8
8
  writeConfig,
9
9
  } from './shared.js';
10
10
  import { isPathSpec } from './plugin-spec.js';
11
+ import { PLUGIN_SECTION, toPluginEntity, fromPluginEntity, readPluginList } from './config-v2.js';
12
+
13
+ // OpenCode 2 reads `plugins` (bare string or `{package, options}`) and still
14
+ // decodes the v1 `plugin` array with its `[spec, options]` tuples. OpenChamber
15
+ // reads both and always writes `plugins` with v2 entries.
11
16
 
12
17
  const PLUGIN_FILE_NAME_PATTERN = /^[a-z0-9][a-z0-9-_.]*\.(js|ts|mjs|cjs)$/;
13
18
 
@@ -77,7 +82,6 @@ function getActiveOpencodeConfigDir() {
77
82
  function getActiveUserConfigPaths() {
78
83
  const configDir = getActiveOpencodeConfigDir();
79
84
  return [
80
- path.join(configDir, 'config.json'),
81
85
  path.join(configDir, 'opencode.json'),
82
86
  path.join(configDir, 'opencode.jsonc'),
83
87
  ];
@@ -184,9 +188,12 @@ function getPluginTarget(id, workingDirectory) {
184
188
  validateScope(scope);
185
189
  const layers = readPluginConfigLayers(workingDirectory);
186
190
  const source = configSources(layers).find((candidate) => candidate.scope === scope);
187
- const plugin = Array.isArray(source?.config?.plugin) ? source.config.plugin : [];
191
+ if (!source) {
192
+ return null;
193
+ }
194
+ const plugin = pluginArrayForWrite(source.config);
188
195
  const index = plugin.findIndex((raw) => parsePluginRaw(raw).spec === spec);
189
- if (!source || index === -1) {
196
+ if (index === -1) {
190
197
  return null;
191
198
  }
192
199
  return { source, plugin, index };
@@ -203,6 +210,16 @@ function pluginDirForScope(scope, workingDirectory) {
203
210
  return path.join(getActiveOpencodeConfigDir(), 'plugins');
204
211
  }
205
212
 
213
+ /**
214
+ * The directories OpenCode 2 scans for local plugins in a scope: `plugins/`
215
+ * (where OpenChamber writes) and the v1 `plugin/`. Each holds `.ts`/`.js`
216
+ * files and plugin package directories.
217
+ */
218
+ function pluginDirsForScope(scope, workingDirectory) {
219
+ const preferred = pluginDirForScope(scope, workingDirectory);
220
+ return [preferred, path.join(path.dirname(preferred), 'plugin')];
221
+ }
222
+
206
223
  function fileTargetFromId(id, workingDirectory) {
207
224
  const decoded = decodePluginId(id);
208
225
  if (decoded.prefix !== 'file') {
@@ -231,41 +248,71 @@ function decodePluginId(id) {
231
248
  return { prefix: decoded.slice(0, separator), value: decoded.slice(separator + 1) };
232
249
  }
233
250
 
251
+ /** Accept a v1 string/tuple or a v2 `{package, options}` object. */
234
252
  function parsePluginRaw(raw) {
235
- if (typeof raw === 'string') {
236
- return { spec: validatePluginSpec(raw) };
237
- }
238
- if (Array.isArray(raw) && raw.length === 2 && isRecord(raw[1])) {
239
- return { spec: validatePluginSpec(raw[0]), options: { ...raw[1] } };
253
+ const entity = toPluginEntity(raw);
254
+ if (!entity) {
255
+ throw codedError('Plugin spec must be a string, [string, object], or {package, options}', 'INVALID_SPEC');
240
256
  }
241
- throw codedError('Plugin spec must be a string or [string, object]', 'INVALID_SPEC');
257
+ const parsed = { spec: validatePluginSpec(entity.package) };
258
+ if (hasOptions(entity.options)) parsed.options = { ...entity.options };
259
+ return parsed;
242
260
  }
243
261
 
262
+ /** Always v2: a bare string, or `{package, options}`. Never a tuple. */
244
263
  function serializePluginEntry(entry) {
245
264
  const spec = validatePluginSpec(entry?.spec);
246
- if (hasOptions(entry?.options)) {
247
- return [spec, { ...entry.options }];
265
+ const serialized = fromPluginEntity({ package: spec, options: hasOptions(entry?.options) ? entry.options : undefined });
266
+ if (serialized === null) {
267
+ throw codedError('Plugin spec must be a non-empty string', 'INVALID_SPEC');
248
268
  }
249
- return spec;
269
+ return serialized;
270
+ }
271
+
272
+ function migratePluginRaw(raw) {
273
+ try {
274
+ return serializePluginEntry(parsePluginRaw(raw));
275
+ } catch {
276
+ return raw;
277
+ }
278
+ }
279
+
280
+ /**
281
+ * The plugin array a write should target. Prefer the v2 `plugins` key; when the
282
+ * file only has the v1 `plugin` array, migrate the whole array into `plugins`
283
+ * in place so the two spellings cannot disagree.
284
+ */
285
+ function pluginArrayForWrite(config) {
286
+ const legacy = Array.isArray(config[PLUGIN_SECTION.v1]) ? config[PLUGIN_SECTION.v1] : null;
287
+ if (!Array.isArray(config[PLUGIN_SECTION.v2])) config[PLUGIN_SECTION.v2] = [];
288
+ if (legacy) {
289
+ config[PLUGIN_SECTION.v2] = [
290
+ // An entry we cannot parse is carried over untouched rather than dropped:
291
+ // it is the user's config, and losing it would be worse than leaving it
292
+ // in a shape OpenCode already refuses.
293
+ ...legacy.map((raw) => migratePluginRaw(raw)),
294
+ ...config[PLUGIN_SECTION.v2],
295
+ ];
296
+ delete config[PLUGIN_SECTION.v1];
297
+ }
298
+ return config[PLUGIN_SECTION.v2];
250
299
  }
251
300
 
252
301
  function listPluginEntries(workingDirectory) {
253
302
  const layers = readPluginConfigLayers(workingDirectory);
254
303
  return configSources(layers).flatMap((source) => {
255
- if (!Array.isArray(source.config?.plugin)) {
256
- return [];
257
- }
258
- return source.config.plugin.map((raw) => {
259
- const parsed = parsePluginRaw(raw);
260
- return {
261
- id: encodePluginId('config', `${source.scope}:${parsed.spec}`),
262
- spec: parsed.spec,
263
- ...(parsed.options !== undefined ? { options: parsed.options } : {}),
304
+ return readPluginList(source.config).map((item) => {
305
+ const entry = {
306
+ id: encodePluginId('config', `${source.scope}:${item.entry.package}`),
307
+ spec: item.entry.package,
264
308
  scope: source.scope,
265
309
  kind: 'config',
266
- parsedKind: parsedKindForSpec(parsed.spec),
310
+ parsedKind: parsedKindForSpec(item.entry.package),
267
311
  sourcePath: source.filePath,
312
+ legacy: item.legacy,
268
313
  };
314
+ if (item.entry.options !== undefined) entry.options = item.entry.options;
315
+ return entry;
269
316
  });
270
317
  });
271
318
  }
@@ -282,8 +329,7 @@ function createPluginEntry(entry, workingDirectory) {
282
329
  const layers = readPluginConfigLayers(workingDirectory);
283
330
  const existing = configSources(layers).find((source) => (
284
331
  source.scope === scope
285
- && Array.isArray(source.config?.plugin)
286
- && source.config.plugin.some((raw) => parsePluginRaw(raw).spec === spec)
332
+ && readPluginList(source.config).some((item) => item.entry.package === spec)
287
333
  ));
288
334
  if (existing) {
289
335
  throw codedError(`Plugin "${spec}" already exists`, 'ENTRY_EXISTS');
@@ -299,10 +345,7 @@ function createPluginEntry(entry, workingDirectory) {
299
345
  config = layers.paths.customPath ? layers.customConfig : layers.userConfig;
300
346
  }
301
347
 
302
- if (!Array.isArray(config.plugin)) {
303
- config.plugin = [];
304
- }
305
- config.plugin.push(serializePluginEntry({ spec, options: entry.options }));
348
+ pluginArrayForWrite(config).push(serializePluginEntry({ spec, options: entry.options }));
306
349
  writeConfig(config, targetPath);
307
350
  }
308
351
 
@@ -325,7 +368,7 @@ function deletePluginEntry(id, workingDirectory) {
325
368
  }
326
369
  target.plugin.splice(target.index, 1);
327
370
  if (target.plugin.length === 0) {
328
- delete target.source.config.plugin;
371
+ delete target.source.config[PLUGIN_SECTION.v2];
329
372
  }
330
373
  writeConfig(target.source.config, target.source.filePath);
331
374
  }
@@ -335,21 +378,29 @@ function listPluginDirFiles(workingDirectory) {
335
378
  if (workingDirectory) {
336
379
  scopes.push(AGENT_SCOPE.PROJECT);
337
380
  }
338
- return scopes.flatMap((scope) => {
339
- const dir = pluginDirForScope(scope, workingDirectory);
381
+ return scopes.flatMap((scope) => pluginDirsForScope(scope, workingDirectory).flatMap((dir) => {
340
382
  if (!fs.existsSync(dir)) {
341
383
  return [];
342
384
  }
385
+ const editable = dir === pluginDirForScope(scope, workingDirectory);
343
386
  return fs.readdirSync(dir, { withFileTypes: true })
344
- .filter((entry) => entry.isFile() && PLUGIN_FILE_NAME_PATTERN.test(entry.name) && !entry.name.includes('..'))
345
- .map((entry) => ({
346
- id: encodePluginId('file', `${scope}:${entry.name}`),
347
- fileName: entry.name,
348
- scope,
349
- kind: 'file',
350
- absolutePath: path.join(dir, entry.name),
351
- }));
352
- });
387
+ .filter((entry) => !entry.name.includes('..') && !entry.name.startsWith('.'))
388
+ .flatMap((entry) => {
389
+ if (entry.isFile() && PLUGIN_FILE_NAME_PATTERN.test(entry.name)) {
390
+ // Only files in the v2 `plugins/` directory are editable through
391
+ // the file id; a v1 `plugin/` file is listed for what it is.
392
+ return editable
393
+ ? [{ id: encodePluginId('file', `${scope}:${entry.name}`), fileName: entry.name, scope, kind: 'file', absolutePath: path.join(dir, entry.name) }]
394
+ : [{ id: encodePluginId('legacy', `${scope}:${entry.name}`), fileName: entry.name, scope, kind: 'package', absolutePath: path.join(dir, entry.name) }];
395
+ }
396
+ if (entry.isDirectory()) {
397
+ // A plugin package (a directory with its own entry point): OpenCode
398
+ // loads it, OpenChamber only lists it.
399
+ return [{ id: encodePluginId('package', `${scope}:${entry.name}`), fileName: entry.name, scope, kind: 'package', absolutePath: path.join(dir, entry.name) }];
400
+ }
401
+ return [];
402
+ });
403
+ }));
353
404
  }
354
405
 
355
406
  function readPluginDirFile(id, workingDirectory) {
@@ -45,19 +45,21 @@ describe('opencode plugins data layer', () => {
45
45
  delete process.env.OPENCODE_CONFIG;
46
46
  });
47
47
 
48
- test('parses raw plugin entries', () => {
48
+ test('parses v1 tuples and v2 objects into the same entry', () => {
49
49
  expect(plugins.parsePluginRaw('foo')).toEqual({ spec: 'foo' });
50
50
  expect(plugins.parsePluginRaw('foo@1.0.0')).toEqual({ spec: 'foo@1.0.0' });
51
51
  expect(plugins.parsePluginRaw(['foo', { a: 1 }])).toEqual({ spec: 'foo', options: { a: 1 } });
52
- expect(plugins.parsePluginRaw(['foo', {}])).toEqual({ spec: 'foo', options: {} });
52
+ expect(plugins.parsePluginRaw(['foo', {}])).toEqual({ spec: 'foo' });
53
+ expect(plugins.parsePluginRaw({ package: 'foo', options: { a: 1 } })).toEqual({ spec: 'foo', options: { a: 1 } });
54
+ expect(plugins.parsePluginRaw({ package: 'foo' })).toEqual({ spec: 'foo' });
53
55
  expect(() => plugins.parsePluginRaw(123)).toThrow('Plugin spec');
54
56
  });
55
57
 
56
- test('serializes plugin entries', () => {
58
+ test('serializes plugin entries in v2 shape, never a tuple', () => {
57
59
  expect(plugins.serializePluginEntry({ spec: 'foo' })).toBe('foo');
58
60
  expect(plugins.serializePluginEntry({ spec: 'foo', options: undefined })).toBe('foo');
59
61
  expect(plugins.serializePluginEntry({ spec: 'foo', options: {} })).toBe('foo');
60
- expect(plugins.serializePluginEntry({ spec: 'foo', options: { a: 1 } })).toEqual(['foo', { a: 1 }]);
62
+ expect(plugins.serializePluginEntry({ spec: 'foo', options: { a: 1 } })).toEqual({ package: 'foo', options: { a: 1 } });
61
63
  });
62
64
 
63
65
  test('rejects invalid specs and file names', () => {
@@ -69,11 +71,12 @@ describe('opencode plugins data layer', () => {
69
71
  expect(() => plugins.writePluginDirFile({ fileName: 'foo.txt', content: '', scope: 'project' }, projectDir)).toThrow('Plugin file name');
70
72
  });
71
73
 
72
- test('creates string and tuple entries with duplicate rejection', () => {
74
+ test('creates string and object entries with duplicate rejection', () => {
73
75
  plugins.createPluginEntry({ spec: 'plain-plugin', scope: 'user' }, projectDir);
74
76
  plugins.createPluginEntry({ spec: 'tuple-plugin', options: { apiKey: 'x' }, scope: 'user' }, projectDir);
75
77
 
76
- expect(readJson(userConfigPath).plugin).toEqual(['plain-plugin', ['tuple-plugin', { apiKey: 'x' }]]);
78
+ expect(readJson(userConfigPath).plugins).toEqual(['plain-plugin', { package: 'tuple-plugin', options: { apiKey: 'x' } }]);
79
+ expect(readJson(userConfigPath).plugin).toBeUndefined();
77
80
  expect(() => plugins.createPluginEntry({ spec: 'plain-plugin', scope: 'user' }, projectDir)).toThrow('already exists');
78
81
  expect(thrownBy(() => plugins.createPluginEntry({ spec: 'plain-plugin', scope: 'user' }, projectDir))).toHaveProperty('code', 'ENTRY_EXISTS');
79
82
  });
@@ -82,8 +85,8 @@ describe('opencode plugins data layer', () => {
82
85
  plugins.createPluginEntry({ spec: 'user-plugin', scope: 'user' }, projectDir);
83
86
  plugins.createPluginEntry({ spec: 'project-plugin', scope: 'project' }, projectDir);
84
87
 
85
- expect(readJson(userConfigPath).plugin).toEqual(['user-plugin']);
86
- expect(readJson(path.join(projectDir, '.opencode', 'opencode.json')).plugin).toEqual(['project-plugin']);
88
+ expect(readJson(userConfigPath).plugins).toEqual(['user-plugin']);
89
+ expect(readJson(path.join(projectDir, '.opencode', 'opencode.json')).plugins).toEqual(['project-plugin']);
87
90
  });
88
91
 
89
92
  test('re-resolves custom config env between calls', () => {
@@ -98,24 +101,34 @@ describe('opencode plugins data layer', () => {
98
101
  plugins.createPluginEntry({ spec: 'second-plugin', scope: 'user' }, projectDir);
99
102
  plugins.writePluginDirFile({ fileName: 'second.js', content: 'two', scope: 'user' }, projectDir);
100
103
 
101
- expect(readJson(firstConfigPath).plugin).toEqual(['first-plugin']);
102
- expect(readJson(secondConfigPath).plugin).toEqual(['second-plugin']);
104
+ expect(readJson(firstConfigPath).plugins).toEqual(['first-plugin']);
105
+ expect(readJson(secondConfigPath).plugins).toEqual(['second-plugin']);
103
106
  expect(fs.existsSync(path.join(path.dirname(firstConfigPath), 'plugins', 'first.js'))).toBe(true);
104
107
  expect(fs.existsSync(path.join(path.dirname(secondConfigPath), 'plugins', 'second.js'))).toBe(true);
105
108
  });
106
109
 
107
- test('updates entries in place and transitions between string and tuple', () => {
110
+ test('rewrites a v1 plugin array into v2 plugins when one entry is updated', () => {
108
111
  writeJson(userConfigPath, { plugin: ['first', ['second', { a: 1 }], 'third'] });
109
112
 
110
113
  plugins.updatePluginEntry(plugins.encodePluginId('config', 'user:second'), { spec: 'second-new', options: {} }, projectDir);
111
- expect(readJson(userConfigPath).plugin).toEqual(['first', 'second-new', 'third']);
114
+ const migrated = readJson(userConfigPath);
115
+ expect(migrated.plugin).toBeUndefined();
116
+ expect(migrated.plugins).toEqual(['first', 'second-new', 'third']);
112
117
 
113
118
  plugins.updatePluginEntry(plugins.encodePluginId('config', 'user:first'), { spec: 'first-new', options: { b: 2 } }, projectDir);
114
- expect(readJson(userConfigPath).plugin).toEqual([['first-new', { b: 2 }], 'second-new', 'third']);
119
+ expect(readJson(userConfigPath).plugins).toEqual([{ package: 'first-new', options: { b: 2 } }, 'second-new', 'third']);
115
120
  });
116
121
 
117
- test('deletes entries and prunes empty plugin key', () => {
118
- writeJson(userConfigPath, { plugin: ['only'] });
122
+ test('reads a v2 plugins array and updates it in place', () => {
123
+ writeJson(userConfigPath, { plugins: ['alpha', { package: 'beta', options: { a: 1 } }] });
124
+
125
+ expect(plugins.listPluginEntries(projectDir).map((entry) => entry.spec)).toEqual(['alpha', 'beta']);
126
+ plugins.updatePluginEntry(plugins.encodePluginId('config', 'user:beta'), { options: { a: 2 } }, projectDir);
127
+ expect(readJson(userConfigPath).plugins).toEqual(['alpha', { package: 'beta', options: { a: 2 } }]);
128
+ });
129
+
130
+ test('deletes entries and prunes the empty plugins key', () => {
131
+ writeJson(userConfigPath, { plugins: ['only'] });
119
132
 
120
133
  plugins.deletePluginEntry(plugins.encodePluginId('config', 'user:only'), projectDir);
121
134
  expect(readJson(userConfigPath)).toEqual({});
@@ -0,0 +1,59 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import express from 'express';
3
+ import request from 'supertest';
4
+ import { registerOpenCodeRoutes } from './routes.js';
5
+
6
+ const createApp = (getProviderSources) => {
7
+ const app = express();
8
+ app.use(express.json());
9
+ registerOpenCodeRoutes(app, {
10
+ resolveProjectDirectory: vi.fn(async () => ({ directory: '/projects/app' })),
11
+ getProviderSources,
12
+ });
13
+ return app;
14
+ };
15
+
16
+ describe('GET /api/provider/:providerId/source', () => {
17
+ it('returns the stored config entry next to the layer sources', async () => {
18
+ const stored = {
19
+ name: 'Stored',
20
+ package: 'aisdk:@ai-sdk/openai-compatible',
21
+ env: ['STORED_KEY'],
22
+ settings: { baseURL: 'https://stored.example.com/v1' },
23
+ models: { m: { modelID: 'm', name: 'M' } },
24
+ };
25
+ const getProviderSources = vi.fn(() => ({
26
+ sources: {
27
+ auth: { exists: false },
28
+ user: { exists: false, path: '/user.json' },
29
+ project: { exists: true, path: '/projects/app/opencode.json' },
30
+ custom: { exists: false, path: null },
31
+ },
32
+ config: stored,
33
+ }));
34
+
35
+ const response = await request(createApp(getProviderSources))
36
+ .get('/api/provider/stored-llm/source?directory=/projects/app')
37
+ .expect(200);
38
+
39
+ expect(getProviderSources).toHaveBeenCalledWith('stored-llm', '/projects/app');
40
+ expect(response.body.config).toEqual(stored);
41
+ expect(response.body.sources.project.exists).toBe(true);
42
+ });
43
+
44
+ it('returns null config when no layer defines the provider', async () => {
45
+ const response = await request(createApp(() => ({
46
+ sources: {
47
+ auth: { exists: false },
48
+ user: { exists: false, path: '/user.json' },
49
+ project: { exists: false, path: null },
50
+ custom: { exists: false, path: null },
51
+ },
52
+ config: null,
53
+ })))
54
+ .get('/api/provider/other/source')
55
+ .expect(200);
56
+
57
+ expect(response.body.config).toBeNull();
58
+ });
59
+ });