@xopcai/xopc 0.0.384 → 0.0.386

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 (280) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BSel9yf8.js → agent-avatar-dicebear-D-86VOlb.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DgHMyhuY.js → agent-defaults-settings-panel-SmeUVHY8.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BosuN4dO.js → agent-plugin-dialog-BVT3wXq5.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agents-B-pw5RKI.js → agents-D7rLQFhX.js} +3 -3
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DuOqKkfH.js → app-management-settings-panel-CUR7n5iP.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-8JF9rXFr.js → appearance-settings-BCotSGep.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-Cuclpk0A.js → apps-page-hk0bo9LT.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-page-D7NwNy2I.js → automations-page-CqxuUwox.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-workspace-CSxW4wX0.js → automations-workspace-11_Z69pr.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-Dnb7CH_l.js → block-editor-eldB84Mj.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-automations-page-GBgDe21o.js → browser-automations-page-D4TaUPYT.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-settings-page-B2FXaO3n.js → browser-settings-page-BXRlxeGV.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capabilities-XFwwUNU3.js → capabilities-BkKgImWi.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capabilities-2Do3eKMM.js → capabilities-DVj9n65C.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-page-f2-MquJn.js → capabilities-page-CyYlueEd.js} +2 -2
  18. package/dist/gateway/static/root/assets/{capabilities-settings-panel-D9F0mw16.js → capabilities-settings-panel-uVEgfvo0.js} +1 -1
  19. package/dist/gateway/static/root/assets/{capability-header-actions-DVRxJPQP.js → capability-header-actions-BXv0xu56.js} +1 -1
  20. package/dist/gateway/static/root/assets/{channels-CnDm5T1t.js → channels-fNb3SOzm.js} +1 -1
  21. package/dist/gateway/static/root/assets/{chat-terminal-dock-BxSCDbK7.js → chat-terminal-dock-CnLtparQ.js} +1 -1
  22. package/dist/gateway/static/root/assets/{computer-settings-page-DVAB-kQw.js → computer-settings-page-xM0AnOlP.js} +1 -1
  23. package/dist/gateway/static/root/assets/{connector-service-page-D2EeLXei.js → connector-service-page-CdG2WUb6.js} +1 -1
  24. package/dist/gateway/static/root/assets/{connectors-page-DK9n4hgZ.js → connectors-page-BRd08GH6.js} +1 -1
  25. package/dist/gateway/static/root/assets/constants-CpWu0oHS.js +1 -0
  26. package/dist/gateway/static/root/assets/{date-picker-Cl9KfFj8.js → date-picker-DIBbE-O8.js} +1 -1
  27. package/dist/gateway/static/root/assets/{dependency-picker-Ei6aX5WM.js → dependency-picker-DDD8zokD.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-4Evl4RKX.js → desktop-pet-KlF390Xn.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-DAD_OWcX.js → desktop-pet-settings-CgqQMKDC.js} +1 -1
  30. package/dist/gateway/static/root/assets/{device-pairing-wizard-BA21epMn.js → device-pairing-wizard-BR6isfG2.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-B_Zb5nNR.js → directory-picker-path-field-vPQsW05P.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-DtHNy4TE.js → extension-debug-page-ZHLPrLbH.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-8gWSThWP.js → extension-page-DJ42KFRN.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-provider-nbgU7xBS.js → extension-provider-6IcsyNaV.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-CunUbB09.js → extension-settings-page-D7-5v0V4.js} +1 -1
  36. package/dist/gateway/static/root/assets/{fallback-models-BSAfzXby.js → fallback-models-DnYn7qOV.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CN-2229W.js → gateway-settings-Bwe3JWX-.js} +1 -1
  38. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DktBCtHF.js → highlighted-body-KQOG7T2V-DefTxF3q.js} +1 -1
  39. package/dist/gateway/static/root/assets/{home-page-CUJcNW3H.js → home-page-BtSy2hRV.js} +1 -1
  40. package/dist/gateway/static/root/assets/{imports-page-DQm1MNNC.js → imports-page-CTdBYZib.js} +1 -1
  41. package/dist/gateway/static/root/assets/{index-BPNL54bv.js → index-B08iR7fT.js} +10 -10
  42. package/dist/gateway/static/root/assets/index-DBRwvWzm.css +1 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DaC5YjuJ.js → keyboard-shortcuts-settings-CXKp57O_.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-app-workbench-page-DwQyyo7a.js → local-app-workbench-page-DzD_OzGY.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-apps-page-CpZhivpf.js → local-apps-page-B0E0vttg.js} +1 -1
  46. package/dist/gateway/static/root/assets/{logs-page-Db43nh1M.js → logs-page-eL4fYcMl.js} +1 -1
  47. package/dist/gateway/static/root/assets/{management-settings-DrKejBEZ.js → management-settings-DSpjodMC.js} +1 -1
  48. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BTrk2wWv.js +1 -0
  49. package/dist/gateway/static/root/assets/{note-detail-panel-a8NSwmmW.js → note-detail-panel-CsY5tQp5.js} +3 -3
  50. package/dist/gateway/static/root/assets/{notes-page-BKRke43F.js → notes-page-D09LjNoj.js} +1 -1
  51. package/dist/gateway/static/root/assets/{page-context-capture-button-DUaMkmxv.js → page-context-capture-button-DO-aP3D9.js} +1 -1
  52. package/dist/gateway/static/root/assets/{personal-page-BqF-HHw1.js → personal-page-E8F2aGNB.js} +1 -1
  53. package/dist/gateway/static/root/assets/{product-open-page-GrhtTQIz.js → product-open-page-aUoA-uPw.js} +1 -1
  54. package/dist/gateway/static/root/assets/{product-preview-content-zdP7gN0y.js → product-preview-content-B-cz-pIV.js} +1 -1
  55. package/dist/gateway/static/root/assets/{project-detail-page-9Vd_AqDW.js → project-detail-page-WhefAh8E.js} +1 -1
  56. package/dist/gateway/static/root/assets/{projects-page-DGunhjoM.js → projects-page-CyqAs0tO.js} +1 -1
  57. package/dist/gateway/static/root/assets/{remote-access-hub-BoRsF3Lx.js → remote-access-hub-BwhRGL6m.js} +1 -1
  58. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-W0HDm--J.js → runtime-tools-settings-panel-o26dmPNq.js} +1 -1
  59. package/dist/gateway/static/root/assets/{scenes-page-CYsFOfVJ.js → scenes-page-D_e19kv_.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schema-form-CBxEbBQq.js → schema-form-DLLdqUC3.js} +1 -1
  61. package/dist/gateway/static/root/assets/{send-session-input-BCAF-Ikt.js → send-session-input-2I-nFJcE.js} +1 -1
  62. package/dist/gateway/static/root/assets/session-manager-Co5ozD0l.js +16 -0
  63. package/dist/gateway/static/root/assets/{sessions-page-Dthfx_vc.js → sessions-page-DX6INsiS.js} +1 -1
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-C4_gW1vw.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-page-CFs-WP_2.js → settings-page-Bc_zxxRu.js} +1 -1
  66. package/dist/gateway/static/root/assets/{setup-status-panel-D2-9fXYL.js → setup-status-panel-FpF_cPPr.js} +1 -1
  67. package/dist/gateway/static/root/assets/{share-preview-page-nJ2FWAEP.js → share-preview-page-BOCcPBqQ.js} +1 -1
  68. package/dist/gateway/static/root/assets/{shares-settings-DTb88RHD.js → shares-settings-CInxjxgJ.js} +1 -1
  69. package/dist/gateway/static/root/assets/{skill-api-DJ8UBsxq.js → skill-api-Bjd8WAA4.js} +1 -1
  70. package/dist/gateway/static/root/assets/{skills-page-DjbBOikT.js → skills-page-8CKS3Oo2.js} +1 -1
  71. package/dist/gateway/static/root/assets/{system-settings-panel-Dt5GkLhM.js → system-settings-panel-BgQdsrNw.js} +1 -1
  72. package/dist/gateway/static/root/assets/task-detail-page-BnG5ehZ6.js +2 -0
  73. package/dist/gateway/static/root/assets/task-expandable-content-BCuc70Vc.js +1 -0
  74. package/dist/gateway/static/root/assets/{tasks-DJIeIk9C.js → tasks-PuIUgF9L.js} +1 -1
  75. package/dist/gateway/static/root/assets/{tunnel-api-JHttXi63.js → tunnel-api-CY7MoDGf.js} +1 -1
  76. package/dist/gateway/static/root/assets/{usage-page-B3rUa0fW.js → usage-page-s8Sv_PIG.js} +1 -1
  77. package/dist/gateway/static/root/assets/{use-composer-attachments-BFP3k6oC.js → use-composer-attachments-D0S2iZF4.js} +1 -1
  78. package/dist/gateway/static/root/assets/{use-file-preview-expanded-B1BiTQNS.js → use-file-preview-expanded-BElqELib.js} +1 -1
  79. package/dist/gateway/static/root/assets/{user-model-page-Cq1VSsZw.js → user-model-page-CyWrEtHY.js} +1 -1
  80. package/dist/gateway/static/root/assets/{work-discovery-overlay-BAtG_JHv.js → work-discovery-overlay-DmZXLs1v.js} +1 -1
  81. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cw12NFgx.js → workflow-run-setup-panel-BdLOzHm4.js} +1 -1
  82. package/dist/gateway/static/root/assets/{workflows-page-kR5ouOuM.js → workflows-page-Cx3I3AV5.js} +1 -1
  83. package/dist/gateway/static/root/assets/{workspace-api-Xr3wz8T3.js → workspace-api-Du7-xJ0q.js} +2 -2
  84. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BTBVKpSg.js → xopc-cloud-account-card-D8B136vW.js} +1 -1
  85. package/dist/gateway/static/root/index.html +12 -12
  86. package/dist/package.js +1 -1
  87. package/dist/packages/gateway-contract/src/index.js +2 -0
  88. package/dist/packages/gateway-contract/src/task-research-result.js +89 -0
  89. package/dist/packages/gateway-contract/src/tasks.js +7 -1
  90. package/dist/packages/gateway-contract/src/turn-outcome.js +3 -0
  91. package/dist/src/agent/child-agent-factory.d.ts +4 -1
  92. package/dist/src/agent/child-agent-factory.js +91 -11
  93. package/dist/src/agent/context/connection-objective-context.d.ts +1 -0
  94. package/dist/src/agent/context/connection-objective-context.js +33 -0
  95. package/dist/src/agent/data-acquisition/service.js +41 -6
  96. package/dist/src/agent/data-acquisition/types.d.ts +2 -0
  97. package/dist/src/agent/embedded/agent-profile-context.d.ts +7 -0
  98. package/dist/src/agent/embedded/agent-profile-context.js +92 -0
  99. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -1
  100. package/dist/src/agent/embedded/execution-tool-policy.js +3 -2
  101. package/dist/src/agent/embedded/run-for-session.js +37 -14
  102. package/dist/src/agent/embedded/run-turn.js +123 -26
  103. package/dist/src/agent/embedded/runs.d.ts +9 -2
  104. package/dist/src/agent/embedded/runs.js +30 -7
  105. package/dist/src/agent/embedded/session-runner.js +14 -3
  106. package/dist/src/agent/embedded/types.d.ts +6 -1
  107. package/dist/src/agent/external-tools/cliProvider.d.ts +1 -0
  108. package/dist/src/agent/external-tools/cliProvider.js +1 -0
  109. package/dist/src/agent/external-tools/composio-provider.js +2 -0
  110. package/dist/src/agent/external-tools/gateway-tools.js +15 -5
  111. package/dist/src/agent/external-tools/service.d.ts +1 -0
  112. package/dist/src/agent/external-tools/service.js +3 -1
  113. package/dist/src/agent/external-tools/types.d.ts +4 -0
  114. package/dist/src/agent/orchestration/agent-run-supervisor.js +2 -1
  115. package/dist/src/agent/orchestration/agent-turn-policy.d.ts +1 -0
  116. package/dist/src/agent/orchestration/agent-turn-policy.js +5 -1
  117. package/dist/src/agent/orchestration/delegation-budget.d.ts +7 -1
  118. package/dist/src/agent/orchestration/delegation-budget.js +19 -10
  119. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +5 -0
  120. package/dist/src/agent/orchestration/llm-turn-retry.js +15 -5
  121. package/dist/src/agent/orchestration/research-checkpoint.d.ts +56 -0
  122. package/dist/src/agent/orchestration/research-checkpoint.js +64 -0
  123. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +3 -1
  124. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +15 -2
  125. package/dist/src/agent/orchestration/run-termination.d.ts +12 -0
  126. package/dist/src/agent/orchestration/run-termination.js +24 -0
  127. package/dist/src/agent/orchestration/turn-recovery.d.ts +9 -0
  128. package/dist/src/agent/orchestration/turn-recovery.js +45 -0
  129. package/dist/src/agent/prompt/sections/agent-identity.js +12 -7
  130. package/dist/src/agent/prompt/sections/messaging-runtime.js +1 -1
  131. package/dist/src/agent/prompt/sections/project-context.js +1 -1
  132. package/dist/src/agent/prompt/sections/response-language.d.ts +1 -1
  133. package/dist/src/agent/prompt/sections/response-language.js +6 -2
  134. package/dist/src/agent/prompt/subagent-context.js +1 -1
  135. package/dist/src/agent/prompt/system-prompt.js +4 -6
  136. package/dist/src/agent/service/direct-turn-helpers.js +6 -5
  137. package/dist/src/agent/service/process-direct-streaming.js +7 -1
  138. package/dist/src/agent/tasks/task-judge-service.js +30 -10
  139. package/dist/src/agent/tools/apply-patch.js +1 -1
  140. package/dist/src/agent/tools/delegate-tool.js +216 -121
  141. package/dist/src/agent/tools/delegation-policy.js +13 -1
  142. package/dist/src/agent/tools/factory.js +12 -1
  143. package/dist/src/agent/tools/index.d.ts +2 -0
  144. package/dist/src/agent/tools/index.js +3 -1
  145. package/dist/src/agent/tools/language-diagnostics.js +1 -1
  146. package/dist/src/agent/tools/personal-request-result-tool.js +20 -3
  147. package/dist/src/agent/tools/personal-request-tool.js +165 -23
  148. package/dist/src/agent/tools/personal-task-tool.d.ts +6 -3
  149. package/dist/src/agent/tools/personal-task-tool.js +146 -23
  150. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  151. package/dist/src/agent/tools/research-checkpoint-tool.d.ts +3 -0
  152. package/dist/src/agent/tools/research-checkpoint-tool.js +28 -0
  153. package/dist/src/agent/tools/review-workspace.js +1 -1
  154. package/dist/src/agent/tools/search/cache.d.ts +20 -0
  155. package/dist/src/agent/tools/search/cache.js +19 -0
  156. package/dist/src/agent/tools/search/errors.d.ts +19 -0
  157. package/dist/src/agent/tools/search/errors.js +69 -0
  158. package/dist/src/agent/tools/search/providers/bing-api.js +2 -1
  159. package/dist/src/agent/tools/search/providers/bing-html.js +2 -1
  160. package/dist/src/agent/tools/search/providers/brave.js +2 -1
  161. package/dist/src/agent/tools/search/providers/duckduckgo-html.js +2 -1
  162. package/dist/src/agent/tools/search/providers/searxng.js +2 -1
  163. package/dist/src/agent/tools/search/providers/tavily.js +2 -1
  164. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +1 -0
  165. package/dist/src/agent/tools/search/providers/xopc-cloud.js +7 -2
  166. package/dist/src/agent/tools/search/registry.d.ts +21 -5
  167. package/dist/src/agent/tools/search/registry.js +252 -25
  168. package/dist/src/agent/tools/search/types.d.ts +25 -0
  169. package/dist/src/agent/tools/task-collaboration-tool.d.ts +16 -0
  170. package/dist/src/agent/tools/task-collaboration-tool.js +153 -0
  171. package/dist/src/agent/tools/task-result-tool.d.ts +2 -0
  172. package/dist/src/agent/tools/task-result-tool.js +73 -0
  173. package/dist/src/agent/tools/web.d.ts +16 -2
  174. package/dist/src/agent/tools/web.js +74 -29
  175. package/dist/src/agent/tools/xopc-use-tool.js +3 -3
  176. package/dist/src/automations/capabilities/write.d.ts +4 -4
  177. package/dist/src/automations/domain/validation.d.ts +8 -8
  178. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
  179. package/dist/src/browser/automations/schema.d.ts +2 -2
  180. package/dist/src/browser/automations/service.d.ts +2 -2
  181. package/dist/src/cli/commands/channels.js +1 -1
  182. package/dist/src/cli/commands/connectors.js +1 -1
  183. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  184. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  185. package/dist/src/cli/commands/models.js +1 -1
  186. package/dist/src/cli/commands/onboard.js +1 -1
  187. package/dist/src/config/index.js +2 -2
  188. package/dist/src/config/schema.d.ts +1 -0
  189. package/dist/src/config/schema.js +4 -1
  190. package/dist/src/connectors/connection-recovery-service.d.ts +9 -1
  191. package/dist/src/connectors/connection-recovery-service.js +213 -33
  192. package/dist/src/discussions/action-tasks.d.ts +2 -2
  193. package/dist/src/extensions/sdk/index.js +1 -1
  194. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  195. package/dist/src/gateway/hono/routes/connection-waits.js +3 -1
  196. package/dist/src/gateway/hono/routes/projects.js +1 -1
  197. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +16 -0
  198. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  199. package/dist/src/gateway/service/agent-runner.d.ts +2 -0
  200. package/dist/src/gateway/service/agent-runner.js +30 -17
  201. package/dist/src/gateway/service/run-gateway-agent.js +21 -6
  202. package/dist/src/gateway/service/session-input-coordinator.d.ts +10 -1
  203. package/dist/src/gateway/service/session-input-coordinator.js +216 -27
  204. package/dist/src/gateway/service.d.ts +1 -0
  205. package/dist/src/gateway/service.js +6 -4
  206. package/dist/src/gateway/session-context-summary.js +1 -1
  207. package/dist/src/personal-agent/prompts.js +10 -3
  208. package/dist/src/personal-agent/reply-composer.d.ts +1 -0
  209. package/dist/src/personal-agent/reply-composer.js +91 -19
  210. package/dist/src/personal-agent/reply-style.d.ts +1 -1
  211. package/dist/src/personal-agent/reply-style.js +1 -0
  212. package/dist/src/personal-agent/repository.d.ts +1 -1
  213. package/dist/src/personal-agent/repository.js +1 -1
  214. package/dist/src/personal-agent/request-access.d.ts +3 -0
  215. package/dist/src/personal-agent/request-access.js +31 -0
  216. package/dist/src/personal-agent/request-delivery.js +9 -4
  217. package/dist/src/personal-agent/request-repository.d.ts +3 -0
  218. package/dist/src/personal-agent/request-service.d.ts +6 -0
  219. package/dist/src/personal-agent/request-service.js +121 -25
  220. package/dist/src/personal-agent/result-file-links.d.ts +3 -0
  221. package/dist/src/personal-agent/result-file-links.js +21 -0
  222. package/dist/src/personal-agent/task-cancel.js +85 -35
  223. package/dist/src/providers/model-response.js +13 -2
  224. package/dist/src/scenes/taskFollowUp/service.d.ts +15 -5
  225. package/dist/src/session/session-context-for-llm.js +2 -2
  226. package/dist/src/session/store.d.ts +3 -1
  227. package/dist/src/session/store.js +30 -7
  228. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +7 -2
  229. package/dist/src/storage/sqlite/connection-wait-repository.js +124 -20
  230. package/dist/src/storage/sqlite/index.d.ts +1 -0
  231. package/dist/src/storage/sqlite/index.js +3 -1
  232. package/dist/src/storage/sqlite/migrations/250_research_checkpoints.sql +15 -0
  233. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  234. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  235. package/dist/src/storage/sqlite/research-checkpoint-repository.d.ts +24 -0
  236. package/dist/src/storage/sqlite/research-checkpoint-repository.js +91 -0
  237. package/dist/src/storage/sqlite/schema.js +1 -1
  238. package/dist/src/storage/sqlite/session-creation-repository.js +3 -2
  239. package/dist/src/storage/sqlite/session-input-repository.d.ts +16 -0
  240. package/dist/src/storage/sqlite/session-input-repository.js +41 -7
  241. package/dist/src/storage/sqlite/transcript-repository.d.ts +2 -0
  242. package/dist/src/storage/sqlite/transcript-repository.js +25 -1
  243. package/dist/src/tasks/capabilities/management.d.ts +2 -2
  244. package/dist/src/tasks/capabilities/relations.d.ts +7 -7
  245. package/dist/src/tasks/capabilities/write.d.ts +2 -2
  246. package/dist/src/tasks/index.js +1 -1
  247. package/dist/src/tasks/task-allocation-service.d.ts +2 -0
  248. package/dist/src/tasks/task-allocation-service.js +43 -2
  249. package/dist/src/tasks/task-application-service.js +3 -3
  250. package/dist/src/tasks/task-collaboration-delivery.js +4 -1
  251. package/dist/src/tasks/task-collaboration-repository.d.ts +3 -0
  252. package/dist/src/tasks/task-collaboration-repository.js +11 -1
  253. package/dist/src/tasks/task-context-assembler.js +19 -6
  254. package/dist/src/tasks/task-continuation.d.ts +6 -0
  255. package/dist/src/tasks/task-continuation.js +33 -0
  256. package/dist/src/tasks/task-contract-planner.d.ts +1 -0
  257. package/dist/src/tasks/task-contract-planner.js +22 -15
  258. package/dist/src/tasks/task-main-update-delivery.js +13 -8
  259. package/dist/src/tasks/task-model-call.d.ts +7 -0
  260. package/dist/src/tasks/task-model-call.js +35 -0
  261. package/dist/src/tasks/task-read-model-projector.js +1 -1
  262. package/dist/src/tasks/task-research-repair.d.ts +19 -0
  263. package/dist/src/tasks/task-research-repair.js +75 -0
  264. package/dist/src/tasks/task-research-result.d.ts +85 -0
  265. package/dist/src/tasks/task-research-result.js +394 -0
  266. package/dist/src/tasks/task-result-delivery-repository.js +13 -2
  267. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  268. package/dist/src/tasks/task-run-coordinator.d.ts +1 -0
  269. package/dist/src/tasks/task-run-coordinator.js +80 -11
  270. package/dist/src/tasks/task-run-dispatcher.js +12 -0
  271. package/dist/src/tasks/task-run-repository.d.ts +13 -0
  272. package/dist/src/tasks/task-run-repository.js +120 -2
  273. package/package.json +7 -3
  274. package/dist/gateway/static/root/assets/constants-Dy8Gw0sF.js +0 -1
  275. package/dist/gateway/static/root/assets/index-yseLAt9D.css +0 -1
  276. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C4VzqE9z.js +0 -1
  277. package/dist/gateway/static/root/assets/session-manager-_yy4bxhT.js +0 -16
  278. package/dist/gateway/static/root/assets/settings-advanced-gate-O_0Lk38S.js +0 -1
  279. package/dist/gateway/static/root/assets/task-detail-page-88EShcbs.js +0 -2
  280. package/dist/gateway/static/root/assets/task-expandable-content-CF6Bj-Qa.js +0 -1
@@ -16,8 +16,8 @@ import { prepareUpdateGlobalDefaults } from "../../gateway/global-defaults-admin
16
16
  import { disconnectProvider } from "../../providers/provider-disconnect.js";
17
17
  import { colors } from "../utils/colors.js";
18
18
  import { runCliOAuthLogin } from "../utils/oauth-login.js";
19
- import { Command } from "commander";
20
19
  import { input } from "@inquirer/prompts";
20
+ import { Command } from "commander";
21
21
  //#region src/cli/commands/models.ts
22
22
  init_credentials();
23
23
  init_schema();
@@ -11,8 +11,8 @@ import { initWorkspace } from "../utils/init-workspace.js";
11
11
  import { setupModel } from "./onboard/model.js";
12
12
  import { getChannelConfigurators } from "./onboard/channels/registry.js";
13
13
  import { setupChannels } from "./onboard/channels/index.js";
14
- import { Command } from "commander";
15
14
  import { select } from "@inquirer/prompts";
15
+ import { Command } from "commander";
16
16
  //#region src/cli/commands/onboard.ts
17
17
  init_repository();
18
18
  init_schema();
@@ -5,7 +5,7 @@ import { resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
5
5
  import { extractProfileAgentId, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
6
6
  import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
7
7
  import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
8
- import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
8
+ import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultChatModelConfig, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
9
9
  import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
10
10
  import { FILENAMES, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
11
11
  import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
@@ -26,4 +26,4 @@ init_workspace_path();
26
26
  init_models_json();
27
27
  init_resolve_config_value();
28
28
  //#endregion
29
- export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BASE_RELOAD_RULES, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, assertConfigRewriteSafeForRunningGateway, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, hasBundledExtensionManifest, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
29
+ export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BASE_RELOAD_RULES, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, assertConfigRewriteSafeForRunningGateway, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultChatModelConfig, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, hasBundledExtensionManifest, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcCloudCatalogCachePath, resolveXopcDatabasePath, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
@@ -2126,6 +2126,7 @@ export interface ParsedModelRef {
2126
2126
  model: string;
2127
2127
  }
2128
2128
  export declare function getAgentDefaultModelRef(): string | undefined;
2129
+ export declare function getAgentDefaultChatModelConfig(): AgentModelConfig | undefined;
2129
2130
  export declare function getAgentDefaultImageModelConfig(): AgentModelConfig | undefined;
2130
2131
  export declare function getAgentDefaultImageGenerationModelConfig(agentId: string): AgentImageGenerationModelConfig | undefined;
2131
2132
  /** `provider/model` or null when invalid. */
@@ -16,6 +16,9 @@ import semver from "semver";
16
16
  function getAgentDefaultModelRef() {
17
17
  return getAgentDefaultModelsConfig()?.chat.primary;
18
18
  }
19
+ function getAgentDefaultChatModelConfig() {
20
+ return getAgentDefaultModelsConfig()?.chat;
21
+ }
19
22
  function getAgentDefaultModelsConfig(requestedAgentId) {
20
23
  const catalog = new AgentCatalogRepository().snapshot();
21
24
  const id = requestedAgentId?.trim() || catalog.defaultAgentId;
@@ -1146,4 +1149,4 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
1146
1149
  }));
1147
1150
  //#endregion
1148
1151
  init_schema();
1149
- export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
1152
+ export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, BrowserConfigSchema, ChannelsConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewayScenesConfigSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, McpConfigSchema, McpOAuthConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, RuntimeToolsConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TunnelBrokerUrlSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultChatModelConfig, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
@@ -1,12 +1,13 @@
1
1
  import type { Config } from '../config/schema.js';
2
2
  import type { SessionInput } from '../storage/sqlite/session-input-repository.js';
3
3
  import { ComposioSessionsAdapter } from './composio-sessions.js';
4
- import type { ConnectionWaitSnapshot } from '@xopcai/gateway-contract';
4
+ import type { ConnectionWait, ConnectionWaitSnapshot } from '@xopcai/gateway-contract';
5
5
  export type ConnectionAction = {
6
6
  waitId: string;
7
7
  expectedTranscriptId: string;
8
8
  expectedVersion: number;
9
9
  idempotencyKey: string;
10
+ expectedObjectiveRevision?: number;
10
11
  action: 'install_complete' | 'connect' | 'check' | 'skip' | 'cancel' | 'select_account' | 'confirm_scope' | 'replace_source';
11
12
  needKey?: string;
12
13
  accountId?: string;
@@ -17,6 +18,7 @@ export type ConnectionAction = {
17
18
  export declare class ConnectionRecoveryService {
18
19
  private readonly deps;
19
20
  private readonly busy;
21
+ private readonly checks;
20
22
  private timer?;
21
23
  private deliveryTimer?;
22
24
  private polling;
@@ -32,8 +34,14 @@ export declare class ConnectionRecoveryService {
32
34
  drain: (conversationId: string) => void;
33
35
  onPersonalRequestDelivered?: (conversationId: string, requestId: string) => void;
34
36
  adapter?: ComposioSessionsAdapter;
37
+ checkTimeoutMs?: number;
35
38
  });
36
39
  private get adapter();
40
+ cancelObjective(target: ConnectionWait): void;
41
+ continueObjective(target: ConnectionWait, idempotencyKey: string): Promise<void>;
42
+ private markChecking;
43
+ /** Readiness checks never execute the objective; late results cannot advance a newer wait. */
44
+ private boundedCheck;
37
45
  snapshot(conversationId: string): ConnectionWaitSnapshot;
38
46
  private view;
39
47
  private ensureInstallation;
@@ -1,12 +1,12 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
3
+ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
4
4
  import { readCurrentTranscriptId } from "../storage/sqlite/session-instance-repository.js";
5
5
  import { getSessionInputState, init_session_input_repository } from "../storage/sqlite/session-input-repository.js";
6
6
  import { init_request_repository, personalRequestForWait } from "../personal-agent/request-repository.js";
7
7
  import { getConnectorAccount, init_connector_account_repository } from "../storage/sqlite/connector-account-repository.js";
8
8
  import { getConnectorConnection, getConnectorInstallation, init_connector_repository, listConnectorConnections, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
9
- import { cancelConnectionObjective, getActiveConnectionWait, getConnectionWait, init_connection_wait_repository, listConnectionWaitsToCheck, publishConnectionWait, queueConnectionResolution, updateConnectionWait } from "../storage/sqlite/connection-wait-repository.js";
9
+ import { cancelConnectionObjective, getActiveConnectionWait, getConnectionWait, hasPendingConnectionMessages, init_connection_wait_repository, interruptedConnectionMessage, listConnectionWaitsToCheck, publishConnectionWait, queueConnectionResolution, reconcileConnectionWaits, updateConnectionWait } from "../storage/sqlite/connection-wait-repository.js";
10
10
  import { init_session_repository } from "../storage/sqlite/session-repository.js";
11
11
  import { canAccessConnectorAccount, currentAccountConnections } from "./account-access.js";
12
12
  import { getCliAdapter } from "./cli/adapterRegistry.js";
@@ -46,6 +46,7 @@ function isConnectorNeed(need) {
46
46
  /** Authorization lives at click time. Chat history contains only immutable explanations. */
47
47
  var ConnectionRecoveryService = class {
48
48
  busy = /* @__PURE__ */ new Set();
49
+ checks = /* @__PURE__ */ new Map();
49
50
  timer;
50
51
  deliveryTimer;
51
52
  polling = false;
@@ -67,6 +68,7 @@ var ConnectionRecoveryService = class {
67
68
  this.timer = void 0;
68
69
  clearInterval(this.deliveryTimer);
69
70
  this.deliveryTimer = void 0;
71
+ for (const controller of this.checks.values()) controller.abort(/* @__PURE__ */ new Error("Connection check stopped"));
70
72
  }
71
73
  async poll() {
72
74
  if (this.polling) return;
@@ -74,8 +76,9 @@ var ConnectionRecoveryService = class {
74
76
  try {
75
77
  drainPersonalRequestContinuations(this.deps.onPersonalRequestDelivered);
76
78
  drainPersonalRequestResults(this.deps.onPersonalRequestDelivered);
79
+ for (const conversationId of reconcileConnectionWaits()) this.deps.drain(conversationId);
77
80
  for (const wait of listConnectionWaitsToCheck()) {
78
- if (this.busy.has(wait.conversationId)) continue;
81
+ if (this.busy.has(wait.conversationId) || interruptedConnectionMessage(wait)) continue;
79
82
  await this.act(wait.conversationId, {
80
83
  waitId: wait.id,
81
84
  expectedTranscriptId: wait.transcriptId,
@@ -94,6 +97,84 @@ var ConnectionRecoveryService = class {
94
97
  get adapter() {
95
98
  return this.deps.adapter ?? new ComposioSessionsAdapter();
96
99
  }
100
+ cancelObjective(target) {
101
+ const wait = getConnectionWait(target.id);
102
+ if (!wait || wait.objectiveRevision !== target.objectiveRevision || wait.resolution !== "cancelled") return;
103
+ this.checks.get(wait.id)?.abort(/* @__PURE__ */ new Error("Connection objective cancelled"));
104
+ const request = personalRequestForWait(wait.id);
105
+ if (request) cancelPersonalRequest(request);
106
+ }
107
+ async continueObjective(target, idempotencyKey) {
108
+ const wait = getConnectionWait(target.id);
109
+ if (!wait || wait.status === "closed" || wait.objectiveRevision !== target.objectiveRevision || wait.transcriptId !== target.transcriptId) return;
110
+ if (wait.status === "queued") {
111
+ if (!wait.intent || wait.intent.validUntil <= Date.now() || wait.reviewRequired) {
112
+ updateConnectionWait({
113
+ ...wait,
114
+ reviewRequired: false,
115
+ scopeConfirmedAt: Date.now(),
116
+ intent: {
117
+ objectiveRevision: wait.objectiveRevision,
118
+ validUntil: Date.now() + INTENT_TTL
119
+ }
120
+ }, wait.version);
121
+ publishConnectionWait(wait.conversationId);
122
+ }
123
+ return;
124
+ }
125
+ if (wait.checking) {
126
+ updateConnectionWait({
127
+ ...wait,
128
+ checking: void 0,
129
+ reviewRequired: false,
130
+ scopeConfirmedAt: Date.now(),
131
+ intent: {
132
+ objectiveRevision: wait.objectiveRevision,
133
+ validUntil: Date.now() + INTENT_TTL
134
+ }
135
+ }, wait.version);
136
+ publishConnectionWait(wait.conversationId);
137
+ return;
138
+ }
139
+ await this.act(wait.conversationId, {
140
+ waitId: wait.id,
141
+ expectedTranscriptId: wait.transcriptId,
142
+ expectedVersion: wait.version,
143
+ idempotencyKey,
144
+ action: "confirm_scope"
145
+ });
146
+ }
147
+ markChecking(wait, phase) {
148
+ const next = updateConnectionWait({
149
+ ...wait,
150
+ checking: {
151
+ phase,
152
+ startedAt: Date.now()
153
+ },
154
+ recoveryError: void 0
155
+ }, wait.version);
156
+ publishConnectionWait(wait.conversationId);
157
+ return next;
158
+ }
159
+ /** Readiness checks never execute the objective; late results cannot advance a newer wait. */
160
+ async boundedCheck(waitId, operation) {
161
+ const controller = new AbortController();
162
+ this.checks.set(waitId, controller);
163
+ const timeout = setTimeout(() => controller.abort(/* @__PURE__ */ new Error("Connection check timed out. The objective is preserved.")), this.deps.checkTimeoutMs ?? 3e4);
164
+ timeout.unref();
165
+ let onAbort = () => {};
166
+ try {
167
+ return await Promise.race([operation(), new Promise((_resolve, reject) => {
168
+ onAbort = () => reject(controller.signal.reason);
169
+ controller.signal.addEventListener("abort", onAbort, { once: true });
170
+ if (controller.signal.aborted) onAbort();
171
+ })]);
172
+ } finally {
173
+ clearTimeout(timeout);
174
+ controller.signal.removeEventListener("abort", onAbort);
175
+ if (this.checks.get(waitId) === controller) this.checks.delete(waitId);
176
+ }
177
+ }
97
178
  snapshot(conversationId) {
98
179
  if (!connectorPrincipalForSession(conversationId).isLocalOwner) throw new Error("This connection belongs to another principal.");
99
180
  const transcriptId = readCurrentTranscriptId(getSqliteDatabase(), conversationId);
@@ -175,7 +256,11 @@ var ConnectionRecoveryService = class {
175
256
  phase,
176
257
  accounts: active.map((connection) => ({
177
258
  id: connection.accountId,
178
- label: [getConnectorAccount(connection.accountId)?.label, connection.identity.email ?? connection.identity.name ?? connection.accountId].filter(Boolean).join(" · ")
259
+ label: [...new Set([
260
+ getConnectorAccount(connection.accountId)?.label,
261
+ connection.identity.workspace,
262
+ connection.identity.email ?? connection.identity.username ?? connection.identity.displayName ?? connection.identity.name ?? connection.accountId
263
+ ].filter(Boolean))].join(" · ")
179
264
  })),
180
265
  ...need.capabilityError && selected ? { reason: need.capabilityError } : {},
181
266
  ...blocked ? { reason: scopeBlocked ? "This action needs broader permissions. Review connector permissions in settings." : "This app is disabled or unavailable to the current agent. Review connector settings." } : {}
@@ -184,11 +269,20 @@ var ConnectionRecoveryService = class {
184
269
  const ready = needs.every((need) => need.phase === "ready");
185
270
  const review = wait.reviewRequired || Date.now() - wait.createdAt > INTENT_TTL && !wait.scopeConfirmedAt;
186
271
  const { intent: _intent, checkpoint: _checkpoint, ...visible } = wait;
272
+ const runtime = getSessionInputState(wait.conversationId);
273
+ const blockedInput = interruptedConnectionMessage(wait);
274
+ const deferred = wait.status === "open" && ready && !review && !wait.checking && !wait.recoveryError && Boolean(wait.intent && wait.intent.validUntil > Date.now()) && hasPendingConnectionMessages(wait);
187
275
  return {
188
276
  ...visible,
189
277
  needs,
190
278
  timeRange: wait.checkpoint.timeRange,
191
- phase: wait.status === "queued" ? "queued" : ready ? review ? "review_scope" : "ready" : "needs_connection"
279
+ phase: wait.status === "queued" || deferred ? "queued" : wait.checking || wait.recoveryError ? "needs_connection" : ready ? review ? "review_scope" : "ready" : "needs_connection",
280
+ recoveryStage: wait.checking ? wait.checking.phase === "connection" ? "checking_connection" : "checking_tools" : wait.status === "queued" || deferred ? "queued" : void 0,
281
+ queueBlocked: deferred || wait.status === "queued" && Boolean(runtime.activeInputId && runtime.activeInputId !== wait.queuedInputId),
282
+ ...blockedInput ? {
283
+ blockedInputId: blockedInput.id,
284
+ queueBlocked: true
285
+ } : {}
192
286
  };
193
287
  }
194
288
  async ensureInstallation(wait, connectorId) {
@@ -300,27 +394,60 @@ var ConnectionRecoveryService = class {
300
394
  }
301
395
  async preflight(input) {
302
396
  if (input.kind !== "connection_resume") return true;
303
- const wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
304
- if (!wait || wait.status !== "queued" || wait.queuedInputId !== input.id || wait.transcriptId !== readCurrentTranscriptId(getSqliteDatabase(), input.conversationId)) return false;
397
+ let wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
398
+ if (!wait || wait.status !== "queued" || wait.queuedInputId !== input.id || wait.objectiveRevision !== input.payload?.objectiveRevision || wait.transcriptId !== readCurrentTranscriptId(getSqliteDatabase(), input.conversationId)) return false;
305
399
  if (wait.resolution === "skipped") return true;
400
+ let checkFailed = false;
401
+ let reviewRequired = false;
306
402
  try {
307
- const fresh = await this.syncConnections(wait);
403
+ wait = this.markChecking(wait, "connection");
404
+ const fresh = await this.boundedCheck(wait.id, () => this.syncConnections(wait));
405
+ if (getConnectionWait(wait.id)?.version !== wait.version) return false;
406
+ wait = this.markChecking(wait, "tools");
308
407
  const verified = new Set(fresh.filter((item) => item.status === "active").map((item) => item.id));
309
408
  wait.needs = wait.needs.map((need) => ({
310
409
  ...need,
311
410
  unavailable: !fresh.some((item) => item.id === need.connectionId && item.status === "active")
312
411
  }));
313
- wait.needs = await this.checkCapabilities(wait, verified);
412
+ wait.needs = await this.boundedCheck(wait.id, () => this.checkCapabilities(wait, verified));
314
413
  const ready = this.view(wait, verified).needs.every((need) => need.phase === "ready");
315
414
  if (getConnectionWait(wait.id)?.version !== wait.version) return false;
316
- if (ready && wait.intent && wait.intent.validUntil > Date.now() && wait.intent.objectiveRevision === wait.objectiveRevision) return true;
317
- } catch {}
415
+ if (hasPendingConnectionMessages(wait, true)) {
416
+ updateConnectionWait({
417
+ ...wait,
418
+ checking: void 0,
419
+ lastCheckedAt: Date.now()
420
+ }, wait.version);
421
+ return true;
422
+ }
423
+ if (ready && wait.intent && wait.intent.validUntil > Date.now() && wait.intent.objectiveRevision === wait.objectiveRevision) {
424
+ updateConnectionWait({
425
+ ...wait,
426
+ checking: void 0,
427
+ lastCheckedAt: Date.now()
428
+ }, wait.version);
429
+ return true;
430
+ }
431
+ reviewRequired = ready;
432
+ } catch (err) {
433
+ checkFailed = true;
434
+ if (getConnectionWait(wait.id)?.version === wait.version) log.warn({
435
+ err,
436
+ conversationId: input.conversationId,
437
+ waitId: wait.id,
438
+ phase: "resume_preflight"
439
+ }, "Connection recovery check failed; objective preserved");
440
+ }
318
441
  if (getConnectionWait(wait.id)?.version === wait.version) {
319
442
  updateConnectionWait({
320
443
  ...wait,
321
444
  status: "open",
322
445
  intent: void 0,
323
446
  queuedInputId: void 0,
447
+ checking: void 0,
448
+ lastCheckedAt: Date.now(),
449
+ recoveryError: checkFailed ? "check_failed" : void 0,
450
+ reviewRequired: reviewRequired || wait.reviewRequired,
324
451
  objectiveRevision: wait.objectiveRevision + 1
325
452
  }, wait.version);
326
453
  publishConnectionWait(input.conversationId);
@@ -339,8 +466,9 @@ var ConnectionRecoveryService = class {
339
466
  const snapshot = this.snapshot(conversationId);
340
467
  let wait = getConnectionWait(action.waitId);
341
468
  if (!wait || wait.conversationId !== conversationId || wait.principalId !== "local-owner" || wait.transcriptId !== action.expectedTranscriptId || snapshot.transcriptId !== action.expectedTranscriptId) throw new Error("SESSION_CHANGED");
342
- if (wait.lastAction?.key === action.idempotencyKey && wait.lastAction.action === action.action) return { snapshot };
343
- if (wait.status !== "open" || wait.version !== action.expectedVersion) throw new Error("WAIT_CHANGED");
469
+ if ((wait.status !== "open" || !wait.checking) && wait.lastAction?.key === action.idempotencyKey && wait.lastAction.action === action.action) return { snapshot };
470
+ const matchesTarget = action.action === "cancel" && action.expectedObjectiveRevision !== void 0 ? wait.objectiveRevision === action.expectedObjectiveRevision : wait.version === action.expectedVersion;
471
+ if (wait.status !== "open" && !(action.action === "cancel" && wait.status === "queued") || !matchesTarget) throw new Error("WAIT_CHANGED");
344
472
  wait = {
345
473
  ...wait,
346
474
  lastAction: {
@@ -349,9 +477,14 @@ var ConnectionRecoveryService = class {
349
477
  }
350
478
  };
351
479
  if (action.action === "cancel") {
352
- const request = personalRequestForWait(wait.id);
353
- if (request) cancelPersonalRequest(request);
354
- else cancelConnectionObjective(conversationId);
480
+ const cancelled = wait;
481
+ runSqliteWriteTransaction(() => {
482
+ updateConnectionWait(cancelled, cancelled.version);
483
+ const request = personalRequestForWait(cancelled.id);
484
+ if (request) cancelPersonalRequest(request);
485
+ else cancelConnectionObjective(conversationId);
486
+ });
487
+ this.checks.get(wait.id)?.abort(/* @__PURE__ */ new Error("Connection objective cancelled"));
355
488
  } else if (action.action === "replace_source") {
356
489
  const need = wait.needs.find((need) => need.key === action.needKey);
357
490
  if (!need || !this.view(wait).needs.find((item) => item.key === need.key)?.alternatives?.some((item) => item.candidateRef === action.candidateRef)) throw new Error("Unsupported replacement.");
@@ -394,6 +527,8 @@ var ConnectionRecoveryService = class {
394
527
  unavailable: false,
395
528
  capabilityError: void 0
396
529
  } : item),
530
+ checking: void 0,
531
+ recoveryError: void 0,
397
532
  intent: {
398
533
  objectiveRevision: wait.objectiveRevision,
399
534
  validUntil: Date.now() + INTENT_TTL
@@ -487,16 +622,36 @@ var ConnectionRecoveryService = class {
487
622
  authorizationUrl: auth.connectUrl
488
623
  };
489
624
  } else {
490
- const fresh = await this.syncConnections(wait);
625
+ if (action.action === "select_account") {
626
+ const need = this.view(wait).needs.find((item) => item.key === action.needKey);
627
+ const connection = need?.target.type === "connector" ? currentAccountConnections(listConnectorConnections({
628
+ principalId: wait.principalId,
629
+ connectorId: need.target.connectorId
630
+ })).find((item) => item.accountId === action.accountId) : void 0;
631
+ if (!connection || !need?.accounts.some((item) => item.id === connection.accountId)) throw new Error("Account is unavailable.");
632
+ wait = {
633
+ ...wait,
634
+ needs: wait.needs.map((item) => item.key === need.key ? {
635
+ ...item,
636
+ accountId: connection.accountId,
637
+ connectionId: connection.id,
638
+ attempt: void 0
639
+ } : item),
640
+ intent: {
641
+ objectiveRevision: wait.objectiveRevision,
642
+ validUntil: Date.now() + INTENT_TTL
643
+ }
644
+ };
645
+ }
646
+ wait = this.markChecking(wait, "connection");
647
+ const fresh = await this.boundedCheck(wait.id, () => this.syncConnections(wait));
491
648
  const verified = new Set(fresh.filter((item) => item.status === "active").map((item) => item.id));
492
649
  const latest = getConnectionWait(wait.id);
493
650
  if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
651
+ const currentNeeds = this.view(wait).needs;
494
652
  let needs = wait.needs.map((need) => {
495
653
  if (need.target.type === "store-connector") {
496
- const selected = this.view({
497
- ...wait,
498
- needs
499
- }).needs.find((item) => item.key === need.key);
654
+ const selected = currentNeeds.find((item) => item.key === need.key);
500
655
  return selected?.phase === "ready" ? {
501
656
  ...need,
502
657
  connectionId: selected.connectionId,
@@ -537,23 +692,33 @@ var ConnectionRecoveryService = class {
537
692
  ...wait,
538
693
  needs
539
694
  }, verified).needs) if (selected.target.type === "connector" && (selected.phase === "ready" || selected.capabilityError && selected.connectionId)) await this.ensureInstallation(wait, selected.target.connectorId);
540
- needs = await this.checkCapabilities({
695
+ wait = this.markChecking({
541
696
  ...wait,
542
697
  needs
543
- }, verified);
544
- if (getConnectionWait(wait.id)?.version !== wait.version) throw new Error("WAIT_CHANGED");
545
- const readyWithoutReview = this.view({
698
+ }, "tools");
699
+ needs = await this.boundedCheck(wait.id, () => this.checkCapabilities({
546
700
  ...wait,
547
701
  needs
548
- }, verified).phase === "ready";
702
+ }, verified));
703
+ if (getConnectionWait(wait.id)?.version !== wait.version) throw new Error("WAIT_CHANGED");
704
+ const readinessPhase = this.view({
705
+ ...wait,
706
+ needs,
707
+ checking: void 0,
708
+ recoveryError: void 0
709
+ }, verified).phase;
710
+ const readyWithoutReview = readinessPhase === "ready";
549
711
  wait = updateConnectionWait({
550
712
  ...wait,
551
713
  needs,
714
+ checking: void 0,
715
+ lastCheckedAt: Date.now(),
716
+ recoveryError: void 0,
552
717
  ...action.action === "confirm_scope" ? {
553
718
  scopeConfirmedAt: Date.now(),
554
719
  reviewRequired: false
555
720
  } : {},
556
- ...needs.some((need) => need.capabilityError) ? { intent: void 0 } : readyWithoutReview || action.action === "confirm_scope" ? { intent: {
721
+ ...needs.some((need) => need.capabilityError) || readinessPhase === "review_scope" && action.action !== "confirm_scope" ? { intent: void 0 } : readyWithoutReview || action.action === "confirm_scope" ? { intent: {
557
722
  objectiveRevision: wait.objectiveRevision,
558
723
  validUntil: Date.now() + INTENT_TTL
559
724
  } } : {}
@@ -578,14 +743,29 @@ var ConnectionRecoveryService = class {
578
743
  return { snapshot: this.snapshot(conversationId) };
579
744
  } catch (error) {
580
745
  const wait = getActiveConnectionWait(conversationId);
581
- if (action.action === "connect" && wait?.status === "open" && wait.lastAction?.key === action.idempotencyKey) {
746
+ if (ownsLock && wait?.status === "open" && wait.lastAction?.key === action.idempotencyKey) {
747
+ if (wait.checking) log.warn({
748
+ err: error,
749
+ conversationId,
750
+ waitId: wait.id,
751
+ phase: wait.checking.phase
752
+ }, "Connection check failed; objective preserved");
582
753
  updateConnectionWait({
583
754
  ...wait,
584
- intent: void 0,
585
- needs: wait.needs.map((need) => need.key === action.needKey ? {
586
- ...need,
587
- attempt: void 0
588
- } : need)
755
+ lastAction: void 0,
756
+ ...wait.checking ? {
757
+ checking: void 0,
758
+ lastCheckedAt: Date.now(),
759
+ recoveryError: "check_failed",
760
+ intent: void 0
761
+ } : {},
762
+ ...action.action === "connect" ? {
763
+ intent: void 0,
764
+ needs: wait.needs.map((need) => need.key === action.needKey ? {
765
+ ...need,
766
+ attempt: void 0
767
+ } : need)
768
+ } : {}
589
769
  }, wait.version);
590
770
  publishConnectionWait(conversationId);
591
771
  }
@@ -1,7 +1,7 @@
1
1
  export declare function meetingActionTasks(id: string): {
2
2
  actionId: string;
3
3
  taskId: string;
4
- phase: "backlog" | "ready" | "active" | "review" | "closed";
4
+ phase: "review" | "backlog" | "ready" | "active" | "closed";
5
5
  resolution: "cancelled" | "done" | "duplicate" | "wont_do";
6
6
  deleted: boolean;
7
7
  }[];
@@ -10,7 +10,7 @@ export declare function convertMeetingAction(id: string, actionId: string, organ
10
10
  existing: boolean;
11
11
  actionId: string;
12
12
  taskId: string;
13
- phase: "backlog" | "ready" | "active" | "review" | "closed";
13
+ phase: "review" | "backlog" | "ready" | "active" | "closed";
14
14
  resolution: "cancelled" | "done" | "duplicate" | "wont_do";
15
15
  deleted: boolean;
16
16
  } | {
@@ -7,8 +7,8 @@ import { DEFAULT_SECURITY_CONFIG, checkExtensionDirSafety, checkExtensionPathSaf
7
7
  import { SlotRegistry, getSlotRegistry, registerSlotType } from "../slots.js";
8
8
  import { ExtensionDiagnostics, ExtensionLoaderCacheImpl, getExtensionCache, getExtensionDiagnostics } from "../diagnostics.js";
9
9
  import { ExtensionHookRunner, createHookContext, isHookEvent } from "../hooks.js";
10
- import { registerExtensionCliProgram } from "./channel-helpers.js";
11
10
  import { defineChannelPluginEntry } from "./channel-entry.js";
11
+ import { registerExtensionCliProgram } from "./channel-helpers.js";
12
12
  import { lazyFunction, lazyModule } from "./lazy.js";
13
13
  import { createMockExtensionApi, createTestGateway } from "./testing.js";
14
14
  //#region src/extensions/sdk/index.ts
@@ -277,4 +277,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
277
277
  readonly zh: "使用已验证的参数执行选定的外部工具。";
278
278
  };
279
279
  }];
280
- export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "xopc_tool_execute" | "web_extract" | "read_media" | "xopc_tool_search" | "xopc_tool_describe" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "computer_use" | "send_message" | "text_to_speech" | "send_media" | "create_share" | "session_status" | "memory_maintenance" | "tool_manual" | "delegate_task" | "skill_install" | "execute_code" | "create_desktop_pet")[];
280
+ export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "xopc_tool_execute" | "web_extract" | "tool_manual" | "session_status" | "read_media" | "xopc_tool_search" | "xopc_tool_describe" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "computer_use" | "send_message" | "text_to_speech" | "send_media" | "create_share" | "memory_maintenance" | "delegate_task" | "skill_install" | "execute_code" | "create_desktop_pet")[];
@@ -4,6 +4,7 @@ const actionSchema = z.object({
4
4
  waitId: z.string().min(1),
5
5
  expectedTranscriptId: z.string().min(1),
6
6
  expectedVersion: z.number().int().positive(),
7
+ expectedObjectiveRevision: z.number().int().positive().optional(),
7
8
  idempotencyKey: z.string().min(1).max(200),
8
9
  action: z.enum([
9
10
  "install_complete",
@@ -17,7 +18,8 @@ const actionSchema = z.object({
17
18
  ]),
18
19
  candidateRef: z.string().optional(),
19
20
  needKey: z.string().optional(),
20
- accountId: z.string().optional()
21
+ accountId: z.string().optional(),
22
+ instanceId: z.string().optional()
21
23
  }).strict();
22
24
  function registerConnectionWaitRoutes(app, { service, strictRateLimitMiddleware }) {
23
25
  app.get("/api/sessions/:conversationId/connection-wait", (c) => {
@@ -20,9 +20,9 @@ import { resolveProjectAgentId } from "../../../projects/project-agent.js";
20
20
  import { inferSuggestedProjectDefaultAgentId } from "../../../projects/project-agent-suggestion.js";
21
21
  import { buildProjectLoopOverview } from "../../../projects/project-loop.js";
22
22
  import "../../../projects/index.js";
23
+ import { defineTaskContract } from "../../../tasks/task-contract-definition.js";
23
24
  import { TaskApplicationService } from "../../../tasks/task-application-service.js";
24
25
  import { createProductDispatcher } from "../../../capabilities/runtime/product.js";
25
- import { defineTaskContract } from "../../../tasks/task-contract-definition.js";
26
26
  import { ProjectOperatingViewService, summarizeProjectOperatingView } from "../../../tasks/project-operating-view-service.js";
27
27
  import "../../../tasks/index.js";
28
28
  import { parseActivityIncludeRelated, parseActivityQuery } from "./activity.js";
@@ -57,6 +57,14 @@ export declare function submitSessionInput(c: Context, deps: AuthenticatedRouteD
57
57
  waitId: string;
58
58
  objectiveRevision: number;
59
59
  resolution: "answered" | "agent_decide" | "cancelled";
60
+ } | {
61
+ waitId: string;
62
+ objectiveRevision: number;
63
+ connectionAction: "continue" | "cancel";
64
+ } | {
65
+ waitId: string;
66
+ objectiveRevision: number;
67
+ connectionBarrier: true;
60
68
  };
61
69
  attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
62
70
  contextRefs?: {
@@ -208,6 +216,14 @@ export declare function replaceLatestSessionTurn(c: Context, deps: Authenticated
208
216
  waitId: string;
209
217
  objectiveRevision: number;
210
218
  resolution: "answered" | "agent_decide" | "cancelled";
219
+ } | {
220
+ waitId: string;
221
+ objectiveRevision: number;
222
+ connectionAction: "continue" | "cancel";
223
+ } | {
224
+ waitId: string;
225
+ objectiveRevision: number;
226
+ connectionBarrier: true;
211
227
  };
212
228
  attachments?: import("hono/dist/types/utils/types.js").JSONValue[];
213
229
  contextRefs?: {
@@ -9,10 +9,10 @@ import { TaskRunRepository, init_task_run_repository } from "../../../tasks/task
9
9
  import { CapabilityError } from "../../../capabilities/runtime/errors.js";
10
10
  import "../../../capabilities/runtime/dispatcher.js";
11
11
  import { TaskConversationRepository } from "../../../tasks/task-conversation-repository.js";
12
+ import { TaskCollaborationRepository } from "../../../tasks/task-collaboration-repository.js";
12
13
  import { TaskCriterionReviewRepository } from "../../../tasks/task-criterion-review-repository.js";
13
14
  import { TaskContextMutationOutputSchema } from "../../../tasks/capabilities/relations.js";
14
15
  import { TaskDeleteOutputSchema } from "../../../tasks/capabilities/management.js";
15
- import { TaskCollaborationRepository } from "../../../tasks/task-collaboration-repository.js";
16
16
  import { TaskMutationOutputSchema } from "../../../tasks/capabilities/write.js";
17
17
  import { createProductDispatcher } from "../../../capabilities/runtime/product.js";
18
18
  import { ProjectOperatingViewService } from "../../../tasks/project-operating-view-service.js";