@xopcai/xopc 0.0.143 → 0.0.145

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 (259) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/Combination-DolwnuKi.js +41 -0
  4. package/dist/gateway/static/root/assets/{activity-center-store-jITiX2vJ.js → activity-center-store-3l9ahUqb.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DiME9u_P.js → agent-avatar-dicebear-BEUxdhZx.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-1bpT0xRO.js +2 -0
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-CRHSZJWi.js +1 -0
  8. package/dist/gateway/static/root/assets/{appearance-settings-DUfdNQqk.js → appearance-settings-BunADYJb.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-Cc4JgVUQ.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-B-Qk6cGr.js → archive-plugin-B6vTkH2A.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-Di6EEbQX.js → attachment-load-BjZXzaNv.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-DGxvRxtO.js → automation-suggestion-card-ZDA-Stg1.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-page-mb0fdVpq.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-ZaOZDH2I.js → binary-plugins-DYZfLvPz.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-BTFhjWfg.js → block-editor-C3MUlYC9.js} +46 -46
  16. package/dist/gateway/static/root/assets/browser-settings-page-Bb0xhaMN.js +8 -0
  17. package/dist/gateway/static/root/assets/capability-presets-api-BV76yN9a.js +1 -0
  18. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CUcGKZqC.js +2 -0
  19. package/dist/gateway/static/root/assets/channel-recipient-api-fTlTnWB4.js +1 -0
  20. package/dist/gateway/static/root/assets/channels-settings-BlSDMGdy.js +1 -0
  21. package/dist/gateway/static/root/assets/channels-status-swr-CJauF1CW.js +1 -0
  22. package/dist/gateway/static/root/assets/{code-editor--tMO38Tr.js → code-editor-D4_k-6QN.js} +1 -1
  23. package/dist/gateway/static/root/assets/connector-logo-BVFNT2zW.js +1 -0
  24. package/dist/gateway/static/root/assets/connectors-page-CMgAFGvb.js +2 -0
  25. package/dist/gateway/static/root/assets/copy-to-clipboard-HOJ79TWv.js +1 -0
  26. package/dist/gateway/static/root/assets/{desktop-pet---yzVxVR.js → desktop-pet-_jUmoXd3.js} +1 -1
  27. package/dist/gateway/static/root/assets/{desktop-pet-settings-Dc3gqBJE.js → desktop-pet-settings-DwGOy4AQ.js} +1 -1
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-DCmOGLtK.js → directory-picker-path-field-akvF0F-u.js} +1 -1
  29. package/dist/gateway/static/root/assets/dist-C99RGfAH.js +1 -0
  30. package/dist/gateway/static/root/assets/dreaming-settings-BLetQiYY.js +3 -0
  31. package/dist/gateway/static/root/assets/{extension-debug-page-ByaKTTq4.js → extension-debug-page-Cof2ncxE.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-BmRzHAZr.js → extension-page-CwWktRNz.js} +1 -1
  33. package/dist/gateway/static/root/assets/extension-settings-page-CuggWOIl.js +1 -0
  34. package/dist/gateway/static/root/assets/gateway-config-api-B7sxIbza.js +1 -0
  35. package/dist/gateway/static/root/assets/gateway-settings-DIv0eKMf.js +1 -0
  36. package/dist/gateway/static/root/assets/gateway-startup-retry-DtoLihQE.js +1 -0
  37. package/dist/gateway/static/root/assets/goal-create-dialog-C4Kw0mfS.js +1 -0
  38. package/dist/gateway/static/root/assets/goal-detail-page-BMmzYpZL.js +4 -0
  39. package/dist/gateway/static/root/assets/goals-config-api-B0jm5JaA.js +1 -0
  40. package/dist/gateway/static/root/assets/goals-page-CGeT77PC.js +2 -0
  41. package/dist/gateway/static/root/assets/goals-settings-N5_iL7es.js +1 -0
  42. package/dist/gateway/static/root/assets/heartbeat-settings-XzH3lbRR.js +1 -0
  43. package/dist/gateway/static/root/assets/{html-workspace-editor-COqmtESs.js → html-workspace-editor-C3DKAkMc.js} +1 -1
  44. package/dist/gateway/static/root/assets/index-CSLF84-Q.css +1 -0
  45. package/dist/gateway/static/root/assets/index-I-ZCenVw.js +259 -0
  46. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-x_v0nrIi.js +1 -0
  47. package/dist/gateway/static/root/assets/locale-store-CiM-D9jA.js +1 -0
  48. package/dist/gateway/static/root/assets/logs-page-BSh1t8cD.js +7 -0
  49. package/dist/gateway/static/root/assets/markdown-editor-BvUebh3C.js +2 -0
  50. package/dist/gateway/static/root/assets/{markdown-split-Dw-yE2-y.js → markdown-split-5rJx5flj.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-D9NNNUgE.js → media-plugins-DYXccwAd.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-Cb1VMeqP.js +5 -0
  53. package/dist/gateway/static/root/assets/models-hub-panel-BNpTenAI.js +2 -0
  54. package/dist/gateway/static/root/assets/{notes-page-CRgbJGgk.js → notes-page-BgLyndCO.js} +1 -1
  55. package/dist/gateway/static/root/assets/notes-workbench-teklkhcE.js +4 -0
  56. package/dist/gateway/static/root/assets/{page-tabs-D4hkWVt_.js → page-tabs-6Al9_sGz.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-CIckv0uy.js → preview-open-alternatives-Cm3G72Hv.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-CCB_dKoh.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-VOAFAHYj.js +1 -0
  60. package/dist/gateway/static/root/assets/remote-access-hub-USYu64Ru.js +1 -0
  61. package/dist/gateway/static/root/assets/{save-bar-controls-B0b42kB2.js → save-bar-controls-BYtfzu_F.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schedule-field-BtjEkczK.js → schedule-field-CvIRc6yK.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schema-form-Bf0bk3i6.js → schema-form-CQuKx0n7.js} +1 -1
  64. package/dist/gateway/static/root/assets/sessions-page-oGC8O5h_.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-advanced-gate-D4rP66R1.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-collapsible-section-BTKTdTNX.js → settings-collapsible-section-CF3HHM-t.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-form-section-DL4P0sAj.js → settings-form-section-CwWjoRN6.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BV6KFNj4.js → settings-loading-skeleton-aUFmJa13.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-B_4DsX5W.js → settings-page-B2UUU9TF.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-layout-CyGlrInB.js → settings-page-layout-DqpbTWqI.js} +1 -1
  71. package/dist/gateway/static/root/assets/setup-status-panel-Ck9keROI.js +1 -0
  72. package/dist/gateway/static/root/assets/share-preview-page-BOhlPsS1.js +2 -0
  73. package/dist/gateway/static/root/assets/shares-settings-BYLsCuqj.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-BNHUyVML.js +1 -0
  75. package/dist/gateway/static/root/assets/skills-page-CpXbQH4n.js +2 -0
  76. package/dist/gateway/static/root/assets/{system-settings-panel-D85fBBuI.js → system-settings-panel-CWxSvuwD.js} +1 -1
  77. package/dist/gateway/static/root/assets/{theme-store-Bt6vAkSB.js → theme-store-C9Dxcppm.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib-CwEuYrHX.js → typed-models-lib-qROAvqTw.js} +1 -1
  79. package/dist/gateway/static/root/assets/use-channel-catalog-DE9cpn4G.js +1 -0
  80. package/dist/gateway/static/root/assets/user-context-page-DbNEK4Yp.js +1 -0
  81. package/dist/gateway/static/root/assets/user-profile-fields-editor-CWxc0ghP.js +1 -0
  82. package/dist/gateway/static/root/assets/{user-profile-settings-panel-CWM0fEpb.js → user-profile-settings-panel-DW-Up6vt.js} +1 -1
  83. package/dist/gateway/static/root/assets/{utils--BO6xT3u.js → utils-D53uRXVr.js} +1 -1
  84. package/dist/gateway/static/root/assets/{vendor-codemirror-C1WKjCk5.js → vendor-codemirror--gTq3YAI.js} +17 -17
  85. package/dist/gateway/static/root/assets/voice-api-key-field-Cs7MOrg0.js +1 -0
  86. package/dist/gateway/static/root/assets/work-item-detail-page-D1ziG1Pp.js +1 -0
  87. package/dist/gateway/static/root/assets/workflow-run-setup-panel-D_x9ELJp.js +3 -0
  88. package/dist/gateway/static/root/assets/workflows-page-DHGV_n6i.js +11 -0
  89. package/dist/gateway/static/root/index.html +10 -10
  90. package/dist/package.js +1 -1
  91. package/dist/src/agent/embedded/session-runner.js +3 -3
  92. package/dist/src/agent/embedded/session-runner.js.map +1 -1
  93. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +3 -1
  94. package/dist/src/agent/embedded/xopc-auth-storage.js +11 -1
  95. package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
  96. package/dist/src/agent/memory/dreaming/config.js +1 -1
  97. package/dist/src/agent-runtime/index.js +1 -1
  98. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  99. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  100. package/dist/src/config/agent-profile.js +1 -1
  101. package/dist/src/config/index.js +2 -2
  102. package/dist/src/config/schema.d.ts +60 -5
  103. package/dist/src/config/schema.js +30 -9
  104. package/dist/src/config/schema.js.map +1 -1
  105. package/dist/src/connectors/composio-catalog.js +11 -2
  106. package/dist/src/connectors/composio-catalog.js.map +1 -1
  107. package/dist/src/connectors/connector-memory-sync.js +135 -26
  108. package/dist/src/connectors/connector-memory-sync.js.map +1 -1
  109. package/dist/src/gateway/agents-admin.js +1 -1
  110. package/dist/src/gateway/heartbeat/service.js +1 -1
  111. package/dist/src/gateway/hono/app.js +1 -1
  112. package/dist/src/gateway/hono/app.js.map +1 -1
  113. package/dist/src/gateway/hono/lib/config-payload.d.ts +11 -0
  114. package/dist/src/gateway/hono/lib/config-payload.js +1 -0
  115. package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
  116. package/dist/src/gateway/hono/routes/config-patch/misc.js +6 -1
  117. package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
  118. package/dist/src/gateway/hono/routes/memory.js +11 -1
  119. package/dist/src/gateway/hono/routes/memory.js.map +1 -1
  120. package/dist/src/gateway/hono/routes/status.js +3 -0
  121. package/dist/src/gateway/hono/routes/status.js.map +1 -1
  122. package/dist/src/gateway/hono/routes/voice.d.ts +5 -5
  123. package/dist/src/gateway/hono/routes/voice.js +288 -62
  124. package/dist/src/gateway/hono/routes/voice.js.map +1 -1
  125. package/dist/src/gateway/hono/routes/you.js +5 -1
  126. package/dist/src/gateway/hono/routes/you.js.map +1 -1
  127. package/dist/src/gateway/service.d.ts +8 -0
  128. package/dist/src/gateway/service.js +41 -11
  129. package/dist/src/gateway/service.js.map +1 -1
  130. package/dist/src/heartbeat/index.js +1 -1
  131. package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +21 -0
  132. package/dist/src/knowledge/connected-knowledge-pipeline.js +267 -0
  133. package/dist/src/knowledge/connected-knowledge-pipeline.js.map +1 -0
  134. package/dist/src/knowledge/coordinator.d.ts +10 -0
  135. package/dist/src/knowledge/coordinator.js +52 -0
  136. package/dist/src/knowledge/coordinator.js.map +1 -0
  137. package/dist/src/knowledge/index.d.ts +2 -0
  138. package/dist/src/knowledge/index.js +3 -1
  139. package/dist/src/knowledge/ingestion-service.d.ts +7 -1
  140. package/dist/src/knowledge/ingestion-service.js +28 -0
  141. package/dist/src/knowledge/ingestion-service.js.map +1 -1
  142. package/dist/src/knowledge/types.d.ts +18 -0
  143. package/dist/src/media-understanding/audio-transcription-runner.js +5 -3
  144. package/dist/src/media-understanding/audio-transcription-runner.js.map +1 -1
  145. package/dist/src/media-understanding/runner.js +8 -3
  146. package/dist/src/media-understanding/runner.js.map +1 -1
  147. package/dist/src/media-understanding/types.d.ts +7 -0
  148. package/dist/src/storage/sqlite/index.d.ts +1 -1
  149. package/dist/src/storage/sqlite/index.js +2 -2
  150. package/dist/src/storage/sqlite/knowledge-repository.d.ts +26 -1
  151. package/dist/src/storage/sqlite/knowledge-repository.js +120 -6
  152. package/dist/src/storage/sqlite/knowledge-repository.js.map +1 -1
  153. package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +47 -0
  154. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  155. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  156. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  157. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  158. package/dist/src/storage/sqlite/schema.js +1 -1
  159. package/dist/src/user-context/projection.d.ts +13 -4
  160. package/dist/src/user-context/projection.js +19 -7
  161. package/dist/src/user-context/projection.js.map +1 -1
  162. package/dist/src/voice/language-profile.d.ts +20 -0
  163. package/dist/src/voice/language-profile.js +156 -0
  164. package/dist/src/voice/language-profile.js.map +1 -0
  165. package/dist/src/voice/local/model-files.d.ts +14 -0
  166. package/dist/src/voice/local/model-files.js +94 -0
  167. package/dist/src/voice/local/model-files.js.map +1 -0
  168. package/dist/src/voice/local/model-manager.d.ts +18 -0
  169. package/dist/src/voice/local/model-manager.js +135 -0
  170. package/dist/src/voice/local/model-manager.js.map +1 -0
  171. package/dist/src/voice/local/models.d.ts +28 -0
  172. package/dist/src/voice/local/models.js +101 -0
  173. package/dist/src/voice/local/models.js.map +1 -0
  174. package/dist/src/voice/local/runtime-client.d.ts +26 -0
  175. package/dist/src/voice/local/runtime-client.js +166 -0
  176. package/dist/src/voice/local/runtime-client.js.map +1 -0
  177. package/dist/src/voice/local/runtime-dispatcher.d.ts +9 -0
  178. package/dist/src/voice/local/runtime-dispatcher.js +22 -0
  179. package/dist/src/voice/local/runtime-dispatcher.js.map +1 -0
  180. package/dist/src/voice/local/runtime-worker.d.ts +1 -0
  181. package/dist/src/voice/local/runtime-worker.js +249 -0
  182. package/dist/src/voice/local/runtime-worker.js.map +1 -0
  183. package/dist/src/voice/local/wav.d.ts +6 -0
  184. package/dist/src/voice/local/wav.js +69 -0
  185. package/dist/src/voice/local/wav.js.map +1 -0
  186. package/dist/src/voice/metadata/builtin.js +46 -0
  187. package/dist/src/voice/metadata/builtin.js.map +1 -1
  188. package/dist/src/voice/stt/factory.js +8 -2
  189. package/dist/src/voice/stt/factory.js.map +1 -1
  190. package/dist/src/voice/stt/providers/alibaba-transcription.js +14 -8
  191. package/dist/src/voice/stt/providers/alibaba-transcription.js.map +1 -1
  192. package/dist/src/voice/stt/providers/index.d.ts +1 -0
  193. package/dist/src/voice/stt/providers/index.js +2 -1
  194. package/dist/src/voice/stt/providers/local-transcription.d.ts +2 -0
  195. package/dist/src/voice/stt/providers/local-transcription.js +51 -0
  196. package/dist/src/voice/stt/providers/local-transcription.js.map +1 -0
  197. package/dist/src/voice/stt/providers/openai-transcription.js +5 -3
  198. package/dist/src/voice/stt/providers/openai-transcription.js.map +1 -1
  199. package/dist/src/voice/stt/transcribe-core.js +5 -4
  200. package/dist/src/voice/stt/transcribe-core.js.map +1 -1
  201. package/dist/src/voice/stt/types.d.ts +4 -0
  202. package/dist/src/voice/stt/types.js +5 -4
  203. package/dist/src/voice/stt/types.js.map +1 -1
  204. package/dist/src/voice/tts/providers/edge-speech.js +2 -2
  205. package/dist/src/voice/tts/providers/edge-speech.js.map +1 -1
  206. package/dist/src/voice/tts/types.js +3 -3
  207. package/dist/src/voice/tts/types.js.map +1 -1
  208. package/package.json +4 -2
  209. package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +0 -41
  210. package/dist/gateway/static/root/assets/agents-DzBXhZXO.js +0 -2
  211. package/dist/gateway/static/root/assets/app-management-settings-panel-Cuo7SbUP.js +0 -1
  212. package/dist/gateway/static/root/assets/apps-page-CKuKK5AU.js +0 -1
  213. package/dist/gateway/static/root/assets/automations-page-D-FF_WKV.js +0 -4
  214. package/dist/gateway/static/root/assets/browser-settings-page-BvKLdEQt.js +0 -8
  215. package/dist/gateway/static/root/assets/capability-presets-api-BU-pVZiZ.js +0 -1
  216. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DgyeEwzh.js +0 -2
  217. package/dist/gateway/static/root/assets/channel-recipient-api-DuulnhIj.js +0 -1
  218. package/dist/gateway/static/root/assets/channels-settings-BbVsdD_I.js +0 -1
  219. package/dist/gateway/static/root/assets/channels-status-swr-B5lVrUsN.js +0 -1
  220. package/dist/gateway/static/root/assets/connectors-page-B8QqVy3I.js +0 -2
  221. package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +0 -1
  222. package/dist/gateway/static/root/assets/dreaming-settings-BgT5KZVe.js +0 -3
  223. package/dist/gateway/static/root/assets/extension-settings-page-JUtwIhbF.js +0 -1
  224. package/dist/gateway/static/root/assets/fetch-8QNN25Sh.js +0 -1
  225. package/dist/gateway/static/root/assets/gateway-config-api-CxicF50_.js +0 -1
  226. package/dist/gateway/static/root/assets/gateway-settings-Bz2I_EO5.js +0 -1
  227. package/dist/gateway/static/root/assets/gateway-startup-retry-5YBnS9Fj.js +0 -1
  228. package/dist/gateway/static/root/assets/goal-create-dialog-VcoyuZGN.js +0 -1
  229. package/dist/gateway/static/root/assets/goal-detail-page-Cilkap2G.js +0 -4
  230. package/dist/gateway/static/root/assets/goals-config-api-CwcHRdC0.js +0 -1
  231. package/dist/gateway/static/root/assets/goals-page-C6eoni4z.js +0 -2
  232. package/dist/gateway/static/root/assets/goals-settings-o4i-qAOS.js +0 -1
  233. package/dist/gateway/static/root/assets/heartbeat-settings-DQQkETX8.js +0 -1
  234. package/dist/gateway/static/root/assets/index-BKRqeRHm.js +0 -257
  235. package/dist/gateway/static/root/assets/index-CphxClbs.css +0 -1
  236. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-LT6qB-ua.js +0 -1
  237. package/dist/gateway/static/root/assets/locale-store-Ba72bFmP.js +0 -1
  238. package/dist/gateway/static/root/assets/logs-page-Dli2e3fS.js +0 -7
  239. package/dist/gateway/static/root/assets/markdown-editor-jD1LPiP-.js +0 -2
  240. package/dist/gateway/static/root/assets/messages-CzKxM6I4.js +0 -5
  241. package/dist/gateway/static/root/assets/models-hub-panel-DVn2Q1Ik.js +0 -2
  242. package/dist/gateway/static/root/assets/notes-workbench-BxZRHLWx.js +0 -2
  243. package/dist/gateway/static/root/assets/project-detail-page-Doz53xLn.js +0 -1
  244. package/dist/gateway/static/root/assets/projects-page-DoMtcRLg.js +0 -1
  245. package/dist/gateway/static/root/assets/remote-access-hub-BeHVEgrm.js +0 -1
  246. package/dist/gateway/static/root/assets/sessions-page-Bk4bQsBe.js +0 -1
  247. package/dist/gateway/static/root/assets/settings-advanced-gate-DdFyaRMm.js +0 -1
  248. package/dist/gateway/static/root/assets/setup-status-panel-DJ1_MLgX.js +0 -1
  249. package/dist/gateway/static/root/assets/share-preview-page-BQBV7YrV.js +0 -2
  250. package/dist/gateway/static/root/assets/shares-settings-0VuFLBeU.js +0 -1
  251. package/dist/gateway/static/root/assets/skill-reload-api-DO87Ckeo.js +0 -1
  252. package/dist/gateway/static/root/assets/skills-page-D3VdtxAn.js +0 -2
  253. package/dist/gateway/static/root/assets/use-channel-catalog-COXIfXcl.js +0 -1
  254. package/dist/gateway/static/root/assets/user-context-page-m9JVQ73F.js +0 -1
  255. package/dist/gateway/static/root/assets/user-profile-fields-editor-DtQiuY7E.js +0 -1
  256. package/dist/gateway/static/root/assets/voice-api-key-field-LoT3wgZ9.js +0 -1
  257. package/dist/gateway/static/root/assets/work-item-detail-page-DSTMz_mO.js +0 -1
  258. package/dist/gateway/static/root/assets/workflow-run-setup-panel-B35lJzvm.js +0 -3
  259. package/dist/gateway/static/root/assets/workflows-page-BfSm9oR8.js +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":[],"sources":["../../../src/config/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n AgentConfigEntrySchema,\n CapabilityPresetSchema,\n DEFAULT_CAPABILITY_PRESET_ID,\n} from '../agent-manifest/schema.js';\nimport { linearizePresetIds } from '../agent-manifest/preset-chain.js';\nimport { checkCacheDir } from '../browser/cache-dir-policy.js';\nimport { DEFAULT_AGENT_MODELS } from './default-model.js';\nimport { validatePublicUrl } from './public-url.js';\n\n// ============================================\n// Agent Configs\n// ============================================\n\n/**\n * Agent model ref. Always an object with explicit `primary` and optional\n * `fallbacks` chain. No string-form shorthand — every write site builds the\n * object explicitly so reads never branch on shape.\n */\nexport const AgentModelRefSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type AgentModelConfig = z.infer<typeof AgentModelRefSchema>;\n\n/**\n * Image-generation model ref. {@link AgentModelRefSchema} plus runtime knobs\n * (`timeoutMs`, `autoProviderFallback`) used by the image-generation runtime.\n */\nexport const AgentImageGenerationModelSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n /** Hard cap for the whole generation attempt (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /**\n * When all `primary + fallbacks` candidates fail, sweep every other\n * configured provider before giving up.\n */\n autoProviderFallback: z.boolean().optional(),\n })\n .strict();\n\nexport type AgentImageGenerationModelConfig = z.infer<typeof AgentImageGenerationModelSchema>;\n\nexport const AgentTypedModelRoleSchema = z\n .object({\n description: z.string().max(500).optional(),\n model: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.model)) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport type AgentTypedModelRole = z.infer<typeof AgentTypedModelRoleSchema>;\n\nconst AgentTypedModelRolesSchema = z\n .record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), AgentTypedModelRoleSchema)\n .optional();\n\nexport const AgentModelsSchema = z\n .object({\n defaultRole: z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/).optional(),\n roles: AgentTypedModelRolesSchema,\n imageModel: AgentModelRefSchema.optional(),\n imageGenerationModel: AgentImageGenerationModelSchema.optional(),\n })\n .strict()\n .optional();\n\nexport type AgentModelsConfig = z.infer<typeof AgentModelsSchema>;\n\nexport type AgentTypedModel = AgentTypedModelRole & { id: string };\n\nexport const AgentsConfigSchema = z.object({\n /** Default agent id when not specified (routing / session creation). */\n default: z.string().optional(),\n /** Protected global defaults preset applied before each agent's own presets. */\n defaultPreset: z.string().default(DEFAULT_CAPABILITY_PRESET_ID),\n capabilityPresets: z.record(z.string(), CapabilityPresetSchema).default({}),\n list: z.array(AgentConfigEntrySchema).default([]),\n}).strict().default({\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: DEFAULT_AGENT_MODELS,\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Smart Assistant',\n description: 'General-purpose personal assistant.',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n understanding: {\n enabled: true,\n adaptiveCadence: true,\n reviewIntervalTurns: 10,\n maxHistoryMessages: 80,\n maxDurationMs: 120_000,\n },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n});\n\nconst BrowserCloudConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n region: z.string().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserExtensionConfigSchema = z\n .object({\n port: z.number().int().min(1024).max(65535).optional(),\n host: z.string().min(1).optional(),\n connectionTimeout: z.number().int().positive().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserCloakConfigSchema = z\n .object({\n keepOpen: z.boolean().optional(),\n temporaryProfile: z.boolean().optional(),\n cacheDir: z.string().optional().superRefine((value, ctx) => {\n const result = checkCacheDir(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: result.message });\n }\n }),\n binaryPath: z.string().optional(),\n timezone: z.string().optional(),\n locale: z.string().optional(),\n webrtcIp: z.string().optional(),\n fingerprintPlatform: z.string().optional(),\n extraArgs: z.array(z.string()).optional(),\n })\n .strict()\n .optional();\n\nexport const BrowserConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n backend: z.enum(['local', 'cdp', 'cloud', 'extension', 'cloakbrowser']).default('extension'),\n headless: z.boolean().optional(),\n allowPrivateUrls: z.boolean().optional(),\n commandTimeout: z.number().int().min(5).max(900).optional(),\n cloudProvider: z.enum(['local', 'browserbase', 'browser-use']).optional(),\n cloud: BrowserCloudConfigSchema,\n cdpUrl: z.string().optional(),\n extension: BrowserExtensionConfigSchema,\n cloakbrowser: BrowserCloakConfigSchema,\n humanize: z.boolean().optional(),\n humanPreset: z.enum(['default', 'careful']).optional(),\n dialogPolicy: z.enum(['must_respond', 'auto_dismiss', 'auto_accept']).optional(),\n dialogTimeoutSeconds: z.number().int().positive().optional(),\n })\n .strict()\n .default({ enabled: true, backend: 'extension' });\n\n// ============================================\n// Channel Configs (per-channel Zod lives in bundled extensions; root schema is open)\n// ============================================\n\nexport {\n TelegramTopicConfigSchema,\n TelegramGroupConfigSchema,\n TelegramAccountConfigSchema,\n TelegramConfigSchema,\n} from '../../extensions/telegram/src/config-schema.js';\nexport type { TelegramConfig } from '../../extensions/telegram/src/config-schema.js';\nexport { WeixinAccountConfigSchema, WeixinConfigSchema } from '../../extensions/weixin/src/config-schema.js';\nexport type { WeixinConfig } from '../../extensions/weixin/src/config-schema.js';\n// ============================================\n// Session Routing Configuration\n// ============================================\n\nexport const BindingMatchSchema = z.object({\n channel: z.string(),\n accountId: z.string().optional(),\n peerKind: z.string().optional(),\n peerId: z.string().optional(),\n guildId: z.string().optional(),\n teamId: z.string().optional(),\n memberRoleIds: z.array(z.string()).optional(),\n});\n\nexport const BindingRuleSchema = z.object({\n id: z.string().optional(),\n agentId: z.string(),\n priority: z.number().default(100),\n match: BindingMatchSchema,\n enabled: z.boolean().default(true),\n});\n\nexport const BindingsConfigSchema = z.array(BindingRuleSchema).default([]);\n\nexport const SessionDmScopeSchema = z.enum([\n 'main',\n 'per-peer',\n 'per-channel-peer',\n 'per-account-channel-peer',\n]);\n\nexport const SessionStorageConfigSchema = z.object({\n pruneAfterMs: z.number().optional(),\n maxEntries: z.number().optional(),\n});\n\nexport const SessionResetModeSchema = z.enum(['daily', 'idle']);\n\nexport const SessionResetConfigSchema = z\n .object({\n mode: SessionResetModeSchema.optional(),\n /** Local hour (0–23) for the daily reset boundary. */\n atHour: z.number().int().min(0).max(23).optional(),\n /** Sliding idle window (minutes). When set with daily mode, whichever expires first wins. */\n idleMinutes: z.number().int().min(0).optional(),\n })\n .strict();\n\nexport const SessionResetByTypeSchema = z\n .object({\n direct: SessionResetConfigSchema.optional(),\n group: SessionResetConfigSchema.optional(),\n thread: SessionResetConfigSchema.optional(),\n })\n .strict();\n\nexport const SessionScopeSchema = z.enum(['per-sender', 'global']);\n\nexport const SessionConfigSchema = z.object({\n scope: SessionScopeSchema.default('per-sender'),\n mainKey: z.string().default('main'),\n dmScope: SessionDmScopeSchema.default('main'),\n identityLinks: z.record(z.string(), z.array(z.string())).optional(),\n resetTriggers: z.array(z.string()).optional(),\n idleMinutes: z.number().int().positive().optional(),\n reset: SessionResetConfigSchema.optional(),\n resetByType: SessionResetByTypeSchema.optional(),\n resetByChannel: z.record(z.string(), SessionResetConfigSchema).optional(),\n storage: SessionStorageConfigSchema.optional(),\n}).default({\n scope: 'per-sender',\n mainKey: 'main',\n dmScope: 'main',\n});\n\n/** Channel buckets — shapes validated post-parse by registered channel plugins. */\nexport const ChannelsConfigSchema = z.record(z.string(), z.unknown()).default({});\n\nexport const SearchProviderEntrySchema = z.object({\n type: z.enum(['brave', 'tavily', 'bing', 'searxng']),\n apiKey: z.string().optional(),\n /** SearXNG instance base URL (e.g. http://localhost:8080) */\n url: z.string().optional(),\n disabled: z.boolean().optional(),\n});\n\nexport type SearchProviderEntry = z.infer<typeof SearchProviderEntrySchema>;\n\nexport const WebSearchConfigSchema = z.object({\n maxResults: z.number().default(5),\n /** Ordered API providers; empty → HTML fallback only */\n providers: z.array(SearchProviderEntrySchema).default([]),\n});\n\nexport type WebSearchConfig = z.infer<typeof WebSearchConfigSchema>;\n\nexport const WebsiteBlocklistSchema = z.object({\n /** Master switch. Default false (no blocking). */\n enabled: z.boolean().default(false),\n /** Domain patterns to block (e.g. \"example.com\", \"*.evil.org\"). */\n domains: z.array(z.string()).default([]),\n});\n\nexport type WebsiteBlocklistConfig = z.infer<typeof WebsiteBlocklistSchema>;\n\nexport const WebToolsConfigSchema = z.object({\n /** Search result HTML fallback: cn → Bing, otherwise DuckDuckGo */\n region: z.enum(['cn', 'global']).optional(),\n search: WebSearchConfigSchema.optional(),\n /** Domain blocklist for web_fetch / web_extract / browser tools. */\n blocklist: WebsiteBlocklistSchema.optional(),\n});\n\nexport type WebToolsConfig = z.infer<typeof WebToolsConfigSchema>;\n\nexport const ToolsConfigSchema = z.object({\n web: WebToolsConfigSchema.optional(),\n /**\n * Per-capability media providers. Currently only `audio` (STT) is wired;\n * `image` / `video` slots are reserved for future capabilities.\n */\n media: z.lazy(() => ToolsMediaConfigSchema),\n}).default({\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n});\n\n// ============================================\n// Gateway Configuration\n// ============================================\n\nexport const GatewayAuthRateLimitSchema = z\n .object({\n enabled: z.boolean().default(true),\n maxAttempts: z.number().int().min(1).default(5),\n windowMs: z.number().default(900_000),\n blockDurationMs: z.number().default(300_000),\n /** OpenClaw alias for blockDurationMs. */\n lockoutMs: z.number().optional(),\n /** Skip rate limiting for loopback client IPs (default true). Remote browser Origin requests never exempt. */\n exemptLoopback: z.boolean().default(true),\n /**\n * Coalesce same-client failures arriving within this window into a single\n * attempt. Absorbs SPA fan-out / SDK auto-retry storms without weakening\n * brute-force protection (deliberate attackers are still rate-limited to\n * one effective attempt per window). Set to 0 to disable.\n */\n burstCoalesceMs: z.number().int().min(0).default(1000),\n })\n .optional();\n\nexport const GatewaySecuritySchema = z\n .object({\n /** When true, non-loopback binds require explicit gateway.auth.rateLimit configuration. */\n strict: z.boolean().optional(),\n })\n .optional();\n\nexport const GatewayTrustedProxySchema = z\n .object({\n /** Header set by the reverse proxy with the authenticated user identity. */\n userHeader: z.string().min(1),\n /** Additional headers that must be present (e.g. proxy auth markers). */\n requiredHeaders: z.array(z.string()).optional(),\n /** When non-empty, only these user identities are allowed. */\n allowUsers: z.array(z.string()).optional(),\n /** Allow trusted-proxy auth when the TCP source is loopback (same-host reverse proxy). */\n allowLoopback: z.boolean().optional(),\n })\n .strict();\n\nexport const GatewayAuthSchema = z\n .object({\n mode: z.enum(['none', 'token', 'password', 'trusted-proxy']).default('token'),\n token: z.string().optional(),\n password: z.string().optional(),\n /** When true (default for Serve), browser UI may auth via Tailscale identity headers. API routes still require token. */\n allowTailscale: z.boolean().optional(),\n rateLimit: GatewayAuthRateLimitSchema,\n trustedProxy: GatewayTrustedProxySchema.optional(),\n })\n .default({\n mode: 'token',\n });\n\nexport const GatewayTailscaleConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const GatewayTailscaleSchema = z\n .object({\n mode: z.enum(['off', 'serve', 'funnel']).default('off'),\n resetOnExit: z.boolean().default(true),\n consent: GatewayTailscaleConsentSchema.optional(),\n })\n .default({\n mode: 'off',\n resetOnExit: true,\n });\n\nexport const GatewayRemoteSchema = z.object({\n url: z.string().url(),\n token: z.string().optional(),\n password: z.string().optional(),\n transport: z.enum(['direct', 'ssh']).default('direct'),\n sshTarget: z.string().optional(),\n sshIdentity: z.string().optional(),\n tlsFingerprint: z.string().optional(),\n});\n\nexport const GatewayTlsSchema = z\n .object({\n enabled: z.boolean().default(false),\n autoGenerate: z.boolean().default(false),\n certPath: z.string().optional(),\n keyPath: z.string().optional(),\n })\n .default({\n enabled: false,\n autoGenerate: false,\n });\n\nexport const GatewayModeSchema = z.enum(['local', 'remote']).default('local');\n\nexport const HeartbeatConfigSchema = z\n .object({\n enabled: z.boolean(),\n intervalMs: z.number(),\n /** When false, heartbeat instructions are only sent during heartbeat polling turns (not in every chat system prompt). */\n includeSystemPromptSection: z.boolean().optional().default(false),\n target: z.string().optional(),\n targetChatId: z.string().optional(),\n prompt: z.string().optional(),\n ackMaxChars: z.number().optional(),\n isolatedSession: z.boolean().optional(),\n activeHours: z\n .object({\n start: z.string(),\n end: z.string(),\n timezone: z.string().optional(),\n })\n .optional(),\n })\n .default({\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n });\n\nexport const GatewayChannelConnectDeferModeSchema = z.enum(['auto', 'off', 'explicit']);\n\nexport const TunnelConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const TunnelConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n brokerUrl: z.string().url().default('https://frp.xopc.ai/api'),\n /** Broker register API secret (env `XOPC_TUNNEL_REGISTRATION_SECRET` overrides when set). */\n registrationSecret: z.string().min(1).optional(),\n autoStart: z.boolean().default(false),\n subdomain: z.string().optional(),\n consent: TunnelConsentSchema.optional(),\n })\n .default({\n enabled: false,\n brokerUrl: 'https://frp.xopc.ai/api',\n autoStart: false,\n });\n\nexport type TunnelConfig = z.infer<typeof TunnelConfigSchema>;\n\n/**\n * Workspace-scoped concerns (file import, etc.). Distinct from\n * agent manifest workspace roots; this block carries\n * feature configuration for workspace-related routes.\n */\nexport const WorkspaceImportConfigSchema = z.object({\n /** Workspace-relative subdir for imported files. Default `imports`. */\n targetDir: z.string().default('imports'),\n /** Per-file byte cap. Default 100 MiB. */\n maxBytes: z.number().int().min(1024).max(10_737_418_240).default(104_857_600),\n /** When false, the route rejects `onConflict: 'overwrite'`. Default true. */\n allowOverwrite: z.boolean().default(true),\n});\nexport type WorkspaceImportConfig = z.infer<typeof WorkspaceImportConfigSchema>;\n\nexport const WorkspaceConfigSchema = z.object({\n import: WorkspaceImportConfigSchema.optional(),\n}).optional();\nexport type WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;\n\nexport const GatewayBindModeSchema = z.enum(['auto', 'loopback', 'lan', 'tailnet', 'custom']);\n\nexport const GatewayConfigSchema = z.object({\n /** Semantic bind mode. */\n bind: GatewayBindModeSchema.optional(),\n /** IPv4 listen address when `bind` is `custom`. */\n customBindHost: z.string().optional(),\n port: z.number().optional(),\n /** local: this process runs the gateway; remote: CLI clients target gateway.remote. */\n mode: GatewayModeSchema.optional(),\n /** Persistent remote gateway target for CLI/TUI/MCP when mode=remote. */\n remote: GatewayRemoteSchema.optional(),\n tailscale: GatewayTailscaleSchema.optional(),\n tls: GatewayTlsSchema.optional(),\n auth: GatewayAuthSchema.optional(),\n heartbeat: HeartbeatConfigSchema.optional(),\n maxSseConnections: z.number().optional(),\n corsOrigins: z.array(z.string()).optional(),\n /**\n * Reverse-proxy publicly reachable URL (e.g. `https://gateway.example.com`).\n * Optional. When set, mobile pairing surfaces this URL as the preferred\n * baseUrl and it is auto-added to the browser CORS/CSRF allowlist.\n * - Must be a URL with no path / query / userinfo.\n * - Must use `https:` for public hosts; `http:` is only allowed when the\n * hostname is in an RFC1918 / `.local` private range.\n */\n publicUrl: z\n .string()\n .superRefine((value, ctx) => {\n const result = validatePublicUrl(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: `gateway.publicUrl: ${result.message}` });\n }\n })\n .optional(),\n /** Dangerous: allow browser Origin to match the HTTP Host header when not in corsOrigins. */\n dangerouslyAllowHostHeaderOriginFallback: z.boolean().optional(),\n /** CIDRs or exact IPs of reverse proxies allowed to terminate auth (trusted-proxy mode). */\n trustedProxies: z.array(z.string()).optional(),\n /** When true, fall back to X-Real-IP if X-Forwarded-For chain parsing fails. Default false (fail closed). */\n allowRealIpFallback: z.boolean().optional(),\n security: GatewaySecuritySchema,\n /**\n * How channel `start()` is split around HTTP listen when using `GatewayServer`.\n * - `auto` (default): defer ids come from channel plugin `meta.deferConnectUntilAfterListen` + enabled config.\n * - `off`: always start all channels in phase1 (troubleshooting / strict ordering).\n * - `explicit`: defer only `channelConnectDeferIds` (empty = defer none).\n */\n channelConnectDeferMode: GatewayChannelConnectDeferModeSchema.optional(),\n /** When `channelConnectDeferMode` is `explicit`, these channel plugin ids are deferred until after listen. */\n channelConnectDeferIds: z.array(z.string().min(1)).max(24).optional(),\n /** Removed from the defer set (applied after `auto` or `explicit` resolution). */\n channelConnectDeferSkipIds: z.array(z.string().min(1)).max(24).optional(),\n /** Default skills marketplace provider id. Built-in: 'store', 'skillhub', 'clawhub'. Extensions may register more. */\n skillsMarketplaceProvider: z.string().optional(),\n /** Base URL for the xopc skills marketplace (public REST API). */\n skillsStoreBaseUrl: z.string().url().optional(),\n /** File sharing configuration (temporary public download links for workspace files). */\n share: z.object({\n enabled: z.boolean().default(true),\n /** Default TTL in ms (default 24h). */\n defaultTtlMs: z.number().min(60_000).max(604_800_000).default(86_400_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active shares (default 100). */\n maxActiveShares: z.number().min(1).max(10_000).default(100),\n /** Maximum shareable file size in bytes (default 100MB). */\n maxFileSize: z.number().min(1_048_576).max(10_737_418_240).default(104_857_600),\n /** MIME types allowed for inline preview (?inline=1). */\n inlinePreviewMimes: z.array(z.string()).default([\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n 'application/pdf',\n 'text/html',\n 'text/markdown',\n 'text/plain',\n 'application/json',\n ]),\n /** Folder-sharing controls (browse + ZIP). */\n directory: z.object({\n enabled: z.boolean().default(true),\n /** Maximum folder size in bytes at scan time (default 1 GB). */\n maxFolderSize: z.number().int().min(1_048_576).max(10_737_418_240).default(1_073_741_824),\n /** Maximum number of entries scanned for a single folder share. */\n maxFileCount: z.number().int().min(1).max(100_000).default(1_000),\n /** Traversal depth cap (defense against recursive symlinks). */\n maxDepth: z.number().int().min(1).max(64).default(20),\n /** In-memory directory listing cache TTL. */\n listingCacheMs: z.number().int().min(0).max(600_000).default(60_000),\n /** Maximum simultaneous ZIP streams per share token. */\n zipConcurrency: z.number().int().min(1).max(8).default(1),\n }).default({\n enabled: true,\n maxFolderSize: 1_073_741_824,\n maxFileCount: 1_000,\n maxDepth: 20,\n listingCacheMs: 60_000,\n zipConcurrency: 1,\n }),\n }).optional(),\n /** Site-share configuration (static directory or reverse-proxy a local dev server). */\n siteShare: z.object({\n enabled: z.boolean().default(true),\n /** Public host suffix that subdomain shares are served under. */\n publicHostSuffix: z.string().min(1).default('share.xopc.ai'),\n /** Default TTL in ms (default 6h, shorter than file shares — live app surface). */\n defaultTtlMs: z.number().int().min(60_000).max(604_800_000).default(21_600_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().int().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active site shares. */\n maxActiveSites: z.number().int().min(1).max(1_000).default(5),\n static: z.object({\n enabled: z.boolean().default(true),\n /** Maximum total bytes of files served per static site. */\n maxRootDirSize: z.number().int().min(1_048_576).max(10_737_418_240).default(524_288_000),\n /** Maximum file count under root dir. */\n maxFileCount: z.number().int().min(1).max(100_000).default(10_000),\n /** Whether HTML/CSS rewrite of absolute paths is on by default. */\n rewriteEnabledByDefault: z.boolean().default(false),\n }).default({\n enabled: true,\n maxRootDirSize: 524_288_000,\n maxFileCount: 10_000,\n rewriteEnabledByDefault: false,\n }),\n proxy: z.object({\n /** Reverse-proxy mode default-enabled per the product brief. */\n enabled: z.boolean().default(true),\n /** Upstream host whitelist. Loopback by default. */\n allowedUpstreamHosts: z\n .array(z.string().min(1))\n .default(['127.0.0.1', 'localhost', '::1']),\n /** Upstream port whitelist (common dev-server ports). */\n allowedUpstreamPorts: z\n .array(z.number().int().min(1).max(65535))\n .default([3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000]),\n /** Whether to forward WebSocket upgrades. */\n forwardWebSocket: z.boolean().default(true),\n /** Maximum request body size in bytes (50 MB). */\n bodySizeLimit: z.number().int().min(0).max(1_073_741_824).default(52_428_800),\n /** Per-request HTTP timeout in ms. */\n requestTimeoutMs: z.number().int().min(1_000).max(600_000).default(30_000),\n /** Per-WebSocket idle timeout in ms. */\n wsIdleTimeoutMs: z.number().int().min(10_000).max(3_600_000).default(300_000),\n /** Rewrite Set-Cookie Path attribute (subpath mode only). */\n rewriteSetCookiePath: z.boolean().default(true),\n }).default({\n enabled: true,\n allowedUpstreamHosts: ['127.0.0.1', 'localhost', '::1'],\n allowedUpstreamPorts: [3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000],\n forwardWebSocket: true,\n bodySizeLimit: 52_428_800,\n requestTimeoutMs: 30_000,\n wsIdleTimeoutMs: 300_000,\n rewriteSetCookiePath: true,\n }),\n }).optional(),\n}).default({\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'store',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n});\n\nexport const ModelsDevConfigSchema = z.object({\n enabled: z.boolean().default(true),\n}).default({\n enabled: true,\n});\n\n// ============================================\n// STT (Speech-to-Text) Config\n// ============================================\n\nconst SttProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const STTProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z.array(z.string().min(1)).default(['alibaba', 'openai']),\n});\n\nexport const MediaUnderstandingCapabilitiesSchema = z\n .array(z.enum(['image', 'audio', 'video']))\n .optional();\n\nexport const MediaUnderstandingModelSchema = z\n .object({\n provider: z.string().optional(),\n model: z.string().optional(),\n capabilities: MediaUnderstandingCapabilitiesSchema,\n type: z.union([z.literal('provider'), z.literal('cli')]).optional(),\n command: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n apiKey: z.string().optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Primary provider id — any registered MediaUnderstandingProvider id. */\n provider: z.string().min(1).default('alibaba'),\n fallback: STTFallbackConfigSchema.optional(),\n timeoutMs: z.number().int().min(1000).max(180000).optional(),\n /** Ordered model entries for this capability (OpenClaw `tools.media.audio.models`). */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), STTProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// TTS (Text-to-Speech) Config\n// ============================================\n\nconst TtsProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const TTSProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n voice: z.string().optional(),\n })\n .catchall(TtsProviderConfigCatchallSchema);\n\nexport const TTSFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z\n .array(z.string().min(1))\n .default(['openai', 'alibaba', 'minimax', 'edge']),\n});\n\nexport const TTSModelOverridesConfigSchema = z.object({\n enabled: z.boolean().default(true),\n allowText: z.boolean().default(true),\n allowProvider: z.boolean().default(false),\n allowVoice: z.boolean().default(true),\n allowModelId: z.boolean().default(true),\n allowVoiceSettings: z.boolean().default(false),\n allowNormalization: z.boolean().default(false),\n allowSeed: z.boolean().default(false),\n});\n\nexport const TTSEdgeConfigSchema = z.object({\n enabled: z.boolean().default(true),\n voice: z.string().optional(),\n lang: z.string().optional(),\n outputFormat: z.string().optional(),\n pitch: z.string().optional(),\n rate: z.string().optional(),\n volume: z.string().optional(),\n proxy: z.string().optional(),\n timeoutMs: z.number().int().min(1000).max(120000).optional(),\n});\n\nexport const TTSSummarizationConfigSchema = z.object({\n enabled: z.boolean().optional(),\n targetLength: z.number().int().min(1).optional(),\n threshold: z.number().int().min(1).optional(),\n model: z.string().optional(),\n});\n\nexport const TTSConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Primary provider id — any registered SpeechProviderPlugin id. */\n provider: z.string().min(1).default('edge'),\n trigger: z.enum(['off', 'always', 'inbound', 'tagged']).default('always'),\n fallback: TTSFallbackConfigSchema.optional(),\n maxTextLength: z.number().int().min(1).default(512), // Conservative default to accommodate all providers (Alibaba limit is 512)\n timeoutMs: z.number().int().min(1000).max(180000).default(60000),\n summarization: TTSSummarizationConfigSchema.optional(),\n modelOverrides: TTSModelOverridesConfigSchema.optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), TTSProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// messages.* — delivery / presentation concerns\n// ============================================\n\nexport const MessagesConfigSchema = z.object({\n /** Voice (text-to-speech) output configuration. */\n tts: TTSConfigSchema.optional(),\n}).optional();\n\nexport const ToolsMediaAudioConfigSchema = STTConfigSchema;\n\nexport const ToolsMediaConfigSchema = z\n .object({\n /** Shared model entries applied across media capabilities when entry lacks capabilities. */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Audio (speech-to-text) capability provider config. */\n audio: ToolsMediaAudioConfigSchema.optional(),\n })\n .optional();\n\n// ============================================\n// Provider Configs (capability providers: image / audio / video)\n// ============================================\n\n/**\n * Optional Azure OpenAI overrides used when an OpenAI image-generation\n * request should hit an Azure deployment instead of `api.openai.com`.\n *\n * URL template (when present):\n * `https://<resource>.openai.azure.com/openai/deployments/<deployment>/images/generations?api-version=<apiVersion>`\n */\nexport const ProviderAzureConfigSchema = z\n .object({\n /** Azure resource name (subdomain before `.openai.azure.com`). */\n resource: z.string().min(1).optional(),\n /** Azure deployment id (configured per model). */\n deployment: z.string().min(1).optional(),\n /** Azure REST API version, e.g. `2024-08-01-preview`. */\n apiVersion: z.string().min(1).optional(),\n })\n .strict();\n\n/** Per-vendor request overrides applied by the provider HTTP layer. */\nexport const ProviderRequestOverridesSchema = z\n .object({\n /** Hard cap for a single HTTP call (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /** Extra headers merged into every outbound request. */\n headers: z.record(z.string(), z.string()).optional(),\n })\n .strict();\n\n/**\n * Generic per-vendor provider config — used by image / audio / video\n * capability providers via `cfg.providers.<id>`. Kept loose (`.strict()` but\n * everything optional) so adding a new vendor never requires a config\n * migration.\n */\nexport const ProviderAuthConfigSchema = z\n .object({\n /** Static API key (api-key / azure-key modes). */\n apiKey: z.string().optional(),\n /** Override the default REST base URL. */\n baseUrl: z.string().url().optional(),\n /** Vendor region (DashScope: `beijing` / `singapore`; AWS: region id). */\n region: z.string().optional(),\n /** Image-only base URL override (DashScope splits image vs LLM). */\n imageBaseUrl: z.string().url().optional(),\n /** Per-vendor request overrides. */\n request: ProviderRequestOverridesSchema.optional(),\n /** Azure OpenAI deployment overrides; only consumed by OpenAI image provider. */\n azure: ProviderAzureConfigSchema.optional(),\n })\n .strict();\n\nexport type ProviderAuthConfig = z.infer<typeof ProviderAuthConfigSchema>;\n\n/**\n * `cfg.providers.<id>` is keyed by provider id (`openai`, `dashscope`,\n * `minimax`, `google`, `fal`, …). Every entry is optional and validated by\n * {@link ProviderAuthConfigSchema}.\n */\nexport const ProvidersConfigSchema = z.record(z.string(), ProviderAuthConfigSchema);\n\nexport type ProvidersConfig = z.infer<typeof ProvidersConfigSchema>;\n\n// ============================================\n// Extension Configs \n// ============================================\n\n// Security config for extensions \nexport const ExtensionSecurityConfigSchema = z.object({\n checkPermissions: z.boolean().default(true),\n allowUntrusted: z.boolean().default(false),\n allow: z.array(z.string()).default([]),\n trackProvenance: z.boolean().default(true),\n allowPromptInjection: z.boolean().default(false),\n});\n\n// Slot config for extensions \nexport const ExtensionSlotsConfigSchema = z.object({\n memory: z.string().optional(),\n tts: z.string().optional(),\n imageGeneration: z.string().optional(),\n webSearch: z.string().optional(),\n});\n\n// Complete extensions config\n// Extension config allows both known fields AND arbitrary extension-specific config\n// Known fields: enabled (array), allow (array), security (object), slots (object)\n// Arbitrary: any other key is extension-specific config (e.g., extensions.hello.greeting)\nexport const ExtensionsConfigSchema: z.ZodType<Record<string, unknown>> = z.record(z.string(), z.unknown());\n\n// ============================================\n// Update Config\n// ============================================\n\nexport const UpdateAutoConfigSchema = z\n .object({\n /** Enable automatic update installation. Default false. */\n enabled: z.boolean().default(false),\n /** Hours to wait before applying a stable update after first detection. */\n stableDelayHours: z.number().min(0).default(6),\n /** Additional random jitter hours for stable rollout (avoids thundering herd). */\n stableJitterHours: z.number().min(0).default(12),\n /** How often to re-check for beta updates (hours). Min 0.25. */\n betaCheckIntervalHours: z.number().min(0.25).default(1),\n })\n .strict()\n .optional();\n\n/** Persistent `/goal` (Ralph loop) — Hermes-aligned defaults. */\nexport const GoalNotificationEventSchema = z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n]);\n\nexport const GoalNotificationTargetSchema = z\n .object({\n channel: z.string().min(1),\n chatId: z.string().min(1),\n accountId: z.string().optional(),\n threadId: z.union([z.string(), z.number()]).optional(),\n silent: z.boolean().optional(),\n events: z.array(GoalNotificationEventSchema).optional(),\n })\n .strict();\n\nexport const GoalNotificationsConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Notify Telegram/Weixin chats bound to the goal activeSessionKey. */\n includeLinkedSessions: z.boolean().default(true),\n /** Channels eligible for linked-session notifications. */\n channels: z.array(z.string().min(1)).default(['telegram', 'weixin']),\n events: z\n .array(GoalNotificationEventSchema)\n .default(['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry']),\n targets: z.array(GoalNotificationTargetSchema).default([]),\n })\n .strict()\n .default({\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n });\n\nexport const GoalsConfigSchema = z\n .object({\n /** Max continuation turns before auto-pause (Hermes default 20). */\n maxTurns: z.number().int().min(1).max(500).default(20),\n /** Optional judge model ref; defaults to the active agent model. */\n judgeModelRef: z.string().optional(),\n /**\n * When true (default), first post-turn runs a decomposition judge to build a checklist;\n * subsequent turns evaluate progress per item (Hermes-style). When false, use legacy freeform judge only.\n */\n checklistMode: z.boolean().default(true),\n /**\n * empty_only preserves legacy behavior: the first post-turn decomposition runs only when the\n * goal has no checklist. supplement_existing lets the first post-turn add non-duplicate judge\n * criteria even when the user supplied initial acceptance criteria.\n */\n checklistDecomposePolicy: z.enum(['empty_only', 'supplement_existing']).default('empty_only'),\n /** Auto-pause after this many consecutive judge JSON/tool parse failures (Hermes default 3). */\n maxConsecutiveParseFailures: z.number().int().min(1).max(20).default(3),\n /** Judge LLM call timeout in ms (Hermes uses 60s). */\n judgeTimeoutMs: z.number().int().min(5_000).max(120_000).default(60_000),\n /** Max characters of recent transcript JSON passed to the checklist judge as extra context. */\n checklistHistoryChars: z.number().int().min(0).max(100_000).default(24_000),\n /** External channel notification policy for durable goal lifecycle events. */\n notifications: GoalNotificationsConfigSchema,\n })\n .strict();\n\nexport type GoalsConfig = z.infer<typeof GoalsConfigSchema>;\n\nexport const UpdateConfigSchema = z\n .object({\n /** Check for updates on gateway startup. Default true. */\n checkOnStart: z.boolean().default(true),\n /** Update channel: stable (default), beta, or dev. */\n channel: z.enum(['stable', 'beta', 'dev']).default('stable'),\n /** Automatic update policy. */\n auto: UpdateAutoConfigSchema,\n })\n .strict()\n .optional();\n\nexport type UpdateConfig = z.infer<typeof UpdateConfigSchema>;\n\nexport const CommandsConfigSchema = z\n .object({\n restart: z.boolean().optional(),\n })\n .strict()\n .optional();\n\nexport type CommandsConfig = z.infer<typeof CommandsConfigSchema>;\n\nexport const TuiConfigSchema = z\n .object({\n /** Default agent id for fresh TUI sessions. Leaves global routing (`agents.default`) untouched. */\n defaultAgent: z.string().min(1).optional(),\n })\n .strict()\n .default({});\n\nexport type TuiConfig = z.infer<typeof TuiConfigSchema>;\n\n// ============================================\n// MCP (Model Context Protocol)\n// ============================================\n\nconst McpHttpUrlSchema = z\n .string()\n .url()\n .refine((value) => {\n try {\n const protocol = new URL(value).protocol;\n return protocol === 'http:' || protocol === 'https:';\n } catch {\n return false;\n }\n }, 'MCP server URL must use http or https');\n\nconst ConnectorSecretReferenceSchema = z.object({\n xopcSecretRef: z.object({\n provider: z.string().min(1),\n fieldKey: z.string().min(1),\n }),\n});\n\nconst McpConfigScalarSchema = z.union([z.string(), z.number(), z.boolean(), ConnectorSecretReferenceSchema]);\n\nexport const McpServerSchema = z\n .object({\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), McpConfigScalarSchema).optional(),\n cwd: z.string().optional(),\n workingDirectory: z.string().optional(),\n url: McpHttpUrlSchema.optional(),\n transport: z.enum(['sse', 'streamable-http']).optional(),\n headers: z.record(z.string(), McpConfigScalarSchema).optional(),\n connectionTimeoutMs: z.number().finite().positive().optional(),\n })\n .catchall(z.unknown())\n .superRefine((value, ctx) => {\n const hasCommand = typeof value.command === 'string' && value.command.trim().length > 0;\n const hasUrl = typeof value.url === 'string' && value.url.trim().length > 0;\n if (hasCommand && hasUrl) {\n ctx.addIssue({\n code: 'custom',\n message: 'MCP server cannot define both command and url',\n });\n }\n });\n\nexport const McpConfigSchema = z\n .object({\n servers: z.record(z.string(), McpServerSchema).optional(),\n sessionIdleTtlMs: z.number().finite().min(0).optional(),\n })\n .strict()\n .optional();\n\nexport type McpServerConfig = z.infer<typeof McpServerSchema>;\nexport type McpConfig = z.infer<typeof McpConfigSchema>;\n\n// ============================================\n// Code Intelligence\n// ============================================\n\nexport const CodeIntelligenceConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n agentIds: z.array(z.string().min(1)).default(['coder']),\n indexMode: z.enum(['fast', 'moderate', 'full']).default('moderate'),\n autoIndex: z.boolean().default(true),\n autoRefresh: z.boolean().default(true),\n refreshDebounceMs: z.number().int().min(100).max(30_000).default(600),\n queryTimeoutMs: z.number().int().min(1_000).max(120_000).default(20_000),\n indexTimeoutMs: z.number().int().min(10_000).max(30 * 60_000).default(5 * 60_000),\n binaryPath: z.string().min(1).optional(),\n })\n .strict()\n .default({\n enabled: true,\n agentIds: ['coder'],\n indexMode: 'moderate',\n autoIndex: true,\n autoRefresh: true,\n refreshDebounceMs: 600,\n queryTimeoutMs: 20_000,\n indexTimeoutMs: 5 * 60_000,\n });\n\nexport type CodeIntelligenceConfig = z.infer<typeof CodeIntelligenceConfigSchema>;\n\nexport const ConnectorsConfigSchema = z\n .object({\n instances: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n })\n .strict()\n .optional();\n\nexport type ConnectorsConfig = z.infer<typeof ConnectorsConfigSchema>;\n\n// ============================================\n// Root Config\n// ============================================\n\nexport const ConfigSchema = z.object({\n agents: AgentsConfigSchema,\n bindings: BindingsConfigSchema,\n session: SessionConfigSchema,\n channels: ChannelsConfigSchema,\n gateway: GatewayConfigSchema,\n browser: BrowserConfigSchema,\n tunnel: TunnelConfigSchema.optional(),\n workspace: WorkspaceConfigSchema,\n tools: ToolsConfigSchema,\n mcp: McpConfigSchema,\n codeIntelligence: CodeIntelligenceConfigSchema,\n connectors: ConnectorsConfigSchema,\n goals: GoalsConfigSchema.optional(),\n extensions: ExtensionsConfigSchema.default({}),\n /** Per-vendor capability provider config (image / audio / video). */\n providers: ProvidersConfigSchema.optional(),\n modelsDev: ModelsDevConfigSchema,\n /** Delivery / presentation concerns (currently `tts`). */\n messages: MessagesConfigSchema,\n update: UpdateConfigSchema,\n commands: CommandsConfigSchema,\n tui: TuiConfigSchema,\n}).default({\n agents: {\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: DEFAULT_AGENT_MODELS,\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Smart Assistant',\n description: 'General-purpose personal assistant.',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n understanding: {\n enabled: true,\n adaptiveCadence: true,\n reviewIntervalTurns: 10,\n maxHistoryMessages: 80,\n maxDurationMs: 120_000,\n },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n },\n bindings: [],\n session: {\n scope: 'per-sender' as const,\n mainKey: 'main',\n dmScope: 'main' as const,\n },\n channels: {\n telegram: {\n enabled: false,\n debug: false,\n defaults: {\n dmPolicy: 'pairing' as const,\n groupPolicy: 'open' as const,\n replyToMode: 'off' as const,\n historyLimit: 50,\n textChunkLimit: 4000,\n streaming: { mode: 'partial' as const },\n },\n accounts: {\n default: {\n accountId: 'default',\n enabled: true,\n botToken: '',\n allowFrom: [],\n groupAllowFrom: [],\n },\n },\n },\n },\n gateway: {\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'store',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n },\n browser: {\n enabled: true,\n backend: 'extension' as const,\n },\n tools: {\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n },\n codeIntelligence: {\n enabled: true,\n agentIds: ['coder'],\n indexMode: 'moderate' as const,\n autoIndex: true,\n autoRefresh: true,\n refreshDebounceMs: 600,\n queryTimeoutMs: 20_000,\n indexTimeoutMs: 5 * 60_000,\n },\n goals: {\n maxTurns: 20,\n checklistMode: true,\n checklistDecomposePolicy: 'empty_only',\n maxConsecutiveParseFailures: 3,\n judgeTimeoutMs: 60_000,\n checklistHistoryChars: 24_000,\n notifications: {\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n },\n },\n extensions: {\n allow: [],\n security: {\n checkPermissions: true,\n allowUntrusted: false,\n allow: [],\n trackProvenance: true,\n allowPromptInjection: false,\n },\n slots: {},\n },\n modelsDev: {\n enabled: true,\n },\n tui: {},\n // messages.tts / tools.media.audio start undefined; the factory layer fills\n // in provider-level defaults (model/voice) on demand. Fresh configs don't\n // ship with enabled providers so they never make surprise STT/TTS calls.\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\nexport type GatewayAuthConfig = z.infer<typeof GatewayAuthSchema>;\nexport type GatewayTrustedProxyConfig = z.infer<typeof GatewayTrustedProxySchema>;\nexport type GatewayAuthRateLimitConfig = z.infer<typeof GatewayAuthRateLimitSchema>;\nexport type GatewayBindMode = z.infer<typeof GatewayBindModeSchema>;\nexport type STTConfig = z.infer<typeof STTConfigSchema>;\nexport type TTSConfig = z.infer<typeof TTSConfigSchema>;\n\n// ============================================\n// Helper Functions\n// ============================================\n\n/**\n * Parse a model reference string.\n */\nexport interface ParsedModelRef {\n provider: string;\n model: string;\n}\n\nexport function getAgentDefaultModelRef(config: Config): string | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelRef: string | undefined;\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n const roles = models?.roles ?? {};\n const defaultRole = models?.defaultRole ?? Object.keys(roles)[0];\n const role = defaultRole ? roles[defaultRole] : undefined;\n const next = role?.model.trim();\n if (next) modelRef = next;\n };\n const rootPresetIds = [\n ...(config.agents.capabilityPresets[config.agents.defaultPreset] ? [config.agents.defaultPreset] : []),\n ...(agent.extends ?? []).filter((id) => id !== config.agents.defaultPreset),\n ];\n for (const presetId of linearizePresetIds(rootPresetIds, config.agents.capabilityPresets)) {\n applyModels(config.agents.capabilityPresets[presetId]?.models);\n }\n applyModels(agent.models);\n return modelRef;\n}\n\nfunction getAgentDefaultModelsConfig(config: Config): AgentModelsConfig | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelConfig: AgentModelsConfig | undefined;\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n if (!models) return;\n modelConfig = {\n ...modelConfig,\n ...models,\n roles: {\n ...(modelConfig?.roles ?? {}),\n ...(models.roles ?? {}),\n },\n };\n };\n const rootPresetIds = [\n ...(config.agents.capabilityPresets[config.agents.defaultPreset] ? [config.agents.defaultPreset] : []),\n ...(agent.extends ?? []).filter((id) => id !== config.agents.defaultPreset),\n ];\n for (const presetId of linearizePresetIds(rootPresetIds, config.agents.capabilityPresets)) {\n applyModels(config.agents.capabilityPresets[presetId]?.models);\n }\n applyModels(agent.models);\n return modelConfig;\n}\n\nexport function getAgentDefaultImageModelConfig(config: Config): AgentModelConfig | undefined {\n return getAgentDefaultModelsConfig(config)?.imageModel;\n}\n\nexport function getAgentDefaultImageGenerationModelConfig(\n config: Config,\n): AgentImageGenerationModelConfig | undefined {\n return getAgentDefaultModelsConfig(config)?.imageGenerationModel;\n}\n\n/** `provider/model` or null when invalid. */\nexport function parseModelRef(ref: string): ParsedModelRef | null {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n if (idx <= 0 || idx === trimmed.length - 1) {\n return null;\n }\n return { provider: trimmed.slice(0, idx).trim(), model: trimmed.slice(idx + 1).trim() };\n}\n"],"mappings":";;;;;;;;;;AAg2CA,SAAgB,wBAAwB,QAAoC;CAC1E,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,KAAK,GAAG,OAAO,OAAO,OAAO,EAAE;CACzE,MAAM,YACJ,OAAO,QAAQ,SAAS,MAAM,IAC9B,KAAK,MAAM,UAAW,MAAgC,YAAY,KAAK,EAAE,IAAI,MAAM,IACnF,KAAK,IAAI;CACX,MAAM,QAAQ,KAAK,MAAM,UAAU,MAAM,YAAY,SAAS,MAAM,OAAO,UAAU,IAAI,KAAK;AAC9F,KAAI,CAAC,MAAO,QAAO,KAAA;CAEnB,IAAI;CACJ,MAAM,eAAe,WAAgD;EACnE,MAAM,QAAQ,QAAQ,SAAS,EAAE;EACjC,MAAM,cAAc,QAAQ,eAAe,OAAO,KAAK,MAA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ACH,QAAQ;GACN,YAAY;GACZ,WAAW,EAAE;GACd,EACF,EACF;EACD,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,QAAQ;GACnB,WAAW;GACX,WAAW;GACX,aAAa;GACb,mBAAmB;GACnB,gBAAgB;GAChB,gBAAgB,IAAI;GACrB;EACD,OAAO;GACL,UAAU;GACV,eAAe;GACf,0BAA0B;GAC1B,6BAA6B;GAC7B,gBAAgB;GAChB,uBAAuB;GACvB,eAAe;IACb,SAAS;IACT,uBAAuB;IACvB,UAAU,CAAC,YAAY,SAAS;IAChC,QAAQ;KAAC;KAAQ;KAAW;KAAe;KAAgB;KAAc;IACzE,SAAS,EAAE;IACZ;GACF;EACD,YAAY;GACV,OAAO,EAAE;GACT,UAAU;IACR,kBAAkB;IAClB,gBAAgB;IAChB,OAAO,EAAE;IACT,iBAAiB;IACjB,sBAAsB;IACvB;GACD,OAAO,EAAE;GACV;EACD,WAAW,EACT,SAAS,MACV;EACD,KAAK,EAAE;EAIR,CAAC"}
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../../../src/config/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n AgentConfigEntrySchema,\n CapabilityPresetSchema,\n DEFAULT_CAPABILITY_PRESET_ID,\n} from '../agent-manifest/schema.js';\nimport { linearizePresetIds } from '../agent-manifest/preset-chain.js';\nimport { checkCacheDir } from '../browser/cache-dir-policy.js';\nimport { DEFAULT_AGENT_MODELS } from './default-model.js';\nimport { validatePublicUrl } from './public-url.js';\n\n// ============================================\n// Agent Configs\n// ============================================\n\n/**\n * Agent model ref. Always an object with explicit `primary` and optional\n * `fallbacks` chain. No string-form shorthand — every write site builds the\n * object explicitly so reads never branch on shape.\n */\nexport const AgentModelRefSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type AgentModelConfig = z.infer<typeof AgentModelRefSchema>;\n\n/**\n * Image-generation model ref. {@link AgentModelRefSchema} plus runtime knobs\n * (`timeoutMs`, `autoProviderFallback`) used by the image-generation runtime.\n */\nexport const AgentImageGenerationModelSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n /** Hard cap for the whole generation attempt (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /**\n * When all `primary + fallbacks` candidates fail, sweep every other\n * configured provider before giving up.\n */\n autoProviderFallback: z.boolean().optional(),\n })\n .strict();\n\nexport type AgentImageGenerationModelConfig = z.infer<typeof AgentImageGenerationModelSchema>;\n\nexport const AgentTypedModelRoleSchema = z\n .object({\n description: z.string().max(500).optional(),\n model: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.model)) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport type AgentTypedModelRole = z.infer<typeof AgentTypedModelRoleSchema>;\n\nconst AgentTypedModelRolesSchema = z\n .record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), AgentTypedModelRoleSchema)\n .optional();\n\nexport const AgentModelsSchema = z\n .object({\n defaultRole: z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/).optional(),\n roles: AgentTypedModelRolesSchema,\n imageModel: AgentModelRefSchema.optional(),\n imageGenerationModel: AgentImageGenerationModelSchema.optional(),\n })\n .strict()\n .optional();\n\nexport type AgentModelsConfig = z.infer<typeof AgentModelsSchema>;\n\nexport type AgentTypedModel = AgentTypedModelRole & { id: string };\n\nexport const AgentsConfigSchema = z.object({\n /** Default agent id when not specified (routing / session creation). */\n default: z.string().optional(),\n /** Protected global defaults preset applied before each agent's own presets. */\n defaultPreset: z.string().default(DEFAULT_CAPABILITY_PRESET_ID),\n capabilityPresets: z.record(z.string(), CapabilityPresetSchema).default({}),\n list: z.array(AgentConfigEntrySchema).default([]),\n}).strict().default({\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: DEFAULT_AGENT_MODELS,\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Smart Assistant',\n description: 'General-purpose personal assistant.',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n understanding: {\n enabled: true,\n adaptiveCadence: true,\n reviewIntervalTurns: 10,\n maxHistoryMessages: 80,\n maxDurationMs: 120_000,\n },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n});\n\nconst BrowserCloudConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n region: z.string().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserExtensionConfigSchema = z\n .object({\n port: z.number().int().min(1024).max(65535).optional(),\n host: z.string().min(1).optional(),\n connectionTimeout: z.number().int().positive().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserCloakConfigSchema = z\n .object({\n keepOpen: z.boolean().optional(),\n temporaryProfile: z.boolean().optional(),\n cacheDir: z.string().optional().superRefine((value, ctx) => {\n const result = checkCacheDir(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: result.message });\n }\n }),\n binaryPath: z.string().optional(),\n timezone: z.string().optional(),\n locale: z.string().optional(),\n webrtcIp: z.string().optional(),\n fingerprintPlatform: z.string().optional(),\n extraArgs: z.array(z.string()).optional(),\n })\n .strict()\n .optional();\n\nexport const BrowserConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n backend: z.enum(['local', 'cdp', 'cloud', 'extension', 'cloakbrowser']).default('extension'),\n headless: z.boolean().optional(),\n allowPrivateUrls: z.boolean().optional(),\n commandTimeout: z.number().int().min(5).max(900).optional(),\n cloudProvider: z.enum(['local', 'browserbase', 'browser-use']).optional(),\n cloud: BrowserCloudConfigSchema,\n cdpUrl: z.string().optional(),\n extension: BrowserExtensionConfigSchema,\n cloakbrowser: BrowserCloakConfigSchema,\n humanize: z.boolean().optional(),\n humanPreset: z.enum(['default', 'careful']).optional(),\n dialogPolicy: z.enum(['must_respond', 'auto_dismiss', 'auto_accept']).optional(),\n dialogTimeoutSeconds: z.number().int().positive().optional(),\n })\n .strict()\n .default({ enabled: true, backend: 'extension' });\n\n// ============================================\n// Channel Configs (per-channel Zod lives in bundled extensions; root schema is open)\n// ============================================\n\nexport {\n TelegramTopicConfigSchema,\n TelegramGroupConfigSchema,\n TelegramAccountConfigSchema,\n TelegramConfigSchema,\n} from '../../extensions/telegram/src/config-schema.js';\nexport type { TelegramConfig } from '../../extensions/telegram/src/config-schema.js';\nexport { WeixinAccountConfigSchema, WeixinConfigSchema } from '../../extensions/weixin/src/config-schema.js';\nexport type { WeixinConfig } from '../../extensions/weixin/src/config-schema.js';\n// ============================================\n// Session Routing Configuration\n// ============================================\n\nexport const BindingMatchSchema = z.object({\n channel: z.string(),\n accountId: z.string().optional(),\n peerKind: z.string().optional(),\n peerId: z.string().optional(),\n guildId: z.string().optional(),\n teamId: z.string().optional(),\n memberRoleIds: z.array(z.string()).optional(),\n});\n\nexport const BindingRuleSchema = z.object({\n id: z.string().optional(),\n agentId: z.string(),\n priority: z.number().default(100),\n match: BindingMatchSchema,\n enabled: z.boolean().default(true),\n});\n\nexport const BindingsConfigSchema = z.array(BindingRuleSchema).default([]);\n\nexport const SessionDmScopeSchema = z.enum([\n 'main',\n 'per-peer',\n 'per-channel-peer',\n 'per-account-channel-peer',\n]);\n\nexport const SessionStorageConfigSchema = z.object({\n pruneAfterMs: z.number().optional(),\n maxEntries: z.number().optional(),\n});\n\nexport const SessionResetModeSchema = z.enum(['daily', 'idle']);\n\nexport const SessionResetConfigSchema = z\n .object({\n mode: SessionResetModeSchema.optional(),\n /** Local hour (0–23) for the daily reset boundary. */\n atHour: z.number().int().min(0).max(23).optional(),\n /** Sliding idle window (minutes). When set with daily mode, whichever expires first wins. */\n idleMinutes: z.number().int().min(0).optional(),\n })\n .strict();\n\nexport const SessionResetByTypeSchema = z\n .object({\n direct: SessionResetConfigSchema.optional(),\n group: SessionResetConfigSchema.optional(),\n thread: SessionResetConfigSchema.optional(),\n })\n .strict();\n\nexport const SessionScopeSchema = z.enum(['per-sender', 'global']);\n\nexport const SessionConfigSchema = z.object({\n scope: SessionScopeSchema.default('per-sender'),\n mainKey: z.string().default('main'),\n dmScope: SessionDmScopeSchema.default('main'),\n identityLinks: z.record(z.string(), z.array(z.string())).optional(),\n resetTriggers: z.array(z.string()).optional(),\n idleMinutes: z.number().int().positive().optional(),\n reset: SessionResetConfigSchema.optional(),\n resetByType: SessionResetByTypeSchema.optional(),\n resetByChannel: z.record(z.string(), SessionResetConfigSchema).optional(),\n storage: SessionStorageConfigSchema.optional(),\n}).default({\n scope: 'per-sender',\n mainKey: 'main',\n dmScope: 'main',\n});\n\n/** Channel buckets — shapes validated post-parse by registered channel plugins. */\nexport const ChannelsConfigSchema = z.record(z.string(), z.unknown()).default({});\n\nexport const SearchProviderEntrySchema = z.object({\n type: z.enum(['brave', 'tavily', 'bing', 'searxng']),\n apiKey: z.string().optional(),\n /** SearXNG instance base URL (e.g. http://localhost:8080) */\n url: z.string().optional(),\n disabled: z.boolean().optional(),\n});\n\nexport type SearchProviderEntry = z.infer<typeof SearchProviderEntrySchema>;\n\nexport const WebSearchConfigSchema = z.object({\n maxResults: z.number().default(5),\n /** Ordered API providers; empty → HTML fallback only */\n providers: z.array(SearchProviderEntrySchema).default([]),\n});\n\nexport type WebSearchConfig = z.infer<typeof WebSearchConfigSchema>;\n\nexport const WebsiteBlocklistSchema = z.object({\n /** Master switch. Default false (no blocking). */\n enabled: z.boolean().default(false),\n /** Domain patterns to block (e.g. \"example.com\", \"*.evil.org\"). */\n domains: z.array(z.string()).default([]),\n});\n\nexport type WebsiteBlocklistConfig = z.infer<typeof WebsiteBlocklistSchema>;\n\nexport const WebToolsConfigSchema = z.object({\n /** Search result HTML fallback: cn → Bing, otherwise DuckDuckGo */\n region: z.enum(['cn', 'global']).optional(),\n search: WebSearchConfigSchema.optional(),\n /** Domain blocklist for web_fetch / web_extract / browser tools. */\n blocklist: WebsiteBlocklistSchema.optional(),\n});\n\nexport type WebToolsConfig = z.infer<typeof WebToolsConfigSchema>;\n\nexport const ToolsConfigSchema = z.object({\n web: WebToolsConfigSchema.optional(),\n /**\n * Per-capability media providers. Currently only `audio` (STT) is wired;\n * `image` / `video` slots are reserved for future capabilities.\n */\n media: z.lazy(() => ToolsMediaConfigSchema),\n}).default({\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n});\n\n// ============================================\n// Gateway Configuration\n// ============================================\n\nexport const GatewayAuthRateLimitSchema = z\n .object({\n enabled: z.boolean().default(true),\n maxAttempts: z.number().int().min(1).default(5),\n windowMs: z.number().default(900_000),\n blockDurationMs: z.number().default(300_000),\n /** OpenClaw alias for blockDurationMs. */\n lockoutMs: z.number().optional(),\n /** Skip rate limiting for loopback client IPs (default true). Remote browser Origin requests never exempt. */\n exemptLoopback: z.boolean().default(true),\n /**\n * Coalesce same-client failures arriving within this window into a single\n * attempt. Absorbs SPA fan-out / SDK auto-retry storms without weakening\n * brute-force protection (deliberate attackers are still rate-limited to\n * one effective attempt per window). Set to 0 to disable.\n */\n burstCoalesceMs: z.number().int().min(0).default(1000),\n })\n .optional();\n\nexport const GatewaySecuritySchema = z\n .object({\n /** When true, non-loopback binds require explicit gateway.auth.rateLimit configuration. */\n strict: z.boolean().optional(),\n })\n .optional();\n\nexport const GatewayTrustedProxySchema = z\n .object({\n /** Header set by the reverse proxy with the authenticated user identity. */\n userHeader: z.string().min(1),\n /** Additional headers that must be present (e.g. proxy auth markers). */\n requiredHeaders: z.array(z.string()).optional(),\n /** When non-empty, only these user identities are allowed. */\n allowUsers: z.array(z.string()).optional(),\n /** Allow trusted-proxy auth when the TCP source is loopback (same-host reverse proxy). */\n allowLoopback: z.boolean().optional(),\n })\n .strict();\n\nexport const GatewayAuthSchema = z\n .object({\n mode: z.enum(['none', 'token', 'password', 'trusted-proxy']).default('token'),\n token: z.string().optional(),\n password: z.string().optional(),\n /** When true (default for Serve), browser UI may auth via Tailscale identity headers. API routes still require token. */\n allowTailscale: z.boolean().optional(),\n rateLimit: GatewayAuthRateLimitSchema,\n trustedProxy: GatewayTrustedProxySchema.optional(),\n })\n .default({\n mode: 'token',\n });\n\nexport const GatewayTailscaleConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const GatewayTailscaleSchema = z\n .object({\n mode: z.enum(['off', 'serve', 'funnel']).default('off'),\n resetOnExit: z.boolean().default(true),\n consent: GatewayTailscaleConsentSchema.optional(),\n })\n .default({\n mode: 'off',\n resetOnExit: true,\n });\n\nexport const GatewayRemoteSchema = z.object({\n url: z.string().url(),\n token: z.string().optional(),\n password: z.string().optional(),\n transport: z.enum(['direct', 'ssh']).default('direct'),\n sshTarget: z.string().optional(),\n sshIdentity: z.string().optional(),\n tlsFingerprint: z.string().optional(),\n});\n\nexport const GatewayTlsSchema = z\n .object({\n enabled: z.boolean().default(false),\n autoGenerate: z.boolean().default(false),\n certPath: z.string().optional(),\n keyPath: z.string().optional(),\n })\n .default({\n enabled: false,\n autoGenerate: false,\n });\n\nexport const GatewayModeSchema = z.enum(['local', 'remote']).default('local');\n\nexport const HeartbeatConfigSchema = z\n .object({\n enabled: z.boolean(),\n intervalMs: z.number(),\n /** When false, heartbeat instructions are only sent during heartbeat polling turns (not in every chat system prompt). */\n includeSystemPromptSection: z.boolean().optional().default(false),\n target: z.string().optional(),\n targetChatId: z.string().optional(),\n prompt: z.string().optional(),\n ackMaxChars: z.number().optional(),\n isolatedSession: z.boolean().optional(),\n activeHours: z\n .object({\n start: z.string(),\n end: z.string(),\n timezone: z.string().optional(),\n })\n .optional(),\n })\n .default({\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n });\n\nexport const GatewayChannelConnectDeferModeSchema = z.enum(['auto', 'off', 'explicit']);\n\nexport const TunnelConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const TunnelConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n brokerUrl: z.string().url().default('https://frp.xopc.ai/api'),\n /** Broker register API secret (env `XOPC_TUNNEL_REGISTRATION_SECRET` overrides when set). */\n registrationSecret: z.string().min(1).optional(),\n autoStart: z.boolean().default(false),\n subdomain: z.string().optional(),\n consent: TunnelConsentSchema.optional(),\n })\n .default({\n enabled: false,\n brokerUrl: 'https://frp.xopc.ai/api',\n autoStart: false,\n });\n\nexport type TunnelConfig = z.infer<typeof TunnelConfigSchema>;\n\n/**\n * Workspace-scoped concerns (file import, etc.). Distinct from\n * agent manifest workspace roots; this block carries\n * feature configuration for workspace-related routes.\n */\nexport const WorkspaceImportConfigSchema = z.object({\n /** Workspace-relative subdir for imported files. Default `imports`. */\n targetDir: z.string().default('imports'),\n /** Per-file byte cap. Default 100 MiB. */\n maxBytes: z.number().int().min(1024).max(10_737_418_240).default(104_857_600),\n /** When false, the route rejects `onConflict: 'overwrite'`. Default true. */\n allowOverwrite: z.boolean().default(true),\n});\nexport type WorkspaceImportConfig = z.infer<typeof WorkspaceImportConfigSchema>;\n\nexport const WorkspaceConfigSchema = z.object({\n import: WorkspaceImportConfigSchema.optional(),\n}).optional();\nexport type WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;\n\nexport const GatewayBindModeSchema = z.enum(['auto', 'loopback', 'lan', 'tailnet', 'custom']);\n\nexport const GatewayConfigSchema = z.object({\n /** Semantic bind mode. */\n bind: GatewayBindModeSchema.optional(),\n /** IPv4 listen address when `bind` is `custom`. */\n customBindHost: z.string().optional(),\n port: z.number().optional(),\n /** local: this process runs the gateway; remote: CLI clients target gateway.remote. */\n mode: GatewayModeSchema.optional(),\n /** Persistent remote gateway target for CLI/TUI/MCP when mode=remote. */\n remote: GatewayRemoteSchema.optional(),\n tailscale: GatewayTailscaleSchema.optional(),\n tls: GatewayTlsSchema.optional(),\n auth: GatewayAuthSchema.optional(),\n heartbeat: HeartbeatConfigSchema.optional(),\n maxSseConnections: z.number().optional(),\n corsOrigins: z.array(z.string()).optional(),\n /**\n * Reverse-proxy publicly reachable URL (e.g. `https://gateway.example.com`).\n * Optional. When set, mobile pairing surfaces this URL as the preferred\n * baseUrl and it is auto-added to the browser CORS/CSRF allowlist.\n * - Must be a URL with no path / query / userinfo.\n * - Must use `https:` for public hosts; `http:` is only allowed when the\n * hostname is in an RFC1918 / `.local` private range.\n */\n publicUrl: z\n .string()\n .superRefine((value, ctx) => {\n const result = validatePublicUrl(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: `gateway.publicUrl: ${result.message}` });\n }\n })\n .optional(),\n /** Dangerous: allow browser Origin to match the HTTP Host header when not in corsOrigins. */\n dangerouslyAllowHostHeaderOriginFallback: z.boolean().optional(),\n /** CIDRs or exact IPs of reverse proxies allowed to terminate auth (trusted-proxy mode). */\n trustedProxies: z.array(z.string()).optional(),\n /** When true, fall back to X-Real-IP if X-Forwarded-For chain parsing fails. Default false (fail closed). */\n allowRealIpFallback: z.boolean().optional(),\n security: GatewaySecuritySchema,\n /**\n * How channel `start()` is split around HTTP listen when using `GatewayServer`.\n * - `auto` (default): defer ids come from channel plugin `meta.deferConnectUntilAfterListen` + enabled config.\n * - `off`: always start all channels in phase1 (troubleshooting / strict ordering).\n * - `explicit`: defer only `channelConnectDeferIds` (empty = defer none).\n */\n channelConnectDeferMode: GatewayChannelConnectDeferModeSchema.optional(),\n /** When `channelConnectDeferMode` is `explicit`, these channel plugin ids are deferred until after listen. */\n channelConnectDeferIds: z.array(z.string().min(1)).max(24).optional(),\n /** Removed from the defer set (applied after `auto` or `explicit` resolution). */\n channelConnectDeferSkipIds: z.array(z.string().min(1)).max(24).optional(),\n /** Default skills marketplace provider id. Built-in: 'store', 'skillhub', 'clawhub'. Extensions may register more. */\n skillsMarketplaceProvider: z.string().optional(),\n /** Base URL for the xopc skills marketplace (public REST API). */\n skillsStoreBaseUrl: z.string().url().optional(),\n /** File sharing configuration (temporary public download links for workspace files). */\n share: z.object({\n enabled: z.boolean().default(true),\n /** Default TTL in ms (default 24h). */\n defaultTtlMs: z.number().min(60_000).max(604_800_000).default(86_400_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active shares (default 100). */\n maxActiveShares: z.number().min(1).max(10_000).default(100),\n /** Maximum shareable file size in bytes (default 100MB). */\n maxFileSize: z.number().min(1_048_576).max(10_737_418_240).default(104_857_600),\n /** MIME types allowed for inline preview (?inline=1). */\n inlinePreviewMimes: z.array(z.string()).default([\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n 'application/pdf',\n 'text/html',\n 'text/markdown',\n 'text/plain',\n 'application/json',\n ]),\n /** Folder-sharing controls (browse + ZIP). */\n directory: z.object({\n enabled: z.boolean().default(true),\n /** Maximum folder size in bytes at scan time (default 1 GB). */\n maxFolderSize: z.number().int().min(1_048_576).max(10_737_418_240).default(1_073_741_824),\n /** Maximum number of entries scanned for a single folder share. */\n maxFileCount: z.number().int().min(1).max(100_000).default(1_000),\n /** Traversal depth cap (defense against recursive symlinks). */\n maxDepth: z.number().int().min(1).max(64).default(20),\n /** In-memory directory listing cache TTL. */\n listingCacheMs: z.number().int().min(0).max(600_000).default(60_000),\n /** Maximum simultaneous ZIP streams per share token. */\n zipConcurrency: z.number().int().min(1).max(8).default(1),\n }).default({\n enabled: true,\n maxFolderSize: 1_073_741_824,\n maxFileCount: 1_000,\n maxDepth: 20,\n listingCacheMs: 60_000,\n zipConcurrency: 1,\n }),\n }).optional(),\n /** Site-share configuration (static directory or reverse-proxy a local dev server). */\n siteShare: z.object({\n enabled: z.boolean().default(true),\n /** Public host suffix that subdomain shares are served under. */\n publicHostSuffix: z.string().min(1).default('share.xopc.ai'),\n /** Default TTL in ms (default 6h, shorter than file shares — live app surface). */\n defaultTtlMs: z.number().int().min(60_000).max(604_800_000).default(21_600_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().int().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active site shares. */\n maxActiveSites: z.number().int().min(1).max(1_000).default(5),\n static: z.object({\n enabled: z.boolean().default(true),\n /** Maximum total bytes of files served per static site. */\n maxRootDirSize: z.number().int().min(1_048_576).max(10_737_418_240).default(524_288_000),\n /** Maximum file count under root dir. */\n maxFileCount: z.number().int().min(1).max(100_000).default(10_000),\n /** Whether HTML/CSS rewrite of absolute paths is on by default. */\n rewriteEnabledByDefault: z.boolean().default(false),\n }).default({\n enabled: true,\n maxRootDirSize: 524_288_000,\n maxFileCount: 10_000,\n rewriteEnabledByDefault: false,\n }),\n proxy: z.object({\n /** Reverse-proxy mode default-enabled per the product brief. */\n enabled: z.boolean().default(true),\n /** Upstream host whitelist. Loopback by default. */\n allowedUpstreamHosts: z\n .array(z.string().min(1))\n .default(['127.0.0.1', 'localhost', '::1']),\n /** Upstream port whitelist (common dev-server ports). */\n allowedUpstreamPorts: z\n .array(z.number().int().min(1).max(65535))\n .default([3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000]),\n /** Whether to forward WebSocket upgrades. */\n forwardWebSocket: z.boolean().default(true),\n /** Maximum request body size in bytes (50 MB). */\n bodySizeLimit: z.number().int().min(0).max(1_073_741_824).default(52_428_800),\n /** Per-request HTTP timeout in ms. */\n requestTimeoutMs: z.number().int().min(1_000).max(600_000).default(30_000),\n /** Per-WebSocket idle timeout in ms. */\n wsIdleTimeoutMs: z.number().int().min(10_000).max(3_600_000).default(300_000),\n /** Rewrite Set-Cookie Path attribute (subpath mode only). */\n rewriteSetCookiePath: z.boolean().default(true),\n }).default({\n enabled: true,\n allowedUpstreamHosts: ['127.0.0.1', 'localhost', '::1'],\n allowedUpstreamPorts: [3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000],\n forwardWebSocket: true,\n bodySizeLimit: 52_428_800,\n requestTimeoutMs: 30_000,\n wsIdleTimeoutMs: 300_000,\n rewriteSetCookiePath: true,\n }),\n }).optional(),\n}).default({\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'store',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n});\n\nexport const ModelsDevConfigSchema = z.object({\n enabled: z.boolean().default(true),\n}).default({\n enabled: true,\n});\n\n// ============================================\n// STT (Speech-to-Text) Config\n// ============================================\n\nconst SttProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const STTProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTFallbackConfigSchema = z.object({\n enabled: z.boolean().default(false),\n order: z.array(z.string().min(1)).default(['xopc-local']),\n});\n\nexport const MediaUnderstandingCapabilitiesSchema = z\n .array(z.enum(['image', 'audio', 'video']))\n .optional();\n\nexport const MediaUnderstandingModelSchema = z\n .object({\n provider: z.string().optional(),\n model: z.string().optional(),\n capabilities: MediaUnderstandingCapabilitiesSchema,\n type: z.union([z.literal('provider'), z.literal('cli')]).optional(),\n command: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n apiKey: z.string().optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n /** Primary provider id — any registered MediaUnderstandingProvider id. */\n provider: z.string().min(1).default('xopc-local'),\n fallback: STTFallbackConfigSchema.default({ enabled: false, order: ['xopc-local'] }),\n timeoutMs: z.number().int().min(1000).max(180000).optional(),\n /** Ordered model entries for this capability (OpenClaw `tools.media.audio.models`). */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), STTProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// TTS (Text-to-Speech) Config\n// ============================================\n\nconst TtsProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const TTSProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n voice: z.string().optional(),\n })\n .catchall(TtsProviderConfigCatchallSchema);\n\nexport const TTSFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z\n .array(z.string().min(1))\n .default(['openai', 'alibaba', 'minimax', 'edge']),\n});\n\nexport const TTSModelOverridesConfigSchema = z.object({\n enabled: z.boolean().default(true),\n allowText: z.boolean().default(true),\n allowProvider: z.boolean().default(false),\n allowVoice: z.boolean().default(true),\n allowModelId: z.boolean().default(true),\n allowVoiceSettings: z.boolean().default(false),\n allowNormalization: z.boolean().default(false),\n allowSeed: z.boolean().default(false),\n});\n\nexport const TTSEdgeConfigSchema = z.object({\n enabled: z.boolean().default(true),\n voice: z.string().optional(),\n lang: z.string().optional(),\n outputFormat: z.string().optional(),\n pitch: z.string().optional(),\n rate: z.string().optional(),\n volume: z.string().optional(),\n proxy: z.string().optional(),\n timeoutMs: z.number().int().min(1000).max(120000).optional(),\n});\n\nexport const TTSSummarizationConfigSchema = z.object({\n enabled: z.boolean().optional(),\n targetLength: z.number().int().min(1).optional(),\n threshold: z.number().int().min(1).optional(),\n model: z.string().optional(),\n});\n\nexport const TTSConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n /** Primary provider id — any registered SpeechProviderPlugin id. */\n provider: z.string().min(1).default('edge'),\n trigger: z.enum(['off', 'always', 'inbound', 'tagged']).default('inbound'),\n fallback: TTSFallbackConfigSchema.optional(),\n maxTextLength: z.number().int().min(1).default(512), // Conservative default to accommodate all providers (Alibaba limit is 512)\n timeoutMs: z.number().int().min(1000).max(180000).default(60000),\n summarization: TTSSummarizationConfigSchema.optional(),\n modelOverrides: TTSModelOverridesConfigSchema.optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), TTSProviderConfigSchema).optional(),\n })\n .strict();\n\nexport const VoiceRefinementConfigSchema = z\n .object({\n mode: z.enum(['off', 'punctuation', 'light', 'custom']).default('off'),\n /** Optional provider/model reference used only when refinement is enabled. */\n model: z.string().min(1).optional(),\n customInstruction: z.string().max(4000).optional(),\n })\n .strict();\n\nexport const VoiceConfigSchema = z\n .object({\n languageMode: z.enum(['auto', 'manual']).optional(),\n language: z.enum(['en', 'zh']).optional(),\n input: z\n .object({\n refinement: VoiceRefinementConfigSchema.optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .optional();\n\n// ============================================\n// messages.* — delivery / presentation concerns\n// ============================================\n\nexport const MessagesConfigSchema = z.object({\n /** Voice (text-to-speech) output configuration. */\n tts: TTSConfigSchema.optional(),\n}).optional();\n\nexport const ToolsMediaAudioConfigSchema = STTConfigSchema;\n\nexport const ToolsMediaConfigSchema = z\n .object({\n /** Shared model entries applied across media capabilities when entry lacks capabilities. */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Audio (speech-to-text) capability provider config. */\n audio: ToolsMediaAudioConfigSchema.optional(),\n })\n .optional();\n\n// ============================================\n// Provider Configs (capability providers: image / audio / video)\n// ============================================\n\n/**\n * Optional Azure OpenAI overrides used when an OpenAI image-generation\n * request should hit an Azure deployment instead of `api.openai.com`.\n *\n * URL template (when present):\n * `https://<resource>.openai.azure.com/openai/deployments/<deployment>/images/generations?api-version=<apiVersion>`\n */\nexport const ProviderAzureConfigSchema = z\n .object({\n /** Azure resource name (subdomain before `.openai.azure.com`). */\n resource: z.string().min(1).optional(),\n /** Azure deployment id (configured per model). */\n deployment: z.string().min(1).optional(),\n /** Azure REST API version, e.g. `2024-08-01-preview`. */\n apiVersion: z.string().min(1).optional(),\n })\n .strict();\n\n/** Per-vendor request overrides applied by the provider HTTP layer. */\nexport const ProviderRequestOverridesSchema = z\n .object({\n /** Hard cap for a single HTTP call (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /** Extra headers merged into every outbound request. */\n headers: z.record(z.string(), z.string()).optional(),\n })\n .strict();\n\n/**\n * Generic per-vendor provider config — used by image / audio / video\n * capability providers via `cfg.providers.<id>`. Kept loose (`.strict()` but\n * everything optional) so adding a new vendor never requires a config\n * migration.\n */\nexport const ProviderAuthConfigSchema = z\n .object({\n /** Static API key (api-key / azure-key modes). */\n apiKey: z.string().optional(),\n /** Override the default REST base URL. */\n baseUrl: z.string().url().optional(),\n /** Vendor region (DashScope: `beijing` / `singapore`; AWS: region id). */\n region: z.string().optional(),\n /** Image-only base URL override (DashScope splits image vs LLM). */\n imageBaseUrl: z.string().url().optional(),\n /** Per-vendor request overrides. */\n request: ProviderRequestOverridesSchema.optional(),\n /** Azure OpenAI deployment overrides; only consumed by OpenAI image provider. */\n azure: ProviderAzureConfigSchema.optional(),\n })\n .strict();\n\nexport type ProviderAuthConfig = z.infer<typeof ProviderAuthConfigSchema>;\n\n/**\n * `cfg.providers.<id>` is keyed by provider id (`openai`, `dashscope`,\n * `minimax`, `google`, `fal`, …). Every entry is optional and validated by\n * {@link ProviderAuthConfigSchema}.\n */\nexport const ProvidersConfigSchema = z.record(z.string(), ProviderAuthConfigSchema);\n\nexport type ProvidersConfig = z.infer<typeof ProvidersConfigSchema>;\n\n// ============================================\n// Extension Configs \n// ============================================\n\n// Security config for extensions \nexport const ExtensionSecurityConfigSchema = z.object({\n checkPermissions: z.boolean().default(true),\n allowUntrusted: z.boolean().default(false),\n allow: z.array(z.string()).default([]),\n trackProvenance: z.boolean().default(true),\n allowPromptInjection: z.boolean().default(false),\n});\n\n// Slot config for extensions \nexport const ExtensionSlotsConfigSchema = z.object({\n memory: z.string().optional(),\n tts: z.string().optional(),\n imageGeneration: z.string().optional(),\n webSearch: z.string().optional(),\n});\n\n// Complete extensions config\n// Extension config allows both known fields AND arbitrary extension-specific config\n// Known fields: enabled (array), allow (array), security (object), slots (object)\n// Arbitrary: any other key is extension-specific config (e.g., extensions.hello.greeting)\nexport const ExtensionsConfigSchema: z.ZodType<Record<string, unknown>> = z.record(z.string(), z.unknown());\n\n// ============================================\n// Update Config\n// ============================================\n\nexport const UpdateAutoConfigSchema = z\n .object({\n /** Enable automatic update installation. Default false. */\n enabled: z.boolean().default(false),\n /** Hours to wait before applying a stable update after first detection. */\n stableDelayHours: z.number().min(0).default(6),\n /** Additional random jitter hours for stable rollout (avoids thundering herd). */\n stableJitterHours: z.number().min(0).default(12),\n /** How often to re-check for beta updates (hours). Min 0.25. */\n betaCheckIntervalHours: z.number().min(0.25).default(1),\n })\n .strict()\n .optional();\n\n/** Persistent `/goal` (Ralph loop) — Hermes-aligned defaults. */\nexport const GoalNotificationEventSchema = z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n]);\n\nexport const GoalNotificationTargetSchema = z\n .object({\n channel: z.string().min(1),\n chatId: z.string().min(1),\n accountId: z.string().optional(),\n threadId: z.union([z.string(), z.number()]).optional(),\n silent: z.boolean().optional(),\n events: z.array(GoalNotificationEventSchema).optional(),\n })\n .strict();\n\nexport const GoalNotificationsConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Notify Telegram/Weixin chats bound to the goal activeSessionKey. */\n includeLinkedSessions: z.boolean().default(true),\n /** Channels eligible for linked-session notifications. */\n channels: z.array(z.string().min(1)).default(['telegram', 'weixin']),\n events: z\n .array(GoalNotificationEventSchema)\n .default(['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry']),\n targets: z.array(GoalNotificationTargetSchema).default([]),\n })\n .strict()\n .default({\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n });\n\nexport const GoalsConfigSchema = z\n .object({\n /** Max continuation turns before auto-pause (Hermes default 20). */\n maxTurns: z.number().int().min(1).max(500).default(20),\n /** Optional judge model ref; defaults to the active agent model. */\n judgeModelRef: z.string().optional(),\n /**\n * When true (default), first post-turn runs a decomposition judge to build a checklist;\n * subsequent turns evaluate progress per item (Hermes-style). When false, use legacy freeform judge only.\n */\n checklistMode: z.boolean().default(true),\n /**\n * empty_only preserves legacy behavior: the first post-turn decomposition runs only when the\n * goal has no checklist. supplement_existing lets the first post-turn add non-duplicate judge\n * criteria even when the user supplied initial acceptance criteria.\n */\n checklistDecomposePolicy: z.enum(['empty_only', 'supplement_existing']).default('empty_only'),\n /** Auto-pause after this many consecutive judge JSON/tool parse failures (Hermes default 3). */\n maxConsecutiveParseFailures: z.number().int().min(1).max(20).default(3),\n /** Judge LLM call timeout in ms (Hermes uses 60s). */\n judgeTimeoutMs: z.number().int().min(5_000).max(120_000).default(60_000),\n /** Max characters of recent transcript JSON passed to the checklist judge as extra context. */\n checklistHistoryChars: z.number().int().min(0).max(100_000).default(24_000),\n /** External channel notification policy for durable goal lifecycle events. */\n notifications: GoalNotificationsConfigSchema,\n })\n .strict();\n\nexport type GoalsConfig = z.infer<typeof GoalsConfigSchema>;\n\nexport const UpdateConfigSchema = z\n .object({\n /** Check for updates on gateway startup. Default true. */\n checkOnStart: z.boolean().default(true),\n /** Update channel: stable (default), beta, or dev. */\n channel: z.enum(['stable', 'beta', 'dev']).default('stable'),\n /** Automatic update policy. */\n auto: UpdateAutoConfigSchema,\n })\n .strict()\n .optional();\n\nexport type UpdateConfig = z.infer<typeof UpdateConfigSchema>;\n\nexport const CommandsConfigSchema = z\n .object({\n restart: z.boolean().optional(),\n })\n .strict()\n .optional();\n\nexport type CommandsConfig = z.infer<typeof CommandsConfigSchema>;\n\nexport const TuiConfigSchema = z\n .object({\n /** Default agent id for fresh TUI sessions. Leaves global routing (`agents.default`) untouched. */\n defaultAgent: z.string().min(1).optional(),\n })\n .strict()\n .default({});\n\nexport type TuiConfig = z.infer<typeof TuiConfigSchema>;\n\n// ============================================\n// MCP (Model Context Protocol)\n// ============================================\n\nconst McpHttpUrlSchema = z\n .string()\n .url()\n .refine((value) => {\n try {\n const protocol = new URL(value).protocol;\n return protocol === 'http:' || protocol === 'https:';\n } catch {\n return false;\n }\n }, 'MCP server URL must use http or https');\n\nconst ConnectorSecretReferenceSchema = z.object({\n xopcSecretRef: z.object({\n provider: z.string().min(1),\n fieldKey: z.string().min(1),\n }),\n});\n\nconst McpConfigScalarSchema = z.union([z.string(), z.number(), z.boolean(), ConnectorSecretReferenceSchema]);\n\nexport const McpServerSchema = z\n .object({\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), McpConfigScalarSchema).optional(),\n cwd: z.string().optional(),\n workingDirectory: z.string().optional(),\n url: McpHttpUrlSchema.optional(),\n transport: z.enum(['sse', 'streamable-http']).optional(),\n headers: z.record(z.string(), McpConfigScalarSchema).optional(),\n connectionTimeoutMs: z.number().finite().positive().optional(),\n })\n .catchall(z.unknown())\n .superRefine((value, ctx) => {\n const hasCommand = typeof value.command === 'string' && value.command.trim().length > 0;\n const hasUrl = typeof value.url === 'string' && value.url.trim().length > 0;\n if (hasCommand && hasUrl) {\n ctx.addIssue({\n code: 'custom',\n message: 'MCP server cannot define both command and url',\n });\n }\n });\n\nexport const McpConfigSchema = z\n .object({\n servers: z.record(z.string(), McpServerSchema).optional(),\n sessionIdleTtlMs: z.number().finite().min(0).optional(),\n })\n .strict()\n .optional();\n\nexport type McpServerConfig = z.infer<typeof McpServerSchema>;\nexport type McpConfig = z.infer<typeof McpConfigSchema>;\n\n// ============================================\n// Code Intelligence\n// ============================================\n\nexport const CodeIntelligenceConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n agentIds: z.array(z.string().min(1)).default(['coder']),\n indexMode: z.enum(['fast', 'moderate', 'full']).default('moderate'),\n autoIndex: z.boolean().default(true),\n autoRefresh: z.boolean().default(true),\n refreshDebounceMs: z.number().int().min(100).max(30_000).default(600),\n queryTimeoutMs: z.number().int().min(1_000).max(120_000).default(20_000),\n indexTimeoutMs: z.number().int().min(10_000).max(30 * 60_000).default(5 * 60_000),\n binaryPath: z.string().min(1).optional(),\n })\n .strict()\n .default({\n enabled: true,\n agentIds: ['coder'],\n indexMode: 'moderate',\n autoIndex: true,\n autoRefresh: true,\n refreshDebounceMs: 600,\n queryTimeoutMs: 20_000,\n indexTimeoutMs: 5 * 60_000,\n });\n\nexport type CodeIntelligenceConfig = z.infer<typeof CodeIntelligenceConfigSchema>;\n\nexport const ConnectorsConfigSchema = z\n .object({\n instances: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n })\n .strict()\n .optional();\n\nexport type ConnectorsConfig = z.infer<typeof ConnectorsConfigSchema>;\n\n// ============================================\n// Root Config\n// ============================================\n\nexport const ConfigSchema = z.object({\n agents: AgentsConfigSchema,\n bindings: BindingsConfigSchema,\n session: SessionConfigSchema,\n channels: ChannelsConfigSchema,\n gateway: GatewayConfigSchema,\n browser: BrowserConfigSchema,\n tunnel: TunnelConfigSchema.optional(),\n workspace: WorkspaceConfigSchema,\n tools: ToolsConfigSchema,\n mcp: McpConfigSchema,\n codeIntelligence: CodeIntelligenceConfigSchema,\n connectors: ConnectorsConfigSchema,\n goals: GoalsConfigSchema.optional(),\n extensions: ExtensionsConfigSchema.default({}),\n /** Per-vendor capability provider config (image / audio / video). */\n providers: ProvidersConfigSchema.optional(),\n modelsDev: ModelsDevConfigSchema,\n /** Delivery / presentation concerns (currently `tts`). */\n messages: MessagesConfigSchema,\n /** User-facing voice input behavior beyond provider selection. */\n voice: VoiceConfigSchema,\n update: UpdateConfigSchema,\n commands: CommandsConfigSchema,\n tui: TuiConfigSchema,\n}).default({\n agents: {\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: DEFAULT_AGENT_MODELS,\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Smart Assistant',\n description: 'General-purpose personal assistant.',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n understanding: {\n enabled: true,\n adaptiveCadence: true,\n reviewIntervalTurns: 10,\n maxHistoryMessages: 80,\n maxDurationMs: 120_000,\n },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n },\n bindings: [],\n session: {\n scope: 'per-sender' as const,\n mainKey: 'main',\n dmScope: 'main' as const,\n },\n channels: {\n telegram: {\n enabled: false,\n debug: false,\n defaults: {\n dmPolicy: 'pairing' as const,\n groupPolicy: 'open' as const,\n replyToMode: 'off' as const,\n historyLimit: 50,\n textChunkLimit: 4000,\n streaming: { mode: 'partial' as const },\n },\n accounts: {\n default: {\n accountId: 'default',\n enabled: true,\n botToken: '',\n allowFrom: [],\n groupAllowFrom: [],\n },\n },\n },\n },\n gateway: {\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'store',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n },\n browser: {\n enabled: true,\n backend: 'extension' as const,\n },\n tools: {\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n },\n codeIntelligence: {\n enabled: true,\n agentIds: ['coder'],\n indexMode: 'moderate' as const,\n autoIndex: true,\n autoRefresh: true,\n refreshDebounceMs: 600,\n queryTimeoutMs: 20_000,\n indexTimeoutMs: 5 * 60_000,\n },\n goals: {\n maxTurns: 20,\n checklistMode: true,\n checklistDecomposePolicy: 'empty_only',\n maxConsecutiveParseFailures: 3,\n judgeTimeoutMs: 60_000,\n checklistHistoryChars: 24_000,\n notifications: {\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n },\n },\n extensions: {\n allow: [],\n security: {\n checkPermissions: true,\n allowUntrusted: false,\n allow: [],\n trackProvenance: true,\n allowPromptInjection: false,\n },\n slots: {},\n },\n modelsDev: {\n enabled: true,\n },\n tui: {},\n // messages.tts / tools.media.audio start undefined; the factory layer fills\n // in provider-level defaults (model/voice) on demand. Fresh configs don't\n // ship with enabled providers so they never make surprise STT/TTS calls.\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\nexport type GatewayAuthConfig = z.infer<typeof GatewayAuthSchema>;\nexport type GatewayTrustedProxyConfig = z.infer<typeof GatewayTrustedProxySchema>;\nexport type GatewayAuthRateLimitConfig = z.infer<typeof GatewayAuthRateLimitSchema>;\nexport type GatewayBindMode = z.infer<typeof GatewayBindModeSchema>;\nexport type STTConfig = z.infer<typeof STTConfigSchema>;\nexport type TTSConfig = z.infer<typeof TTSConfigSchema>;\nexport type VoiceConfig = z.infer<typeof VoiceConfigSchema>;\n\n// ============================================\n// Helper Functions\n// ============================================\n\n/**\n * Parse a model reference string.\n */\nexport interface ParsedModelRef {\n provider: string;\n model: string;\n}\n\nexport function getAgentDefaultModelRef(config: Config): string | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelRef: string | undefined;\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n const roles = models?.roles ?? {};\n const defaultRole = models?.defaultRole ?? Object.keys(roles)[0];\n const role = defaultRole ? roles[defaultRole] : undefined;\n const next = role?.model.trim();\n if (next) modelRef = next;\n };\n const rootPresetIds = [\n ...(config.agents.capabilityPresets[config.agents.defaultPreset] ? [config.agents.defaultPreset] : []),\n ...(agent.extends ?? []).filter((id) => id !== config.agents.defaultPreset),\n ];\n for (const presetId of linearizePresetIds(rootPresetIds, config.agents.capabilityPresets)) {\n applyModels(config.agents.capabilityPresets[presetId]?.models);\n }\n applyModels(agent.models);\n return modelRef;\n}\n\nfunction getAgentDefaultModelsConfig(config: Config): AgentModelsConfig | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelConfig: AgentModelsConfig | undefined;\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n if (!models) return;\n modelConfig = {\n ...modelConfig,\n ...models,\n roles: {\n ...(modelConfig?.roles ?? {}),\n ...(models.roles ?? {}),\n },\n };\n };\n const rootPresetIds = [\n ...(config.agents.capabilityPresets[config.agents.defaultPreset] ? [config.agents.defaultPreset] : []),\n ...(agent.extends ?? []).filter((id) => id !== config.agents.defaultPreset),\n ];\n for (const presetId of linearizePresetIds(rootPresetIds, config.agents.capabilityPresets)) {\n applyModels(config.agents.capabilityPresets[presetId]?.models);\n }\n applyModels(agent.models);\n return modelConfig;\n}\n\nexport function getAgentDefaultImageModelConfig(config: Config): AgentModelConfig | undefined {\n return getAgentDefaultModelsConfig(config)?.imageModel;\n}\n\nexport function getAgentDefaultImageGenerationModelConfig(\n config: Config,\n): AgentImageGenerationModelConfig | undefined {\n return getAgentDefaultModelsConfig(config)?.imageGenerationModel;\n}\n\n/** `provider/model` or null when invalid. */\nexport function parseModelRef(ref: string): ParsedModelRef | null {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n if (idx <= 0 || idx === trimmed.length - 1) {\n return null;\n }\n return { provider: trimmed.slice(0, idx).trim(), model: trimmed.slice(idx + 1).trim() };\n}\n"],"mappings":";;;;;;;;;;AA03CA,SAAgB,wBAAwB,QAAoC;CAC1E,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,KAAK,GAAG,OAAO,OAAO,OAAO,EAAE;CACzE,MAAM,YACJ,OAAO,QAAQ,SAAS,MAAM,IAC9B,KAAK,MAAM,UAAW,MAAgC,YAAY,KAAK,EAAE,IAAI,MAAM,IACnF,KAAK,IAAI;CACX,MAAM,QAAQ,KAAK,MAAM,UAAU,MAAM,YAAY,SAAS,MAAM,OAAO,UAAU,IAAI,KAAK;AAC9F,KAAI,CAAC,MAAO,QAAO,KAAA;CAEnB,IAAI;CACJ,MAAM,eAAe,WAAgD;EACnE,MAAM,QAAQ,QAAQ,SAAS,EAAE;EACjC,MAAM,cAAc,QAAQ,eAAe,OAAO,KAAK,MAAM,CAAC;EAE9D,MAAM,QADO,cAAc,MAAM,eAAe,KAAA,IAC7B,MAAM,MAAM;AAC/B,MAAI,KAAM,YAAW;;CAEv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T,OAAO;GACP,UAAU;IACR,UAAU;IACV,aAAa;IACb,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,WAAW,EAAE,MAAM,WAAoB;IACxC;GACD,UAAU,EACR,SAAS;IACP,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW,EAAE;IACb,gBAAgB,EAAE;IACnB,EACF;GACF,EACF;EACD,SAAS;GACP,MAAM;GACN,MAAM;GACN,MAAM,EACJ,MAAM,SACP;GACD,WAAW;IACT,SAAS;IACT,YAAY;IACZ,4BAA4B;IAC7B;GACD,mBAAmB;GACnB,aAAa,EAAE;GACf,2BAA2B;GAC3B,oBAAoB;GACrB;EACD,SAAS;GACP,SAAS;GACT,SAAS;GACV;EACD,OAAO,EACL,KAAK,EACH,QAAQ;GACN,YAAY;GACZ,WAAW,EAAE;GACd,EACF,EACF;EACD,kBAAkB;GAChB,SAAS;GACT,UAAU,CAAC,QAAQ;GACnB,WAAW;GACX,WAAW;GACX,aAAa;GACb,mBAAmB;GACnB,gBAAgB;GAChB,gBAAgB,IAAI;GACrB;EACD,OAAO;GACL,UAAU;GACV,eAAe;GACf,0BAA0B;GAC1B,6BAA6B;GAC7B,gBAAgB;GAChB,uBAAuB;GACvB,eAAe;IACb,SAAS;IACT,uBAAuB;IACvB,UAAU,CAAC,YAAY,SAAS;IAChC,QAAQ;KAAC;KAAQ;KAAW;KAAe;KAAgB;KAAc;IACzE,SAAS,EAAE;IACZ;GACF;EACD,YAAY;GACV,OAAO,EAAE;GACT,UAAU;IACR,kBAAkB;IAClB,gBAAgB;IAChB,OAAO,EAAE;IACT,iBAAiB;IACjB,sBAAsB;IACvB;GACD,OAAO,EAAE;GACV;EACD,WAAW,EACT,SAAS,MACV;EACD,KAAK,EAAE;EAIR,CAAC"}
@@ -74,6 +74,12 @@ const COMPOSIO_TOOLKIT_DISPLAY_NAMES = {
74
74
  };
75
75
  const RECOMMENDED = new Set(COMPOSIO_RECOMMENDED_TOOLKITS);
76
76
  const AGENT_READY = new Set(COMPOSIO_AGENT_READY_TOOLKITS);
77
+ const PERSONAL_CONTEXT_TOOLKITS = new Set([
78
+ "gmail",
79
+ "googledrive",
80
+ "notion",
81
+ "slack"
82
+ ]);
77
83
  const LOCAL_TOOLKIT_LOGO_FILE_NAMES = {
78
84
  googlecalendar: "google-calendar",
79
85
  googledocs: "google-docs",
@@ -151,6 +157,7 @@ function verificationForToolkit(slug) {
151
157
  }
152
158
  function connectorDefinitionFromComposioToolkit(item) {
153
159
  const slug = item.slug.trim().toLowerCase();
160
+ const knowledgeCapabilities = PERSONAL_CONTEXT_TOOLKITS.has(slug) ? ["context", "memory_source"] : [];
154
161
  return {
155
162
  id: `composio-${slug}`,
156
163
  version: "sessions-v1",
@@ -162,12 +169,14 @@ function connectorDefinitionFromComposioToolkit(item) {
162
169
  capabilities: item.isNoAuth ? [
163
170
  "tools",
164
171
  "events",
165
- "workflows"
172
+ "workflows",
173
+ ...knowledgeCapabilities
166
174
  ] : [
167
175
  "tools",
168
176
  "auth.oauth",
169
177
  "events",
170
- "workflows"
178
+ "workflows",
179
+ ...knowledgeCapabilities
171
180
  ],
172
181
  tags: [
173
182
  "composio",
@@ -1 +1 @@
1
- {"version":3,"file":"composio-catalog.js","names":[],"sources":["../../../src/connectors/composio-catalog.ts"],"sourcesContent":["import {\n listCachedConnectorCatalogEntries,\n upsertConnectorCatalogEntry,\n} from '../storage/sqlite/connector-repository.js';\nimport { ComposioSessionsAdapter, type ComposioToolkitCatalogItem } from './composio-sessions.js';\nimport { composioIntegrationStrategy } from './integration-strategy.js';\nimport type { ConnectorCategory, ConnectorDefinition, ConnectorVerificationLevel } from './types.js';\n\nconst CATALOG_CACHE_TTL_MS = 6 * 60 * 60 * 1000;\n\nexport const COMPOSIO_RECOMMENDED_TOOLKITS = [\n 'gmail',\n 'googlecalendar',\n 'googledrive',\n 'notion',\n 'slack',\n 'github',\n 'linear',\n 'outlook',\n 'microsoft_teams',\n 'jira',\n 'dropbox',\n 'todoist',\n] as const;\n\nexport const COMPOSIO_AGENT_READY_TOOLKITS = [\n ...COMPOSIO_RECOMMENDED_TOOLKITS,\n 'discord',\n 'googledocs',\n 'googlesheets',\n 'trello',\n 'asana',\n 'clickup',\n 'twitter',\n 'spotify',\n 'telegram',\n 'whatsapp',\n 'shopify',\n 'stripe',\n 'hubspot',\n 'salesforce',\n 'airtable',\n 'figma',\n 'youtube',\n 'one_drive',\n 'excel',\n] as const;\n\nexport type ComposioAgentReadyToolkit = typeof COMPOSIO_AGENT_READY_TOOLKITS[number];\n\nexport const COMPOSIO_TOOLKIT_DISPLAY_NAMES: Record<ComposioAgentReadyToolkit, string> = {\n gmail: 'Gmail',\n googlecalendar: 'Google Calendar',\n googledrive: 'Google Drive',\n notion: 'Notion',\n slack: 'Slack',\n github: 'GitHub',\n linear: 'Linear via Composio',\n outlook: 'Outlook',\n microsoft_teams: 'Microsoft Teams',\n jira: 'Jira',\n dropbox: 'Dropbox',\n todoist: 'Todoist',\n discord: 'Discord',\n googledocs: 'Google Docs',\n googlesheets: 'Google Sheets',\n trello: 'Trello',\n asana: 'Asana',\n clickup: 'ClickUp',\n twitter: 'X (Twitter)',\n spotify: 'Spotify',\n telegram: 'Telegram',\n whatsapp: 'WhatsApp',\n shopify: 'Shopify',\n stripe: 'Stripe',\n hubspot: 'HubSpot',\n salesforce: 'Salesforce',\n airtable: 'Airtable',\n figma: 'Figma',\n youtube: 'YouTube',\n one_drive: 'OneDrive',\n excel: 'Microsoft Excel',\n};\n\nconst RECOMMENDED = new Set<string>(COMPOSIO_RECOMMENDED_TOOLKITS);\nconst AGENT_READY = new Set<string>(COMPOSIO_AGENT_READY_TOOLKITS);\n\nconst LOCAL_TOOLKIT_LOGO_FILE_NAMES: Readonly<Record<string, string>> = {\n googlecalendar: 'google-calendar',\n googledocs: 'google-docs',\n googledrive: 'google-drive',\n googlesheets: 'google-sheets',\n microsoft_teams: 'microsoft-teams',\n one_drive: 'one-drive',\n};\n\nfunction composioLogoUrl(slug: string): string {\n if (AGENT_READY.has(slug)) {\n const fileName = LOCAL_TOOLKIT_LOGO_FILE_NAMES[slug] ?? slug;\n return `/connector-icons/${fileName}.svg`;\n }\n return `/connector-icons/composio/${encodeURIComponent(slug)}`;\n}\n\nconst CONNECTOR_DESCRIPTIONS: Record<string, string> = {\n gmail: 'Find, draft, and send Gmail messages with explicit write confirmation.',\n googlecalendar: 'Find and manage Google Calendar events from conversations and workflows.',\n googledrive: 'Search and work with approved files in Google Drive.',\n notion: 'Search and update approved Notion pages and databases.',\n slack: 'Read conversations and send approved messages in Slack.',\n github: 'Work with repositories, issues, pull requests, and reviews on GitHub.',\n linear: 'Find and manage Linear issues and projects.',\n outlook: 'Read and send Outlook mail with account-level controls.',\n microsoft_teams: 'Read conversations and send approved Microsoft Teams messages.',\n jira: 'Find and manage Jira issues for an approved site.',\n dropbox: 'Search and work with approved Dropbox files.',\n todoist: 'Create and manage personal or team tasks in Todoist.',\n discord: 'Read conversations and send approved messages in Discord.',\n googledocs: 'Find, read, and update approved documents in Google Docs.',\n googlesheets: 'Read and update approved spreadsheets in Google Sheets.',\n trello: 'Find and manage Trello boards, lists, and cards.',\n asana: 'Find and manage Asana tasks and projects.',\n clickup: 'Find and manage ClickUp tasks, lists, and workspaces.',\n twitter: 'Search posts and publish approved updates on X.',\n spotify: 'Search Spotify and manage approved playlists and playback actions.',\n telegram: 'Read conversations and send approved Telegram messages.',\n whatsapp: 'Read conversations and send approved WhatsApp messages.',\n shopify: 'Work with Shopify products, customers, and orders.',\n stripe: 'Work with Stripe customers, payments, invoices, and subscriptions.',\n hubspot: 'Find and manage HubSpot contacts, companies, and deals.',\n salesforce: 'Find and manage approved Salesforce records and opportunities.',\n airtable: 'Read and update approved Airtable bases and records.',\n figma: 'Find Figma files, inspect project context, and manage comments.',\n youtube: 'Find and manage YouTube videos, channels, and playlists.',\n one_drive: 'Search and work with approved files in OneDrive.',\n excel: 'Read and update approved Microsoft Excel workbooks and tables.',\n};\n\nconst CODE_TOOLKITS = new Set(['github', 'gitlab', 'bitbucket', 'linear', 'jira']);\nconst DOC_TOOLKITS = new Set(['notion', 'googledocs', 'figma']);\nconst DATA_TOOLKITS = new Set(['googledrive', 'dropbox', 'one_drive', 'googlesheets', 'excel', 'airtable']);\n\nfunction categoryForToolkit(slug: string): ConnectorCategory {\n if (CODE_TOOLKITS.has(slug)) return 'code';\n if (DOC_TOOLKITS.has(slug)) return 'docs';\n if (DATA_TOOLKITS.has(slug)) return 'data';\n return 'automation';\n}\n\nfunction verificationForToolkit(slug: string): ConnectorVerificationLevel {\n if (RECOMMENDED.has(slug) || AGENT_READY.has(slug)) return 'verified';\n return 'experimental';\n}\n\nexport function connectorDefinitionFromComposioToolkit(item: ComposioToolkitCatalogItem): ConnectorDefinition {\n const slug = item.slug.trim().toLowerCase();\n return {\n id: `composio-${slug}`,\n version: 'sessions-v1',\n displayName: item.name,\n description: CONNECTOR_DESCRIPTIONS[slug]\n ?? `Connect ${item.name} so agents can use approved actions on your behalf.`,\n category: categoryForToolkit(slug),\n kind: 'composio',\n source: 'builtin',\n capabilities: item.isNoAuth\n ? ['tools', 'events', 'workflows']\n : ['tools', 'auth.oauth', 'events', 'workflows'],\n tags: ['composio', slug, verificationForToolkit(slug)],\n branding: {\n logoUrl: composioLogoUrl(slug),\n source: 'composio-catalog',\n fetchedAt: new Date().toISOString(),\n },\n verificationLevel: verificationForToolkit(slug),\n auth: item.isNoAuth\n ? { mode: 'none' }\n : { mode: 'oauth', provider: 'composio' },\n setup: {},\n runtime: { type: 'composio', toolkit: slug, role: 'toolkit' },\n integrationStrategy: composioIntegrationStrategy(slug),\n };\n}\n\nexport type ComposioCatalogResult = {\n connectors: ConnectorDefinition[];\n source: 'live' | 'cache';\n stale: boolean;\n fetchedAt?: string;\n};\n\nexport async function listComposioConnectorCatalog(options: {\n principalId?: string;\n refresh?: boolean;\n adapter?: ComposioSessionsAdapter;\n now?: number;\n} = {}): Promise<ComposioCatalogResult> {\n const now = options.now ?? Date.now();\n const cached = listCachedConnectorCatalogEntries('composio');\n const freshCached = cached.filter((entry) => !entry.expiresAt || Date.parse(entry.expiresAt) > now);\n if (!options.refresh && freshCached.length > 0) {\n return {\n connectors: freshCached.map((entry) => entry.definition),\n source: 'cache',\n stale: false,\n fetchedAt: freshCached[0]?.fetchedAt,\n };\n }\n\n try {\n const adapter = options.adapter ?? new ComposioSessionsAdapter();\n const toolkits = await adapter.listToolkitCatalog({ principalId: options.principalId ?? 'local-owner' });\n const fetchedAt = new Date(now).toISOString();\n const expiresAt = new Date(now + CATALOG_CACHE_TTL_MS).toISOString();\n const connectors = toolkits.map(connectorDefinitionFromComposioToolkit);\n for (const definition of connectors) {\n upsertConnectorCatalogEntry({\n connectorId: definition.id,\n provider: 'composio',\n definition,\n fetchedAt,\n expiresAt,\n });\n }\n return { connectors, source: 'live', stale: false, fetchedAt };\n } catch (error) {\n if (cached.length === 0) throw error;\n return {\n connectors: cached.map((entry) => entry.definition),\n source: 'cache',\n stale: true,\n fetchedAt: cached[0]?.fetchedAt,\n };\n }\n}\n"],"mappings":";;;;AAQA,MAAM,uBAAuB,MAAS,KAAK;AAE3C,MAAa,gCAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,gCAAgC;CAC3C,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAID,MAAa,iCAA4E;CACvF,OAAO;CACP,gBAAgB;CAChB,aAAa;CACb,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,iBAAiB;CACjB,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACT,YAAY;CACZ,cAAc;CACd,QAAQ;CACR,OAAO;CACP,SAAS;CACT,SAAS;CACT,SAAS;CACT,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,UAAU;CACV,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AAM,qBAAqB,CAAC,aAAa;EACpE,MAAM,aAAa,SAAS,IAAI,uCAAuC;AACvE,OAAK,MAAM,cAAc,WACvB,6BAA4B;GAC1B,aAAa,WAAW;GACxB,UAAU;GACV;GACA;GACA;GACD,CAAC;AAEJ,SAAO;GAAE;GAAY,QAAQ;GAAQ,OAAO;GAAO;GAAW;UACvD,OAAO;AACd,MAAI,OAAO,WAAW,EAAG,OAAM;AAC/B,SAAO;GACL,YAAY,OAAO,KAAK,UAAU,MAAM,WAAW;GACnD,QAAQ;GACR,OAAO;GACP,WAAW,OAAO,IAAI;GACvB"}
1
+ {"version":3,"file":"composio-catalog.js","names":[],"sources":["../../../src/connectors/composio-catalog.ts"],"sourcesContent":["import {\n listCachedConnectorCatalogEntries,\n upsertConnectorCatalogEntry,\n} from '../storage/sqlite/connector-repository.js';\nimport { ComposioSessionsAdapter, type ComposioToolkitCatalogItem } from './composio-sessions.js';\nimport { composioIntegrationStrategy } from './integration-strategy.js';\nimport type { ConnectorCategory, ConnectorDefinition, ConnectorVerificationLevel } from './types.js';\n\nconst CATALOG_CACHE_TTL_MS = 6 * 60 * 60 * 1000;\n\nexport const COMPOSIO_RECOMMENDED_TOOLKITS = [\n 'gmail',\n 'googlecalendar',\n 'googledrive',\n 'notion',\n 'slack',\n 'github',\n 'linear',\n 'outlook',\n 'microsoft_teams',\n 'jira',\n 'dropbox',\n 'todoist',\n] as const;\n\nexport const COMPOSIO_AGENT_READY_TOOLKITS = [\n ...COMPOSIO_RECOMMENDED_TOOLKITS,\n 'discord',\n 'googledocs',\n 'googlesheets',\n 'trello',\n 'asana',\n 'clickup',\n 'twitter',\n 'spotify',\n 'telegram',\n 'whatsapp',\n 'shopify',\n 'stripe',\n 'hubspot',\n 'salesforce',\n 'airtable',\n 'figma',\n 'youtube',\n 'one_drive',\n 'excel',\n] as const;\n\nexport type ComposioAgentReadyToolkit = typeof COMPOSIO_AGENT_READY_TOOLKITS[number];\n\nexport const COMPOSIO_TOOLKIT_DISPLAY_NAMES: Record<ComposioAgentReadyToolkit, string> = {\n gmail: 'Gmail',\n googlecalendar: 'Google Calendar',\n googledrive: 'Google Drive',\n notion: 'Notion',\n slack: 'Slack',\n github: 'GitHub',\n linear: 'Linear via Composio',\n outlook: 'Outlook',\n microsoft_teams: 'Microsoft Teams',\n jira: 'Jira',\n dropbox: 'Dropbox',\n todoist: 'Todoist',\n discord: 'Discord',\n googledocs: 'Google Docs',\n googlesheets: 'Google Sheets',\n trello: 'Trello',\n asana: 'Asana',\n clickup: 'ClickUp',\n twitter: 'X (Twitter)',\n spotify: 'Spotify',\n telegram: 'Telegram',\n whatsapp: 'WhatsApp',\n shopify: 'Shopify',\n stripe: 'Stripe',\n hubspot: 'HubSpot',\n salesforce: 'Salesforce',\n airtable: 'Airtable',\n figma: 'Figma',\n youtube: 'YouTube',\n one_drive: 'OneDrive',\n excel: 'Microsoft Excel',\n};\n\nconst RECOMMENDED = new Set<string>(COMPOSIO_RECOMMENDED_TOOLKITS);\nconst AGENT_READY = new Set<string>(COMPOSIO_AGENT_READY_TOOLKITS);\nconst PERSONAL_CONTEXT_TOOLKITS = new Set(['gmail', 'googledrive', 'notion', 'slack']);\n\nconst LOCAL_TOOLKIT_LOGO_FILE_NAMES: Readonly<Record<string, string>> = {\n googlecalendar: 'google-calendar',\n googledocs: 'google-docs',\n googledrive: 'google-drive',\n googlesheets: 'google-sheets',\n microsoft_teams: 'microsoft-teams',\n one_drive: 'one-drive',\n};\n\nfunction composioLogoUrl(slug: string): string {\n if (AGENT_READY.has(slug)) {\n const fileName = LOCAL_TOOLKIT_LOGO_FILE_NAMES[slug] ?? slug;\n return `/connector-icons/${fileName}.svg`;\n }\n return `/connector-icons/composio/${encodeURIComponent(slug)}`;\n}\n\nconst CONNECTOR_DESCRIPTIONS: Record<string, string> = {\n gmail: 'Find, draft, and send Gmail messages with explicit write confirmation.',\n googlecalendar: 'Find and manage Google Calendar events from conversations and workflows.',\n googledrive: 'Search and work with approved files in Google Drive.',\n notion: 'Search and update approved Notion pages and databases.',\n slack: 'Read conversations and send approved messages in Slack.',\n github: 'Work with repositories, issues, pull requests, and reviews on GitHub.',\n linear: 'Find and manage Linear issues and projects.',\n outlook: 'Read and send Outlook mail with account-level controls.',\n microsoft_teams: 'Read conversations and send approved Microsoft Teams messages.',\n jira: 'Find and manage Jira issues for an approved site.',\n dropbox: 'Search and work with approved Dropbox files.',\n todoist: 'Create and manage personal or team tasks in Todoist.',\n discord: 'Read conversations and send approved messages in Discord.',\n googledocs: 'Find, read, and update approved documents in Google Docs.',\n googlesheets: 'Read and update approved spreadsheets in Google Sheets.',\n trello: 'Find and manage Trello boards, lists, and cards.',\n asana: 'Find and manage Asana tasks and projects.',\n clickup: 'Find and manage ClickUp tasks, lists, and workspaces.',\n twitter: 'Search posts and publish approved updates on X.',\n spotify: 'Search Spotify and manage approved playlists and playback actions.',\n telegram: 'Read conversations and send approved Telegram messages.',\n whatsapp: 'Read conversations and send approved WhatsApp messages.',\n shopify: 'Work with Shopify products, customers, and orders.',\n stripe: 'Work with Stripe customers, payments, invoices, and subscriptions.',\n hubspot: 'Find and manage HubSpot contacts, companies, and deals.',\n salesforce: 'Find and manage approved Salesforce records and opportunities.',\n airtable: 'Read and update approved Airtable bases and records.',\n figma: 'Find Figma files, inspect project context, and manage comments.',\n youtube: 'Find and manage YouTube videos, channels, and playlists.',\n one_drive: 'Search and work with approved files in OneDrive.',\n excel: 'Read and update approved Microsoft Excel workbooks and tables.',\n};\n\nconst CODE_TOOLKITS = new Set(['github', 'gitlab', 'bitbucket', 'linear', 'jira']);\nconst DOC_TOOLKITS = new Set(['notion', 'googledocs', 'figma']);\nconst DATA_TOOLKITS = new Set(['googledrive', 'dropbox', 'one_drive', 'googlesheets', 'excel', 'airtable']);\n\nfunction categoryForToolkit(slug: string): ConnectorCategory {\n if (CODE_TOOLKITS.has(slug)) return 'code';\n if (DOC_TOOLKITS.has(slug)) return 'docs';\n if (DATA_TOOLKITS.has(slug)) return 'data';\n return 'automation';\n}\n\nfunction verificationForToolkit(slug: string): ConnectorVerificationLevel {\n if (RECOMMENDED.has(slug) || AGENT_READY.has(slug)) return 'verified';\n return 'experimental';\n}\n\nexport function connectorDefinitionFromComposioToolkit(item: ComposioToolkitCatalogItem): ConnectorDefinition {\n const slug = item.slug.trim().toLowerCase();\n const knowledgeCapabilities = PERSONAL_CONTEXT_TOOLKITS.has(slug)\n ? ['context', 'memory_source'] as const\n : [];\n return {\n id: `composio-${slug}`,\n version: 'sessions-v1',\n displayName: item.name,\n description: CONNECTOR_DESCRIPTIONS[slug]\n ?? `Connect ${item.name} so agents can use approved actions on your behalf.`,\n category: categoryForToolkit(slug),\n kind: 'composio',\n source: 'builtin',\n capabilities: item.isNoAuth\n ? ['tools', 'events', 'workflows', ...knowledgeCapabilities]\n : ['tools', 'auth.oauth', 'events', 'workflows', ...knowledgeCapabilities],\n tags: ['composio', slug, verificationForToolkit(slug)],\n branding: {\n logoUrl: composioLogoUrl(slug),\n source: 'composio-catalog',\n fetchedAt: new Date().toISOString(),\n },\n verificationLevel: verificationForToolkit(slug),\n auth: item.isNoAuth\n ? { mode: 'none' }\n : { mode: 'oauth', provider: 'composio' },\n setup: {},\n runtime: { type: 'composio', toolkit: slug, role: 'toolkit' },\n integrationStrategy: composioIntegrationStrategy(slug),\n };\n}\n\nexport type ComposioCatalogResult = {\n connectors: ConnectorDefinition[];\n source: 'live' | 'cache';\n stale: boolean;\n fetchedAt?: string;\n};\n\nexport async function listComposioConnectorCatalog(options: {\n principalId?: string;\n refresh?: boolean;\n adapter?: ComposioSessionsAdapter;\n now?: number;\n} = {}): Promise<ComposioCatalogResult> {\n const now = options.now ?? Date.now();\n const cached = listCachedConnectorCatalogEntries('composio');\n const freshCached = cached.filter((entry) => !entry.expiresAt || Date.parse(entry.expiresAt) > now);\n if (!options.refresh && freshCached.length > 0) {\n return {\n connectors: freshCached.map((entry) => entry.definition),\n source: 'cache',\n stale: false,\n fetchedAt: freshCached[0]?.fetchedAt,\n };\n }\n\n try {\n const adapter = options.adapter ?? new ComposioSessionsAdapter();\n const toolkits = await adapter.listToolkitCatalog({ principalId: options.principalId ?? 'local-owner' });\n const fetchedAt = new Date(now).toISOString();\n const expiresAt = new Date(now + CATALOG_CACHE_TTL_MS).toISOString();\n const connectors = toolkits.map(connectorDefinitionFromComposioToolkit);\n for (const definition of connectors) {\n upsertConnectorCatalogEntry({\n connectorId: definition.id,\n provider: 'composio',\n definition,\n fetchedAt,\n expiresAt,\n });\n }\n return { connectors, source: 'live', stale: false, fetchedAt };\n } catch (error) {\n if (cached.length === 0) throw error;\n return {\n connectors: cached.map((entry) => entry.definition),\n source: 'cache',\n stale: true,\n fetchedAt: cached[0]?.fetchedAt,\n };\n }\n}\n"],"mappings":";;;;AAQA,MAAM,uBAAuB,MAAS,KAAK;AAE3C,MAAa,gCAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,gCAAgC;CAC3C,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAID,MAAa,iCAA4E;CACvF,OAAO;CACP,gBAAgB;CAChB,aAAa;CACb,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,iBAAiB;CACjB,MAAM;CACN,SAAS;CACT,SAAS;CACT,SAAS;CACT,YAAY;CACZ,cAAc;CACd,QAAQ;CACR,OAAO;CACP,SAAS;CACT,SAAS;CACT,SAAS;CACT,UAAU;CACV,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,UAAU;CACV,OAAO;CACP,SAAS;CACT,WAAW;CACX,OAAO;CACR;AAED,MAAM,cAAc,IAAI,IAAY,8BAA8B;AAClE,MAAM,cAAc,IAAI,IAAY,8BAA8B;AAClE,MAAM,4BAA4B,IAAI,IAAI;CAAC;CAAS;CAAe;CAAU;CAAQ,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