@xopcai/xopc 0.0.332 → 0.0.334

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 (465) hide show
  1. package/dist/browser-ext/dist/assets/{auth-DocRzRlS.js → auth-Cjj5SuoT.js} +49 -39
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +240 -36
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-C2wg3xC_.js → agent-avatar-dicebear-B73q7mlz.js} +1 -1
  8. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-B9L2YIXz.js +1 -0
  9. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BeNnu1Ts.js → agent-plugin-dialog-COOjsvea.js} +1 -1
  10. package/dist/gateway/static/root/assets/agents-CCj1JnLu.js +70 -0
  11. package/dist/gateway/static/root/assets/agents-admin-api-Cuqi5xZn.js +2 -0
  12. package/dist/gateway/static/root/assets/{app-link-C6gA5Nck.js → app-link-DRL0YnPs.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-management-settings-panel-etFSkfzl.js → app-management-settings-panel-CckioKud.js} +1 -1
  14. package/dist/gateway/static/root/assets/{appearance-settings-DKmU2VAP.js → appearance-settings-DDiPIr_Q.js} +1 -1
  15. package/dist/gateway/static/root/assets/apps-page-Azqy8vfo.js +1 -0
  16. package/dist/gateway/static/root/assets/{archive-plugin-D0z_Fr2G.js → archive-plugin-Dtyr0RhX.js} +1 -1
  17. package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +1 -0
  18. package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +1 -0
  19. package/dist/gateway/static/root/assets/{automations-page-B7_C-p66.js → automations-page-g3SrFkTC.js} +1 -1
  20. package/dist/gateway/static/root/assets/automations-workspace-B0nW2nZD.js +7 -0
  21. package/dist/gateway/static/root/assets/binary-plugins-BwKQVxsU.js +2 -0
  22. package/dist/gateway/static/root/assets/{block-editor-ChWW8Z9L.js → block-editor-DD9d5pCt.js} +29 -29
  23. package/dist/gateway/static/root/assets/{browser-automation-inputs-C5s1yHOu.js → browser-automation-inputs-D2gNdS3e.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-automations-page-BV00BXRb.js → browser-automations-page-BKqqJR7P.js} +2 -2
  25. package/dist/gateway/static/root/assets/{browser-settings-page-xwTmuZjS.js → browser-settings-page-BZH9bZbk.js} +2 -2
  26. package/dist/gateway/static/root/assets/capabilities-CHk4RZl4.js +1 -0
  27. package/dist/gateway/static/root/assets/capabilities-page-CfWaVH-6.js +2 -0
  28. package/dist/gateway/static/root/assets/capabilities-settings-panel-C5FcWsSe.js +8 -0
  29. package/dist/gateway/static/root/assets/capability-header-actions-Bd66yEOa.js +1 -0
  30. package/dist/gateway/static/root/assets/channels-DIU5Gq4o.js +1 -0
  31. package/dist/gateway/static/root/assets/{chat-terminal-dock-C41mXCAi.js → chat-terminal-dock-B0nPDJyj.js} +2 -2
  32. package/dist/gateway/static/root/assets/{computer-settings-page-BJkqok2G.js → computer-settings-page-D7PxxaoG.js} +1 -1
  33. package/dist/gateway/static/root/assets/{connector-service-page-BKCZMmwm.js → connector-service-page-BZH4SeQg.js} +1 -1
  34. package/dist/gateway/static/root/assets/connectors-page-BC81R_fz.js +2 -0
  35. package/dist/gateway/static/root/assets/{turn-outcome-D0SnyZ3Z.js → constants-Co2_smKQ.js} +1 -1
  36. package/dist/gateway/static/root/assets/date-picker-CDEVYjXI.js +1 -0
  37. package/dist/gateway/static/root/assets/{dependency-picker-CqADAHZp.js → dependency-picker-AInmpSwC.js} +1 -1
  38. package/dist/gateway/static/root/assets/{desktop-pet-Bab-iWED.js → desktop-pet-Sjgnlq8M.js} +1 -1
  39. package/dist/gateway/static/root/assets/{desktop-pet-settings-BqgzLOdi.js → desktop-pet-settings-BWn0rrhr.js} +1 -1
  40. package/dist/gateway/static/root/assets/{device-pairing-wizard-DFg7FDPf.js → device-pairing-wizard-BtW837_d.js} +1 -1
  41. package/dist/gateway/static/root/assets/{directory-picker-path-field-hqJ9sFCR.js → directory-picker-path-field-2CpmDx_D.js} +1 -1
  42. package/dist/gateway/static/root/assets/dist-CKkafhaS.js +1 -0
  43. package/dist/gateway/static/root/assets/dist-io9jFpN72.js +1 -0
  44. package/dist/gateway/static/root/assets/{extension-debug-page-DX3PFhRE.js → extension-debug-page-WWJFj9Z5.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-page-DkREdHLs.js → extension-page-DL00dFRr.js} +1 -1
  46. package/dist/gateway/static/root/assets/{extension-settings-page-wF-HNTM-.js → extension-settings-page-CN-agjPk.js} +1 -1
  47. package/dist/gateway/static/root/assets/{files-BK6enEvD.js → files-Bw4SBGdM.js} +1 -1
  48. package/dist/gateway/static/root/assets/{gateway-config-swr-cR-tz7-Q.js → gateway-config-swr-CgIjCxM8.js} +1 -1
  49. package/dist/gateway/static/root/assets/gateway-realtime-Ciq4c7KT.js +1 -0
  50. package/dist/gateway/static/root/assets/gateway-realtime-store-BHeHN26R.js +1 -0
  51. package/dist/gateway/static/root/assets/gateway-settings-4oD6fhAm.js +1 -0
  52. package/dist/gateway/static/root/assets/{gateway-startup-retry-6jLRcQsu.js → gateway-startup-retry-i-1lTrwY.js} +1 -1
  53. package/dist/gateway/static/root/assets/home-page-nEpyJUBY.js +1 -0
  54. package/dist/gateway/static/root/assets/{image-generation-api-CSSkwsyC.js → image-generation-api-gilc-u7M.js} +1 -1
  55. package/dist/gateway/static/root/assets/{imports-page-B80Cv043.js → imports-page-BivdeiQ5.js} +1 -1
  56. package/dist/gateway/static/root/assets/index-BioG1pRD.js +106 -0
  57. package/dist/gateway/static/root/assets/index-DbLEkdNg.css +1 -0
  58. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BgoFaTwv.js → keyboard-shortcuts-settings-B_8AJTFr.js} +1 -1
  59. package/dist/gateway/static/root/assets/local-app-workbench-page-CRtZQrmz.js +1 -0
  60. package/dist/gateway/static/root/assets/{local-apps-page-HO6OQlQT.js → local-apps-page-DclxpoqR.js} +1 -1
  61. package/dist/gateway/static/root/assets/{local-apps-Bpja8nC6.js → local-apps-yys1VChX.js} +1 -1
  62. package/dist/gateway/static/root/assets/local-session-drafts-DkolHmyp.js +1 -0
  63. package/dist/gateway/static/root/assets/{locale-store-wNXWkWu5.js → locale-store-BY30D6tg.js} +1 -1
  64. package/dist/gateway/static/root/assets/logs-page-DX8TxkRl.js +2 -0
  65. package/dist/gateway/static/root/assets/management-settings-5WFufZ4g.js +1 -0
  66. package/dist/gateway/static/root/assets/{markdown-view-DlT9KqwF.js → markdown-view-DYJnwlDr.js} +1 -1
  67. package/dist/gateway/static/root/assets/media-plugins-DlJDvwLK.js +1 -0
  68. package/dist/gateway/static/root/assets/messages-_6IXbP2u.js +3 -0
  69. package/dist/gateway/static/root/assets/note-detail-panel-GF5Q9Fqy.js +5 -0
  70. package/dist/gateway/static/root/assets/notes-page-E8o4_Ty9.js +8 -0
  71. package/dist/gateway/static/root/assets/page-context-capture-button-CiCmfRTw.js +1 -0
  72. package/dist/gateway/static/root/assets/{page-tabs-vqI30Yrg.js → page-tabs-Cwp3fGVM.js} +1 -1
  73. package/dist/gateway/static/root/assets/popover-select-0p9PIHRy.js +1 -0
  74. package/dist/gateway/static/root/assets/{preview-open-alternatives-B-mwPBJW.js → preview-open-alternatives-DJ5xqGeu.js} +1 -1
  75. package/dist/gateway/static/root/assets/{product-delivery-bv3z8Xkh.js → product-delivery-BAks11S4.js} +1 -1
  76. package/dist/gateway/static/root/assets/{product-open-page-D--sj_uN.js → product-open-page-CcGwNePw.js} +1 -1
  77. package/dist/gateway/static/root/assets/project-detail-page-6hhRBkmC.js +1 -0
  78. package/dist/gateway/static/root/assets/projects-page-DUOzRaFI.js +1 -0
  79. package/dist/gateway/static/root/assets/{registry-api-BIpltJ47.js → registry-api-BvVx0G1o.js} +1 -1
  80. package/dist/gateway/static/root/assets/remote-access-hub-BWpWUXiE.js +1 -0
  81. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CAnb0PNY.js → runtime-tools-settings-panel-C6eDCNHz.js} +2 -2
  82. package/dist/gateway/static/root/assets/scenes-page-pF7Lmqnk.js +2 -0
  83. package/dist/gateway/static/root/assets/{schema-form-BKj6wIMb.js → schema-form-D8W8q_ez.js} +1 -1
  84. package/dist/gateway/static/root/assets/{schemas-88fK3zzl.js → schemas-CObaziC7.js} +3 -3
  85. package/dist/gateway/static/root/assets/session-api-BAyUr97V.js +1 -0
  86. package/dist/gateway/static/root/assets/session-manager-BAy2sR2Q.js +16 -0
  87. package/dist/gateway/static/root/assets/sessions-page-BDKDqqf9.js +1 -0
  88. package/dist/gateway/static/root/assets/settings-advanced-gate-C9cJWlAq.js +1 -0
  89. package/dist/gateway/static/root/assets/{settings-form-section-78ycUHfv.js → settings-form-section-B0cAj0nq.js} +1 -1
  90. package/dist/gateway/static/root/assets/{settings-page-BOdxIVzo.js → settings-page-DZVVTFxs.js} +1 -1
  91. package/dist/gateway/static/root/assets/setup-status-panel-DZCPVx9c.js +1 -0
  92. package/dist/gateway/static/root/assets/share-preview-page-BkPNyV8c.js +2 -0
  93. package/dist/gateway/static/root/assets/shares-settings-Bqlv5JBi.js +1 -0
  94. package/dist/gateway/static/root/assets/{skill-api-CiBGQ0Jg.js → skill-api-C0dufzQC.js} +1 -1
  95. package/dist/gateway/static/root/assets/skill-reload-api-3JF2OTBz.js +1 -0
  96. package/dist/gateway/static/root/assets/skills-page-DB4lR4om.js +2 -0
  97. package/dist/gateway/static/root/assets/{system-settings-panel-CyJUeREH.js → system-settings-panel-xjrlhdUz.js} +1 -1
  98. package/dist/gateway/static/root/assets/task-detail-page-CB6M7wSs.js +1 -0
  99. package/dist/gateway/static/root/assets/{tasks-CDR_RVbQ.js → tasks-QQJXsiER.js} +1 -1
  100. package/dist/gateway/static/root/assets/{tunnel-api-Day9zhKi.js → tunnel-api--68MQEWM.js} +1 -1
  101. package/dist/gateway/static/root/assets/usage-page-OLZ00eqD.js +1 -0
  102. package/dist/gateway/static/root/assets/{use-autosave-Bj9hC6ML.js → use-autosave-DsnHYpTv.js} +1 -1
  103. package/dist/gateway/static/root/assets/user-model-page-CoePFpHD.js +2 -0
  104. package/dist/gateway/static/root/assets/{voice-api-key-field-fWRD6B8r.js → voice-api-key-field-CvIXutQp.js} +1 -1
  105. package/dist/gateway/static/root/assets/{voice-config-api-ujEySjyc.js → voice-config-api-Bwy3Al3J.js} +1 -1
  106. package/dist/gateway/static/root/assets/{work-discovery-overlay-CnxdvIk8.js → work-discovery-overlay-By5_7MLR.js} +1 -1
  107. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DlWNN1VA.js → workflow-run-setup-panel-HSMDxDXV.js} +2 -2
  108. package/dist/gateway/static/root/assets/workflows-page-DElQ47Da.js +6 -0
  109. package/dist/gateway/static/root/index.html +27 -21
  110. package/dist/package.js +1 -1
  111. package/dist/packages/gateway-contract/src/automations.js +44 -14
  112. package/dist/packages/gateway-contract/src/capabilities.js +120 -10
  113. package/dist/packages/gateway-contract/src/index.js +8 -2
  114. package/dist/packages/gateway-contract/src/scenes.js +7 -6
  115. package/dist/packages/gateway-contract/src/session-command-rejection.js +19 -0
  116. package/dist/packages/gateway-contract/src/session-input-command.js +109 -0
  117. package/dist/packages/gateway-contract/src/sessions.js +2 -7
  118. package/dist/packages/gateway-contract/src/usage.js +6 -0
  119. package/dist/src/agent/agent-manager.js +15 -9
  120. package/dist/src/agent/background-review/run-background-review.js +8 -3
  121. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  122. package/dist/src/agent/embedded/model-runtime.js +1 -1
  123. package/dist/src/agent/embedded/run-for-session.js +1 -1
  124. package/dist/src/agent/embedded/run-turn.js +7 -1
  125. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  126. package/dist/src/agent/external-tools/gateway-tools.d.ts +2 -1
  127. package/dist/src/agent/external-tools/gateway-tools.js +45 -11
  128. package/dist/src/agent/external-tools/index.js +1 -1
  129. package/dist/src/agent/image/tool-model-config.js +2 -2
  130. package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
  131. package/dist/src/agent/memory/compaction.js +4 -0
  132. package/dist/src/agent/service/btw-query.js +8 -2
  133. package/dist/src/agent/service/process-direct-streaming.js +4 -2
  134. package/dist/src/agent/service.js +5 -5
  135. package/dist/src/agent/session/session-inspector.js +1 -1
  136. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  137. package/dist/src/agent/skills/hub-pull.js +2 -2
  138. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  139. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  140. package/dist/src/agent/tasks/task-judge-service.js +7 -3
  141. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  142. package/dist/src/agent/tool-manuals/xopc-use.js +5 -4
  143. package/dist/src/agent/tools/automation-tool.d.ts +4 -1
  144. package/dist/src/agent/tools/automation-tool.js +42 -4
  145. package/dist/src/agent/tools/session-search-tool.js +1 -1
  146. package/dist/src/agent/tools/web-extract.js +1 -1
  147. package/dist/src/agent/tools/xopc-use-tool.js +50 -9
  148. package/dist/src/agent-catalog/capabilities.js +2 -2
  149. package/dist/src/ai-assist/text-assist.js +6 -2
  150. package/dist/src/auth/credentials.js +1 -1
  151. package/dist/src/auth/oauth-provider-lock.js +1 -1
  152. package/dist/src/auth/sync-provider-auth.js +1 -1
  153. package/dist/src/automations/api/routes.js +65 -0
  154. package/dist/src/automations/capabilities/drafts.js +1 -1
  155. package/dist/src/automations/capabilities/read.js +24 -0
  156. package/dist/src/automations/capabilities/write.d.ts +52 -14
  157. package/dist/src/automations/capabilities/write.js +52 -3
  158. package/dist/src/automations/delivery/delivery-router.d.ts +50 -0
  159. package/dist/src/automations/delivery/delivery-router.js +318 -0
  160. package/dist/src/automations/delivery/index.d.ts +1 -0
  161. package/dist/src/automations/delivery/index.js +2 -0
  162. package/dist/src/automations/domain/defaults.d.ts +0 -1
  163. package/dist/src/automations/domain/defaults.js +1 -1
  164. package/dist/src/automations/domain/index.js +2 -2
  165. package/dist/src/automations/domain/types.d.ts +158 -7
  166. package/dist/src/automations/domain/validation.d.ts +104 -22
  167. package/dist/src/automations/domain/validation.js +66 -13
  168. package/dist/src/automations/draft/automation-draft-prompt.js +3 -4
  169. package/dist/src/automations/draft/automation-draft-service.js +6 -0
  170. package/dist/src/automations/draft/automation-draft-validator.d.ts +22 -3
  171. package/dist/src/automations/draft/automation-draft-validator.js +4 -4
  172. package/dist/src/automations/events/event-catalog.d.ts +14 -0
  173. package/dist/src/automations/events/event-catalog.js +117 -0
  174. package/dist/src/automations/events/event-dispatcher.d.ts +27 -0
  175. package/dist/src/automations/events/event-dispatcher.js +140 -0
  176. package/dist/src/automations/events/event-repository.d.ts +59 -0
  177. package/dist/src/automations/events/event-repository.js +361 -0
  178. package/dist/src/automations/events/index.d.ts +3 -0
  179. package/dist/src/automations/events/index.js +4 -0
  180. package/dist/src/automations/index.d.ts +3 -1
  181. package/dist/src/automations/index.js +9 -3
  182. package/dist/src/automations/service/action-executor.d.ts +20 -1
  183. package/dist/src/automations/service/action-executor.js +80 -40
  184. package/dist/src/automations/service/automation-service.d.ts +21 -4
  185. package/dist/src/automations/service/automation-service.js +150 -100
  186. package/dist/src/automations/storage/automation-repository.js +4 -5
  187. package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
  188. package/dist/src/automations/storage/automation-run-repository.js +26 -1
  189. package/dist/src/automations/storage/index.js +2 -2
  190. package/dist/src/automations/webhook-secrets.d.ts +1 -0
  191. package/dist/src/automations/webhook-secrets.js +16 -0
  192. package/dist/src/bootstrap/application-state.js +1 -1
  193. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  194. package/dist/src/capabilities/runtime/product.js +1 -1
  195. package/dist/src/capabilities/store-connector.d.ts +17 -1
  196. package/dist/src/capabilities/store-connector.js +69 -3
  197. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  198. package/dist/src/chat-commands/agent-edit.js +1 -1
  199. package/dist/src/chat-commands/builtins/config.js +1 -1
  200. package/dist/src/cli/commands/agent.js +1 -1
  201. package/dist/src/cli/commands/agents.js +1 -1
  202. package/dist/src/cli/commands/connectors.js +4 -3
  203. package/dist/src/cli/commands/doctor/checks/automation-integrity.d.ts +2 -0
  204. package/dist/src/cli/commands/doctor/checks/automation-integrity.js +55 -0
  205. package/dist/src/cli/commands/doctor/checks/database-relations.d.ts +2 -0
  206. package/dist/src/cli/commands/doctor/checks/database-relations.js +81 -0
  207. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  208. package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
  209. package/dist/src/cli/commands/doctor/flow.js +5 -1
  210. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  211. package/dist/src/cli/commands/models.js +1 -1
  212. package/dist/src/cli/commands/onboard/model.js +2 -2
  213. package/dist/src/cli/commands/skills.js +1 -1
  214. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  215. package/dist/src/computer/runtime.js +1 -1
  216. package/dist/src/config/index.js +5 -5
  217. package/dist/src/config/loader.js +2 -2
  218. package/dist/src/config/models-json.js +1 -1
  219. package/dist/src/config/schema.js +1 -1
  220. package/dist/src/connectors/approval-resume.js +1 -1
  221. package/dist/src/connectors/cli/authorization.d.ts +1 -1
  222. package/dist/src/connectors/cli/store.d.ts +1 -1
  223. package/dist/src/connectors/cli/store.js +1 -1
  224. package/dist/src/connectors/composio-backends.js +14 -4
  225. package/dist/src/connectors/composio-managed-events.d.ts +5 -2
  226. package/dist/src/connectors/composio-managed-events.js +4 -1
  227. package/dist/src/connectors/connection-candidates.js +53 -15
  228. package/dist/src/connectors/connection-capabilities.js +5 -1
  229. package/dist/src/connectors/connection-recovery-service.d.ts +2 -1
  230. package/dist/src/connectors/connection-recovery-service.js +89 -4
  231. package/dist/src/discussions/analyzer.js +4 -4
  232. package/dist/src/execution-environments/local-worktree-manager.js +10 -1
  233. package/dist/src/execution-environments/session-environment-service.d.ts +3 -0
  234. package/dist/src/execution-environments/session-environment-service.js +28 -4
  235. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  236. package/dist/src/extensions/update.js +1 -1
  237. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  238. package/dist/src/gateway/agents-admin.js +2 -2
  239. package/dist/src/gateway/file-path-classifier.js +1 -1
  240. package/dist/src/gateway/home-intelligence-automation-reconciler.js +4 -1
  241. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  242. package/dist/src/gateway/hono/routes/agent-stream.js +6 -2
  243. package/dist/src/gateway/hono/routes/browser-session.js +4 -2
  244. package/dist/src/gateway/hono/routes/capabilities.js +1 -1
  245. package/dist/src/gateway/hono/routes/commands-skills.js +9 -2
  246. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  247. package/dist/src/gateway/hono/routes/connection-waits.js +3 -2
  248. package/dist/src/gateway/hono/routes/files.js +3 -0
  249. package/dist/src/gateway/hono/routes/lazy-bundles.js +14 -1
  250. package/dist/src/gateway/hono/routes/models.js +17 -1
  251. package/dist/src/gateway/hono/routes/notes.js +2 -4
  252. package/dist/src/gateway/hono/routes/projects.js +2 -2
  253. package/dist/src/gateway/hono/routes/public-gateway.js +93 -3
  254. package/dist/src/gateway/hono/routes/scenes.js +57 -41
  255. package/dist/src/gateway/hono/routes/session-command-handler.d.ts +5 -0
  256. package/dist/src/gateway/hono/routes/session-command-handler.js +189 -0
  257. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +14 -2
  258. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  259. package/dist/src/gateway/hono/routes/sessions.js +15 -168
  260. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  261. package/dist/src/gateway/hono/routes/tui.js +2 -1
  262. package/dist/src/gateway/hono/routes/usage.d.ts +3 -0
  263. package/dist/src/gateway/hono/routes/usage.js +61 -0
  264. package/dist/src/gateway/hono/routes/voice.js +10 -1
  265. package/dist/src/gateway/image-generation-setup.js +2 -2
  266. package/dist/src/gateway/lock.js +1 -1
  267. package/dist/src/gateway/memory-maintenance-automation-reconciler.js +5 -2
  268. package/dist/src/gateway/resolve-webchat-session-key.d.ts +1 -1
  269. package/dist/src/gateway/resolve-webchat-session-key.js +2 -2
  270. package/dist/src/gateway/scenes/host.js +27 -14
  271. package/dist/src/gateway/scenes/slackThreadSource.d.ts +2 -2
  272. package/dist/src/gateway/security/gateway-scopes.js +1 -0
  273. package/dist/src/gateway/service/active-execution.d.ts +19 -0
  274. package/dist/src/gateway/service/active-execution.js +16 -0
  275. package/dist/src/gateway/service/agent-runner.d.ts +4 -0
  276. package/dist/src/gateway/service/agent-runner.js +19 -1
  277. package/dist/src/gateway/service/marketplace-service.js +2 -2
  278. package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
  279. package/dist/src/gateway/service/run-gateway-agent.js +10 -2
  280. package/dist/src/gateway/service/session-command-service.d.ts +34 -0
  281. package/dist/src/gateway/service/session-command-service.js +81 -0
  282. package/dist/src/gateway/service/session-input-coordinator.d.ts +21 -0
  283. package/dist/src/gateway/service/session-input-coordinator.js +41 -0
  284. package/dist/src/gateway/service/session-preparation-worker.d.ts +15 -0
  285. package/dist/src/gateway/service/session-preparation-worker.js +125 -0
  286. package/dist/src/gateway/service/sessions-api.d.ts +13 -0
  287. package/dist/src/gateway/service/sessions-api.js +23 -0
  288. package/dist/src/gateway/service.d.ts +30 -3
  289. package/dist/src/gateway/service.js +89 -79
  290. package/dist/src/gateway/side-chat/promotion-service.js +0 -1
  291. package/dist/src/gateway/side-chat/run-service.js +10 -7
  292. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  293. package/dist/src/home-intelligence/generator.js +5 -2
  294. package/dist/src/infra/domain-outbox-dispatcher.d.ts +0 -3
  295. package/dist/src/infra/domain-outbox-dispatcher.js +15 -7
  296. package/dist/src/local-apps/service.js +2 -2
  297. package/dist/src/mcp/channel-bridge.js +12 -2
  298. package/dist/src/notes/capabilities/read.js +2 -2
  299. package/dist/src/notes/service.d.ts +4 -1
  300. package/dist/src/notes/service.js +13 -11
  301. package/dist/src/projects/project-service.js +1 -2
  302. package/dist/src/projects/project-skill-service.js +2 -2
  303. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  304. package/dist/src/providers/index.js +2 -2
  305. package/dist/src/providers/model-call.d.ts +3 -2
  306. package/dist/src/providers/model-call.js +30 -5
  307. package/dist/src/providers/model-catalog-persistence.js +1 -1
  308. package/dist/src/providers/register-runtime-providers.js +1 -1
  309. package/dist/src/scenes/activationAdapter.d.ts +19 -0
  310. package/dist/src/scenes/activationAdapter.js +1 -0
  311. package/dist/src/scenes/agentExecutor.js +3 -10
  312. package/dist/src/scenes/contracts.d.ts +3 -9
  313. package/dist/src/scenes/contracts.js +1 -0
  314. package/dist/src/scenes/execution.d.ts +9 -3
  315. package/dist/src/scenes/execution.js +12 -11
  316. package/dist/src/scenes/httpServices.d.ts +5 -2
  317. package/dist/src/scenes/mailContext.d.ts +4 -0
  318. package/dist/src/scenes/mailContext.js +9 -0
  319. package/dist/src/scenes/maintenance.js +1 -5
  320. package/dist/src/scenes/metrics.d.ts +0 -6
  321. package/dist/src/scenes/metrics.js +0 -11
  322. package/dist/src/scenes/registry.d.ts +11 -0
  323. package/dist/src/scenes/registry.js +28 -0
  324. package/dist/src/scenes/repository.d.ts +6 -3
  325. package/dist/src/scenes/repository.js +43 -5
  326. package/dist/src/scenes/service.d.ts +2 -1
  327. package/dist/src/scenes/service.js +9 -7
  328. package/dist/src/scenes/taskFollowUp/contracts.d.ts +37 -7
  329. package/dist/src/scenes/taskFollowUp/contracts.js +36 -17
  330. package/dist/src/scenes/taskFollowUp/service.d.ts +35 -7
  331. package/dist/src/scenes/taskFollowUp/service.js +86 -28
  332. package/dist/src/scenes/templates.d.ts +2 -2
  333. package/dist/src/scenes/userNotes.d.ts +3 -0
  334. package/dist/src/scenes/userNotes.js +6 -0
  335. package/dist/src/session/client-history.d.ts +3 -0
  336. package/dist/src/session/client-history.js +10 -5
  337. package/dist/src/session/manager.d.ts +1 -0
  338. package/dist/src/session/resolve-session.js +4 -3
  339. package/dist/src/session/session-title.js +1 -1
  340. package/dist/src/session/store.d.ts +1 -0
  341. package/dist/src/session/store.js +3 -3
  342. package/dist/src/storage/sqlite/ai-usage-repository.d.ts +137 -0
  343. package/dist/src/storage/sqlite/ai-usage-repository.js +175 -0
  344. package/dist/src/storage/sqlite/connector-account-repository.js +7 -5
  345. package/dist/src/storage/sqlite/connector-repository.js +36 -34
  346. package/dist/src/storage/sqlite/index.d.ts +2 -2
  347. package/dist/src/storage/sqlite/index.js +3 -3
  348. package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +48 -0
  349. package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +14 -0
  350. package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +16 -0
  351. package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +30 -0
  352. package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +188 -0
  353. package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +41 -0
  354. package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +6 -0
  355. package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +1 -0
  356. package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +4 -0
  357. package/dist/src/storage/sqlite/migrations/218_core_relation_indexes.sql +26 -0
  358. package/dist/src/storage/sqlite/migrations/219_json_contracts.sql +123 -0
  359. package/dist/src/storage/sqlite/migrations/220_normalize_timestamps.sql +339 -0
  360. package/dist/src/storage/sqlite/migrations/221_ai_usage_retention_index.sql +2 -0
  361. package/dist/src/storage/sqlite/migrations/222_session_config_authority.sql +13 -0
  362. package/dist/src/storage/sqlite/migrations/223_session_creation_receipts.sql +59 -0
  363. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  364. package/dist/src/storage/sqlite/migrations/runner.js +4 -4
  365. package/dist/src/storage/sqlite/row-mappers.d.ts +3 -7
  366. package/dist/src/storage/sqlite/row-mappers.js +6 -6
  367. package/dist/src/storage/sqlite/scenes-schema.d.ts +1 -1
  368. package/dist/src/storage/sqlite/scenes-schema.js +0 -1
  369. package/dist/src/storage/sqlite/schema.js +1 -1
  370. package/dist/src/storage/sqlite/schema.sql +0 -52
  371. package/dist/src/storage/sqlite/schemas/scenes.sql +0 -7
  372. package/dist/src/storage/sqlite/session-creation-repository.d.ts +50 -0
  373. package/dist/src/storage/sqlite/session-creation-repository.js +166 -0
  374. package/dist/src/storage/sqlite/session-input-repository.d.ts +12 -2
  375. package/dist/src/storage/sqlite/session-input-repository.js +25 -2
  376. package/dist/src/storage/sqlite/session-read-repository.d.ts +1 -1
  377. package/dist/src/storage/sqlite/session-read-repository.js +0 -1
  378. package/dist/src/storage/sqlite/session-repository.d.ts +0 -4
  379. package/dist/src/storage/sqlite/session-repository.js +8 -18
  380. package/dist/src/storage/sqlite/timestamps.d.ts +4 -0
  381. package/dist/src/storage/sqlite/timestamps.js +20 -0
  382. package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
  383. package/dist/src/storage/sqlite/transcript-repository.js +23 -15
  384. package/dist/src/storage/sqlite/user-trust-repository.js +4 -2
  385. package/dist/src/tasks/capabilities/read.js +2 -2
  386. package/dist/src/tasks/capabilities/write.d.ts +1 -1
  387. package/dist/src/tasks/home-query-service.js +3 -3
  388. package/dist/src/tasks/task-contract-planner.js +1 -1
  389. package/dist/src/tui/backends/embedded-backend.d.ts +5 -0
  390. package/dist/src/tui/backends/embedded-backend.js +266 -20
  391. package/dist/src/tui/backends/embedded-drafts.d.ts +22 -0
  392. package/dist/src/tui/backends/embedded-drafts.js +53 -0
  393. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +10 -0
  394. package/dist/src/tui/backends/gateway-realtime-backend.js +214 -33
  395. package/dist/src/tui/tui-backend.d.ts +1 -1
  396. package/dist/src/tui/tui-chat-input-state.d.ts +1 -0
  397. package/dist/src/tui/tui-commands.js +1 -1
  398. package/dist/src/tui/tui-session-format.js +0 -1
  399. package/dist/src/tui/tui-startup-resources.d.ts +1 -0
  400. package/dist/src/tui/tui-startup-resources.js +2 -2
  401. package/dist/src/tui/tui-types.d.ts +0 -1
  402. package/dist/src/tui/tui.js +69 -29
  403. package/dist/src/usage/cost.d.ts +4 -0
  404. package/dist/src/usage/cost.js +28 -0
  405. package/dist/src/usage/recorder.d.ts +13 -0
  406. package/dist/src/usage/recorder.js +117 -0
  407. package/dist/src/usage/scenario-registry.d.ts +8 -0
  408. package/dist/src/usage/scenario-registry.js +117 -0
  409. package/dist/src/usage/types.d.ts +55 -0
  410. package/dist/src/usage/types.js +1 -0
  411. package/dist/src/voice/realtime/persona-context.js +1 -1
  412. package/dist/src/voice/tts/summarize.js +1 -1
  413. package/dist/src/work-discovery/analyzer.js +2 -2
  414. package/dist/src/work-discovery/investigator.js +1 -1
  415. package/dist/src/work-discovery/service.js +3 -6
  416. package/dist/src/workflows/service/workflow-run-service.js +16 -3
  417. package/package.json +3 -3
  418. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Se1Z72VG.js +0 -1
  419. package/dist/gateway/static/root/assets/agents-udIitwV8.js +0 -70
  420. package/dist/gateway/static/root/assets/apps-page-DVNySL58.js +0 -1
  421. package/dist/gateway/static/root/assets/attachment-load-DNCDbeOX.js +0 -1
  422. package/dist/gateway/static/root/assets/automations-workspace-BMgJvdcv.js +0 -7
  423. package/dist/gateway/static/root/assets/binary-plugins-BYn2hScX.js +0 -2
  424. package/dist/gateway/static/root/assets/capabilities-CHA-sTAZ.js +0 -1
  425. package/dist/gateway/static/root/assets/capabilities-page-v0WkhV5o.js +0 -2
  426. package/dist/gateway/static/root/assets/capabilities-settings-panel-DefBGjhV.js +0 -8
  427. package/dist/gateway/static/root/assets/capability-header-actions-vmx35sbu.js +0 -1
  428. package/dist/gateway/static/root/assets/channels-Eo4ONF5X.js +0 -1
  429. package/dist/gateway/static/root/assets/connectors-page-DZYgogQw.js +0 -2
  430. package/dist/gateway/static/root/assets/conversation-identity-Cw0n9uzK.js +0 -1
  431. package/dist/gateway/static/root/assets/date-picker-CrOV4Ynd.js +0 -1
  432. package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +0 -1
  433. package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
  434. package/dist/gateway/static/root/assets/gateway-settings-Du-Dos9O.js +0 -1
  435. package/dist/gateway/static/root/assets/home-page-D7YoMHq4.js +0 -1
  436. package/dist/gateway/static/root/assets/index-BEw0xrde.css +0 -1
  437. package/dist/gateway/static/root/assets/index-DalslRUx.js +0 -121
  438. package/dist/gateway/static/root/assets/local-app-workbench-page-BKL5UZAj.js +0 -1
  439. package/dist/gateway/static/root/assets/logs-page-CjzR9Rpj.js +0 -2
  440. package/dist/gateway/static/root/assets/management-settings-Dk_gTJb9.js +0 -1
  441. package/dist/gateway/static/root/assets/media-plugins-Dlj6TD3M.js +0 -1
  442. package/dist/gateway/static/root/assets/messages-fmf0dnr4.js +0 -3
  443. package/dist/gateway/static/root/assets/note-detail-panel-BebJPjjk.js +0 -5
  444. package/dist/gateway/static/root/assets/notes-page-CmS_hvz8.js +0 -8
  445. package/dist/gateway/static/root/assets/page-context-capture-button-BArPtqp5.js +0 -1
  446. package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +0 -1
  447. package/dist/gateway/static/root/assets/project-detail-page-BFUdtWXF.js +0 -1
  448. package/dist/gateway/static/root/assets/projects-page-DBsBwAQ6.js +0 -1
  449. package/dist/gateway/static/root/assets/remote-access-hub-BurdDY0m.js +0 -1
  450. package/dist/gateway/static/root/assets/scenes-page-Cj8xtr5t.js +0 -2
  451. package/dist/gateway/static/root/assets/sessions-page-BCsjgkCs.js +0 -1
  452. package/dist/gateway/static/root/assets/settings-advanced-gate-BLL7csOJ.js +0 -1
  453. package/dist/gateway/static/root/assets/setup-status-panel-CbKHBjrU.js +0 -1
  454. package/dist/gateway/static/root/assets/share-preview-page-DyLfktib.js +0 -2
  455. package/dist/gateway/static/root/assets/shares-settings-BzvSNouj.js +0 -1
  456. package/dist/gateway/static/root/assets/skill-reload-api-BHnru0F5.js +0 -1
  457. package/dist/gateway/static/root/assets/skills-page-C35VKjhb.js +0 -2
  458. package/dist/gateway/static/root/assets/task-detail-page-Bd1_Fguk.js +0 -1
  459. package/dist/gateway/static/root/assets/user-model-page-DuYzuR1T.js +0 -2
  460. package/dist/gateway/static/root/assets/workflows-page-B45YDiEw.js +0 -6
  461. package/dist/src/automations/product-events.d.ts +0 -5
  462. package/dist/src/automations/product-events.js +0 -19
  463. package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -9
  464. package/dist/src/tui/tui-empty-session-cleanup.js +0 -19
  465. /package/dist/gateway/static/root/assets/{dist-CI_fqRk-.js → dist-CI_fqRk-2.js} +0 -0
@@ -50,8 +50,15 @@ function trimRuns(db, automationId) {
50
50
  const countRow = db.prepare(`SELECT COUNT(*) AS count FROM automation_runs WHERE automation_id = ?`).get(automationId);
51
51
  if (countRow.count <= MAX_RUNS_PER_AUTOMATION) return;
52
52
  const staleRunIds = db.prepare(`SELECT run_id FROM automation_runs WHERE automation_id = ? AND status NOT IN ('queued', 'running', 'cancelling')
53
+ AND NOT EXISTS (
54
+ SELECT 1 FROM automation_result_deliveries d
55
+ WHERE d.run_id = automation_runs.run_id AND d.status <> 'delivered'
56
+ )
53
57
  ORDER BY created_at_ms ASC LIMIT ?`).all(automationId, countRow.count - TRIM_TO_RUNS);
54
58
  for (const { run_id: runId } of staleRunIds) {
59
+ db.prepare("DELETE FROM automation_event_deliveries WHERE run_id = ?").run(runId);
60
+ db.prepare("DELETE FROM automation_result_deliveries WHERE run_id = ?").run(runId);
61
+ db.prepare("DELETE FROM automation_results WHERE run_id = ?").run(runId);
55
62
  db.prepare("DELETE FROM automation_run_requests WHERE run_id = ?").run(runId);
56
63
  db.prepare(`DELETE FROM automation_run_events WHERE run_id = ?`).run(runId);
57
64
  db.prepare(`DELETE FROM automation_runs WHERE run_id = ?`).run(runId);
@@ -175,11 +182,29 @@ function listAutomationRunsForProductEvent(options) {
175
182
  }
176
183
  function deleteAutomationRunsForAutomation(automationId) {
177
184
  runSqliteWriteTransaction((db) => {
185
+ db.prepare(`DELETE FROM automation_event_deliveries
186
+ WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)`).run(automationId);
187
+ db.prepare(`DELETE FROM automation_result_deliveries
188
+ WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)`).run(automationId);
189
+ db.prepare(`DELETE FROM automation_results
190
+ WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)`).run(automationId);
178
191
  db.prepare("DELETE FROM automation_run_requests WHERE run_id IN (SELECT run_id FROM automation_runs WHERE automation_id = ?)").run(automationId);
179
192
  db.prepare(`DELETE FROM automation_run_events WHERE automation_id = ?`).run(automationId);
180
193
  db.prepare(`DELETE FROM automation_runs WHERE automation_id = ?`).run(automationId);
181
194
  });
182
195
  }
196
+ function pruneAutomationHistory(cutoffMs = Date.now() - 720 * 60 * 6e4) {
197
+ return runSqliteWriteTransaction((db) => {
198
+ const result = db.prepare(`DELETE FROM automation_events
199
+ WHERE projection_status = 'projected' AND projected_at_ms < ?
200
+ AND NOT EXISTS (
201
+ SELECT 1 FROM automation_event_deliveries d
202
+ WHERE d.event_id = automation_events.event_id
203
+ AND d.status IN ('pending', 'retrying', 'queued', 'dead_letter')
204
+ )`).run(cutoffMs);
205
+ return Number(result.changes);
206
+ });
207
+ }
183
208
  function markAutomationRunRead(runId, readAtMs = Date.now()) {
184
209
  return getSqliteDatabase().prepare(`UPDATE automation_runs SET read_at_ms = COALESCE(read_at_ms, ?) WHERE run_id = ? AND ended_at_ms IS NOT NULL`).run(readAtMs, runId).changes > 0;
185
210
  }
@@ -196,4 +221,4 @@ function markAllAutomationRunsRead(options) {
196
221
  return Number(result.changes);
197
222
  }
198
223
  //#endregion
199
- export { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease };
224
+ export { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease };
@@ -1,3 +1,3 @@
1
1
  import { deleteAutomation, getAutomation, getDeletedAutomationRevision, listAutomations, saveAutomation, saveAutomations } from "./automation-repository.js";
2
- import { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease } from "./automation-run-repository.js";
3
- export { appendAutomationRunEvent, deleteAutomation, deleteAutomationRunsForAutomation, getAutomation, getAutomationRun, getAutomationRunRequest, getDeletedAutomationRevision, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listAutomations, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, saveAutomation, saveAutomationRun, saveAutomationRunRequest, saveAutomations, touchAutomationRunLease };
2
+ import { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, getAutomationRunRequest, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomationRun, saveAutomationRunRequest, touchAutomationRunLease } from "./automation-run-repository.js";
3
+ export { appendAutomationRunEvent, deleteAutomation, deleteAutomationRunsForAutomation, getAutomation, getAutomationRun, getAutomationRunRequest, getDeletedAutomationRevision, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listAutomations, listUnfinishedAutomationRuns, markAllAutomationRunsRead, markAutomationRunRead, pruneAutomationHistory, saveAutomation, saveAutomationRun, saveAutomationRunRequest, saveAutomations, touchAutomationRunLease };
@@ -0,0 +1 @@
1
+ export declare function resolveAutomationWebhookSecret(secretId: string): string | undefined;
@@ -0,0 +1,16 @@
1
+ //#region src/automations/webhook-secrets.ts
2
+ function resolveAutomationWebhookSecret(secretId) {
3
+ const raw = process.env.XOPC_AUTOMATION_WEBHOOK_SECRETS?.trim();
4
+ if (!raw) return void 0;
5
+ let parsed;
6
+ try {
7
+ parsed = JSON.parse(raw);
8
+ } catch {
9
+ throw new Error("XOPC_AUTOMATION_WEBHOOK_SECRETS must be a JSON object");
10
+ }
11
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("XOPC_AUTOMATION_WEBHOOK_SECRETS must be a JSON object");
12
+ const value = parsed[secretId];
13
+ return typeof value === "string" && value.length >= 16 ? value : void 0;
14
+ }
15
+ //#endregion
16
+ export { resolveAutomationWebhookSecret };
@@ -1,9 +1,9 @@
1
1
  import { requireXopcDatabase } from "../storage/sqlite/connection.js";
2
2
  import { init_sqlite } from "../storage/sqlite/index.js";
3
3
  import { AgentCatalogService } from "../agent-catalog/service.js";
4
- import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
5
4
  import { cutoverLegacyAgentConfig } from "../agent-catalog/migrations/legacy-config-cutover.js";
6
5
  import "../agent-catalog/index.js";
6
+ import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
7
7
  import { runBootstrapMigrationsSync } from "../migrations/runner.js";
8
8
  //#region src/bootstrap/application-state.ts
9
9
  init_sqlite();
@@ -1,7 +1,7 @@
1
1
  import { SqliteCommitEffectError, init_transaction } from "../../storage/sqlite/transaction.js";
2
+ import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
2
3
  import { CapabilityError } from "./errors.js";
3
4
  import { executeExternalOperation } from "./external-operations.js";
4
- import { OperationConflictError, executeAtomicOperation } from "./atomic-operations.js";
5
5
  import { createHash } from "node:crypto";
6
6
  import { z } from "zod";
7
7
  //#region src/capabilities/runtime/dispatcher.ts
@@ -1,5 +1,6 @@
1
1
  import { CapabilityError } from "./errors.js";
2
2
  import { CapabilityDispatcher } from "./dispatcher.js";
3
+ import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
3
4
  import { registerLocalAppReadCapabilities } from "../../local-apps/capabilities/read.js";
4
5
  import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
5
6
  import { registerNoteWriteCapabilities } from "../../notes/capabilities/write.js";
@@ -18,7 +19,6 @@ import { registerSceneReadCapabilities } from "../../scenes/capabilities/read.js
18
19
  import { registerSceneWriteCapabilities } from "../../scenes/capabilities/write.js";
19
20
  import { registerSettingsCapability } from "./settings.js";
20
21
  import { registerAppContextCapability } from "./app-context.js";
21
- import { registerAgentCapabilities } from "../../agent-catalog/capabilities.js";
22
22
  //#region src/capabilities/runtime/product.ts
23
23
  function createProductDispatcher(getNotes, taskWrites) {
24
24
  const dispatcher = new CapabilityDispatcher();
@@ -7,10 +7,26 @@ export type StoreConnectorInstallPlan = {
7
7
  definition: ConnectorDefinition;
8
8
  permissions: ConnectorPermissions;
9
9
  requiresRestart: false;
10
+ reviewHash: string;
10
11
  };
12
+ export type StoreConnectorInstallCandidate = {
13
+ candidateRef: string;
14
+ source: 'store';
15
+ packageName: string;
16
+ version: string;
17
+ label: string;
18
+ summary: string;
19
+ capabilities: string[];
20
+ };
21
+ export declare function storeConnectorCandidateRef(packageName: string, version: string): string;
22
+ export declare function parseStoreConnectorCandidateRef(ref: string): {
23
+ packageName: string;
24
+ version: string;
25
+ } | undefined;
26
+ export declare function searchStoreConnectorInstallCandidates(config: Config, query: string, limit?: number): Promise<StoreConnectorInstallCandidate[]>;
11
27
  export declare function listStoreConnectors(config: Config, params: SkillsStoreListParams): Promise<import("../agent/skills/skills-marketplace.js").SkillsStoreListResponse>;
12
28
  export declare function getStoreConnectorInstallPlan(config: Config, packageName: string, version?: string): Promise<StoreConnectorInstallPlan>;
13
- export declare function installStoreConnector(config: Config, packageName: string, input: ConnectorInstallInput, version?: string): Promise<{
29
+ export declare function installStoreConnector(config: Config, packageName: string, input: ConnectorInstallInput, version?: string, reviewHash?: string): Promise<{
14
30
  instance: import("../connectors/types.js").ConnectorInstance;
15
31
  plan: StoreConnectorInstallPlan;
16
32
  }>;
@@ -1,10 +1,65 @@
1
1
  import { getCliAdapter } from "../connectors/cli/adapterRegistry.js";
2
- import { downloadConnectorStoreZipBuffer, fetchStoreConnectorPackageDetail, listConnectorPackages, resolveSkillsStoreBaseUrl } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
2
+ import { listConnectorInstances } from "../connectors/instances.js";
3
3
  import { installConnectorDefinition } from "../connectors/install.js";
4
+ import { downloadConnectorStoreZipBuffer, fetchStoreConnectorPackageDetail, listConnectorPackages, resolveSkillsStoreBaseUrl } from "../agent/skills/marketplace/adapters/store/store-api-client.js";
4
5
  import { createHash } from "node:crypto";
5
6
  import { isIP } from "node:net";
6
7
  import AdmZip from "adm-zip";
7
8
  //#region src/capabilities/store-connector.ts
9
+ const STORE_CONNECTOR_CANDIDATE_PREFIX = "store-connector:";
10
+ function storeConnectorCandidateRef(packageName, version) {
11
+ return `${STORE_CONNECTOR_CANDIDATE_PREFIX}${encodeURIComponent(packageName)}:${encodeURIComponent(version)}`;
12
+ }
13
+ function parseStoreConnectorCandidateRef(ref) {
14
+ if (!ref.startsWith(STORE_CONNECTOR_CANDIDATE_PREFIX)) return void 0;
15
+ const parts = ref.slice(16).split(":");
16
+ if (parts.length !== 2) return void 0;
17
+ try {
18
+ const packageName = decodeURIComponent(parts[0]);
19
+ const version = decodeURIComponent(parts[1]);
20
+ return packageName && version ? {
21
+ packageName,
22
+ version
23
+ } : void 0;
24
+ } catch {
25
+ return;
26
+ }
27
+ }
28
+ function manifestCapabilities(value) {
29
+ if (!value || typeof value !== "object" || Array.isArray(value)) return ["connector.tools"];
30
+ const manifest = value;
31
+ if (!Array.isArray(manifest.provides)) return ["connector.tools"];
32
+ const values = manifest.provides.flatMap((entry) => {
33
+ if (typeof entry === "string" && entry.trim()) return [entry.trim()];
34
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return [];
35
+ const id = entry.id;
36
+ return typeof id === "string" && id.trim() ? [id.trim()] : [];
37
+ });
38
+ return values.length ? [...new Set(values)].slice(0, 20) : ["connector.tools"];
39
+ }
40
+ async function searchStoreConnectorInstallCandidates(config, query, limit = 5) {
41
+ const result = await listStoreConnectors(config, {
42
+ q: query,
43
+ page: 1,
44
+ pageSize: Math.min(10, Math.max(1, limit)),
45
+ sort: "downloads"
46
+ });
47
+ const installed = new Set(listConnectorInstances(config).map((instance) => instance.connectorId));
48
+ return result.items.filter((item) => item.type === "connector" && !installed.has(item.name) && typeof item.latestVersion === "string" && item.latestVersion).slice(0, limit).map((item) => ({
49
+ candidateRef: storeConnectorCandidateRef(item.name, item.latestVersion),
50
+ source: "store",
51
+ packageName: item.name,
52
+ version: item.latestVersion,
53
+ label: (() => {
54
+ const manifest = item.connectorManifest;
55
+ if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) return item.name;
56
+ const displayName = manifest.displayName;
57
+ return typeof displayName === "string" && displayName.trim() ? displayName.trim() : item.name;
58
+ })(),
59
+ summary: item.description,
60
+ capabilities: manifestCapabilities(item.connectorManifest)
61
+ }));
62
+ }
8
63
  function asRecord(value, label) {
9
64
  if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${label} must be an object.`);
10
65
  return value;
@@ -308,15 +363,26 @@ async function getStoreConnectorInstallPlan(config, packageName, version) {
308
363
  version: detail.latestVersion.version,
309
364
  permissions: definition.permissions ?? {},
310
365
  requiresRestart: false,
366
+ reviewHash: createHash("sha256").update(JSON.stringify({
367
+ packageName: detail.name,
368
+ version: detail.latestVersion.version,
369
+ sha256: actualSha256,
370
+ permissions: definition.permissions ?? {},
371
+ capabilities: definition.capabilities,
372
+ auth: definition.auth,
373
+ setup: definition.setup,
374
+ runtime: definition.runtime
375
+ })).digest("hex"),
311
376
  definition
312
377
  };
313
378
  }
314
- async function installStoreConnector(config, packageName, input, version) {
379
+ async function installStoreConnector(config, packageName, input, version, reviewHash) {
315
380
  const plan = await getStoreConnectorInstallPlan(config, packageName, version);
381
+ if (!reviewHash || reviewHash !== plan.reviewHash) throw new Error(reviewHash ? "Connector package changed after review; inspect it again." : "Connector capability review is required.");
316
382
  return {
317
383
  instance: await installConnectorDefinition(config, plan.definition, input),
318
384
  plan
319
385
  };
320
386
  }
321
387
  //#endregion
322
- export { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors };
388
+ export { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors, parseStoreConnectorCandidateRef, searchStoreConnectorInstallCandidates, storeConnectorCandidateRef };
@@ -72,7 +72,7 @@ async function mergeVoiceTranscriptsIntoUserText(prepared, userText, sttConfig,
72
72
  mime: att.mimeType,
73
73
  fileName: att.name
74
74
  })).text.trim();
75
- transcripts.push(transcript || "[Voice: no speech detected]");
75
+ if (transcript) transcripts.push(transcript);
76
76
  if (transcript && "uri" in att && att.uri?.trim()) transcribedMediaUris.push(att.uri.trim());
77
77
  } catch (error) {
78
78
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -1,7 +1,7 @@
1
1
  import { normalizeAgentId } from "../agent-catalog/id.js";
2
2
  import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
3
- import { init_agent_session_key, resolveAgentIdFromConversationId } from "../routing/agent-session-key.js";
4
3
  import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
4
+ import { init_agent_session_key, resolveAgentIdFromConversationId } from "../routing/agent-session-key.js";
5
5
  import { commandRegistry } from "./registry.js";
6
6
  import { join } from "node:path";
7
7
  import { readFile } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { ConfigSchema, init_schema } from "../../config/schema.js";
4
3
  import { init_paths, resolveConfigPath } from "../../config/paths.js";
4
+ import { ConfigSchema, init_schema } from "../../config/schema.js";
5
5
  import { commandRegistry } from "../registry.js";
6
6
  import { parseConfigValue } from "../config-value.js";
7
7
  import { getConfigValueAtPath, parseConfigPath, setConfigValueAtPath, unsetConfigValueAtPath } from "../config-paths.js";
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
4
3
  import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
4
+ import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
5
5
  import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
6
6
  import { ExtensionLoader } from "../../extensions/loader.js";
7
7
  import "../../extensions/index.js";
@@ -1,8 +1,8 @@
1
1
  import { normalizeAgentId, validateAgentIdForNewAgent } from "../../agent-catalog/id.js";
2
2
  import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
3
3
  import { init_agent_scope, resolveAgentDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agent/agent-scope.js";
4
- import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
5
4
  import { AgentCatalogService } from "../../agent-catalog/service.js";
5
+ import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
6
6
  import { colors } from "../utils/colors.js";
7
7
  //#region src/cli/commands/agents.ts
8
8
  init_repository();
@@ -1,5 +1,5 @@
1
- import { loadConfig, saveConfig } from "../../config/loader.js";
2
1
  import { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors } from "../../capabilities/store-connector.js";
2
+ import { loadConfig, saveConfig } from "../../config/loader.js";
3
3
  import { register } from "../registry.js";
4
4
  import { confirm } from "@inquirer/prompts";
5
5
  import { Command } from "commander";
@@ -52,7 +52,8 @@ function createConnectorsCommand(ctx) {
52
52
  command.command("install <packageName>").description("Verify and install a connector capability from xopc-store").option("--version <version>", "Install an exact version").option("--secret <KEY=VALUE>", "Provide a required secret; repeat for multiple values", (value, previous = []) => [...previous, value], []).option("--config-value <KEY=VALUE>", "Provide a connector config value; repeat for multiple values", (value, previous = []) => [...previous, value], []).option("-y, --yes", "Skip the interactive confirmation", false).action(async (packageName, options) => {
53
53
  try {
54
54
  const config = loadConfig(ctx.configPath);
55
- printPlan(await getStoreConnectorInstallPlan(config, packageName, options.version));
55
+ const plan = await getStoreConnectorInstallPlan(config, packageName, options.version);
56
+ printPlan(plan);
56
57
  if (!options.yes && process.stdin.isTTY) {
57
58
  if (!await confirm({
58
59
  message: "Install this connector?",
@@ -65,7 +66,7 @@ function createConnectorsCommand(ctx) {
65
66
  const { instance } = await installStoreConnector(config, packageName, {
66
67
  secrets: parsePairs(options.secret, "--secret"),
67
68
  config: parsePairs(options.configValue, "--config-value")
68
- }, options.version);
69
+ }, options.version, plan.reviewHash);
69
70
  await saveConfig(config, ctx.configPath);
70
71
  console.log(`Installed ${instance.displayName} (${instance.instanceId}).`);
71
72
  } catch (error) {
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, DoctorContext } from '../types.js';
2
+ export declare function checkAutomationIntegrity(ctx: DoctorContext): Promise<CheckResult>;
@@ -0,0 +1,55 @@
1
+ import { requireXopcDatabase } from "../../../../storage/sqlite/connection.js";
2
+ import { getSqliteDatabase } from "../../../../storage/sqlite/transaction.js";
3
+ import { init_sqlite } from "../../../../storage/sqlite/index.js";
4
+ import { existsSync } from "node:fs";
5
+ //#region src/cli/commands/doctor/checks/automation-integrity.ts
6
+ init_sqlite();
7
+ async function checkAutomationIntegrity(ctx) {
8
+ if (!ctx.options.deep) return {
9
+ id: "automation-integrity",
10
+ label: "Automations",
11
+ status: "skip",
12
+ message: "Deep mode off; automation scan skipped.",
13
+ hints: ["Run: xopc doctor --deep"]
14
+ };
15
+ if (!existsSync(ctx.configPath)) return {
16
+ id: "automation-integrity",
17
+ label: "Automations",
18
+ status: "skip",
19
+ message: "No config file; skipped.",
20
+ hints: []
21
+ };
22
+ requireXopcDatabase();
23
+ const db = getSqliteDatabase();
24
+ const issues = [];
25
+ const orphanResults = db.prepare(`SELECT r.run_id FROM automation_results r
26
+ LEFT JOIN automation_runs ar ON ar.run_id = r.run_id WHERE ar.run_id IS NULL LIMIT 20`).all();
27
+ for (const row of orphanResults) issues.push(`orphan result ${row.run_id}`);
28
+ const orphanResultDeliveries = db.prepare(`SELECT d.run_id, d.destination_key FROM automation_result_deliveries d
29
+ LEFT JOIN automation_results r ON r.run_id = d.run_id WHERE r.run_id IS NULL LIMIT 20`).all();
30
+ for (const row of orphanResultDeliveries) issues.push(`orphan result delivery ${row.run_id}/${row.destination_key}`);
31
+ const orphanEventRuns = db.prepare(`SELECT d.event_id, d.automation_id, d.run_id FROM automation_event_deliveries d
32
+ LEFT JOIN automation_runs r ON r.run_id = d.run_id
33
+ WHERE d.run_id IS NOT NULL AND r.run_id IS NULL LIMIT 20`).all();
34
+ for (const row of orphanEventRuns) issues.push(`orphan event delivery run ${row.event_id}/${row.automation_id}/${row.run_id}`);
35
+ const expiredLeases = db.prepare(`SELECT
36
+ (SELECT COUNT(*) FROM automation_events WHERE projection_status = 'projecting' AND projection_lease_until_ms <= ?) +
37
+ (SELECT COUNT(*) FROM automation_event_deliveries WHERE lease_owner IS NOT NULL AND lease_until_ms <= ?) +
38
+ (SELECT COUNT(*) FROM automation_result_deliveries WHERE status = 'delivering' AND lease_until_ms <= ?) AS count`).get(Date.now(), Date.now(), Date.now());
39
+ if (expiredLeases.count > 0) issues.push(`${expiredLeases.count} expired automation lease(s) awaiting recovery`);
40
+ return issues.length === 0 ? {
41
+ id: "automation-integrity",
42
+ label: "Automations",
43
+ status: "pass",
44
+ message: "Automation state graph OK.",
45
+ hints: []
46
+ } : {
47
+ id: "automation-integrity",
48
+ label: "Automations",
49
+ status: "warn",
50
+ message: `${issues.length} automation integrity issue(s).`,
51
+ hints: issues
52
+ };
53
+ }
54
+ //#endregion
55
+ export { checkAutomationIntegrity };
@@ -0,0 +1,2 @@
1
+ import type { CheckResult, DoctorContext } from '../types.js';
2
+ export declare function checkDatabaseRelations(ctx: DoctorContext): Promise<CheckResult>;
@@ -0,0 +1,81 @@
1
+ import { requireXopcDatabase } from "../../../../storage/sqlite/connection.js";
2
+ import { getSqliteDatabase } from "../../../../storage/sqlite/transaction.js";
3
+ import { init_sqlite } from "../../../../storage/sqlite/index.js";
4
+ import { existsSync } from "node:fs";
5
+ //#region src/cli/commands/doctor/checks/database-relations.ts
6
+ init_sqlite();
7
+ const IMPLICIT_RELATION_CHECKS = [
8
+ ["session active transcript", `SELECT COUNT(*) AS count FROM sessions s
9
+ LEFT JOIN transcripts t ON t.transcript_id = s.active_transcript_id
10
+ WHERE t.transcript_id IS NULL`],
11
+ ["session project", `SELECT COUNT(*) AS count FROM sessions s
12
+ LEFT JOIN projects p ON p.project_id = s.project_id
13
+ WHERE s.project_id IS NOT NULL AND p.project_id IS NULL`],
14
+ ["queued session input", `SELECT COUNT(*) AS count FROM session_inputs i
15
+ LEFT JOIN sessions s ON s.conversation_id = i.conversation_id
16
+ WHERE s.conversation_id IS NULL`],
17
+ ["discussion action task", `SELECT COUNT(*) AS count FROM discussion_action_tasks a
18
+ LEFT JOIN tasks t ON t.task_id = a.task_id
19
+ WHERE t.task_id IS NULL`],
20
+ ["workflow event run", `SELECT COUNT(*) AS count FROM workflow_events e
21
+ LEFT JOIN workflow_runs r ON r.run_id = e.run_id
22
+ WHERE r.run_id IS NULL`],
23
+ ["local app active release", `SELECT COUNT(*) AS count FROM local_apps a
24
+ LEFT JOIN local_app_releases r ON r.release_id = a.active_release_id
25
+ WHERE a.active_release_id IS NOT NULL AND r.release_id IS NULL`],
26
+ ["automation run owner", `SELECT COUNT(*) AS count FROM automation_runs r
27
+ LEFT JOIN automations a ON a.automation_id = r.automation_id
28
+ WHERE a.automation_id IS NULL`],
29
+ ["automation run event", `SELECT COUNT(*) AS count FROM automation_run_events e
30
+ LEFT JOIN automation_runs r ON r.run_id = e.run_id
31
+ WHERE r.run_id IS NULL`],
32
+ ["automation event delivery owner", `SELECT COUNT(*) AS count FROM automation_event_deliveries d
33
+ LEFT JOIN automations a ON a.automation_id = d.automation_id
34
+ WHERE a.automation_id IS NULL`]
35
+ ];
36
+ async function checkDatabaseRelations(ctx) {
37
+ if (!ctx.options.deep) return {
38
+ id: "database-relations",
39
+ label: "Database relations",
40
+ status: "skip",
41
+ message: "Deep mode off; relation scan skipped.",
42
+ hints: ["Run: xopc doctor --deep"]
43
+ };
44
+ if (!existsSync(ctx.configPath)) return {
45
+ id: "database-relations",
46
+ label: "Database relations",
47
+ status: "skip",
48
+ message: "No config file; skipped.",
49
+ hints: []
50
+ };
51
+ requireXopcDatabase();
52
+ const db = getSqliteDatabase();
53
+ const issues = [];
54
+ const tables = new Set(db.prepare(`SELECT name FROM sqlite_master WHERE type = 'table'`).all().map((row) => row.name));
55
+ for (const table of tables) {
56
+ const escaped = table.replaceAll("\"", "\"\"");
57
+ const foreignKeys = db.prepare(`PRAGMA foreign_key_list("${escaped}")`).all();
58
+ for (const foreignKey of foreignKeys) if (!tables.has(foreignKey.table)) issues.push(`missing foreign-key target ${table} -> ${foreignKey.table}`);
59
+ }
60
+ const violations = db.prepare("PRAGMA foreign_key_check").all();
61
+ for (const violation of violations.slice(0, 20)) issues.push(`foreign-key violation ${violation.table} row ${violation.rowid ?? "?"} -> ${violation.parent}`);
62
+ for (const [label, sql] of IMPLICIT_RELATION_CHECKS) {
63
+ const row = db.prepare(sql).get();
64
+ if (row.count > 0) issues.push(`${row.count} orphan ${label} record(s)`);
65
+ }
66
+ return issues.length === 0 ? {
67
+ id: "database-relations",
68
+ label: "Database relations",
69
+ status: "pass",
70
+ message: "Foreign-key and core implicit relations OK.",
71
+ hints: []
72
+ } : {
73
+ id: "database-relations",
74
+ label: "Database relations",
75
+ status: "warn",
76
+ message: `${issues.length} database relation issue(s).`,
77
+ hints: issues.slice(0, 20)
78
+ };
79
+ }
80
+ //#endregion
81
+ export { checkDatabaseRelations };
@@ -53,7 +53,7 @@ async function checkDatabaseSchema(ctx) {
53
53
  id: "database-schema",
54
54
  label: "Database schema",
55
55
  status: "pass",
56
- message: `SQLite schema v${status.dbVersion} (current release v208).`,
56
+ message: `SQLite schema v${status.dbVersion} (current release v223).`,
57
57
  hints: []
58
58
  };
59
59
  }
@@ -1,9 +1,9 @@
1
1
  import { AgentCatalogRepository, init_repository } from "../../../../agent-catalog/repository.js";
2
2
  import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
3
- import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
4
- import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
5
3
  import { PROVIDER_ENV_MAP, init_env_keys } from "../../../../providers/env-keys.js";
4
+ import { getModelOAuthProviderIds, init_registry } from "../../../../auth/oauth/registry.js";
6
5
  import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
6
+ import { getDefaultAgentId, init_resolve_route } from "../../../../routing/resolve-route.js";
7
7
  import { loadConfig } from "../../../../config/loader.js";
8
8
  import { existsSync } from "node:fs";
9
9
  //#region src/cli/commands/doctor/checks/provider-auth.ts
@@ -3,6 +3,7 @@ import { checkNodeVersion } from "./checks/node-version.js";
3
3
  import { checkConfigHealth } from "./checks/config-health.js";
4
4
  import { checkStateIntegrity } from "./checks/state-integrity.js";
5
5
  import { checkDatabaseSchema } from "./checks/database-schema.js";
6
+ import { checkDatabaseRelations } from "./checks/database-relations.js";
6
7
  import { checkProviderAuth } from "./checks/provider-auth.js";
7
8
  import { checkChannelConfig } from "./checks/channel-config.js";
8
9
  import { checkChannelPairingPending } from "./checks/channel-pairing-pending.js";
@@ -16,6 +17,7 @@ import { checkChannelPlugins } from "./checks/channel-plugins.js";
16
17
  import { checkMigrations } from "./checks/migrations.js";
17
18
  import { checkImageProviders } from "./checks/image-providers.js";
18
19
  import { checkToolRuntimes } from "./checks/tool-runtimes.js";
20
+ import { checkAutomationIntegrity } from "./checks/automation-integrity.js";
19
21
  //#region src/cli/commands/doctor/flow.ts
20
22
  const DOCTOR_CHECKS = [
21
23
  checkVersionUpdate,
@@ -25,6 +27,7 @@ const DOCTOR_CHECKS = [
25
27
  checkConfigHealth,
26
28
  checkStateIntegrity,
27
29
  checkDatabaseSchema,
30
+ checkDatabaseRelations,
28
31
  checkProviderAuth,
29
32
  checkImageProviders,
30
33
  checkChannelConfig,
@@ -33,7 +36,8 @@ const DOCTOR_CHECKS = [
33
36
  checkWorkspaceStatus,
34
37
  checkGatewayService,
35
38
  checkGatewayHealth,
36
- checkSessionIntegrity
39
+ checkSessionIntegrity,
40
+ checkAutomationIntegrity
37
41
  ];
38
42
  /**
39
43
  * Headless data collection — used by both CLI and gateway API.
@@ -1,7 +1,7 @@
1
1
  import { init_paths, resolveExtensionsDir } from "../../config/paths.js";
2
+ import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
2
3
  import { computeExtensionDirectoryIntegrity, getExtensionLockfileManager } from "../../extensions/lockfile.js";
3
4
  import { AgentPluginStore } from "../../extensions/agent-plugins/store.js";
4
- import { downloadExtensionStoreZipBuffer, resolveExtensionZipDownloadUrl, resolveExtensionsStoreBaseUrl, verifyStoreArtifactSha256 } from "../../agent/skills/marketplace/adapters/store/store-api-client.js";
5
5
  import { loadConfig } from "../../config/loader.js";
6
6
  import { getContextWithOpts } from "../context.js";
7
7
  import { peekExtensionManifestFromStoreZip } from "../../extensions/install.js";
@@ -1,8 +1,8 @@
1
1
  import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
2
+ import { AgentCatalogService } from "../../agent-catalog/service.js";
2
3
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
3
4
  import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
4
5
  import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
5
- import { AgentCatalogService } from "../../agent-catalog/service.js";
6
6
  import { loadConfig } from "../../config/loader.js";
7
7
  import { formatExamples, register } from "../registry.js";
8
8
  import { getContextWithOpts } from "../context.js";
@@ -1,12 +1,12 @@
1
1
  import { AgentCatalogRepository, init_repository } from "../../../agent-catalog/repository.js";
2
- import { getAgentDefaultModelRef, init_schema } from "../../../config/schema.js";
3
2
  import { resolveModelsJsonPath } from "../../../config/paths.js";
3
+ import { AgentCatalogService } from "../../../agent-catalog/service.js";
4
+ import { getAgentDefaultModelRef, init_schema } from "../../../config/schema.js";
4
5
  import { init_models_json, loadModelsJson, saveModelsJson } from "../../../config/models-json.js";
5
6
  import { getApiKeyFromEnv } from "../../../providers/env-keys.js";
6
7
  import { getModelRegistry } from "../../../providers/model-registry.js";
7
8
  import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
8
9
  import { getAllProviders, getModelsByProvider, getProviderDisplayName, init_providers, providerSupportsApiKey, providerSupportsOAuth } from "../../../providers/index.js";
9
- import { AgentCatalogService } from "../../../agent-catalog/service.js";
10
10
  import { prepareUpdateGlobalDefaults } from "../../../gateway/global-defaults-admin.js";
11
11
  import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
12
12
  import { getXopcCloudCatalogCoordinator } from "../../../providers/xopc-cloud-catalog-coordinator.js";
@@ -1,10 +1,10 @@
1
1
  import { resolveStateDir } from "../../config/paths-state.js";
2
2
  import { init_paths, resolveBundledSkillsDir, resolveSkillsLockPath } from "../../config/paths.js";
3
+ import { loadSkillsLock } from "../../agent/skills/hub-lock.js";
3
4
  import { findInstallSpec, hasBinary, installSkill } from "../../agent/skills/installer.js";
4
5
  import { createSkillConfigManager, isSkillEnabled } from "../../agent/skills/config.js";
5
6
  import { formatScanSummary, scanSkillDirectory } from "../../agent/skills/scanner.js";
6
7
  import { createSkillLoader } from "../../agent/skills/index.js";
7
- import { loadSkillsLock } from "../../agent/skills/hub-lock.js";
8
8
  import { pullSkillFromSource, updateSkillFromLock } from "../../agent/skills/hub-pull.js";
9
9
  import { ProjectTrustStore } from "../../project-trust/trust-store.js";
10
10
  import { loadConfig } from "../../config/loader.js";
@@ -1,6 +1,6 @@
1
1
  import { AgentCatalogRepository, init_repository } from "../../agent-catalog/repository.js";
2
- import { ConfigSchema, init_schema } from "../../config/schema.js";
3
2
  import { AgentCatalogService } from "../../agent-catalog/service.js";
3
+ import { ConfigSchema, init_schema } from "../../config/schema.js";
4
4
  import { assertConfigRewriteSafeForRunningGateway, saveConfig } from "../../config/loader.js";
5
5
  import { ensureStarterAgentsInitialized } from "../../agent/starter-agents.js";
6
6
  import { bootstrapApplicationStateSync } from "../../bootstrap/application-state.js";
@@ -1,9 +1,9 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
4
3
  import { COMPUTER_CONTROL_TOOL, ComputerAppSchema, ComputerObservationSchema, ComputerWindowSchema, init_src } from "../../packages/computer-control-contract/src/index.js";
5
4
  import { ComputerServiceLimitsSchema, computerModelProfile, init_model_policy } from "./model-policy.js";
6
5
  import { getApiKey, init_providers, resolveModel } from "../providers/index.js";
6
+ import { resolveEffectiveAgentConfigForSession } from "../config/agent-profile.js";
7
7
  import { enterComputerControl, leaveComputerControl } from "./control-guard.js";
8
8
  import { ComputerDiagnosticSchema, ComputerOperationError, computerDiagnostic, computerRecovery } from "./errors.js";
9
9
  import { createComputerModelAdapter, predictComputerStep, readComputerJson } from "./model-adapter.js";