@xopcai/xopc 0.0.162 → 0.0.164

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 (262) hide show
  1. package/README.md +4 -2
  2. package/README.zh-CN.md +4 -2
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-hpcNv9MZ.js → activity-store-DkALQFJT.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Zf9UQEmQ.js → agent-avatar-dicebear-RpxkQtQ3.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-CxpwxMPE.js +2 -0
  8. package/dist/gateway/static/root/assets/{api-Dnatri09.js → api-DPIXEcIq.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-BBTR9wJP.js → app-management-settings-panel-DLdjfMXB.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-C2zpLCHD.js → appearance-settings-C89-uxkq.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-k-tZbaRB.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-9eR_ODY1.js → archive-plugin-CqbH5geE.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-DPuWYUeX.js → attachment-load-CeU4Qiot.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automation-suggestion-card-Dw49OJRl.js → automation-suggestion-card-WiOuqXq9.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-page-Bdn3dgC_.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-BdkJpDFm.js → binary-plugins-C5TdzrhJ.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-CAi7SXYU.js → block-editor-BjvWhphG.js} +39 -39
  18. package/dist/gateway/static/root/assets/browser-settings-page-GsVTGfGs.js +8 -0
  19. package/dist/gateway/static/root/assets/{browser-workflow-inputs-Dx6wkGz1.js → browser-workflow-inputs-DXmzQ3nk.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-workflows-page-Skertc-A.js → browser-workflows-page-C1-ptRe4.js} +2 -2
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-6d4kVjzl.js +2 -0
  22. package/dist/gateway/static/root/assets/{capability-presets-api-CNFl7dM3.js → capability-presets-api-C0pVlUyc.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DCxy5Ls_.js +2 -0
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-DYQyGDw4.js → channel-recipient-api-B5rLegwk.js} +1 -1
  25. package/dist/gateway/static/root/assets/channels-settings-Bg3P8k0f.js +1 -0
  26. package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +1 -0
  27. package/dist/gateway/static/root/assets/{connector-logo-Bng6kxYF.js → connector-logo-CuI5w4qM.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-6UR7yhIZ.js +2 -0
  29. package/dist/gateway/static/root/assets/{desktop-pet-Bpf6oegd.js → desktop-pet-BvG8vDXZ.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-BVUyefSd.js → desktop-pet-settings-CR__kZ8C.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-DjSZAPz_.js → directory-picker-path-field-BblWMz3e.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dreaming-settings-CAZk2AM4.js → dreaming-settings-DHMPugDE.js} +3 -3
  33. package/dist/gateway/static/root/assets/{extension-debug-page-C2F6vTTd.js → extension-debug-page-ByVY1gZg.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-AnIt4bn4.js → extension-page-DLCKKtbK.js} +1 -1
  35. package/dist/gateway/static/root/assets/extension-settings-page-M-rhlFBC.js +1 -0
  36. package/dist/gateway/static/root/assets/{gateway-config-api-DLFyZv33.js → gateway-config-api-DZHqhbXH.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-DnQAA-qq.js → gateway-settings-CZswIehx.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-DbzLyJ3R.js → gateway-startup-retry-ulwTJovP.js} +1 -1
  39. package/dist/gateway/static/root/assets/goal-create-dialog-TbyRfDas.js +1 -0
  40. package/dist/gateway/static/root/assets/goal-detail-page-B-QBVOf2.js +4 -0
  41. package/dist/gateway/static/root/assets/{goals-config-api-REmr3QCr.js → goals-config-api-DMxG6f0N.js} +1 -1
  42. package/dist/gateway/static/root/assets/goals-page-BGxki8BR.js +2 -0
  43. package/dist/gateway/static/root/assets/{goals-settings-Dz0F3uRO.js → goals-settings-G-w1gCYD.js} +1 -1
  44. package/dist/gateway/static/root/assets/{heartbeat-settings-CQFY5gYs.js → heartbeat-settings-Csb90R59.js} +1 -1
  45. package/dist/gateway/static/root/assets/index-BXtJvaQl.css +1 -0
  46. package/dist/gateway/static/root/assets/{index-C8JkTS6d.js → index-CGwuxvzr.js} +70 -70
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BnOQXU5k.js → keyboard-shortcuts-settings-C_Bl3YOr.js} +1 -1
  48. package/dist/gateway/static/root/assets/local-app-workbench-page-BR2tBhO3.js +2 -0
  49. package/dist/gateway/static/root/assets/{local-apps-page-KsOtWOyM.js → local-apps-page-_8Rv-tSk.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-0lpYdNDr.js → locale-store-C_ax27uc.js} +1 -1
  51. package/dist/gateway/static/root/assets/logs-page-CwF0C_Z2.js +7 -0
  52. package/dist/gateway/static/root/assets/{markdown-split-D5GRg10r.js → markdown-split-CZnZS6gq.js} +1 -1
  53. package/dist/gateway/static/root/assets/{media-plugins-C1ryULGs.js → media-plugins-C2XLYC6G.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-C96Zjb0V.js +5 -0
  55. package/dist/gateway/static/root/assets/{notes-page-CIeZ1_DT.js → notes-page-BkuZxTFo.js} +1 -1
  56. package/dist/gateway/static/root/assets/notes-workbench-CD4FADi7.js +4 -0
  57. package/dist/gateway/static/root/assets/{page-tabs-Caj1-E_X.js → page-tabs-DR2FGC4E.js} +1 -1
  58. package/dist/gateway/static/root/assets/{preview-open-alternatives-DKwEce-9.js → preview-open-alternatives-B65O8wBL.js} +1 -1
  59. package/dist/gateway/static/root/assets/{product-open-page-B90ZskkN.js → product-open-page-Cag-utLH.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-COKtUblD.js +1 -0
  61. package/dist/gateway/static/root/assets/projects-page-QYmqanBN.js +1 -0
  62. package/dist/gateway/static/root/assets/remote-access-hub-BU_gBU0f.js +1 -0
  63. package/dist/gateway/static/root/assets/{save-bar-controls-BDYt53uQ.js → save-bar-controls-DCWpFnPc.js} +1 -1
  64. package/dist/gateway/static/root/assets/schedule-field-ClacZdvE.js +1 -0
  65. package/dist/gateway/static/root/assets/{schema-form-D7oCARF7.js → schema-form-BVlbEipU.js} +1 -1
  66. package/dist/gateway/static/root/assets/sessions-page-u-Pjbzfm.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-1Yck1PKq.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-form-section-CARTHCxH.js → settings-form-section-GSNlQWSW.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DEwYqESe.js → settings-loading-skeleton-08Ae5sB_.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-B6vVdHeQ.js → settings-page-BseJD4I-.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-page-layout-D3srt5Bi.js → settings-page-layout-bSliH-Y3.js} +1 -1
  72. package/dist/gateway/static/root/assets/setup-status-panel-CGRhJVlt.js +1 -0
  73. package/dist/gateway/static/root/assets/{share-preview-page-Ck9SxiXw.js → share-preview-page-C114OpTx.js} +1 -1
  74. package/dist/gateway/static/root/assets/shares-settings-BRFpWFgI.js +1 -0
  75. package/dist/gateway/static/root/assets/skill-reload-api-cVjU2GnN.js +1 -0
  76. package/dist/gateway/static/root/assets/skills-page-CoMTjtRT.js +2 -0
  77. package/dist/gateway/static/root/assets/{system-settings-panel-DLBUQSk2.js → system-settings-panel-El8cDcTY.js} +1 -1
  78. package/dist/gateway/static/root/assets/{theme-store-C1oaqeD2.js → theme-store-D37XLD_C.js} +1 -1
  79. package/dist/gateway/static/root/assets/time-picker-CU7hhD8T.js +1 -0
  80. package/dist/gateway/static/root/assets/{typed-models-lib-Divbg_C4.js → typed-models-lib-kToxD7Rc.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-channel-catalog-CP9a_rAf.js → use-channel-catalog-DBh0dOC9.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-context-page-C0xYCSXB.js +1 -0
  83. package/dist/gateway/static/root/assets/voice-api-key-field-DzEpwYaU.js +1 -0
  84. package/dist/gateway/static/root/assets/work-discovery-page-DakZqR85.js +1 -0
  85. package/dist/gateway/static/root/assets/work-item-detail-page-CswqPbTT.js +1 -0
  86. package/dist/gateway/static/root/assets/work-page-DYRXEk8m.js +1 -0
  87. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DbDPYQwB.js → workflow-run-setup-panel-BwSxyVMM.js} +2 -2
  88. package/dist/gateway/static/root/assets/workflows-page-CiLSYGuN.js +11 -0
  89. package/dist/gateway/static/root/index.html +7 -7
  90. package/dist/package.js +1 -1
  91. package/dist/src/agent/client-error-format.d.ts +1 -1
  92. package/dist/src/agent/client-error-format.js +6 -2
  93. package/dist/src/agent/embedded/model-runtime.d.ts +4 -0
  94. package/dist/src/agent/embedded/model-runtime.js +49 -0
  95. package/dist/src/agent/embedded/run-for-session.js +38 -31
  96. package/dist/src/agent/embedded/session-runner.d.ts +1 -0
  97. package/dist/src/agent/embedded/session-runner.js +13 -5
  98. package/dist/src/agent/failover-error.d.ts +1 -1
  99. package/dist/src/agent/image/generation/openai-compatible-image-provider.d.ts +2 -6
  100. package/dist/src/agent/image/generation/openai-compatible-image-provider.js +1 -3
  101. package/dist/src/agent/image/generation/provider-registry.d.ts +5 -46
  102. package/dist/src/agent/image/generation/provider-registry.js +24 -73
  103. package/dist/{extensions/dashscope/src/image-generation-provider.d.ts → src/agent/image/generation/providers/dashscope.d.ts} +3 -6
  104. package/dist/{extensions/dashscope/src/image-generation-provider.js → src/agent/image/generation/providers/dashscope.js} +36 -59
  105. package/dist/{extensions/fal/src/image-generation-provider.d.ts → src/agent/image/generation/providers/fal.d.ts} +1 -1
  106. package/dist/{extensions/fal/src/image-generation-provider.js → src/agent/image/generation/providers/fal.js} +19 -29
  107. package/dist/{extensions/google/src/image-generation-provider.d.ts → src/agent/image/generation/providers/google.d.ts} +2 -2
  108. package/dist/{extensions/google/src/image-generation-provider.js → src/agent/image/generation/providers/google.js} +23 -30
  109. package/dist/{extensions/minimax/src/image-generation-provider.d.ts → src/agent/image/generation/providers/minimax.d.ts} +2 -5
  110. package/dist/{extensions/minimax/src/image-generation-provider.js → src/agent/image/generation/providers/minimax.js} +35 -51
  111. package/dist/{extensions/openai/src/image-generation-provider.d.ts → src/agent/image/generation/providers/openai.d.ts} +2 -2
  112. package/dist/{extensions/openai/src/image-generation-provider.js → src/agent/image/generation/providers/openai.js} +13 -38
  113. package/dist/src/agent/image/generation/runtime-types.d.ts +1 -0
  114. package/dist/src/agent/image/generation/runtime.d.ts +1 -3
  115. package/dist/src/agent/image/generation/runtime.js +6 -6
  116. package/dist/src/agent/image/generation/types.d.ts +23 -3
  117. package/dist/src/agent/image/index.d.ts +1 -1
  118. package/dist/src/agent/image/index.js +2 -2
  119. package/dist/src/agent/media-generation/runtime-shared.d.ts +2 -0
  120. package/dist/src/agent/media-generation/runtime-shared.js +1 -0
  121. package/dist/src/agent/tools/factory.js +4 -1
  122. package/dist/src/agent/tools/image-generate-tool.d.ts +2 -0
  123. package/dist/src/agent/tools/image-generate-tool.js +14 -7
  124. package/dist/src/auth/credentials.js +45 -2
  125. package/dist/src/auth/index.js +2 -1
  126. package/dist/src/auth/oauth/anthropic.js +27 -24
  127. package/dist/src/auth/oauth/github-copilot.js +20 -15
  128. package/dist/src/auth/oauth/google-antigravity.js +9 -2
  129. package/dist/src/auth/oauth/google-gemini-cli.js +9 -2
  130. package/dist/src/auth/oauth/google-oauth/google-antigravity.js +47 -40
  131. package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js +48 -41
  132. package/dist/src/auth/oauth/google-oauth/oauth-page.js +7 -2
  133. package/dist/src/auth/oauth/google-oauth/pkce.js +4 -1
  134. package/dist/src/auth/oauth/index.d.ts +2 -0
  135. package/dist/src/auth/oauth/index.js +24 -10
  136. package/dist/src/auth/oauth/kimi-coding.js +76 -71
  137. package/dist/src/auth/oauth/minimax-cn.js +78 -73
  138. package/dist/src/auth/oauth/minimax.js +78 -73
  139. package/dist/src/auth/oauth/openai-codex.js +31 -25
  140. package/dist/src/auth/oauth/pkce.js +4 -1
  141. package/dist/src/auth/oauth/registry.d.ts +13 -0
  142. package/dist/src/auth/oauth/registry.js +65 -0
  143. package/dist/src/auth/oauth/xopc-cloud.d.ts +2 -0
  144. package/dist/src/auth/oauth/xopc-cloud.js +101 -0
  145. package/dist/src/auth/sync-provider-auth.d.ts +3 -0
  146. package/dist/src/auth/sync-provider-auth.js +17 -1
  147. package/dist/src/cli/commands/models.js +2 -5
  148. package/dist/src/cli/commands/onboard/model.js +3 -2
  149. package/dist/src/cli/commands/setup-shared/types.d.ts +1 -1
  150. package/dist/src/cli/utils/oauth-providers.d.ts +3 -26
  151. package/dist/src/cli/utils/oauth-providers.js +6 -80
  152. package/dist/src/config/index.js +2 -2
  153. package/dist/src/config/models-json.d.ts +6 -0
  154. package/dist/src/config/models-json.js +10 -6
  155. package/dist/src/config/schema.d.ts +26 -15
  156. package/dist/src/config/schema.js +23 -12
  157. package/dist/src/gateway/heartbeat/service.js +1 -1
  158. package/dist/src/gateway/hono/app.js +12 -6
  159. package/dist/src/gateway/hono/lib/safe-providers-config.d.ts +0 -3
  160. package/dist/src/gateway/hono/lib/safe-providers-config.js +1 -3
  161. package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
  162. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
  163. package/dist/src/gateway/hono/oauth-async.js +3 -19
  164. package/dist/src/gateway/hono/oauth.js +3 -19
  165. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -11
  166. package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
  167. package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -2
  168. package/dist/src/gateway/hono/routes/models.js +96 -128
  169. package/dist/src/gateway/image-generation-setup.d.ts +40 -0
  170. package/dist/src/gateway/image-generation-setup.js +130 -0
  171. package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
  172. package/dist/src/gateway/rate-limit/buckets.js +12 -0
  173. package/dist/src/gateway/service.d.ts +3 -0
  174. package/dist/src/gateway/service.js +10 -0
  175. package/dist/src/heartbeat/index.js +1 -1
  176. package/dist/src/media-shared/http/private-network.d.ts +1 -1
  177. package/dist/src/media-shared/http/private-network.js +1 -1
  178. package/dist/src/providers/auth-runtime/resolve-api-key.d.ts +2 -4
  179. package/dist/src/providers/auth-runtime/resolve-api-key.js +2 -4
  180. package/dist/src/providers/auth-runtime/resolve-auth.d.ts +3 -4
  181. package/dist/src/providers/auth-runtime/resolve-auth.js +18 -18
  182. package/dist/src/providers/domestic-presets.d.ts +2 -0
  183. package/dist/src/providers/index.js +9 -0
  184. package/dist/src/providers/model-catalog-store.d.ts +33 -0
  185. package/dist/src/providers/model-catalog-store.js +63 -0
  186. package/dist/src/providers/model-catalog-sync-service.d.ts +40 -0
  187. package/dist/src/providers/model-catalog-sync-service.js +132 -0
  188. package/dist/src/providers/model-reference-auditor.d.ts +14 -0
  189. package/dist/src/providers/model-reference-auditor.js +71 -0
  190. package/dist/src/providers/model-registry.d.ts +4 -1
  191. package/dist/src/providers/model-registry.js +33 -2
  192. package/dist/src/providers/presentation.js +2 -0
  193. package/dist/src/providers/xopc-cloud-model-source.d.ts +30 -0
  194. package/dist/src/providers/xopc-cloud-model-source.js +68 -0
  195. package/dist/src/session/index.d.ts +1 -1
  196. package/dist/src/session/index.js +2 -2
  197. package/dist/src/session/session-title.d.ts +2 -0
  198. package/dist/src/session/session-title.js +24 -3
  199. package/dist/src/work-discovery/analyzer.js +27 -14
  200. package/package.json +5 -7
  201. package/dist/extensions/dashscope/src/index.d.ts +0 -4
  202. package/dist/extensions/dashscope/src/index.js +0 -2
  203. package/dist/extensions/dashscope/xopc.extension.json +0 -15
  204. package/dist/extensions/fal/src/index.d.ts +0 -4
  205. package/dist/extensions/fal/src/index.js +0 -2
  206. package/dist/extensions/fal/xopc.extension.json +0 -14
  207. package/dist/extensions/google/src/index.d.ts +0 -4
  208. package/dist/extensions/google/src/index.js +0 -2
  209. package/dist/extensions/google/xopc.extension.json +0 -14
  210. package/dist/extensions/minimax/src/index.d.ts +0 -4
  211. package/dist/extensions/minimax/src/index.js +0 -2
  212. package/dist/extensions/minimax/xopc.extension.json +0 -15
  213. package/dist/extensions/openai/src/index.d.ts +0 -4
  214. package/dist/extensions/openai/src/index.js +0 -2
  215. package/dist/extensions/openai/xopc.extension.json +0 -14
  216. package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +0 -2
  217. package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +0 -1
  218. package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +0 -6
  219. package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +0 -8
  220. package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +0 -2
  221. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +0 -2
  222. package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +0 -1
  223. package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +0 -1
  224. package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +0 -2
  225. package/dist/gateway/static/root/assets/extension-settings-page-CLSc6682.js +0 -1
  226. package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +0 -1
  227. package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +0 -4
  228. package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +0 -2
  229. package/dist/gateway/static/root/assets/index-hmrG55qg.css +0 -1
  230. package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +0 -2
  231. package/dist/gateway/static/root/assets/logs-page-CwLPgrWh.js +0 -7
  232. package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +0 -5
  233. package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +0 -4
  234. package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +0 -1
  235. package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +0 -1
  236. package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +0 -1
  237. package/dist/gateway/static/root/assets/schedule-field-Bcdni4Pj.js +0 -1
  238. package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +0 -1
  239. package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +0 -1
  240. package/dist/gateway/static/root/assets/settings-collapsible-section-6eNF8Jey.js +0 -1
  241. package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +0 -1
  242. package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +0 -1
  243. package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +0 -1
  244. package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +0 -2
  245. package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +0 -1
  246. package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +0 -1
  247. package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +0 -1
  248. package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +0 -1
  249. package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +0 -1
  250. package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +0 -11
  251. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +0 -19
  252. package/dist/src/agent/embedded/xopc-auth-storage.js +0 -40
  253. package/dist/src/agent/image/generation/bundled-registry.d.ts +0 -18
  254. package/dist/src/agent/image/generation/bundled-registry.js +0 -35
  255. package/dist/src/agent/image/generation/bundled.d.ts +0 -10
  256. package/dist/src/agent/image/generation/bundled.js +0 -15
  257. package/dist/src/agent/image/generation/image-provider-ui.d.ts +0 -20
  258. package/dist/src/agent/image/generation/image-provider-ui.js +0 -1
  259. package/dist/src/gateway/image-capabilities.d.ts +0 -28
  260. package/dist/src/gateway/image-capabilities.js +0 -78
  261. package/dist/src/generated/bundled-image-generation-providers.d.ts +0 -14
  262. package/dist/src/generated/bundled-image-generation-providers.js +0 -17
@@ -1,4 +1,5 @@
1
- import { generatePKCE } from "./pkce.js";
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { generatePKCE, init_pkce } from "./pkce.js";
2
3
  import { randomBytes } from "node:crypto";
3
4
  import http from "node:http";
4
5
  //#region src/auth/oauth/openai-codex.ts
@@ -7,15 +8,6 @@ import http from "node:http";
7
8
  *
8
9
  * Owns callback validation, manual prompt handling, and success/error pages.
9
10
  */
10
- const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
11
- const AUTHORIZE_URL = "https://auth.openai.com/oauth/authorize";
12
- const TOKEN_URL = "https://auth.openai.com/oauth/token";
13
- const CALLBACK_PORT = 1455;
14
- const CALLBACK_PATH = "/auth/callback";
15
- const REDIRECT_URI = `http://localhost:${CALLBACK_PORT}${CALLBACK_PATH}`;
16
- const SCOPE = "openid profile email offline_access";
17
- const MANUAL_PROMPT_DELAY_MS = 15e3;
18
- const TOKEN_REQUEST_TIMEOUT_MS = 3e4;
19
11
  function xopcOAuthHtml(params) {
20
12
  const color = params.tone === "success" ? "#2563eb" : "#dc2626";
21
13
  const escapedTitle = escapeHtml(params.title);
@@ -299,19 +291,33 @@ async function loginOpenAICodex(callbacks) {
299
291
  async function refreshOpenAICodexToken(refreshToken) {
300
292
  return refreshAccessToken(refreshToken);
301
293
  }
302
- const openaiCodexOAuthProvider = {
303
- id: "openai-codex",
304
- name: "OpenAI Codex",
305
- usesCallbackServer: true,
306
- async login(callbacks) {
307
- return loginOpenAICodex(callbacks);
308
- },
309
- async refreshToken(credentials) {
310
- return refreshOpenAICodexToken(credentials.refresh);
311
- },
312
- getApiKey(credentials) {
313
- return credentials.access;
314
- }
315
- };
294
+ var CLIENT_ID, AUTHORIZE_URL, TOKEN_URL, CALLBACK_PORT, CALLBACK_PATH, REDIRECT_URI, SCOPE, MANUAL_PROMPT_DELAY_MS, TOKEN_REQUEST_TIMEOUT_MS, openaiCodexOAuthProvider;
295
+ var init_openai_codex = __esmMin((() => {
296
+ init_pkce();
297
+ CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
298
+ AUTHORIZE_URL = "https://auth.openai.com/oauth/authorize";
299
+ TOKEN_URL = "https://auth.openai.com/oauth/token";
300
+ CALLBACK_PORT = 1455;
301
+ CALLBACK_PATH = "/auth/callback";
302
+ REDIRECT_URI = `http://localhost:${CALLBACK_PORT}${CALLBACK_PATH}`;
303
+ SCOPE = "openid profile email offline_access";
304
+ MANUAL_PROMPT_DELAY_MS = 15e3;
305
+ TOKEN_REQUEST_TIMEOUT_MS = 3e4;
306
+ openaiCodexOAuthProvider = {
307
+ id: "openai-codex",
308
+ name: "OpenAI Codex",
309
+ usesCallbackServer: true,
310
+ async login(callbacks) {
311
+ return loginOpenAICodex(callbacks);
312
+ },
313
+ async refreshToken(credentials) {
314
+ return refreshOpenAICodexToken(credentials.refresh);
315
+ },
316
+ getApiKey(credentials) {
317
+ return credentials.access;
318
+ }
319
+ };
320
+ }));
316
321
  //#endregion
317
- export { loginOpenAICodex, openaiCodexOAuthProvider, refreshOpenAICodexToken };
322
+ init_openai_codex();
323
+ export { init_openai_codex, loginOpenAICodex, openaiCodexOAuthProvider, refreshOpenAICodexToken };
@@ -1,3 +1,4 @@
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
1
2
  //#region src/auth/oauth/pkce.ts
2
3
  /**
3
4
  * PKCE utilities using Web Crypto API.
@@ -19,5 +20,7 @@ async function generatePKCE() {
19
20
  challenge: base64urlEncode(new Uint8Array(hashBuffer))
20
21
  };
21
22
  }
23
+ var init_pkce = __esmMin((() => {}));
22
24
  //#endregion
23
- export { generatePKCE };
25
+ init_pkce();
26
+ export { generatePKCE, init_pkce };
@@ -0,0 +1,13 @@
1
+ import type { OAuthProviderInterface } from './types.js';
2
+ export interface OAuthProviderDefinition {
3
+ displayName: string;
4
+ oauthOnly?: boolean;
5
+ provider: OAuthProviderInterface;
6
+ profileId: string;
7
+ urlPrompt: string;
8
+ }
9
+ export declare const OAUTH_PROVIDER_DEFINITIONS: Readonly<Record<string, OAuthProviderDefinition>>;
10
+ export declare function getOAuthProviderDefinition(provider: string): OAuthProviderDefinition | undefined;
11
+ export declare function getOAuthProviderInterfaces(): Record<string, OAuthProviderInterface>;
12
+ export declare function getOAuthProviderIds(): string[];
13
+ export declare function isOAuthOnlyProvider(provider: string): boolean;
@@ -0,0 +1,65 @@
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { anthropicOAuthProvider, init_anthropic } from "./anthropic.js";
3
+ import { githubCopilotOAuthProvider, init_github_copilot } from "./github-copilot.js";
4
+ import { antigravityOAuthProvider } from "./google-oauth/google-antigravity.js";
5
+ import { init_google_antigravity } from "./google-antigravity.js";
6
+ import { geminiCliOAuthProvider } from "./google-oauth/google-gemini-cli.js";
7
+ import { init_google_gemini_cli } from "./google-gemini-cli.js";
8
+ import { init_kimi_coding, kimiCodingOAuthProvider } from "./kimi-coding.js";
9
+ import { init_minimax_cn, minimaxCnOAuthProvider } from "./minimax-cn.js";
10
+ import { init_minimax, minimaxOAuthProvider } from "./minimax.js";
11
+ import { init_openai_codex, openaiCodexOAuthProvider } from "./openai-codex.js";
12
+ import { init_xopc_cloud, xopcCloudOAuthProvider } from "./xopc-cloud.js";
13
+ //#region src/auth/oauth/registry.ts
14
+ function definition(provider, displayName = provider.name) {
15
+ return {
16
+ displayName,
17
+ provider,
18
+ profileId: `${provider.id}:default`,
19
+ urlPrompt: "🌐 Please open this URL in your browser:\n"
20
+ };
21
+ }
22
+ function getOAuthProviderDefinition(provider) {
23
+ return OAUTH_PROVIDER_DEFINITIONS[provider];
24
+ }
25
+ function getOAuthProviderInterfaces() {
26
+ return Object.fromEntries(Object.entries(OAUTH_PROVIDER_DEFINITIONS).map(([id, value]) => [id, value.provider]));
27
+ }
28
+ function getOAuthProviderIds() {
29
+ return Object.keys(OAUTH_PROVIDER_DEFINITIONS);
30
+ }
31
+ function isOAuthOnlyProvider(provider) {
32
+ return OAUTH_PROVIDER_DEFINITIONS[provider]?.oauthOnly === true;
33
+ }
34
+ var OAUTH_PROVIDER_DEFINITIONS;
35
+ var init_registry = __esmMin((() => {
36
+ init_anthropic();
37
+ init_github_copilot();
38
+ init_google_antigravity();
39
+ init_google_gemini_cli();
40
+ init_kimi_coding();
41
+ init_minimax_cn();
42
+ init_minimax();
43
+ init_openai_codex();
44
+ init_xopc_cloud();
45
+ OAUTH_PROVIDER_DEFINITIONS = {
46
+ "xopc-cloud": {
47
+ ...definition(xopcCloudOAuthProvider),
48
+ oauthOnly: true
49
+ },
50
+ anthropic: definition(anthropicOAuthProvider, "Anthropic (Claude)"),
51
+ minimax: definition(minimaxOAuthProvider, "MiniMax (幂维智能)"),
52
+ "minimax-cn": {
53
+ ...definition(minimaxCnOAuthProvider, "MiniMax CN"),
54
+ urlPrompt: "🌐 请在浏览器中打开以下 URL:\n"
55
+ },
56
+ "kimi-coding": definition(kimiCodingOAuthProvider, "Kimi For Coding (月之暗面)"),
57
+ "github-copilot": definition(githubCopilotOAuthProvider),
58
+ "google-gemini-cli": definition(geminiCliOAuthProvider),
59
+ "google-antigravity": definition(antigravityOAuthProvider),
60
+ "openai-codex": definition(openaiCodexOAuthProvider)
61
+ };
62
+ }));
63
+ //#endregion
64
+ init_registry();
65
+ export { OAUTH_PROVIDER_DEFINITIONS, getOAuthProviderDefinition, getOAuthProviderIds, getOAuthProviderInterfaces, init_registry, isOAuthOnlyProvider };
@@ -0,0 +1,2 @@
1
+ import type { OAuthProviderInterface } from './types.js';
2
+ export declare const xopcCloudOAuthProvider: OAuthProviderInterface;
@@ -0,0 +1,101 @@
1
+ import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { hostname } from "node:os";
3
+ import { setTimeout } from "node:timers/promises";
4
+ //#region src/auth/oauth/xopc-cloud.ts
5
+ function consoleUrl() {
6
+ return (process.env.XOPC_CONSOLE_URL ?? DEFAULT_CONSOLE_URL).replace(/\/+$/, "");
7
+ }
8
+ async function readJson(response) {
9
+ const body = await response.json().catch(() => null);
10
+ return body && typeof body === "object" ? body : {};
11
+ }
12
+ function credentials(body) {
13
+ if (typeof body.access_token !== "string" || body.access_token.length === 0 || typeof body.refresh_token !== "string" || body.refresh_token.length === 0 || typeof body.expires_in !== "number" || !Number.isFinite(body.expires_in) || body.expires_in <= 0) throw new Error("XOPC OAuth token response is incomplete");
14
+ return {
15
+ access: body.access_token,
16
+ refresh: body.refresh_token,
17
+ expires: Date.now() + body.expires_in * 1e3,
18
+ scope: typeof body.scope === "string" ? body.scope.split(" ").filter(Boolean) : []
19
+ };
20
+ }
21
+ async function tokenRequest(body, signal) {
22
+ return fetch(`${consoleUrl()}/oauth/token`, {
23
+ method: "POST",
24
+ headers: {
25
+ "content-type": "application/x-www-form-urlencoded",
26
+ accept: "application/json"
27
+ },
28
+ body,
29
+ signal: signal ?? AbortSignal.timeout(3e4)
30
+ });
31
+ }
32
+ async function login(callbacks) {
33
+ const response = await fetch(`${consoleUrl()}/oauth/device_authorization`, {
34
+ method: "POST",
35
+ headers: {
36
+ "content-type": "application/x-www-form-urlencoded",
37
+ accept: "application/json"
38
+ },
39
+ body: new URLSearchParams({
40
+ client_id: CLIENT_ID,
41
+ scope: DEFAULT_SCOPE,
42
+ device_name: hostname() || "XOPC client",
43
+ client_type: "cli"
44
+ }),
45
+ signal: callbacks.signal ?? AbortSignal.timeout(3e4)
46
+ });
47
+ const body = await readJson(response);
48
+ if (!response.ok) throw new Error(body.error_description ?? body.error ?? "XOPC OAuth authorization failed");
49
+ const deviceCode = typeof body.device_code === "string" ? body.device_code : "";
50
+ const userCode = typeof body.user_code === "string" ? body.user_code : "";
51
+ const verificationUri = typeof body.verification_uri_complete === "string" ? body.verification_uri_complete : typeof body.verification_uri === "string" ? body.verification_uri : "";
52
+ if (!deviceCode || !userCode || !verificationUri) throw new Error("XOPC OAuth response is incomplete");
53
+ const intervalMs = Math.max(1, Number(body.interval) || 5) * 1e3;
54
+ const expiresAt = Date.now() + Math.max(1, Number(body.expires_in) || 600) * 1e3;
55
+ callbacks.onDeviceCode({
56
+ userCode,
57
+ verificationUri,
58
+ intervalSeconds: intervalMs / 1e3,
59
+ expiresInSeconds: Math.floor((expiresAt - Date.now()) / 1e3)
60
+ });
61
+ while (Date.now() < expiresAt) {
62
+ if (callbacks.signal?.aborted) throw callbacks.signal.reason ?? /* @__PURE__ */ new Error("OAuth login cancelled");
63
+ await setTimeout(intervalMs, void 0, callbacks.signal ? { signal: callbacks.signal } : void 0);
64
+ const token = await tokenRequest(new URLSearchParams({
65
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
66
+ client_id: CLIENT_ID,
67
+ device_code: deviceCode
68
+ }), callbacks.signal);
69
+ const tokenBody = await readJson(token);
70
+ if (token.ok) return credentials(tokenBody);
71
+ if (tokenBody.error === "authorization_pending" || tokenBody.error === "slow_down") continue;
72
+ throw new Error(tokenBody.error_description ?? tokenBody.error ?? "XOPC OAuth token exchange failed");
73
+ }
74
+ throw new Error("XOPC OAuth authorization expired");
75
+ }
76
+ async function refreshToken(current) {
77
+ const response = await tokenRequest(new URLSearchParams({
78
+ grant_type: "refresh_token",
79
+ client_id: CLIENT_ID,
80
+ refresh_token: current.refresh
81
+ }));
82
+ const body = await readJson(response);
83
+ if (!response.ok) throw new Error(body.error_description ?? body.error ?? "XOPC OAuth refresh failed");
84
+ return credentials(body);
85
+ }
86
+ var CLIENT_ID, DEFAULT_CONSOLE_URL, DEFAULT_SCOPE, xopcCloudOAuthProvider;
87
+ var init_xopc_cloud = __esmMin((() => {
88
+ CLIENT_ID = "xopc-native";
89
+ DEFAULT_CONSOLE_URL = "https://console.xopc.ai";
90
+ DEFAULT_SCOPE = "models:read models:invoke account:usage offline_access";
91
+ xopcCloudOAuthProvider = {
92
+ id: "xopc-cloud",
93
+ name: "XOPC Model Service",
94
+ login,
95
+ refreshToken,
96
+ getApiKey: (value) => value.access
97
+ };
98
+ }));
99
+ //#endregion
100
+ init_xopc_cloud();
101
+ export { init_xopc_cloud, xopcCloudOAuthProvider };
@@ -2,12 +2,15 @@
2
2
  * Synchronous checks that mirror CredentialResolver.resolveApiKey sources
3
3
  * used by isProviderConfiguredSync (fallback candidate filtering).
4
4
  */
5
+ import type { Config } from '../config/schema.js';
5
6
  /**
6
7
  * Synchronous API key / OAuth access for {@link Agent} `getApiKey` (pi-agent requires sync).
7
8
  * Order: default agent auth-profiles → global auth-profiles → OAuth token file.
8
9
  * Does not read standard env vars or models.json registry — callers chain `getApiKeySync` after this.
9
10
  */
10
11
  export declare function resolveProviderApiKeySync(provider: string): string | undefined;
12
+ /** Resolve one agent's private credential, then the shared credential and OAuth token. */
13
+ export declare function resolveProviderApiKeyForAgentSync(provider: string, agentId?: string, config?: Config): string | undefined;
11
14
  /**
12
15
  * True if credentials exist in auth profiles (global or agent) or OAuth store,
13
16
  * matching async CredentialResolver resolution (excluding env — callers check env separately).
@@ -2,6 +2,7 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
3
3
  import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
4
4
  import { init_loader, loadConfig } from "../config/loader.js";
5
+ import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
5
6
  import { existsSync, readFileSync } from "node:fs";
6
7
  //#region src/auth/sync-provider-auth.ts
7
8
  /**
@@ -81,6 +82,7 @@ function readOAuthAccessTokenSync(provider) {
81
82
  */
82
83
  function resolveProviderApiKeySync(provider) {
83
84
  const normalized = provider.toLowerCase();
85
+ if (isOAuthOnlyProvider(normalized)) return readOAuthAccessTokenSync(normalized);
84
86
  const cfg = loadConfig();
85
87
  const fromAgent = readApiKeyFromProfilesFile(resolveAgentAuthProfilesPath(cfg, getDefaultAgentId(cfg)), normalized);
86
88
  if (fromAgent) return fromAgent;
@@ -88,11 +90,24 @@ function resolveProviderApiKeySync(provider) {
88
90
  if (fromGlobal) return fromGlobal;
89
91
  return readOAuthAccessTokenSync(normalized);
90
92
  }
93
+ /** Resolve one agent's private credential, then the shared credential and OAuth token. */
94
+ function resolveProviderApiKeyForAgentSync(provider, agentId, config) {
95
+ const normalized = provider.toLowerCase();
96
+ if (isOAuthOnlyProvider(normalized)) return readOAuthAccessTokenSync(normalized);
97
+ if (agentId?.trim()) {
98
+ const fromAgent = readApiKeyFromProfilesFile(resolveAgentAuthProfilesPath(config ?? loadConfig(), agentId.trim()), normalized);
99
+ if (fromAgent) return fromAgent;
100
+ }
101
+ const fromGlobal = readApiKeyFromProfilesFile(resolveAuthProfilesPath(), normalized);
102
+ if (fromGlobal) return fromGlobal;
103
+ return readOAuthAccessTokenSync(normalized);
104
+ }
91
105
  /**
92
106
  * True if credentials exist in auth profiles (global or agent) or OAuth store,
93
107
  * matching async CredentialResolver resolution (excluding env — callers check env separately).
94
108
  */
95
109
  function hasProviderAuthOnDiskSync(provider) {
110
+ if (isOAuthOnlyProvider(provider.toLowerCase())) return hasOAuthTokenSync(provider);
96
111
  const cfg = loadConfig();
97
112
  if (hasApiKeyInProfilesFile(resolveAgentAuthProfilesPath(cfg, getDefaultAgentId(cfg)), provider)) return true;
98
113
  if (hasApiKeyInProfilesFile(resolveAuthProfilesPath(), provider)) return true;
@@ -103,7 +118,8 @@ var init_sync_provider_auth = __esmMin((() => {
103
118
  init_paths();
104
119
  init_loader();
105
120
  init_resolve_route();
121
+ init_registry();
106
122
  }));
107
123
  //#endregion
108
124
  init_sync_provider_auth();
109
- export { hasProviderAuthOnDiskSync, init_sync_provider_auth, resolveProviderApiKeySync };
125
+ export { hasProviderAuthOnDiskSync, init_sync_provider_auth, resolveProviderApiKeyForAgentSync, resolveProviderApiKeySync };
@@ -15,14 +15,11 @@ init_credentials();
15
15
  init_schema();
16
16
  init_providers();
17
17
  const IMAGE_GENERATION_IDS = new Set([
18
- "gpt-image-1",
19
- "dall-e-3",
20
- "dall-e-2",
18
+ "gpt-image-2",
19
+ "gpt-image-1.5",
21
20
  "wan2.6-t2i",
22
21
  "wan2.7-image-pro",
23
22
  "wan2.7-image",
24
- "wan2.1-t2i-turbo",
25
- "wan2.1-t2i-plus",
26
23
  "image-01",
27
24
  "image-01-live"
28
25
  ]);
@@ -301,7 +301,7 @@ function resolvePresetEnvCredential(preset) {
301
301
  }
302
302
  }
303
303
  async function setupDomesticPreset(config, ctx, preset) {
304
- console.log(`\n🇨🇳 ${preset.displayName}\n`);
304
+ console.log(`\n${preset.onboardingIcon ?? "🇨🇳"} ${preset.displayName}\n`);
305
305
  console.log(preset.description);
306
306
  if (preset.quirks?.length) for (const quirk of preset.quirks) console.log(colors.gray(`Note: ${quirk}`));
307
307
  const baseUrlChoice = await select({
@@ -336,13 +336,14 @@ async function setupDomesticPreset(config, ctx, preset) {
336
336
  headers: preset.headers
337
337
  });
338
338
  const modelChoices = discoveredChoices.length > 0 ? discoveredChoices : getModelsForProvider(preset.id);
339
+ if (preset.requiresModelDiscovery && modelChoices.length === 0) throw new Error(`No models are available from ${preset.displayName}. Ask an administrator to publish a model, then retry.`);
339
340
  const modelRef = await select({
340
341
  message: "Model:",
341
342
  choices: modelChoices.map((choice) => ({
342
343
  ...choice,
343
344
  name: modelChoiceName(choice)
344
345
  })),
345
- default: `${preset.id}/${preset.defaultModel}`
346
+ default: preset.defaultModel ? `${preset.id}/${preset.defaultModel}` : modelChoices[0]?.value
346
347
  });
347
348
  const modelId = modelRef.split("/").slice(1).join("/");
348
349
  if (await confirm({
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export type SetupAction = 'add' | 'set' | 'remove' | 'noop';
9
9
  export interface SetupError {
10
- /** Dot path of the offending field, when known (e.g. `providers.openai.apiKey`). */
10
+ /** Dot path of the offending field, when known (e.g. `providers.openai.baseUrl`). */
11
11
  path?: string;
12
12
  message: string;
13
13
  }
@@ -1,29 +1,6 @@
1
- /**
2
- * OAuth Provider Configuration
3
- *
4
- * Centralized OAuth provider definitions for CLI commands.
5
- * Used by both auth.ts and onboard.ts to avoid duplication.
6
- */
7
- import type { OAuthProviderInterface } from '../../auth/oauth/types.js';
8
- export interface OAuthProviderConfig {
9
- displayName: string;
10
- provider: OAuthProviderInterface;
11
- profileId: string;
12
- urlPrompt: string;
13
- }
14
- /**
15
- * Map of provider IDs to their OAuth configuration.
16
- */
17
- export declare const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig>;
18
- /**
19
- * Get supported OAuth provider IDs.
20
- */
1
+ import { type OAuthProviderDefinition } from '../../auth/oauth/registry.js';
2
+ export type OAuthProviderConfig = OAuthProviderDefinition;
3
+ export declare const OAUTH_PROVIDERS: Readonly<Record<string, OAuthProviderDefinition>>;
21
4
  export declare function getSupportedOAuthProviders(): string[];
22
- /**
23
- * Check if a provider supports OAuth.
24
- */
25
5
  export declare function supportsOAuth(provider: string): boolean;
26
- /**
27
- * Get OAuth provider config by ID.
28
- */
29
6
  export declare function getOAuthProvider(provider: string): OAuthProviderConfig | undefined;
@@ -1,89 +1,15 @@
1
- import { anthropicOAuthProvider } from "../../auth/oauth/anthropic.js";
2
- import { minimaxOAuthProvider } from "../../auth/oauth/minimax.js";
3
- import { minimaxCnOAuthProvider } from "../../auth/oauth/minimax-cn.js";
4
- import { kimiCodingOAuthProvider } from "../../auth/oauth/kimi-coding.js";
5
- import { githubCopilotOAuthProvider } from "../../auth/oauth/github-copilot.js";
6
- import { geminiCliOAuthProvider } from "../../auth/oauth/google-oauth/google-gemini-cli.js";
7
- import { antigravityOAuthProvider } from "../../auth/oauth/google-oauth/google-antigravity.js";
8
- import { openaiCodexOAuthProvider } from "../../auth/oauth/openai-codex.js";
9
- import "../../auth/oauth/index.js";
1
+ import { OAUTH_PROVIDER_DEFINITIONS, getOAuthProviderDefinition, init_registry } from "../../auth/oauth/registry.js";
10
2
  //#region src/cli/utils/oauth-providers.ts
11
- /**
12
- * OAuth Provider Configuration
13
- *
14
- * Centralized OAuth provider definitions for CLI commands.
15
- * Used by both auth.ts and onboard.ts to avoid duplication.
16
- */
17
- /**
18
- * Map of provider IDs to their OAuth configuration.
19
- */
20
- const OAUTH_PROVIDERS = {
21
- anthropic: {
22
- displayName: "Anthropic (Claude)",
23
- provider: anthropicOAuthProvider,
24
- profileId: "anthropic:default",
25
- urlPrompt: "🌐 Please open this URL in your browser:\n"
26
- },
27
- minimax: {
28
- displayName: "MiniMax (幂维智能)",
29
- provider: minimaxOAuthProvider,
30
- profileId: "minimax:default",
31
- urlPrompt: "🌐 Please open this URL in your browser:\n"
32
- },
33
- "minimax-cn": {
34
- displayName: "MiniMax CN",
35
- provider: minimaxCnOAuthProvider,
36
- profileId: "minimax-cn:default",
37
- urlPrompt: "🌐 请在浏览器中打开以下 URL:\n"
38
- },
39
- "kimi-coding": {
40
- displayName: "Kimi For Coding (月之暗面)",
41
- provider: kimiCodingOAuthProvider,
42
- profileId: "kimi-coding:default",
43
- urlPrompt: "🌐 Please open this URL in your browser:\n"
44
- },
45
- "github-copilot": {
46
- displayName: "GitHub Copilot",
47
- provider: githubCopilotOAuthProvider,
48
- profileId: "github-copilot:default",
49
- urlPrompt: "🌐 Please open this URL in your browser:\n"
50
- },
51
- "google-gemini-cli": {
52
- displayName: "Google Gemini CLI",
53
- provider: geminiCliOAuthProvider,
54
- profileId: "google-gemini-cli:default",
55
- urlPrompt: "🌐 Please open this URL in your browser:\n"
56
- },
57
- "google-antigravity": {
58
- displayName: "Google Antigravity",
59
- provider: antigravityOAuthProvider,
60
- profileId: "google-antigravity:default",
61
- urlPrompt: "🌐 Please open this URL in your browser:\n"
62
- },
63
- "openai-codex": {
64
- displayName: "OpenAI Codex",
65
- provider: openaiCodexOAuthProvider,
66
- profileId: "openai-codex:default",
67
- urlPrompt: "🌐 Please open this URL in your browser:\n"
68
- }
69
- };
70
- /**
71
- * Get supported OAuth provider IDs.
72
- */
3
+ init_registry();
4
+ const OAUTH_PROVIDERS = OAUTH_PROVIDER_DEFINITIONS;
73
5
  function getSupportedOAuthProviders() {
74
- return Object.keys(OAUTH_PROVIDERS);
6
+ return Object.keys(OAUTH_PROVIDER_DEFINITIONS);
75
7
  }
76
- /**
77
- * Check if a provider supports OAuth.
78
- */
79
8
  function supportsOAuth(provider) {
80
- return provider in OAUTH_PROVIDERS;
9
+ return Boolean(getOAuthProviderDefinition(provider));
81
10
  }
82
- /**
83
- * Get OAuth provider config by ID.
84
- */
85
11
  function getOAuthProvider(provider) {
86
- return OAUTH_PROVIDERS[provider];
12
+ return getOAuthProviderDefinition(provider);
87
13
  }
88
14
  //#endregion
89
15
  export { OAUTH_PROVIDERS, getOAuthProvider, getSupportedOAuthProviders, supportsOAuth };
@@ -1,7 +1,7 @@
1
1
  import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXopcDatabasePath } from "./paths-state.js";
2
2
  import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
3
3
  import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
4
- import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
4
+ import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
5
5
  import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
6
6
  import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
7
7
  import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
@@ -27,4 +27,4 @@ init_workspace_path();
27
27
  init_models_json();
28
28
  init_resolve_config_value();
29
29
  //#endregion
30
- export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, USER_MEMORY_FILENAME, USER_PROFILE_FILENAME, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, hasBundledExtensionManifest, isKnownCliMcpTypeAlias, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveUserDir, resolveUserMemoryPath, resolveUserProfilePath, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
30
+ export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, USER_MEMORY_FILENAME, USER_PROFILE_FILENAME, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, hasBundledExtensionManifest, isKnownCliMcpTypeAlias, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveUserDir, resolveUserMemoryPath, resolveUserProfilePath, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
@@ -292,6 +292,9 @@ export declare const ProviderConfigSchema: z.ZodObject<{
292
292
  supportsStrictMode: z.ZodOptional<z.ZodBoolean>;
293
293
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
294
294
  }, z.core.$strip>>>;
295
+ modelDiscovery: z.ZodOptional<z.ZodObject<{
296
+ enabled: z.ZodBoolean;
297
+ }, z.core.$strict>>;
295
298
  }, z.core.$strip>;
296
299
  export declare const ModelsJsonSchema: z.ZodObject<{
297
300
  providers: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -412,6 +415,9 @@ export declare const ModelsJsonSchema: z.ZodObject<{
412
415
  supportsStrictMode: z.ZodOptional<z.ZodBoolean>;
413
416
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
414
417
  }, z.core.$strip>>>;
418
+ modelDiscovery: z.ZodOptional<z.ZodObject<{
419
+ enabled: z.ZodBoolean;
420
+ }, z.core.$strict>>;
415
421
  }, z.core.$strip>>;
416
422
  }, z.core.$strip>;
417
423
  export type OpenRouterRouting = z.infer<typeof OpenRouterRoutingSchema>;
@@ -27,6 +27,14 @@ function validateModelsConfig(config) {
27
27
  }
28
28
  const data = result.data;
29
29
  for (const [providerName, providerConfig] of Object.entries(data.providers)) {
30
+ if (providerName === "xopc-cloud") {
31
+ errors.push({
32
+ path: "providers.xopc-cloud",
33
+ message: "xopc-cloud is managed by OAuth and the runtime model catalog; it cannot be configured in models.json",
34
+ severity: "error"
35
+ });
36
+ continue;
37
+ }
30
38
  if (!PROVIDER_ID_REGEX.test(providerName)) errors.push({
31
39
  path: `providers.${providerName}`,
32
40
  message: "Provider ID must start/end with alphanumeric, contain only lowercase letters, numbers, hyphens, and underscores",
@@ -46,11 +54,6 @@ function validateModelsConfig(config) {
46
54
  message: "baseUrl is required when defining custom models",
47
55
  severity: "error"
48
56
  });
49
- if (!providerConfig.apiKey) errors.push({
50
- path: `providers.${providerName}.apiKey`,
51
- message: "apiKey is required when defining custom models",
52
- severity: "error"
53
- });
54
57
  }
55
58
  if (!hasModels && !hasBaseUrl && !hasModelOverrides && !providerConfig.apiKey) errors.push({
56
59
  path: `providers.${providerName}`,
@@ -247,7 +250,8 @@ var init_models_json = __esmMin((() => {
247
250
  headers: z.record(z.string(), z.string()).optional(),
248
251
  authHeader: z.boolean().optional(),
249
252
  models: z.array(CustomModelSchema).optional(),
250
- modelOverrides: z.record(z.string(), ModelOverrideSchema).optional()
253
+ modelOverrides: z.record(z.string(), ModelOverrideSchema).optional(),
254
+ modelDiscovery: z.object({ enabled: z.boolean() }).strict().optional()
251
255
  });
252
256
  ModelsJsonSchema = z.object({ providers: z.record(z.string(), ProviderConfigSchema) });
253
257
  PROVIDER_ID_REGEX = /^[a-z0-9]([a-z0-9-_]*[a-z0-9])?$/;