@xopcai/xopc 0.0.427 → 0.0.428

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 (265) 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/{activity-store-D_DXNHba.js → activity-store-WqnVruhY.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CjaQxFQt.js → agent-avatar-dicebear-CSiO9c2F.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-display-6Z4m31Fz.js → agent-avatar-display-D-yds6wG.js} +2 -2
  6. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-D4ClP_DJ.js → agent-defaults-settings-panel-_UT9C7bg.js} +1 -1
  7. package/dist/gateway/static/root/assets/agent-plugin-dialog-DVzYXsAy.js +1 -0
  8. package/dist/gateway/static/root/assets/{agents-admin-api-u5c3GREg.js → agents-admin-api-Bgv4lJ9Y.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agents-B9slUA_1.js → agents-yTsbcxRi.js} +3 -3
  10. package/dist/gateway/static/root/assets/{api-C3Tp9MkF.js → api-C-9J9ghT.js} +1 -1
  11. package/dist/gateway/static/root/assets/{api-CRT9ZyH0.js → api-Dv6Cn-Rs.js} +1 -1
  12. package/dist/gateway/static/root/assets/{app-management-settings-panel-XqoIBF2H.js → app-management-settings-panel-BXJrrjH5.js} +1 -1
  13. package/dist/gateway/static/root/assets/{appearance-settings-9ZtqCASo.js → appearance-settings-oYjAVulT.js} +1 -1
  14. package/dist/gateway/static/root/assets/{apps-page-DUeu_7iC.js → apps-page-D95yzj-f.js} +1 -1
  15. package/dist/gateway/static/root/assets/{archive-plugin-BCQnOkV8.js → archive-plugin-DBPu3xCJ.js} +1 -1
  16. package/dist/gateway/static/root/assets/automation-api-DAou8Kji.js +1 -0
  17. package/dist/gateway/static/root/assets/{automation-result-state-CMfVTv_i.js → automation-result-state-CA7LV098.js} +1 -1
  18. package/dist/gateway/static/root/assets/automation-task-card-w6cKxfaP.js +3 -0
  19. package/dist/gateway/static/root/assets/{automations-page-DMIyWsP0.js → automations-page-D4LyOLzY.js} +1 -1
  20. package/dist/gateway/static/root/assets/automations-workspace-BGyvZZj5.js +9 -0
  21. package/dist/gateway/static/root/assets/{binary-plugins-CIB5cbvQ.js → binary-plugins-D25P9ZxQ.js} +1 -1
  22. package/dist/gateway/static/root/assets/{block-editor-CXdlNAmZ.js → block-editor-BI105p1U.js} +1 -1
  23. package/dist/gateway/static/root/assets/{browser-automation-inputs-Fxo7HbK6.js → browser-automation-inputs-DhDRvWQE.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-automations-page-Dn3LN5wo.js → browser-automations-page-CCPi1Bvy.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-control-api-CbbPvhHR.js → browser-control-api-BN4F-bM1.js} +1 -1
  26. package/dist/gateway/static/root/assets/{browser-settings-page-Cpm9fEPV.js → browser-settings-page-BZXUZpjp.js} +1 -1
  27. package/dist/gateway/static/root/assets/{capabilities-BEvywfF9.js → capabilities-LC-yEQYo.js} +1 -1
  28. package/dist/gateway/static/root/assets/{capabilities-page-BCzsIzvC.js → capabilities-page-DHJLl4RD.js} +2 -2
  29. package/dist/gateway/static/root/assets/capabilities-settings-panel-FJ3Vo7Wa.js +8 -0
  30. package/dist/gateway/static/root/assets/capabilities-u2z_KFRt.js +1 -0
  31. package/dist/gateway/static/root/assets/{channels-CA5z5dGY.js → channels-9Uaa-IN0.js} +1 -1
  32. package/dist/gateway/static/root/assets/{chat-agents-api-D8YS5amE.js → chat-agents-api-Cffxfzi1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{chat-chart-block-B39npsXj.js → chat-chart-block-Bbk0b3TV.js} +1 -1
  34. package/dist/gateway/static/root/assets/chat-page--dKUIg5W.js +72 -0
  35. package/dist/gateway/static/root/assets/{chat-terminal-dock-DjFnElAM.js → chat-terminal-dock-CQMuG-Bz.js} +1 -1
  36. package/dist/gateway/static/root/assets/{command-palette-api-Dijix7V6.js → command-palette-api-BRxfFgGA.js} +1 -1
  37. package/dist/gateway/static/root/assets/composer-payload-handoff-_9L2A5AZ.js +1 -0
  38. package/dist/gateway/static/root/assets/{computer-settings-page-MkqyKyf3.js → computer-settings-page-Bm70SIjD.js} +1 -1
  39. package/dist/gateway/static/root/assets/{connected-providers-grid-BSvKP2u-.js → connected-providers-grid-B7ktDgqt.js} +1 -1
  40. package/dist/gateway/static/root/assets/{connector-service-page-DlIl9bLx.js → connector-service-page-BVMEg8n-.js} +1 -1
  41. package/dist/gateway/static/root/assets/{connectors-api-DEJU8mgn.js → connectors-api-B07yoCzk.js} +1 -1
  42. package/dist/gateway/static/root/assets/connectors-page-hPKaJUWY.js +1 -0
  43. package/dist/gateway/static/root/assets/{date-picker-BIfjfOTM.js → date-picker-BvEnSGZK.js} +1 -1
  44. package/dist/gateway/static/root/assets/{desktop-pet-DFNehTtd.js → desktop-pet-C1z9YDEg.js} +1 -1
  45. package/dist/gateway/static/root/assets/{desktop-pet-settings-BDjsFown.js → desktop-pet-settings-CbbVb8GY.js} +1 -1
  46. package/dist/gateway/static/root/assets/{dev-view-store-CeZZLOc6.js → dev-view-store-38EmUIEC.js} +1 -1
  47. package/dist/gateway/static/root/assets/{device-pairing-wizard-DH_uJ698.js → device-pairing-wizard-Wb1EKiXA.js} +1 -1
  48. package/dist/gateway/static/root/assets/{directory-picker-path-field-DiZXY7jF.js → directory-picker-path-field-BvKDrKc4.js} +1 -1
  49. package/dist/gateway/static/root/assets/{discussion-annotation-sync-BXqNuZnx.js → discussion-annotation-sync-BfVzIwe2.js} +1 -1
  50. package/dist/gateway/static/root/assets/{extension-debug-page-myQqsol2.js → extension-debug-page-CB9Lu3Sq.js} +1 -1
  51. package/dist/gateway/static/root/assets/{extension-iframe-host-DaL-OcTw.js → extension-iframe-host-BzjrVAUR.js} +1 -1
  52. package/dist/gateway/static/root/assets/{extension-marketplace-api-DRBszrCR.js → extension-marketplace-api-DigziAgd.js} +1 -1
  53. package/dist/gateway/static/root/assets/{extension-page-DvlGhZLa.js → extension-page-DUa9MeaZ.js} +1 -1
  54. package/dist/gateway/static/root/assets/{extension-provider-fOi6V6Cr.js → extension-provider-301x0rh-.js} +1 -1
  55. package/dist/gateway/static/root/assets/{extension-settings-page-DOGlQpkx.js → extension-settings-page-CP9ciZUI.js} +1 -1
  56. package/dist/gateway/static/root/assets/{file-preview-surface-DfkXvFnc.js → file-preview-surface-BaMGmCbw.js} +1 -1
  57. package/dist/gateway/static/root/assets/{gateway-config-swr-BOCt_zOo.js → gateway-config-swr-BD4Bf8uu.js} +1 -1
  58. package/dist/gateway/static/root/assets/{gateway-realtime-BL_Cf0OQ.js → gateway-realtime-CSd9VB7Z.js} +1 -1
  59. package/dist/gateway/static/root/assets/gateway-realtime-store-Bxkv62qs.js +1 -0
  60. package/dist/gateway/static/root/assets/{gateway-restart-CHf8qY7H.js → gateway-restart-CIUCTKYR.js} +1 -1
  61. package/dist/gateway/static/root/assets/{gateway-settings-Di41peSM.js → gateway-settings-CCqF1uZv.js} +1 -1
  62. package/dist/gateway/static/root/assets/{gateway-startup-retry-CvkJYurV.js → gateway-startup-retry-BsU5k8oi.js} +1 -1
  63. package/dist/gateway/static/root/assets/{global-defaults-api-BWMbKu72.js → global-defaults-api-asOZQeM8.js} +1 -1
  64. package/dist/gateway/static/root/assets/home-page-Bb_RC1O9.js +2 -0
  65. package/dist/gateway/static/root/assets/{image-generation-api-Ce-IY7Ug.js → image-generation-api-BbEnKsK1.js} +1 -1
  66. package/dist/gateway/static/root/assets/{imports-page-W7_cDbxy.js → imports-page-CVnoGUyp.js} +1 -1
  67. package/dist/gateway/static/root/assets/index-ClPeYgQk.js +11 -0
  68. package/dist/gateway/static/root/assets/index-Cz-VjTNd.css +1 -0
  69. package/dist/gateway/static/root/assets/{install-connector-dialog-DWVl9ekV.js → install-connector-dialog-DXVOHMhS.js} +1 -1
  70. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Doyu0Q9e.js → keyboard-shortcuts-settings-BCl90SrD.js} +1 -1
  71. package/dist/gateway/static/root/assets/{local-app-workbench-page-B3h3P6aI.js → local-app-workbench-page-CcJc9xLJ.js} +1 -1
  72. package/dist/gateway/static/root/assets/{local-apps-page-D6D2bZGW.js → local-apps-page-CdAKoWfg.js} +1 -1
  73. package/dist/gateway/static/root/assets/{local-session-drafts-BJ1B1dQ7.js → local-session-drafts-nRGeybku.js} +1 -1
  74. package/dist/gateway/static/root/assets/{locale-store-Br7IfbXK.js → locale-store-B7y-RVe8.js} +1 -1
  75. package/dist/gateway/static/root/assets/{logs-page-qiXos_12.js → logs-page-McbSQwJI.js} +1 -1
  76. package/dist/gateway/static/root/assets/{management-settings-C0WcSdK7.js → management-settings-BIR0BwNV.js} +1 -1
  77. package/dist/gateway/static/root/assets/{markdown-view-Ck5s16p9.js → markdown-view-DFHa8rUg.js} +1 -1
  78. package/dist/gateway/static/root/assets/mcp-conversation-setup-page-Dwx4TuIr.js +1 -0
  79. package/dist/gateway/static/root/assets/{media-plugins-Ba6vUE4J.js → media-plugins-BzzLV7wW.js} +1 -1
  80. package/dist/gateway/static/root/assets/messages-DYDkJvXj.js +3 -0
  81. package/dist/gateway/static/root/assets/{model-selector-DCBmsHzj.js → model-selector-DJSVr3LM.js} +1 -1
  82. package/dist/gateway/static/root/assets/{models-hub-cache-Bd-fYUrV.js → models-hub-cache-BUapaPTN.js} +1 -1
  83. package/dist/gateway/static/root/assets/new-chat-navigation-B6NPQ4h4.js +1 -0
  84. package/dist/gateway/static/root/assets/{note-detail-panel-CnuxqWMd.js → note-detail-panel-CJ-dPovd.js} +3 -3
  85. package/dist/gateway/static/root/assets/note-image-lightbox-ClPkeHe5.js +1 -0
  86. package/dist/gateway/static/root/assets/{notes-api-8kp0X1x6.js → notes-api-ulup1oFS.js} +1 -1
  87. package/dist/gateway/static/root/assets/{notes-page-XMdy-H3H.js → notes-page-BaFNplIr.js} +1 -1
  88. package/dist/gateway/static/root/assets/{oauth-api-DMMdeaNd.js → oauth-api-DINa08-z.js} +1 -1
  89. package/dist/gateway/static/root/assets/{oauth-provider-connect-CfOK8mPM.js → oauth-provider-connect-C0PVEHC2.js} +1 -1
  90. package/dist/gateway/static/root/assets/{page-context-capture-button-CKlKWSJ7.js → page-context-capture-button-CGfR0dsc.js} +1 -1
  91. package/dist/gateway/static/root/assets/{page-context-draft-LF33STHC.js → page-context-draft-DhRNxc0v.js} +1 -1
  92. package/dist/gateway/static/root/assets/page-header-store-CoKMiYoi.js +1 -0
  93. package/dist/gateway/static/root/assets/{personal-avatar-D6CzIIfo.js → personal-avatar-DiVFO2Aw.js} +1 -1
  94. package/dist/gateway/static/root/assets/{personal-page-CIMMSI25.js → personal-page-CiKdXLeR.js} +1 -1
  95. package/dist/gateway/static/root/assets/{personal-settings-panel-wKdlrfPq.js → personal-settings-panel-Ds4ntiqu.js} +1 -1
  96. package/dist/gateway/static/root/assets/{phone-dependencies-card-CDhk5277.js → phone-dependencies-card-B3R6L5Qu.js} +1 -1
  97. package/dist/gateway/static/root/assets/{phone-model-connection-DZ-ZunPz.js → phone-model-connection-ucX3Tvl8.js} +1 -1
  98. package/dist/gateway/static/root/assets/{phone-model-picker-DuZc5jYO.js → phone-model-picker-CU37sziM.js} +1 -1
  99. package/dist/gateway/static/root/assets/{phone-settings-page-0u0GQl_R.js → phone-settings-page-BSdB2pnW.js} +1 -1
  100. package/dist/gateway/static/root/assets/{phone-workspace-store-SN7hfddU.js → phone-workspace-store-Cmes9gQ4.js} +1 -1
  101. package/dist/gateway/static/root/assets/{plugin-details-dialog-Bfc-Wmrd.js → plugin-details-dialog-DblFhnuC.js} +1 -1
  102. package/dist/gateway/static/root/assets/{preference-select-fields-BKeHZLXZ.js → preference-select-fields-D2-QfMN5.js} +1 -1
  103. package/dist/gateway/static/root/assets/{product-automation-feedback-BPur0vyo.js → product-automation-feedback-BzY3z8zu.js} +1 -1
  104. package/dist/gateway/static/root/assets/{product-open-page-Bfd7R483.js → product-open-page-BKw6H0Mn.js} +1 -1
  105. package/dist/gateway/static/root/assets/{product-preview-content-Bnq68oVw.js → product-preview-content-CNaJb6Bj.js} +1 -1
  106. package/dist/gateway/static/root/assets/{product-preview-modal-BPmTeweh.js → product-preview-modal-DgwrrpqJ.js} +2 -2
  107. package/dist/gateway/static/root/assets/project-detail-page-FReFYUv0.js +7 -0
  108. package/dist/gateway/static/root/assets/{project-understanding-DLvxAoTT.js → project-understanding-CrSkrJnM.js} +1 -1
  109. package/dist/gateway/static/root/assets/{projects-page-BGy1pw9a.js → projects-page-Cp91_KzA.js} +1 -1
  110. package/dist/gateway/static/root/assets/{providers-api-DOnNfkwQ.js → providers-api-CBSC3jdu.js} +1 -1
  111. package/dist/gateway/static/root/assets/{recording-upload-CHFJbqW1.js → recording-upload-DBHAGKZj.js} +1 -1
  112. package/dist/gateway/static/root/assets/{registry-api-DFDvOTg4.js → registry-api-QZEjziDq.js} +1 -1
  113. package/dist/gateway/static/root/assets/{remote-access-hub-BVqwnOqO.js → remote-access-hub-BdXxFQfH.js} +1 -1
  114. package/dist/gateway/static/root/assets/{resource-unavailable-TQcRCpAg.js → resource-unavailable-BTNhcOHF.js} +1 -1
  115. package/dist/gateway/static/root/assets/route-preload-DS4fVFbc.js +2 -0
  116. package/dist/gateway/static/root/assets/{runtime-tools-api-9o3Wfji1.js → runtime-tools-api-BDTUD8Rj.js} +1 -1
  117. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-ccVBG-bZ.js → runtime-tools-settings-panel-CYEzIrDf.js} +1 -1
  118. package/dist/gateway/static/root/assets/{service-recommendation-list-CNghOavt.js → service-recommendation-list-CfeYH6lK.js} +1 -1
  119. package/dist/gateway/static/root/assets/{session-api-Bs3r_d2_.js → session-api-DVXLCZX2.js} +1 -1
  120. package/dist/gateway/static/root/assets/{session-manager-Bnq3qpqy.js → session-manager-DjRWxXJG.js} +1 -1
  121. package/dist/gateway/static/root/assets/{sessions-page-CyBj1Xw2.js → sessions-page-C8gwrFHR.js} +1 -1
  122. package/dist/gateway/static/root/assets/settings-advanced-gate-BMHe9uwy.js +1 -0
  123. package/dist/gateway/static/root/assets/{settings-advanced-section-DwpPPxT0.js → settings-advanced-section-BmrbHgQa.js} +1 -1
  124. package/dist/gateway/static/root/assets/{settings-mode-store-CiRpsdTJ.js → settings-mode-store-Bk_hzwPK.js} +1 -1
  125. package/dist/gateway/static/root/assets/{settings-page-Cd8Ermnn.js → settings-page-DCQnHCNN.js} +1 -1
  126. package/dist/gateway/static/root/assets/{settings-page-header-BZl4AMiN.js → settings-page-header-BLKI3_9N.js} +1 -1
  127. package/dist/gateway/static/root/assets/{settings-page-layout-onhEgq-K.js → settings-page-layout-BqBVrkC9.js} +1 -1
  128. package/dist/gateway/static/root/assets/{setup-interaction-page-Cvvj6JyV.js → setup-interaction-page-B9ACeAvO.js} +1 -1
  129. package/dist/gateway/static/root/assets/{setup-status-panel-D4qgE7QM.js → setup-status-panel-DEefuWo3.js} +1 -1
  130. package/dist/gateway/static/root/assets/{share-link-dialog-DA0QuFOD.js → share-link-dialog-C2LyeNzj.js} +1 -1
  131. package/dist/gateway/static/root/assets/{share-preview-page-YDpIY4dC.js → share-preview-page-BFwEr7Ws.js} +1 -1
  132. package/dist/gateway/static/root/assets/{shares-api-D8Q-m46d.js → shares-api-CTFkLQxq.js} +1 -1
  133. package/dist/gateway/static/root/assets/{shares-settings-DUvjOMmA.js → shares-settings-CpK3yhtc.js} +1 -1
  134. package/dist/gateway/static/root/assets/{skill-api-uKU4sRiv.js → skill-api-DpicfA6o.js} +1 -1
  135. package/dist/gateway/static/root/assets/{skill-list-api-BzKzG-xG.js → skill-list-api-B8fegRLZ.js} +1 -1
  136. package/dist/gateway/static/root/assets/{skill-reload-api-DkUXekcd.js → skill-reload-api-VmC8ySUy.js} +1 -1
  137. package/dist/gateway/static/root/assets/{skills-page-ClyNSh-7.js → skills-page-BIWXS6Ki.js} +1 -1
  138. package/dist/gateway/static/root/assets/{system-settings-panel-BN6sUX0H.js → system-settings-panel-BmoA92oX.js} +1 -1
  139. package/dist/gateway/static/root/assets/task-detail-page-L5RIelv0.js +3 -0
  140. package/dist/gateway/static/root/assets/{task-result-evidence-DKygspo2.js → task-result-evidence-BV-6hBVU.js} +1 -1
  141. package/dist/gateway/static/root/assets/{terminal-panel-store-DJVC7HqA.js → terminal-panel-store-BGdKE9hU.js} +1 -1
  142. package/dist/gateway/static/root/assets/{theme-store-Dlnmgryi.js → theme-store-Dvv79Wb2.js} +1 -1
  143. package/dist/gateway/static/root/assets/{tracing-settings-page-Bs76WeoF.js → tracing-settings-page-B4uA4Pnz.js} +1 -1
  144. package/dist/gateway/static/root/assets/{tunnel-api-B7nx0NQJ.js → tunnel-api-BurZtvqx.js} +1 -1
  145. package/dist/gateway/static/root/assets/{understanding-activity-store-C4bblRnQ.js → understanding-activity-store-C1cLL8zq.js} +1 -1
  146. package/dist/gateway/static/root/assets/{understanding-refresh-store-BvCj9-Ue.js → understanding-refresh-store-C3Lr_pjY.js} +1 -1
  147. package/dist/gateway/static/root/assets/{usage-page-anU5gslJ.js → usage-page-C91ZzLm9.js} +1 -1
  148. package/dist/gateway/static/root/assets/{use-autosave-YHxQ-UZg.js → use-autosave-zkzRuUtx.js} +1 -1
  149. package/dist/gateway/static/root/assets/{use-composer-attachments-DYY3Yz4a.js → use-composer-attachments-CoiQAgjo.js} +1 -1
  150. package/dist/gateway/static/root/assets/{use-file-preview-expanded-CYgWzDnv.js → use-file-preview-expanded-DFzy6iVy.js} +2 -2
  151. package/dist/gateway/static/root/assets/{use-personal-profile-D2Un8G1L.js → use-personal-profile-BB10h9ED.js} +1 -1
  152. package/dist/gateway/static/root/assets/{use-workspace-tree-Dkg9tUr4.js → use-workspace-tree-sF5DcONt.js} +1 -1
  153. package/dist/gateway/static/root/assets/user-model-page-WFnD5utO.js +2 -0
  154. package/dist/gateway/static/root/assets/{voice-api-key-field-BUes-Jlp.js → voice-api-key-field-Bqa4PeZx.js} +1 -1
  155. package/dist/gateway/static/root/assets/{voice-config-api-CrULrSKC.js → voice-config-api-LNO2xXHk.js} +1 -1
  156. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-DFMNIyy4.js → voice-input-shortcut-events-AzfhxBX7.js} +1 -1
  157. package/dist/gateway/static/root/assets/{voice-transcribe-api-Dy4hfftb.js → voice-transcribe-api-Cb8i6dLb.js} +1 -1
  158. package/dist/gateway/static/root/assets/{work-discovery-overlay-CFF4cRFl.js → work-discovery-overlay-CdQUiV-a.js} +1 -1
  159. package/dist/gateway/static/root/assets/{work-discovery-page-BnYaVH3V.js → work-discovery-page-HcUloXxf.js} +1 -1
  160. package/dist/gateway/static/root/assets/{working-directory-picker-modal-GFwVefVA.js → working-directory-picker-modal-Dv1HUipe.js} +1 -1
  161. package/dist/gateway/static/root/assets/{workspace-api-BdB4NEOh.js → workspace-api-Am2ee4R6.js} +2 -2
  162. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CqHcVFhS.js +1 -0
  163. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-NRL3YRjg.js → workspace-file-preview-dialog-z5Q00v92.js} +1 -1
  164. package/dist/gateway/static/root/assets/{workspace-open-location-menu-Dcij7wvJ.js → workspace-open-location-menu-4ONYaGy0.js} +1 -1
  165. package/dist/gateway/static/root/assets/xopc-cloud-account-card-DimGN59n.js +1 -0
  166. package/dist/gateway/static/root/index.html +80 -80
  167. package/dist/package.js +1 -1
  168. package/dist/packages/gateway-contract/src/automations.js +1 -0
  169. package/dist/packages/gateway-contract/src/capabilities.js +6 -2
  170. package/dist/packages/gateway-contract/src/home.js +12 -2
  171. package/dist/src/agent/background-review/prompts.js +11 -6
  172. package/dist/src/agent/background-review/run-background-review.js +12 -3
  173. package/dist/src/agent/context/execution-context.js +3 -1
  174. package/dist/src/agent/embedded/configuration-capability-correction.js +1 -1
  175. package/dist/src/agent/embedded/run-turn.js +12 -1
  176. package/dist/src/agent/embedded/session-runner.js +4 -0
  177. package/dist/src/agent/mcp/connection-drafts.d.ts +2 -1
  178. package/dist/src/agent/mcp/connection-drafts.js +3 -2
  179. package/dist/src/agent/mcp/connection-setup.d.ts +15 -1
  180. package/dist/src/agent/mcp/connection-setup.js +219 -106
  181. package/dist/src/agent/mcp/continuation-guard.d.ts +3 -0
  182. package/dist/src/agent/mcp/continuation-guard.js +54 -0
  183. package/dist/src/agent/mcp/continuation-input.d.ts +4 -0
  184. package/dist/src/agent/mcp/continuation-input.js +13 -0
  185. package/dist/src/agent/mcp/conversation-setup.d.ts +121 -2
  186. package/dist/src/agent/mcp/conversation-setup.js +274 -39
  187. package/dist/src/agent/mcp/discovery.d.ts +102 -0
  188. package/dist/src/agent/mcp/discovery.js +219 -0
  189. package/dist/src/agent/mcp/native-mcp.js +8 -1
  190. package/dist/src/agent/mcp/setup-plan.d.ts +76 -0
  191. package/dist/src/agent/mcp/setup-plan.js +93 -0
  192. package/dist/src/agent/mcp/tool-catalog.d.ts +2 -0
  193. package/dist/src/agent/mcp/tool-catalog.js +7 -1
  194. package/dist/src/agent/mcp/transport.d.ts +20 -0
  195. package/dist/src/agent/mcp/transport.js +188 -0
  196. package/dist/src/agent/orchestration/delegation-scope.d.ts +2 -1
  197. package/dist/src/agent/prompt/conversational-configuration-guide.js +1 -1
  198. package/dist/src/agent/service/direct-turn-helpers.js +2 -1
  199. package/dist/src/agent/service/process-direct-streaming.js +2 -1
  200. package/dist/src/agent/service.js +5 -1
  201. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -2
  202. package/dist/src/agent/tool-manuals/xopc-configuration.js +37 -4
  203. package/dist/src/agent/tools/factory.js +1 -1
  204. package/dist/src/agent/tools/mcp-setup-tool.js +6 -2
  205. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -0
  206. package/dist/src/agent/tools/xopc-use-tool.js +21 -0
  207. package/dist/src/automations/api/routes.js +13 -5
  208. package/dist/src/automations/capabilities/read.js +31 -3
  209. package/dist/src/automations/domain/types.d.ts +2 -0
  210. package/dist/src/automations/service/automation-service.d.ts +7 -0
  211. package/dist/src/automations/service/automation-service.js +9 -2
  212. package/dist/src/automations/storage/automation-run-repository.d.ts +11 -2
  213. package/dist/src/automations/storage/automation-run-repository.js +28 -24
  214. package/dist/src/automations/storage/index.js +2 -2
  215. package/dist/src/config/schema.d.ts +3 -0
  216. package/dist/src/config/schema.js +3 -2
  217. package/dist/src/extensions/agent-plugins/setup.d.ts +1 -0
  218. package/dist/src/extensions/agent-plugins/setup.js +1 -0
  219. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  220. package/dist/src/gateway/hono/routes/tasks.js +0 -4
  221. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  222. package/dist/src/gateway/service.js +9 -8
  223. package/dist/src/home-intelligence/evidence-presentation.d.ts +3 -0
  224. package/dist/src/home-intelligence/evidence-presentation.js +30 -0
  225. package/dist/src/home-intelligence/generator.d.ts +8 -0
  226. package/dist/src/home-intelligence/generator.js +15 -4
  227. package/dist/src/home-intelligence/policy.js +3 -0
  228. package/dist/src/memory-learning/repository.d.ts +6 -1
  229. package/dist/src/memory-learning/repository.js +10 -5
  230. package/dist/src/memory-learning/service.js +23 -1
  231. package/dist/src/process/mcp-stdio-supervisor.d.ts +1 -0
  232. package/dist/src/process/mcp-stdio-supervisor.js +14 -0
  233. package/dist/src/tasks/task-criterion-review-repository.js +1 -1
  234. package/dist/src/tui/tui.js +1 -1
  235. package/dist/src/user-context/extraction/registry.js +2 -2
  236. package/dist/src/user-model/capture/executor.d.ts +1 -0
  237. package/dist/src/user-model/capture/executor.js +6 -6
  238. package/dist/src/user-model/capture/semantic.d.ts +3 -0
  239. package/dist/src/user-model/capture/semantic.js +14 -4
  240. package/package.json +1 -1
  241. package/dist/gateway/static/root/assets/agent-plugin-dialog-m1A8wF9p.js +0 -1
  242. package/dist/gateway/static/root/assets/automation-api-hRsGx-qe.js +0 -1
  243. package/dist/gateway/static/root/assets/automation-task-card-Bur78p68.js +0 -3
  244. package/dist/gateway/static/root/assets/automations-workspace-DEkDjxeU.js +0 -9
  245. package/dist/gateway/static/root/assets/capabilities-Bo2qEJhH.js +0 -1
  246. package/dist/gateway/static/root/assets/capabilities-settings-panel-Cr67ziwX.js +0 -8
  247. package/dist/gateway/static/root/assets/chat-page-D92AWJbh.js +0 -72
  248. package/dist/gateway/static/root/assets/composer-payload-handoff-BQXlFKf4.js +0 -1
  249. package/dist/gateway/static/root/assets/connectors-page-Vx8-MY0Y.js +0 -1
  250. package/dist/gateway/static/root/assets/gateway-realtime-store-BHBOPF_q.js +0 -1
  251. package/dist/gateway/static/root/assets/home-page-B3sgqrl3.js +0 -2
  252. package/dist/gateway/static/root/assets/index-D4B6O8B3.js +0 -11
  253. package/dist/gateway/static/root/assets/index-DGWBJDAM.css +0 -1
  254. package/dist/gateway/static/root/assets/mcp-conversation-setup-page-CENs3hGU.js +0 -1
  255. package/dist/gateway/static/root/assets/messages-ByFlEbsu.js +0 -3
  256. package/dist/gateway/static/root/assets/note-image-lightbox-BFKZ7qJr.js +0 -1
  257. package/dist/gateway/static/root/assets/page-header-store-Du44NIEJ.js +0 -1
  258. package/dist/gateway/static/root/assets/project-detail-page-D9nnyvrI.js +0 -7
  259. package/dist/gateway/static/root/assets/route-preload-DI43HQV_.js +0 -2
  260. package/dist/gateway/static/root/assets/send-1f1Ntw6E.js +0 -1
  261. package/dist/gateway/static/root/assets/settings-advanced-gate-BI4DMz4_.js +0 -1
  262. package/dist/gateway/static/root/assets/task-detail-page-CS9m7Ipo.js +0 -2
  263. package/dist/gateway/static/root/assets/user-model-page-DIgPL3tN.js +0 -2
  264. package/dist/gateway/static/root/assets/workspace-editor-agent-store-4cZ26iaD.js +0 -1
  265. package/dist/gateway/static/root/assets/xopc-cloud-account-card-DC9aG7Pl.js +0 -1
@@ -11,9 +11,11 @@ import { isManagedConnectorServer } from "../../connectors/materialize.js";
11
11
  import { classifyMcpConnectionError } from "./connection-errors.js";
12
12
  import { McpConnectionDrafts, McpDraftError, mcpConfigRevision } from "./connection-drafts.js";
13
13
  import { weixinSetupScope } from "./weixin-setup-scope.js";
14
+ import { localExecutionSchema, secretFieldsSchema } from "./setup-plan.js";
15
+ import { McpDiscovery, createMcpResearch } from "./discovery.js";
14
16
  import { createHash, randomUUID } from "node:crypto";
15
17
  import { z } from "zod";
16
- import { setTimeout } from "node:timers/promises";
18
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
17
19
  //#region src/agent/mcp/conversation-setup.ts
18
20
  init_credentials();
19
21
  init_session_repository();
@@ -24,9 +26,26 @@ const log = createLogger("McpConversationSetup");
24
26
  const targetSchema = z.object({
25
27
  serverId: z.string().regex(/^[a-zA-Z0-9_-]{1,64}$/),
26
28
  displayName: z.string().min(1).max(100).optional(),
27
- url: z.string().url().max(2048),
29
+ url: z.string().url().max(2048).optional(),
28
30
  purpose: z.string().min(1).max(1e3),
29
- expectedRevision: z.string().optional()
31
+ authentication: z.enum([
32
+ "auto",
33
+ "bearer",
34
+ "header",
35
+ "none"
36
+ ]).optional(),
37
+ expectedRevision: z.string().optional(),
38
+ planId: z.string().uuid().optional(),
39
+ expectedPlanVersion: z.number().int().positive().optional(),
40
+ transport: z.enum([
41
+ "streamable-http",
42
+ "sse",
43
+ "stdio"
44
+ ]).optional(),
45
+ secretFields: secretFieldsSchema.optional(),
46
+ execution: localExecutionSchema.optional(),
47
+ helpUrl: z.string().url().optional(),
48
+ objective: z.enum(["connect_only", "complete_task"]).optional()
30
49
  }).strict();
31
50
  const setupSchema = z.object({
32
51
  setupId: identity,
@@ -49,12 +68,15 @@ var McpConversationSetup = class {
49
68
  busy = /* @__PURE__ */ new Set();
50
69
  authorizations = /* @__PURE__ */ new Set();
51
70
  disposed = false;
71
+ retryTimers = /* @__PURE__ */ new Map();
72
+ discovery;
52
73
  constructor(options) {
53
74
  this.options = options;
54
75
  this.drafts = new McpConnectionDrafts({
55
76
  readConfig: options.readConfig,
56
77
  saveConfig: options.saveConfig
57
78
  });
79
+ this.discovery = new McpDiscovery(options.research ?? createMcpResearch(options.readConfig));
58
80
  }
59
81
  notify(goal) {
60
82
  try {
@@ -87,8 +109,18 @@ var McpConversationSetup = class {
87
109
  if (!goal || conversationId && goal.conversationId !== conversationId) throw new McpDraftError(404, "MCP setup not found.");
88
110
  return goal;
89
111
  }
112
+ canProvideToken(goal) {
113
+ const url = new URL(goal.url);
114
+ return (goal.phase === "auth_unknown" || goal.phase === "blocked" && goal.errorCode === "access_denied") && !goal.tokenProvider && !goal.secretProviders && (url.protocol === "https:" || [
115
+ "127.0.0.1",
116
+ "localhost",
117
+ "[::1]"
118
+ ].includes(url.hostname));
119
+ }
90
120
  view(goal) {
91
121
  const expired = goal.expiresAt < Date.now() && goal.phase !== "ready";
122
+ const interactionPath = goal.channel ? `${goal.channel.origin}/#/mcp-setup/${goal.id}` : `/mcp-setup/${goal.id}`;
123
+ const interactionLink = `[Complete connection](${interactionPath})`;
92
124
  return {
93
125
  setupId: goal.id,
94
126
  serverId: goal.serverId,
@@ -97,18 +129,33 @@ var McpConversationSetup = class {
97
129
  phase: goal.phase,
98
130
  expired,
99
131
  reloadRequired: goal.reloadRequired === true,
132
+ canProvideToken: this.canProvideToken(goal),
133
+ secretFields: goal.secretFields,
134
+ helpUrl: goal.helpUrl,
135
+ objective: goal.objective,
136
+ planApproval: goal.reviewRequired ? {
137
+ sources: goal.sources ?? [],
138
+ execution: goal.execution,
139
+ endpoint: goal.transport === "stdio" ? goal.execution?.command : goal.url,
140
+ purpose: goal.purpose
141
+ } : void 0,
142
+ diagnosis: goal.diagnosis,
143
+ nextRetryAt: goal.nextRetryAt,
144
+ attempts: goal.attempts ?? 0,
100
145
  errorCode: goal.errorCode,
101
146
  conversationId: goal.conversationId,
102
147
  expiresAt: goal.expiresAt,
103
- interactionPath: goal.channel ? `${goal.channel.origin}/#/mcp-setup/${goal.id}` : `/mcp-setup/${goal.id}`,
148
+ interactionPath,
104
149
  returnChannel: goal.channel ? "weixin" : void 0,
105
150
  managementPath: goal.channel ? `${goal.channel.origin}/#/capabilities/connectors?tab=connected` : "/capabilities/connectors?tab=connected",
106
151
  continuationQueued: goal.resumed === true,
107
152
  replyDelivery: goal.reply?.status,
108
- instruction: goal.phase === "cancelled" ? "This setup is cancelled. Do not continue or revive it. Cancellation does not undo configuration already saved." : expired ? "This request expired. Start a new objective instead of reusing authorization." : goal.phase === "approval_required" ? "Send the exact trusted interactionPath to the user. The paired Weixin user has requested this service; an authenticated Gateway owner must approve this exact request on that page before any probe, credential submission or configuration change. Never ask for keys, callback URLs or a continue reply in chat. The result returns to this original Weixin conversation automatically." : goal.phase === "blocked" ? "The connection check failed. Report the safe error code and the remaining blocker. Do not repeatedly retry without resolving the cause." : goal.reloadRequired ? "Configuration is saved but runtime reload failed. Report the partial result and require a Gateway restart; do not claim the tools are active or tested." : goal.phase === "ready" ? "Configuration is saved. The host continues the original objective in a fresh turn so native MCP tools can load. Stop this turn; do not repeat installation or invent a successful read." : goal.phase === "planned" ? "Continue automatic steps with advance and the returned version." : "Link the trusted interactionPath for authorization or Token input, then stop this turn. The host resumes automatically; never ask for credentials, callback URLs or a continue reply in chat."
153
+ instruction: goal.phase === "cancelled" ? "This setup is cancelled. Do not continue or revive it. Cancellation does not undo configuration already saved." : expired ? "This request expired. Start a new objective instead of reusing authorization." : goal.phase === "approval_required" ? goal.channel ? "Send the exact trusted interactionPath to the user. The paired Weixin user has requested this service; an authenticated Gateway owner must approve this exact request on that page before any probe, credential submission or configuration change. Never ask for keys, callback URLs or a continue reply in chat. The result returns to this original Weixin conversation automatically." : `Copy ${interactionLink} verbatim. The owner must review this exact publisher source or local execution plan before any probe, credential submission or execution. Do not ask for secrets or an additional continue reply in chat.` : this.canProvideToken(goal) ? `The service refused access. Copy this Markdown link verbatim for secure first-time Token input: ${interactionLink} . Never rewrite its destination as xopc://workspace or add an origin. A refusal alone does not prove a missing Token; service or account permissions may also block access. Do not request secrets in chat or repeatedly retry.` : goal.phase === "blocked" ? "The connection check failed. Report the safe error code and the remaining blocker. Do not repeatedly retry without resolving the cause." : goal.reloadRequired ? "Configuration is saved but runtime reload failed. Report the partial result and require a Gateway restart; do not claim the tools are active or tested." : goal.phase === "ready" ? "Configuration is saved. The host queues the original objective once in a fresh turn. If this is that continuation, discover native tools by the exact server namespace and finish the original objective; otherwise stop and let the queued continuation run. Do not repeat installation or invent a successful read." : goal.phase === "planned" ? "Continue automatic steps with advance and the returned version." : `Copy this Markdown link verbatim for authorization or Token input: ${interactionLink} . Never rewrite its destination as xopc://workspace or add an origin. Then stop this turn. The host resumes automatically; never ask for credentials, callback URLs or a continue reply in chat.`
109
154
  };
110
155
  }
111
156
  cancelGoal(goal) {
157
+ clearTimeout(this.retryTimers.get(goal.id));
158
+ this.retryTimers.delete(goal.id);
112
159
  goal.phase = "cancelled";
113
160
  this.save(goal);
114
161
  const draftId = this.draftIds.get(goal.id);
@@ -118,6 +165,10 @@ var McpConversationSetup = class {
118
165
  this.draftIds.delete(goal.id);
119
166
  return this.view(goal);
120
167
  }
168
+ async cancelConversation(conversationId) {
169
+ this.discovery.cancelConversation(conversationId);
170
+ for (const goal of this.goals.values().filter((g) => g.conversationId === conversationId && g.phase !== "cancelled")) this.cancelGoal(goal);
171
+ }
121
172
  revokeWeixinRequests(accountId, peerId) {
122
173
  for (const goal of this.goals.values()) if (goal.channel?.accountId === accountId && goal.channel.peerId.toLowerCase() === peerId.toLowerCase() && goal.phase !== "cancelled") this.cancelGoal(goal);
123
174
  }
@@ -153,11 +204,27 @@ var McpConversationSetup = class {
153
204
  const channel = context.canRequestWeixinSetup ? weixinSetupScope(context.conversationId, this.options.readConfig()) : void 0;
154
205
  if (!localOwner && !channel) throw new McpDraftError(404, "A paired, account-isolated Weixin direct conversation and a secure Gateway public URL are required. Shared/merged routing is not eligible.");
155
206
  if (channel && ![
207
+ "discover",
208
+ "propose",
209
+ "select",
210
+ "repair",
156
211
  "start",
157
212
  "get",
158
213
  "cancel",
159
214
  "advance"
160
215
  ].includes(command)) throw new McpDraftError(409, "Weixin configuration requires approval for a specific new connection on the secure page.");
216
+ if ([
217
+ "discover",
218
+ "propose",
219
+ "select"
220
+ ].includes(command)) {
221
+ if (!context.canConfigure && !channel) throw new McpDraftError(409, "An active owner turn is required.");
222
+ if (dryRun) return {
223
+ dryRun: true,
224
+ instruction: "Discovery and candidate state were not changed."
225
+ };
226
+ return this.discovery.command(command, input, context);
227
+ }
161
228
  if (command === "inspect") {
162
229
  z.object({}).strict().parse(input);
163
230
  return this.inspect();
@@ -167,15 +234,65 @@ var McpConversationSetup = class {
167
234
  return this.view(this.get(args.setupId, context.conversationId));
168
235
  }
169
236
  if (!context.canConfigure && !channel) throw new McpDraftError(409, "An active owner App or local CLI turn is required for MCP configuration.");
237
+ if (command === "repair") {
238
+ const args = setupSchema.extend({
239
+ planId: z.string().uuid(),
240
+ expectedPlanVersion: z.number().int().positive()
241
+ }).strict().parse(input);
242
+ const goal = this.get(args.setupId, context.conversationId);
243
+ this.current(goal);
244
+ if (goal.version !== args.expectedVersion || goal.expiresAt < Date.now() || goal.phase !== "blocked" || goal.diagnosis?.recovery?.kind !== "verify_documented_endpoint") throw new McpDraftError(409, "This objective does not permit endpoint repair.");
245
+ const selected = this.discovery.selected(args.planId, args.expectedPlanVersion, context);
246
+ if (selected.purpose !== goal.purpose || selected.plan.url === goal.url && (selected.plan.transport ?? "streamable-http") === (goal.transport ?? "streamable-http")) throw new McpDraftError(409, "Repair needs the original objective and a documented different endpoint or transport.");
247
+ if (dryRun) return {
248
+ dryRun: true,
249
+ instruction: "The original objective and all existing credentials remain unchanged."
250
+ };
251
+ const revision = mcpConfigRevision(configuredServer(this.options.readConfig(), goal.serverId));
252
+ if (revision !== goal.expectedRevision) throw new McpDraftError(409, "The saved connection changed. Inspect before repairing.");
253
+ this.cancelGoal(goal);
254
+ return this.command("start", {
255
+ planId: args.planId,
256
+ expectedPlanVersion: args.expectedPlanVersion,
257
+ serverId: goal.serverId,
258
+ purpose: goal.purpose,
259
+ ...!channel ? { expectedRevision: revision } : {}
260
+ }, context);
261
+ }
170
262
  if (command === "start") {
171
263
  if (getActiveConnectionWait(context.conversationId)) throw new McpDraftError(409, "Another connection objective is waiting. Finish or cancel it before starting a separate MCP setup.");
172
- const args = targetSchema.parse(input), url = new URL(args.url);
264
+ const args = targetSchema.parse(input);
265
+ let selected;
266
+ if (args.planId) {
267
+ if (!args.expectedPlanVersion || args.url || args.execution || args.authentication || args.secretFields || args.transport || args.helpUrl || args.objective) throw new McpDraftError(400, "Use the selected plan without overriding its configuration.");
268
+ selected = this.discovery.selected(args.planId, args.expectedPlanVersion, context);
269
+ Object.assign(args, selected.plan);
270
+ args.purpose = selected.purpose;
271
+ }
272
+ const stdio = args.transport === "stdio";
273
+ for (const reference of [args.helpUrl, args.execution?.sourceUrl].filter((v) => Boolean(v))) {
274
+ const parsed = new URL(reference);
275
+ if (!["https:", "http:"].includes(parsed.protocol) || parsed.username || parsed.password || [...parsed.searchParams.keys()].some((key) => /token|secret|password|api.?key|authorization/i.test(key))) throw new McpDraftError(400, "Use a public integration guide without embedded credentials.");
276
+ }
277
+ if (stdio ? !args.execution || args.url : !args.url || args.execution) throw new McpDraftError(400, "Provide one HTTP URL or stdio execution plan.");
278
+ const url = new URL(stdio ? `stdio://localhost/${args.serverId}` : args.url);
173
279
  if ([
174
280
  "__proto__",
175
281
  "constructor",
176
282
  "prototype"
177
283
  ].includes(args.serverId.toLowerCase())) throw new McpDraftError(400, "Use a non-reserved server name.");
178
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || [...url.searchParams.keys()].some((key) => /token|secret|password|api.?key|authorization/i.test(key))) throw new McpDraftError(400, "Use an HTTP MCP address without embedded credentials. Enter secrets only in the secure page.");
284
+ if (!stdio && (!["http:", "https:"].includes(url.protocol) || url.username || url.password || [...url.searchParams.keys()].some((key) => /token|secret|password|api.?key|authorization/i.test(key)))) throw new McpDraftError(400, "Use an HTTP MCP address without embedded credentials. Enter secrets only in the secure page.");
285
+ if (args.secretFields?.some((field) => field.location !== (stdio ? "env" : "header"))) throw new McpDraftError(400, "Credential fields do not match the selected transport.");
286
+ if (args.authentication === "bearer" && args.secretFields?.length) {
287
+ if (args.secretFields.length !== 1 || args.secretFields[0].location !== "header" || args.secretFields[0].name.toLowerCase() !== "authorization") throw new McpDraftError(400, "Bearer authentication uses one Authorization credential field.");
288
+ args.secretFields[0].prefix = "Bearer ";
289
+ }
290
+ if (args.authentication === "header" && !args.secretFields?.length) throw new McpDraftError(400, "Describe the documented header fields.");
291
+ if (!stdio && (args.authentication === "bearer" || args.secretFields?.length) && url.protocol !== "https:" && ![
292
+ "127.0.0.1",
293
+ "localhost",
294
+ "[::1]"
295
+ ].includes(url.hostname)) throw new McpDraftError(400, "Token authentication requires HTTPS or a loopback server.");
179
296
  const session = getSessionMetadata(context.conversationId);
180
297
  if (!session?.transcriptId || session.agentId !== context.agentId) throw new McpDraftError(409, "Conversation identity changed.");
181
298
  if (channel) {
@@ -196,14 +313,23 @@ var McpConversationSetup = class {
196
313
  if (dryRun) return {
197
314
  dryRun: true,
198
315
  serverId: args.serverId,
199
- authentication: "probe_required"
316
+ authentication: args.authentication === "bearer" ? "token_required" : "probe_required"
200
317
  };
201
- const existing = this.goals.values().find((goal) => goal.conversationId === context.conversationId && goal.transcriptId === session.transcriptId && goal.serverId === args.serverId && goal.url === url.href && goal.purpose === args.purpose && goal.displayName === args.displayName && goal.phase !== "cancelled" && goal.phase !== "ready" && goal.expiresAt > Date.now());
318
+ const existing = this.goals.values().find((goal) => goal.conversationId === context.conversationId && goal.transcriptId === session.transcriptId && JSON.stringify([
319
+ goal.transport ?? "streamable-http",
320
+ goal.execution,
321
+ goal.secretFields,
322
+ goal.helpUrl,
323
+ goal.objective
324
+ ]) === JSON.stringify([
325
+ args.transport ?? "streamable-http",
326
+ args.execution,
327
+ args.secretFields,
328
+ args.helpUrl,
329
+ args.objective
330
+ ]) && JSON.stringify(goal.sources) === JSON.stringify(selected?.sources) && goal.serverId === args.serverId && goal.url === url.href && goal.purpose === args.purpose && goal.displayName === args.displayName && (goal.authentication ?? "auto") === (args.authentication ?? "auto") && goal.phase !== "cancelled" && goal.phase !== "ready" && goal.expiresAt > Date.now());
202
331
  if (existing) return this.view(existing);
203
- for (const previous of this.goals.values().filter((item) => item.conversationId === context.conversationId && (item.phase !== "ready" || !item.resumed) && item.phase !== "cancelled")) {
204
- previous.phase = "cancelled";
205
- this.save(previous);
206
- }
332
+ for (const previous of this.goals.values().filter((item) => item.conversationId === context.conversationId && (item.phase !== "ready" || !item.resumed) && item.phase !== "cancelled")) this.cancelGoal(previous);
207
333
  const goal = {
208
334
  id: randomUUID(),
209
335
  conversationId: context.conversationId,
@@ -213,9 +339,18 @@ var McpConversationSetup = class {
213
339
  displayName: args.displayName,
214
340
  url: url.href,
215
341
  purpose: args.purpose,
342
+ authentication: args.authentication,
343
+ transport: args.transport,
344
+ execution: args.execution,
345
+ secretFields: args.secretFields,
346
+ helpUrl: args.helpUrl,
347
+ objective: args.objective,
348
+ reviewRequired: stdio || Boolean(selected),
349
+ publicOnly: Boolean(selected && !stdio),
350
+ sources: selected?.sources,
216
351
  expectedRevision: mcpConfigRevision(server),
217
352
  version: 1,
218
- phase: channel ? "approval_required" : "planned",
353
+ phase: channel || stdio || selected ? "approval_required" : "planned",
219
354
  ...channel ? { channel } : {},
220
355
  expiresAt: Date.now() + 15 * 6e4
221
356
  };
@@ -233,10 +368,7 @@ var McpConversationSetup = class {
233
368
  return this.options.withConfigLock(async () => {
234
369
  const config = this.options.readConfig(), server = configuredServer(config, args.serverId);
235
370
  if (!server || isManagedConnectorServer(server) || server.xopcPlugin || mcpConfigRevision(server) !== args.expectedRevision) throw new McpDraftError(409, "The custom server changed or belongs to another owner. Inspect again.");
236
- for (const goal of this.goals.values().filter((item) => item.serverId === args.serverId && item.phase !== "ready" && item.phase !== "cancelled")) {
237
- goal.phase = "cancelled";
238
- this.save(goal);
239
- }
371
+ for (const goal of this.goals.values().filter((item) => item.serverId === args.serverId && item.phase !== "ready" && item.phase !== "cancelled")) this.cancelGoal(goal);
240
372
  const next = structuredClone(config);
241
373
  if (command === "remove") delete next.mcp.servers[args.serverId];
242
374
  else next.mcp.servers[args.serverId].enabled = args.enabled;
@@ -271,6 +403,10 @@ var McpConversationSetup = class {
271
403
  return this.view(goal);
272
404
  }
273
405
  if (goal.expiresAt < Date.now()) throw new McpDraftError(409, "Setup expired. Start a new goal; do not reuse an old authorization.");
406
+ if (goal.nextRetryAt && Date.now() < goal.nextRetryAt) {
407
+ this.scheduleRetry(goal);
408
+ return this.view(goal);
409
+ }
274
410
  if (this.busy.has(goal.id)) return {
275
411
  ...this.view(goal),
276
412
  inProgress: true
@@ -288,6 +424,22 @@ var McpConversationSetup = class {
288
424
  if (mcpConfigRevision(published) !== goal.expectedRevision) throw new McpDraftError(409, "Server changed. Start again from the current configuration.");
289
425
  let draftId = this.draftIds.get(goal.id);
290
426
  if (!draftId) {
427
+ const fields = goal.secretFields?.length ? goal.secretFields : [{
428
+ id: "token",
429
+ name: "Authorization",
430
+ location: "header",
431
+ prefix: "Bearer ",
432
+ label: "Token"
433
+ }];
434
+ const secretConfig = {};
435
+ for (const field of fields) {
436
+ const provider = goal.secretProviders?.[field.id] ?? (field.id === "token" ? goal.tokenProvider : void 0);
437
+ if (provider) (secretConfig[field.location === "env" ? "env" : "headers"] ??= {})[field.name] = { xopcSecretRef: {
438
+ provider,
439
+ fieldKey: field.id,
440
+ prefix: field.prefix
441
+ } };
442
+ }
291
443
  const draft = await this.drafts.create("local-owner", {
292
444
  serverId: goal.serverId,
293
445
  ...published ? {
@@ -295,16 +447,20 @@ var McpConversationSetup = class {
295
447
  expectedServer: published
296
448
  } : {},
297
449
  server: {
298
- url: goal.url,
450
+ ...goal.transport === "stdio" ? {
451
+ ...goal.execution,
452
+ sourceUrl: void 0,
453
+ type: "stdio",
454
+ xopcManagedStdio: true
455
+ } : {
456
+ url: goal.url,
457
+ type: goal.transport ?? "streamable-http"
458
+ },
299
459
  displayName: goal.displayName,
300
- type: "streamable-http",
301
460
  enabled: true,
302
461
  xopcSetupId: goal.id,
303
- ...goal.tokenProvider ? { headers: { Authorization: { xopcSecretRef: {
304
- provider: goal.tokenProvider,
305
- fieldKey: "token",
306
- prefix: "Bearer "
307
- } } } } : {}
462
+ xopcPublicOnly: goal.publicOnly,
463
+ ...secretConfig
308
464
  }
309
465
  });
310
466
  this.current(goal);
@@ -315,6 +471,12 @@ var McpConversationSetup = class {
315
471
  this.save(goal);
316
472
  }
317
473
  }
474
+ if (goal.authentication === "bearer" && !goal.secretFields?.length && !goal.tokenProvider && !goal.secretProviders?.token || goal.secretFields?.some((field) => !goal.secretProviders?.[field.id])) {
475
+ goal.phase = "token_required";
476
+ goal.errorCode = void 0;
477
+ this.save(goal);
478
+ return this.view(goal);
479
+ }
318
480
  if (goal.phase === "authorizing") {
319
481
  const auth = this.drafts.authorization("local-owner", draftId);
320
482
  if (auth.state === "error" || auth.state === "cancelled") {
@@ -325,12 +487,46 @@ var McpConversationSetup = class {
325
487
  }
326
488
  if (auth.state !== "connected") return this.view(goal);
327
489
  } else {
328
- const probe = await this.drafts.probe("local-owner", draftId);
490
+ if ((goal.attempts ?? 0) >= 3) {
491
+ goal.phase = "blocked";
492
+ goal.nextRetryAt = void 0;
493
+ goal.diagnosis = {
494
+ ...goal.diagnosis,
495
+ recovery: {
496
+ kind: "report_blocker",
497
+ reason: "retry_budget_exhausted"
498
+ }
499
+ };
500
+ this.save(goal);
501
+ return this.view(goal);
502
+ }
503
+ goal.attempts = (goal.attempts ?? 0) + 1;
504
+ goal.nextRetryAt = void 0;
505
+ this.save(goal);
506
+ const probe = await this.drafts.probe("local-owner", draftId, { beforeRequest: (request) => {
507
+ this.current(goal);
508
+ const key = `${request?.method ?? "GET"}:${request?.stage ?? "metadata"}`;
509
+ goal.requestCounts ??= {};
510
+ if ((goal.requestCounts[key] ?? 0) >= 3) throw new Error("MCP retry budget exhausted for this protocol stage");
511
+ goal.requestCounts[key] = (goal.requestCounts[key] ?? 0) + 1;
512
+ this.goals.set(goal.id, goal);
513
+ } });
329
514
  this.current(goal);
515
+ goal.diagnosis = {
516
+ auth: probe.auth,
517
+ observation: probe.observation,
518
+ recovery: probe.recovery
519
+ };
330
520
  if (probe.state !== "connected") {
331
521
  goal.phase = probe.state === "error" ? "blocked" : probe.state;
332
- goal.errorCode = probe.state === "token_required" && goal.tokenProvider ? "credential_rejected" : probe.errorCode;
522
+ goal.errorCode = probe.state === "token_required" && (goal.tokenProvider || goal.secretProviders) ? "credential_rejected" : probe.errorCode;
523
+ if ((probe.recovery?.kind === "wait" || [
524
+ "network",
525
+ "timeout",
526
+ "connection_refused"
527
+ ].includes(probe.errorCode ?? "")) && (goal.attempts ?? 0) < 3) goal.nextRetryAt = probe.recovery?.retryAt ?? Date.now() + (goal.attempts === 1 ? 2e3 : 5e3);
333
528
  this.save(goal);
529
+ this.scheduleRetry(goal);
334
530
  return this.view(goal);
335
531
  }
336
532
  }
@@ -369,6 +565,21 @@ var McpConversationSetup = class {
369
565
  this.busy.delete(goal.id);
370
566
  }
371
567
  }
568
+ scheduleRetry(goal) {
569
+ if (this.retryTimers.has(goal.id) || !goal.nextRetryAt || goal.nextRetryAt >= goal.expiresAt || this.disposed) return;
570
+ const version = goal.version;
571
+ const timer = setTimeout(() => {
572
+ this.retryTimers.delete(goal.id);
573
+ if (this.disposed) return;
574
+ try {
575
+ const current = this.goals.get(goal.id);
576
+ if (!current || current.version !== version) return;
577
+ this.advance(current).catch(() => {});
578
+ } catch {}
579
+ }, Math.max(1, goal.nextRetryAt - Date.now()));
580
+ timer.unref();
581
+ this.retryTimers.set(goal.id, timer);
582
+ }
372
583
  /** Owner-only UI; secret values and OAuth URLs never pass through the model API. */
373
584
  async interact(id, action, value, expectedVersion, ownerPrincipalId = "local-owner") {
374
585
  const goal = this.get(id);
@@ -398,16 +609,16 @@ var McpConversationSetup = class {
398
609
  }
399
610
  return {
400
611
  ...this.view(goal),
401
- endpointOrigin: new URL(goal.url).origin,
612
+ endpointOrigin: goal.transport === "stdio" ? "Gateway local process" : new URL(goal.url).origin,
402
613
  approval: goal.channel ? {
403
614
  ...goal.channel,
404
615
  endpoint: goal.url,
405
616
  purpose: goal.purpose
406
617
  } : void 0,
407
- canReplaceToken: Boolean(goal.tokenProvider),
618
+ canReplaceToken: Boolean(goal.tokenProvider || goal.secretProviders),
408
619
  authorizationUrl,
409
620
  authState,
410
- requiresRecheck: !draftId && goal.phase !== "ready" && goal.phase !== "cancelled"
621
+ requiresRecheck: !draftId && goal.phase !== "ready" && goal.phase !== "cancelled" && goal.phase !== "approval_required"
411
622
  };
412
623
  }
413
624
  this.current(goal);
@@ -421,7 +632,7 @@ var McpConversationSetup = class {
421
632
  }
422
633
  if (goal.expiresAt < Date.now() || goal.phase === "ready") throw new McpDraftError(409, "This setup no longer accepts input.");
423
634
  if (action === "approve") {
424
- if (!goal.channel || goal.phase !== "approval_required" || !ownerPrincipalId) throw new McpDraftError(409, "This request cannot be approved.");
635
+ if (!(goal.channel || goal.reviewRequired) || goal.phase !== "approval_required" || !ownerPrincipalId) throw new McpDraftError(409, "This request cannot be approved.");
425
636
  goal.approvedBy = ownerPrincipalId;
426
637
  goal.phase = "planned";
427
638
  this.save(goal);
@@ -429,21 +640,35 @@ var McpConversationSetup = class {
429
640
  }
430
641
  if (goal.phase === "approval_required") throw new McpDraftError(409, "Approve the exact Weixin request before continuing.");
431
642
  if (action === "token") {
432
- if (!(goal.phase === "token_required" || goal.phase === "blocked" && goal.tokenProvider) || !value?.trim() || value.length > 16384) throw new McpDraftError(400, "A token is required for this setup.");
643
+ if (!(goal.phase === "token_required" || goal.phase === "blocked" && (goal.tokenProvider || goal.secretProviders) || this.canProvideToken(goal))) throw new McpDraftError(400, "A token is required for this setup.");
644
+ if (goal.nextRetryAt && Date.now() < goal.nextRetryAt) throw new McpDraftError(409, "The service cooldown has not expired. Wait before submitting credentials.");
645
+ const fields = goal.secretFields?.length ? goal.secretFields : [{
646
+ id: "token",
647
+ name: "Authorization",
648
+ location: "header",
649
+ prefix: "Bearer ",
650
+ label: "Token"
651
+ }];
652
+ const values = typeof value === "string" && fields.length === 1 ? { [fields[0].id]: value } : value;
653
+ if (!values || typeof values !== "object" || Object.keys(values).length !== fields.length || fields.some((field) => !Object.hasOwn(values, field.id) || typeof values[field.id] !== "string" || !values[field.id].trim() || values[field.id].length > 16384 || /[\r\n\0]/.test(values[field.id]))) throw new McpDraftError(400, "Provide every requested secret field without control characters.");
433
654
  if (this.busy.has(id)) throw new McpDraftError(409, "A check is in progress.");
434
655
  const url = new URL(goal.url);
435
- if (url.protocol !== "https:" && ![
656
+ if (goal.transport !== "stdio" && url.protocol !== "https:" && ![
436
657
  "127.0.0.1",
437
658
  "localhost",
438
659
  "[::1]"
439
660
  ].includes(url.hostname)) throw new McpDraftError(400, "Token authentication requires HTTPS or a loopback server.");
440
661
  this.busy.add(id);
441
662
  this.save(goal);
442
- const provider = connectorSecretProviderId(`mcp-setup-${id}-${goal.version}`, "token");
663
+ const providers = {};
443
664
  const credentials = new CredentialResolver();
444
665
  try {
445
- await credentials.saveApiKey(provider, value.trim());
446
- this.current(goal);
666
+ for (const field of fields) {
667
+ const provider = connectorSecretProviderId(`mcp-setup-${id}-${goal.version}`, field.id);
668
+ providers[field.id] = provider;
669
+ await credentials.saveApiKey(provider, values[field.id].trim());
670
+ this.current(goal);
671
+ }
447
672
  const old = this.draftIds.get(id);
448
673
  if (old) try {
449
674
  this.drafts.remove("local-owner", old);
@@ -451,12 +676,16 @@ var McpConversationSetup = class {
451
676
  if (!(error instanceof McpDraftError) || error.status !== 404) throw error;
452
677
  }
453
678
  this.draftIds.delete(id);
454
- goal.tokenProvider = provider;
679
+ goal.secretProviders = providers;
680
+ goal.tokenProvider = providers.token;
455
681
  goal.phase = "planned";
456
682
  goal.errorCode = void 0;
683
+ goal.attempts = 0;
684
+ goal.requestCounts = {};
685
+ goal.nextRetryAt = void 0;
457
686
  this.save(goal);
458
687
  } catch (error) {
459
- await credentials.deleteProfile(`${provider}:default`);
688
+ await Promise.all(Object.values(providers).map((provider) => credentials.deleteProfile(`${provider}:default`)));
460
689
  throw error;
461
690
  } finally {
462
691
  this.busy.delete(id);
@@ -483,7 +712,7 @@ var McpConversationSetup = class {
483
712
  this.authorizations.add(id);
484
713
  (async () => {
485
714
  for (;;) {
486
- await setTimeout(250, void 0, { ref: false });
715
+ await setTimeout$1(250, void 0, { ref: false });
487
716
  if (this.disposed) return;
488
717
  const goal = this.goals.get(id);
489
718
  if (!goal || goal.phase !== "authorizing" || goal.expiresAt < Date.now()) return;
@@ -513,6 +742,8 @@ var McpConversationSetup = class {
513
742
  }
514
743
  dispose() {
515
744
  this.disposed = true;
745
+ for (const timer of this.retryTimers.values()) clearTimeout(timer);
746
+ this.retryTimers.clear();
516
747
  for (const draftId of this.draftIds.values()) try {
517
748
  this.drafts.remove("local-owner", draftId);
518
749
  } catch {}
@@ -602,6 +833,10 @@ var McpConversationSetup = class {
602
833
  }
603
834
  }
604
835
  async resumePending(runtimeReloaded = false) {
836
+ for (const goal of this.goals.values().filter((item) => item.phase === "blocked" && item.nextRetryAt)) try {
837
+ this.current(goal);
838
+ this.scheduleRetry(goal);
839
+ } catch {}
605
840
  for (const goal of this.goals.values().filter((item) => item.phase === "ready" && item.reply && item.reply.status !== "delivered")) try {
606
841
  await this.deliverReply(goal);
607
842
  } catch {}
@@ -0,0 +1,102 @@
1
+ import type { Config } from '../../config/schema.js';
2
+ import { type ConnectionPlan } from './setup-plan.js';
3
+ type Context = {
4
+ conversationId: string;
5
+ agentId: string;
6
+ authorizeResearch?: (tool: 'web_search' | 'web_fetch', args: Record<string, unknown>) => Promise<boolean>;
7
+ signal?: AbortSignal;
8
+ };
9
+ type Document = {
10
+ id: string;
11
+ url: string;
12
+ hash: string;
13
+ text: string;
14
+ };
15
+ export interface McpResearch {
16
+ search(query: string, signal?: AbortSignal): Promise<Array<{
17
+ url: string;
18
+ title: string;
19
+ }>>;
20
+ read(url: string, signal?: AbortSignal): Promise<{
21
+ url: string;
22
+ text: string;
23
+ }>;
24
+ }
25
+ export declare function createMcpResearch(config: () => Config): McpResearch;
26
+ /** Search results are evidence to inspect, never configuration authority. */
27
+ export declare class McpDiscovery {
28
+ private readonly research;
29
+ private readonly records;
30
+ constructor(research: McpResearch);
31
+ private current;
32
+ private authorized;
33
+ command(command: string, input: Record<string, unknown>, context: Context): Promise<{
34
+ discoveryId: string;
35
+ version: number;
36
+ documents: Document[];
37
+ failures: {
38
+ url: string;
39
+ reason: string;
40
+ }[];
41
+ instruction: string;
42
+ candidates?: undefined;
43
+ planId?: undefined;
44
+ expectedPlanVersion?: undefined;
45
+ } | {
46
+ discoveryId: string;
47
+ version: number;
48
+ candidates: {
49
+ ownership: string;
50
+ displayName: string;
51
+ transport: "stdio" | "streamable-http" | "sse";
52
+ authentication: "header" | "none" | "auto" | "bearer";
53
+ secretFields: {
54
+ id: string;
55
+ label: string;
56
+ location: "header" | "env";
57
+ name: string;
58
+ prefix: "" | "Bearer ";
59
+ }[];
60
+ objective: "connect_only" | "complete_task";
61
+ url?: string;
62
+ helpUrl?: string;
63
+ execution?: {
64
+ command: string;
65
+ args: string[];
66
+ sourceUrl: string;
67
+ cwd?: string;
68
+ };
69
+ candidateId: string;
70
+ }[];
71
+ instruction: string;
72
+ documents?: undefined;
73
+ failures?: undefined;
74
+ planId?: undefined;
75
+ expectedPlanVersion?: undefined;
76
+ } | {
77
+ planId: string;
78
+ expectedPlanVersion: number;
79
+ instruction: string;
80
+ discoveryId?: undefined;
81
+ version?: undefined;
82
+ documents?: undefined;
83
+ failures?: undefined;
84
+ candidates?: undefined;
85
+ }>;
86
+ selected(id: string, version: number, context: Context): {
87
+ trusted: boolean;
88
+ sources: {
89
+ url: string;
90
+ hash: string;
91
+ }[];
92
+ purpose: string;
93
+ id: string;
94
+ plan: ConnectionPlan;
95
+ evidence: Array<{
96
+ documentId: string;
97
+ quote: string;
98
+ }>;
99
+ };
100
+ cancelConversation(conversationId: string): void;
101
+ }
102
+ export {};