@xopcai/xopc 0.0.425 → 0.0.427

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 (448) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/src/adapters/security-adapter.js +1 -1
  3. package/dist/extensions/telegram/src/pairing-config-resolver.js +1 -1
  4. package/dist/extensions/telegram/src/plugin.js +2 -2
  5. package/dist/extensions/telegram/xopc.extension.json +1 -1
  6. package/dist/extensions/weixin/src/api/api.js +1 -1
  7. package/dist/extensions/weixin/src/auth/accounts.js +2 -2
  8. package/dist/extensions/weixin/src/auth/pairing.js +1 -1
  9. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  10. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +1 -1
  11. package/dist/extensions/weixin/src/cli/qr-login.js +1 -1
  12. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  13. package/dist/extensions/weixin/src/messaging/inbound.js +2 -2
  14. package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
  15. package/dist/extensions/weixin/src/messaging/send.js +12 -3
  16. package/dist/extensions/weixin/src/monitor/monitor.js +1 -1
  17. package/dist/extensions/weixin/src/outbound-send.js +12 -3
  18. package/dist/extensions/weixin/src/pairing-config-resolver.js +1 -1
  19. package/dist/extensions/weixin/src/plugin.js +1 -1
  20. package/dist/gateway/static/root/assets/{activity-store-CMw8qBuC.js → activity-store-D_DXNHba.js} +1 -1
  21. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-JI0YWOIm.js → agent-avatar-dicebear-CjaQxFQt.js} +1 -1
  22. package/dist/gateway/static/root/assets/{agent-avatar-display-YqmwzOSa.js → agent-avatar-display-6Z4m31Fz.js} +2 -2
  23. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D4ClP_DJ.js +1 -0
  24. package/dist/gateway/static/root/assets/agent-plugin-dialog-m1A8wF9p.js +1 -0
  25. package/dist/gateway/static/root/assets/agents-B9slUA_1.js +77 -0
  26. package/dist/gateway/static/root/assets/{agents-admin-api-DLnmdC1h.js → agents-admin-api-u5c3GREg.js} +1 -1
  27. package/dist/gateway/static/root/assets/{api-Boc-CVh7.js → api-C3Tp9MkF.js} +1 -1
  28. package/dist/gateway/static/root/assets/{api-bL7sxjAF.js → api-CRT9ZyH0.js} +1 -1
  29. package/dist/gateway/static/root/assets/app-link-DRy3-k7j.js +1 -0
  30. package/dist/gateway/static/root/assets/{app-management-settings-panel-jIG5i7KE.js → app-management-settings-panel-XqoIBF2H.js} +1 -1
  31. package/dist/gateway/static/root/assets/{appearance-settings-BnaQW9Xd.js → appearance-settings-9ZtqCASo.js} +1 -1
  32. package/dist/gateway/static/root/assets/apps-page-DUeu_7iC.js +1 -0
  33. package/dist/gateway/static/root/assets/{archive-plugin-DjboG3kA.js → archive-plugin-BCQnOkV8.js} +1 -1
  34. package/dist/gateway/static/root/assets/attachment-load-DrVGNxJm.js +1 -0
  35. package/dist/gateway/static/root/assets/{automation-api-CZqL9l_d.js → automation-api-hRsGx-qe.js} +1 -1
  36. package/dist/gateway/static/root/assets/{automation-result-state-DRd-X_Ai.js → automation-result-state-CMfVTv_i.js} +1 -1
  37. package/dist/gateway/static/root/assets/automation-task-card-Bur78p68.js +3 -0
  38. package/dist/gateway/static/root/assets/{automations-page-HyBQIfmn.js → automations-page-DMIyWsP0.js} +1 -1
  39. package/dist/gateway/static/root/assets/automations-workspace-DEkDjxeU.js +9 -0
  40. package/dist/gateway/static/root/assets/{binary-plugins-Bg8ARZUH.js → binary-plugins-CIB5cbvQ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{block-editor-DKohqFAW.js → block-editor-CXdlNAmZ.js} +2 -2
  42. package/dist/gateway/static/root/assets/{browser-automation-inputs-YeibTzw4.js → browser-automation-inputs-Fxo7HbK6.js} +1 -1
  43. package/dist/gateway/static/root/assets/{browser-automations-page-BWNcbuz2.js → browser-automations-page-Dn3LN5wo.js} +2 -2
  44. package/dist/gateway/static/root/assets/{browser-control-api-CDeuxy2x.js → browser-control-api-CbbPvhHR.js} +1 -1
  45. package/dist/gateway/static/root/assets/browser-settings-page-Cpm9fEPV.js +3 -0
  46. package/dist/gateway/static/root/assets/{button-CnRSIP6m.js → button-Cc4hUNTt.js} +1 -1
  47. package/dist/gateway/static/root/assets/{capabilities-BcQa8c9n.js → capabilities-BEvywfF9.js} +1 -1
  48. package/dist/gateway/static/root/assets/capabilities-Bo2qEJhH.js +1 -0
  49. package/dist/gateway/static/root/assets/capabilities-page-BCzsIzvC.js +2 -0
  50. package/dist/gateway/static/root/assets/capabilities-settings-panel-Cr67ziwX.js +8 -0
  51. package/dist/gateway/static/root/assets/{capability-header-actions-CTUCuBlW.js → capability-header-actions-BxMYfQ8y.js} +1 -1
  52. package/dist/gateway/static/root/assets/channels-CA5z5dGY.js +1 -0
  53. package/dist/gateway/static/root/assets/{chat-agents-api-B8JO6Tcj.js → chat-agents-api-D8YS5amE.js} +1 -1
  54. package/dist/gateway/static/root/assets/{chat-chart-block-DRtuFfF1.js → chat-chart-block-B39npsXj.js} +1 -1
  55. package/dist/gateway/static/root/assets/chat-page-D92AWJbh.js +72 -0
  56. package/dist/gateway/static/root/assets/{chat-terminal-dock-Dkqq5FSL.js → chat-terminal-dock-DjFnElAM.js} +2 -2
  57. package/dist/gateway/static/root/assets/{command-palette-api-qujvNqkK.js → command-palette-api-Dijix7V6.js} +1 -1
  58. package/dist/gateway/static/root/assets/composer-payload-handoff-BQXlFKf4.js +1 -0
  59. package/dist/gateway/static/root/assets/{computer-settings-page-8q4hRmoo.js → computer-settings-page-MkqyKyf3.js} +1 -1
  60. package/dist/gateway/static/root/assets/confirm-dialog-D7dQJytv.js +1 -0
  61. package/dist/gateway/static/root/assets/connected-providers-grid-BSvKP2u-.js +1 -0
  62. package/dist/gateway/static/root/assets/{connector-service-page-DQaTI21R.js → connector-service-page-DlIl9bLx.js} +1 -1
  63. package/dist/gateway/static/root/assets/{connectors-api-BjypBp2g.js → connectors-api-DEJU8mgn.js} +1 -1
  64. package/dist/gateway/static/root/assets/connectors-page-Vx8-MY0Y.js +1 -0
  65. package/dist/gateway/static/root/assets/{copy-text-row-CYIv7RfP.js → copy-text-row-CpiRzq4G.js} +1 -1
  66. package/dist/gateway/static/root/assets/{date-picker-D_PSHGpe.js → date-picker-BIfjfOTM.js} +1 -1
  67. package/dist/gateway/static/root/assets/dependency-picker-XjPB8FJS.js +1 -0
  68. package/dist/gateway/static/root/assets/{desktop-pet-1Et9VqkM.js → desktop-pet-DFNehTtd.js} +1 -1
  69. package/dist/gateway/static/root/assets/{desktop-pet-narrative-rADKU0FX.js → desktop-pet-narrative-ChwjpnsG.js} +1 -1
  70. package/dist/gateway/static/root/assets/{desktop-pet-settings-0fCGgaG7.js → desktop-pet-settings-BDjsFown.js} +1 -1
  71. package/dist/gateway/static/root/assets/{dev-view-store-TTj_djD8.js → dev-view-store-CeZZLOc6.js} +1 -1
  72. package/dist/gateway/static/root/assets/device-pairing-wizard-DH_uJ698.js +1 -0
  73. package/dist/gateway/static/root/assets/{directory-picker-path-field-C07a7wYX.js → directory-picker-path-field-DiZXY7jF.js} +1 -1
  74. package/dist/gateway/static/root/assets/{discussion-annotation-sync-BFqKm9ky.js → discussion-annotation-sync-BXqNuZnx.js} +1 -1
  75. package/dist/gateway/static/root/assets/dist-BGTk37IG.js +1 -0
  76. package/dist/gateway/static/root/assets/dist-BuHnPloF.js +1 -0
  77. package/dist/gateway/static/root/assets/dist-GJ8-1PAx.js +1 -0
  78. package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +1 -0
  79. package/dist/gateway/static/root/assets/{extension-debug-page-DFaVlqas.js → extension-debug-page-myQqsol2.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-iframe-host-BfzPfXBq.js → extension-iframe-host-DaL-OcTw.js} +1 -1
  81. package/dist/gateway/static/root/assets/{extension-marketplace-api-ow0K1Y4_.js → extension-marketplace-api-DRBszrCR.js} +1 -1
  82. package/dist/gateway/static/root/assets/{extension-page-CrDADV5W.js → extension-page-DvlGhZLa.js} +1 -1
  83. package/dist/gateway/static/root/assets/{extension-provider-mnRoa63o.js → extension-provider-fOi6V6Cr.js} +1 -1
  84. package/dist/gateway/static/root/assets/{extension-settings-page-BLl02GFY.js → extension-settings-page-DOGlQpkx.js} +1 -1
  85. package/dist/gateway/static/root/assets/{file-preview-surface-TGdKqhCf.js → file-preview-surface-DfkXvFnc.js} +1 -1
  86. package/dist/gateway/static/root/assets/{gateway-config-swr-DfPQIHOL.js → gateway-config-swr-BOCt_zOo.js} +1 -1
  87. package/dist/gateway/static/root/assets/{gateway-realtime-67vWg_M2.js → gateway-realtime-BL_Cf0OQ.js} +1 -1
  88. package/dist/gateway/static/root/assets/gateway-realtime-store-BHBOPF_q.js +1 -0
  89. package/dist/gateway/static/root/assets/{gateway-restart-CLtR2wkL.js → gateway-restart-CHf8qY7H.js} +1 -1
  90. package/dist/gateway/static/root/assets/{gateway-settings-COvC3r-l.js → gateway-settings-Di41peSM.js} +1 -1
  91. package/dist/gateway/static/root/assets/{gateway-startup-retry-9YQllbw2.js → gateway-startup-retry-CvkJYurV.js} +1 -1
  92. package/dist/gateway/static/root/assets/{global-defaults-api-DYMRjGvd.js → global-defaults-api-BWMbKu72.js} +1 -1
  93. package/dist/gateway/static/root/assets/home-page-B3sgqrl3.js +2 -0
  94. package/dist/gateway/static/root/assets/{image-generation-api-Dzydfvy8.js → image-generation-api-Ce-IY7Ug.js} +1 -1
  95. package/dist/gateway/static/root/assets/{imports-page-Csd_YZXZ.js → imports-page-W7_cDbxy.js} +1 -1
  96. package/dist/gateway/static/root/assets/index-D4B6O8B3.js +11 -0
  97. package/dist/gateway/static/root/assets/index-DGWBJDAM.css +1 -0
  98. package/dist/gateway/static/root/assets/install-connector-dialog-DWVl9ekV.js +1 -0
  99. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B201bMIa.js → keyboard-shortcuts-settings-Doyu0Q9e.js} +1 -1
  100. package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
  101. package/dist/gateway/static/root/assets/local-app-workbench-page-B3h3P6aI.js +1 -0
  102. package/dist/gateway/static/root/assets/{local-apps-page-BOwqNH0L.js → local-apps-page-D6D2bZGW.js} +1 -1
  103. package/dist/gateway/static/root/assets/{local-session-drafts-DjmK-SM9.js → local-session-drafts-BJ1B1dQ7.js} +1 -1
  104. package/dist/gateway/static/root/assets/{locale-store-Bg_XR36n.js → locale-store-Br7IfbXK.js} +1 -1
  105. package/dist/gateway/static/root/assets/{logs-page-gw3E9CMQ.js → logs-page-qiXos_12.js} +2 -2
  106. package/dist/gateway/static/root/assets/management-settings-C0WcSdK7.js +1 -0
  107. package/dist/gateway/static/root/assets/{markdown-view-BUpXJUPv.js → markdown-view-Ck5s16p9.js} +2 -2
  108. package/dist/gateway/static/root/assets/mcp-conversation-setup-page-CENs3hGU.js +1 -0
  109. package/dist/gateway/static/root/assets/{media-plugins-_shnaEMY.js → media-plugins-Ba6vUE4J.js} +1 -1
  110. package/dist/gateway/static/root/assets/messages-ByFlEbsu.js +3 -0
  111. package/dist/gateway/static/root/assets/model-selector-DCBmsHzj.js +1 -0
  112. package/dist/gateway/static/root/assets/{models-hub-cache-KOJC3z6Q.js → models-hub-cache-Bd-fYUrV.js} +1 -1
  113. package/dist/gateway/static/root/assets/note-detail-panel-CnuxqWMd.js +5 -0
  114. package/dist/gateway/static/root/assets/note-image-lightbox-BFKZ7qJr.js +1 -0
  115. package/dist/gateway/static/root/assets/{notes-api-BSmikUKI.js → notes-api-8kp0X1x6.js} +1 -1
  116. package/dist/gateway/static/root/assets/{notes-page-CA0NRL8O.js → notes-page-XMdy-H3H.js} +1 -1
  117. package/dist/gateway/static/root/assets/{oauth-api-D2t9HXoC.js → oauth-api-DMMdeaNd.js} +1 -1
  118. package/dist/gateway/static/root/assets/{oauth-provider-connect-DGGGGtcB.js → oauth-provider-connect-CfOK8mPM.js} +1 -1
  119. package/dist/gateway/static/root/assets/{page-context-capture-button-BH54VO0V.js → page-context-capture-button-CKlKWSJ7.js} +1 -1
  120. package/dist/gateway/static/root/assets/{page-context-draft-BS5y8Cx9.js → page-context-draft-LF33STHC.js} +1 -1
  121. package/dist/gateway/static/root/assets/page-header-store-Du44NIEJ.js +1 -0
  122. package/dist/gateway/static/root/assets/{personal-avatar-D8DtpDTa.js → personal-avatar-D6CzIIfo.js} +1 -1
  123. package/dist/gateway/static/root/assets/personal-page-CIMMSI25.js +1 -0
  124. package/dist/gateway/static/root/assets/{personal-settings-panel-9uDaNJy5.js → personal-settings-panel-wKdlrfPq.js} +1 -1
  125. package/dist/gateway/static/root/assets/{phone-dependencies-card-DLYrI0C4.js → phone-dependencies-card-CDhk5277.js} +1 -1
  126. package/dist/gateway/static/root/assets/phone-model-connection-DZ-ZunPz.js +1 -0
  127. package/dist/gateway/static/root/assets/{phone-model-picker-BbA2iI-3.js → phone-model-picker-DuZc5jYO.js} +1 -1
  128. package/dist/gateway/static/root/assets/phone-settings-page-0u0GQl_R.js +1 -0
  129. package/dist/gateway/static/root/assets/{phone-workspace-store-CVDk80Bf.js → phone-workspace-store-SN7hfddU.js} +1 -1
  130. package/dist/gateway/static/root/assets/plugin-details-dialog-Bfc-Wmrd.js +1 -0
  131. package/dist/gateway/static/root/assets/{popover-select-DD8fmrxH.js → popover-select-CEMWIrtY.js} +1 -1
  132. package/dist/gateway/static/root/assets/{preference-select-fields-BVoN-lAv.js → preference-select-fields-BKeHZLXZ.js} +1 -1
  133. package/dist/gateway/static/root/assets/{product-automation-feedback-DCo90zGh.js → product-automation-feedback-BPur0vyo.js} +2 -2
  134. package/dist/gateway/static/root/assets/{product-open-page-OWl8IAoY.js → product-open-page-Bfd7R483.js} +1 -1
  135. package/dist/gateway/static/root/assets/{product-preview-content-Cjas7UNe.js → product-preview-content-Bnq68oVw.js} +1 -1
  136. package/dist/gateway/static/root/assets/{product-preview-modal-CPWRvBI9.js → product-preview-modal-BPmTeweh.js} +2 -2
  137. package/dist/gateway/static/root/assets/project-detail-page-D9nnyvrI.js +7 -0
  138. package/dist/gateway/static/root/assets/{project-understanding-Ba02SFzB.js → project-understanding-DLvxAoTT.js} +1 -1
  139. package/dist/gateway/static/root/assets/projects-page-BGy1pw9a.js +1 -0
  140. package/dist/gateway/static/root/assets/{providers-api-rwQ4LWzr.js → providers-api-DOnNfkwQ.js} +1 -1
  141. package/dist/gateway/static/root/assets/{recording-upload-BSmvRrZQ.js → recording-upload-CHFJbqW1.js} +1 -1
  142. package/dist/gateway/static/root/assets/{refresh-button-bU_0NarN.js → refresh-button-DiWdGAaX.js} +1 -1
  143. package/dist/gateway/static/root/assets/{registry-api-Vy7LfH6E.js → registry-api-DFDvOTg4.js} +1 -1
  144. package/dist/gateway/static/root/assets/{remote-access-hub-UXrnpGev.js → remote-access-hub-BVqwnOqO.js} +1 -1
  145. package/dist/gateway/static/root/assets/{resource-unavailable-f9OzSi4W.js → resource-unavailable-TQcRCpAg.js} +1 -1
  146. package/dist/gateway/static/root/assets/route-preload-DI43HQV_.js +2 -0
  147. package/dist/gateway/static/root/assets/{runtime-tools-api-Bt8t37z5.js → runtime-tools-api-9o3Wfji1.js} +1 -1
  148. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DU4UXnBm.js → runtime-tools-settings-panel-ccVBG-bZ.js} +1 -1
  149. package/dist/gateway/static/root/assets/{schema-form-BKeP5G7b.js → schema-form-C-jw6Hid.js} +1 -1
  150. package/dist/gateway/static/root/assets/{secret-input-BQvFXqzz.js → secret-input-Dryrns2s.js} +1 -1
  151. package/dist/gateway/static/root/assets/{service-recommendation-list-CuYsRcBB.js → service-recommendation-list-CNghOavt.js} +1 -1
  152. package/dist/gateway/static/root/assets/{session-api-DJI9eSgw.js → session-api-Bs3r_d2_.js} +1 -1
  153. package/dist/gateway/static/root/assets/session-manager-Bnq3qpqy.js +23 -0
  154. package/dist/gateway/static/root/assets/sessions-page-CyBj1Xw2.js +1 -0
  155. package/dist/gateway/static/root/assets/settings-advanced-gate-BI4DMz4_.js +1 -0
  156. package/dist/gateway/static/root/assets/{settings-advanced-section-BxUuF_yi.js → settings-advanced-section-DwpPPxT0.js} +1 -1
  157. package/dist/gateway/static/root/assets/{settings-mode-store-CaoRh2gt.js → settings-mode-store-CiRpsdTJ.js} +1 -1
  158. package/dist/gateway/static/root/assets/{settings-page-qQ8-6dJ_.js → settings-page-Cd8Ermnn.js} +1 -1
  159. package/dist/gateway/static/root/assets/{settings-page-header-CyUHrn7c.js → settings-page-header-BZl4AMiN.js} +1 -1
  160. package/dist/gateway/static/root/assets/{settings-page-layout-DGVqXrlp.js → settings-page-layout-onhEgq-K.js} +1 -1
  161. package/dist/gateway/static/root/assets/setup-interaction-page-Cvvj6JyV.js +1 -0
  162. package/dist/gateway/static/root/assets/setup-status-panel-D4qgE7QM.js +1 -0
  163. package/dist/gateway/static/root/assets/share-link-dialog-DA0QuFOD.js +1 -0
  164. package/dist/gateway/static/root/assets/{share-preview-page-Cem96FbB.js → share-preview-page-YDpIY4dC.js} +1 -1
  165. package/dist/gateway/static/root/assets/{shares-api-Dowes16l.js → shares-api-D8Q-m46d.js} +1 -1
  166. package/dist/gateway/static/root/assets/shares-settings-DUvjOMmA.js +1 -0
  167. package/dist/gateway/static/root/assets/{skill-api-D8ZwFEVe.js → skill-api-uKU4sRiv.js} +1 -1
  168. package/dist/gateway/static/root/assets/{skill-list-api-B4gp00-f.js → skill-list-api-BzKzG-xG.js} +1 -1
  169. package/dist/gateway/static/root/assets/{skill-reload-api-ClmaaDXo.js → skill-reload-api-DkUXekcd.js} +1 -1
  170. package/dist/gateway/static/root/assets/skills-page-ClyNSh-7.js +2 -0
  171. package/dist/gateway/static/root/assets/{system-settings-panel-D095uacX.js → system-settings-panel-BN6sUX0H.js} +1 -1
  172. package/dist/gateway/static/root/assets/task-detail-page-CS9m7Ipo.js +2 -0
  173. package/dist/gateway/static/root/assets/{task-result-evidence-LUrJlUhb.js → task-result-evidence-DKygspo2.js} +1 -1
  174. package/dist/gateway/static/root/assets/{terminal-panel-store-BqEDB1Vl.js → terminal-panel-store-DJVC7HqA.js} +1 -1
  175. package/dist/gateway/static/root/assets/{theme-store-gAcojLgP.js → theme-store-Dlnmgryi.js} +1 -1
  176. package/dist/gateway/static/root/assets/tool-friendly-title-DcCc6g7o.js +1 -0
  177. package/dist/gateway/static/root/assets/tracing-settings-page-Bs76WeoF.js +1 -0
  178. package/dist/gateway/static/root/assets/{tunnel-api-C9u9E3UQ.js → tunnel-api-B7nx0NQJ.js} +1 -1
  179. package/dist/gateway/static/root/assets/{understanding-activity-store-BTrzsR6_.js → understanding-activity-store-C4bblRnQ.js} +1 -1
  180. package/dist/gateway/static/root/assets/{understanding-refresh-store-5Qava3jh.js → understanding-refresh-store-BvCj9-Ue.js} +1 -1
  181. package/dist/gateway/static/root/assets/{usage-page-DFMLYKAc.js → usage-page-anU5gslJ.js} +1 -1
  182. package/dist/gateway/static/root/assets/{use-autosave-3O-X7x15.js → use-autosave-YHxQ-UZg.js} +1 -1
  183. package/dist/gateway/static/root/assets/use-composer-attachments-DYY3Yz4a.js +2 -0
  184. package/dist/gateway/static/root/assets/use-file-preview-expanded-CYgWzDnv.js +2 -0
  185. package/dist/gateway/static/root/assets/{use-personal-profile-MusPgljM.js → use-personal-profile-D2Un8G1L.js} +1 -1
  186. package/dist/gateway/static/root/assets/{use-workspace-tree-Ck_U2yTw.js → use-workspace-tree-Dkg9tUr4.js} +1 -1
  187. package/dist/gateway/static/root/assets/user-model-page-DIgPL3tN.js +2 -0
  188. package/dist/gateway/static/root/assets/{voice-api-key-field-C5zJApoa.js → voice-api-key-field-BUes-Jlp.js} +1 -1
  189. package/dist/gateway/static/root/assets/{voice-config-api-DC1bYDt1.js → voice-config-api-CrULrSKC.js} +1 -1
  190. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-0SZjJdVV.js → voice-input-shortcut-events-DFMNIyy4.js} +1 -1
  191. package/dist/gateway/static/root/assets/voice-transcribe-api-Dy4hfftb.js +1 -0
  192. package/dist/gateway/static/root/assets/{work-discovery-overlay-DAQ8McVe.js → work-discovery-overlay-CFF4cRFl.js} +1 -1
  193. package/dist/gateway/static/root/assets/{work-discovery-page-DUQysEyb.js → work-discovery-page-BnYaVH3V.js} +1 -1
  194. package/dist/gateway/static/root/assets/working-directory-picker-modal-GFwVefVA.js +1 -0
  195. package/dist/gateway/static/root/assets/{workspace-api-ZrN6yUER.js → workspace-api-BdB4NEOh.js} +2 -2
  196. package/dist/gateway/static/root/assets/workspace-editor-agent-store-4cZ26iaD.js +1 -0
  197. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-Yj_kBWSb.js → workspace-file-preview-dialog-NRL3YRjg.js} +1 -1
  198. package/dist/gateway/static/root/assets/{workspace-open-location-menu-yxT7wajO.js → workspace-open-location-menu-Dcij7wvJ.js} +1 -1
  199. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-IcH9KDzx.js → xopc-cloud-account-card-DC9aG7Pl.js} +1 -1
  200. package/dist/gateway/static/root/index.html +100 -98
  201. package/dist/package.js +1 -1
  202. package/dist/packages/gateway-contract/src/automations.js +7 -0
  203. package/dist/packages/gateway-contract/src/capabilities.js +1 -1
  204. package/dist/src/agent/agent-manager.d.ts +1 -0
  205. package/dist/src/agent/agent-manager.js +1 -0
  206. package/dist/src/agent/child-agent-factory.js +1 -1
  207. package/dist/src/agent/data-acquisition/service.js +1 -1
  208. package/dist/src/agent/embedded/configuration-capability-correction.d.ts +3 -0
  209. package/dist/src/agent/embedded/configuration-capability-correction.js +14 -0
  210. package/dist/src/agent/embedded/run-for-session.js +20 -5
  211. package/dist/src/agent/embedded/run-turn.js +13 -1
  212. package/dist/src/agent/embedded/session-runner.js +6 -3
  213. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  214. package/dist/src/agent/image/load-image-media.js +1 -1
  215. package/dist/src/agent/inbound/inbound-loop.js +4 -1
  216. package/dist/src/agent/independent-execution.js +1 -1
  217. package/dist/src/agent/mcp/config.js +1 -1
  218. package/dist/src/agent/mcp/connection-drafts.d.ts +3 -1
  219. package/dist/src/agent/mcp/connection-drafts.js +3 -2
  220. package/dist/src/agent/mcp/connection-setup.js +34 -2
  221. package/dist/src/agent/mcp/conversation-setup.d.ts +163 -0
  222. package/dist/src/agent/mcp/conversation-setup.js +621 -0
  223. package/dist/src/agent/mcp/native-mcp.d.ts +1 -0
  224. package/dist/src/agent/mcp/tool-catalog.d.ts +5 -0
  225. package/dist/src/agent/mcp/tool-catalog.js +19 -2
  226. package/dist/src/agent/mcp/weixin-setup-scope.d.ts +12 -0
  227. package/dist/src/agent/mcp/weixin-setup-scope.js +43 -0
  228. package/dist/src/agent/prompt/conversational-configuration-guide.js +2 -1
  229. package/dist/src/agent/prompt/sections/tooling.js +3 -2
  230. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  231. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  232. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  233. package/dist/src/agent/service.d.ts +2 -0
  234. package/dist/src/agent/service.js +11 -1
  235. package/dist/src/agent/service.types.d.ts +1 -0
  236. package/dist/src/agent/tasks/task-judge-service.js +2 -2
  237. package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +6 -4
  238. package/dist/src/agent/tool-manuals/xopc-configuration.js +92 -8
  239. package/dist/src/agent/tools/automation-tool.d.ts +9 -1
  240. package/dist/src/agent/tools/automation-tool.js +34 -5
  241. package/dist/src/agent/tools/create-share-tool.js +1 -1
  242. package/dist/src/agent/tools/factory.d.ts +3 -0
  243. package/dist/src/agent/tools/factory.js +34 -23
  244. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  245. package/dist/src/agent/tools/index.d.ts +1 -0
  246. package/dist/src/agent/tools/index.js +5 -4
  247. package/dist/src/agent/tools/mcp-setup-tool.d.ts +9 -0
  248. package/dist/src/agent/tools/mcp-setup-tool.js +32 -0
  249. package/dist/src/agent/tools/personal-task-tool.js +2 -2
  250. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  251. package/dist/src/agent/tools/read.js +1 -1
  252. package/dist/src/agent/tools/skill-install-tool.js +56 -1
  253. package/dist/src/agent/tools/skill-manage-tool.d.ts +4 -0
  254. package/dist/src/agent/tools/skill-manage-tool.js +74 -2
  255. package/dist/src/agent/tools/skills-tools.js +1 -1
  256. package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
  257. package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
  258. package/dist/src/agent/tools/tool-manual-tool.js +3 -1
  259. package/dist/src/agent/tools/toolExposure.js +2 -0
  260. package/dist/src/agent/tools/write.js +1 -1
  261. package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
  262. package/dist/src/agent/tools/xopc-use-tool.js +60 -10
  263. package/dist/src/agent-catalog/service.d.ts +1 -1
  264. package/dist/src/agent-catalog/service.js +2 -1
  265. package/dist/src/automations/capabilities/drafts.js +5 -2
  266. package/dist/src/automations/capabilities/read.js +18 -7
  267. package/dist/src/automations/capabilities/write.d.ts +111 -52
  268. package/dist/src/automations/capabilities/write.js +44 -10
  269. package/dist/src/automations/delivery/delivery-router.d.ts +1 -0
  270. package/dist/src/automations/delivery/delivery-router.js +7 -1
  271. package/dist/src/automations/domain/types.d.ts +8 -0
  272. package/dist/src/automations/domain/validation.d.ts +24 -0
  273. package/dist/src/automations/domain/validation.js +7 -0
  274. package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -0
  275. package/dist/src/automations/index.js +2 -2
  276. package/dist/src/automations/mcp-source.d.ts +60 -0
  277. package/dist/src/automations/mcp-source.js +173 -0
  278. package/dist/src/automations/service/action-executor.js +15 -1
  279. package/dist/src/automations/service/automation-service.d.ts +5 -0
  280. package/dist/src/automations/service/automation-service.js +52 -2
  281. package/dist/src/automations/service/index.js +2 -2
  282. package/dist/src/browser/setup/repository.d.ts +1 -0
  283. package/dist/src/browser/setup/repository.js +7 -1
  284. package/dist/src/browser/setup/service.d.ts +3 -0
  285. package/dist/src/browser/setup/service.js +41 -18
  286. package/dist/src/browser/setup/types.d.ts +1 -0
  287. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  288. package/dist/src/channels/index.js +1 -1
  289. package/dist/src/channels/manager.d.ts +1 -0
  290. package/dist/src/channels/outbound-sender.d.ts +1 -0
  291. package/dist/src/channels/outbound-sender.js +3 -0
  292. package/dist/src/channels/pairing/pairing-service.js +1 -1
  293. package/dist/src/channels/weixin/account-identity.d.ts +2 -0
  294. package/dist/src/channels/weixin/account-identity.js +15 -0
  295. package/dist/src/chat-commands/builtins/config.js +1 -1
  296. package/dist/src/cli/commands/backup.js +1 -1
  297. package/dist/src/cli/commands/channels.js +2 -2
  298. package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -1
  299. package/dist/src/cli/commands/mcp.js +1 -1
  300. package/dist/src/config/models-json.d.ts +12 -0
  301. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  302. package/dist/src/extensions/agent-plugins/setup.d.ts +1 -1
  303. package/dist/src/extensions/agent-plugins/setup.js +3 -3
  304. package/dist/src/extensions/api.js +1 -1
  305. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  306. package/dist/src/gateway/agents-admin.js +1 -1
  307. package/dist/src/gateway/device-routes.js +1 -1
  308. package/dist/src/gateway/global-defaults-admin.js +1 -1
  309. package/dist/src/gateway/hono/app.js +1 -1
  310. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  311. package/dist/src/gateway/hono/oauth-async.js +1 -1
  312. package/dist/src/gateway/hono/routes/channels.js +1 -1
  313. package/dist/src/gateway/hono/routes/config.js +1 -1
  314. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  315. package/dist/src/gateway/hono/routes/mcp.js +39 -2
  316. package/dist/src/gateway/hono/routes/notes.js +2 -2
  317. package/dist/src/gateway/hono/routes/phone-setup.js +45 -16
  318. package/dist/src/gateway/hono/routes/phone.js +2 -4
  319. package/dist/src/gateway/hono/routes/projects.js +1 -1
  320. package/dist/src/gateway/hono/routes/provider-setup.js +1 -1
  321. package/dist/src/gateway/hono/routes/public-gateway.js +22 -0
  322. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  323. package/dist/src/gateway/hono/routes/shares.js +1 -1
  324. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  325. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  326. package/dist/src/gateway/media-access.js +1 -1
  327. package/dist/src/gateway/service/agent-runner.d.ts +1 -0
  328. package/dist/src/gateway/service/agent-runner.js +3 -1
  329. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  330. package/dist/src/gateway/service/config-coordinator.js +2 -1
  331. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  332. package/dist/src/gateway/service/sessions-api.js +2 -1
  333. package/dist/src/gateway/service.d.ts +5 -1
  334. package/dist/src/gateway/service.js +86 -12
  335. package/dist/src/gateway/session-context-summary.js +1 -1
  336. package/dist/src/gateway/session-reset-service.d.ts +1 -0
  337. package/dist/src/gateway/session-reset-service.js +15 -2
  338. package/dist/src/gateway/xopc-cloud-capability-setup.js +9 -1
  339. package/dist/src/notes/service.js +1 -1
  340. package/dist/src/personal-agent/prompts.js +1 -1
  341. package/dist/src/personal-agent/reply-composer.js +2 -2
  342. package/dist/src/personal-agent/request-service.js +3 -3
  343. package/dist/src/personal-agent/service.js +1 -1
  344. package/dist/src/personal-agent/task-cancel.js +1 -1
  345. package/dist/src/phone/cloud-adb-connection.js +8 -5
  346. package/dist/src/phone/contracts.d.ts +4 -0
  347. package/dist/src/phone/contracts.js +6 -1
  348. package/dist/src/phone/gui-protocol.d.ts +7 -0
  349. package/dist/src/phone/gui-protocol.js +302 -0
  350. package/dist/src/phone/model-adapter.d.ts +1 -1
  351. package/dist/src/phone/model-adapter.js +7 -4
  352. package/dist/src/phone/runtime.js +8 -2
  353. package/dist/src/phone/setup/service.d.ts +14 -4
  354. package/dist/src/phone/setup/service.js +106 -28
  355. package/dist/src/phone/ui-dump-binary.d.ts +1 -1
  356. package/dist/src/phone/ui-dump-binary.js +1 -1
  357. package/dist/src/phone/ui-session.d.ts +2 -0
  358. package/dist/src/phone/ui-session.js +23 -4
  359. package/dist/src/projects/index.js +1 -1
  360. package/dist/src/projects/project-service.js +1 -1
  361. package/dist/src/providers/env-keys.js +2 -0
  362. package/dist/src/providers/index.js +11 -0
  363. package/dist/src/providers/model-catalog-types.d.ts +1 -1
  364. package/dist/src/providers/model-supplements.d.ts +1 -1
  365. package/dist/src/providers/model-supplements.js +6 -3
  366. package/dist/src/providers/phone-models.d.ts +3 -0
  367. package/dist/src/providers/phone-models.js +33 -0
  368. package/dist/src/providers/presentation.js +0 -1
  369. package/dist/src/runtime-tools/phone-dependencies.d.ts +2 -0
  370. package/dist/src/runtime-tools/phone-dependencies.js +10 -0
  371. package/dist/src/share/note-share-service.js +1 -1
  372. package/dist/src/share/site-proxy.js +1 -1
  373. package/dist/src/tasks/capabilities/write.js +1 -1
  374. package/dist/src/tasks/index.js +1 -1
  375. package/dist/src/tasks/task-allocation-service.js +3 -3
  376. package/dist/src/tasks/task-application-service.js +2 -2
  377. package/dist/src/tasks/task-context-assembler.js +1 -1
  378. package/dist/src/tasks/task-contract-planner.js +1 -1
  379. package/dist/src/tasks/task-handoff.js +1 -1
  380. package/dist/src/tasks/task-research-result.js +1 -1
  381. package/dist/src/tasks/task-run-coordinator.js +2 -2
  382. package/dist/src/tui/backends/embedded-backend.js +1 -1
  383. package/dist/src/tui/tui.js +1 -1
  384. package/dist/src/voice/platform-catalog.d.ts +1 -1
  385. package/package.json +3 -1
  386. package/skills/tools/configure-xopc/SKILL.md +10 -3
  387. package/skills/tools/configure-xopc/references/browser/chrome-extension.md +4 -1
  388. package/skills/tools/configure-xopc/references/browser/overview.md +2 -2
  389. package/skills/tools/configure-xopc/references/phone/aliyun.md +3 -2
  390. package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
  391. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DlvjxWg6.js +0 -1
  392. package/dist/gateway/static/root/assets/agent-plugin-dialog-OBueuQSc.js +0 -1
  393. package/dist/gateway/static/root/assets/agents-Cp6_5OOQ.js +0 -77
  394. package/dist/gateway/static/root/assets/app-link-1j40sJ-z.js +0 -1
  395. package/dist/gateway/static/root/assets/apps-page-C2WKUwtN.js +0 -1
  396. package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +0 -1
  397. package/dist/gateway/static/root/assets/automation-task-card-wbnR5i6N.js +0 -3
  398. package/dist/gateway/static/root/assets/automations-workspace-D6cTOKr7.js +0 -9
  399. package/dist/gateway/static/root/assets/browser-settings-page-L0nBjfhG.js +0 -3
  400. package/dist/gateway/static/root/assets/capabilities-aT-QjNTl.js +0 -1
  401. package/dist/gateway/static/root/assets/capabilities-page-DlpuHdHi.js +0 -2
  402. package/dist/gateway/static/root/assets/capabilities-settings-panel-pvqkN2-2.js +0 -8
  403. package/dist/gateway/static/root/assets/channels-BUPtawh6.js +0 -1
  404. package/dist/gateway/static/root/assets/chat-page-BP0huA-W.js +0 -72
  405. package/dist/gateway/static/root/assets/composer-payload-handoff-CYIhcczq.js +0 -1
  406. package/dist/gateway/static/root/assets/confirm-dialog-XGclfBqe.js +0 -1
  407. package/dist/gateway/static/root/assets/connected-providers-grid-CKZfhHSD.js +0 -1
  408. package/dist/gateway/static/root/assets/connectors-page-Lf1ZzaVn.js +0 -1
  409. package/dist/gateway/static/root/assets/dependency-picker-UqKVJ9dv.js +0 -1
  410. package/dist/gateway/static/root/assets/device-pairing-wizard-ByEL5lvM.js +0 -1
  411. package/dist/gateway/static/root/assets/dist-CaUuvp8-.js +0 -1
  412. package/dist/gateway/static/root/assets/dist-D3lWNSe7.js +0 -1
  413. package/dist/gateway/static/root/assets/dist-DfWfZ9iu.js +0 -1
  414. package/dist/gateway/static/root/assets/dist-DusecO_p.js +0 -1
  415. package/dist/gateway/static/root/assets/gateway-realtime-store-Bkt1z-xo.js +0 -1
  416. package/dist/gateway/static/root/assets/home-page-k9LFXcVa.js +0 -2
  417. package/dist/gateway/static/root/assets/index-CpwPxKQ8.css +0 -1
  418. package/dist/gateway/static/root/assets/index-DKW7BeT_.js +0 -11
  419. package/dist/gateway/static/root/assets/install-connector-dialog-CTQAKTPv.js +0 -1
  420. package/dist/gateway/static/root/assets/local-app-workbench-page-CD_8_gd_.js +0 -1
  421. package/dist/gateway/static/root/assets/management-settings-t_Z2mCyw.js +0 -1
  422. package/dist/gateway/static/root/assets/messages-DG4HLOER.js +0 -3
  423. package/dist/gateway/static/root/assets/model-selector-a7PIT1Lk.js +0 -1
  424. package/dist/gateway/static/root/assets/note-detail-panel-BsHYUFgk.js +0 -5
  425. package/dist/gateway/static/root/assets/note-image-lightbox-B-bEtjhj.js +0 -1
  426. package/dist/gateway/static/root/assets/page-header-store-BdZnUh-D.js +0 -1
  427. package/dist/gateway/static/root/assets/personal-page-KJezmTKP.js +0 -1
  428. package/dist/gateway/static/root/assets/phone-settings-page-Cg_BPss4.js +0 -1
  429. package/dist/gateway/static/root/assets/plugin-details-dialog-DgibLkc3.js +0 -1
  430. package/dist/gateway/static/root/assets/project-detail-page-B_HlZux_.js +0 -7
  431. package/dist/gateway/static/root/assets/projects-page-CdfKjp95.js +0 -1
  432. package/dist/gateway/static/root/assets/route-preload-BtObM-co.js +0 -2
  433. package/dist/gateway/static/root/assets/session-manager-CtKgACGl.js +0 -23
  434. package/dist/gateway/static/root/assets/sessions-page-BAsKzRHt.js +0 -1
  435. package/dist/gateway/static/root/assets/settings-advanced-gate-CjAFqg2U.js +0 -1
  436. package/dist/gateway/static/root/assets/setup-status-panel-BpaPb625.js +0 -1
  437. package/dist/gateway/static/root/assets/share-link-dialog-CQJ6Ykm2.js +0 -1
  438. package/dist/gateway/static/root/assets/shares-settings-DZEkZDR0.js +0 -1
  439. package/dist/gateway/static/root/assets/skills-page-CV0X9rvG.js +0 -2
  440. package/dist/gateway/static/root/assets/task-detail-page-CY2C4AM2.js +0 -2
  441. package/dist/gateway/static/root/assets/tool-friendly-title-o6sxGVUu.js +0 -1
  442. package/dist/gateway/static/root/assets/tracing-settings-page-B1ZRh-Is.js +0 -1
  443. package/dist/gateway/static/root/assets/use-composer-attachments-BLc4dBfe.js +0 -2
  444. package/dist/gateway/static/root/assets/use-file-preview-expanded-BaOmTXsT.js +0 -2
  445. package/dist/gateway/static/root/assets/user-model-page-Den5Lg-k.js +0 -2
  446. package/dist/gateway/static/root/assets/voice-transcribe-api-CxVeANPX.js +0 -1
  447. package/dist/gateway/static/root/assets/working-directory-picker-modal-BO9qdJyZ.js +0 -1
  448. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Bo5dwoWP.js +0 -1
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Bg_XR36n.js";import{t as l}from"./createLucideIcon-DPHK1VkS.js";import{n as u,r as d}from"./popover-select-DD8fmrxH.js";import{t as f}from"./circle-check-C23XjkUj.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./secret-input-BQvFXqzz.js";import{t as h}from"./loader-circle-CifKLtgG.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./cn-0WouolD0.js";import{t as v}from"./button-CnRSIP6m.js";import{t as y}from"./skeleton-BI5TyibZ.js";import{a as b,i as ee,n as x,o as te,r as ne,s as S,t as re}from"./dist-DfWfZ9iu.js";import{n as C}from"./interaction-BdhHBbYa.js";import{A as w,N as T,f as E,g as D,h as ie,j as O,k,p as A,w as j,z as M}from"./connectors-api-BjypBp2g.js";import{s as N}from"./form-field-width-DJw_jULe.js";import{n as P}from"./electron-env-DHOGevH3.js";import{t as F}from"./oauth-provider-connect-DGGGGtcB.js";var I=l(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function L(e,t){let n={};for(let t of e.setup.secrets??[])n[t.key]=``;let r={};for(let t of e.setup.config??[])r[t.key]=t.defaultValue===void 0?``:typeof t.defaultValue==`string`?t.defaultValue:JSON.stringify(t.defaultValue,null,2);return{connector:e,secrets:n,config:r,installing:!1,error:null,result:null,health:null,...t?{store:t}:{}}}var R=n(),z=e(t(),1),B=r();async function V(e,t){let n=await c(o(e),t);if(!n.ok)throw Error(n.error??`Connection request failed.`);return n.payload}function H({definition:e,instance:t,onClose:n,onChanged:r}){let i=s(e=>e.language)===`zh`,[c,l]=(0,z.useState)(t),[f,p]=(0,z.useState)(),[m,_]=(0,z.useState)(),[x,C]=(0,z.useState)(),[w,E]=(0,z.useState)(),[D,O]=(0,z.useState)(!1),[A,M]=(0,z.useState)(),N=c?.instanceId??e.id,P=(0,z.useCallback)(async()=>{let e=await V(`/api/connectors/${encodeURIComponent(N)}/accounts`);p(e),e.authorization&&_(e.authorization)},[N]);(0,z.useEffect)(()=>{c&&P().catch(e=>M(String(e)))},[c,P]);let F=m&&[`preparing`,`awaiting_user`,`verifying`].includes(m.status);(0,z.useEffect)(()=>{if(!F||!m)return;let e=!1,t=!1,n=async()=>{if(!t){t=!0;try{let t=await V(`/api/connectors/authorizations/${m.id}`);if(e)return;_(t.authorization),t.authorization.status===`succeeded`&&(await P(),c&&await r(c))}catch(t){e||M(String(t))}finally{t=!1}}},i=()=>{n()},a=()=>{document.visibilityState===`visible`&&i()};i();let o=setInterval(i,1500);return window.addEventListener(`focus`,i),document.addEventListener(`visibilitychange`,a),()=>{e=!0,clearInterval(o),window.removeEventListener(`focus`,i),document.removeEventListener(`visibilitychange`,a)}},[F,m?.id,c,r,P]);let I=m?.challenge?.type===`qr_code`?m.challenge.artifactId:void 0;(0,z.useEffect)(()=>{if(!I){C(void 0);return}let e=!1,t;return a(o(`/api/connectors/authorizations/${I}/artifact`)).then(async n=>{if(!n.ok)throw Error(`QR code unavailable.`);let r=await n.blob();e||(t=URL.createObjectURL(r),C(t))}).catch(t=>{e||M(String(t))}),()=>{e=!0,t&&URL.revokeObjectURL(t)}},[I]);let L=async t=>{O(!0),M(void 0);try{let n=c??await ie(e.id,{});l(n);let r=await V(`/api/connectors/${encodeURIComponent(n.instanceId)}/authorizations`,{method:`POST`,body:JSON.stringify({accountId:t})});_(r.authorization)}catch(e){M(e instanceof Error?e.message:String(e))}finally{O(!1)}},R=async e=>{O(!0),M(void 0);try{await V(`/api/connectors/${encodeURIComponent(N)}/policy`,{method:`PATCH`,body:JSON.stringify({maxScope:e})}),await P()}catch(e){M(String(e))}finally{O(!1)}},H=async e=>{O(!0),M(void 0);try{await V(`/api/connectors/accounts/${encodeURIComponent(e)}`,{method:`DELETE`}),await P()}catch(e){M(String(e))}finally{O(!1)}},U=async e=>{if(c){O(!0),M(void 0);try{if(e===`remove`)await j(N),await r(c),n();else if(e===`toggle`){let e=await k(N,!c.enabled);l(e),await r(e)}else{let e=await T(N);E(e.ok?i?`验证通过,可用操作:${e.toolCount}`:`Verified: ${e.toolCount} actions`:e.error??e.action??e.status)}}catch(e){M(String(e))}finally{O(!1)}}},W=()=>{c&&r(c),n()};return(0,B.jsx)(re,{open:!0,onOpenChange:e=>{e||W()},children:(0,B.jsxs)(te,{children:[(0,B.jsx)(b,{className:`fixed inset-0 z-50 bg-black/40`}),(0,B.jsxs)(ne,{className:`fixed left-1/2 top-1/2 z-50 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay text-fg`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge p-5`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(S,{className:`font-semibold`,children:e.displayName}),(0,B.jsx)(ee,{className:`mt-1 text-sm text-fg-muted`,children:i?`连接账号并设置允许的操作。`:`Connect an account and choose allowed actions.`})]}),(0,B.jsx)(v,{variant:`ghost`,onClick:W,"aria-label":i?`关闭`:`Close`,children:(0,B.jsx)(g,{className:`size-4`})})]}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[A?(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-red-600`,children:A}):null,c&&!f?(0,B.jsx)(y,{className:`h-24 w-full`}):null,c?(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsx)(v,{disabled:D||!!F,onClick:()=>void U(`toggle`),children:c.enabled?i?`停用`:`Disable`:i?`启用`:`Enable`}),(0,B.jsx)(v,{disabled:D||!!F||!c.enabled,onClick:()=>void U(`test`),children:i?`检查连接`:`Check connection`}),(0,B.jsx)(v,{variant:`ghost`,disabled:D||!!F,onClick:()=>void U(`remove`),children:i?`移除连接`:`Remove connection`})]}):null,w?(0,B.jsx)(`p`,{className:`text-sm text-fg-muted`,children:w}):null,f?.accounts.map(e=>(0,B.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,B.jsx)(`p`,{className:`text-sm font-medium`,children:e.label??e.id}),(0,B.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:String(e.identity.openId??e.identity.botId??e.identity.userId??e.id)}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.enabled&&e.status===`active`?i?`已连接`:`Connected`:i?`已断开`:`Disconnected`}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(v,{variant:`secondary`,disabled:D||!!F||c?.enabled===!1,onClick:()=>void L(e.id),children:i?`重新连接`:`Reconnect`}),(0,B.jsx)(v,{variant:`ghost`,disabled:D||!!F||!e.enabled,onClick:()=>void H(e.id),children:i?`断开本地连接`:`Disconnect locally`})]})]},e.id)),f?.policy?(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`p`,{className:`text-sm`,children:i?`允许的操作`:`Allowed actions`}),(0,B.jsxs)(u,{value:f.policy.maxScope,onChange:e=>void R(e.target.value),disabled:D,children:[(0,B.jsx)(d,{value:`read`,children:i?`仅查看`:`Read only`}),(0,B.jsx)(d,{value:`write`,children:i?`查看并执行操作`:`Read and write`})]}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`写入操作需要确认。断开本地连接不会撤销第三方授权。`:`Writes require confirmation. Local disconnection does not revoke provider authorization.`})]}):null,m?(0,B.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-edge p-4`,"aria-live":`polite`,children:[(0,B.jsx)(`p`,{className:`text-sm`,children:m.status===`succeeded`?i?`账号验证成功`:`Account verified`:m.status===`preparing`?i?`正在准备授权…`:`Preparing authorization…`:m.status===`verifying`?i?`授权已完成,正在验证账号…`:`Authorization complete. Verifying account…`:F?i?`请完成当前步骤,返回后会自动检查结果。`:`Complete this step. We will check the result when you return.`:m.error??(i?`授权已结束,请重新连接。`:`Authorization ended. Connect again.`)}),F&&m.challenge&&m.challenge.totalSteps>1?(0,B.jsxs)(`p`,{className:`text-sm font-medium`,children:[i?`第 ${m.challenge.step} / ${m.challenge.totalSteps} 步`:`Step ${m.challenge.step} of ${m.challenge.totalSteps}`,m.challenge.step>1?i?`:上一步已完成,请打开新的授权页面继续。`:`: Previous step complete. Open the new authorization page to continue.`:i?`:完成后还需要继续授权账号。`:`: Account authorization follows this step.`]}):null,F&&m.challenge?.type===`open_url`?(0,B.jsx)(`a`,{href:m.challenge.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm text-accent underline`,children:i?`打开授权页面`:`Open authorization page`},m.challenge.url):null,F&&I?x?(0,B.jsx)(`img`,{src:x,alt:i?`授权二维码`:`Authorization QR code`,className:`mx-auto size-56 bg-white object-contain`}):(0,B.jsx)(y,{className:`mx-auto size-56`}):null,F?(0,B.jsx)(v,{variant:`secondary`,onClick:()=>{V(`/api/connectors/authorizations/${m.id}/cancel`,{method:`POST`}).then(()=>_({...m,status:`cancelled`,challenge:void 0})).catch(e=>M(String(e)))},children:i?`取消授权`:`Cancel authorization`}):null]}):null]}),(0,B.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge p-4`,children:[(0,B.jsx)(v,{variant:`secondary`,onClick:W,children:i?`关闭`:`Close`}),(0,B.jsxs)(v,{disabled:D||!!F||c?.enabled===!1,onClick:()=>void L(),children:[D?(0,B.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,i?`连接账号`:`Connect account`]})]})]})]})})}function U(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e)}function W(e,t){return e.runtime.type===`composio`?t.connectorDescriptions[e.runtime.toolkit.toLowerCase()]??e.description:e.description}function G(e){return e instanceof Error?e.message:String(e)}function K(e,t){let n=G(e);return/APIKey_InsufficientPermissions/i.test(n)||/["\\]?code["\\]?\s*:\s*812\b/i.test(n)||/session_management/i.test(n)&&/write access|write permission|at least ["\\]?write/i.test(n)?t.composioSessionWritePermissionRequired:n}var q={sm:{frame:`size-9 rounded-lg`,image:`size-7`,fallback:`size-4`},md:{frame:`size-10 rounded-xl`,image:`size-8`,fallback:`size-5`},lg:{frame:`size-12 rounded-xl`,image:`size-10`,fallback:`size-5`}};function J(e){let t=(0,R.c)(15),{connector:n,size:r,className:i}=e,a=r===void 0?`md`:r,o=n?.branding?.logoUrl,[s,c]=(0,z.useState)(!1),l=q[a],u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{c(!1)},t[0]=u):u=t[0];let d;t[1]===o?d=t[2]:(d=[o],t[1]=o,t[2]=d),(0,z.useEffect)(u,d);let f;t[3]!==i||t[4]!==l.frame?(f=_(`flex shrink-0 items-center justify-center overflow-hidden border border-edge bg-white`,l.frame,i),t[3]=i,t[4]=l.frame,t[5]=f):f=t[5];let p=n?.displayName,m;t[6]!==l.fallback||t[7]!==l.image||t[8]!==s||t[9]!==o?(m=o&&!s?(0,B.jsx)(`img`,{src:o,alt:``,loading:`lazy`,draggable:!1,className:_(`object-contain`,l.image),onError:()=>c(!0)}):(0,B.jsx)(I,{className:_(`text-fg-muted`,l.fallback),"aria-hidden":!0}),t[6]=l.fallback,t[7]=l.image,t[8]=s,t[9]=o,t[10]=m):m=t[10];let h;return t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,B.jsx)(`span`,{className:f,title:p,children:m}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}var Y=_(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,N),ae=_(Y,`min-h-28 font-mono`);function oe(e,t){return e?t.healthStatusLabels[e]??e:t.healthStatusPending}function se(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function X({draft:e,onChange:t,onClose:n,onInstalled:r,t:a}){let{connector:o}=e,s=W(o,a),c=o.runtime.type===`composio`&&o.runtime.role===`toolkit`,l=o.runtime.type===`composio`&&o.runtime.role===`toolkit`?o.runtime.toolkit:null,k=o.understanding!=null,[j,N]=(0,z.useState)(!c),[L,R]=(0,z.useState)(null),[V,H]=(0,z.useState)(c),[G,q]=(0,z.useState)(null),[X,ce]=(0,z.useState)(null),[Z,le]=(0,z.useState)(!1),[Q,ue]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!c)return;let e=!1;return E().then(t=>{e||(R(t),N(t.configured))}).catch(t=>{e||q(t instanceof Error?t.message:String(t))}).finally(()=>{e||H(!1)}),()=>{e=!0}},[o.id,c]),(0,z.useEffect)(()=>{if(!l||!j)return;let e=!1;return le(!0),A(l).then(t=>{e||ce(t)}).catch(t=>{e||q(t instanceof Error?t.message:String(t))}).finally(()=>{e||le(!1)}),()=>{e=!0}},[j,l]);let de=(0,z.useCallback)(async()=>{let n=P(),i=c&&!n?window.open(``,`_blank`):null;i&&(i.opener=null),q(null),t({...e,installing:!0,error:null,result:null,health:null});try{if(c&&!j)throw Error(a.composioSetupSignInRequired);let s=c&&l?X??await A(l):null,u=e.config.authConfigId?.trim();if(s?.requiresCustomAuthConfig&&!u)throw Error(a.composioAuthConfigRequired);if(u){let e=s?.authConfigs.find(e=>e.id===u);if(!e||e.status!==`ENABLED`||!e.isEnabledForToolRouter)throw Error(a.composioAuthConfigUnavailable)}let d={};for(let t of o.setup.config??[]){let n=se(t.type,e.config[t.key]??``);n!==void 0&&(d[t.key]=n)}u&&(d.authConfigId=u);let f=e.store?await D(e.store.packageName,{secrets:e.secrets,config:d},e.store.version,e.store.reviewHash):await ie(o.id,{secrets:e.secrets,config:d,definition:o.source===`registry`?o:void 0}),p=null;try{if(c){let e=await O(o.id);if(!e.authorizationUrl)throw Error(`The connection service did not return an authorization URL.`);if(n){let t=await window.electronAPI?.shell?.openExternalUrl(e.authorizationUrl);if(!t?.ok)throw Error(t?.error??`Could not open the system browser.`)}else i?i.location.href=e.authorizationUrl:window.open(e.authorizationUrl,`_blank`,`noopener,noreferrer`);let t=await M(l,e.connectionId,12e4,e.attemptId);if(i?.close(),k&&Q){if(!t.accountId)throw Error(`Connector account is unavailable.`);await w(t.accountId)}}}catch(n){i?.close(),t({...e,installing:!1,result:null,health:null,error:c?K(n,a):n instanceof Error?n.message:String(n)}),await r(f);return}if(f.materialized.type===`cli`||f.materialized.type===`mcp`)try{p=await T(f.instanceId)}catch{p=null}t({...e,installing:!1,result:f,health:p}),await r(f)}catch(n){i?.close(),t({...e,installing:!1,error:n instanceof Error?n.message:String(n)})}},[k,X,j,l,o,e,c,Q,t,r,a.composioAuthConfigRequired,a.composioAuthConfigUnavailable,a.composioSetupSignInRequired]),fe=X?.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter)??[],$=X?.requiresCustomAuthConfig===!0,pe=j&&$&&!e.config.authConfigId?.trim();return(0,B.jsx)(re,{open:!0,onOpenChange:e=>{e||n()},children:(0,B.jsxs)(te,{children:[(0,B.jsx)(b,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,B.jsxs)(ne,{className:_(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,c?`max-h-[calc(100dvh-2rem)] w-[min(100%-2rem,32rem)]`:`h-[min(100dvh-2rem,36rem)] w-[min(100%-2rem,42rem)]`,`rounded-2xl border border-edge bg-surface-overlay shadow-float dark:border-edge`),children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,B.jsx)(J,{connector:o,size:`lg`}),(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(S,{className:`text-base font-semibold text-fg`,children:U(a.connectDialogTitle,{name:o.displayName})}),(0,B.jsx)(ee,{className:`mt-1 line-clamp-3 text-sm text-fg-muted`,children:s})]})]}),(0,B.jsx)(x,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:_(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,C.focusRingPanel),"aria-label":a.modalClose,children:[(0,B.jsx)(g,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`sr-only`,children:a.modalClose})]})})]}),(0,B.jsx)(`div`,{className:_(`min-h-0 overflow-y-auto px-6 py-5`,!c&&`flex-1`),children:(0,B.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&V?(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,"aria-busy":`true`,"aria-label":a.composioSetupTitle,children:[(0,B.jsx)(y,{className:`h-4 w-40`}),(0,B.jsx)(y,{className:`mt-2 h-3 w-72 max-w-full`}),(0,B.jsx)(y,{className:`mt-3 h-16 w-full rounded-xl`})]}):c&&!j?(0,B.jsxs)(`section`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/50 p-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioSetupTitle}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.composioSetupHint}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(F,{providerId:`xopc-cloud`,displayName:`XOPC Cloud`,connected:!1,onConnected:()=>{E().then(e=>{R(e),N(e.configured)})}})}),(0,B.jsx)(i,{to:`/settings/connector-service`,onClick:n,className:`mt-3 block text-xs text-accent-fg`,children:a.composioSetupByok})]}):null,c&&k?(0,B.jsxs)(`label`,{className:`flex items-start gap-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,B.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 accent-accent`,checked:Q,onChange:e=>ue(e.currentTarget.checked)}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:a.learnAfterConnect}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:a.learnAfterConnectHint})]})]}):null,c&&j&&L?.mode===`managed`?(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:$?a.composioCloudAuthUnavailable:a.composioSetupManaged}):null,c&&j&&L?.mode===`byok`?(0,B.jsxs)(`details`,{open:$,className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:a.composioAdvancedSettings}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.composioAuthConfigTitle}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:$?a.composioAuthConfigRequiredHint:a.composioAuthConfigManaged})]}),L?.mode===`byok`?(0,B.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:[a.composioAuthConfigManage,(0,B.jsx)(p,{className:`size-3.5`,"aria-hidden":!0})]}):(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:a.composioSetupManaged})]}),Z?(0,B.jsx)(y,{className:`mt-3 h-10 w-full`}):(0,B.jsxs)(u,{className:_(Y,`mt-3`),value:e.config.authConfigId??``,onChange:n=>t({...e,config:{...e.config,authConfigId:n.currentTarget.value},error:null}),children:[$?null:(0,B.jsx)(d,{value:``,children:a.composioAuthConfigManaged}),$&&!e.config.authConfigId?(0,B.jsx)(d,{value:``,disabled:!0,children:a.composioAuthConfigSelect}):null,fe.map(e=>(0,B.jsxs)(d,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`,` · `,e.id]},e.id))]}),!Z&&$&&fe.length===0?(0,B.jsx)(`p`,{className:`mt-2 text-xs text-amber-700 dark:text-amber-300`,children:a.composioAuthConfigEmpty}):null]}):null,c&&j&&L?.mode===`byok`?(0,B.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:a.composioSessionWritePermissionHint}):null,e.store?(0,B.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.detailPermissions}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[(e.store.permissions.data??[]).map(e=>(0,B.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(e.store.permissions.networkDomains??[]).map(e=>(0,B.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,B.jsx)(`span`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-1 text-xs text-emerald-700 dark:text-emerald-300`,children:a.storeLocalExecDenied})]})]}):null,(o.setup.links??[]).length>0?(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2 rounded-xl border border-edge bg-surface-base p-3`,children:(o.setup.links??[]).map(e=>{let t=e.external!==!1&&/^https:\/\//i.test(e.href);return(0,B.jsxs)(`a`,{href:t?e.href:`#${e.href}`,target:t?`_blank`:void 0,rel:t?`noopener noreferrer`:void 0,className:`inline-flex items-center gap-1.5 text-sm font-medium text-accent-fg hover:underline`,children:[e.label,t?(0,B.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}):null]},`${e.label}:${e.href}`)})}):null,(o.setup.secrets??[]).map(n=>(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.description?(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.description}):null,(0,B.jsx)(m,{value:e.secrets[n.key]??``,onChange:r=>t({...e,secrets:{...e.secrets,[n.key]:r},error:null}),labels:a.secretInputLabels,placeholder:n.required?a.requiredPlaceholder:a.optionalPlaceholder})]},n.key)),(o.setup.config??[]).map(n=>(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.label}),n.type===`json`?(0,B.jsx)(`textarea`,{className:ae,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})}):(0,B.jsx)(`input`,{className:Y,value:e.config[n.key]??``,placeholder:n.placeholder,onChange:r=>t({...e,config:{...e.config,[n.key]:r.currentTarget.value},error:null})})]},n.key)),e.installing?(0,B.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,B.jsx)(h,{className:`size-4 animate-spin text-accent`,"aria-hidden":!0}),a.connectingTitle]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:a.connectingHint})]}):null,e.error?(0,B.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:e.error}):null,G?(0,B.jsx)(`p`,{className:`min-w-0 max-w-full break-words rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600 [overflow-wrap:anywhere]`,children:G}):null,e.result?(0,B.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4 text-sm text-fg-muted`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsx)(`div`,{children:(0,B.jsx)(`p`,{className:`font-medium text-fg`,children:a.connectedBadge})}),(0,B.jsx)(`span`,{className:_(`rounded-full px-2 py-0.5 text-xs font-medium`,e.health?.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e.health?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-hover text-fg-muted`),children:e.health?.ok?a.healthStatusHealthy:oe(e.health?.status,a)})]}),(0,B.jsx)(`p`,{className:`mt-3`,children:e.health?.ok?a.connectionReady:e.health?a.connectionNeedsSetup:a.installedWithoutHealth}),e.health?.action?(0,B.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:e.health.action}):null]}):null]})}),(0,B.jsx)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:(0,B.jsxs)(v,{variant:`primary`,disabled:!!e.result||e.installing||V||Z||pe||c&&!j,onClick:()=>void de(),children:[e.installing?(0,B.jsx)(h,{className:`size-4 animate-spin`}):e.result?(0,B.jsx)(f,{className:`size-4`}):(0,B.jsx)(I,{className:`size-4`}),e.result?a.connectedBadge:a.connect]})})]})]})})}function ce(e){let t=(0,R.c)(2),n;return t[0]===e?n=t[1]:(n=e.draft.connector.runtime.type===`cli`?(0,B.jsx)(H,{definition:e.draft.connector,onClose:e.onClose,onChanged:e.onInstalled}):(0,B.jsx)(X,{...e}),t[0]=e,t[1]=n),n}export{U as a,I as c,W as i,J as n,H as o,K as r,L as s,ce as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c}from"./locale-store-Bg_XR36n.js";import{t as ee}from"./resource-unavailable-f9OzSi4W.js";import{t as l}from"./arrow-left-D880xG-P.js";import{t as u}from"./check-DUBLcKHA.js";import{t as te}from"./circle-check-C23XjkUj.js";import{t as d}from"./circle-x-DFsCKeya.js";import{t as f}from"./clock-3-DnrAnuyZ.js";import{t as p}from"./external-link-DjqjBmc3.js";import{n as m,r as h,t as ne}from"./power-off-CwwQ7Gp7.js";import{t as g}from"./folder-kanban-CpLlFI1o.js";import{t as re}from"./history-DXH_9jsE.js";import{t as _}from"./loader-circle-CifKLtgG.js";import{t as v}from"./panel-left-C8MqSXRZ.js";import{t as y}from"./power-ZI-pBczI.js";import{t as ie}from"./refresh-cw-BRlGaq2w.js";import{t as ae}from"./rotate-ccw-JM1TBLpp.js";import{t as b}from"./shield-check-BU58siTV.js";import{t as x}from"./sparkles-DHlfQFAF.js";import{t as S}from"./trash-2-DusmjVPV.js";import{t as oe}from"./triangle-alert-2JXFNNKU.js";import{t as se}from"./x-B_N4OPjy.js";import{t as C}from"./button-CnRSIP6m.js";import{t as ce}from"./skeleton-BI5TyibZ.js";import{a as le,i as ue,n as w,o as de,r as fe,s as pe,t as me}from"./dist-DfWfZ9iu.js";import{a as he,i as ge}from"./vendor-swr-CdRzEUwF.js";import{a as _e}from"./local-apps-Ck6kACsY.js";import{u as ve}from"./api-Boc-CVh7.js";import{t as ye}from"./page-header-store-BdZnUh-D.js";import{a as be,c as xe,d as Se,l as Ce,n as we,r as Te,s as Ee,t as De,u as Oe}from"./api-bL7sxjAF.js";import{n as ke,r as Ae,t as je}from"./runtime-health-D2TDFLLq.js";import{r as Me}from"./date-formatters-DukWSVwc.js";import{n as Ne,t as Pe}from"./tab-completion-input-CxtEp0aP.js";import{t as Fe}from"./page-context-capture-button-BH54VO0V.js";var T=e(t(),1);function Ie(e){return e.replace(/^(?:例如\s*[::]?|for example\s*[::]?|e\.g\.\s*)/i,``).replace(/…$/,``).trim()}var Le=`build-xopc-local-app`;function E(e){return(e.routing?.agentId??e.agentId??``).trim().toLowerCase()}function Re(e){return e.find(e=>E(e)===`coder`)??null}function ze(e,t){let n=new URLSearchParams({skill:Le}),r=t?.trim();return r&&n.set(`draft`,r),`/chat/${encodeURIComponent(e)}?${n.toString()}`}var Be=n(),D=r();function Ve(e){let t=(0,Be.c)(36),{scenarios:n,results:r,runningTarget:i,zh:a,onRunAll:o,onRunScenario:s,onAskCoder:c}=e;if(!n.length)return null;let ee=a?`产品场景`:`Product scenarios`,l;t[0]===ee?l=t[1]:(l=(0,D.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:ee}),t[0]=ee,t[1]=l);let u=a?`${n.length} 个关键用户路径`:`${n.length} critical user journey${n.length===1?``:`s`}`,p;t[2]===u?p=t[3]:(p=(0,D.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:u}),t[2]=u,t[3]=p);let h;t[4]!==l||t[5]!==p?(h=(0,D.jsxs)(`div`,{children:[l,p]}),t[4]=l,t[5]=p,t[6]=h):h=t[6];let ne=i!==null,g;t[7]===i?g=t[8]:(g=i===`all`?(0,D.jsx)(_,{className:`size-3 animate-spin`}):(0,D.jsx)(ie,{className:`size-3`}),t[7]=i,t[8]=g);let re=a?`全部重跑`:`Run all`,v;t[9]!==o||t[10]!==ne||t[11]!==g||t[12]!==re?(v=(0,D.jsxs)(C,{variant:`ghost`,className:`h-7 rounded-lg px-2 text-[11px]`,onClick:o,disabled:ne,children:[g,re]}),t[9]=o,t[10]=ne,t[11]=g,t[12]=re,t[13]=v):v=t[13];let y;t[14]!==h||t[15]!==v?(y=(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[h,v]}),t[14]=h,t[15]=v,t[16]=y):y=t[16];let ae=a?`产品场景验收结果`:`Product scenario acceptance results`,b;if(t[17]!==c||t[18]!==s||t[19]!==r||t[20]!==i||t[21]!==n||t[22]!==a){let e;t[24]!==c||t[25]!==s||t[26]!==r||t[27]!==i||t[28]!==a?(e=e=>{let t=r[e.id],n=i===`all`||i===e.id?`running`:t?.status??`pending`;return(0,D.jsx)(`li`,{className:`py-2.5 first:pt-1`,children:(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,D.jsx)(`span`,{className:`mt-0.5 shrink-0`,"aria-hidden":!0,children:n===`running`?(0,D.jsx)(_,{className:`size-3.5 animate-spin text-accent`}):n===`passed`?(0,D.jsx)(te,{className:`size-3.5 text-success`}):n===`failed`?(0,D.jsx)(d,{className:`size-3.5 text-danger`}):(0,D.jsx)(f,{className:`size-3.5 text-fg-subtle`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsx)(`p`,{className:`truncate text-[11px] font-medium text-fg`,children:e.name}),(0,D.jsx)(`p`,{className:`mt-0.5 text-[10px] text-fg-subtle`,children:a?`${e.stepCount} 个步骤`:`${e.stepCount} step${e.stepCount===1?``:`s`}`})]}),(0,D.jsx)(C,{variant:`ghost`,className:`size-7 shrink-0 rounded-lg p-0`,onClick:()=>s(e.id),disabled:i!==null,"aria-label":a?`重跑${e.name}`:`Rerun ${e.name}`,title:a?`单独重跑`:`Rerun scenario`,children:(0,D.jsx)(ie,{className:`size-3`})})]}),n===`running`?(0,D.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`正在隔离预览中执行…`:`Running in an isolated preview…`}):t?.status===`failed`?(0,D.jsxs)(`div`,{className:`mt-1.5`,children:[(0,D.jsx)(`p`,{className:`text-[11px] leading-4 text-danger`,children:t.message}),(0,D.jsxs)(C,{variant:`ghost`,className:`mt-1 h-7 rounded-lg px-2 text-[11px] text-danger hover:text-danger`,onClick:()=>c(e,t),children:[(0,D.jsx)(m,{className:`size-3`}),a?`让 Coder 修复`:`Ask Coder to fix`]})]}):t?.status===`passed`?(0,D.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`场景已通过`:`Scenario passed`}):(0,D.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-fg-muted`,children:a?`等待运行`:`Waiting to run`})]})]})},e.id)},t[24]=c,t[25]=s,t[26]=r,t[27]=i,t[28]=a,t[29]=e):e=t[29],b=n.map(e),t[17]=c,t[18]=s,t[19]=r,t[20]=i,t[21]=n,t[22]=a,t[23]=b}else b=t[23];let x;t[30]!==ae||t[31]!==b?(x=(0,D.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,"aria-label":ae,children:b}),t[30]=ae,t[31]=b,t[32]=x):x=t[32];let S;return t[33]!==y||t[34]!==x?(S=(0,D.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[y,x]}),t[33]=y,t[34]=x,t[35]=S):S=t[35],S}var He=`allow-scripts allow-forms`;function Ue(e,t){return Me(e,t)}function We(e,t,n){return!!(t&&n&&e.sourceHash===t&&e.status===n.status&&e.interactiveCount===n.interactiveCount&&JSON.stringify(e.checks)===JSON.stringify(n.checks))}function Ge(){let{appId:e}=i(),t=e===`new`,n=c(e=>e.language)===`zh`,r=c(e=>e.language),d=o(),{mutate:f}=he(),Me=ye(e=>e.setPageHeader),Le=ye(e=>e.clearPageHeader),{data:E,isLoading:Be,error:Ge,mutate:Ke}=ge(!t&&e?[`local-app`,e]:null,()=>we(e)),{data:O,isLoading:qe,mutate:Je}=ge(!t&&e?[`local-app-validation`,e]:null,()=>Se(e)),[Ye,Xe]=(0,T.useState)(``),[Ze,Qe]=(0,T.useState)(``),[k,A]=(0,T.useState)(!1),[j,M]=(0,T.useState)(null),[$e,et]=(0,T.useState)(!1),[tt,nt]=(0,T.useState)(!1),[rt,it]=(0,T.useState)(0),[at,ot]=(0,T.useState)(``),[N,st]=(0,T.useState)(!1),[P,ct]=(0,T.useState)(!1),[F,I]=(0,T.useState)(`booting`),[L,lt]=(0,T.useState)(null),[R,ut]=(0,T.useState)(null),[z,dt]=(0,T.useState)({}),[B,ft]=(0,T.useState)(`all`),[V,H]=(0,T.useState)(0),[pt,mt]=(0,T.useState)(0),[ht,U]=(0,T.useState)(null),[W,gt]=(0,T.useState)(null),[_t,vt]=(0,T.useState)([]),[yt,G]=(0,T.useState)(!1),bt=(0,T.useRef)(new Set),K=(0,T.useRef)(null),xt=(0,T.useRef)(null),St=(0,T.useRef)(null),q=(0,T.useRef)(null),J=(0,T.useRef)(``),Y=O?.acceptanceScenarios??[],X=(0,T.useMemo)(()=>{if(!Y.length)return null;let e=Y.map(e=>z[e.id]).filter(e=>!!e);return e.length===Y.length?{status:e.some(e=>e.status===`failed`)?`failed`:`passed`,scenarioCount:Y.length,scenarios:e}:null},[Y,z]),Z=(0,T.useMemo)(()=>{if(!R)return null;if(!O?.acceptanceScenarioCount)return R;if(!X)return null;let e=X.scenarios.find(e=>e.status===`failed`),t={id:`criteria`,status:X.status,message:e?`${e.name}: ${e.message}`:`${X.scenarioCount} product scenario(s) passed`},n=[...R.checks,t];return{status:n.some(e=>e.status===`failed`)?`failed`:`passed`,checks:n,interactiveCount:R.interactiveCount}},[R,X,O?.acceptanceScenarioCount]),Ct=(0,T.useCallback)(async(e,t)=>{let n=Re(await ve(e.projectId));if(!n){let n=new URLSearchParams({projectId:e.projectId,...t?{draft:t}:{}});d(`/chat/new?${n}`,{state:{agentId:`coder`,forceNewChat:!0}});return}bt.current.add(n.key),d(ze(n.key,t))},[d]),wt=(0,T.useCallback)(async(e=!0)=>{if(!E)return null;ct(!0);try{let t=await Se(E.id);return await Je(t,{revalidate:!1}),e&&(q.current=t.sourceHash??null,ft(`all`),H(0),it(e=>e+1)),t}catch(e){return M(e instanceof Error?e.message:String(e)),null}finally{ct(!1)}},[E,Je]);(0,T.useEffect)(()=>{if(!E)return;let e=!1;ve(E.projectId).then(t=>{e||(bt.current=new Set(t.filter(e=>(e.routing?.agentId??e.agentId)?.toLowerCase()===`coder`).map(e=>e.key)))}).catch(()=>{});let t=e=>{let t=e.detail?.key;!t||!bt.current.has(t)||(K.current!==null&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,wt(!0)},750))};return window.addEventListener(`session-transcript-updated`,t),()=>{e=!0,window.removeEventListener(`session-transcript-updated`,t),K.current!==null&&window.clearTimeout(K.current)}},[E,wt]),(0,T.useEffect)(()=>{vt(E?.acceptanceRuns??[])},[E?.acceptanceRuns]),(0,T.useEffect)(()=>{q.current=null},[E?.id]),(0,T.useEffect)(()=>{!O?.sourceHash||q.current===O.sourceHash||(q.current=O.sourceHash,ft(`all`),H(0),it(e=>e+1))},[E?.id,O?.sourceHash]),(0,T.useLayoutEffect)(()=>{if(!E)return;I(`booting`),lt(null),ut(null),gt(null),G(!1),J.current=``;let e=window.setTimeout(()=>I(e=>e===`failed`?e:`timeout`),7e3),t=xt.current?Ae(xt.current,t=>{let n=_e(t);if(n){if(n.type===`ready`){I(e=>e===`failed`?e:`healthy`);return}if(n.type===`acceptance`){window.clearTimeout(e),ut(n.detail),gt(q.current);return}n.type!==`criteria`&&(window.clearTimeout(e),lt(n.detail),I(`failed`))}}):()=>{};return()=>{window.clearTimeout(e),t()}},[E,rt]),(0,T.useLayoutEffect)(()=>{if(!E||O?.status!==`healthy`||!Y.length){U(null);return}let e=B===`all`?Y[V]:Y.find(e=>e.id===B),t=e?[e]:[];if(!t.length)return;U(B),dt(e=>{if(B===`all`&&V===0)return{};let t={...e};return delete t[B],t});let r=!1,i=e=>{dt(n=>{let r={...n};for(let n of t)r[n.id]={id:n.id,name:n.name,status:`failed`,message:e,failureKind:`runner`};return r}),U(null)},a=window.setTimeout(()=>i(r?n?`场景在 10 秒内未完成。`:`Scenario did not finish within 10 seconds.`:n?`验收执行器未能连接,请重新验收。`:`The acceptance runner did not connect. Run acceptance again.`),1e4),o=St.current?Ae(St.current,e=>{let t=_e(e);t&&(t.type===`ready`?r=!0:t.type===`criteria`?(window.clearTimeout(a),dt(e=>{let n={...e};for(let e of t.detail.scenarios)(n[e.id]?.status!==`failed`||e.status===`failed`)&&(n[e.id]=e);return n}),B===`all`&&V+1<Y.length?(H(e=>e+1),mt(e=>e+1)):U(null)):t.type===`error`&&(window.clearTimeout(a),i(je(t.detail))))}):()=>{};return()=>{window.clearTimeout(a),o()}},[Y,E,pt,B,V,rt,O?.status,n]),(0,T.useEffect)(()=>{if(!E||!Z||!W||W!==O?.sourceHash)return;let e=`${E.id}:${W}:${JSON.stringify(Z)}`;J.current!==e&&(J.current=e,G(!0),Ee(E.id,W,Z).then(t=>{J.current===e&&vt(e=>[t,...e.filter(e=>e.id!==t.id)].toSorted((e,t)=>t.createdAt-e.createdAt).slice(0,20))}).catch(t=>{J.current===e&&(J.current=``,G(!1),M(t instanceof Error?t.message:String(t)))}).finally(()=>{J.current===e&&G(!1)}))},[Z,W,E,O?.sourceHash]);let Q=(0,T.useCallback)(async e=>{if(E){st(!0),M(null);try{await Ct(E,e)}catch(e){M(e instanceof Error?e.message:String(e)),st(!1)}}},[E,Ct]);(0,T.useLayoutEffect)(()=>(Me({startExtra:(0,D.jsx)(a,{to:`/local-apps`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`返回应用工坊`:`Back to App Studio`,children:(0,D.jsx)(l,{className:`size-4`})}),main:(0,D.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:E?.name||(t?n?`创建应用`:`Create app`:n?`应用详情`:`App details`)}),end:E?(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,D.jsx)(Fe,{resource:{kind:`local_app`,id:E.id,revision:O?.sourceHash??``},disabled:k||N||P||!O?.sourceHash}),(0,D.jsx)(C,{asChild:!0,variant:`ghost`,className:`h-9`,children:(0,D.jsxs)(a,{to:`/projects/${encodeURIComponent(E.projectId)}`,children:[(0,D.jsx)(g,{className:`size-4`}),n?`项目`:`Project`]})}),(0,D.jsxs)(C,{className:`h-9`,onClick:()=>void Q(),disabled:N,children:[N?(0,D.jsx)(_,{className:`size-4 animate-spin`}):(0,D.jsx)(m,{className:`size-4`}),n?`继续开发`:`Continue building`]})]}):null}),()=>Le()),[E,t,k,N,P,O?.sourceHash,Le,Q,Me,n]);async function Tt(e){e.preventDefault(),A(!0),M(null);try{let e=await De({name:Ye,idea:Ze});await f(`local-apps-list`);let t=n?`请基于 APP_BRIEF.md 完成这个本地应用的首版。先检查现有草稿,再实现最小可用版本并运行校验;完成后告诉我可以如何预览。`:`Build the first usable version of this local app from APP_BRIEF.md. Inspect the existing draft, implement the smallest useful version, run validation, and tell me how to preview it.`;try{await Ct(e,t)}catch{d(`/local-apps/${encodeURIComponent(e.id)}`,{replace:!0})}}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}}async function Et(){if(E){A(!0),M(null);try{let e=await be(E.id);await Ke(e,{revalidate:!1}),await Je(),await Promise.all([f(`local-apps-list`),f(`gateway-extensions-list`)]),et(!1)}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}}}async function Dt(e){A(!0),M(null);try{let t=await e();return await Ke(t,{revalidate:!1}),await Je(),await Promise.all([f(`local-apps-list`),f(`gateway-extensions-list`)]),!0}catch(e){return M(e instanceof Error?e.message:String(e)),!1}finally{A(!1)}}async function Ot(e){E&&await Dt(()=>Ce(E.id,e))}async function kt(e){E&&await Dt(()=>xe(E.id,e))}async function At(){E&&await Dt(()=>Oe(E.id))&&nt(!1)}async function jt(e){if(!(!E||!e.length)){M(null);try{let t=await Te(E.id,{sourceHash:O?.sourceHash,locale:n?`zh`:`en`,diagnostics:e});await Q(t.prompt)}catch(e){M(e instanceof Error?e.message:String(e))}}}function Mt(){jt([...O?.issues.map(e=>({phase:`build`,code:e.code,message:e.message}))??[],...L?[{phase:`runtime`,code:L.kind,message:je(L)}]:[],...Z?.checks.filter(e=>e.status===`failed`&&e.id!==`criteria`).map(e=>({phase:`acceptance`,code:e.id,message:e.message}))??[],...Object.values(z).filter(e=>e.status===`failed`).map(e=>({phase:e.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${e.message}`})),...F===`timeout`?[{phase:`boot`,code:`boot_timeout`,message:`Preview did not report ready within 7 seconds.`}]:[]])}function Nt(){ft(`all`),H(0),mt(e=>e+1)}function Pt(e){ft(e),H(0),mt(e=>e+1)}function Ft(e,t){jt([{phase:t.failureKind===`runner`?`runner`:`acceptance`,code:e.id,message:`${e.name}: ${t.message}`}])}let It=_t.findIndex(e=>We(e,W,Z)),$=It>=0?_t[It]:null,Lt=It>=0?_t[It+1]??null:_t[0]??null,Rt=ke(Z),zt=Lt?Lt.checks.filter(e=>e.status===`failed`).map(e=>e.message):[],Bt=O?.status===`failed`||F===`failed`||F===`timeout`||Z?.status===`failed`||Object.values(z).some(e=>e.status===`failed`),Vt=zt.filter(e=>!Rt.includes(e)).length;async function Ht(){let e=await wt(!1);if(e?.status===`healthy`&&e.sourceHash!==W){q.current=e.sourceHash??null,H(0),it(e=>e+1);return}e?.status===`healthy`&&F===`healthy`&&Z?.status===`passed`&&$&&$.sourceHash===e.sourceHash&&et(!0)}return t?(0,D.jsx)(`div`,{className:`flex min-h-0 flex-1 bg-surface-panel p-3 sm:p-5 xl:p-6`,children:(0,D.jsxs)(`div`,{className:`grid w-full min-w-0 overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base shadow-surface lg:grid-cols-[minmax(280px,0.8fr)_minmax(0,1.5fr)]`,children:[(0,D.jsxs)(`form`,{onSubmit:Tt,className:`flex flex-col border-b border-edge-subtle p-5 lg:border-b-0 lg:border-r`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-accent`,children:[(0,D.jsx)(x,{className:`size-4`}),n?`告诉编程智能体你的想法`:`Tell Coder your idea`]}),(0,D.jsx)(`h2`,{className:`mt-4 text-xl font-semibold tracking-tight text-fg`,children:n?`你想创建什么?`:`What do you want to create?`}),(0,D.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`我们会创建项目,并在对话中由编程智能体根据你的想法开发应用。`:`We will create a Coder Project and carry the app context and development skill into chat.`}),(0,D.jsxs)(`label`,{className:`mt-6 text-xs font-medium text-fg-muted`,children:[n?`应用名称`:`App name`,(0,D.jsx)(Pe,{value:Ye,onChange:e=>Xe(e.target.value),suggestion:Ie(n?`例如:阅读清单`:`e.g. Reading list`),onAcceptSuggestion:Xe,required:!0,className:`mt-2 w-full rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:阅读清单`:`e.g. Reading list`})]}),(0,D.jsxs)(`label`,{className:`mt-4 text-xs font-medium text-fg-muted`,children:[n?`描述你的想法`:`Describe your idea`,(0,D.jsx)(Ne,{value:Ze,onChange:e=>Qe(e.target.value),suggestion:Ie(n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`),onAcceptSuggestion:Qe,required:!0,rows:7,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`我想要一个可以记录待读文章、标记进度并按主题筛选的小工具…`:`I want a small tool that tracks articles, reading progress, and topics…`})]}),j?(0,D.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:j}):null,(0,D.jsxs)(C,{type:`submit`,variant:`primary`,className:`mt-5 h-10`,disabled:k||!Ye.trim()||!Ze.trim(),children:[k?(0,D.jsx)(_,{className:`size-4 animate-spin`}):(0,D.jsx)(m,{className:`size-4`}),n?`开始开发对话`:`Continue with Coder`]})]}),(0,D.jsx)(`div`,{className:`hidden min-h-[620px] place-items-center bg-surface-panel p-8 lg:grid`,children:(0,D.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,D.jsx)(`div`,{className:`mx-auto flex size-16 items-center justify-center rounded-2xl border border-edge bg-surface-base text-accent shadow-surface`,children:(0,D.jsx)(v,{className:`size-7`})}),(0,D.jsx)(`h3`,{className:`mt-5 text-base font-semibold text-fg`,children:n?`创建后,这里就是实时预览`:`Your live preview appears here`}),(0,D.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n?`你可以先体验草稿,再决定是否把它添加到左侧导航。`:`Try the draft first, then decide whether to add it to the sidebar.`})]})})]})}):Be?(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_260px]`,children:[(0,D.jsx)(ce,{className:`rounded-xl`}),(0,D.jsx)(ce,{className:`rounded-xl`}),(0,D.jsx)(ce,{className:`rounded-xl`})]}):Ge||!E?(0,D.jsx)(ee,{kind:`app`,missing:!Ge||/not found|404/i.test(String(Ge)),backTo:`/local-apps`,retry:()=>void Ke()}):(0,D.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-hidden bg-surface-panel p-3 lg:grid-cols-[280px_minmax(0,1fr)_300px]`,children:[(0,D.jsxs)(`aside`,{className:`min-h-0 min-w-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.12em] text-accent`,children:[(0,D.jsx)(x,{className:`size-4`}),n?`创作对话`:`Build conversation`]}),(0,D.jsx)(`div`,{className:`mt-4 min-w-0 rounded-xl bg-surface-panel p-3 text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:E.idea}),(0,D.jsxs)(`div`,{className:`mt-4 rounded-xl bg-accent-soft p-3`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium text-accent-fg`,children:[(0,D.jsx)(te,{className:`size-4`}),n?`草稿已准备好`:`Draft is ready`]}),(0,D.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`继续开发会打开对应项目的对话,编程智能体可以参考当前应用继续修改。`:`Continue in the Project where Coder has the app context and dedicated skill.`})]}),(0,D.jsxs)(`form`,{className:`mt-5`,onSubmit:e=>{e.preventDefault(),Q(at)},children:[(0,D.jsx)(`label`,{className:`text-xs font-medium text-fg-muted`,htmlFor:`local-app-change-request`,children:n?`下一步想改什么?`:`What should change next?`}),(0,D.jsx)(Ne,{id:`local-app-change-request`,value:at,onChange:e=>ot(e.target.value),suggestion:Ie(n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`),onAcceptSuggestion:ot,rows:4,className:`mt-2 w-full resize-none rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm leading-6 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,placeholder:n?`例如:增加月视图,并支持按标签筛选`:`e.g. Add a monthly view and tag filters`}),(0,D.jsxs)(C,{type:`submit`,className:`mt-2 w-full`,disabled:N||!at.trim(),children:[N?(0,D.jsx)(_,{className:`size-4 animate-spin`}):(0,D.jsx)(m,{className:`size-4`}),n?`让 Coder 修改`:`Ask Coder to update`]})]}),(0,D.jsxs)(C,{variant:`ghost`,className:`mt-2 w-full`,onClick:()=>void Q(),disabled:N,children:[(0,D.jsx)(g,{className:`size-4`}),n?`打开已有开发对话`:`Open development chat`]})]}),(0,D.jsxs)(`section`,{className:`flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,D.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center justify-between border-b border-edge-subtle px-3`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`size-2 rounded-full ${O?.status===`failed`||F===`failed`||F===`timeout`||Z?.status===`failed`?`bg-danger`:O?.status===`healthy`&&F===`healthy`&&Z?.status===`passed`&&$?.sourceHash===O.sourceHash&&!yt?`bg-success`:`bg-fg-subtle`}`}),F===`failed`||F===`timeout`?n?`预览运行异常`:`Preview runtime issue`:O?.status===`failed`||Z?.status===`failed`?n?`自动验收未通过`:`Acceptance needs attention`:F===`booting`||!Z?n?`自动验收中`:`Running acceptance`:yt||$?.sourceHash!==O?.sourceHash?n?`正在保存验收快照`:`Saving acceptance snapshot`:n?`草稿已通过验收`:`Draft accepted`]}),(0,D.jsxs)(C,{variant:`ghost`,className:`h-8 px-2`,onClick:()=>void wt(!0),disabled:P,children:[P?(0,D.jsx)(_,{className:`size-3.5 animate-spin`}):(0,D.jsx)(ie,{className:`size-3.5`}),n?`重新验收`:`Run again`]})]}),(0,D.jsx)(`iframe`,{ref:xt,title:`${E.name} preview`,src:s(E.draftPreviewUrl),sandbox:He,className:`min-h-0 w-full flex-1 bg-white`,onError:()=>{lt({kind:`script_error`,message:`Preview document failed to load`}),I(`failed`)}},rt),O?.status===`healthy`&&O.acceptanceScenarioCount>0?(0,D.jsx)(`iframe`,{ref:St,title:`${E.name} acceptance runner`,src:`${s(E.draftPreviewUrl)}?xopcAcceptance=1&xopcScenario=${encodeURIComponent(B===`all`?Y[V]?.id??``:B)}`,sandbox:He,"aria-hidden":`true`,tabIndex:-1,className:`pointer-events-none fixed left-[-200vw] top-0 h-[720px] w-[1024px] opacity-0`},`criteria-${rt}-${pt}-${V}`):null]}),(0,D.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto rounded-xl border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n?`发布状态`:`Release status`}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:E.installationState===`not_installed`?n?`尚未安装`:`Not installed`:E.enabled?n?`版本 ${E.activeVersion} 正在使用`:`Version ${E.activeVersion} is active`:n?`已禁用,版本仍保留`:`Disabled, release retained`})]}),(0,D.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full ${E.enabled?`bg-success`:`bg-fg-subtle`}`,"aria-hidden":!0})]}),(0,D.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 text-xs`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`当前草稿`:`Draft`}),(0,D.jsxs)(`dd`,{className:`mt-1 font-medium text-fg`,children:[`v`,E.draftVersion]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`已安装`:`Installed`}),(0,D.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:E.activeVersion?`v${E.activeVersion}`:`—`})]})]}),(0,D.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,D.jsx)(h,{className:`size-4 text-accent`}),n?`草稿检查`:`Draft checks`]}),qe||P?(0,D.jsx)(_,{className:`size-3.5 animate-spin text-fg-muted`}):O?.status===`healthy`?(0,D.jsx)(te,{className:`size-4 text-success`}):(0,D.jsx)(oe,{className:`size-4 text-danger`})]}),O?(0,D.jsxs)(`div`,{className:`mt-2`,children:[(0,D.jsx)(`p`,{className:`text-xs leading-5 ${O.status===`healthy`?`text-fg-muted`:`text-danger`}`,children:O.status===`healthy`?O.hasDraftChanges?n?`${O.changedFileCount} 个文件有改动,可以安装新版本。`:`${O.changedFileCount} changed files are ready for a new release.`:n?`草稿与当前安装版本一致。`:`Draft matches the installed release.`:O.issues[0]?.message}),O.changedFiles.length?(0,D.jsx)(`ul`,{className:`mt-2 space-y-1`,children:O.changedFiles.slice(0,4).map(e=>(0,D.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,D.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,O.changedFileCount>4?(0,D.jsx)(`p`,{className:`mt-1 text-[10px] text-fg-subtle`,children:n?`还有 ${O.changedFileCount-4} 个文件`:`${O.changedFileCount-4} more files`}):null,(0,D.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,D.jsx)(`span`,{className:`size-2 rounded-full ${F===`healthy`?`bg-success`:F===`booting`?`bg-fg-subtle`:`bg-danger`}`}),n?`预览运行`:`Preview runtime`]}),(0,D.jsx)(`p`,{className:`mt-1 text-xs leading-5 ${F===`failed`||F===`timeout`?`text-danger`:`text-fg-muted`}`,children:L?je(L):F===`healthy`?n?`已成功启动,未发现未捕获异常。`:`Started successfully with no uncaught errors.`:F===`timeout`?n?`7 秒内未完成启动,可能出现白屏或阻塞。`:`Did not finish booting within 7 seconds.`:n?`正在等待应用启动。`:`Waiting for the app to start.`})]}),(0,D.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-fg`,children:[(0,D.jsx)(`span`,{className:`size-2 rounded-full ${Z?.status===`passed`?`bg-success`:Z?.status===`failed`?`bg-danger`:`bg-fg-subtle`}`}),n?`自动验收`:`Automatic acceptance`]}),Z?(0,D.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:Z.checks.map(e=>(0,D.jsxs)(`li`,{className:`flex items-start gap-2 text-[11px] leading-4 ${e.status===`failed`?`text-danger`:`text-fg-muted`}`,children:[(0,D.jsx)(`span`,{className:`mt-1 size-1.5 shrink-0 rounded-full ${e.status===`failed`?`bg-danger`:e.status===`passed`?`bg-success`:`bg-fg-subtle`}`}),(0,D.jsx)(`span`,{children:e.message})]},e.id))}):(0,D.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:O?.acceptanceScenarioCount?n?`正在检查页面基础质量和 ${O.acceptanceScenarioCount} 个产品场景。`:`Checking page quality and ${O.acceptanceScenarioCount} product scenario(s).`:n?`正在检查页面内容和基础交互。`:`Checking rendered content and basic interaction.`}),yt?(0,D.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-[11px] text-fg-muted`,children:[(0,D.jsx)(_,{className:`size-3 animate-spin`}),n?`正在保存当前源码对应的验收快照…`:`Saving the acceptance snapshot for this source…`]}):$?(0,D.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-fg-muted`,children:Lt?n?`相比上次:已修复 ${Vt} 项,仍有 ${Rt.length} 项。`:`Since the previous run: ${Vt} fixed, ${Rt.length} remaining.`:n?`首个验收快照已保存。`:`First acceptance snapshot saved.`}):null,(0,D.jsx)(Ve,{scenarios:Y,results:z,runningTarget:ht,zh:n,onRunAll:Nt,onRunScenario:Pt,onAskCoder:Ft})]}),Bt?(0,D.jsxs)(C,{className:`mt-3 w-full`,onClick:Mt,disabled:N,children:[(0,D.jsx)(m,{className:`size-4`}),n?`让 Coder 修复`:`Ask Coder to fix`]}):null]}):(0,D.jsx)(ce,{className:`mt-2 h-12 rounded-lg`})]}),(0,D.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,D.jsx)(b,{className:`size-4 text-accent`}),n?`权限`:`Permissions`]}),(0,D.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(O?.permissions??E.permissions).map(e=>(0,D.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:e},e))})]}),(0,D.jsx)(C,{variant:`primary`,className:`mt-5 w-full`,onClick:()=>void Ht(),disabled:k||qe||P||yt||O?.status===`failed`||F!==`healthy`||Z?.status!==`passed`||!$||$.sourceHash!==O?.sourceHash||E.installationState===`installed`&&O?.hasDraftChanges===!1,children:E.installationState===`installed`?n?`安装当前更新`:`Install current update`:n?`添加到左侧导航`:`Add to sidebar`}),E.installationState===`installed`?(0,D.jsxs)(`div`,{className:`mt-2 flex gap-2`,children:[(0,D.jsxs)(C,{className:`min-w-0 flex-1`,onClick:()=>void Ot(!E.enabled),disabled:k,children:[E.enabled?(0,D.jsx)(ne,{className:`size-4`}):(0,D.jsx)(y,{className:`size-4`}),E.enabled?n?`禁用`:`Disable`:n?`启用`:`Enable`]}),(0,D.jsx)(C,{variant:`ghost`,className:`text-danger hover:text-danger`,onClick:()=>nt(!0),disabled:k,"aria-label":n?`卸载应用`:`Uninstall app`,children:(0,D.jsx)(S,{className:`size-4`})})]}):null,(0,D.jsxs)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4`,children:[(0,D.jsxs)(`h3`,{className:`flex items-center gap-2 text-xs font-semibold text-fg`,children:[(0,D.jsx)(re,{className:`size-4`}),n?`版本历史`:`Release history`]}),E.releases.length?(0,D.jsx)(`ul`,{className:`mt-2 divide-y divide-edge-subtle`,children:E.releases.map(e=>(0,D.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5`,children:[(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[`v`,e.version,e.isActive?(0,D.jsx)(`span`,{className:`rounded-full bg-success-soft px-1.5 py-0.5 text-[10px] text-success`,children:n?`当前`:`Active`}):null]}),(0,D.jsx)(`p`,{className:`mt-0.5 truncate text-[10px] text-fg-subtle`,children:Ue(e.createdAt,r)})]}),e.isActive?null:(0,D.jsxs)(C,{variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:()=>void kt(e.id),disabled:k,children:[(0,D.jsx)(ae,{className:`size-3.5`}),n?`恢复`:`Restore`]})]},e.id))}):(0,D.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n?`安装首个版本后,可以从这里恢复。`:`Install the first version to enable recovery.`})]}),j?(0,D.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-danger`,role:`alert`,children:j}):null]}),(0,D.jsx)(me,{open:$e,onOpenChange:et,children:(0,D.jsxs)(de,{children:[(0,D.jsx)(le,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(fe,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(560px,calc(100vh-32px))] w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(pe,{className:`text-base font-semibold text-fg`,children:n?`确认安装到 XOPC`:`Confirm installation`}),(0,D.jsx)(ue,{className:`mt-1 text-sm text-fg-muted`,children:n?`当前草稿会成为左侧导航中的可用版本。`:`The current draft will become the version available in the sidebar.`})]}),(0,D.jsx)(w,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,D.jsx)(se,{className:`size-4`})})]}),(0,D.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,D.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:E.name}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:E.extensionId})]}),(0,D.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`本次迭代`:`This iteration`}),(0,D.jsxs)(`dl`,{className:`mt-2 grid grid-cols-2 gap-3 text-xs`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`文件变化`:`Changed files`}),(0,D.jsx)(`dd`,{className:`mt-1 font-medium text-fg`,children:O?.changedFileCount??0})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`dt`,{className:`text-fg-subtle`,children:n?`自动验收`:`Acceptance`}),(0,D.jsxs)(`dd`,{className:`mt-1 flex items-center gap-1.5 font-medium text-success`,children:[(0,D.jsx)(te,{className:`size-3.5`}),n?`已通过并保存`:`Passed and saved`]})]})]}),O?.changedFiles.length?(0,D.jsx)(`ul`,{className:`mt-3 space-y-1`,children:O.changedFiles.slice(0,5).map(e=>(0,D.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2 text-[11px] text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`w-4 shrink-0 font-medium text-fg-subtle`,children:e.status===`added`?`+`:e.status===`deleted`?`−`:`•`}),(0,D.jsx)(`span`,{className:`truncate font-mono`,children:e.path})]},e.path))}):null,(0,D.jsx)(`h4`,{className:`mt-5 text-xs font-semibold text-fg`,children:n?`请求权限`:`Requested permissions`}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:(O?.permissions??E.permissions).map(e=>(0,D.jsxs)(`li`,{className:`flex items-center gap-2 text-sm text-fg`,children:[(0,D.jsx)(u,{className:`size-4 text-success`}),e,E.installationState===`installed`&&O?.permissionDelta.added.includes(e)?(0,D.jsx)(`span`,{className:`rounded-full bg-warning-soft px-2 py-0.5 text-[10px] text-warning`,children:n?`新增`:`New`}):null]},e))}),E.installationState===`installed`&&O?.permissionDelta.added.length?(0,D.jsx)(`p`,{className:`mt-4 rounded-xl bg-warning-soft p-3 text-xs leading-5 text-warning`,children:n?`此更新增加了权限,请确认这些能力符合你的修改意图。`:`This update adds permissions. Confirm they match the change you requested.`}):null,(0,D.jsx)(`p`,{className:`mt-5 rounded-xl bg-accent-soft p-3 text-xs leading-5 text-accent-fg`,children:n?`Phase 1 应用只能使用界面主题和本地存储,不能访问网络或运行系统命令。`:`Phase 1 apps can use theme and local storage only. They cannot access the network or run system commands.`})]}),(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,D.jsx)(w,{asChild:!0,children:(0,D.jsx)(C,{children:n?`取消`:`Cancel`})}),(0,D.jsxs)(C,{variant:`primary`,onClick:()=>void Et(),disabled:k,children:[k?(0,D.jsx)(_,{className:`size-4 animate-spin`}):(0,D.jsx)(p,{className:`size-4`}),n?`确认安装`:`Install`]})]})]})]})}),(0,D.jsx)(me,{open:tt,onOpenChange:nt,children:(0,D.jsxs)(de,{children:[(0,D.jsx)(le,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),(0,D.jsxs)(fe,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(420px,calc(100vh-32px))] w-[min(500px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-2xl focus:outline-none`,children:[(0,D.jsxs)(`div`,{className:`flex items-start justify-between border-b border-edge-subtle p-5`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(pe,{className:`text-base font-semibold text-fg`,children:n?`卸载当前应用?`:`Uninstall this app?`}),(0,D.jsx)(ue,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:n?`应用会从侧栏移除,但项目、源码、版本历史和本地数据都会保留。`:`The app leaves the sidebar, while its Project, source, release history, and local data remain.`})]}),(0,D.jsx)(w,{className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover`,children:(0,D.jsx)(se,{className:`size-4`})})]}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,D.jsxs)(`div`,{className:`rounded-xl bg-surface-panel p-4`,children:[(0,D.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:E.name}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`之后可从任意保留版本重新安装。`:`You can reinstall any retained release later.`})]})}),(0,D.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,D.jsx)(w,{asChild:!0,children:(0,D.jsx)(C,{children:n?`取消`:`Cancel`})}),(0,D.jsxs)(C,{variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void At(),disabled:k,children:[k?(0,D.jsx)(_,{className:`size-4 animate-spin`}):(0,D.jsx)(S,{className:`size-4`}),n?`卸载但保留项目`:`Uninstall and keep Project`]})]})]})]})})]})}export{Ge as LocalAppWorkbenchPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a,i as o,n as s,o as c}from"./locale-store-Bg_XR36n.js";import{t as l}from"./messages-DG4HLOER.js";import{t as u}from"./activity-YogQEteU.js";import{t as d}from"./chevron-left-DqFhpbvK.js";import{t as f}from"./chevron-right-BweFrslA.js";import{n as p,r as m,t as h}from"./popover-select-DD8fmrxH.js";import{t as g}from"./laptop-CI3hBVrl.js";import{n as _,t as v}from"./shield-off-2jsucUds.js";import{t as y}from"./plus-Q2yW6OE7.js";import{t as b}from"./search-DA7gz22f.js";import{t as x}from"./smartphone-DSSsQFqA.js";import{t as S}from"./x-B_N4OPjy.js";import{t as C}from"./cn-0WouolD0.js";import{t as w}from"./button-CnRSIP6m.js";import{t as T}from"./skeleton-BI5TyibZ.js";import{a as E,n as ee,o as te,r as D,s as ne,t as re}from"./dist-DfWfZ9iu.js";import{i as ie,o as ae}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{i as O,o as k}from"./vendor-swr-CdRzEUwF.js";import{s as A}from"./session-api-DJI9eSgw.js";import{t as j}from"./page-tabs-oeTY7z3_.js";import{n as M}from"./index.module-Cd9ENXfk.js";import{t as N}from"./confirm-dialog-XGclfBqe.js";import{t as P}from"./refresh-button-bU_0NarN.js";import{n as F}from"./settings-loading-skeleton-BTqvr_Fw.js";import{n as I,t as L}from"./settings-page-header-CyUHrn7c.js";import{t as oe}from"./settings-page-layout-DGVqXrlp.js";import{t as R}from"./device-pairing-wizard-ByEL5lvM.js";var z=n(),B=e(t(),1),V=r();async function H(e=`GET`,t,n){let r=await a(o(`/api/endpoint-tools/target-authorizations`+(n?`/`+encodeURIComponent(n):``)),{method:e,...t?{body:JSON.stringify(t)}:{}});if(!r.ok)throw Error(r.status===403?`owner`:`unavailable`);return(await r.json()).payload}function se({devices:e,zh:t}){let n=O(`device-single-call-grants`,()=>H(),{refreshInterval:5e3,shouldRetryOnError:!1}),r=O(n.error?null:`device-grant-conversations`,()=>A({limit:100}),{shouldRetryOnError:!1}),[i,a]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(`weather`),[f,p]=(0,B.useState)(`approximate`),[m,g]=(0,B.useState)(`restaurant`),[_,v]=(0,B.useState)(!1),[y,b]=(0,B.useState)(!1);if(n.error)return null;let x=e.flatMap(e=>e.endpoints.map(t=>({...t,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))),S=x.find(e=>e.endpointId===c)?.tools.find(e=>e.descriptor.name.endsWith(`.device.get_location`))?.descriptor.name,C=async()=>{if(!(!S||!i||!o)){v(!0),b(!1);try{await H(`POST`,{conversationId:i,requestorPrincipalId:o,targetEndpointId:c,toolName:S,arguments:{purpose:u,precision:f,...u===`nearby`?{category:m}:{}}}),await n.mutate()}catch{b(!0)}finally{v(!1)}}};return(0,V.jsxs)(`section`,{className:`mb-5 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-fg`,children:t?`跨设备单次授权`:`Single-call device authorization`}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t?`为指定会话和来源设备授权一次定位查询,60 秒后失效。目标设备仍需确认;授权后请在来源设备继续请求。`:`Authorize one location query for a conversation and source device. Expires in 60 seconds; target-device consent is still required. Continue the request from the source device.`}),n.isLoading||r.isLoading?(0,V.jsx)(T,{className:`mt-3 h-28`}):(0,V.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(h,{value:i,onChange:a,placeholder:t?`选择会话`:`Conversation`,ariaLabel:t?`会话`:`Conversation`,options:(r.data?.items??[]).map(e=>({value:e.key,label:e.name||e.key}))}),(0,V.jsx)(h,{value:o,onChange:s,placeholder:t?`消息来源设备`:`Source device`,ariaLabel:t?`消息来源设备`:`Source device`,options:e.filter(e=>e.endpoints.length>0).map(e=>({value:e.id,label:e.displayName+` · `+e.platform+` · `+e.id.slice(-8)}))}),(0,V.jsx)(h,{value:c,onChange:l,placeholder:t?`使用哪台设备的位置`:`Location device`,ariaLabel:t?`目标设备`:`Target device`,options:x.filter(e=>e.tools.some(e=>e.descriptor.name.endsWith(`.device.get_location`))).map(e=>({value:e.endpointId,label:e.label}))}),(0,V.jsx)(h,{placeholder:t?`用途`:`Purpose`,value:u,onChange:e=>d(e),ariaLabel:t?`用途`:`Purpose`,options:[{value:`weather`,label:t?`查询天气`:`Weather`},{value:`nearby`,label:t?`附近地点`:`Nearby places`}],allowEmpty:!1}),(0,V.jsx)(h,{placeholder:t?`精度`:`Precision`,value:f,onChange:e=>p(e),ariaLabel:t?`精度`:`Precision`,options:[{value:`approximate`,label:t?`大致位置`:`Approximate`},{value:`precise`,label:t?`精确位置`:`Precise`}],allowEmpty:!1}),u===`nearby`?(0,V.jsx)(h,{placeholder:t?`地点类型`:`Category`,value:m,onChange:g,ariaLabel:t?`附近地点类型`:`Place category`,options:[`restaurant`,`cafe`,`pharmacy`,`park`].map((e,n)=>({value:e,label:t?[`餐厅`,`咖啡馆`,`药店`,`公园`][n]:e})),allowEmpty:!1}):null,(0,V.jsx)(w,{variant:`primary`,disabled:_||!i||!o||!S,onClick:()=>void C(),children:t?`允许一次`:`Allow once`})]}),y?(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-fg-muted`,children:t?`授权失败,请检查设备连接后重试。`:`Authorization failed. Check the device connection.`}):null,(0,V.jsx)(`div`,{className:`mt-3 space-y-2`,children:n.data?.map(r=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-sm text-fg-muted`,children:[(0,V.jsxs)(`span`,{children:[e.find(e=>e.endpoints.some(e=>e.endpointId===r.targetEndpointId))?.displayName??(t?`设备`:`Device`),` · `,r.state===`running`?t?`执行中`:`Running`:t?`等待本次调用`:`Awaiting one call`]}),(0,V.jsx)(w,{disabled:_,onClick:()=>{v(!0),H(`DELETE`,void 0,r.id).then(()=>n.mutate()).catch(()=>b(!0)).finally(()=>v(!1))},children:t?`撤销`:`Revoke`})]},r.id))})]})}var ce=720*60*60*1e3;function le(e){let t=[e.access,e.principal].filter(e=>e!==null);return t.length>0&&t.every(e=>e.revokedAt!==void 0)}function U(e){return le(e)?`revoked`:e.endpoints.length>0?`online`:`offline`}function ue(e){return new Set(e.endpoints.flatMap(e=>e.tools.map(({descriptor:e})=>e.name))).size}function de(e,t=Date.now()){return U(e)===`offline`&&(e.lastSeenAt??e.createdAt)<t-ce}function fe(e,t,n=Date.now()){let r=t.query.trim().toLocaleLowerCase();return e.filter(e=>{let i=U(e),a=t.status===`all`||(t.status===`active`?i!==`revoked`:t.status===`stale`?de(e,n):i===t.status),o=!t.platform||e.platform===t.platform,s=!r||[e.displayName,e.id,e.kind,e.platform].some(e=>e.toLocaleLowerCase().includes(r));return a&&o&&s})}function pe(e){return e.length>8?e.slice(-8):e}function me(e){let t=(0,z.c)(61),{device:n,busy:r,onClose:i,onRevoke:a,onRename:o}=e,c=s(he),u;t[0]===c?u=t[1]:(u=l(c),t[0]=c,t[1]=u);let d=u.endpointToolsSettings,f=c===`zh`?`zh-CN`:`en`,p;t[2]===f?p=t[3]:(p=new Intl.DateTimeFormat(f,{dateStyle:`medium`,timeStyle:`short`}),t[2]=f,t[3]=p);let m=p,h;t[4]===n?h=t[5]:(h=n?U(n):`offline`,t[4]=n,t[5]=h);let g=h,_=n!==null,y;t[6]===i?y=t[7]:(y=e=>!e&&i(),t[6]=i,t[7]=y);let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,V.jsx)(E,{className:C(`xopc-dialog-overlay fixed inset-0 bg-scrim`,ae)}),t[8]=b):b=t[8];let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=C(`xopc-drawer-right fixed right-0 top-0 flex size-full max-w-lg flex-col border-l border-edge bg-surface-overlay shadow-popover outline-none`,ie),t[9]=x):x=t[9];let T=n?.displayName??d.deviceDetails,O;t[10]===T?O=t[11]:(O=(0,V.jsx)(ne,{className:`truncate text-base font-semibold text-fg`,children:T}),t[10]=T,t[11]=O);let k;t[12]===n?k=t[13]:(k=n?(0,V.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[n.kind,` · `,n.platform,` · `,pe(n.id)]}):null,t[12]=n,t[13]=k);let A;t[14]!==O||t[15]!==k?(A=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[O,k]}),t[14]=O,t[15]=k,t[16]=A):A=t[16];let j;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,V.jsx)(S,{className:`size-5`,"aria-hidden":!0}),t[17]=j):j=t[17];let M;t[18]===d.close?M=t[19]:(M=(0,V.jsx)(ee,{asChild:!0,children:(0,V.jsx)(w,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":d.close,children:j})}),t[18]=d.close,t[19]=M);let N;t[20]!==A||t[21]!==M?(N=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[A,M]}),t[20]=A,t[21]=M,t[22]=N):N=t[22];let P;t[23]!==d.accessActive||t[24]!==d.accessRevoked||t[25]!==d.accessTitle||t[26]!==d.createdAt||t[27]!==d.endpointCount||t[28]!==d.endpointsTitle||t[29]!==d.identityId||t[30]!==d.identityTitle||t[31]!==d.lastSeen||t[32]!==d.never||t[33]!==d.noAccessIdentity||t[34]!==d.noOnlineEndpoints||t[35]!==d.noPermissions||t[36]!==d.permissions||t[37]!==d.status||t[38]!==d.statusLabel||t[39]!==d.toolCount||t[40]!==n||t[41]!==m||t[42]!==c||t[43]!==o||t[44]!==g?(P=n?(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4`,children:[n.principal&&g!==`revoked`&&o?(0,V.jsx)(ge,{device:n,zh:c===`zh`,onRename:o},`${n.id}:${n.settingsRevision??0}`):null,(0,V.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 rounded-xl bg-surface-hover/40 p-4`,children:[(0,V.jsx)(W,{label:d.statusLabel,value:d.status[g]}),(0,V.jsx)(W,{label:d.lastSeen,value:n.lastSeenAt?m.format(n.lastSeenAt):d.never}),(0,V.jsx)(W,{label:d.endpointCount,value:String(n.endpoints.length)}),(0,V.jsx)(W,{label:d.toolCount,value:String(ue(n))})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.accessTitle}),(0,V.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs text-fg-muted`,children:n.access?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{children:n.access.revokedAt?d.accessRevoked:d.accessActive}),(0,V.jsx)(`p`,{className:`mt-1`,children:n.access.requestProofVersion===1?c===`zh`?`设备请求签名已启用`:`Device request signing enabled`:c===`zh`?`请求签名未启用,设备不可用`:`Request signing is missing; device unavailable`}),(0,V.jsxs)(`p`,{className:`mt-1 break-words`,children:[d.permissions,`: `,n.access.scopes.join(`, `)||d.noPermissions]})]}):(0,V.jsx)(`p`,{children:d.noAccessIdentity})})]}),n.access&&!n.access.revokedAt&&n.platform!==`chrome`?(0,V.jsx)(_e,{device:n,zh:c===`zh`},n.id):null,(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.endpointsTitle}),(0,V.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[n.endpoints.length===0?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.noOnlineEndpoints}):null,n.endpoints.map(e=>(0,V.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,V.jsx)(`p`,{className:`min-w-0 break-all text-xs font-medium text-fg`,children:e.endpointId}),(0,V.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[d.status[e.availability],` · v`,e.appVersion]})]}),(0,V.jsx)(`div`,{className:`mt-3 space-y-2`,children:e.tools.map(e=>{let{descriptor:t}=e;return(0,V.jsxs)(`div`,{className:`rounded-lg bg-surface-hover/50 px-3 py-2`,children:[(0,V.jsx)(`p`,{className:`break-all text-xs font-medium text-fg`,children:t.title}),(0,V.jsxs)(`p`,{className:`mt-0.5 break-words text-xs text-fg-subtle`,children:[t.requiresForeground?c===`zh`?`需要设备在前台 · `:`Requires foreground · `:``,t.confirmation===`always`?c===`zh`?`每次确认`:`Confirm each time`:c===`zh`?`按已授权范围调用`:`Uses the authorized scope`]})]},t.name)})})]},e.connectionId))]})]}),(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:d.identityTitle}),n.principal&&g!==`revoked`&&o?(0,V.jsx)(ge,{device:n,zh:c===`zh`,onRename:o},`${n.id}:${n.settingsRevision??0}`):null,(0,V.jsxs)(`dl`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-3 text-xs`,children:[(0,V.jsx)(W,{label:d.identityId,value:n.id,breakAll:!0}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(W,{label:d.createdAt,value:m.format(n.createdAt)})})]})]})]}):null,t[23]=d.accessActive,t[24]=d.accessRevoked,t[25]=d.accessTitle,t[26]=d.createdAt,t[27]=d.endpointCount,t[28]=d.endpointsTitle,t[29]=d.identityId,t[30]=d.identityTitle,t[31]=d.lastSeen,t[32]=d.never,t[33]=d.noAccessIdentity,t[34]=d.noOnlineEndpoints,t[35]=d.noPermissions,t[36]=d.permissions,t[37]=d.status,t[38]=d.statusLabel,t[39]=d.toolCount,t[40]=n,t[41]=m,t[42]=c,t[43]=o,t[44]=g,t[45]=P):P=t[45];let F;t[46]!==r||t[47]!==d.removeDevice||t[48]!==d.revoking||t[49]!==n||t[50]!==a||t[51]!==g?(F=n&&g!==`revoked`?(0,V.jsx)(`div`,{className:`shrink-0 border-t border-edge px-4 py-3`,children:(0,V.jsxs)(w,{variant:`secondary`,className:`w-full text-danger`,disabled:r,onClick:()=>a(n),children:[(0,V.jsx)(v,{className:`size-4`,"aria-hidden":!0}),r?d.revoking:d.removeDevice]})}):null,t[46]=r,t[47]=d.removeDevice,t[48]=d.revoking,t[49]=n,t[50]=a,t[51]=g,t[52]=F):F=t[52];let I;t[53]!==N||t[54]!==P||t[55]!==F?(I=(0,V.jsxs)(te,{children:[b,(0,V.jsxs)(D,{className:x,"aria-describedby":void 0,children:[N,P,F]})]}),t[53]=N,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;return t[57]!==I||t[58]!==_||t[59]!==y?(L=(0,V.jsx)(re,{open:_,onOpenChange:y,children:I}),t[57]=I,t[58]=_,t[59]=y,t[60]=L):L=t[60],L}function he(e){return e.language}function W(e){let t=(0,z.c)(10),{label:n,value:r,breakAll:i}=e,a=i!==void 0&&i,o;t[0]===n?o=t[1]:(o=(0,V.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s=a&&`break-all font-mono text-xs`,c;t[2]===s?c=t[3]:(c=C(`mt-1 text-sm text-fg`,s),t[2]=s,t[3]=c);let l;t[4]!==c||t[5]!==r?(l=(0,V.jsx)(`dd`,{className:c,children:r}),t[4]=c,t[5]=r,t[6]=l):l=t[6];let u;return t[7]!==o||t[8]!==l?(u=(0,V.jsxs)(`div`,{className:`min-w-0`,children:[o,l]}),t[7]=o,t[8]=l,t[9]=u):u=t[9],u}function ge({device:e,zh:t,onRename:n}){let[r,i]=(0,B.useState)(e.displayName),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1);return(0,V.jsxs)(`form`,{className:`space-y-2`,onSubmit:async t=>{if(t.preventDefault(),!(a||!r.trim())){o(!0),c(!1);try{await n(e,r.trim())}catch{c(!0)}finally{o(!1)}}},children:[(0,V.jsxs)(`label`,{className:`block text-sm text-fg`,children:[t?`设备名称`:`Device name`,(0,V.jsx)(`input`,{value:r,maxLength:80,onChange:e=>i(e.target.value),className:`mt-2 h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-fg`})]}),(0,V.jsx)(w,{type:`submit`,variant:`secondary`,disabled:a||!r.trim()||r.trim()===e.displayName,children:a?t?`保存中…`:`Saving…`:t?`保存名称`:`Save name`}),s?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`保存失败,请刷新设备信息后重试。`:`Unable to save. Refresh device information and retry.`}):null]})}function _e({device:e,zh:t}){let n=e.access?.scopes.includes(`phone.control`)?`control`:e.access?.scopes.includes(`phone.view`)?`view`:`none`,[r,i]=(0,B.useState)(n),[a,s]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1);return(0,B.useEffect)(()=>i(n),[n]),(0,V.jsxs)(`section`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`云手机访问`:`Cloud phone access`}),(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`移动端配对后默认可查看并接管。可在此关闭,或撤销整个设备的授权。`:`Mobile pairing includes viewing and control by default. Disable it here or revoke the device entirely.`}),(0,V.jsxs)(p,{value:r,disabled:a,onChange:async t=>{let n=t.target.value;s(!0),u(!1);try{await c(o(`/api/phone/device-access/${encodeURIComponent(e.id)}`),{method:`PATCH`,body:JSON.stringify({access:n})}),i(n),await k(o(`/api/endpoint-tools/devices`))}catch{u(!0)}finally{s(!1)}},children:[(0,V.jsx)(m,{value:`none`,children:t?`不允许`:`Not allowed`}),(0,V.jsx)(m,{value:`view`,children:t?`仅查看`:`View only`}),(0,V.jsx)(m,{value:`control`,children:t?`查看并接管`:`View and control`})]}),l?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`授权保存失败,请重试。`:`Unable to save phone access.`}):null]})}function ve(e){let t=(0,z.c)(19),{onPaired:n}=e,[r,a]=i(),o=s(be),c;t[0]===o?c=t[1]:(c=l(o),t[0]=o,t[1]=c);let u=c.endpointToolsSettings.deviceAccess,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d={open:!1},t[2]=d):d=t[2];let[f,p]=(0,B.useState)(d),m,h;t[3]!==r||t[4]!==a?(m=()=>{let e=r.get(`startDevicePairing`);e!==`mobile`&&e!==`browser`||(p({open:!0,target:e}),a(ye,{replace:!0}))},h=[r,a],t[3]=r,t[4]=a,t[5]=m,t[6]=h):(m=t[5],h=t[6]),(0,B.useEffect)(m,h);let g,_;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p({open:!0}),_=(0,V.jsx)(y,{className:`size-4`,"aria-hidden":!0}),t[7]=g,t[8]=_):(g=t[7],_=t[8]);let v;t[9]===u.addDevice?v=t[10]:(v=(0,V.jsxs)(w,{variant:`primary`,onClick:g,children:[_,u.addDevice]}),t[9]=u.addDevice,t[10]=v);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>p(t=>({...t,open:e})),t[11]=b):b=t[11];let x;t[12]!==f.open||t[13]!==f.target||t[14]!==n?(x=(0,V.jsx)(R,{open:f.open,onOpenChange:b,onPaired:n,targetKind:f.target}),t[12]=f.open,t[13]=f.target,t[14]=n,t[15]=x):x=t[15];let S;return t[16]!==v||t[17]!==x?(S=(0,V.jsxs)(V.Fragment,{children:[v,x]}),t[16]=v,t[17]=x,t[18]=S):S=t[18],S}function ye(e){let t=new URLSearchParams(e);return t.delete(`startDevicePairing`),t}function be(e){return e.language}async function G(e){let t=await e.json().catch(()=>null);if(!e.ok||t?.payload===void 0)throw Error(t?.error?.message??`Endpoint management request failed: ${e.status}`);return t.payload}function xe(){return o(`/api/endpoint-tools/devices`)}function Se(e){let t=new URLSearchParams({page:String(e.page),pageSize:String(e.pageSize)});return e.query.trim()&&t.set(`query`,e.query.trim()),e.principalId&&t.set(`principalId`,e.principalId),e.status&&t.set(`status`,e.status),e.effect&&t.set(`effect`,e.effect),o(`/api/endpoint-tools/invocations?${t}`)}async function Ce(){return G(await a(xe()))}async function we(e){let t=Array.from({length:Math.ceil(e.length/100)},(t,n)=>e.slice(n*100,(n+1)*100));await Promise.all(t.map(async e=>{await G(await a(o(`/api/endpoint-tools/devices/revoke`),{method:`POST`,body:JSON.stringify({ids:e})}))}))}async function Te(e){return G(await a(Se(e)))}async function Ee(e,t,n){await G(await a(o(`/api/endpoint-tools/devices/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({nickname:t,expectedRevision:n})}))}var De=5e3,K=20,Oe=20;function ke(e){return e===`online`||e===`succeeded`?`bg-success-soft text-success`:e===`running`?`bg-accent-soft text-accent-fg`:e===`failed`||e===`revoked`?`bg-danger-soft text-danger`:`bg-surface-hover text-fg-muted`}function Ae(e){let t=(0,z.c)(5),{status:n,label:r}=e,i;t[0]===n?i=t[1]:(i=C(`rounded-full px-2 py-0.5 text-xs font-medium`,ke(n)),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,V.jsx)(`span`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function q(){let e=s(e=>e.language),t=l(e).endpointToolsSettings,[n,r]=i(),a=n.get(`view`)===`activity`?`activity`:`devices`,[o,c]=(0,B.useState)(null),[p,m]=(0,B.useState)([]),[y,S]=(0,B.useState)(!1),[T,E]=(0,B.useState)(!1),[ee,te]=(0,B.useState)(``),[D,ne]=(0,B.useState)(`active`),[re,ie]=(0,B.useState)(``),[ae,k]=(0,B.useState)(1),[A,R]=(0,B.useState)(()=>new Set),[z,H]=(0,B.useState)(``),[ce]=M(z,250),[le,he]=(0,B.useState)(``),[W,ge]=(0,B.useState)(``),[_e,ye]=(0,B.useState)(``),[be,G]=(0,B.useState)(1),ke={page:be,pageSize:Oe,query:ce,principalId:le,status:W,effect:_e},q=O(xe(),Ce,{refreshInterval:De}),J=O(a===`activity`?Se(ke):null,()=>Te(ke),{refreshInterval:De,keepPreviousData:!0}),je=(0,B.useMemo)(()=>new Intl.DateTimeFormat(e===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),[e]);if(q.isLoading&&!q.data)return(0,V.jsx)(I,{children:(0,V.jsx)(F,{sections:2})});let Y=q.data??[],Me=J.data?.items??[],Ne=Y.filter(e=>U(e)===`online`).length,Pe=Y.filter(e=>U(e)!==`revoked`).length,Fe=Y.filter(e=>de(e)).length,Ie=[...new Set(Y.map(e=>e.platform))].toSorted(),X=fe(Y,{query:ee,status:D,platform:re}),Le=Math.max(1,Math.ceil(X.length/K)),Z=Math.min(ae,Le),Re=X.slice((Z-1)*K,Z*K),Q=Re.reduce((e,t)=>(U(t)!==`revoked`&&e.push(t.id),e),[]),ze=Q.length>0&&Q.every(e=>A.has(e)),Be=e=>{r(t=>{let n=new URLSearchParams(t);return e===`devices`?n.delete(`view`):n.set(`view`,e),n},{replace:!0})},Ve=async()=>{await Promise.all([q.mutate(),a===`activity`?J.mutate():Promise.resolve()])},He=async()=>{if(!(p.length===0||y)){S(!0),E(!1);try{await we(p.map(e=>e.id)),m([]),R(new Set),await q.mutate()}catch{E(!0)}finally{S(!1)}}},$=e=>{e(),k(1),R(new Set)};return(0,V.jsxs)(I,{children:[(0,V.jsx)(L,{title:t.title,subtitle:t.subtitle,actions:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P,{className:`size-9 shrink-0 p-0`,label:t.refresh,onClick:Ve}),(0,V.jsx)(ve,{onPaired:()=>void q.mutate()})]})}),q.error||J.error?(0,V.jsx)(`div`,{className:`rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger`,children:t.loadError}):null,(0,V.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[{label:t.activeDevices,value:Pe,filter:`active`},{label:t.onlineDevices,value:Ne,filter:`online`},{label:t.staleDevices,value:Fe,filter:`stale`}].map(({label:e,value:t,filter:n})=>(0,V.jsxs)(`button`,{type:`button`,className:C(`touch-target rounded-xl px-4 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,D===n?`bg-surface-active`:`bg-surface-hover/20 hover:bg-surface-hover/50`),"aria-pressed":D===n,onClick:()=>{$(()=>ne(n)),Be(`devices`)},children:[(0,V.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e}),(0,V.jsx)(`span`,{className:`mt-1 block text-2xl font-semibold text-fg`,children:t})]},n))}),(0,V.jsx)(j,{items:[{id:`devices`,label:t.devicesTab,icon:_,count:Pe},{id:`activity`,label:t.activityTab,icon:u,count:J.data?.total}],activeTab:a,onChange:Be,ariaLabel:t.viewsAria,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`}),(0,V.jsxs)(oe,{id:`devices`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.devicesTitle,hint:t.devicesHint,children:[(0,V.jsx)(se,{devices:Y,zh:e===`zh`}),(0,V.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-[minmax(0,1fr)_11rem_11rem]`,children:[(0,V.jsxs)(`label`,{className:`relative block`,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:t.searchDevices}),(0,V.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`input`,{type:`search`,"aria-label":t.searchDevices,value:ee,placeholder:t.searchDevices,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>$(()=>te(e.target.value))})]}),(0,V.jsx)(h,{value:D,options:[{value:`active`,label:t.filterActive},{value:`online`,label:t.status.online},{value:`offline`,label:t.status.offline},{value:`stale`,label:t.filterStale},{value:`revoked`,label:t.status.revoked},{value:`all`,label:t.filterAll}],placeholder:t.statusLabel,allowEmpty:!1,ariaLabel:t.statusLabel,onChange:e=>$(()=>ne(e))}),(0,V.jsx)(h,{value:re,options:Ie.map(e=>({value:e,label:e})),placeholder:t.allPlatforms,emptyLabel:t.allPlatforms,ariaLabel:t.platformLabel,onChange:e=>$(()=>ie(e))})]}),A.size>0?(0,V.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl bg-accent-soft px-3 py-2`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-accent-fg`,children:t.selectedCount.replace(`{{count}}`,String(A.size))}),(0,V.jsxs)(w,{variant:`secondary`,className:`text-danger`,onClick:()=>{E(!1),m(Y.filter(e=>A.has(e.id)))},children:[(0,V.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t.removeSelected]})]}):null,Y.length===0?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noDevices}):X.length===0?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingDevices}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`flex min-h-10 items-center gap-3 border-b border-edge-subtle px-1`,children:(0,V.jsxs)(`label`,{className:C(`touch-target flex items-center gap-2 text-xs text-fg-muted`,Q.length>0?`cursor-pointer`:`cursor-not-allowed opacity-50`),children:[(0,V.jsx)(`input`,{type:`checkbox`,"aria-label":t.selectPage,checked:ze,disabled:Q.length===0,className:`size-4 accent-accent`,onChange:e=>{R(t=>{let n=new Set(t);for(let t of Q)e.target.checked?n.add(t):n.delete(t);return n})}}),t.selectPage]})}),(0,V.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:Re.map(e=>{let n=U(e),r=e.kind===`mobile`?x:g;return(0,V.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`label`,{className:C(`touch-target flex size-10 shrink-0 items-center justify-center`,n===`revoked`?`cursor-not-allowed opacity-40`:`cursor-pointer`),children:(0,V.jsx)(`input`,{type:`checkbox`,checked:A.has(e.id),disabled:n===`revoked`,"aria-label":t.selectDevice.replace(`{{name}}`,e.displayName),className:`size-4 accent-accent`,onChange:t=>{R(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}})}),(0,V.jsxs)(`button`,{type:`button`,className:`touch-target flex min-w-0 flex-1 items-center gap-3 py-3 text-left hover:bg-surface-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,V.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-inset text-fg-muted`,children:(0,V.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),(0,V.jsx)(Ae,{status:n,label:t.status[n]})]}),(0,V.jsxs)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:[e.platform,` · `,pe(e.id),` · `,t.lastSeen,`: `,e.lastSeenAt?je.format(e.lastSeenAt):t.never]})]}),(0,V.jsx)(`span`,{className:`hidden shrink-0 text-right text-xs text-fg-muted sm:block`,children:t.endpointSummary.replace(`{{endpoints}}`,String(e.endpoints.length)).replace(`{{tools}}`,String(ue(e)))}),(0,V.jsx)(f,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})]},e.id)})}),(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((Z-1)*K+1)).replace(`{{to}}`,String(Math.min(Z*K,X.length))).replace(`{{total}}`,String(X.length))}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(w,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:Z<=1,onClick:()=>k(e=>Math.max(1,e-1)),children:(0,V.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(w,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:Z>=Le,onClick:()=>k(e=>Math.min(Le,e+1)),children:(0,V.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]})]})]})]}),(0,V.jsxs)(oe,{id:`activity`,activeTab:a,tabIdPrefix:`endpoint-management-tab`,panelIdPrefix:`endpoint-management-panel`,title:t.callsTitle,hint:t.callsHint,children:[(0,V.jsxs)(`div`,{className:`mb-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,V.jsxs)(`label`,{className:`relative block sm:col-span-2 lg:col-span-1`,children:[(0,V.jsx)(`span`,{className:`sr-only`,children:t.searchActivity}),(0,V.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`input`,{type:`search`,"aria-label":t.searchActivity,value:z,placeholder:t.searchActivity,className:`h-10 w-full rounded-lg border border-edge bg-surface-inset pl-9 pr-3 text-base text-fg placeholder:text-fg-subtle focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,onChange:e=>{H(e.target.value),G(1)}})]}),(0,V.jsx)(h,{value:le,options:Y.map(e=>({value:e.id,label:`${e.displayName} · ${pe(e.id)}`})),placeholder:t.allDevices,emptyLabel:t.allDevices,ariaLabel:t.deviceLabel,onChange:e=>{he(e),G(1)}}),(0,V.jsx)(h,{value:W,options:[{value:`running`,label:t.status.running},{value:`succeeded`,label:t.status.succeeded},{value:`failed`,label:t.status.failed}],placeholder:t.allStatuses,emptyLabel:t.allStatuses,ariaLabel:t.statusLabel,onChange:e=>{ge(e),G(1)}}),(0,V.jsx)(h,{value:_e,options:[{value:`read`,label:t.effects.read},{value:`write`,label:t.effects.write},{value:`destructive`,label:t.effects.destructive}],placeholder:t.allEffects,emptyLabel:t.allEffects,ariaLabel:t.effectLabel,onChange:e=>{ye(e),G(1)}})]}),J.isLoading&&!J.data?(0,V.jsx)(F,{sections:1}):null,Me.length===0&&!J.isLoading?(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.noMatchingCalls}):null,(0,V.jsx)(`div`,{className:`space-y-2`,children:Me.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg bg-surface-base/55 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`break-all text-sm font-medium text-fg`,children:e.toolName}),(0,V.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:[je.format(e.startedAt),` · `,t.effects[e.effect],` · `,e.endpointId]}),e.errorMessage?(0,V.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e.errorMessage}):null]}),(0,V.jsx)(Ae,{status:e.status,label:t.status[e.status]})]},e.id))}),J.data&&J.data.total>0?(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 border-t border-edge-subtle pt-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.paginationSummary.replace(`{{from}}`,String((J.data.page-1)*J.data.pageSize+1)).replace(`{{to}}`,String(Math.min(J.data.page*J.data.pageSize,J.data.total))).replace(`{{total}}`,String(J.data.total))}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(w,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.previousPage,disabled:J.data.page<=1,onClick:()=>G(e=>Math.max(1,e-1)),children:(0,V.jsx)(d,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(w,{variant:`ghost`,className:`size-9 p-0`,"aria-label":t.nextPage,disabled:J.data.page>=J.data.totalPages,onClick:()=>G(e=>Math.min(J.data.totalPages,e+1)),children:(0,V.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]})]}):null]}),(0,V.jsx)(me,{device:o,busy:y,onRename:async(e,t)=>{await Ee(e.id,t,e.settingsRevision??0);let n=await q.mutate();c(n?.find(t=>t.id===e.id)??null)},onClose:()=>c(null),onRevoke:e=>{c(null),E(!1),m([e])}}),(0,V.jsx)(N,{open:p.length>0,title:p.length>1?t.removeManyTitle:t.removeTitle,description:`${p.length>1?t.removeManyDescription.replace(`{{count}}`,String(p.length)):t.removeDescription.replace(`{{name}}`,p[0]?.displayName??``)}${T?`\n\n${t.revokeError}`:``}`,confirmLabel:y?t.revoking:t.removeDevice,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void He(),onCancel:()=>{y||m([])}})]})}export{q as EndpointToolsManagementSettings};