@openchamber/web 2.3.2 → 2.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/assets/{AboutDialog-MZbHWRua.js → AboutDialog-Ctk2zvrv.js} +1 -1
  2. package/dist/assets/{ArchiveView-CkeSWPcI.js → ArchiveView-sbNreasJ.js} +1 -1
  3. package/dist/assets/{CommandPalette-CtKzNzwW.js → CommandPalette-BICwnwAZ.js} +2 -2
  4. package/dist/assets/{DiffView-DaXjHTAq.js → DiffView-B5yeuxv8.js} +1 -1
  5. package/dist/assets/{FilesView-DMNYEydF.js → FilesView-ni2zfAwL.js} +7 -7
  6. package/dist/assets/{GitView-HXttTpUw.js → GitView-C0QgeC9O.js} +3 -3
  7. package/dist/assets/{GuestSurfacePane-KzguENQG.js → GuestSurfacePane-D1gLktSj.js} +1 -1
  8. package/dist/assets/{HelpDialog-9YZGhBgT.js → HelpDialog-CxC6qTaS.js} +1 -1
  9. package/dist/assets/{InProgressOperationBanner-DzGIwGH2.js → InProgressOperationBanner-JFV70YFh.js} +1 -1
  10. package/dist/assets/{JsonTreeView-D9rP8jM8.js → JsonTreeView-RsbV4Usa.js} +1 -1
  11. package/dist/assets/MarkdownRendererImpl-CZK5DoOX.js +1 -0
  12. package/dist/assets/{MemoryDebugPanel-Ct0h3RWh.js → MemoryDebugPanel-caUWOKiz.js} +1 -1
  13. package/dist/assets/{OnboardingScreen-B5Zzb1Mp.js → OnboardingScreen-BDT-J2JP.js} +1 -1
  14. package/dist/assets/{OpenCodeStatusDialog-CXBWWRh8.js → OpenCodeStatusDialog-Cxa2yqOB.js} +1 -1
  15. package/dist/assets/{PatchDiff-DhDAQ5em.js → PatchDiff-C1pnbAsJ.js} +1 -1
  16. package/dist/assets/{PierreDiffViewer-DPa08AmN.js → PierreDiffViewer-D0zX2Msu.js} +1 -1
  17. package/dist/assets/PlanView-BxRCMuGe.js +5 -0
  18. package/dist/assets/{ProjectActionsDialog-DATu0aBc.js → ProjectActionsDialog-D660By4K.js} +1 -1
  19. package/dist/assets/{RunOverview-D6xy_vME.js → RunOverview-C1uTMnQS.js} +2 -2
  20. package/dist/assets/{ScheduledTasksDialog-BWXVnfrf.js → ScheduledTasksDialog-S-gAgo7Z.js} +5 -5
  21. package/dist/assets/SettingsView-CVpfbdob.js +30 -0
  22. package/dist/assets/{SettingsWindow-Cx6TrtY0.js → SettingsWindow-Dd1hHvgh.js} +1 -1
  23. package/dist/assets/SourceBoardView-DbGWAxtS.js +1 -0
  24. package/dist/assets/SpaceAccessDialog-muTSsEJ9.js +1 -0
  25. package/dist/assets/{SpaceApplyDialog-BtuwtlaG.js → SpaceApplyDialog-Dsf6MNGm.js} +1 -1
  26. package/dist/assets/{SpaceRow-MXqvd-dr.js → SpaceRow-7Z6ebRtm.js} +1 -1
  27. package/dist/assets/{SpaceSetupOutput-Uo5LS7Jy.js → SpaceSetupOutput-BytPfCOC.js} +1 -1
  28. package/dist/assets/{SpacesView-DvoOh4sM.js → SpacesView-CYCrlp0D.js} +1 -1
  29. package/dist/assets/{SubmoduleDiffSummary-CyMwDeoP.js → SubmoduleDiffSummary-VrNUbIqF.js} +1 -1
  30. package/dist/assets/{ToolOutputDialog-BaUZIVzc.js → ToolOutputDialog-DHORjBND.js} +7 -7
  31. package/dist/assets/{ToolPartDiffPreview-DmMwdcF4.js → ToolPartDiffPreview-BLAXe7C5.js} +1 -1
  32. package/dist/assets/{UsageStatsView-D7WrDBTC.js → UsageStatsView-BxtYEAa0.js} +1 -1
  33. package/dist/assets/{Virtualizer-CnU8pYMb.js → Virtualizer-Bl4Cf-H-.js} +1 -1
  34. package/dist/assets/{WalkthroughView-r0Ho9F4Z.js → WalkthroughView-B2BJJ4u5.js} +2 -2
  35. package/dist/assets/{WorktreesView-C-t7uxq1.js → WorktreesView-Dv0AO9dF.js} +1 -1
  36. package/dist/assets/{appThemeRegistry-BUY7Ge9i.js → appThemeRegistry-xm_W0svA.js} +1 -1
  37. package/dist/assets/{ar-HauNhDvN.js → ar-Cj8UF12m.js} +4 -4
  38. package/dist/assets/{computeVirtualFileMetrics-CUof18z3.js → computeVirtualFileMetrics-Cx05cmWI.js} +2 -2
  39. package/dist/assets/{de-fEoJ_Yyp.js → de-fSQ1ho01.js} +4 -4
  40. package/dist/assets/{decorate-BkTSGAlD.js → decorate-jpF7GA6t.js} +2 -2
  41. package/dist/assets/{es-CKNTBsZW.js → es-DrdzhSlK.js} +5 -5
  42. package/dist/assets/{fileContentPoller-BJWgy1fX.js → fileContentPoller-C0f20jNG.js} +3 -3
  43. package/dist/assets/{flexokiTheme-BArobfXV.js → flexokiTheme-DKNCYSqL.js} +1 -1
  44. package/dist/assets/{fr-C23655Pi.js → fr-Cmz6Da4q.js} +4 -4
  45. package/dist/assets/{he-CphXS_Fv.js → he-COJRUNy4.js} +4 -4
  46. package/dist/assets/{index-B27cSA9V.js → index-C8Mw8uvl.js} +1 -1
  47. package/dist/assets/{initializeSharedPreferences-CucsmDMw.js → initializeSharedPreferences-U9-v9mfq.js} +1 -1
  48. package/dist/assets/{isDiffPlainText-DSCjvV0m.js → isDiffPlainText-DW43IghW.js} +1 -1
  49. package/dist/assets/{isFilePlainText-C7g4UPox.js → isFilePlainText-Duq5CiuG.js} +1 -1
  50. package/dist/assets/{ja-BmsU2iQe.js → ja-Ce0NvDHZ.js} +4 -4
  51. package/dist/assets/katex-BZNCT55U.css +1 -0
  52. package/dist/assets/katex.min-EZjpSwGK.js +65 -0
  53. package/dist/assets/{ko-CxISpkje.js → ko-BGFcCLLq.js} +4 -4
  54. package/dist/assets/main-BUetg9hg.js +1048 -0
  55. package/dist/assets/{main-CGPiw9fS.js → main-Be_jmIlF.js} +2 -2
  56. package/dist/assets/markdownCore-BkTeS4gA.js +10 -0
  57. package/dist/assets/{miniChat-DVEKVYKe.js → miniChat-g1RgiLLS.js} +2 -2
  58. package/dist/assets/{mobile-Q_FVBe4I.js → mobile-DBli3U-T.js} +2 -2
  59. package/dist/assets/{moveWorkspacePath-CyZJ-2aD.js → moveWorkspacePath-CnYc96Xo.js} +1 -1
  60. package/dist/assets/{nl-jnTBQ_gU.js → nl-Cu1nxo5t.js} +4 -4
  61. package/dist/assets/{parseDiffFromFile-OHXXXyzL.js → parseDiffFromFile-DEjkjYod.js} +3 -3
  62. package/dist/assets/{patchFileDiff-BZrb6h2u.js → patchFileDiff-D__42sau.js} +5 -5
  63. package/dist/assets/{pierreDiffTint-DHf2xvyt.js → pierreDiffTint-3oatL635.js} +4 -4
  64. package/dist/assets/pl-4LdEMgWI.js +20 -0
  65. package/dist/assets/{pt-BR-BfpsFrHv.js → pt-BR-2UbEBNgC.js} +5 -5
  66. package/dist/assets/{relocateRestoredSession-DInneXVI.js → relocateRestoredSession-pkxyd_lV.js} +1 -1
  67. package/dist/assets/renderElectronMiniChatApp-D0tKJFBB.js +2 -0
  68. package/dist/assets/renderMobileApp-D6bOYHuP.js +25 -0
  69. package/dist/assets/{restartOpenCode-DwBaMPJK.js → restartOpenCode-FYqjpaWc.js} +1 -1
  70. package/dist/assets/runtimeEndpointReset-6CNNzem4.js +74 -0
  71. package/dist/assets/{scheduledTasksApi-ClJplEhR.js → scheduledTasksApi-BbnQ4W-W.js} +1 -1
  72. package/dist/assets/{selectionMarkdown-BuveYuup.js → selectionMarkdown-D8QAxC44.js} +1 -1
  73. package/dist/assets/sessionOwnership-BBuf0UCB.js +1 -0
  74. package/dist/assets/{shikiHighlight-DJAESrna.js → shikiHighlight-CweIj1cL.js} +1 -1
  75. package/dist/assets/{space-apply-DWFLwXbI.js → space-apply-CEi013sa.js} +1 -1
  76. package/dist/assets/{space-close-BYDbwdWc.js → space-close-BuStkLrZ.js} +1 -1
  77. package/dist/assets/{spaceNetwork-DHrhfbKM.js → spaceNetwork-tH2d5Mgs.js} +1 -1
  78. package/dist/assets/{textMateThemeFromAppTheme-DcAZmUlv.js → textMateThemeFromAppTheme-DLJBL6al.js} +1 -1
  79. package/dist/assets/tr-Bg0Qt-mG.js +11 -0
  80. package/dist/assets/{uk-C82aEtvs.js → uk-vcnOugr0.js} +5 -5
  81. package/dist/assets/useAppFontEffects-Cs6k0JKv.js +773 -0
  82. package/dist/assets/{useCallableModelProviders-BU_455MN.js → useCallableModelProviders-BsGEzsl2.js} +1 -1
  83. package/dist/assets/{useInlineCommentController-AuUrVz9U.js → useInlineCommentController-CVYaPzfO.js} +2 -2
  84. package/dist/assets/{useRootScrollLock-Cpk7NmBa.js → useRootScrollLock-Dov-44ov.js} +2 -2
  85. package/dist/assets/{vendor-codemirror-language-data-BYGweLoh.js → vendor-codemirror-language-data-DBekkZIx.js} +2 -2
  86. package/dist/assets/vendor-tanstack-react-virtual-Dozz-7fb.js +1 -0
  87. package/dist/assets/vendor-tanstack-virtual-core-DKBj55Em.js +1 -0
  88. package/dist/assets/{vendor-yaml-3778uTud.js → vendor-yaml-CE-D_49-.js} +1 -1
  89. package/dist/assets/{zh-CN-DEq7j9I5.js → zh-CN-C3UhwFsk.js} +5 -5
  90. package/dist/assets/{zh-TW-DgCN99T-.js → zh-TW-D0CmmMvp.js} +5 -5
  91. package/dist/index.html +3 -3
  92. package/dist/mini-chat.html +3 -3
  93. package/dist/mobile.html +3 -3
  94. package/package.json +5 -5
  95. package/server/index.js +13 -1
  96. package/server/lib/agent-memory/actions.js +22 -9
  97. package/server/lib/agent-memory/actions.test.js +57 -0
  98. package/server/lib/agent-memory/runtime.js +8 -5
  99. package/server/lib/agent-tool/DOCUMENTATION.md +17 -1
  100. package/server/lib/agent-tool/runtime.js +41 -7
  101. package/server/lib/agent-tool/runtime.test.js +11 -0
  102. package/server/lib/git/DOCUMENTATION.md +17 -5
  103. package/server/lib/git/lfs-discovery.js +7 -4
  104. package/server/lib/git/lfs-discovery.test.js +60 -0
  105. package/server/lib/git/network-operations.js +9 -3
  106. package/server/lib/git/network-operations.test.js +31 -2
  107. package/server/lib/git/service.js +72 -12
  108. package/server/lib/git/service.test.js +65 -0
  109. package/server/lib/github/DOCUMENTATION.md +1 -0
  110. package/server/lib/github/reference-search.js +49 -18
  111. package/server/lib/github/reference-search.test.js +28 -6
  112. package/server/lib/github/routes.js +87 -1
  113. package/server/lib/github/routes.mutations.test.js +38 -0
  114. package/server/lib/github/routes.test.js +1 -0
  115. package/server/lib/gitlab/DOCUMENTATION.md +4 -0
  116. package/server/lib/gitlab/client.js +23 -0
  117. package/server/lib/gitlab/client.test.js +28 -1
  118. package/server/lib/gitlab/mappers.js +9 -0
  119. package/server/lib/gitlab/resources.js +153 -4
  120. package/server/lib/gitlab/resources.test.js +107 -0
  121. package/server/lib/gitlab/routes.js +120 -1
  122. package/server/lib/gitlab/routes.test.js +59 -0
  123. package/server/lib/markdown-image-grants/DOCUMENTATION.md +4 -0
  124. package/server/lib/markdown-image-grants/routes.js +14 -2
  125. package/server/lib/markdown-image-grants/routes.test.js +23 -0
  126. package/server/lib/notifications/APNS.md +24 -23
  127. package/server/lib/notifications/DOCUMENTATION.md +2 -2
  128. package/server/lib/notifications/apns-runtime.js +8 -5
  129. package/server/lib/notifications/apns-runtime.test.js +26 -0
  130. package/server/lib/notifications/message.js +5 -3
  131. package/server/lib/notifications/message.test.js +9 -0
  132. package/server/lib/notifications/runtime.js +44 -9
  133. package/server/lib/notifications/trigger-runtime.test.js +84 -0
  134. package/server/lib/openchamber-control/DOCUMENTATION.md +6 -1
  135. package/server/lib/openchamber-control/actions.js +18 -2
  136. package/server/lib/openchamber-control/project-knowledge.js +17 -3
  137. package/server/lib/openchamber-control/project-knowledge.test.js +14 -0
  138. package/server/lib/openchamber-control/render-page.js +58 -0
  139. package/server/lib/openchamber-control/service.js +9 -0
  140. package/server/lib/openchamber-control/service.test.js +43 -0
  141. package/server/lib/openchamber-sessions/routes.js +1 -0
  142. package/server/lib/openchamber-sessions/worktree-move.js +26 -10
  143. package/server/lib/openchamber-sessions/worktree-move.test.js +36 -0
  144. package/server/lib/opencode/DOCUMENTATION.md +1 -1
  145. package/server/lib/opencode/managed-config-file.js +3 -2
  146. package/server/lib/opencode/managed-config-file.test.js +20 -6
  147. package/server/lib/opencode/settings-helpers.js +3 -0
  148. package/server/lib/opencode/settings-helpers.test.js +1 -1
  149. package/server/lib/opencode/settings-registry.json +3 -0
  150. package/server/lib/opencode/settings-runtime.js +1 -0
  151. package/server/lib/project-context/DOCUMENTATION.md +25 -1
  152. package/server/lib/project-context/plan-progress.js +69 -0
  153. package/server/lib/project-context/plan-progress.test.js +58 -0
  154. package/server/lib/project-context/routes.http.test.js +22 -0
  155. package/server/lib/project-context/routes.js +20 -0
  156. package/server/lib/project-context/runtime.js +132 -18
  157. package/server/lib/project-context/runtime.test.js +58 -0
  158. package/server/lib/provider-read-cache/index.js +7 -1
  159. package/server/lib/provider-read-cache/index.test.js +12 -0
  160. package/server/lib/relay/DOCUMENTATION.md +17 -1
  161. package/server/lib/session-knowledge/DOCUMENTATION.md +17 -0
  162. package/server/lib/session-knowledge/runtime.js +29 -6
  163. package/server/lib/session-knowledge/runtime.test.js +26 -1
  164. package/server/lib/source-control/audit-storage.js +1 -0
  165. package/server/lib/source-control/mutation-storage.js +3 -0
  166. package/server/lib/spaces/DOCUMENTATION.md +14 -9
  167. package/server/lib/spaces/code-out.js +13 -4
  168. package/server/lib/spaces/code-out.test.js +5 -3
  169. package/server/lib/spaces/dispatcher.js +12 -5
  170. package/server/lib/spaces/dispatcher.test.js +19 -1
  171. package/server/lib/spaces/gatekeeper-channel.js +8 -7
  172. package/server/lib/spaces/gatekeeper-channel.test.js +10 -0
  173. package/server/lib/spaces/gatekeeper-program.cjs +38 -3
  174. package/server/lib/spaces/gatekeeper-program.test.js +20 -0
  175. package/server/lib/spaces/hardening.js +14 -1
  176. package/server/lib/spaces/hardening.test.js +5 -0
  177. package/server/lib/spaces/host-providers.js +165 -0
  178. package/server/lib/spaces/host-providers.test.js +100 -0
  179. package/server/lib/spaces/host.js +16 -4
  180. package/server/lib/spaces/journey.js +87 -17
  181. package/server/lib/spaces/journey.test.js +90 -2
  182. package/server/lib/spaces/layout.js +15 -5
  183. package/server/lib/spaces/places/docker-live-support.js +2 -0
  184. package/server/lib/spaces/places/docker.test.js +2 -0
  185. package/server/lib/spaces/places/fake-docker.js +3 -0
  186. package/server/lib/spaces/places/grants.docker.live.test.js +71 -7
  187. package/server/lib/spaces/routes.js +9 -0
  188. package/server/lib/spaces/routes.test.js +4 -2
  189. package/server/lib/spaces/space-opencode.js +31 -14
  190. package/server/lib/spaces/space-opencode.test.js +15 -2
  191. package/server/lib/spaces/space-records.js +8 -0
  192. package/server/lib/spaces/space-records.test.js +7 -3
  193. package/server/lib/spaces/websocket.test.js +13 -1
  194. package/server/lib/ui-auth/ui-auth.js +28 -3
  195. package/server/lib/ui-auth/ui-auth.test.js +31 -0
  196. package/dist/assets/MarkdownRendererImpl-B2LsA09C.js +0 -1
  197. package/dist/assets/PlanView-Dt5EN_JK.js +0 -5
  198. package/dist/assets/SettingsView-BolP_tuu.js +0 -30
  199. package/dist/assets/SourceBoardView-yca1qvgB.js +0 -1
  200. package/dist/assets/SpaceAccessDialog-CZ-u75py.js +0 -1
  201. package/dist/assets/katex-rNcbfUj4.css +0 -1
  202. package/dist/assets/katex.min-DQ8qF6NR.js +0 -65
  203. package/dist/assets/main-CVHM3_8W.js +0 -1048
  204. package/dist/assets/markdownCore-D5ZOJXeO.js +0 -9
  205. package/dist/assets/pl-Bj-Hy0X5.js +0 -20
  206. package/dist/assets/renderElectronMiniChatApp-B_5BeSF6.js +0 -2
  207. package/dist/assets/renderMobileApp-DGEXUTk-.js +0 -25
  208. package/dist/assets/runtimeEndpointReset-CIpvn8QG.js +0 -59
  209. package/dist/assets/sessionOwnership-BZoGed9N.js +0 -1
  210. package/dist/assets/tr-qMRMBQ8r.js +0 -11
  211. package/dist/assets/useAppFontEffects-Bih1DxXi.js +0 -745
  212. package/dist/assets/vendor-tanstack-react-virtual-CvuLsk7D.js +0 -1
  213. package/dist/assets/vendor-tanstack-virtual-core-DPaNcJcT.js +0 -1
@@ -35,7 +35,7 @@ afterEach(() => {
35
35
  });
36
36
 
37
37
  /** A journey on fresh stand-ins. `failAt` names a stand-in step that rejects. */
38
- const journeyWith = ({ readHostLogin = null, failAt = null, place = createMemoryPlace(), morePlaces = [], projects = [PROJECT], historyStatus = 'sent', holdCodeIn = false, holdCodeOut = false, holdIdleSave = false, holdReady = false, holdLoginRow = false, hostEnvironment = {}, hostLogin = null, dataDir = null, archiveChats = null, logger = quiet, resolveDirectory = undefined } = {}) => {
38
+ const journeyWith = ({ readHostLogin = null, hostProviders = undefined, failAt = null, place = createMemoryPlace(), morePlaces = [], projects = [PROJECT], historyStatus = 'sent', holdCodeIn = false, holdCodeOut = false, holdIdleSave = false, holdReady = false, holdLoginRow = false, hostEnvironment = {}, hostLogin = null, dataDir = null, archiveChats = null, logger = quiet, resolveDirectory = undefined } = {}) => {
39
39
  // With `holdCodeIn`, code in waits until the test lets it go, so a creation stays under way;
40
40
  // `holdCodeOut` does the same for the fetch of an apply.
41
41
  let releaseCodeIn = () => {};
@@ -78,7 +78,8 @@ const journeyWith = ({ readHostLogin = null, failAt = null, place = createMemory
78
78
  let releaseLoginRow = () => {};
79
79
  const loginRowHeld = new Promise((resolve) => { releaseLoginRow = resolve; });
80
80
  const spaceOpenCode = {
81
- writeProviderConfig: async (spaceId, grants) => { calls.push(['writeProviderConfig', spaceId, grants]); fail('writeProviderConfig'); },
81
+ // The host's custom provider definitions travel as a fourth element only when there are any, so the older expectations read as before.
82
+ writeProviderConfig: async (spaceId, grants, customProviders) => { calls.push(['writeProviderConfig', spaceId, grants, ...(customProviders?.size > 0 ? [customProviders] : [])]); fail('writeProviderConfig'); },
82
83
  writeLogin: async (spaceId, provider, login) => { calls.push(['writeLogin', spaceId, provider, login]); if (holdLoginRow) await loginRowHeld; fail('writeLogin'); },
83
84
  removeLogin: async (spaceId, provider) => { calls.push(['removeLogin', spaceId, provider]); if (holdLoginRow) await loginRowHeld; fail('removeLogin'); },
84
85
  };
@@ -118,6 +119,7 @@ const journeyWith = ({ readHostLogin = null, failAt = null, place = createMemory
118
119
  archiveChats,
119
120
  readHostSecret: (name) => hostEnvironment[name],
120
121
  readHostLogin: readHostLogin ?? (async (provider) => (hostLogin && provider === 'openai' ? hostLogin : null)),
122
+ hostProviders,
121
123
  folderExists: async () => true,
122
124
  resolveDirectory,
123
125
  readIdleStop: async () => idle.saved ?? { enabled: true, hours: 4 },
@@ -1163,6 +1165,92 @@ describe('the journey: grants', () => {
1163
1165
  });
1164
1166
  });
1165
1167
 
1168
+ describe('the journey: a provider of the user\'s own', () => {
1169
+ const OLLAMA = { name: 'Ollama (local)', package: 'aisdk:@ai-sdk/openai-compatible', baseURL: 'http://localhost:11434/v1', headers: {}, models: { 'qwen3:8b': { modelID: 'qwen3:8b', name: 'Qwen3 8B' } }, key: null };
1170
+ const LIGHTHOUSE = { name: 'Lighthouse', package: 'aisdk:@ai-sdk/openai', baseURL: 'https://lighthouse-gw.example.dev/v1', headers: { 'x-team': 'platform' }, models: { 'gpt-5.5': { modelID: 'gpt-5.5' } }, key: 'sk-lighthouse' };
1171
+ /** The host's providers as a stand-in reads them, by id; `reads` records which directory each read named. */
1172
+ const hostProvidersOf = (definitions, reads = []) => ({
1173
+ read: async (providerId, directory) => { reads.push([providerId, directory]); return definitions[providerId] ?? null; },
1174
+ list: async () => Object.entries(definitions).map(([id, definition]) => ({ id, name: definition.name, hasKey: definition.key !== null })),
1175
+ });
1176
+ const ready = async (options) => {
1177
+ const made = journeyWith(options);
1178
+ const { id } = await made.journey.createSpace(REQUEST);
1179
+ await until(() => steps(made.events, id).includes('ready'));
1180
+ await until(() => made.records.read(id).record?.history !== 'pending');
1181
+ made.calls.splice(0);
1182
+ return { ...made, id };
1183
+ };
1184
+
1185
+ it('reads the provider from the host for the space\'s project, sends "this machine" to the Docker host, and tells OpenCode inside the provider as the host defines it', async () => {
1186
+ const reads = [];
1187
+ const { journey, records, calls, id } = await ready({ hostProviders: hostProvidersOf({ 'ollama-local': OLLAMA, lighthouse: LIGHTHOUSE }, reads) });
1188
+ const ollama = await journey.grantAccess(id, { kind: 'custom', provider: 'ollama-local' });
1189
+ expect(ollama.grant).toEqual({ kind: 'custom', id: 'ollama-local', provider: 'ollama-local', url: 'http://gatekeeper:8080/model/ollama-local' });
1190
+ const lighthouse = await journey.grantAccess(id, { kind: 'custom', provider: 'lighthouse' });
1191
+ expect(lighthouse.grant).toMatchObject({ kind: 'custom', id: 'lighthouse' });
1192
+ expect(reads.every(([, directory]) => directory === PROJECT)).toBe(true);
1193
+
1194
+ const definitionOf = (definition) => { const { key: _key, ...rest } = definition; return rest; };
1195
+ expect(calls).toEqual([
1196
+ // No key: the window forwards the request as the space made it, less its credential headers.
1197
+ ['addGrant', id, { id: 'ollama-local', upstream: 'http://host.docker.internal:11434/v1', header: null, secret: null }],
1198
+ ['writeProviderConfig', id, [expect.objectContaining({ id: 'ollama-local' })], new Map([['ollama-local', definitionOf(OLLAMA)]])],
1199
+ // The provider's own headers go with the key to the gatekeeper, and nowhere else.
1200
+ ['addGrant', id, { id: 'lighthouse', upstream: 'https://lighthouse-gw.example.dev/v1', header: 'authorization', secret: 'sk-lighthouse', headers: { 'x-team': 'platform' } }],
1201
+ ['writeProviderConfig', id, [expect.objectContaining({ id: 'ollama-local' }), expect.objectContaining({ id: 'lighthouse' })], new Map([['ollama-local', definitionOf(OLLAMA)], ['lighthouse', definitionOf(LIGHTHOUSE)]])],
1202
+ ]);
1203
+ // The headers are read on the host and go to the gatekeeper; the record names none of them.
1204
+ expect(JSON.stringify(records.read(id).record)).not.toContain('platform');
1205
+ // The record names the providers and nothing of them: no address, no key.
1206
+ expect(records.read(id).record.grants).toEqual([{ kind: 'custom', id: 'ollama-local', provider: 'ollama-local' }, { kind: 'custom', id: 'lighthouse', provider: 'lighthouse' }]);
1207
+ const onDisk = JSON.stringify(records.read(id).record);
1208
+ expect(onDisk).not.toContain('11434');
1209
+ expect(onDisk).not.toContain('sk-lighthouse');
1210
+ expect(JSON.stringify(await journey.listSpaces({ access: true }))).not.toContain('sk-lighthouse');
1211
+ });
1212
+
1213
+ it('refuses a provider the host does not define, one whose SDK the window cannot serve, and one without an address', async () => {
1214
+ const bedrock = { ...LIGHTHOUSE, package: 'aisdk:@ai-sdk/amazon-bedrock' };
1215
+ const noAddress = { ...LIGHTHOUSE, baseURL: null };
1216
+ const { journey, records, calls, id } = await ready({ hostProviders: hostProvidersOf({ bedrock, 'no-address': noAddress }) });
1217
+ await expect(journey.grantAccess(id, { kind: 'custom', provider: 'nowhere' })).rejects.toMatchObject({ code: 'provider_not_found' });
1218
+ await expect(journey.grantAccess(id, { kind: 'custom', provider: 'bedrock' })).rejects.toMatchObject({ code: 'provider_not_supported' });
1219
+ await expect(journey.grantAccess(id, { kind: 'custom', provider: 'no-address' })).rejects.toMatchObject({ code: 'provider_not_supported' });
1220
+ await expect(journey.grantAccess(id, { kind: 'custom', provider: 'bedrock', upstream: 'https://x.example/' })).rejects.toMatchObject({ code: 'invalid_grant_request' });
1221
+ expect(calls).toEqual([]);
1222
+ expect(records.read(id).record.grants).toEqual([]);
1223
+ });
1224
+
1225
+ it('says the grant again after a start from the host\'s definition as it is then, and leaves one the host no longer defines as "needs access"', async () => {
1226
+ const definitions = { 'ollama-local': OLLAMA, lighthouse: LIGHTHOUSE };
1227
+ const { journey, calls, gatekeeper, id } = await ready({ hostProviders: hostProvidersOf(definitions) });
1228
+ await journey.grantAccess(id, { kind: 'custom', provider: 'ollama-local' });
1229
+ await journey.grantAccess(id, { kind: 'custom', provider: 'lighthouse' });
1230
+ await journey.stopSpace(id);
1231
+ // Like the program's memory: a stop forgets every grant.
1232
+ gatekeeper.forget(id);
1233
+ // Meanwhile the user changed Lighthouse's key in Settings and deleted Ollama there.
1234
+ definitions.lighthouse = { ...LIGHTHOUSE, key: 'sk-lighthouse-2' };
1235
+ delete definitions['ollama-local'];
1236
+ calls.splice(0);
1237
+
1238
+ const started = await journey.startSpace(id);
1239
+ expect(started).toMatchObject({ grantsRestored: ['lighthouse'], needsAccess: ['ollama-local'] });
1240
+ expect(calls.filter(([name]) => name === 'addGrant')).toEqual([['addGrant', id, { id: 'lighthouse', upstream: 'https://lighthouse-gw.example.dev/v1', header: 'authorization', secret: 'sk-lighthouse-2', headers: { 'x-team': 'platform' } }]]);
1241
+ // The configuration inside is written from what the host defines now; the deleted provider is left out.
1242
+ const [write] = calls.filter(([name]) => name === 'writeProviderConfig');
1243
+ expect(write[2].map((grant) => grant.id)).toEqual(['ollama-local', 'lighthouse']);
1244
+ expect(Array.from(write[3].keys())).toEqual(['lighthouse']);
1245
+ expect((await journey.listSpaces({ access: true }))[0]).toMatchObject({ access: 'needs_access', needsAccess: ['ollama-local'] });
1246
+ });
1247
+
1248
+ it('lists the host\'s own providers for the dialogs and leaves the catalog\'s providers to their own rows', async () => {
1249
+ const { journey } = await ready({ hostProviders: hostProvidersOf({ 'ollama-local': OLLAMA, openai: LIGHTHOUSE, 'github-copilot': LIGHTHOUSE }) });
1250
+ expect(await journey.readHostCustomProviders(PROJECT)).toEqual({ providers: [{ id: 'ollama-local', name: 'Ollama (local)', hasKey: false }] });
1251
+ });
1252
+ });
1253
+
1166
1254
  describe('the journey: journal and apply', () => {
1167
1255
  const ready = async (options) => {
1168
1256
  const made = journeyWith(options);
@@ -93,11 +93,21 @@ export const GATEKEEPER_PROGRAM_DIRECTORY = '/tmp/openchamber-gatekeeper';
93
93
  export const GATEKEEPER_PROGRAM_PATH = `${GATEKEEPER_PROGRAM_DIRECTORY}/gatekeeper.cjs`;
94
94
  export const GATEKEEPER_BIND_PATH = `${GATEKEEPER_PROGRAM_DIRECTORY}/bind`;
95
95
 
96
- // OpenCode's global configuration inside a space, where the host writes the provider
97
- // configuration that sends model calls through the window. The agent can change it; the
98
- // gatekeeper is what enforces, this only cooperates.
99
- export const SPACE_OPENCODE_CONFIG_DIRECTORY = `${SPACE_HOME}/.config/opencode`;
100
- export const SPACE_OPENCODE_CONFIG_PATH = `${SPACE_OPENCODE_CONFIG_DIRECTORY}/opencode.json`;
96
+ // OpenCode's configuration inside a space, where the host writes the provider configuration
97
+ // that sends model calls through the window: a `.opencode` folder in the work volume beside the
98
+ // project's copy. OpenCode reads a `.opencode/opencode.json` of any folder above the project
99
+ // over the project's own `opencode.json`, measured on 2.0.27, and that file travels in with the
100
+ // code: written in the home directory, the host's entry lost to a provider the project defines
101
+ // itself, with its real address, which nothing inside can reach. The folder starts with a dot,
102
+ // which no project folder name can, and it is outside the project's repository, so nothing of it
103
+ // comes out with the code. The agent can change it; the gatekeeper is what enforces, this only
104
+ // cooperates.
105
+ export const spaceOpenCodeConfigDirectory = (spaceId) => `${spaceWorkPath(spaceId)}/.opencode`;
106
+ export const spaceOpenCodeConfigPath = (spaceId) => `${spaceOpenCodeConfigDirectory(spaceId)}/opencode.json`;
107
+ // Where the host wrote it before, OpenCode's global file in the home volume. A space made then
108
+ // still holds it, and OpenCode merges a provider's settings across layers field by field, so a
109
+ // stale entry there would leak fields into the one beside the project; the write removes it.
110
+ export const LEGACY_SPACE_OPENCODE_CONFIG_PATH = `${SPACE_HOME}/.config/opencode/opencode.json`;
101
111
 
102
112
  const IMAGE_PATH = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin';
103
113
 
@@ -127,6 +127,8 @@ require('node:http').createServer((request, response) => {
127
127
  path: request.url,
128
128
  authorization: hash(request.headers.authorization),
129
129
  apiKey: hash(request.headers['x-api-key']),
130
+ // A header of the user's own, as a custom provider's grant sets it beside the key.
131
+ team: hash(request.headers['x-team']),
130
132
  headerNames: Object.keys(request.headers).sort(),
131
133
  };
132
134
  // One line per request in the container's log, so the host can read what a client it does
@@ -270,6 +270,8 @@ describe('docker place: create', () => {
270
270
  '--log-opt', 'compress=false',
271
271
  '--network', NETWORK,
272
272
  '--network-alias', 'gatekeeper',
273
+ // The Docker host by name, for a provider that listens on that machine's loopback.
274
+ '--add-host', 'host.docker.internal:host-gateway',
273
275
  '--env', 'HOME=/tmp',
274
276
  SPACE_BASE_IMAGE,
275
277
  '/bin/sh', '-c',
@@ -63,6 +63,7 @@ export function hardenedContainerEntry({
63
63
  memoryBytes = 4294967296,
64
64
  tmpfs = '/tmp:rw,exec,nosuid,size=256m',
65
65
  aliases = [],
66
+ extraHosts = [],
66
67
  image = FAKE_BASE_IMAGE,
67
68
  }) {
68
69
  const mountList = mounts ?? [
@@ -99,6 +100,7 @@ export function hardenedContainerEntry({
99
100
  Runtime: 'runc',
100
101
  Devices: [],
101
102
  PortBindings: {},
103
+ ExtraHosts: extraHosts,
102
104
  },
103
105
  Mounts: mountList.map(volumeMountEntry),
104
106
  // Like the real engine once the container runs: an address on its network. The fake gives it
@@ -241,6 +243,7 @@ export function createFakeDocker({
241
243
  memoryBytes: Number(readFlag(args, '--memory')),
242
244
  tmpfs: args.includes('--tmpfs') ? readFlag(args, '--tmpfs') : undefined,
243
245
  aliases: args.includes('--network-alias') ? [readFlag(args, '--network-alias')] : [],
246
+ extraHosts: args.filter((arg, index) => args[index - 1] === '--add-host'),
244
247
  });
245
248
  add('container', name, args[0] === 'create' ? alterContainer(entry) : entry);
246
249
  // `docker create` prints the id of the new container.
@@ -19,7 +19,8 @@ import { createGlobalMessageStreamHub } from '../../event-stream/global-hub.js';
19
19
  import { registerOpenCodeProxy } from '../../opencode/proxy.js';
20
20
  import { runCommand } from '../run-command.js';
21
21
  import { createSpacesHost } from '../host.js';
22
- import { SPACE_HOME, SPACE_OPENCODE_CONFIG_PATH } from '../layout.js';
22
+ import { createHostProviders } from '../host-providers.js';
23
+ import { LEGACY_SPACE_OPENCODE_CONFIG_PATH, SPACE_HOME, spaceOpenCodeConfigPath } from '../layout.js';
23
24
  import { WINDOW_PLACEHOLDER_KEY, loginGrantOf, spaceLoginCredentialId } from '../space-opencode.js';
24
25
  import { LIVE_DOCKER_ENABLED, createLiveDockerPlace } from './docker-live-support.js';
25
26
 
@@ -53,6 +54,10 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
53
54
  // plugin stores it, with the address GitHub told it at login.
54
55
  const GITHUB_TOKEN = `gho_live_${crypto.randomBytes(20).toString('hex')}`;
55
56
  const COPILOT_LOGIN = { methodID: 'device', access: GITHUB_TOKEN, expires: 0, metadata: { apiEndpoint: 'https://api.individual.githubcopilot.com' } };
57
+ // A provider of the user's own, defined in the project's configuration with a key in a host
58
+ // variable and a header of its own; the stand-in sees both, the space neither.
59
+ const CUSTOM_KEY = `sk-lighthouse-live-${crypto.randomBytes(24).toString('hex')}`;
60
+ const CUSTOM_HEADER = `team-live-${crypto.randomBytes(16).toString('hex')}`;
56
61
  let place;
57
62
  let dispose = async () => {};
58
63
  let liveHost;
@@ -64,6 +69,7 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
64
69
  let server;
65
70
  let spaceId;
66
71
  let upstream = { seen: async () => [], stop: async () => {} };
72
+ let customProviderAt = () => {};
67
73
  let session = null;
68
74
  const url = (suffix) => `http://127.0.0.1:${server.address().port}${suffix}`;
69
75
  const inside = async (argv) => place.exec(spaceId, argv, { timeoutMs: 60_000 });
@@ -81,6 +87,13 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
81
87
  const git = (...args) => runCommand('git', ['-C', project, ...args]);
82
88
  await git('init', '-q', '.');
83
89
  fs.writeFileSync(path.join(project, 'README.md'), 'A project for the grants live pass.\n');
90
+ // The custom provider lives in the project's own OpenCode configuration, committed, so the
91
+ // file travels into the space with the code, where its address, a port nothing listens on,
92
+ // is what OpenCode inside would use if the host's entry did not win over it. On the host the
93
+ // address is set again once the stand-in runs; the host reads the file, not the commit.
94
+ const writeCustomProvider = (baseURL) => fs.writeFileSync(path.join(project, 'opencode.json'), JSON.stringify({ providers: { lighthouse: { name: 'Lighthouse', package: 'aisdk:@ai-sdk/openai-compatible', env: ['LIGHTHOUSE_KEY'], settings: { baseURL }, headers: { 'x-team': CUSTOM_HEADER }, models: { 'gpt-5.5': { modelID: 'gpt-5.5', name: 'GPT 5.5' } } } } }, null, 2));
95
+ writeCustomProvider('http://127.0.0.1:9/v1');
96
+ customProviderAt = writeCustomProvider;
84
97
  await git('add', '.');
85
98
  await git('-c', 'user.email=me@example.invalid', '-c', 'user.name=Me', 'commit', '-q', '-m', 'init');
86
99
 
@@ -88,7 +101,9 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
88
101
  dataDir,
89
102
  place,
90
103
  listProjectDirectories: async () => [project],
91
- hostEnvironment: { ...process.env, OPENAI_API_KEY: ENV_KEY },
104
+ hostEnvironment: { ...process.env, OPENAI_API_KEY: ENV_KEY, LIGHTHOUSE_KEY: CUSTOM_KEY },
105
+ // The host's OpenCode of this test stores no key, so the reader falls back to the variable the entry names.
106
+ hostProviders: createHostProviders({ readStoredKey: async () => null, hostEnvironment: { LIGHTHOUSE_KEY: CUSTOM_KEY } }),
92
107
  readHostLogin: async (provider) => (provider === 'openai' ? hostLogin : provider === 'github-copilot' ? COPILOT_LOGIN : null),
93
108
  // The renewal as the host's OpenCode would take it: a new token, an hour from now.
94
109
  renewHostLogin: async (provider) => { renewals.push(provider); hostLogin = { ...hostLogin, access: `eyJ-renewed-${crypto.randomBytes(24).toString('hex')}`, expires: Date.now() + 3600_000 }; return hostLogin; },
@@ -122,6 +137,7 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
122
137
  spaceId = answer.id;
123
138
  expect(await until(async () => (await listed())?.state === 'running' && (await listed())?.step === null, CREATE_TIMEOUT_MS)).toBe(true);
124
139
  upstream = await liveHost.startWindowUpstream(spaceId);
140
+ customProviderAt(upstream.url);
125
141
  }, CREATE_TIMEOUT_MS);
126
142
 
127
143
  afterAll(async () => {
@@ -156,11 +172,39 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
156
172
  expect(insideTheSpace.stdout.length).toBeGreaterThan(0);
157
173
  expect(insideTheSpace.stdout).not.toContain(TYPED_KEY);
158
174
  // What the space does have: the configuration that points OpenCode at the window.
159
- const config = JSON.parse((await inside(['cat', SPACE_OPENCODE_CONFIG_PATH])).stdout);
175
+ const config = JSON.parse((await inside(['cat', spaceOpenCodeConfigPath(spaceId)])).stdout);
160
176
  expect(config.provider.anthropic.options).toEqual({ baseURL: 'http://gatekeeper:8080/model/anthropic', apiKey: 'space-window' });
161
177
  expect((await listed())).toMatchObject({ access: 'granted', needsAccess: [], grants: [expect.objectContaining({ id: 'anthropic' })] });
162
178
  }, 120_000);
163
179
 
180
+ it('gives a provider of the user\'s own to the gatekeeper with its key and its own header, and keeps both out of the record, the containers and the space', async () => {
181
+ const granted = await host.journey.grantAccess(spaceId, { kind: 'custom', provider: 'lighthouse' });
182
+ expect(granted.grant).toEqual({ kind: 'custom', id: 'lighthouse', provider: 'lighthouse', url: 'http://gatekeeper:8080/model/lighthouse' });
183
+ expect(JSON.stringify(granted)).not.toContain(CUSTOM_KEY);
184
+ expect(JSON.stringify(granted)).not.toContain(CUSTOM_HEADER);
185
+
186
+ // The window carries the key as a bearer and the header of the provider's own, over what the space sent under its name.
187
+ const through = await shell('curl -s -H "authorization: Bearer space-window" -H "x-team: space-says-admin" http://gatekeeper:8080/model/lighthouse/chat/completions');
188
+ expect(through.code, through.stderr).toBe(0);
189
+ expect(JSON.parse(through.stdout)).toMatchObject({ path: '/v1/chat/completions', authorization: sha256(`Bearer ${CUSTOM_KEY}`), team: sha256(CUSTOM_HEADER), apiKey: 'none' });
190
+
191
+ // Not on the host's disk, not in the containers' metadata, not anywhere the space can look.
192
+ for (const secret of [CUSTOM_KEY, CUSTOM_HEADER]) {
193
+ expect(recordText()).not.toContain(secret);
194
+ expect(await liveHost.spaceMetadata(spaceId)).not.toContain(secret);
195
+ expect(await liveHost.gatekeeperMetadata(spaceId)).not.toContain(secret);
196
+ }
197
+ expect(JSON.parse(recordText()).grants).toContainEqual({ kind: 'custom', id: 'lighthouse', provider: 'lighthouse' });
198
+ const insideTheSpace = await shell(`env; ps auxeww; find /home/space /tmp /spaces/${spaceId} -type f -size -1M -exec cat {} + 2>/dev/null; true`);
199
+ expect(insideTheSpace.stdout.length).toBeGreaterThan(0);
200
+ expect(insideTheSpace.stdout).not.toContain(CUSTOM_KEY);
201
+ expect(insideTheSpace.stdout).not.toContain(CUSTOM_HEADER);
202
+ // What the space does have: the provider as the host defines it, at the window, with the placeholder key.
203
+ const config = JSON.parse((await inside(['cat', spaceOpenCodeConfigPath(spaceId)])).stdout);
204
+ expect(config.providers.lighthouse).toEqual({ name: 'Lighthouse', package: 'aisdk:@ai-sdk/openai-compatible', settings: { baseURL: 'http://gatekeeper:8080/model/lighthouse', apiKey: WINDOW_PLACEHOLDER_KEY }, models: { 'gpt-5.5': { modelID: 'gpt-5.5', name: 'GPT 5.5' } } });
205
+ expect(await listed()).toMatchObject({ access: 'granted', needsAccess: [] });
206
+ }, 120_000);
207
+
164
208
  it('sends a turn of OpenCode inside through the window, where the stand-in sees the real key', async () => {
165
209
  const directory = (await listed()).directory;
166
210
  const created = await prefixed('/session', json({ location: { directory }, title: 'Through the window' }));
@@ -178,6 +222,25 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
178
222
  expect(JSON.stringify(await upstream.seen())).not.toContain(TYPED_KEY);
179
223
  }, 180_000);
180
224
 
225
+ it('sends a turn of OpenCode inside through the window for a provider the project itself defines, over the copy of that definition inside', async () => {
226
+ // Relies on the two cases above: the session of the Anthropic case and the lighthouse grant.
227
+ // The project's own `opencode.json` is in the space with its unreachable address; the entry
228
+ // the host wrote beside the project is the one OpenCode inside reads, and the home directory
229
+ // holds none.
230
+ expect((await inside(['cat', `${(await listed()).directory}/opencode.json`])).stdout).toContain('http://127.0.0.1:9/v1');
231
+ expect((await inside(['test', '-e', LEGACY_SPACE_OPENCODE_CONFIG_PATH])).code).not.toBe(0);
232
+ const directory = (await listed()).directory;
233
+ const headers = { 'content-type': 'application/json', 'x-opencode-directory': encodeURIComponent(directory) };
234
+ const model = await prefixed(`/session/${session.id}/model`, { ...json({ model: { id: 'gpt-5.5', providerID: 'lighthouse' } }), headers });
235
+ expect(model.status, await model.clone().text()).toBeLessThan(300);
236
+ const prompt = await prefixed(`/session/${session.id}/prompt`, { ...json({ id: `msg_${crypto.randomBytes(8).toString('hex')}`, text: 'Say hello through the project provider.' }), headers });
237
+ expect(prompt.status, await prompt.clone().text()).toBeLessThan(300);
238
+ const fromOpenCode = (entry) => entry.method === 'POST' && entry.authorization === sha256(`Bearer ${CUSTOM_KEY}`) && entry.path.startsWith('/v1/chat/completions');
239
+ expect(await until(async () => (await upstream.seen()).some(fromOpenCode), 120_000)).toBe(true);
240
+ expect((await upstream.seen()).find(fromOpenCode)).toMatchObject({ team: sha256(CUSTOM_HEADER) });
241
+ expect(JSON.stringify(await upstream.seen())).not.toContain(CUSTOM_KEY);
242
+ }, 180_000);
243
+
181
244
  it('measures whether OpenCode inside takes a provider granted after its instance started', async () => {
182
245
  // A second provider, from the host's environment this time, granted while the instance of
183
246
  // the space's project is already running. Whether that instance re-reads its configuration
@@ -199,7 +262,8 @@ describe.skipIf(!LIVE_DOCKER_ENABLED)('grants on a real space: docker (live)', (
199
262
  it('says the grants again after a stop and a start: the environment key yes, the typed key no', async () => {
200
263
  await host.journey.stopSpace(spaceId);
201
264
  const started = await host.journey.startSpace(spaceId);
202
- expect(started).toMatchObject({ state: 'running', networkRestored: true, grantsRestored: ['openai'], needsAccess: ['anthropic'] });
265
+ // The custom provider is said again from the project's configuration, key and header read on the host anew.
266
+ expect(started).toMatchObject({ state: 'running', networkRestored: true, grantsRestored: ['lighthouse', 'openai'], needsAccess: ['anthropic'] });
203
267
  expect(await listed()).toMatchObject({ access: 'needs_access', needsAccess: ['anthropic'] });
204
268
  // The environment key works again at once; the typed one is gone with the gatekeeper's memory.
205
269
  const bearer = await shell('curl -s http://gatekeeper:8080/model/openai/responses');
@@ -243,7 +307,7 @@ console.log(JSON.stringify(rows.map((row) => ({ ...row, active: row.active === 1
243
307
  expect(JSON.parse(through.stdout)).toMatchObject({ path: '/v1/responses', authorization: sha256(`Bearer ${LOGIN_TOKEN}`) });
244
308
  // The row inside names the method with placeholder tokens; the key grant's row-less state is gone.
245
309
  expect(await rowsInside()).toEqual([expect.objectContaining({ id: spaceLoginCredentialId('openai'), integrationID: 'openai', active: true, value: expect.objectContaining({ type: 'oauth', methodID: 'chatgpt-token-sharing', access: WINDOW_PLACEHOLDER_KEY, refresh: WINDOW_PLACEHOLDER_KEY, metadata: { clientID: 'client_live', scopes: ['chatgpt.tokens.use.direct'] } }) })]);
246
- const config = JSON.parse((await inside(['cat', SPACE_OPENCODE_CONFIG_PATH])).stdout);
310
+ const config = JSON.parse((await inside(['cat', spaceOpenCodeConfigPath(spaceId)])).stdout);
247
311
  expect(config.provider.openai.options).toEqual({ baseURL: 'http://gatekeeper:8080/model/openai', transport: 'http' });
248
312
  // Not on the host's disk, not in container metadata, not anywhere the space can look.
249
313
  expect(JSON.parse(recordText()).grants.find((grant) => grant.id === 'openai')).toEqual({ kind: 'login', id: 'openai', provider: 'openai', method: 'chatgpt-token-sharing' });
@@ -306,7 +370,7 @@ console.log(JSON.stringify(rows.map((row) => ({ ...row, active: row.active === 1
306
370
  it('takes the row with it when a key replaces the login', async () => {
307
371
  await host.journey.grantAccess(spaceId, { kind: 'model', provider: 'openai', upstream: upstream.url, secret: { kind: 'env', name: 'OPENAI_API_KEY' } });
308
372
  expect(await rowsInside()).toEqual([]);
309
- const config = JSON.parse((await inside(['cat', SPACE_OPENCODE_CONFIG_PATH])).stdout);
373
+ const config = JSON.parse((await inside(['cat', spaceOpenCodeConfigPath(spaceId)])).stdout);
310
374
  expect(config.provider.openai.options).toEqual({ baseURL: 'http://gatekeeper:8080/model/openai', apiKey: WINDOW_PLACEHOLDER_KEY });
311
375
  expect(recordText()).not.toContain(hostLogin.access);
312
376
  // A space that holds a key is not one the keeper has a login to say to.
@@ -347,7 +411,7 @@ console.log(JSON.stringify(rows.map((row) => ({ ...row, active: row.active === 1
347
411
  // The row inside names the method and the window as the address, next to nothing else; the
348
412
  // key the OpenAI provider holds stays in the configuration, and Copilot has no entry there.
349
413
  expect(await rowsInside()).toEqual([expect.objectContaining({ id: spaceLoginCredentialId('github-copilot'), integrationID: 'github-copilot', active: true, value: { type: 'oauth', methodID: 'device', access: WINDOW_PLACEHOLDER_KEY, refresh: WINDOW_PLACEHOLDER_KEY, expires: Date.UTC(2100, 0, 1), metadata: { apiEndpoint: 'http://gatekeeper:8080/model/github-copilot' } } })]);
350
- const config = JSON.parse((await inside(['cat', SPACE_OPENCODE_CONFIG_PATH])).stdout);
414
+ const config = JSON.parse((await inside(['cat', spaceOpenCodeConfigPath(spaceId)])).stdout);
351
415
  expect(config.provider['github-copilot']).toBeUndefined();
352
416
  expect(config.provider.openai.options).toEqual({ baseURL: 'http://gatekeeper:8080/model/openai', apiKey: WINDOW_PLACEHOLDER_KEY });
353
417
  // The token is nowhere the host keeps or the space can look, and the address GitHub gave stays on the host.
@@ -20,6 +20,9 @@ import { sshHostSchema } from './places/ssh-host.js';
20
20
 
21
21
  export const SPACES_ROUTE = '/api/openchamber/spaces';
22
22
 
23
+ // The project a request names in `?directory=`; anything else reads as no project.
24
+ const directoryQuerySchema = z.string().min(1);
25
+
23
26
  // Which HTTP status a refusal of the journey gets. Everything not named here is 502 when it comes
24
27
  // from the place or the space, and 500 when it is not a `SpaceError` at all.
25
28
  const STATUS_BY_CODE = new Map([
@@ -36,6 +39,7 @@ const STATUS_BY_CODE = new Map([
36
39
  ['invalid_request_body', 400],
37
40
  ['invalid_grant_request', 400],
38
41
  ['provider_not_supported', 400],
42
+ ['provider_not_found', 404],
39
43
  ['invalid_domain', 400],
40
44
  ['invalid_idle_stop', 400],
41
45
  ['network_is_open', 409],
@@ -309,6 +313,11 @@ export function registerSpaceRoutes(app, { getJourney, getPlaces = () => [], rea
309
313
  res.json(await journey.readHostLogins());
310
314
  }));
311
315
 
316
+ // The providers the user defined on the host for a project, for the grant dialogs; never a key.
317
+ app.get(`${SPACES_ROUTE}/custom-providers`, withJourney(async (journey, req, res) => {
318
+ res.json(await journey.readHostCustomProviders(directoryQuerySchema.safeParse(req.query?.directory).data ?? null));
319
+ }));
320
+
312
321
  // A grant for a running space; the key in the body goes to the gatekeeper and nowhere else.
313
322
  app.post(`${SPACES_ROUTE}/:id/grants`, withJourney(async (journey, req, res) => {
314
323
  res.json(await journey.grantAccess(spaceIdOf(req), requireBody(req)));
@@ -68,6 +68,7 @@ const journeyOf = (overrides = {}) => {
68
68
  runSetup: record('runSetup', { id: ID, state: 'running', setup: { state: 'running', index: 0, total: 1, command: 'npm ci' } }),
69
69
  readSetup: record('readSetup', { setup: null, output: null }),
70
70
  readHostLogins: record('readHostLogins', { logins: [{ provider: 'openai', method: 'chatgpt-token-sharing', expires: '2026-09-26T11:00:00.000Z', state: 'usable' }] }),
71
+ readHostCustomProviders: record('readHostCustomProviders', { providers: [{ id: 'ollama-local', name: 'Ollama (local)', hasKey: false }] }),
71
72
  readDisk: record('readDisk', { imageBytes: null, toolsBytes: 0, spacesBytes: 0, freeBytes: 0, freesImage: false }),
72
73
  cleanUpDisk: record('cleanUpDisk', { freedBytes: 0, kept: [], disk: null }),
73
74
  pullImage: record('pullImage', { imageBytes: null, imagePulling: true, imageFailure: null, toolsBytes: 0, spacesBytes: 0, freeBytes: 0, freesImage: false }),
@@ -78,7 +79,7 @@ const journeyOf = (overrides = {}) => {
78
79
  describe('space routes', () => {
79
80
  it('answers every journey route with 404 and isolated_spaces_off while the feature is off, and the switch still works', async () => {
80
81
  const { call, calls } = await serve({ journey: null, switchState: { enabled: false } });
81
- for (const [method, path] of [['GET', ''], ['POST', ''], ['GET', '/places'], ['POST', `/${ID}/start`], ['POST', `/${ID}/stop`], ['POST', `/${ID}/restart`], ['POST', `/${ID}/restart-opencode`], ['POST', `/${ID}/grants`], ['GET', '/logins'], ['DELETE', `/${ID}`], ['GET', `/${ID}/journal`], ['GET', `/${ID}/apply`], ['POST', `/${ID}/apply`], ['GET', '/idle-stop'], ['PUT', '/idle-stop'], ['POST', `/${ID}/setup`], ['GET', `/${ID}/setup`], ['GET', '/places/docker/disk'], ['POST', '/places/docker/clean-up'], ['POST', '/places/docker/image']]) {
82
+ for (const [method, path] of [['GET', ''], ['POST', ''], ['GET', '/places'], ['POST', `/${ID}/start`], ['POST', `/${ID}/stop`], ['POST', `/${ID}/restart`], ['POST', `/${ID}/restart-opencode`], ['POST', `/${ID}/grants`], ['GET', '/logins'], ['GET', '/custom-providers'], ['DELETE', `/${ID}`], ['GET', `/${ID}/journal`], ['GET', `/${ID}/apply`], ['POST', `/${ID}/apply`], ['GET', '/idle-stop'], ['PUT', '/idle-stop'], ['POST', `/${ID}/setup`], ['GET', `/${ID}/setup`], ['GET', '/places/docker/disk'], ['POST', '/places/docker/clean-up'], ['POST', '/places/docker/image']]) {
82
83
  expect(await call(method, `${SPACES_ROUTE}${path}`, method === 'GET' || method === 'DELETE' ? undefined : {}), `${method} ${path}`).toEqual({ status: 404, body: { code: 'isolated_spaces_off', message: 'Isolated spaces are turned off.', details: null } });
83
84
  }
84
85
  expect(await call('GET', `${SPACES_ROUTE}/switch`)).toEqual({ status: 200, body: { enabled: false, spaces: [] } });
@@ -130,6 +131,7 @@ describe('space routes', () => {
130
131
  expect(await call('POST', `${SPACES_ROUTE}/${ID}/grants`, { kind: 'domain', upstream: 'https://registry.example.com/' })).toEqual({ status: 200, body: { grant: { id: 'open-1' } } });
131
132
  expect(await call('POST', `${SPACES_ROUTE}/${ID}/network/domains`, { domain: 'registry.npmjs.org' })).toEqual({ status: 200, body: { network: { mode: 'allowlist', domains: ['registry.npmjs.org'] } } });
132
133
  expect(await call('GET', `${SPACES_ROUTE}/logins`)).toEqual({ status: 200, body: { logins: [{ provider: 'openai', method: 'chatgpt-token-sharing', expires: '2026-09-26T11:00:00.000Z', state: 'usable' }] } });
134
+ expect(await call('GET', `${SPACES_ROUTE}/custom-providers?directory=%2Fhome%2Fme%2Fproject`)).toEqual({ status: 200, body: { providers: [{ id: 'ollama-local', name: 'Ollama (local)', hasKey: false }] } });
133
135
  expect(await call('GET', `${SPACES_ROUTE}/${ID}/journal`)).toEqual({ status: 200, body: { records: [], dropped: 0, since: 'now' } });
134
136
  expect(await call('GET', `${SPACES_ROUTE}/${ID}/apply`)).toEqual({ status: 200, body: { changedPaths: 2 } });
135
137
  expect(await call('POST', `${SPACES_ROUTE}/${ID}/apply`, { as: 'branch', branch: 'b' })).toEqual({ status: 200, body: { applied: { status: 'applied' } } });
@@ -137,7 +139,7 @@ describe('space routes', () => {
137
139
  expect(await call('GET', `${SPACES_ROUTE}/${ID}/setup`)).toEqual({ status: 200, body: { setup: null, output: null } });
138
140
  expect(await call('DELETE', `${SPACES_ROUTE}/${ID}`)).toEqual({ status: 200, body: { id: ID, removed: true } });
139
141
  expect(journey.calls).toEqual([
140
- ['listSpaces', { access: true }], ['readDisk', 'docker'], ['cleanUpDisk', 'docker'], ['pullImage', 'docker'], ['createSpace', request], ['startSpace', ID], ['stopSpace', ID], ['restartSpace', ID], ['restartOpenCode', ID], ['grantAccess', ID, { kind: 'domain', upstream: 'https://registry.example.com/' }], ['openDomain', ID, { domain: 'registry.npmjs.org' }], ['readHostLogins'], ['readJournal', ID], ['previewApply', ID], ['applySpace', ID, { as: 'branch', branch: 'b' }], ['runSetup', ID, { commands: ['npm ci'] }], ['readSetup', ID], ['removeSpace', ID, { allowUnsaved: false }],
142
+ ['listSpaces', { access: true }], ['readDisk', 'docker'], ['cleanUpDisk', 'docker'], ['pullImage', 'docker'], ['createSpace', request], ['startSpace', ID], ['stopSpace', ID], ['restartSpace', ID], ['restartOpenCode', ID], ['grantAccess', ID, { kind: 'domain', upstream: 'https://registry.example.com/' }], ['openDomain', ID, { domain: 'registry.npmjs.org' }], ['readHostLogins'], ['readHostCustomProviders', '/home/me/project'], ['readJournal', ID], ['previewApply', ID], ['applySpace', ID, { as: 'branch', branch: 'b' }], ['runSetup', ID, { commands: ['npm ci'] }], ['readSetup', ID], ['removeSpace', ID, { allowUnsaved: false }],
141
143
  ]);
142
144
  });
143
145
 
@@ -15,28 +15,31 @@ import { z } from 'zod';
15
15
 
16
16
  import { SpaceError } from './errors.js';
17
17
  import { tail } from './exec-http.js';
18
- import { IMAGE_ONLY_PATH, IMAGE_SH, SPACE_OPENCODE_CONFIG_DIRECTORY, SPACE_OPENCODE_CONFIG_PATH, spaceWindowUrl } from './layout.js';
18
+ import { IMAGE_ONLY_PATH, IMAGE_SH, LEGACY_SPACE_OPENCODE_CONFIG_PATH, spaceOpenCodeConfigDirectory, spaceOpenCodeConfigPath, spaceWindowUrl } from './layout.js';
19
19
 
20
20
  // OpenCode takes a key from this option and its auth plugins stay out of the way; the window
21
21
  // throws it away and puts the real one in its place. It is not a secret and never was one.
22
22
  export const WINDOW_PLACEHOLDER_KEY = 'space-window';
23
23
 
24
24
  // Through a temporary name, so OpenCode never reads half a file. The configuration is JSON on
25
- // stdin: nothing of it is an argument.
26
- const WRITE_CONFIG_SCRIPT = [
27
- IMAGE_ONLY_PATH,
28
- `mkdir -p ${SPACE_OPENCODE_CONFIG_DIRECTORY}`,
29
- `&& cat > ${SPACE_OPENCODE_CONFIG_PATH}.new && mv ${SPACE_OPENCODE_CONFIG_PATH}.new ${SPACE_OPENCODE_CONFIG_PATH}`,
30
- ].join(' ');
25
+ // stdin: nothing of it is an argument; the path holds the space id, which `spaceWorkPath` checks.
26
+ // The file the host wrote in the home directory before goes after the new one is in place: the
27
+ // host always wrote it whole, so nothing of the agent's is lost that a grant would not have
28
+ // overwritten anyway.
29
+ const writeConfigScriptOf = (spaceId) => {
30
+ const file = spaceOpenCodeConfigPath(spaceId);
31
+ return [IMAGE_ONLY_PATH, `mkdir -p ${spaceOpenCodeConfigDirectory(spaceId)}`, `&& cat > ${file}.new && mv ${file}.new ${file}`, `&& rm -f ${LEGACY_SPACE_OPENCODE_CONFIG_PATH}`].join(' ');
32
+ };
31
33
 
32
34
  /**
33
- * OpenCode's global configuration for a space with these model grants: each provider, under the
35
+ * OpenCode's configuration for a space with these model grants: each provider, under the
34
36
  * id the host's catalog gives it, with its base URL at the window and a placeholder key. The
35
37
  * composer offers the host's catalog, and the same provider id inside is what makes that choice
36
38
  * work in the space unchanged. Decided with the maintainer on 2026-09-26.
37
39
  */
38
- export function buildProviderConfig(grants) {
40
+ export function buildProviderConfig(grants, customProviders = new Map()) {
39
41
  const provider = {};
42
+ const providers = {};
40
43
  for (const grant of grants) {
41
44
  if (grant.kind === 'model') provider[grant.provider] = { options: { baseURL: spaceWindowUrl(grant.id), apiKey: WINDOW_PLACEHOLDER_KEY } };
42
45
  // A login takes its token from the row below, so no placeholder key. Copilot's plugin reads
@@ -45,8 +48,19 @@ export function buildProviderConfig(grants) {
45
48
  const options = loginMethodOf(grant.provider, grant.method)?.options(spaceWindowUrl(grant.id));
46
49
  if (options) provider[grant.provider] = { options };
47
50
  }
51
+ // A custom provider is unknown to the catalog inside, so its entry carries what the host's
52
+ // does: the SDK, the name and the models, in OpenCode 2's own spelling, which is what the
53
+ // host's Settings write. The catalog providers above keep the spelling measured on 2.0.25;
54
+ // OpenCode reads both in one file. A definition the host could not read now is left out,
55
+ // and the start that finds it again writes it.
56
+ if (grant.kind === 'custom') {
57
+ const definition = customProviders.get(grant.provider);
58
+ if (definition) providers[grant.provider] = { name: definition.name, package: definition.package, settings: { baseURL: spaceWindowUrl(grant.id), apiKey: WINDOW_PLACEHOLDER_KEY }, models: definition.models };
59
+ }
48
60
  }
49
- return { $schema: 'https://opencode.ai/config.json', provider };
61
+ const config = { $schema: 'https://opencode.ai/config.json', provider };
62
+ if (Object.keys(providers).length > 0) config.providers = providers;
63
+ return config;
50
64
  }
51
65
 
52
66
  const CODEX_API = 'https://chatgpt.com/backend-api/codex';
@@ -260,10 +274,13 @@ export function archivedChatOf({ info, messages }, { directory, archivedAt, keep
260
274
  * `chatMaxBytes` and `chatTimeoutMs` the caps on one chat, smaller in the tests.
261
275
  */
262
276
  export function createSpaceOpenCode({ exec, requestInside, chatMaxBytes = CHAT_EXPORT_MAX_BYTES, chatTimeoutMs = CHAT_EXPORT_TIMEOUT_MS }) {
263
- /** Writes the whole global configuration from the model grants the record holds. */
264
- const writeProviderConfig = async (spaceId, grants) => {
265
- const text = `${JSON.stringify(buildProviderConfig(grants), null, 2)}\n`;
266
- const result = await exec(spaceId, [IMAGE_SH, '-c', WRITE_CONFIG_SCRIPT], { stdin: text });
277
+ /**
278
+ * Writes the whole configuration beside the project from the model grants the record holds;
279
+ * `customProviders` holds the host's definition of each custom provider among them, by id.
280
+ */
281
+ const writeProviderConfig = async (spaceId, grants, customProviders = new Map()) => {
282
+ const text = `${JSON.stringify(buildProviderConfig(grants, customProviders), null, 2)}\n`;
283
+ const result = await exec(spaceId, [IMAGE_SH, '-c', writeConfigScriptOf(spaceId)], { stdin: text });
267
284
  if (result.code !== 0) {
268
285
  throw new SpaceError('space_setup_failed', `Could not write the provider configuration inside the space: ${tail(result.stderr) || `exit code ${result.code}`}`);
269
286
  }
@@ -27,13 +27,13 @@ describe('the provider configuration inside a space', () => {
27
27
  expect(JSON.stringify(buildProviderConfig(GRANTS))).not.toContain('api.anthropic.com');
28
28
  });
29
29
 
30
- it('writes the whole file over exec, as JSON on stdin, through a temporary name', async () => {
30
+ it('writes the whole file over exec, as JSON on stdin, through a temporary name, beside the project and not in the home directory', async () => {
31
31
  const calls = [];
32
32
  const opencode = createSpaceOpenCode({ exec: async (spaceId, argv, options) => { calls.push({ spaceId, argv, options }); return { code: 0, stdout: '', stderr: '' }; } });
33
33
  await opencode.writeProviderConfig(ID, GRANTS);
34
34
  expect(calls).toEqual([{
35
35
  spaceId: ID,
36
- argv: ['/bin/sh', '-c', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; mkdir -p /home/space/.config/opencode && cat > /home/space/.config/opencode/opencode.json.new && mv /home/space/.config/opencode/opencode.json.new /home/space/.config/opencode/opencode.json'],
36
+ argv: ['/bin/sh', '-c', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; mkdir -p /spaces/a1b2c3d4e5f6/.opencode && cat > /spaces/a1b2c3d4e5f6/.opencode/opencode.json.new && mv /spaces/a1b2c3d4e5f6/.opencode/opencode.json.new /spaces/a1b2c3d4e5f6/.opencode/opencode.json && rm -f /home/space/.config/opencode/opencode.json'],
37
37
  options: { stdin: `${JSON.stringify(buildProviderConfig(GRANTS), null, 2)}\n` },
38
38
  }]);
39
39
  });
@@ -43,6 +43,19 @@ describe('the provider configuration inside a space', () => {
43
43
  await expect(opencode.writeProviderConfig(ID, GRANTS)).rejects.toMatchObject({ code: 'space_setup_failed', message: expect.stringContaining('Read-only file system') });
44
44
  });
45
45
 
46
+ it('writes a custom provider as the host defines it, at the window, and leaves one the host cannot say now out', () => {
47
+ const ollama = { kind: 'custom', id: 'ollama-local', provider: 'ollama-local' };
48
+ const definitions = new Map([['ollama-local', { name: 'Ollama (local)', package: 'aisdk:@ai-sdk/openai-compatible', baseURL: 'http://localhost:11434/v1', headers: {}, models: { 'qwen3:8b': { modelID: 'qwen3:8b', name: 'Qwen3 8B' } }, key: null }]]);
49
+ expect(buildProviderConfig([GRANTS[0], ollama], definitions)).toEqual({
50
+ $schema: 'https://opencode.ai/config.json',
51
+ provider: { anthropic: { options: { baseURL: 'http://gatekeeper:8080/model/anthropic', apiKey: WINDOW_PLACEHOLDER_KEY } } },
52
+ providers: { 'ollama-local': { name: 'Ollama (local)', package: 'aisdk:@ai-sdk/openai-compatible', settings: { baseURL: 'http://gatekeeper:8080/model/ollama-local', apiKey: WINDOW_PLACEHOLDER_KEY }, models: { 'qwen3:8b': { modelID: 'qwen3:8b', name: 'Qwen3 8B' } } } },
53
+ });
54
+ // The host's address stays on the host; the space sees the window and nothing behind it.
55
+ expect(JSON.stringify(buildProviderConfig([ollama], definitions))).not.toContain('11434');
56
+ expect(buildProviderConfig([ollama])).toEqual({ $schema: 'https://opencode.ai/config.json', provider: {} });
57
+ });
58
+
46
59
  it('points a provider with a login grant at the window over HTTP, with no placeholder key', () => {
47
60
  expect(buildProviderConfig([{ kind: 'login', id: 'openai', provider: 'openai', method: 'chatgpt-browser' }]).provider).toEqual({
48
61
  openai: { options: { baseURL: 'http://gatekeeper:8080/model/openai', transport: 'http' } },
@@ -74,6 +74,14 @@ export const grantSchema = z.discriminatedUnion('kind', [
74
74
  provider: z.string().regex(GRANT_ID_PATTERN),
75
75
  method: z.string().regex(/^[a-z0-9-]{1,64}$/),
76
76
  }).strict(),
77
+ // A provider the user defined in the host's OpenCode configuration, "custom" in Settings: its
78
+ // address, its key and its models are read from the host again at every start, so the record
79
+ // names only the provider.
80
+ z.object({
81
+ kind: z.literal('custom'),
82
+ id: z.string().regex(GRANT_ID_PATTERN),
83
+ provider: z.string().regex(GRANT_ID_PATTERN),
84
+ }).strict(),
77
85
  ]);
78
86
  const MAX_GRANTS = 100;
79
87
 
@@ -60,15 +60,19 @@ describe('space records', () => {
60
60
  const typed = { ...model, id: 'openai', provider: 'openai', upstream: 'https://api.openai.com/v1', header: 'authorization', source: { kind: 'typed' } };
61
61
  const domain = { kind: 'domain', id: 'open-0a1b2c3d4e5f', upstream: 'https://registry.example.com/npm/' };
62
62
  const login = { kind: 'login', id: 'openai', provider: 'openai', method: 'chatgpt-token-sharing' };
63
- const written = records.write(ID, { network: { mode: 'open' }, grants: [model, typed, domain, login] });
64
- expect(written.grants).toEqual([model, typed, domain, login]);
65
- expect(records.read(ID).record.grants).toEqual([model, typed, domain, login]);
63
+ const custom = { kind: 'custom', id: 'ollama-local', provider: 'ollama-local' };
64
+ const written = records.write(ID, { network: { mode: 'open' }, grants: [model, typed, domain, login, custom] });
65
+ expect(written.grants).toEqual([model, typed, domain, login, custom]);
66
+ expect(records.read(ID).record.grants).toEqual([model, typed, domain, login, custom]);
66
67
 
67
68
  for (const bad of [
68
69
  { ...model, secret: 'sk-live-1' },
69
70
  { ...login, access: 'eyJ-live' },
70
71
  { ...login, upstream: 'https://api.openai.com/v1' },
71
72
  { ...login, method: 'not a method' },
73
+ // A custom provider's address and key live on the host, never in the record.
74
+ { ...custom, upstream: 'http://localhost:11434/v1' },
75
+ { ...custom, secret: 'sk-live-1' },
72
76
  { ...model, value: 'sk-live-1' },
73
77
  { ...model, source: { kind: 'typed', value: 'sk-live-1' } },
74
78
  { ...model, source: { kind: 'env', name: 'ANTHROPIC_API_KEY', value: 'sk-live-1' } },