@xopcai/xopc 0.0.117 → 0.0.119

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 (590) hide show
  1. package/README.md +26 -24
  2. package/README.zh-CN.md +46 -42
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BBLhJ2C6.js → agent-avatar-dicebear-CU8J6zou.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-B0hkpLhP.js +2 -0
  7. package/dist/gateway/static/root/assets/app-management-settings-panel-B9vfYoEr.js +1 -0
  8. package/dist/gateway/static/root/assets/appearance-settings-ClOzIO24.js +1 -0
  9. package/dist/gateway/static/root/assets/{apps-page-DdDx0V4z.js → apps-page-DU0dz9Zo.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-DZsVqMhU.js → archive-plugin-BkVIgZzA.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CIol6JWX.js → attachment-load-CaCMWh1D.js} +1 -1
  12. package/dist/gateway/static/root/assets/automation-suggestion-card-DhGDpKP3.js +1 -0
  13. package/dist/gateway/static/root/assets/automations-page-CTedroVo.js +1 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-B3UauMfp.js → binary-plugins-B4TO_bsn.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-2HJoFchH.js → block-editor-DJRWwWNI.js} +6 -6
  16. package/dist/gateway/static/root/assets/browser-settings-page-FCDwOOBK.js +8 -0
  17. package/dist/gateway/static/root/assets/capability-presets-api-Befi89CL.js +1 -0
  18. package/dist/gateway/static/root/assets/capability-presets-settings-panel-_G8eb2vJ.js +1 -0
  19. package/dist/gateway/static/root/assets/channel-recipient-api-BNSuJb5f.js +1 -0
  20. package/dist/gateway/static/root/assets/channels-settings-C3d5JBJX.js +1 -0
  21. package/dist/gateway/static/root/assets/cn-BQ_8x0bT.js +1 -0
  22. package/dist/gateway/static/root/assets/connectors-page-yaUNvt5u.js +2 -0
  23. package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +2 -0
  24. package/dist/gateway/static/root/assets/dreaming-settings-DNrdg1Ve.js +1 -0
  25. package/dist/gateway/static/root/assets/{extension-debug-page-DX5WRE_t.js → extension-debug-page-DYh402XV.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-Buah7Bw-.js → extension-page-Cr_TizrN.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-DuroLVnf.js → extension-settings-page-BU1KoKRj.js} +1 -1
  28. package/dist/gateway/static/root/assets/{fetch-B5zdl27C.js → fetch-Y7AEX4H3.js} +1 -1
  29. package/dist/gateway/static/root/assets/format-cron-label-arqgGlVV.js +1 -0
  30. package/dist/gateway/static/root/assets/{gateway-config-api-gT4ZhE7h.js → gateway-config-api-RbMmAOpX.js} +1 -1
  31. package/dist/gateway/static/root/assets/gateway-settings-C79wkXef.js +1 -0
  32. package/dist/gateway/static/root/assets/{gateway-startup-retry-B3kL8KGY.js → gateway-startup-retry-DiD_Tx4N.js} +1 -1
  33. package/dist/gateway/static/root/assets/goal-detail-page-9paXuHdo.js +1 -0
  34. package/dist/gateway/static/root/assets/{goals-config-api-AR-fVh0P.js → goals-config-api-DqxVi0p5.js} +1 -1
  35. package/dist/gateway/static/root/assets/{goals-page-Cpb21ezg.js → goals-page-CS0R-Af2.js} +2 -2
  36. package/dist/gateway/static/root/assets/goals-settings-CSuzZ8Ae.js +1 -0
  37. package/dist/gateway/static/root/assets/heartbeat-settings-DXPaYJm3.js +1 -0
  38. package/dist/gateway/static/root/assets/index-BoKafJIZ.js +191 -0
  39. package/dist/gateway/static/root/assets/index-CArhCcYn.css +1 -0
  40. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Dvg53qnd.js +1 -0
  41. package/dist/gateway/static/root/assets/{logs-page-DefCgF4o.js → logs-page-DLXPcksQ.js} +2 -2
  42. package/dist/gateway/static/root/assets/{markdown-split-ChbR9LGO.js → markdown-split-CpHxbtWJ.js} +1 -1
  43. package/dist/gateway/static/root/assets/{media-plugins-B82oP80n.js → media-plugins-SFPQRSxq.js} +1 -1
  44. package/dist/gateway/static/root/assets/messages-CrDHEbss.js +3 -0
  45. package/dist/gateway/static/root/assets/models-hub-panel-BDF2iyRk.js +2 -0
  46. package/dist/gateway/static/root/assets/note-detail-page-CSb_hwig.js +2 -0
  47. package/dist/gateway/static/root/assets/{note-image-lightbox-CDknITM3.js → note-image-lightbox-BUYURRgn.js} +1 -1
  48. package/dist/gateway/static/root/assets/notes-page-BsIBSFyZ.js +1 -0
  49. package/dist/gateway/static/root/assets/{preview-open-alternatives-DV3xQsWB.js → preview-open-alternatives-BHz9iWYA.js} +1 -1
  50. package/dist/gateway/static/root/assets/remote-access-hub-CwzSovcS.js +1 -0
  51. package/dist/gateway/static/root/assets/{save-bar-controls-BODCXnvY.js → save-bar-controls-CefkOlRg.js} +1 -1
  52. package/dist/gateway/static/root/assets/schedule-field-CmTRoOcE.js +1 -0
  53. package/dist/gateway/static/root/assets/{schema-form-qtfEI6QM.js → schema-form-FMKv1vGu.js} +1 -1
  54. package/dist/gateway/static/root/assets/sessions-page-PHmX-NmA.js +1 -0
  55. package/dist/gateway/static/root/assets/settings-advanced-gate-BRAeKJN4.js +1 -0
  56. package/dist/gateway/static/root/assets/{settings-collapsible-section-BHZKjVcS.js → settings-collapsible-section-BouO6JTi.js} +1 -1
  57. package/dist/gateway/static/root/assets/{settings-form-section-5i35D-J1.js → settings-form-section-D-4lBl6X.js} +1 -1
  58. package/dist/gateway/static/root/assets/settings-page-KKrbFjy8.js +1 -0
  59. package/dist/gateway/static/root/assets/settings-page-layout-BJ4Gsef5.js +1 -0
  60. package/dist/gateway/static/root/assets/setup-status-panel-CrUjHPQo.js +1 -0
  61. package/dist/gateway/static/root/assets/{share-preview-page-B0H63tDv.js → share-preview-page-BDy2btRN.js} +1 -1
  62. package/dist/gateway/static/root/assets/shares-settings-B18OBmH5.js +1 -0
  63. package/dist/gateway/static/root/assets/skill-reload-api-C28-2uKQ.js +1 -0
  64. package/dist/gateway/static/root/assets/skills-page-Bm2ebkwl.js +2 -0
  65. package/dist/gateway/static/root/assets/system-settings-panel-CRngrlnZ.js +1 -0
  66. package/dist/gateway/static/root/assets/typed-models-lib-BltBc0b-.js +1 -0
  67. package/dist/gateway/static/root/assets/{use-channel-catalog-BCjP_VHb.js → use-channel-catalog-CjN-51e6.js} +1 -1
  68. package/dist/gateway/static/root/assets/user-profile-settings-panel-DJ1dKwZy.js +1 -0
  69. package/dist/gateway/static/root/assets/utils-B5M5-YvK.js +1 -0
  70. package/dist/gateway/static/root/assets/voice-api-key-field-CeEevm7z.js +1 -0
  71. package/dist/gateway/static/root/assets/{voice-player-store-BlF9V05n.js → voice-player-store-B7ykUlHM.js} +1 -1
  72. package/dist/gateway/static/root/assets/workflow-run-setup-panel-C4PzUQjB.js +3 -0
  73. package/dist/gateway/static/root/assets/workflows-page-BL84_-Ky.js +18 -0
  74. package/dist/gateway/static/root/index.html +6 -7
  75. package/dist/package.js +1 -1
  76. package/dist/src/agent/agent-manager.d.ts +4 -5
  77. package/dist/src/agent/agent-manager.js +6 -9
  78. package/dist/src/agent/agent-manager.js.map +1 -1
  79. package/dist/src/agent/agent-scope.js +0 -2
  80. package/dist/src/agent/agent-scope.js.map +1 -1
  81. package/dist/src/agent/background-review/prompts.d.ts +2 -2
  82. package/dist/src/agent/background-review/prompts.js +2 -2
  83. package/dist/src/agent/background-review/prompts.js.map +1 -1
  84. package/dist/src/agent/background-review/settings.d.ts +1 -1
  85. package/dist/src/agent/background-review/settings.js +7 -8
  86. package/dist/src/agent/background-review/settings.js.map +1 -1
  87. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +1 -0
  88. package/dist/src/agent/bootstrap/bootstrap-cache.js +4 -3
  89. package/dist/src/agent/bootstrap/bootstrap-cache.js.map +1 -1
  90. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +4 -0
  91. package/dist/src/agent/bootstrap/bootstrap-files.js +4 -3
  92. package/dist/src/agent/bootstrap/bootstrap-files.js.map +1 -1
  93. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +4 -2
  94. package/dist/src/agent/bootstrap/filter-bootstrap-files.js.map +1 -1
  95. package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +2 -1
  96. package/dist/src/agent/bootstrap/load-bootstrap-files.js +17 -16
  97. package/dist/src/agent/bootstrap/load-bootstrap-files.js.map +1 -1
  98. package/dist/src/agent/bootstrap/types.d.ts +1 -1
  99. package/dist/src/agent/context/workspace-templates/AGENTS.md +1 -1
  100. package/dist/src/agent/context/workspace.d.ts +4 -2
  101. package/dist/src/agent/context/workspace.js +5 -4
  102. package/dist/src/agent/context/workspace.js.map +1 -1
  103. package/dist/src/agent/embedded/run-for-session.js +106 -15
  104. package/dist/src/agent/embedded/run-for-session.js.map +1 -1
  105. package/dist/src/agent/fallback/candidates.d.ts +0 -8
  106. package/dist/src/agent/fallback/candidates.js +10 -11
  107. package/dist/src/agent/fallback/candidates.js.map +1 -1
  108. package/dist/src/agent/index.js +1 -1
  109. package/dist/src/agent/lifecycle/handlers/compaction.d.ts +1 -3
  110. package/dist/src/agent/lifecycle/handlers/compaction.js +1 -16
  111. package/dist/src/agent/lifecycle/handlers/compaction.js.map +1 -1
  112. package/dist/src/agent/lifecycle/progress.d.ts +0 -1
  113. package/dist/src/agent/lifecycle/progress.js +1 -6
  114. package/dist/src/agent/lifecycle/progress.js.map +1 -1
  115. package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +1 -2
  116. package/dist/src/agent/lifecycle/timeout-wrapper.js +1 -7
  117. package/dist/src/agent/lifecycle/timeout-wrapper.js.map +1 -1
  118. package/dist/src/agent/memory/builtin-memory-store.d.ts +4 -2
  119. package/dist/src/agent/memory/builtin-memory-store.js +11 -6
  120. package/dist/src/agent/memory/builtin-memory-store.js.map +1 -1
  121. package/dist/src/agent/memory/builtin-provider.js +36 -7
  122. package/dist/src/agent/memory/builtin-provider.js.map +1 -1
  123. package/dist/src/agent/memory/candidate-extractor.d.ts +6 -0
  124. package/dist/src/agent/memory/candidate-extractor.js +60 -0
  125. package/dist/src/agent/memory/candidate-extractor.js.map +1 -0
  126. package/dist/src/agent/memory/manager.d.ts +2 -1
  127. package/dist/src/agent/memory/manager.js +27 -3
  128. package/dist/src/agent/memory/manager.js.map +1 -1
  129. package/dist/src/agent/memory/memory-config.js +3 -0
  130. package/dist/src/agent/memory/memory-config.js.map +1 -1
  131. package/dist/src/agent/memory/prefetch-coordinator.js.map +1 -1
  132. package/dist/src/agent/memory/types.d.ts +27 -4
  133. package/dist/src/agent/middleware/self-verify.d.ts +0 -1
  134. package/dist/src/agent/middleware/self-verify.js +0 -2
  135. package/dist/src/agent/middleware/self-verify.js.map +1 -1
  136. package/dist/src/agent/models/index.d.ts +1 -1
  137. package/dist/src/agent/models/manager.d.ts +4 -20
  138. package/dist/src/agent/models/manager.js +9 -126
  139. package/dist/src/agent/models/manager.js.map +1 -1
  140. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -4
  141. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -9
  142. package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
  143. package/dist/src/agent/prompt/memory/index.d.ts +4 -2
  144. package/dist/src/agent/prompt/memory/index.js +18 -12
  145. package/dist/src/agent/prompt/memory/index.js.map +1 -1
  146. package/dist/src/agent/prompt/sections/memory-skills.js +1 -1
  147. package/dist/src/agent/prompt/sections/memory-skills.js.map +1 -1
  148. package/dist/src/agent/prompt/sections/tooling.js +2 -2
  149. package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
  150. package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
  151. package/dist/src/agent/prompt/service-prompt-builder.js +4 -31
  152. package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
  153. package/dist/src/agent/prompt/subagent-context.js +1 -1
  154. package/dist/src/agent/prompt/subagent-context.js.map +1 -1
  155. package/dist/src/agent/prompt/types.d.ts +1 -1
  156. package/dist/src/agent/reply/post-compaction-context.js +1 -3
  157. package/dist/src/agent/reply/post-compaction-context.js.map +1 -1
  158. package/dist/src/agent/reply/startup-context.js +1 -5
  159. package/dist/src/agent/reply/startup-context.js.map +1 -1
  160. package/dist/src/agent/service.d.ts +4 -12
  161. package/dist/src/agent/service.js +10 -48
  162. package/dist/src/agent/service.js.map +1 -1
  163. package/dist/src/agent/service.types.d.ts +2 -2
  164. package/dist/src/agent/session/session-config-service.d.ts +11 -11
  165. package/dist/src/agent/session/session-config-service.js +14 -14
  166. package/dist/src/agent/session/session-config-service.js.map +1 -1
  167. package/dist/src/agent/session/session-inspector.js +3 -2
  168. package/dist/src/agent/session/session-inspector.js.map +1 -1
  169. package/dist/src/agent/starter-agents.js +12 -12
  170. package/dist/src/agent/starter-agents.js.map +1 -1
  171. package/dist/src/agent/tools/automation-tool.d.ts +14 -0
  172. package/dist/src/agent/tools/automation-tool.js +102 -0
  173. package/dist/src/agent/tools/automation-tool.js.map +1 -0
  174. package/dist/src/agent/tools/curated-memory-tool.js +57 -2
  175. package/dist/src/agent/tools/curated-memory-tool.js.map +1 -1
  176. package/dist/src/agent/tools/delegate-tool.js +1 -1
  177. package/dist/src/agent/tools/delegate-tool.js.map +1 -1
  178. package/dist/src/agent/tools/factory.d.ts +3 -3
  179. package/dist/src/agent/tools/factory.js +2 -2
  180. package/dist/src/agent/tools/factory.js.map +1 -1
  181. package/dist/src/agent/tools/index.d.ts +1 -1
  182. package/dist/src/agent/tools/index.js +2 -2
  183. package/dist/src/agent/tools/web-extract.js +6 -8
  184. package/dist/src/agent/tools/web-extract.js.map +1 -1
  185. package/dist/src/agent-manifest/index.js +2 -2
  186. package/dist/src/agent-manifest/resolver.d.ts +4 -2
  187. package/dist/src/agent-manifest/resolver.js +6 -3
  188. package/dist/src/agent-manifest/resolver.js.map +1 -1
  189. package/dist/src/agent-manifest/schema.d.ts +238 -0
  190. package/dist/src/agent-manifest/schema.js +16 -5
  191. package/dist/src/agent-manifest/schema.js.map +1 -1
  192. package/dist/src/agent-manifest/validator.d.ts +3 -2
  193. package/dist/src/agent-manifest/validator.js +2 -1
  194. package/dist/src/agent-manifest/validator.js.map +1 -1
  195. package/dist/src/ai-assist/text-assist.d.ts +1 -1
  196. package/dist/src/ai-assist/text-assist.js +56 -0
  197. package/dist/src/ai-assist/text-assist.js.map +1 -1
  198. package/dist/src/auth/profiles/store.js.map +1 -1
  199. package/dist/src/automations/api/routes.d.ts +3 -0
  200. package/dist/src/automations/api/routes.js +193 -0
  201. package/dist/src/automations/api/routes.js.map +1 -0
  202. package/dist/src/automations/domain/index.d.ts +3 -0
  203. package/dist/src/automations/domain/index.js +3 -0
  204. package/dist/src/automations/domain/schedule.d.ts +4 -0
  205. package/dist/src/automations/domain/schedule.js +37 -0
  206. package/dist/src/automations/domain/schedule.js.map +1 -0
  207. package/dist/src/automations/domain/types.d.ts +160 -0
  208. package/dist/src/automations/domain/validation.d.ts +370 -0
  209. package/dist/src/automations/domain/validation.js +149 -0
  210. package/dist/src/automations/domain/validation.js.map +1 -0
  211. package/dist/src/automations/draft/automation-draft-prompt.d.ts +26 -0
  212. package/dist/src/automations/draft/automation-draft-prompt.js +127 -0
  213. package/dist/src/automations/draft/automation-draft-prompt.js.map +1 -0
  214. package/dist/src/automations/draft/automation-draft-service.d.ts +12 -0
  215. package/dist/src/automations/draft/automation-draft-service.js +135 -0
  216. package/dist/src/automations/draft/automation-draft-service.js.map +1 -0
  217. package/dist/src/automations/draft/automation-draft-validator.d.ts +99 -0
  218. package/dist/src/automations/draft/automation-draft-validator.js +105 -0
  219. package/dist/src/automations/draft/automation-draft-validator.js.map +1 -0
  220. package/dist/src/automations/draft/automation-draft.types.d.ts +40 -0
  221. package/dist/src/automations/draft/index.d.ts +3 -0
  222. package/dist/src/automations/draft/index.js +3 -0
  223. package/dist/src/automations/index.d.ts +3 -0
  224. package/dist/src/automations/index.js +8 -0
  225. package/dist/src/automations/product-events.d.ts +5 -0
  226. package/dist/src/automations/product-events.js +21 -0
  227. package/dist/src/automations/product-events.js.map +1 -0
  228. package/dist/src/automations/service/action-executor.d.ts +9 -0
  229. package/dist/src/automations/service/action-executor.js +157 -0
  230. package/dist/src/automations/service/action-executor.js.map +1 -0
  231. package/dist/src/automations/service/automation-service.d.ts +54 -0
  232. package/dist/src/automations/service/automation-service.js +404 -0
  233. package/dist/src/automations/service/automation-service.js.map +1 -0
  234. package/dist/src/automations/service/index.d.ts +2 -0
  235. package/dist/src/automations/service/index.js +3 -0
  236. package/dist/src/automations/storage/automation-repository.d.ts +6 -0
  237. package/dist/src/automations/storage/automation-repository.js +61 -0
  238. package/dist/src/automations/storage/automation-repository.js.map +1 -0
  239. package/dist/src/automations/storage/automation-run-repository.d.ts +17 -0
  240. package/dist/src/automations/storage/automation-run-repository.js +130 -0
  241. package/dist/src/automations/storage/automation-run-repository.js.map +1 -0
  242. package/dist/src/automations/storage/index.d.ts +2 -0
  243. package/dist/src/automations/storage/index.js +3 -0
  244. package/dist/src/channels/pipeline.d.ts +1 -1
  245. package/dist/src/channels/pipeline.js.map +1 -1
  246. package/dist/src/channels/plugin-types.d.ts +3 -0
  247. package/dist/src/chat-commands/agent-edit.js +0 -1
  248. package/dist/src/chat-commands/agent-edit.js.map +1 -1
  249. package/dist/src/chat-commands/builtins/model.js +2 -2
  250. package/dist/src/chat-commands/builtins/model.js.map +1 -1
  251. package/dist/src/chat-commands/builtins/thinking.js.map +1 -1
  252. package/dist/src/cli/command-catalog.js +0 -39
  253. package/dist/src/cli/command-catalog.js.map +1 -1
  254. package/dist/src/cli/command-loaders.js +0 -1
  255. package/dist/src/cli/command-loaders.js.map +1 -1
  256. package/dist/src/cli/command-manifest.d.ts +1 -1
  257. package/dist/src/cli/command-manifest.js +1 -5
  258. package/dist/src/cli/command-manifest.js.map +1 -1
  259. package/dist/src/cli/commands/agents.js +7 -6
  260. package/dist/src/cli/commands/agents.js.map +1 -1
  261. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  262. package/dist/src/cli/commands/doctor/checks/{cron-health.d.ts → migrations.d.ts} +1 -1
  263. package/dist/src/cli/commands/doctor/checks/migrations.js +40 -0
  264. package/dist/src/cli/commands/doctor/checks/migrations.js.map +1 -0
  265. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -0
  266. package/dist/src/cli/commands/doctor/checks/provider-auth.js.map +1 -1
  267. package/dist/src/cli/commands/doctor/checks/workspace-status.js +0 -1
  268. package/dist/src/cli/commands/doctor/checks/workspace-status.js.map +1 -1
  269. package/dist/src/cli/commands/doctor/flow.js +2 -2
  270. package/dist/src/cli/commands/doctor/flow.js.map +1 -1
  271. package/dist/src/cli/commands/gateway/call.js +2 -2
  272. package/dist/src/cli/commands/gateway/call.js.map +1 -1
  273. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  274. package/dist/src/cli/commands/gateway/run-foreground.js +4 -2
  275. package/dist/src/cli/commands/gateway/run-foreground.js.map +1 -1
  276. package/dist/src/cli/commands/init.js +33 -14
  277. package/dist/src/cli/commands/init.js.map +1 -1
  278. package/dist/src/cli/commands/models.js +13 -31
  279. package/dist/src/cli/commands/models.js.map +1 -1
  280. package/dist/src/cli/commands/onboard/model.js +17 -10
  281. package/dist/src/cli/commands/onboard/model.js.map +1 -1
  282. package/dist/src/cli/commands/onboard.js +2 -2
  283. package/dist/src/cli/commands/onboard.js.map +1 -1
  284. package/dist/src/cli/commands/tui.js +26 -4
  285. package/dist/src/cli/commands/tui.js.map +1 -1
  286. package/dist/src/cli/index.d.ts +1 -0
  287. package/dist/src/cli/index.js +10 -5
  288. package/dist/src/cli/index.js.map +1 -1
  289. package/dist/src/cli/registry.js +1 -1
  290. package/dist/src/cli/registry.js.map +1 -1
  291. package/dist/src/cli/templates.d.ts +1 -1
  292. package/dist/src/cli/templates.js +1 -11
  293. package/dist/src/cli/templates.js.map +1 -1
  294. package/dist/src/cli/utils/init-workspace-core.js +2 -0
  295. package/dist/src/cli/utils/init-workspace-core.js.map +1 -1
  296. package/dist/src/commands/agents.config.d.ts +9 -0
  297. package/dist/src/commands/agents.config.js +42 -12
  298. package/dist/src/commands/agents.config.js.map +1 -1
  299. package/dist/src/config/agent-profile.js +5 -3
  300. package/dist/src/config/agent-profile.js.map +1 -1
  301. package/dist/src/config/agent-typed-models.js +3 -5
  302. package/dist/src/config/agent-typed-models.js.map +1 -1
  303. package/dist/src/config/config-surface.d.ts +3 -0
  304. package/dist/src/config/index.d.ts +0 -1
  305. package/dist/src/config/index.js +3 -3
  306. package/dist/src/config/index.js.map +1 -1
  307. package/dist/src/config/paths.d.ts +8 -10
  308. package/dist/src/config/paths.js +16 -16
  309. package/dist/src/config/paths.js.map +1 -1
  310. package/dist/src/config/profile.js +0 -1
  311. package/dist/src/config/profile.js.map +1 -1
  312. package/dist/src/config/rules.js +0 -5
  313. package/dist/src/config/rules.js.map +1 -1
  314. package/dist/src/config/schema.d.ts +45 -44
  315. package/dist/src/config/schema.js +68 -52
  316. package/dist/src/config/schema.js.map +1 -1
  317. package/dist/src/config/web-patch.d.ts +0 -12
  318. package/dist/src/config/web-patch.js +2 -29
  319. package/dist/src/config/web-patch.js.map +1 -1
  320. package/dist/src/extensions/api.d.ts +2 -0
  321. package/dist/src/extensions/api.js +10 -0
  322. package/dist/src/extensions/api.js.map +1 -1
  323. package/dist/src/extensions/extension-registry-impl.d.ts +4 -1
  324. package/dist/src/extensions/extension-registry-impl.js +8 -0
  325. package/dist/src/extensions/extension-registry-impl.js.map +1 -1
  326. package/dist/src/extensions/loader.d.ts +3 -3
  327. package/dist/src/extensions/loader.js +3 -3
  328. package/dist/src/extensions/loader.js.map +1 -1
  329. package/dist/src/extensions/sdk/testing.d.ts +2 -0
  330. package/dist/src/extensions/sdk/testing.js +7 -0
  331. package/dist/src/extensions/sdk/testing.js.map +1 -1
  332. package/dist/src/extensions/types/core.d.ts +10 -1
  333. package/dist/src/extensions/types/index.d.ts +1 -1
  334. package/dist/src/extensions/types/{phase4.d.ts → registration.d.ts} +2 -2
  335. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  336. package/dist/src/gateway/agent-builtin-tools.js +1 -1
  337. package/dist/src/gateway/agent-builtin-tools.js.map +1 -1
  338. package/dist/src/gateway/agents-admin.d.ts +8 -0
  339. package/dist/src/gateway/agents-admin.js +63 -34
  340. package/dist/src/gateway/agents-admin.js.map +1 -1
  341. package/dist/src/gateway/capability-presets-admin.d.ts +1 -0
  342. package/dist/src/gateway/capability-presets-admin.js +19 -10
  343. package/dist/src/gateway/capability-presets-admin.js.map +1 -1
  344. package/dist/src/gateway/chat-stream/mapper.js +9 -2
  345. package/dist/src/gateway/chat-stream/mapper.js.map +1 -1
  346. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +11 -0
  347. package/dist/src/gateway/dreaming-automation-reconciler.js +105 -0
  348. package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -0
  349. package/dist/src/gateway/global-defaults-admin.d.ts +36 -0
  350. package/dist/src/gateway/global-defaults-admin.js +146 -0
  351. package/dist/src/gateway/global-defaults-admin.js.map +1 -0
  352. package/dist/src/gateway/heartbeat/service.d.ts +0 -2
  353. package/dist/src/gateway/heartbeat/service.js +0 -7
  354. package/dist/src/gateway/heartbeat/service.js.map +1 -1
  355. package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -6
  356. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  357. package/dist/src/gateway/hono/lib/config-payload.js.map +1 -1
  358. package/dist/src/gateway/hono/routes/agents.js +33 -1
  359. package/dist/src/gateway/hono/routes/agents.js.map +1 -1
  360. package/dist/src/gateway/hono/routes/commands-skills.js +4 -5
  361. package/dist/src/gateway/hono/routes/commands-skills.js.map +1 -1
  362. package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
  363. package/dist/src/gateway/hono/routes/config-patch/misc.js +12 -6
  364. package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -1
  365. package/dist/src/gateway/hono/routes/dreaming.js +27 -37
  366. package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
  367. package/dist/src/gateway/hono/routes/global-defaults.d.ts +3 -0
  368. package/dist/src/gateway/hono/routes/global-defaults.js +61 -0
  369. package/dist/src/gateway/hono/routes/global-defaults.js.map +1 -0
  370. package/dist/src/gateway/hono/routes/home.d.ts +2 -2
  371. package/dist/src/gateway/hono/routes/home.js +34 -25
  372. package/dist/src/gateway/hono/routes/home.js.map +1 -1
  373. package/dist/src/gateway/hono/routes/lazy-bundles.js +21 -9
  374. package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
  375. package/dist/src/gateway/hono/routes/memory.js +75 -4
  376. package/dist/src/gateway/hono/routes/memory.js.map +1 -1
  377. package/dist/src/gateway/hono/routes/migrations.d.ts +3 -0
  378. package/dist/src/gateway/hono/routes/migrations.js +35 -0
  379. package/dist/src/gateway/hono/routes/migrations.js.map +1 -0
  380. package/dist/src/gateway/hono/routes/models.js +1 -1
  381. package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
  382. package/dist/src/gateway/hono/routes/public-gateway.js.map +1 -1
  383. package/dist/src/gateway/hono/routes/sessions.js +14 -0
  384. package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
  385. package/dist/src/gateway/run-loop.js +2 -0
  386. package/dist/src/gateway/run-loop.js.map +1 -1
  387. package/dist/src/gateway/security/operator-scopes.js +5 -1
  388. package/dist/src/gateway/security/operator-scopes.js.map +1 -1
  389. package/dist/src/gateway/service/config-coordinator.d.ts +4 -4
  390. package/dist/src/gateway/service/config-coordinator.js +14 -8
  391. package/dist/src/gateway/service/config-coordinator.js.map +1 -1
  392. package/dist/src/gateway/service/marketplace-service.d.ts +4 -4
  393. package/dist/src/gateway/service/marketplace-service.js +11 -7
  394. package/dist/src/gateway/service/marketplace-service.js.map +1 -1
  395. package/dist/src/gateway/service/sessions-api.d.ts +2 -1
  396. package/dist/src/gateway/service/sessions-api.js +6 -1
  397. package/dist/src/gateway/service/sessions-api.js.map +1 -1
  398. package/dist/src/gateway/service.d.ts +7 -3
  399. package/dist/src/gateway/service.js +61 -27
  400. package/dist/src/gateway/service.js.map +1 -1
  401. package/dist/src/goals/goal-service.js +45 -4
  402. package/dist/src/goals/goal-service.js.map +1 -1
  403. package/dist/src/infra/update-restart.js +1 -1
  404. package/dist/src/migrations/config/default-capability-preset.d.ts +10 -0
  405. package/dist/src/migrations/config/default-capability-preset.js +135 -0
  406. package/dist/src/migrations/config/default-capability-preset.js.map +1 -0
  407. package/dist/src/migrations/index.d.ts +4 -0
  408. package/dist/src/migrations/index.js +4 -0
  409. package/dist/src/migrations/registry.d.ts +8 -0
  410. package/dist/src/migrations/registry.js +18 -0
  411. package/dist/src/migrations/registry.js.map +1 -0
  412. package/dist/src/migrations/runner.d.ts +17 -0
  413. package/dist/src/migrations/runner.js +191 -0
  414. package/dist/src/migrations/runner.js.map +1 -0
  415. package/dist/src/migrations/types.d.ts +34 -0
  416. package/dist/src/notes/service.js +27 -2
  417. package/dist/src/notes/service.js.map +1 -1
  418. package/dist/src/providers/index.d.ts +4 -5
  419. package/dist/src/providers/index.js +16 -16
  420. package/dist/src/providers/index.js.map +1 -1
  421. package/dist/src/providers/model-registry.d.ts +0 -1
  422. package/dist/src/providers/model-registry.js +0 -3
  423. package/dist/src/providers/model-registry.js.map +1 -1
  424. package/dist/src/routing/resolve-tui-session-key.d.ts +3 -0
  425. package/dist/src/routing/resolve-tui-session-key.js +14 -3
  426. package/dist/src/routing/resolve-tui-session-key.js.map +1 -1
  427. package/dist/src/session/session-workspace.js +2 -7
  428. package/dist/src/session/session-workspace.js.map +1 -1
  429. package/dist/src/session/store.js +0 -5
  430. package/dist/src/session/store.js.map +1 -1
  431. package/dist/src/session/transcript-outline.d.ts +47 -0
  432. package/dist/src/session/transcript-outline.js +481 -0
  433. package/dist/src/session/transcript-outline.js.map +1 -0
  434. package/dist/src/storage/sqlite/index.d.ts +1 -3
  435. package/dist/src/storage/sqlite/index.js +2 -4
  436. package/dist/src/storage/sqlite/memory-index-repository.d.ts +1 -0
  437. package/dist/src/storage/sqlite/memory-index-repository.js +15 -14
  438. package/dist/src/storage/sqlite/memory-index-repository.js.map +1 -1
  439. package/dist/src/storage/sqlite/memory-records-repository.d.ts +44 -1
  440. package/dist/src/storage/sqlite/memory-records-repository.js +164 -20
  441. package/dist/src/storage/sqlite/memory-records-repository.js.map +1 -1
  442. package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +10 -0
  443. package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +4 -0
  444. package/dist/src/storage/sqlite/migrations/016_automations.sql +47 -0
  445. package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +14 -0
  446. package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +1 -0
  447. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  448. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  449. package/dist/src/storage/sqlite/migrations/runner.js.map +1 -1
  450. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  451. package/dist/src/storage/sqlite/schema.js +1 -1
  452. package/dist/src/storage/sqlite/schema.sql +56 -46
  453. package/dist/src/tui/backends/embedded-backend.d.ts +9 -0
  454. package/dist/src/tui/backends/embedded-backend.js +55 -27
  455. package/dist/src/tui/backends/embedded-backend.js.map +1 -1
  456. package/dist/src/tui/backends/gateway-sse-backend.d.ts +4 -0
  457. package/dist/src/tui/backends/gateway-sse-backend.js +30 -3
  458. package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
  459. package/dist/src/tui/components/tui-header.d.ts +0 -1
  460. package/dist/src/tui/components/tui-header.js +3 -8
  461. package/dist/src/tui/components/tui-header.js.map +1 -1
  462. package/dist/src/tui/tui-backend.d.ts +4 -0
  463. package/dist/src/tui/tui-commands.d.ts +5 -0
  464. package/dist/src/tui/tui-commands.js +43 -0
  465. package/dist/src/tui/tui-commands.js.map +1 -1
  466. package/dist/src/tui/tui-startup-resources.js +2 -1
  467. package/dist/src/tui/tui-startup-resources.js.map +1 -1
  468. package/dist/src/tui/tui-startup-text.js +12 -12
  469. package/dist/src/tui/tui-startup-text.js.map +1 -1
  470. package/dist/src/tui/tui-transcript-tree.d.ts +1 -1
  471. package/dist/src/tui/tui-transcript-tree.js +17 -257
  472. package/dist/src/tui/tui-transcript-tree.js.map +1 -1
  473. package/dist/src/tui/tui-types.d.ts +2 -0
  474. package/dist/src/tui/tui-types.js.map +1 -1
  475. package/dist/src/tui/tui.js +11 -3
  476. package/dist/src/tui/tui.js.map +1 -1
  477. package/dist/src/workflows/domain/index.js +1 -1
  478. package/dist/src/workflows/domain/run.d.ts +7 -7
  479. package/dist/src/workflows/domain/run.js.map +1 -1
  480. package/dist/src/workflows/index.js +2 -2
  481. package/dist/src/workflows/service/workflow-run-service.d.ts +2 -0
  482. package/dist/src/workflows/service/workflow-run-service.js +31 -9
  483. package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
  484. package/dist/src/workflows/service/workflow-run-service.types.d.ts +1 -1
  485. package/package.json +4 -2
  486. package/dist/gateway/static/root/assets/agents-C6xgagZd.js +0 -71
  487. package/dist/gateway/static/root/assets/app-management-settings-panel-CBpLONvG.js +0 -1
  488. package/dist/gateway/static/root/assets/appearance-settings-CGcc54yj.js +0 -1
  489. package/dist/gateway/static/root/assets/browser-settings-page-CUOO-PQk.js +0 -8
  490. package/dist/gateway/static/root/assets/capability-presets-api-XQoMTI0A.js +0 -1
  491. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CfqF-kGr.js +0 -1
  492. package/dist/gateway/static/root/assets/channels-settings-BYyRzsex.js +0 -1
  493. package/dist/gateway/static/root/assets/cn-JdwAhgNB.js +0 -1
  494. package/dist/gateway/static/root/assets/connectors-page-DIvEz4NX.js +0 -2
  495. package/dist/gateway/static/root/assets/createLucideIcon-DPHK1VkS.js +0 -1
  496. package/dist/gateway/static/root/assets/cron-api-R41aQCX9.js +0 -1
  497. package/dist/gateway/static/root/assets/cron-dreaming-jobs-nCMWCf0p.js +0 -1
  498. package/dist/gateway/static/root/assets/cron-page-D97nFqQD.js +0 -3
  499. package/dist/gateway/static/root/assets/dreaming-settings-Bceaw1PG.js +0 -1
  500. package/dist/gateway/static/root/assets/format-cron-label-BsotZDO5.js +0 -2
  501. package/dist/gateway/static/root/assets/format-interval-label-Dn_QKIqb.js +0 -1
  502. package/dist/gateway/static/root/assets/gateway-settings-iISWAZRm.js +0 -1
  503. package/dist/gateway/static/root/assets/goal-detail-page-DCUROLMQ.js +0 -1
  504. package/dist/gateway/static/root/assets/goals-settings-CPAuFwoD.js +0 -1
  505. package/dist/gateway/static/root/assets/heartbeat-config-api-D7bKFEeO.js +0 -1
  506. package/dist/gateway/static/root/assets/heartbeat-settings-CC69vNx0.js +0 -1
  507. package/dist/gateway/static/root/assets/index-CwhK8qCh.js +0 -122
  508. package/dist/gateway/static/root/assets/index-CyfhARL-.css +0 -1
  509. package/dist/gateway/static/root/assets/interval-presets-0DtsnxE0.js +0 -1
  510. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BPREtN8B.js +0 -1
  511. package/dist/gateway/static/root/assets/messages-Cf1O9JB0.js +0 -3
  512. package/dist/gateway/static/root/assets/models-hub-panel-DmKiIihT.js +0 -2
  513. package/dist/gateway/static/root/assets/note-detail-page-CxxfLRJZ.js +0 -2
  514. package/dist/gateway/static/root/assets/notes-page-X2slSx7V.js +0 -1
  515. package/dist/gateway/static/root/assets/remote-access-hub-BvmUWqgu.js +0 -1
  516. package/dist/gateway/static/root/assets/schedule-field-CgJSCD3B.js +0 -1
  517. package/dist/gateway/static/root/assets/sessions-page-B0yESuuL.js +0 -1
  518. package/dist/gateway/static/root/assets/settings-advanced-gate-q2M8RKOo.js +0 -1
  519. package/dist/gateway/static/root/assets/settings-page-CGozabLD.js +0 -1
  520. package/dist/gateway/static/root/assets/setup-status-panel-FoOSe6nU.js +0 -1
  521. package/dist/gateway/static/root/assets/shares-settings-Cy5zWyYQ.js +0 -1
  522. package/dist/gateway/static/root/assets/skill-reload-api-DaZNFro9.js +0 -1
  523. package/dist/gateway/static/root/assets/skills-page-CnwtUzvw.js +0 -2
  524. package/dist/gateway/static/root/assets/system-settings-panel-DXs2VmBt.js +0 -1
  525. package/dist/gateway/static/root/assets/typed-models-lib-4gPuydz_.js +0 -1
  526. package/dist/gateway/static/root/assets/voice-api-key-field-DvKiOglO.js +0 -1
  527. package/dist/gateway/static/root/assets/workflows-page-CAVZcONQ.js +0 -18
  528. package/dist/src/agent/context/workspace-templates/USER.md +0 -24
  529. package/dist/src/agent/fallback/error.d.ts +0 -22
  530. package/dist/src/agent/fallback/error.js +0 -32
  531. package/dist/src/agent/fallback/error.js.map +0 -1
  532. package/dist/src/agent/fallback/index.d.ts +0 -5
  533. package/dist/src/agent/fallback/index.js +0 -9
  534. package/dist/src/agent/fallback/index.js.map +0 -1
  535. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.d.ts +0 -29
  536. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js +0 -76
  537. package/dist/src/agent/orchestration/run-agent-turn-with-fallbacks.js.map +0 -1
  538. package/dist/src/agent/service/reconcile-dreaming-cron.d.ts +0 -6
  539. package/dist/src/agent/service/reconcile-dreaming-cron.js +0 -84
  540. package/dist/src/agent/service/reconcile-dreaming-cron.js.map +0 -1
  541. package/dist/src/agent/tools/cronjob-tool.d.ts +0 -29
  542. package/dist/src/agent/tools/cronjob-tool.js +0 -274
  543. package/dist/src/agent/tools/cronjob-tool.js.map +0 -1
  544. package/dist/src/cli/commands/cron-cli.d.ts +0 -2
  545. package/dist/src/cli/commands/cron-cli.js +0 -15
  546. package/dist/src/cli/commands/cron-cli.js.map +0 -1
  547. package/dist/src/cli/commands/cron.d.ts +0 -4
  548. package/dist/src/cli/commands/cron.js +0 -188
  549. package/dist/src/cli/commands/cron.js.map +0 -1
  550. package/dist/src/cli/commands/doctor/checks/cron-health.js +0 -35
  551. package/dist/src/cli/commands/doctor/checks/cron-health.js.map +0 -1
  552. package/dist/src/cron/execution-types.d.ts +0 -42
  553. package/dist/src/cron/executor.d.ts +0 -67
  554. package/dist/src/cron/executor.js +0 -669
  555. package/dist/src/cron/executor.js.map +0 -1
  556. package/dist/src/cron/index.d.ts +0 -7
  557. package/dist/src/cron/index.js +0 -7
  558. package/dist/src/cron/job-content.d.ts +0 -5
  559. package/dist/src/cron/job-content.js +0 -15
  560. package/dist/src/cron/job-content.js.map +0 -1
  561. package/dist/src/cron/run-log-store.d.ts +0 -12
  562. package/dist/src/cron/run-log-store.js +0 -58
  563. package/dist/src/cron/run-log-store.js.map +0 -1
  564. package/dist/src/cron/schedule.d.ts +0 -10
  565. package/dist/src/cron/schedule.js +0 -85
  566. package/dist/src/cron/schedule.js.map +0 -1
  567. package/dist/src/cron/service.d.ts +0 -58
  568. package/dist/src/cron/service.js +0 -419
  569. package/dist/src/cron/service.js.map +0 -1
  570. package/dist/src/cron/types.d.ts +0 -183
  571. package/dist/src/cron/validation.d.ts +0 -500
  572. package/dist/src/cron/validation.js +0 -192
  573. package/dist/src/cron/validation.js.map +0 -1
  574. package/dist/src/cron/workflow-run-completion.d.ts +0 -23
  575. package/dist/src/cron/workflow-run-completion.js +0 -72
  576. package/dist/src/cron/workflow-run-completion.js.map +0 -1
  577. package/dist/src/extensions/types/phase4.js +0 -1
  578. package/dist/src/gateway/hono/routes/cron.d.ts +0 -3
  579. package/dist/src/gateway/hono/routes/cron.js +0 -109
  580. package/dist/src/gateway/hono/routes/cron.js.map +0 -1
  581. package/dist/src/storage/sqlite/cron-job-repository.d.ts +0 -6
  582. package/dist/src/storage/sqlite/cron-job-repository.js +0 -70
  583. package/dist/src/storage/sqlite/cron-job-repository.js.map +0 -1
  584. package/dist/src/storage/sqlite/cron-run-repository.d.ts +0 -5
  585. package/dist/src/storage/sqlite/cron-run-repository.js +0 -96
  586. package/dist/src/storage/sqlite/cron-run-repository.js.map +0 -1
  587. /package/dist/src/{cron → automations/domain}/types.js +0 -0
  588. /package/dist/src/{config/defaults.d.ts → automations/draft/automation-draft.types.js} +0 -0
  589. /package/dist/src/{config/defaults.js → extensions/types/registration.js} +0 -0
  590. /package/dist/src/{cron/execution-types.js → migrations/types.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":[],"sources":["../../../src/config/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { AgentManifestSchema, CapabilityPresetSchema } from '../agent-manifest/schema.js';\nimport { checkCacheDir } from '../browser/cache-dir-policy.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\nexport const AgentTypedModelRoleSchema = z\n .object({\n description: z.string().max(500).optional(),\n model: z.string().min(1),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const trimmed = entry.model.trim();\n const idx = trimmed.indexOf('/');\n if (idx <= 0 || idx === trimmed.length - 1) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\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 })\n .strict()\n .optional();\n\nexport type AgentModelsConfig = z.infer<typeof AgentModelsSchema>;\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 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 /** Legacy agent defaults kept for migration/tests and read defensively by runtime helpers. */\n defaults: z.record(z.string(), z.unknown()).optional(),\n capabilityPresets: z.record(z.string(), CapabilityPresetSchema).default({}),\n list: z.array(AgentManifestSchema).default([]),\n}).strict().default({\n default: 'main',\n defaults: {},\n capabilityPresets: {},\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\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 models: {\n defaultRole: 'deep',\n roles: {\n deep: { model: 'openai/gpt-4.1' },\n },\n },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\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: 'skillhub',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n});\n\nexport const CronConfigSchema = z.object({\n enabled: z.boolean().optional(),\n maxConcurrentJobs: z.number().optional(),\n historyRetentionDays: z.number().optional(),\n enableMetrics: z.boolean().optional(),\n}).default({\n enabled: true,\n maxConcurrentJobs: 5,\n historyRetentionDays: 7,\n enableMetrics: true,\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\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\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 connectors: ConnectorsConfigSchema,\n cron: CronConfigSchema,\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}).default({\n agents: {\n default: 'main',\n capabilityPresets: {},\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\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 models: {\n defaultRole: 'deep',\n roles: {\n deep: { model: 'openai/gpt-4.1' },\n },\n },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\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: 'skillhub',\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 cron: {\n enabled: true,\n maxConcurrentJobs: 5,\n historyRetentionDays: 7,\n enableMetrics: true,\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 // 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 legacyModel = (config.agents as unknown as {\n defaults?: { model?: string | { primary?: string } };\n } | undefined)?.defaults?.model;\n if (typeof legacyModel === 'string') {\n const trimmed = legacyModel.trim();\n if (trimmed) return trimmed;\n } else if (legacyModel && typeof legacyModel === 'object') {\n const primary = legacyModel.primary?.trim();\n if (primary) return primary;\n }\n\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 const roles = agent.models?.roles ?? {};\n const defaultRole = agent.models?.defaultRole ?? Object.keys(roles)[0];\n const role = defaultRole ? roles[defaultRole] : undefined;\n return role?.model.trim() || undefined;\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":";;;;;;;;AAoxCA,SAAgB,wBAAwB,QAAoC;CAC1E,MAAM,cAAe,OAAO,QAEZ,UAAU;AAC1B,KAAI,OAAO,gBAAgB,UAAU;EACnC,MAAM,UAAU,YAAY,MAAM;AAClC,MAAI,QAAS,QAAO;YACX,eAAe,OAAO,gBAAgB,UAAU;EACzD,MAAM,UAAU,YAAY,SAAS,MAAM;AAC3C,MAAI,QAAS,QAAO;;CAGtB,MAAM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;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,MAAM;GACJ,SAAS;GACT,mBAAmB;GACnB,sBAAsB;GACtB,eAAe;GAChB;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;EAIF,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 { checkCacheDir } from '../browser/cache-dir-policy.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\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 })\n .strict()\n .optional();\n\nexport type AgentModelsConfig = z.infer<typeof AgentModelsSchema>;\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 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: {\n defaultRole: 'deep',\n roles: {},\n },\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\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 },\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: 'skillhub',\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).default('coder'),\n })\n .strict()\n .default({\n defaultAgent: 'coder',\n });\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\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 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: {\n defaultRole: 'deep',\n roles: {},\n },\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\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 },\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: 'skillhub',\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 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 defaultAgent: 'coder',\n },\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 visited = new Set<string>();\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 applyPreset = (presetId: string): void => {\n if (visited.has(presetId)) return;\n visited.add(presetId);\n const preset = config.agents.capabilityPresets[presetId];\n if (!preset) return;\n for (const parent of preset.extends ?? []) {\n applyPreset(parent);\n }\n applyModels(preset.models);\n };\n\n applyPreset(config.agents.defaultPreset);\n for (const presetId of agent.extends ?? []) {\n if (presetId !== config.agents.defaultPreset) {\n applyPreset(presetId);\n }\n }\n applyModels(agent.models);\n return modelRef;\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":";;;;;;;;AA6yCA,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,IAC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ACV;EACD,WAAW,EACT,SAAS,MACV;EACD,KAAK,EACH,cAAc,SACf;EAIF,CAAC"}
@@ -1,10 +1,4 @@
1
1
  import type { Config } from './schema.js';
2
- export declare function mergeCronConfigPatch(config: Config, patch: Record<string, unknown>): {
3
- ok: true;
4
- } | {
5
- ok: false;
6
- message: string;
7
- };
8
2
  export declare function mergeGoalsConfigPatch(config: Config, patch: Record<string, unknown>): {
9
3
  ok: true;
10
4
  } | {
@@ -69,9 +63,3 @@ export declare function resolveUpdateConfigForWeb(config: Config): {
69
63
  betaCheckIntervalHours: number;
70
64
  };
71
65
  };
72
- export declare function resolveCronConfigForWeb(config: Config): {
73
- enabled: boolean;
74
- maxConcurrentJobs: number;
75
- historyRetentionDays: number;
76
- enableMetrics: boolean;
77
- };
@@ -1,13 +1,7 @@
1
- import { CronConfigSchema, GoalsConfigSchema, SessionConfigSchema, SessionDmScopeSchema, UpdateAutoConfigSchema, UpdateConfigSchema, init_schema } from "./schema.js";
1
+ import { GoalsConfigSchema, SessionConfigSchema, SessionDmScopeSchema, UpdateAutoConfigSchema, UpdateConfigSchema, init_schema } from "./schema.js";
2
2
  import { z } from "zod";
3
3
  //#region src/config/web-patch.ts
4
4
  init_schema();
5
- const CronConfigPatchSchema = z.object({
6
- enabled: z.boolean().optional(),
7
- maxConcurrentJobs: z.number().int().min(1).max(100).optional(),
8
- historyRetentionDays: z.number().int().min(1).max(365).optional(),
9
- enableMetrics: z.boolean().optional()
10
- });
11
5
  const GoalsConfigPatchSchema = z.object({
12
6
  maxTurns: z.number().int().min(1).max(500).optional(),
13
7
  judgeModelRef: z.union([z.string(), z.null()]).optional(),
@@ -74,18 +68,6 @@ const GatewaySkillsPatchSchema = z.object({
74
68
  skillsMarketplaceProvider: z.string().min(1).optional(),
75
69
  skillsStoreBaseUrl: z.string().url().optional()
76
70
  });
77
- function mergeCronConfigPatch(config, patch) {
78
- const parsed = CronConfigPatchSchema.safeParse(patch);
79
- if (!parsed.success) return {
80
- ok: false,
81
- message: parsed.error.issues.map((i) => i.message).join("; ")
82
- };
83
- config.cron = {
84
- ...config.cron ?? CronConfigSchema.parse({}),
85
- ...parsed.data
86
- };
87
- return { ok: true };
88
- }
89
71
  function mergeGoalsConfigPatch(config, patch) {
90
72
  const parsed = GoalsConfigPatchSchema.safeParse(patch);
91
73
  if (!parsed.success) return {
@@ -212,16 +194,7 @@ function resolveUpdateConfigForWeb(config) {
212
194
  }
213
195
  };
214
196
  }
215
- function resolveCronConfigForWeb(config) {
216
- const cron = CronConfigSchema.parse(config.cron ?? {});
217
- return {
218
- enabled: cron.enabled !== false,
219
- maxConcurrentJobs: cron.maxConcurrentJobs ?? 5,
220
- historyRetentionDays: cron.historyRetentionDays ?? 7,
221
- enableMetrics: cron.enableMetrics !== false
222
- };
223
- }
224
197
  //#endregion
225
- export { mergeCronConfigPatch, mergeGatewaySkillsMarketplacePatch, mergeGoalsConfigPatch, mergeSessionConfigPatch, mergeUpdateConfigPatch, resolveCronConfigForWeb, resolveGoalsConfigForWeb, resolveSessionConfigForWeb, resolveUpdateConfigForWeb };
198
+ export { mergeGatewaySkillsMarketplacePatch, mergeGoalsConfigPatch, mergeSessionConfigPatch, mergeUpdateConfigPatch, resolveGoalsConfigForWeb, resolveSessionConfigForWeb, resolveUpdateConfigForWeb };
226
199
 
227
200
  //# sourceMappingURL=web-patch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-patch.js","names":[],"sources":["../../../src/config/web-patch.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport type { Config } from './schema.js';\nimport {\n CronConfigSchema,\n GoalsConfigSchema,\n SessionConfigSchema,\n SessionDmScopeSchema,\n UpdateAutoConfigSchema,\n UpdateConfigSchema,\n} from './schema.js';\n\nconst CronConfigPatchSchema = z.object({\n enabled: z.boolean().optional(),\n maxConcurrentJobs: z.number().int().min(1).max(100).optional(),\n historyRetentionDays: z.number().int().min(1).max(365).optional(),\n enableMetrics: z.boolean().optional(),\n});\n\nconst GoalsConfigPatchSchema = z.object({\n maxTurns: z.number().int().min(1).max(500).optional(),\n judgeModelRef: z.union([z.string(), z.null()]).optional(),\n checklistMode: z.boolean().optional(),\n checklistDecomposePolicy: z.enum(['empty_only', 'supplement_existing']).optional(),\n maxConsecutiveParseFailures: z.number().int().min(1).max(20).optional(),\n judgeTimeoutMs: z.number().int().min(5_000).max(120_000).optional(),\n checklistHistoryChars: z.number().int().min(0).max(100_000).optional(),\n notifications: z\n .object({\n enabled: z.boolean().optional(),\n includeLinkedSessions: z.boolean().optional(),\n channels: z.array(z.string().min(1)).optional(),\n events: z\n .array(z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n ]))\n .optional(),\n targets: z\n .array(z.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\n .array(z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n ]))\n .optional(),\n }))\n .optional(),\n })\n .optional(),\n});\n\nconst SessionStoragePatchSchema = z.object({\n pruneAfterMs: z.union([z.number().int().min(0), z.null()]).optional(),\n maxEntries: z.union([z.number().int().min(1), z.null()]).optional(),\n});\n\nconst SessionConfigPatchSchema = z.object({\n dmScope: SessionDmScopeSchema.optional(),\n storage: SessionStoragePatchSchema.optional(),\n});\n\nconst UpdateAutoPatchSchema = z.object({\n enabled: z.boolean().optional(),\n stableDelayHours: z.number().min(0).optional(),\n stableJitterHours: z.number().min(0).optional(),\n betaCheckIntervalHours: z.number().min(0.25).optional(),\n});\n\nconst UpdateConfigPatchSchema = z.object({\n checkOnStart: z.boolean().optional(),\n channel: z.enum(['stable', 'beta', 'dev']).optional(),\n auto: UpdateAutoPatchSchema.optional(),\n});\n\nconst GatewaySkillsPatchSchema = z.object({\n skillsMarketplaceProvider: z.string().min(1).optional(),\n skillsStoreBaseUrl: z.string().url().optional(),\n});\n\nexport function mergeCronConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = CronConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n config.cron = {\n ...(config.cron ?? CronConfigSchema.parse({})),\n ...parsed.data,\n };\n return { ok: true };\n}\n\nexport function mergeGoalsConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = GoalsConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n const currentGoals = GoalsConfigSchema.parse(config.goals ?? {});\n const goalPatch = { ...parsed.data };\n if ('judgeModelRef' in patch) {\n const ref = patch.judgeModelRef;\n if (ref === null || (typeof ref === 'string' && !ref.trim())) {\n delete goalPatch.judgeModelRef;\n delete currentGoals.judgeModelRef;\n }\n }\n config.goals = GoalsConfigSchema.parse({\n ...currentGoals,\n ...goalPatch,\n notifications: goalPatch.notifications\n ? {\n ...currentGoals.notifications,\n ...goalPatch.notifications,\n }\n : currentGoals.notifications,\n });\n return { ok: true };\n}\n\nexport function mergeSessionConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = SessionConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n const current = config.session ?? SessionConfigSchema.parse({});\n const next = { ...current, ...parsed.data };\n if (parsed.data.storage !== undefined) {\n const storagePatch = parsed.data.storage;\n const nextStorage = { ...(current.storage ?? {}) };\n if ('pruneAfterMs' in storagePatch) {\n if (storagePatch.pruneAfterMs === null) delete nextStorage.pruneAfterMs;\n else if (storagePatch.pruneAfterMs !== undefined) nextStorage.pruneAfterMs = storagePatch.pruneAfterMs;\n }\n if ('maxEntries' in storagePatch) {\n if (storagePatch.maxEntries === null) delete nextStorage.maxEntries;\n else if (storagePatch.maxEntries !== undefined) nextStorage.maxEntries = storagePatch.maxEntries;\n }\n if (Object.keys(nextStorage).length === 0) delete next.storage;\n else next.storage = nextStorage;\n }\n config.session = next;\n return { ok: true };\n}\n\nexport function mergeUpdateConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = UpdateConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n const current = config.update ?? { checkOnStart: true, channel: 'stable' as const };\n const merged = {\n ...current,\n ...parsed.data,\n ...(parsed.data.auto !== undefined\n ? { auto: { ...(current.auto ?? {}), ...parsed.data.auto } }\n : {}),\n };\n config.update = UpdateConfigSchema.parse(merged);\n return { ok: true };\n}\n\nexport function mergeGatewaySkillsMarketplacePatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = GatewaySkillsPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n if (!config.gateway) {\n config.gateway = {\n bind: 'loopback',\n port: 18790,\n auth: { mode: 'token' },\n heartbeat: { enabled: true, intervalMs: 1_800_000, includeSystemPromptSection: false },\n maxSseConnections: 100,\n corsOrigins: [],\n };\n }\n if (parsed.data.skillsMarketplaceProvider !== undefined) {\n config.gateway.skillsMarketplaceProvider = parsed.data.skillsMarketplaceProvider.trim();\n }\n if (parsed.data.skillsStoreBaseUrl !== undefined) {\n config.gateway.skillsStoreBaseUrl = parsed.data.skillsStoreBaseUrl.trim().replace(/\\/+$/, '');\n }\n return { ok: true };\n}\n\nexport function resolveGoalsConfigForWeb(config: Config) {\n return GoalsConfigSchema.parse(config.goals ?? {});\n}\n\nexport function resolveSessionConfigForWeb(config: Config) {\n const session = SessionConfigSchema.parse(config.session ?? {});\n return {\n dmScope: session.dmScope,\n storage: {\n pruneAfterDays:\n typeof session.storage?.pruneAfterMs === 'number'\n ? Math.max(0, Math.round(session.storage.pruneAfterMs / 86_400_000))\n : null,\n maxEntries: session.storage?.maxEntries ?? null,\n },\n };\n}\n\nexport function resolveUpdateConfigForWeb(config: Config) {\n const update = config.update ?? { checkOnStart: true, channel: 'stable' as const };\n const auto = UpdateAutoConfigSchema.parse(update.auto ?? {});\n return {\n checkOnStart: update.checkOnStart !== false,\n channel: update.channel ?? 'stable',\n auto: {\n enabled: auto?.enabled === true,\n stableDelayHours: auto?.stableDelayHours ?? 6,\n stableJitterHours: auto?.stableJitterHours ?? 12,\n betaCheckIntervalHours: auto?.betaCheckIntervalHours ?? 1,\n },\n };\n}\n\nexport function resolveCronConfigForWeb(config: Config) {\n const cron = CronConfigSchema.parse(config.cron ?? {});\n return {\n enabled: cron.enabled !== false,\n maxConcurrentJobs: cron.maxConcurrentJobs ?? 5,\n historyRetentionDays: cron.historyRetentionDays ?? 7,\n enableMetrics: cron.enableMetrics !== false,\n };\n}\n"],"mappings":";;;aAUqB;AAErB,MAAM,wBAAwB,EAAE,OAAO;CACrC,SAAS,EAAE,SAAS,CAAC,UAAU;CAC/B,mBAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU;CAC9D,sBAAsB,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU;CACjE,eAAe,EAAE,SAAS,CAAC,UAAU;CACtC,CAAC;AAEF,MAAM,yBAAyB,EAAE,OAAO;CACtC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU;CACrD,eAAe,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU;CACzD,eAAe,EAAE,SAAS,CAAC,UAAU;CACrC,0BAA0B,EAAE,KAAK,CAAC,cAAc,s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AC;;AAGpD,SAAgB,2BAA2B,QAAgB;CACzD,MAAM,UAAU,oBAAoB,MAAM,OAAO,WAAW,EAAE,CAAC;AAC/D,QAAO;EACL,SAAS,QAAQ;EACjB,SAAS;GACP,gBACE,OAAO,QAAQ,SAAS,iBAAiB,WACrC,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,QAAQ,eAAe,MAAW,CAAC,GAClE;GACN,YAAY,QAAQ,SAAS,cAAc;GAC5C;EACF;;AAGH,SAAgB,0BAA0B,QAAgB;CACxD,MAAM,SAAS,OAAO,UAAU;EAAE,cAAc;EAAM,SAAS;EAAmB;CAClF,MAAM,OAAO,uBAAuB,MAAM,OAAO,QAAQ,EAAE,CAAC;AAC5D,QAAO;EACL,cAAc,OAAO,iBAAiB;EACtC,SAAS,OAAO,WAAW;EAC3B,MAAM;GACJ,SAAS,MAAM,YAAY;GAC3B,kBAAkB,MAAM,oBAAoB;GAC5C,mBAAmB,MAAM,qBAAqB;GAC9C,wBAAwB,MAAM,0BAA0B;GACzD;EACF;;AAGH,SAAgB,wBAAwB,QAAgB;CACtD,MAAM,OAAO,iBAAiB,MAAM,OAAO,QAAQ,EAAE,CAAC;AACtD,QAAO;EACL,SAAS,KAAK,YAAY;EAC1B,mBAAmB,KAAK,qBAAqB;EAC7C,sBAAsB,KAAK,wBAAwB;EACnD,eAAe,KAAK,kBAAkB;EACvC"}
1
+ {"version":3,"file":"web-patch.js","names":[],"sources":["../../../src/config/web-patch.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport type { Config } from './schema.js';\nimport {\n GoalsConfigSchema,\n SessionConfigSchema,\n SessionDmScopeSchema,\n UpdateAutoConfigSchema,\n UpdateConfigSchema,\n} from './schema.js';\n\nconst GoalsConfigPatchSchema = z.object({\n maxTurns: z.number().int().min(1).max(500).optional(),\n judgeModelRef: z.union([z.string(), z.null()]).optional(),\n checklistMode: z.boolean().optional(),\n checklistDecomposePolicy: z.enum(['empty_only', 'supplement_existing']).optional(),\n maxConsecutiveParseFailures: z.number().int().min(1).max(20).optional(),\n judgeTimeoutMs: z.number().int().min(5_000).max(120_000).optional(),\n checklistHistoryChars: z.number().int().min(0).max(100_000).optional(),\n notifications: z\n .object({\n enabled: z.boolean().optional(),\n includeLinkedSessions: z.boolean().optional(),\n channels: z.array(z.string().min(1)).optional(),\n events: z\n .array(z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n ]))\n .optional(),\n targets: z\n .array(z.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\n .array(z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n ]))\n .optional(),\n }))\n .optional(),\n })\n .optional(),\n});\n\nconst SessionStoragePatchSchema = z.object({\n pruneAfterMs: z.union([z.number().int().min(0), z.null()]).optional(),\n maxEntries: z.union([z.number().int().min(1), z.null()]).optional(),\n});\n\nconst SessionConfigPatchSchema = z.object({\n dmScope: SessionDmScopeSchema.optional(),\n storage: SessionStoragePatchSchema.optional(),\n});\n\nconst UpdateAutoPatchSchema = z.object({\n enabled: z.boolean().optional(),\n stableDelayHours: z.number().min(0).optional(),\n stableJitterHours: z.number().min(0).optional(),\n betaCheckIntervalHours: z.number().min(0.25).optional(),\n});\n\nconst UpdateConfigPatchSchema = z.object({\n checkOnStart: z.boolean().optional(),\n channel: z.enum(['stable', 'beta', 'dev']).optional(),\n auto: UpdateAutoPatchSchema.optional(),\n});\n\nconst GatewaySkillsPatchSchema = z.object({\n skillsMarketplaceProvider: z.string().min(1).optional(),\n skillsStoreBaseUrl: z.string().url().optional(),\n});\n\nexport function mergeGoalsConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = GoalsConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n const currentGoals = GoalsConfigSchema.parse(config.goals ?? {});\n const goalPatch = { ...parsed.data };\n if ('judgeModelRef' in patch) {\n const ref = patch.judgeModelRef;\n if (ref === null || (typeof ref === 'string' && !ref.trim())) {\n delete goalPatch.judgeModelRef;\n delete currentGoals.judgeModelRef;\n }\n }\n config.goals = GoalsConfigSchema.parse({\n ...currentGoals,\n ...goalPatch,\n notifications: goalPatch.notifications\n ? {\n ...currentGoals.notifications,\n ...goalPatch.notifications,\n }\n : currentGoals.notifications,\n });\n return { ok: true };\n}\n\nexport function mergeSessionConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = SessionConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n const current = config.session ?? SessionConfigSchema.parse({});\n const next = { ...current, ...parsed.data };\n if (parsed.data.storage !== undefined) {\n const storagePatch = parsed.data.storage;\n const nextStorage = { ...(current.storage ?? {}) };\n if ('pruneAfterMs' in storagePatch) {\n if (storagePatch.pruneAfterMs === null) delete nextStorage.pruneAfterMs;\n else if (storagePatch.pruneAfterMs !== undefined) nextStorage.pruneAfterMs = storagePatch.pruneAfterMs;\n }\n if ('maxEntries' in storagePatch) {\n if (storagePatch.maxEntries === null) delete nextStorage.maxEntries;\n else if (storagePatch.maxEntries !== undefined) nextStorage.maxEntries = storagePatch.maxEntries;\n }\n if (Object.keys(nextStorage).length === 0) delete next.storage;\n else next.storage = nextStorage;\n }\n config.session = next;\n return { ok: true };\n}\n\nexport function mergeUpdateConfigPatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = UpdateConfigPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n const current = config.update ?? { checkOnStart: true, channel: 'stable' as const };\n const merged = {\n ...current,\n ...parsed.data,\n ...(parsed.data.auto !== undefined\n ? { auto: { ...(current.auto ?? {}), ...parsed.data.auto } }\n : {}),\n };\n config.update = UpdateConfigSchema.parse(merged);\n return { ok: true };\n}\n\nexport function mergeGatewaySkillsMarketplacePatch(\n config: Config,\n patch: Record<string, unknown>,\n): { ok: true } | { ok: false; message: string } {\n const parsed = GatewaySkillsPatchSchema.safeParse(patch);\n if (!parsed.success) {\n return { ok: false, message: parsed.error.issues.map((i) => i.message).join('; ') };\n }\n if (!config.gateway) {\n config.gateway = {\n bind: 'loopback',\n port: 18790,\n auth: { mode: 'token' },\n heartbeat: { enabled: true, intervalMs: 1_800_000, includeSystemPromptSection: false },\n maxSseConnections: 100,\n corsOrigins: [],\n };\n }\n if (parsed.data.skillsMarketplaceProvider !== undefined) {\n config.gateway.skillsMarketplaceProvider = parsed.data.skillsMarketplaceProvider.trim();\n }\n if (parsed.data.skillsStoreBaseUrl !== undefined) {\n config.gateway.skillsStoreBaseUrl = parsed.data.skillsStoreBaseUrl.trim().replace(/\\/+$/, '');\n }\n return { ok: true };\n}\n\nexport function resolveGoalsConfigForWeb(config: Config) {\n return GoalsConfigSchema.parse(config.goals ?? {});\n}\n\nexport function resolveSessionConfigForWeb(config: Config) {\n const session = SessionConfigSchema.parse(config.session ?? {});\n return {\n dmScope: session.dmScope,\n storage: {\n pruneAfterDays:\n typeof session.storage?.pruneAfterMs === 'number'\n ? Math.max(0, Math.round(session.storage.pruneAfterMs / 86_400_000))\n : null,\n maxEntries: session.storage?.maxEntries ?? null,\n },\n };\n}\n\nexport function resolveUpdateConfigForWeb(config: Config) {\n const update = config.update ?? { checkOnStart: true, channel: 'stable' as const };\n const auto = UpdateAutoConfigSchema.parse(update.auto ?? {});\n return {\n checkOnStart: update.checkOnStart !== false,\n channel: update.channel ?? 'stable',\n auto: {\n enabled: auto?.enabled === true,\n stableDelayHours: auto?.stableDelayHours ?? 6,\n stableJitterHours: auto?.stableJitterHours ?? 12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AkB,MAAM,OAAO,SAAS,EAAE,CAAC;;AAGpD,SAAgB,2BAA2B,QAAgB;CACzD,MAAM,UAAU,oBAAoB,MAAM,OAAO,WAAW,EAAE,CAAC;AAC/D,QAAO;EACL,SAAS,QAAQ;EACjB,SAAS;GACP,gBACE,OAAO,QAAQ,SAAS,iBAAiB,WACrC,KAAK,IAAI,GAAG,KAAK,MAAM,QAAQ,QAAQ,eAAe,MAAW,CAAC,GAClE;GACN,YAAY,QAAQ,SAAS,cAAc;GAC5C;EACF;;AAGH,SAAgB,0BAA0B,QAAgB;CACxD,MAAM,SAAS,OAAO,UAAU;EAAE,cAAc;EAAM,SAAS;EAAmB;CAClF,MAAM,OAAO,uBAAuB,MAAM,OAAO,QAAQ,EAAE,CAAC;AAC5D,QAAO;EACL,cAAc,OAAO,iBAAiB;EACtC,SAAS,OAAO,WAAW;EAC3B,MAAM;GACJ,SAAS,MAAM,YAAY;GAC3B,kBAAkB,MAAM,oBAAoB;GAC5C,mBAAmB,MAAM,qBAAqB;GAC9C,wBAAwB,MAAM,0BAA0B;GACzD;EACF"}
@@ -14,6 +14,7 @@ import { TypedEventBus } from './typed-event-bus.js';
14
14
  import { ExtensionRegistryImpl } from './extension-registry-impl.js';
15
15
  import type { SpeechProviderPlugin } from '../voice/tts/speech-provider-types.js';
16
16
  import type { MediaUnderstandingProvider } from '../media-understanding/types.js';
17
+ import type { Migration } from '../migrations/types.js';
17
18
  export declare class ExtensionApiImpl implements ExtensionApi {
18
19
  readonly id: string;
19
20
  readonly name: string;
@@ -73,6 +74,7 @@ export declare class ExtensionApiImpl implements ExtensionApi {
73
74
  /** Injected from manifest `ui.contributions.commands` by the loader. */
74
75
  _setManifestCommands(commands: CommandContribution[]): void;
75
76
  onCommand(commandId: string, handler: ExtensionCommandHandler): void;
77
+ registerMigration(migration: Migration): void;
76
78
  registerReload(handler: ExtensionReloadHandler): void;
77
79
  /** Called from loader when manifest declares `reload.configPrefixes`. */
78
80
  _setReloadConfigPrefixes(prefixes: string[]): void;
@@ -7,6 +7,7 @@ import { TypedEventBus } from "./typed-event-bus.js";
7
7
  import { ExtensionRegistryImpl } from "./extension-registry-impl.js";
8
8
  import { registerMarketplaceAdapter, unregisterMarketplaceAdapter } from "../agent/skills/marketplace/registry.js";
9
9
  import { registerMediaUnderstandingProvider } from "../media-understanding/registry.js";
10
+ import { registerMigration } from "../migrations/registry.js";
10
11
  import { isAbsolute, resolve } from "path";
11
12
  import { EventEmitter } from "events";
12
13
  //#region src/extensions/api.ts
@@ -107,6 +108,7 @@ var ExtensionApiImpl = class {
107
108
  const plugin = registration.plugin;
108
109
  this._assertContract("channels", plugin.id);
109
110
  this._registry.addChannelPlugin(plugin);
111
+ for (const migration of plugin.migrations ?? []) this.registerMigration(migration);
110
112
  this._eventBus.emit("channel:register", plugin);
111
113
  this._logger.info(`Registered channel plugin: ${plugin.id}`);
112
114
  }
@@ -175,6 +177,14 @@ var ExtensionApiImpl = class {
175
177
  });
176
178
  this._logger.info(`Bound manifest command "${commandId}" as /${name}`);
177
179
  }
180
+ registerMigration(migration) {
181
+ this._registry.addMigrationRegistration({
182
+ extensionId: this.id,
183
+ migration
184
+ });
185
+ registerMigration(`extension:${this.id}`, migration);
186
+ this._logger.info(`Registered migration: ${migration.id}`);
187
+ }
178
188
  registerReload(handler) {
179
189
  const prefixes = this._reloadConfigPrefixes.length > 0 ? this._reloadConfigPrefixes : [`extensions.${this.id}`];
180
190
  this._registry.addReloadRegistration({