@xopcai/xopc 0.0.224 → 0.0.227

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 (232) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/demo-memory/src/index.js +10 -1
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store--GBciH10.js → activity-store-BevwE16n.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-K7V4XXt7.js → agent-avatar-dicebear-BggVQrEZ.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-TJpjRHnr.js +68 -0
  8. package/dist/gateway/static/root/assets/{api-HoIz_ija.js → api-Bx_BpIt8.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-xQCmkAHh.js → app-management-settings-panel-BtKP9n2r.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-BRoeA4kU.js → appearance-settings-BoH2NAUX.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-CZ4Da51l.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-CteCVsBP.js → archive-plugin-DnceUyxm.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-D7xNA2jB.js → attachment-load-Bh8_9gkr.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-BD1vK7r5.js → automations-page-ZKeAAVxD.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-2Y00PvJU.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-C3DaJa0W.js → binary-plugins-Cy9er6w-.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-lTkcHTve.js → block-editor-Cc0wWvNX.js} +3 -3
  18. package/dist/gateway/static/root/assets/browser-settings-page-CbJD27_j.js +8 -0
  19. package/dist/gateway/static/root/assets/{browser-workflow-inputs-1UZ0vnIy.js → browser-workflow-inputs-BS7rpLLl.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-workflows-page-BHuJOF4M.js → browser-workflows-page-BdBVUZXm.js} +2 -2
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-Dv8y6OuP.js +7 -0
  22. package/dist/gateway/static/root/assets/{capability-presets-api-yNqTIuyd.js → capability-presets-api-D1Lqz0Tt.js} +1 -1
  23. package/dist/gateway/static/root/assets/capability-presets-settings-panel-TZmjzWzt.js +3 -0
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-krezGsKc.js → channel-recipient-api-CGuEl-l2.js} +1 -1
  25. package/dist/gateway/static/root/assets/{channels-settings-B4AtvQHk.js → channels-settings-g-68dutA.js} +1 -1
  26. package/dist/gateway/static/root/assets/channels-status-swr-D7KsAeWh.js +1 -0
  27. package/dist/gateway/static/root/assets/{chat-terminal-dock-BRrL2iHA.js → chat-terminal-dock-CdX_7aQh.js} +1 -1
  28. package/dist/gateway/static/root/assets/connectors-page-DXA0rAvQ.js +2 -0
  29. package/dist/gateway/static/root/assets/{cron-expression-Bl-2DzBQ.js → cron-expression-BnSQc4Ek.js} +1 -1
  30. package/dist/gateway/static/root/assets/{date-picker-CxTl6Wlz.js → date-picker-BbuG7zQ_.js} +1 -1
  31. package/dist/gateway/static/root/assets/{dependency-picker-DSl0mOPa.js → dependency-picker-snZeqOmG.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-DTeCmCdb.js → desktop-pet-DJQ8JoR1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-settings-BNebxg0V.js → desktop-pet-settings-B9txsRtv.js} +1 -1
  34. package/dist/gateway/static/root/assets/{directory-picker-path-field-Dn9XpmXY.js → directory-picker-path-field-D7WKWkNB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-D-J-eOTb.js → extension-debug-page-D_7cOCj2.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-CpST24nU.js → extension-page-Bwu47iUb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-4nQXFnFq.js → extension-settings-page-Dwg4dSZM.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-api-BHWHduDi.js → gateway-config-api-jURUSte_.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-config-swr-yUxMMVjK.js → gateway-config-swr-6SQXF1yR.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-settings-BimMKmkM.js → gateway-settings-UklJOMLX.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-startup-retry-9mrsL84j.js → gateway-startup-retry-DqWaxyvZ.js} +1 -1
  42. package/dist/gateway/static/root/assets/heartbeat-settings-Djs_nduD.js +1 -0
  43. package/dist/gateway/static/root/assets/{home-page-DSM6aPHF.js → home-page-i6bXCHdo.js} +1 -1
  44. package/dist/gateway/static/root/assets/{image-generation-api-CgFAGDi8.js → image-generation-api-Bxmt6LEr.js} +1 -1
  45. package/dist/gateway/static/root/assets/index-BBBE89vm.css +2 -0
  46. package/dist/gateway/static/root/assets/index-BsD5wygl.js +74 -0
  47. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-6Ar5rfX4.js → keyboard-shortcuts-settings-ByVsCH3d.js} +1 -1
  48. package/dist/gateway/static/root/assets/{local-app-workbench-page-tzM0wTL8.js → local-app-workbench-page-BCKEDMlP.js} +2 -2
  49. package/dist/gateway/static/root/assets/{local-apps-page-B5n-x544.js → local-apps-page-D19R-xsz.js} +1 -1
  50. package/dist/gateway/static/root/assets/{locale-store-CPylQjH9.js → locale-store-Ci1Qi0Q-.js} +1 -1
  51. package/dist/gateway/static/root/assets/{logs-page-CgoQlera.js → logs-page-Cy9YQK7j.js} +2 -2
  52. package/dist/gateway/static/root/assets/{management-settings-CXBLyU-0.js → management-settings-G0y7zmfY.js} +1 -1
  53. package/dist/gateway/static/root/assets/{markdown-split-CtmQemJi.js → markdown-split-B69d2HWt.js} +1 -1
  54. package/dist/gateway/static/root/assets/{markdown-view-CUsob4Pz.js → markdown-view-CBM-v2ph.js} +1 -1
  55. package/dist/gateway/static/root/assets/{media-plugins-Dsd-IEOW.js → media-plugins-6TWEQgN_.js} +1 -1
  56. package/dist/gateway/static/root/assets/messages-CtOJwGW3.js +3 -0
  57. package/dist/gateway/static/root/assets/{notes-api-CfKZYrBC.js → notes-api-DLsnnZCS.js} +1 -1
  58. package/dist/gateway/static/root/assets/{notes-page-BKbOTE2n.js → notes-page-CkRJJKDm.js} +1 -1
  59. package/dist/gateway/static/root/assets/notes-workbench-B10T3hGX.js +4 -0
  60. package/dist/gateway/static/root/assets/{product-open-page-DqB9bsDB.js → product-open-page-HxArIvoN.js} +1 -1
  61. package/dist/gateway/static/root/assets/project-detail-page-DsqRlgsy.js +1 -0
  62. package/dist/gateway/static/root/assets/{projects-page-PeXUdGdO.js → projects-page-Bu2PN8OK.js} +1 -1
  63. package/dist/gateway/static/root/assets/{registry-api-B_5D8epF.js → registry-api-lEar5FOV.js} +1 -1
  64. package/dist/gateway/static/root/assets/remote-access-hub-CXACdJ2f.js +1 -0
  65. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DBTH_t0O.js → runtime-tools-settings-panel-Bf03UNGD.js} +2 -2
  66. package/dist/gateway/static/root/assets/{schema-form-CqMKAwV0.js → schema-form-CIXMBgx5.js} +1 -1
  67. package/dist/gateway/static/root/assets/sessions-page-CS2knWDT.js +1 -0
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-ByFGk0q_.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-form-section-dPriuuYq.js → settings-form-section-DgdB26mE.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-loading-skeleton-B-Mbm8Va.js → settings-loading-skeleton-efk5W6lG.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-page-Dyj3w-Ml.js → settings-page-BHVf4gEP.js} +1 -1
  72. package/dist/gateway/static/root/assets/{setup-status-panel-C4FxY5J3.js → setup-status-panel-WK0dGNMv.js} +1 -1
  73. package/dist/gateway/static/root/assets/{share-preview-page-emEdx7YL.js → share-preview-page-Cod-w2qm.js} +1 -1
  74. package/dist/gateway/static/root/assets/shares-settings-CUqQ31gt.js +1 -0
  75. package/dist/gateway/static/root/assets/skill-reload-api-DweAPjI8.js +1 -0
  76. package/dist/gateway/static/root/assets/{skills-page-BNtYnrRT.js → skills-page-DwCcipqK.js} +1 -1
  77. package/dist/gateway/static/root/assets/{skills-page.utils-DjnbNFs5.js → skills-page.utils-3WSbtl3S.js} +1 -1
  78. package/dist/gateway/static/root/assets/{system-settings-panel-DDStf-jZ.js → system-settings-panel-C5VxqC_s.js} +1 -1
  79. package/dist/gateway/static/root/assets/task-detail-page-DEj-BFMP.js +1 -0
  80. package/dist/gateway/static/root/assets/{theme-store-BN-32Fz5.js → theme-store-Dd89g_ki.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-autosave-C2mKZ-ua.js → use-autosave-CeV8VJh2.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-context-page-f7yh7aD5.js +1 -0
  83. package/dist/gateway/static/root/assets/{voice-api-key-field-D7OHeQby.js → voice-api-key-field-EmJ-8aZu.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-discovery-overlay-CIiXie7F.js → work-discovery-overlay-zsk6E3Mi.js} +1 -1
  85. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CBAYvm3G.js +3 -0
  86. package/dist/gateway/static/root/assets/workflows-page-BN0JmHrG.js +5 -0
  87. package/dist/gateway/static/root/index.html +11 -11
  88. package/dist/package.js +1 -1
  89. package/dist/src/agent/agent-manager.d.ts +3 -1
  90. package/dist/src/agent/agent-manager.js +22 -5
  91. package/dist/src/agent/embedded/run-turn.js +2 -0
  92. package/dist/src/agent/mcp/bundle-mcp-config.d.ts +9 -1
  93. package/dist/src/agent/mcp/bundle-mcp-config.js +11 -15
  94. package/dist/src/agent/mcp/embedded-mcp.d.ts +1 -1
  95. package/dist/src/agent/mcp/index.d.ts +1 -0
  96. package/dist/src/agent/mcp/index.js +7 -1
  97. package/dist/src/agent/mcp/mcp-http.d.ts +4 -0
  98. package/dist/src/agent/mcp/mcp-http.js +25 -1
  99. package/dist/src/agent/mcp/mcp-transport-config.d.ts +4 -0
  100. package/dist/src/agent/mcp/mcp-transport-config.js +1 -0
  101. package/dist/src/agent/mcp/mcp-transport.d.ts +7 -1
  102. package/dist/src/agent/mcp/mcp-transport.js +38 -11
  103. package/dist/src/agent/mcp/oauth/index.d.ts +6 -0
  104. package/dist/src/agent/mcp/oauth/index.js +6 -0
  105. package/dist/src/agent/mcp/oauth/mcp-oauth-errors.d.ts +5 -0
  106. package/dist/src/agent/mcp/oauth/mcp-oauth-errors.js +14 -0
  107. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +25 -0
  108. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +219 -0
  109. package/dist/src/agent/mcp/oauth/mcp-oauth-provider.d.ts +33 -0
  110. package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +103 -0
  111. package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +29 -0
  112. package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +169 -0
  113. package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +9 -0
  114. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +79 -0
  115. package/dist/src/agent/mcp/oauth/mcp-oauth-types.d.ts +22 -0
  116. package/dist/src/agent/mcp/oauth/mcp-oauth-types.js +1 -0
  117. package/dist/src/agent/memory/builtin-provider.js +23 -4
  118. package/dist/src/agent/memory/compaction-promotion.d.ts +18 -0
  119. package/dist/src/agent/memory/compaction-promotion.js +211 -0
  120. package/dist/src/agent/memory/context/types.d.ts +5 -0
  121. package/dist/src/agent/memory/manager.d.ts +3 -0
  122. package/dist/src/agent/memory/manager.js +12 -2
  123. package/dist/src/agent/memory/trusted-recall.d.ts +7 -0
  124. package/dist/src/agent/memory/trusted-recall.js +53 -0
  125. package/dist/src/agent/memory/turn-provenance.d.ts +14 -0
  126. package/dist/src/agent/memory/turn-provenance.js +60 -0
  127. package/dist/src/agent/memory/types.d.ts +18 -3
  128. package/dist/src/agent/memory/understanding/service.js +1 -0
  129. package/dist/src/agent/memory/understanding/types.d.ts +1 -0
  130. package/dist/src/agent/memory/user-context-coordinator.js +57 -6
  131. package/dist/src/agent/service.d.ts +2 -0
  132. package/dist/src/agent/service.js +6 -0
  133. package/dist/src/agent/skills/index.d.ts +22 -2
  134. package/dist/src/agent/skills/index.js +74 -32
  135. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +2 -0
  136. package/dist/src/agent/skills/skill-sources.d.ts +0 -1
  137. package/dist/src/agent/skills/skill-sources.js +1 -11
  138. package/dist/src/agent/tools/memory-tool.js +5 -1
  139. package/dist/src/capabilities/store-connector.js +99 -10
  140. package/dist/src/cli/commands/channels.js +1 -1
  141. package/dist/src/cli/commands/connectors.js +1 -1
  142. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  143. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  144. package/dist/src/cli/commands/models.js +1 -1
  145. package/dist/src/cli/commands/onboard.js +1 -1
  146. package/dist/src/config/config-mutation.d.ts +14 -0
  147. package/dist/src/config/config-mutation.js +33 -0
  148. package/dist/src/config/index.js +3 -3
  149. package/dist/src/config/paths.d.ts +2 -0
  150. package/dist/src/config/paths.js +5 -1
  151. package/dist/src/config/schema.d.ts +17 -0
  152. package/dist/src/config/schema.js +26 -2
  153. package/dist/src/connectors/auth-provider-registry.d.ts +1 -1
  154. package/dist/src/connectors/auth-provider-registry.js +23 -2
  155. package/dist/src/connectors/connected-source-understanding.js +1 -1
  156. package/dist/src/connectors/install.js +3 -3
  157. package/dist/src/connectors/instances.d.ts +2 -1
  158. package/dist/src/connectors/instances.js +15 -5
  159. package/dist/src/connectors/materialize.d.ts +1 -0
  160. package/dist/src/connectors/materialize.js +9 -1
  161. package/dist/src/connectors/runtime-adapter-registry.js +1 -0
  162. package/dist/src/connectors/types.d.ts +4 -1
  163. package/dist/src/extensions/connector-dependencies.d.ts +10 -0
  164. package/dist/src/extensions/connector-dependencies.js +65 -0
  165. package/dist/src/extensions/install.js +27 -0
  166. package/dist/src/extensions/normalize-manifest.js +1 -0
  167. package/dist/src/extensions/sdk/index.js +1 -1
  168. package/dist/src/extensions/types/manifest.d.ts +2 -0
  169. package/dist/src/gateway/hono/routes/capabilities.js +8 -8
  170. package/dist/src/gateway/hono/routes/connectors.js +104 -70
  171. package/dist/src/gateway/hono/routes/mcp.js +77 -5
  172. package/dist/src/gateway/hono/routes/project-skills.js +30 -2
  173. package/dist/src/gateway/hono/routes/you.js +52 -0
  174. package/dist/src/gateway/service.js +8 -8
  175. package/dist/src/knowledge/connected-knowledge-pipeline.js +26 -4
  176. package/dist/src/knowledge/connected-understanding-pipeline.js +12 -3
  177. package/dist/src/knowledge/index.d.ts +0 -1
  178. package/dist/src/knowledge/index.js +1 -2
  179. package/dist/src/projects/project-skill-service.d.ts +28 -6
  180. package/dist/src/projects/project-skill-service.js +76 -29
  181. package/dist/src/session/store.js +27 -0
  182. package/dist/src/storage/sqlite/index.d.ts +1 -0
  183. package/dist/src/storage/sqlite/index.js +2 -1
  184. package/dist/src/storage/sqlite/memory-records-repository.d.ts +9 -1
  185. package/dist/src/storage/sqlite/memory-records-repository.js +40 -6
  186. package/dist/src/storage/sqlite/migrations/134_memory_provenance.sql +18 -0
  187. package/dist/src/storage/sqlite/migrations/135_user_people.sql +59 -0
  188. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  189. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  190. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  191. package/dist/src/storage/sqlite/schema.js +1 -1
  192. package/dist/src/storage/sqlite/user-people-repository.d.ts +32 -0
  193. package/dist/src/storage/sqlite/user-people-repository.js +246 -0
  194. package/dist/src/tui/backends/embedded-backend.js +1 -1
  195. package/dist/src/user-context/planner.js +8 -3
  196. package/dist/src/user-context/relationships/indexer.d.ts +13 -0
  197. package/dist/src/user-context/relationships/indexer.js +185 -0
  198. package/dist/src/user-context/relationships/service.d.ts +22 -0
  199. package/dist/src/user-context/relationships/service.js +50 -0
  200. package/dist/src/user-context/relationships/types.d.ts +55 -0
  201. package/dist/src/user-context/relationships/types.js +10 -0
  202. package/dist/src/user-context/sources/repository.d.ts +1 -1
  203. package/dist/src/user-context/sources/repository.js +8 -2
  204. package/dist/src/work-discovery/service.js +1 -1
  205. package/package.json +2 -2
  206. package/dist/gateway/static/root/assets/agents-BsxTpXyq.js +0 -68
  207. package/dist/gateway/static/root/assets/apps-page-BXgpBA8w.js +0 -1
  208. package/dist/gateway/static/root/assets/automations-workspace-wrgf-z7D.js +0 -6
  209. package/dist/gateway/static/root/assets/browser-settings-page-zhzNkeVG.js +0 -8
  210. package/dist/gateway/static/root/assets/capabilities-settings-panel-DuCmg2Ej.js +0 -7
  211. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DjiP3mQQ.js +0 -3
  212. package/dist/gateway/static/root/assets/channels-status-swr-DMxB7slL.js +0 -1
  213. package/dist/gateway/static/root/assets/connectors-page-fmda2NEP.js +0 -2
  214. package/dist/gateway/static/root/assets/heartbeat-settings-MUJ3mEC9.js +0 -1
  215. package/dist/gateway/static/root/assets/index-B3zYJBhK.js +0 -74
  216. package/dist/gateway/static/root/assets/index-D3_xSYKd.css +0 -2
  217. package/dist/gateway/static/root/assets/messages-B82nsi9k.js +0 -3
  218. package/dist/gateway/static/root/assets/notes-workbench-BScELo01.js +0 -4
  219. package/dist/gateway/static/root/assets/project-detail-page-DUoyty8X.js +0 -1
  220. package/dist/gateway/static/root/assets/remote-access-hub-sHho-uXP.js +0 -1
  221. package/dist/gateway/static/root/assets/sessions-page-DyvNgaP9.js +0 -1
  222. package/dist/gateway/static/root/assets/settings-advanced-gate-CnYf1R7z.js +0 -1
  223. package/dist/gateway/static/root/assets/shares-settings-BQBVq-sN.js +0 -1
  224. package/dist/gateway/static/root/assets/skill-reload-api-BFoEpQ4I.js +0 -1
  225. package/dist/gateway/static/root/assets/task-detail-page-ZVwr8KbS.js +0 -1
  226. package/dist/gateway/static/root/assets/user-context-page-CHjIinCW.js +0 -1
  227. package/dist/gateway/static/root/assets/workflow-run-setup-panel-9_dAGW3_.js +0 -3
  228. package/dist/gateway/static/root/assets/workflows-page-DXpYJxao.js +0 -5
  229. package/dist/src/extensions/bundle-mcp.d.ts +0 -18
  230. package/dist/src/extensions/bundle-mcp.js +0 -69
  231. package/dist/src/knowledge/people-graph.d.ts +0 -25
  232. package/dist/src/knowledge/people-graph.js +0 -92
@@ -16,6 +16,74 @@ function asStringArray(value, label) {
16
16
  if (!Array.isArray(value) || value.some((item) => typeof item !== "string" || !item.trim())) throw new Error(`${label} must be an array of non-empty strings.`);
17
17
  return value.map((item) => item.trim());
18
18
  }
19
+ const TEMPLATE_PATTERN = /^\{\{(secrets|config)\.([A-Za-z0-9_.-]+)\}\}$/;
20
+ const SETUP_KEY_PATTERN = /^[A-Za-z0-9_.-]+$/;
21
+ function readSetup(value) {
22
+ if (value === void 0) return {
23
+ setup: {},
24
+ keys: /* @__PURE__ */ new Set()
25
+ };
26
+ const record = asRecord(value, "Connector setup");
27
+ const keys = /* @__PURE__ */ new Set();
28
+ const secrets = record.secrets === void 0 ? void 0 : (Array.isArray(record.secrets) ? record.secrets : (() => {
29
+ throw new Error("Connector setup.secrets must be an array.");
30
+ })()).map((raw) => {
31
+ const field = asRecord(raw, "Connector secret field");
32
+ const key = asString(field.key, "Connector secret key");
33
+ if (!SETUP_KEY_PATTERN.test(key) || keys.has(`secrets:${key}`)) throw new Error(`Invalid or duplicate Connector secret key: ${key}`);
34
+ keys.add(`secrets:${key}`);
35
+ return {
36
+ key,
37
+ label: asString(field.label, `Connector secret "${key}" label`),
38
+ ...typeof field.description === "string" ? { description: field.description } : {},
39
+ required: field.required === true
40
+ };
41
+ });
42
+ const config = record.config === void 0 ? void 0 : (Array.isArray(record.config) ? record.config : (() => {
43
+ throw new Error("Connector setup.config must be an array.");
44
+ })()).map((raw) => {
45
+ const field = asRecord(raw, "Connector config field");
46
+ const key = asString(field.key, "Connector config key");
47
+ const type = asString(field.type, `Connector config "${key}" type`);
48
+ if (!SETUP_KEY_PATTERN.test(key) || keys.has(`config:${key}`)) throw new Error(`Invalid or duplicate Connector config key: ${key}`);
49
+ if (![
50
+ "string",
51
+ "number",
52
+ "boolean",
53
+ "json",
54
+ "path"
55
+ ].includes(type)) throw new Error(`Unsupported Connector config type: ${type}`);
56
+ keys.add(`config:${key}`);
57
+ return {
58
+ key,
59
+ label: asString(field.label, `Connector config "${key}" label`),
60
+ type,
61
+ ...typeof field.required === "boolean" ? { required: field.required } : {},
62
+ ...typeof field.placeholder === "string" ? { placeholder: field.placeholder } : {},
63
+ ...field.defaultValue !== void 0 ? { defaultValue: field.defaultValue } : {},
64
+ ...typeof field.description === "string" ? { description: field.description } : {}
65
+ };
66
+ });
67
+ return {
68
+ setup: {
69
+ ...secrets ? { secrets } : {},
70
+ ...config ? { config } : {}
71
+ },
72
+ keys
73
+ };
74
+ }
75
+ function assertDeclaredTemplateReferences(value, setupKeys) {
76
+ if (typeof value === "string") {
77
+ const match = TEMPLATE_PATTERN.exec(value.trim());
78
+ if (match && !setupKeys.has(`${match[1]}:${match[2]}`)) throw new Error(`Connector template references undeclared ${match[1]} field "${match[2]}".`);
79
+ return;
80
+ }
81
+ if (Array.isArray(value)) {
82
+ for (const child of value) assertDeclaredTemplateReferences(child, setupKeys);
83
+ return;
84
+ }
85
+ if (value && typeof value === "object") for (const child of Object.values(value)) assertDeclaredTemplateReferences(child, setupKeys);
86
+ }
19
87
  const NPM_PACKAGE_NAME = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/;
20
88
  const EXACT_SEMVER = /^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
21
89
  function assertSafeRemoteUrl(value) {
@@ -55,13 +123,17 @@ function readPinnedLocalRuntime(runtime, template) {
55
123
  const version = asString(localPackage.version, "Connector local package version");
56
124
  if (!NPM_PACKAGE_NAME.test(name) || !EXACT_SEMVER.test(version)) throw new Error("Local Store connectors must use a valid exact npm package version.");
57
125
  if (template.command !== "npx" || JSON.stringify(asStringArray(template.args, "Connector local MCP arguments")) !== JSON.stringify(["--yes", `${name}@${version}`])) throw new Error("Local Store connectors must use the pinned npx launch form.");
126
+ if (template.env !== void 0) {
127
+ const env = asRecord(template.env, "Connector local MCP environment");
128
+ for (const [key, value] of Object.entries(env)) if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || typeof value !== "string" || !TEMPLATE_PATTERN.test(value.trim())) throw new Error("Connector local MCP environment must contain declared setup references under valid environment variable names.");
129
+ }
58
130
  for (const field of [
59
131
  "url",
60
- "env",
61
132
  "cwd",
62
133
  "workingDirectory",
63
134
  "headers",
64
- "transport"
135
+ "transport",
136
+ "auth"
65
137
  ]) if (field in template) throw new Error("Local Store connectors cannot define additional MCP process fields.");
66
138
  return {
67
139
  registry: "npm",
@@ -71,16 +143,25 @@ function readPinnedLocalRuntime(runtime, template) {
71
143
  }
72
144
  function readConnectorManifest(value, packageName, version, sha256) {
73
145
  const manifest = asRecord(value, "Connector manifest");
146
+ if (manifest.contractVersion !== 1) throw new Error("Store connector manifest must use contractVersion 1.");
74
147
  if (asString(manifest.id, "Connector id") !== packageName) throw new Error("Connector manifest id does not match the store package name.");
75
148
  const runtime = asRecord(manifest.runtime, "Connector runtime");
76
149
  if (runtime.type !== "mcp") throw new Error("Store connectors must use the MCP runtime.");
77
150
  const serverTemplate = asRecord(runtime.serverTemplate, "Connector MCP serverTemplate");
78
151
  const localPackage = readPinnedLocalRuntime(runtime, serverTemplate);
79
152
  const transport = serverTemplate.transport;
80
- if (!localPackage && transport !== "streamable-http" && transport !== "sse") throw new Error("Store connectors must use streamable-http or sse transport.");
81
- const authMode = asRecord(manifest.auth, "Connector auth").mode;
82
- if (authMode !== "none" && authMode !== "apiKey") throw new Error("Store connectors support only none or apiKey authentication.");
83
- const normalizedAuth = { mode: authMode };
153
+ if (!localPackage && transport !== "streamable-http") throw new Error("Remote Store connectors must use streamable-http transport.");
154
+ if ("auth" in serverTemplate) throw new Error("Connector MCP authentication must be declared only in the top-level auth field.");
155
+ const auth = asRecord(manifest.auth, "Connector auth");
156
+ const authMode = auth.mode;
157
+ if (authMode !== "none" && authMode !== "apiKey" && authMode !== "oauth") throw new Error("Store connectors support only none, apiKey, or oauth authentication.");
158
+ if (authMode === "oauth" && localPackage) throw new Error("MCP OAuth requires a remote Store connector.");
159
+ const clientId = auth.clientId === void 0 ? void 0 : asString(auth.clientId, "Connector OAuth clientId");
160
+ if (clientId && authMode !== "oauth") throw new Error("Connector OAuth clientId requires oauth authentication.");
161
+ const normalizedAuth = authMode === "oauth" ? {
162
+ mode: "oauth",
163
+ ...clientId ? { clientId } : {}
164
+ } : { mode: authMode };
84
165
  const category = asString(manifest.category, "Connector category");
85
166
  if (![
86
167
  "code",
@@ -98,16 +179,20 @@ function readConnectorManifest(value, packageName, version, sha256) {
98
179
  "context",
99
180
  "events",
100
181
  "auth.apiKey",
182
+ "auth.oauth",
101
183
  "runtime.mcp.stdio",
102
- "runtime.mcp.sse",
103
184
  "runtime.mcp.streamableHttp"
104
185
  ]);
105
186
  if (capabilities.some((capability) => !allowedCapabilities.has(capability))) throw new Error("Connector manifest contains an unsupported capability.");
106
- const setup = manifest.setup === void 0 ? {} : asRecord(manifest.setup, "Connector setup");
187
+ const expectedAuthCapability = authMode === "oauth" ? "auth.oauth" : authMode === "apiKey" ? "auth.apiKey" : void 0;
188
+ const declaredAuthCapabilities = capabilities.filter((capability) => capability === "auth.oauth" || capability === "auth.apiKey");
189
+ if (expectedAuthCapability ? declaredAuthCapabilities.length !== 1 || declaredAuthCapabilities[0] !== expectedAuthCapability : declaredAuthCapabilities.length > 0) throw new Error("Connector authentication capabilities must match the declared auth mode.");
190
+ const { setup, keys: setupKeys } = readSetup(manifest.setup);
191
+ assertDeclaredTemplateReferences(serverTemplate, setupKeys);
107
192
  const permissions = readPermissions(manifest.permissions, Boolean(localPackage));
108
193
  const endpoint = localPackage ? void 0 : assertSafeRemoteUrl(serverTemplate.url);
109
194
  const hostname = endpoint ? new URL(endpoint).hostname : void 0;
110
- if (hostname && permissions.networkDomains?.length && !permissions.networkDomains.includes(hostname)) throw new Error("Connector network permissions must include the MCP endpoint host.");
195
+ if (hostname && permissions.networkDomains?.length && !permissions.networkDomains.some((domain) => domain.toLowerCase() === hostname.toLowerCase())) throw new Error("Connector network permissions must include the MCP endpoint host.");
111
196
  return {
112
197
  id: packageName,
113
198
  version,
@@ -125,7 +210,11 @@ function readConnectorManifest(value, packageName, version, sha256) {
125
210
  serverId: asString(runtime.serverId, "Connector MCP serverId"),
126
211
  serverTemplate: localPackage ? serverTemplate : {
127
212
  ...serverTemplate,
128
- url: endpoint
213
+ url: endpoint,
214
+ ...authMode === "oauth" ? { auth: {
215
+ type: "oauth",
216
+ ...clientId ? { clientId } : {}
217
+ } } : {}
129
218
  },
130
219
  ...localPackage ? { localPackage } : {}
131
220
  },
@@ -1,8 +1,8 @@
1
1
  import { buildChannelCatalogForConfig, init_channel_catalog_service } from "../../channels/catalog/channel-catalog-service.js";
2
2
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
3
- import { formatExamples, register } from "../registry.js";
4
3
  import { listChannelPairingState } from "../../channels/pairing/pairing-service.js";
5
4
  import { approveChannelPairingFromCli } from "../../channels/pairing/approve-cli.js";
5
+ import { formatExamples, register } from "../registry.js";
6
6
  import { colors } from "../utils/colors.js";
7
7
  import { Command } from "commander";
8
8
  //#region src/cli/commands/channels.ts
@@ -1,8 +1,8 @@
1
1
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
2
2
  import { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors } from "../../capabilities/store-connector.js";
3
3
  import { register } from "../registry.js";
4
- import { Command } from "commander";
5
4
  import { confirm } from "@inquirer/prompts";
5
+ import { Command } from "commander";
6
6
  //#region src/cli/commands/connectors.ts
7
7
  init_loader();
8
8
  function parsePairs(values, option) {
@@ -52,7 +52,7 @@ async function checkDatabaseSchema(ctx) {
52
52
  id: "database-schema",
53
53
  label: "Database schema",
54
54
  status: "pass",
55
- message: `SQLite schema v${status.dbVersion} (current release v133).`,
55
+ message: `SQLite schema v${status.dbVersion} (current release v135).`,
56
56
  hints: []
57
57
  };
58
58
  }
@@ -13,8 +13,8 @@ import { existsSync, readFileSync, rmSync, statSync } from "node:fs";
13
13
  import { execSync } from "node:child_process";
14
14
  import { createHash } from "node:crypto";
15
15
  import semver from "semver";
16
- import { Command } from "commander";
17
16
  import { confirm } from "@inquirer/prompts";
17
+ import { Command } from "commander";
18
18
  //#region src/cli/commands/extension-marketplace.ts
19
19
  init_loader();
20
20
  init_paths();
@@ -9,8 +9,8 @@ import { prepareUpdateGlobalDefaults } from "../../gateway/global-defaults-admin
9
9
  import { disconnectProvider } from "../../providers/provider-disconnect.js";
10
10
  import { colors } from "../utils/colors.js";
11
11
  import { runCliOAuthLogin } from "../utils/oauth-login.js";
12
- import { Command } from "commander";
13
12
  import { input } from "@inquirer/prompts";
13
+ import { Command } from "commander";
14
14
  //#region src/cli/commands/models.ts
15
15
  init_credentials();
16
16
  init_schema();
@@ -10,8 +10,8 @@ import { initWorkspace } from "../utils/init-workspace.js";
10
10
  import { setupModel } from "./onboard/model.js";
11
11
  import { getChannelConfigurators } from "./onboard/channels/registry.js";
12
12
  import { setupChannels } from "./onboard/channels/index.js";
13
- import { Command } from "commander";
14
13
  import { select } from "@inquirer/prompts";
14
+ import { Command } from "commander";
15
15
  //#region src/cli/commands/onboard.ts
16
16
  init_schema();
17
17
  init_paths_state();
@@ -0,0 +1,14 @@
1
+ import type { Config } from './schema.js';
2
+ /** Restore an in-memory config object after a failed persistence attempt. */
3
+ export declare function restoreConfig(config: Config, snapshot: Config): void;
4
+ export declare class ConfigPersistenceError extends Error {
5
+ constructor(message: string, options?: ErrorOptions);
6
+ }
7
+ export declare function persistConfigMutation<T>(params: {
8
+ config: Config;
9
+ mutate: () => T | Promise<T>;
10
+ save: () => Promise<{
11
+ saved: boolean;
12
+ error?: string;
13
+ }>;
14
+ }): Promise<T>;
@@ -0,0 +1,33 @@
1
+ //#region src/config/config-mutation.ts
2
+ /** Restore an in-memory config object after a failed persistence attempt. */
3
+ function restoreConfig(config, snapshot) {
4
+ for (const key of Object.keys(config)) delete config[key];
5
+ Object.assign(config, snapshot);
6
+ }
7
+ var ConfigPersistenceError = class extends Error {
8
+ constructor(message, options) {
9
+ super(message, options);
10
+ this.name = "ConfigPersistenceError";
11
+ }
12
+ };
13
+ async function persistConfigMutation(params) {
14
+ const snapshot = structuredClone(params.config);
15
+ let result;
16
+ try {
17
+ result = await params.mutate();
18
+ } catch (error) {
19
+ restoreConfig(params.config, snapshot);
20
+ throw error;
21
+ }
22
+ try {
23
+ const saved = await params.save();
24
+ if (!saved.saved) throw new ConfigPersistenceError(saved.error ?? "Failed to save configuration.");
25
+ return result;
26
+ } catch (error) {
27
+ restoreConfig(params.config, snapshot);
28
+ if (error instanceof ConfigPersistenceError) throw error;
29
+ throw new ConfigPersistenceError(error instanceof Error ? error.message : String(error), { cause: error });
30
+ }
31
+ }
32
+ //#endregion
33
+ export { ConfigPersistenceError, persistConfigMutation, restoreConfig };
@@ -1,13 +1,13 @@
1
1
  import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXopcCloudCatalogCachePath, 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, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, 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, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, 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";
8
8
  import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
9
9
  import { extractProfileAgentId, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
10
- import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
10
+ import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMcpOAuthPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
11
11
  import { init_loader, loadConfig, saveConfig } from "./loader.js";
12
12
  import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
13
13
  import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.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, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, 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, 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, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
30
+ export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, 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, 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, resolveMcpOAuthPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
@@ -41,6 +41,8 @@ export declare function resolveAuthProfilesPath(): string;
41
41
  * Resolve OAuth token file path for a provider
42
42
  */
43
43
  export declare function resolveOAuthPath(provider: string): string;
44
+ /** Resolve the credential record for one canonical remote MCP endpoint. */
45
+ export declare function resolveMcpOAuthPath(serverKey: string): string;
44
46
  /**
45
47
  * Internal agent state dir: `stateDir/agents/<id>/agent/`
46
48
  * (credentials, inbox IPC, pid, agent.json — not the Markdown workspace).
@@ -30,6 +30,10 @@ function resolveAuthProfilesPath() {
30
30
  function resolveOAuthPath(provider) {
31
31
  return join(resolveCredentialsDir(), "oauth", `${provider}.json`);
32
32
  }
33
+ /** Resolve the credential record for one canonical remote MCP endpoint. */
34
+ function resolveMcpOAuthPath(serverKey) {
35
+ return join(resolveCredentialsDir(), "mcp", `${serverKey}.json`);
36
+ }
33
37
  /**
34
38
  * Internal agent state dir: `stateDir/agents/<id>/agent/`
35
39
  * (credentials, inbox IPC, pid, agent.json — not the Markdown workspace).
@@ -320,4 +324,4 @@ var init_paths = __esmMin((() => {
320
324
  }));
321
325
  //#endregion
322
326
  init_paths();
323
- export { ENV_VARS, FILENAMES, WORKSPACE_FILES, XOPC_DB_FILENAME, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath };
327
+ export { ENV_VARS, FILENAMES, WORKSPACE_FILES, XOPC_DB_FILENAME, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveMcpOAuthPath, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath };
@@ -1430,6 +1430,10 @@ export declare const TuiConfigSchema: z.ZodDefault<z.ZodObject<{
1430
1430
  defaultAgent: z.ZodOptional<z.ZodString>;
1431
1431
  }, z.core.$strict>>;
1432
1432
  export type TuiConfig = z.infer<typeof TuiConfigSchema>;
1433
+ export declare const McpOAuthConfigSchema: z.ZodObject<{
1434
+ type: z.ZodLiteral<"oauth">;
1435
+ clientId: z.ZodOptional<z.ZodString>;
1436
+ }, z.core.$strict>;
1433
1437
  export declare const McpServerSchema: z.ZodObject<{
1434
1438
  command: z.ZodOptional<z.ZodString>;
1435
1439
  args: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1452,6 +1456,10 @@ export declare const McpServerSchema: z.ZodObject<{
1452
1456
  fieldKey: z.ZodString;
1453
1457
  }, z.core.$strip>;
1454
1458
  }, z.core.$strip>]>>>;
1459
+ auth: z.ZodOptional<z.ZodObject<{
1460
+ type: z.ZodLiteral<"oauth">;
1461
+ clientId: z.ZodOptional<z.ZodString>;
1462
+ }, z.core.$strict>>;
1455
1463
  connectionTimeoutMs: z.ZodOptional<z.ZodNumber>;
1456
1464
  requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
1457
1465
  }, z.core.$catchall<z.ZodUnknown>>;
@@ -1478,12 +1486,17 @@ export declare const McpConfigSchema: z.ZodOptional<z.ZodObject<{
1478
1486
  fieldKey: z.ZodString;
1479
1487
  }, z.core.$strip>;
1480
1488
  }, z.core.$strip>]>>>;
1489
+ auth: z.ZodOptional<z.ZodObject<{
1490
+ type: z.ZodLiteral<"oauth">;
1491
+ clientId: z.ZodOptional<z.ZodString>;
1492
+ }, z.core.$strict>>;
1481
1493
  connectionTimeoutMs: z.ZodOptional<z.ZodNumber>;
1482
1494
  requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
1483
1495
  }, z.core.$catchall<z.ZodUnknown>>>>;
1484
1496
  sessionIdleTtlMs: z.ZodOptional<z.ZodNumber>;
1485
1497
  }, z.core.$strict>>;
1486
1498
  export type McpServerConfig = z.infer<typeof McpServerSchema>;
1499
+ export type McpOAuthConfig = z.infer<typeof McpOAuthConfigSchema>;
1487
1500
  export type McpConfig = z.infer<typeof McpConfigSchema>;
1488
1501
  export declare const ConnectorsConfigSchema: z.ZodOptional<z.ZodObject<{
1489
1502
  instances: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -2331,6 +2344,10 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
2331
2344
  fieldKey: z.ZodString;
2332
2345
  }, z.core.$strip>;
2333
2346
  }, z.core.$strip>]>>>;
2347
+ auth: z.ZodOptional<z.ZodObject<{
2348
+ type: z.ZodLiteral<"oauth">;
2349
+ clientId: z.ZodOptional<z.ZodString>;
2350
+ }, z.core.$strict>>;
2334
2351
  connectionTimeoutMs: z.ZodOptional<z.ZodNumber>;
2335
2352
  requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
2336
2353
  }, z.core.$catchall<z.ZodUnknown>>>>;
@@ -64,7 +64,7 @@ function parseModelRef(ref) {
64
64
  model: trimmed.slice(idx + 1).trim()
65
65
  };
66
66
  }
67
- var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentTypedModelRoleSchema, AgentTypedModelRolesSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, RuntimePreferenceSchema, RuntimeProvisionSchema, LanguageRuntimeSchema, DEFAULT_RUNTIME_TOOLS_CONFIG, RuntimeToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayWebchatConfigSchema, GatewayConfigSchema, ModelsDevConfigSchema, ModelCatalogConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpServerSchema, McpConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ConfigSchema;
67
+ var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentTypedModelRoleSchema, AgentTypedModelRolesSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, RuntimePreferenceSchema, RuntimeProvisionSchema, LanguageRuntimeSchema, DEFAULT_RUNTIME_TOOLS_CONFIG, RuntimeToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayWebchatConfigSchema, GatewayConfigSchema, ModelsDevConfigSchema, ModelCatalogConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpOAuthConfigSchema, McpServerSchema, McpConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ConfigSchema;
68
68
  var init_schema = __esmMin((() => {
69
69
  init_schema$1();
70
70
  init_preset_chain();
@@ -970,6 +970,11 @@ defaultAgent: z.string().min(1).optional() }).strict().default({});
970
970
  z.boolean(),
971
971
  ConnectorSecretReferenceSchema
972
972
  ]);
973
+ McpOAuthConfigSchema = z.object({
974
+ type: z.literal("oauth"),
975
+ /** Optional public client id for authorization servers without dynamic registration. */
976
+ clientId: z.string().min(1).optional()
977
+ }).strict();
973
978
  McpServerSchema = z.object({
974
979
  command: z.string().optional(),
975
980
  args: z.array(z.string()).optional(),
@@ -979,6 +984,7 @@ defaultAgent: z.string().min(1).optional() }).strict().default({});
979
984
  url: McpHttpUrlSchema.optional(),
980
985
  transport: z.enum(["sse", "streamable-http"]).optional(),
981
986
  headers: z.record(z.string(), McpConfigScalarSchema).optional(),
987
+ auth: McpOAuthConfigSchema.optional(),
982
988
  connectionTimeoutMs: z.number().finite().positive().optional(),
983
989
  requestTimeoutMs: z.number().finite().positive().optional()
984
990
  }).catchall(z.unknown()).superRefine((value, ctx) => {
@@ -988,6 +994,24 @@ defaultAgent: z.string().min(1).optional() }).strict().default({});
988
994
  code: "custom",
989
995
  message: "MCP server cannot define both command and url"
990
996
  });
997
+ if (value.auth && !hasUrl) ctx.addIssue({
998
+ code: "custom",
999
+ path: ["auth"],
1000
+ message: "MCP OAuth requires an HTTP server URL"
1001
+ });
1002
+ if (value.auth && value.transport === "sse") ctx.addIssue({
1003
+ code: "custom",
1004
+ path: ["auth"],
1005
+ message: "MCP OAuth currently supports streamable HTTP only"
1006
+ });
1007
+ if (value.auth && value.headers) {
1008
+ const authorizationHeader = Object.keys(value.headers).find((key) => key.toLowerCase() === "authorization");
1009
+ if (authorizationHeader) ctx.addIssue({
1010
+ code: "custom",
1011
+ path: ["headers", authorizationHeader],
1012
+ message: "MCP OAuth cannot be combined with a static Authorization header"
1013
+ });
1014
+ }
991
1015
  });
992
1016
  McpConfigSchema = z.object({
993
1017
  servers: z.record(z.string(), McpServerSchema).optional(),
@@ -1148,4 +1172,4 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
1148
1172
  }));
1149
1173
  //#endregion
1150
1174
  init_schema();
1151
- export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, 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, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
1175
+ export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, 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, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
@@ -7,4 +7,4 @@ export type ConnectorAuthStartResult = {
7
7
  authorizationUrl?: string;
8
8
  connectionId?: string;
9
9
  };
10
- export declare function startConnectorAuthorization(definition: ConnectorDefinition, config?: Config): Promise<ConnectorAuthStartResult>;
10
+ export declare function startConnectorAuthorization(definition: ConnectorDefinition, config?: Config, instanceId?: string): Promise<ConnectorAuthStartResult>;
@@ -1,8 +1,29 @@
1
1
  import { startComposioAuthorize } from "./composio.js";
2
+ import { isManagedConnectorServer } from "./materialize.js";
2
3
  import { getConnectorInstance } from "./instances.js";
4
+ import { getMcpOAuthManager } from "../agent/mcp/oauth/mcp-oauth-manager.js";
3
5
  //#region src/connectors/auth-provider-registry.ts
4
- async function startConnectorAuthorization(definition, config) {
5
- if (definition.auth.mode !== "oauth" || definition.auth.provider !== "composio" || definition.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error(`Connector "${definition.id}" does not support Composio authorization.`);
6
+ async function startConnectorAuthorization(definition, config, instanceId) {
7
+ if (definition.auth.mode !== "oauth") throw new Error(`Connector "${definition.id}" does not use OAuth.`);
8
+ if (definition.runtime.type === "mcp") {
9
+ if (!config) throw new Error("Connector configuration is required for MCP authorization.");
10
+ const serverId = instanceId ?? definition.runtime.serverId;
11
+ const server = config.mcp?.servers?.[serverId];
12
+ if (!server) throw new Error(`Connector MCP server not found: ${serverId}`);
13
+ if (!isManagedConnectorServer(server) || server.xopcConnector.connectorId !== definition.id) throw new Error(`MCP server "${serverId}" is not managed by connector "${definition.id}".`);
14
+ const status = await getMcpOAuthManager().start({
15
+ serverId,
16
+ rawServer: server,
17
+ cfg: config
18
+ });
19
+ return {
20
+ connectorId: definition.id,
21
+ provider: "mcp",
22
+ status: status.status,
23
+ authorizationUrl: status.session?.authorizationUrl
24
+ };
25
+ }
26
+ if (definition.auth.provider !== "composio" || definition.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error(`Connector "${definition.id}" does not support OAuth authorization.`);
6
27
  const configuredAuthConfigId = config ? getConnectorInstance(config, definition.id)?.config?.authConfigId : void 0;
7
28
  const authConfigId = typeof configuredAuthConfigId === "string" && configuredAuthConfigId.trim() ? configuredAuthConfigId.trim() : void 0;
8
29
  const authorization = await startComposioAuthorize(definition.id, definition.runtime.toolkit, void 0, authConfigId);
@@ -1,9 +1,9 @@
1
1
  import { finishContextExtractionRun } from "../storage/sqlite/context-extraction-repository.js";
2
2
  import { listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
3
3
  import "../storage/sqlite/index.js";
4
+ import { focusLifecycle } from "../user-context/focus-lifecycle.js";
4
5
  import { upsertUserFocus } from "../user-context/sources/repository.js";
5
6
  import { claimRegisteredExtraction } from "../user-context/extraction/registry.js";
6
- import { focusLifecycle } from "../user-context/focus-lifecycle.js";
7
7
  import { allowsRemoteSourceProcessing } from "../user-context/sources/processing-policy.js";
8
8
  import { analyzeUnderstandingSources } from "../work-discovery/analyzer.js";
9
9
  import { createHash } from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  import { CredentialResolver, init_credentials } from "../auth/credentials.js";
2
2
  import { assertPreferredConnectorStrategy } from "./integration-strategy.js";
3
3
  import { getConnectorDefinition } from "./catalog.js";
4
- import { getConnectorInstance } from "./instances.js";
4
+ import { getConnectorInstance, getInstalledConnectorDefinition } from "./instances.js";
5
5
  import { getConnectorRuntimeAdapter } from "./runtime-adapter-registry.js";
6
6
  //#region src/connectors/install.ts
7
7
  init_credentials();
@@ -22,7 +22,7 @@ async function installConnector(config, connectorId, input, resolver = new Crede
22
22
  function updateConnectorConfig(config, instanceId, input) {
23
23
  const instance = getConnectorInstance(config, instanceId);
24
24
  if (!instance) throw new Error(`Connector instance not found: ${instanceId}`);
25
- const definition = getConnectorDefinition(instance.connectorId);
25
+ const definition = getInstalledConnectorDefinition(config, instanceId);
26
26
  if (!definition) throw new Error(`Unknown connector: ${instance.connectorId}`);
27
27
  const adapter = getConnectorRuntimeAdapter(definition.runtime.type);
28
28
  if (!adapter.update) throw new Error(`Connector type "${definition.runtime.type}" does not support config updates.`);
@@ -40,7 +40,7 @@ function uninstallConnector(config, instanceId) {
40
40
  if (config.mcp?.servers?.[instanceId] || config.connectors?.instances?.[instanceId]) throw new Error(`Connector instance "${instanceId}" is not managed by Connectors.`);
41
41
  throw new Error(`Connector instance not found: ${instanceId}`);
42
42
  }
43
- const definition = getConnectorDefinition(instance.connectorId);
43
+ const definition = getInstalledConnectorDefinition(config, instanceId);
44
44
  if (!definition) throw new Error(`Unknown connector: ${instance.connectorId}`);
45
45
  getConnectorRuntimeAdapter(definition.runtime.type).uninstall({
46
46
  config,
@@ -1,4 +1,5 @@
1
1
  import type { Config } from '../config/schema.js';
2
- import type { ConnectorInstance } from './types.js';
2
+ import type { ConnectorDefinition, ConnectorInstance } from './types.js';
3
3
  export declare function listConnectorInstances(config: Config): ConnectorInstance[];
4
4
  export declare function getConnectorInstance(config: Config, instanceId: string): ConnectorInstance | undefined;
5
+ export declare function getInstalledConnectorDefinition(config: Config, instanceId: string): ConnectorDefinition | undefined;
@@ -1,5 +1,5 @@
1
1
  import { getConnectorDefinition } from "./catalog.js";
2
- import { isManagedConnectorServer } from "./materialize.js";
2
+ import { connectorDefinitionFromManagedMarker, isManagedConnectorServer } from "./materialize.js";
3
3
  import { getConnectorAuditFromMarker, getConnectorUsageFromMarker } from "./usage.js";
4
4
  //#region src/connectors/instances.ts
5
5
  function readMarkerConfig(marker) {
@@ -9,7 +9,7 @@ function readMarkerConfig(marker) {
9
9
  }
10
10
  function secretStatusForServer(server) {
11
11
  const marker = server.xopcConnector;
12
- const definition = marker?.connectorId ? getConnectorDefinition(marker.connectorId) : void 0;
12
+ const definition = connectorDefinitionFromManagedMarker(marker) ?? (marker?.connectorId ? getConnectorDefinition(marker.connectorId) : void 0);
13
13
  const env = server.env && typeof server.env === "object" && !Array.isArray(server.env) ? server.env : {};
14
14
  const status = {};
15
15
  for (const secret of definition?.setup.secrets ?? []) {
@@ -24,7 +24,7 @@ function connectorInstanceFromRecord(instanceId, record) {
24
24
  const markerRecord = marker;
25
25
  if (markerRecord.managed !== true || typeof markerRecord.connectorId !== "string") return [];
26
26
  const connectorId = markerRecord.connectorId;
27
- const definition = getConnectorDefinition(connectorId);
27
+ const definition = connectorDefinitionFromManagedMarker(markerRecord) ?? getConnectorDefinition(connectorId);
28
28
  const runtime = record.runtime && typeof record.runtime === "object" && !Array.isArray(record.runtime) ? record.runtime : {};
29
29
  const runtimeType = runtime.type;
30
30
  if (runtimeType !== "composio" && runtimeType !== "channel" && runtimeType !== "nativeTool" && runtimeType !== "memorySource") return [];
@@ -66,7 +66,7 @@ function listConnectorInstances(config) {
66
66
  const mcpInstances = Object.entries(servers).flatMap(([serverId, server]) => {
67
67
  if (!isManagedConnectorServer(server)) return [];
68
68
  const connectorId = server.xopcConnector.connectorId;
69
- const definition = getConnectorDefinition(connectorId);
69
+ const definition = connectorDefinitionFromManagedMarker(server.xopcConnector) ?? getConnectorDefinition(connectorId);
70
70
  const enabled = server.xopcConnector.enabled !== false;
71
71
  const usage = getConnectorUsageFromMarker(server.xopcConnector);
72
72
  const lastHealthStatus = usage.lastHealthStatus;
@@ -99,5 +99,15 @@ function listConnectorInstances(config) {
99
99
  function getConnectorInstance(config, instanceId) {
100
100
  return listConnectorInstances(config).find((instance) => instance.instanceId === instanceId);
101
101
  }
102
+ function getInstalledConnectorDefinition(config, instanceId) {
103
+ const server = config.mcp?.servers?.[instanceId];
104
+ if (server && isManagedConnectorServer(server)) return connectorDefinitionFromManagedMarker(server.xopcConnector) ?? getConnectorDefinition(server.xopcConnector.connectorId);
105
+ const record = config.connectors?.instances?.[instanceId];
106
+ if (record && typeof record === "object" && !Array.isArray(record)) {
107
+ const marker = record.xopcConnector;
108
+ const connectorId = marker && typeof marker === "object" && !Array.isArray(marker) ? marker.connectorId : void 0;
109
+ return connectorDefinitionFromManagedMarker(marker) ?? (typeof connectorId === "string" ? getConnectorDefinition(connectorId) : void 0);
110
+ }
111
+ }
102
112
  //#endregion
103
- export { getConnectorInstance, listConnectorInstances };
113
+ export { getConnectorInstance, getInstalledConnectorDefinition, listConnectorInstances };