@xopcai/xopc 0.0.465 → 0.0.466

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 (298) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/dingtalk/src/index.d.ts +8 -0
  3. package/dist/extensions/dingtalk/src/index.js +159 -0
  4. package/dist/extensions/dingtalk/xopc.extension.json +131 -0
  5. package/dist/extensions/discord/src/gateway.d.ts +13 -0
  6. package/dist/extensions/discord/src/gateway.js +186 -0
  7. package/dist/extensions/discord/src/index.d.ts +8 -0
  8. package/dist/extensions/discord/src/index.js +184 -0
  9. package/dist/extensions/discord/xopc.extension.json +113 -0
  10. package/dist/extensions/feishu/src/adapters/gateway-setup.js +33 -26
  11. package/dist/extensions/slack/src/index.d.ts +8 -0
  12. package/dist/extensions/slack/src/index.js +169 -0
  13. package/dist/extensions/slack/src/manifest.d.ts +33 -0
  14. package/dist/extensions/slack/src/manifest.js +32 -0
  15. package/dist/extensions/slack/xopc.extension.json +124 -0
  16. package/dist/extensions/telegram/src/adapters/gateway-setup.js +4 -1
  17. package/dist/extensions/telegram/xopc.extension.json +1 -1
  18. package/dist/extensions/wecom/src/index.d.ts +8 -0
  19. package/dist/extensions/wecom/src/index.js +188 -0
  20. package/dist/extensions/wecom/xopc.extension.json +131 -0
  21. package/dist/gateway/static/root/assets/{activity-store-B9heFbtJ.js → activity-store-CdEua6PR.js} +1 -1
  22. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-nzhB7Xjk.js → agent-avatar-dicebear-l8GQ4I9J.js} +1 -1
  23. package/dist/gateway/static/root/assets/{agent-avatar-display-DBzgoHMD.js → agent-avatar-display-BO1bqKlR.js} +2 -2
  24. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BJrNV93g.js → agent-defaults-settings-panel-Dj_H2kDD.js} +1 -1
  25. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DLbTHALG.js → agent-plugin-dialog-BQA2brAU.js} +1 -1
  26. package/dist/gateway/static/root/assets/agents-C5C5l13A.js +77 -0
  27. package/dist/gateway/static/root/assets/{agents-admin-api-CqQbYIiY.js → agents-admin-api-DZ1lLnrj.js} +1 -1
  28. package/dist/gateway/static/root/assets/api-CG-SjNfw.js +1 -0
  29. package/dist/gateway/static/root/assets/{api-BGodd--L.js → api-DDWYNF7I.js} +1 -1
  30. package/dist/gateway/static/root/assets/{api-8tNOT72p.js → api-DVXcGKP-.js} +1 -1
  31. package/dist/gateway/static/root/assets/{app-link-DImAfVs5.js → app-link-BkEO3eBe.js} +1 -1
  32. package/dist/gateway/static/root/assets/{app-management-settings-panel-Q7apF7KE.js → app-management-settings-panel-B5-7E03Z.js} +1 -1
  33. package/dist/gateway/static/root/assets/{appearance-settings-ClVZeUmo.js → appearance-settings-E_BcjEDM.js} +1 -1
  34. package/dist/gateway/static/root/assets/{apps-page-BsJJwpKj.js → apps-page-BjB_mjXu.js} +1 -1
  35. package/dist/gateway/static/root/assets/{archive-plugin-Bl_M0WJp.js → archive-plugin-MvSiDvxK.js} +1 -1
  36. package/dist/gateway/static/root/assets/{automation-api-BOnIc_vw.js → automation-api-24NjW7qG.js} +1 -1
  37. package/dist/gateway/static/root/assets/{automation-result-state-BwDSJs05.js → automation-result-state-C94Q3OEL.js} +1 -1
  38. package/dist/gateway/static/root/assets/{automation-run-list-CqlIq4BG.js → automation-run-list-BShRirWV.js} +1 -1
  39. package/dist/gateway/static/root/assets/automation-task-card-Bgq5Plux.js +2 -0
  40. package/dist/gateway/static/root/assets/{automations-page-Bimqx5Pc.js → automations-page-_apIsCPT.js} +1 -1
  41. package/dist/gateway/static/root/assets/automations-workspace-WmcQUi9O.js +9 -0
  42. package/dist/gateway/static/root/assets/{binary-plugins-DDNKe1Io.js → binary-plugins-C7i5pqkO.js} +1 -1
  43. package/dist/gateway/static/root/assets/{block-editor-BQ3amsRP.js → block-editor-DAWXPErA.js} +1 -1
  44. package/dist/gateway/static/root/assets/{browser-settings-page-CHf1_RVl.js → browser-settings-page-DI2PYAPC.js} +1 -1
  45. package/dist/gateway/static/root/assets/{capabilities-C5oWMC-Z.js → capabilities-CFWTer_v.js} +1 -1
  46. package/dist/gateway/static/root/assets/{capabilities-Cj8vl1ZY.js → capabilities-Dyw8xW90.js} +1 -1
  47. package/dist/gateway/static/root/assets/capabilities-page-C2RB9fzC.js +2 -0
  48. package/dist/gateway/static/root/assets/capabilities-settings-panel-DuQGhgAl.js +8 -0
  49. package/dist/gateway/static/root/assets/{capability-navigation-QtHJxxW2.js → capability-navigation-CZbCI5C2.js} +1 -1
  50. package/dist/gateway/static/root/assets/channels-DiDfjON8.js +1 -0
  51. package/dist/gateway/static/root/assets/{chat-agents-api-C3JChTsh.js → chat-agents-api-BksS0CNy.js} +1 -1
  52. package/dist/gateway/static/root/assets/{chat-chart-block-DrtmYOIo.js → chat-chart-block-aZIklMNN.js} +1 -1
  53. package/dist/gateway/static/root/assets/chat-page-BMZwIVXH.js +71 -0
  54. package/dist/gateway/static/root/assets/{chat-terminal-dock-B0D220I-.js → chat-terminal-dock-B4HoRIzf.js} +1 -1
  55. package/dist/gateway/static/root/assets/{command-palette-api-CkJ6_Yf3.js → command-palette-api-VhBEUFmw.js} +1 -1
  56. package/dist/gateway/static/root/assets/{composer-handoff-params-GKGdXjMZ.js → composer-handoff-params-DBpzHuNo.js} +1 -1
  57. package/dist/gateway/static/root/assets/{composer-model-config-control-DQCOWHzJ.js → composer-model-config-control-BhRAbdPW.js} +1 -1
  58. package/dist/gateway/static/root/assets/{composer-notifications-D__OU_xx.js → composer-notifications-nT-U6jcc.js} +1 -1
  59. package/dist/gateway/static/root/assets/{composer-payload-handoff-BBTbJ1bO.js → composer-payload-handoff-xEFHDnLo.js} +1 -1
  60. package/dist/gateway/static/root/assets/{computer-settings-page-DGRUCkOt.js → computer-settings-page-DXlH96m6.js} +1 -1
  61. package/dist/gateway/static/root/assets/{connected-providers-grid-BoDipD2g.js → connected-providers-grid-D8vBFsbY.js} +1 -1
  62. package/dist/gateway/static/root/assets/{connection-usage-guide-B1VUqibv.js → connection-usage-guide-C8jPm7QO.js} +1 -1
  63. package/dist/gateway/static/root/assets/{connector-service-page-bwQ1PekA.js → connector-service-page-B42yWHxS.js} +1 -1
  64. package/dist/gateway/static/root/assets/{connectors-api-BvYGL65q.js → connectors-api-so2a7xrD.js} +1 -1
  65. package/dist/gateway/static/root/assets/{connectors-page-BX6Jt6w5.js → connectors-page-yhOZIiUZ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{date-picker-ClRDaNBJ.js → date-picker-UEh3JM7r.js} +1 -1
  67. package/dist/gateway/static/root/assets/{date-time-picker-CA6H47M6.js → date-time-picker-Dci0LfAU.js} +1 -1
  68. package/dist/gateway/static/root/assets/{desktop-pet-Bi8Hgf-x.js → desktop-pet-BAU_GuBe.js} +1 -1
  69. package/dist/gateway/static/root/assets/{desktop-pet-settings-CQ6qE8lf.js → desktop-pet-settings-CYE2eTTf.js} +1 -1
  70. package/dist/gateway/static/root/assets/{dev-view-store-UCqQeWa2.js → dev-view-store-C7v4CIlF.js} +1 -1
  71. package/dist/gateway/static/root/assets/{device-pairing-wizard-gC-XZxt2.js → device-pairing-wizard-7NDkYmiZ.js} +1 -1
  72. package/dist/gateway/static/root/assets/{directory-picker-path-field-Y8snl5Xl.js → directory-picker-path-field-DmRZY8kg.js} +1 -1
  73. package/dist/gateway/static/root/assets/{extension-authoritative-grants-D2abOXTl.js → extension-authoritative-grants-DIeg1mg8.js} +1 -1
  74. package/dist/gateway/static/root/assets/{extension-debug-page-OOlRCInL.js → extension-debug-page-D8TAJgZ_.js} +1 -1
  75. package/dist/gateway/static/root/assets/{extension-iframe-host-D_WXBf6a.js → extension-iframe-host-CjfRKtQ4.js} +1 -1
  76. package/dist/gateway/static/root/assets/{extension-marketplace-api-Bmtm6-L1.js → extension-marketplace-api-V1oFBxVi.js} +1 -1
  77. package/dist/gateway/static/root/assets/{extension-message-router-xqjjSxcp.js → extension-message-router-DZahH1Hd.js} +1 -1
  78. package/dist/gateway/static/root/assets/{extension-page-bpQnyNz-.js → extension-page-DMuHBIHa.js} +1 -1
  79. package/dist/gateway/static/root/assets/{extension-provider-l7SvHEK1.js → extension-provider-lqJ1zIkA.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-settings-page-BvUtZGLT.js → extension-settings-page-D5IfKVff.js} +1 -1
  81. package/dist/gateway/static/root/assets/{file-preview-surface-B-r2ZnCV.js → file-preview-surface-B7B9qXm9.js} +1 -1
  82. package/dist/gateway/static/root/assets/{gateway-config-swr-DOwezeL2.js → gateway-config-swr-Dk3FtNv1.js} +1 -1
  83. package/dist/gateway/static/root/assets/{gateway-realtime-Br7dErHY.js → gateway-realtime-DMvo4pAc.js} +1 -1
  84. package/dist/gateway/static/root/assets/gateway-realtime-store-CJf-qaHZ.js +1 -0
  85. package/dist/gateway/static/root/assets/{gateway-restart-B3Xro3qd.js → gateway-restart-C2h5R1eP.js} +1 -1
  86. package/dist/gateway/static/root/assets/{gateway-settings-DCnP-HPj.js → gateway-settings-DGPaikv5.js} +1 -1
  87. package/dist/gateway/static/root/assets/{gateway-startup-retry-vteSIhYI.js → gateway-startup-retry-yZn7ShiP.js} +1 -1
  88. package/dist/gateway/static/root/assets/{global-defaults-api-Bpje9rVk.js → global-defaults-api-gsAa0Kj9.js} +1 -1
  89. package/dist/gateway/static/root/assets/{home-page-CNEgNWEQ.js → home-page-Dgopm60U.js} +3 -3
  90. package/dist/gateway/static/root/assets/{image-generation-api-BvpAa3Lj.js → image-generation-api-DPn1SBMH.js} +1 -1
  91. package/dist/gateway/static/root/assets/{imports-page-Dx5T5pqw.js → imports-page-Cc48Uq20.js} +1 -1
  92. package/dist/gateway/static/root/assets/index-BE3XMuQI.js +11 -0
  93. package/dist/gateway/static/root/assets/index-CY5vdQcc.css +1 -0
  94. package/dist/gateway/static/root/assets/{install-connector-dialog-Cb4ufypG.js → install-connector-dialog-QkJMw_uW.js} +1 -1
  95. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEuXrnv0.js → keyboard-shortcuts-settings-BZXqXuI4.js} +1 -1
  96. package/dist/gateway/static/root/assets/{local-app-workbench-page-CPFIbEbv.js → local-app-workbench-page-wekatwet.js} +1 -1
  97. package/dist/gateway/static/root/assets/{local-apps-page-DxHcRSxc.js → local-apps-page-D-bRvlZY.js} +1 -1
  98. package/dist/gateway/static/root/assets/{local-session-drafts-Cmc-GCVa.js → local-session-drafts-CZ19DRRK.js} +1 -1
  99. package/dist/gateway/static/root/assets/{locale-store-tI9VX7dp.js → locale-store-DIBIYLnI.js} +1 -1
  100. package/dist/gateway/static/root/assets/{logs-page-BcibwftP.js → logs-page-CukseY3k.js} +1 -1
  101. package/dist/gateway/static/root/assets/{management-api-C9tFjLcE.js → management-api-EG5duPec.js} +1 -1
  102. package/dist/gateway/static/root/assets/{management-settings-DbnAlXoB.js → management-settings-B7RWHrwo.js} +1 -1
  103. package/dist/gateway/static/root/assets/{markdown-view-CSpQhSka.js → markdown-view-C30KvTaE.js} +1 -1
  104. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DedbjJbF.js → mcp-conversation-setup-page-BZ1PDTYY.js} +1 -1
  105. package/dist/gateway/static/root/assets/{media-plugins-BYnP_orq.js → media-plugins-DlMEwcS8.js} +1 -1
  106. package/dist/gateway/static/root/assets/messages-BDBGlBKh.js +3 -0
  107. package/dist/gateway/static/root/assets/{model-selector-B4oTiJI6.js → model-selector-COGICRIG.js} +1 -1
  108. package/dist/gateway/static/root/assets/{models-hub-cache-DpEClnsE.js → models-hub-cache-aRYHi2dh.js} +1 -1
  109. package/dist/gateway/static/root/assets/new-chat-navigation-DXYDldT_.js +1 -0
  110. package/dist/gateway/static/root/assets/{note-detail-panel-D8asMfBm.js → note-detail-panel-yAPC_cZU.js} +3 -3
  111. package/dist/gateway/static/root/assets/note-image-lightbox-CxXu_Tkh.js +1 -0
  112. package/dist/gateway/static/root/assets/{notes-api-pVC1amyp.js → notes-api-BXevQivV.js} +1 -1
  113. package/dist/gateway/static/root/assets/{notes-page-CG1_6PLz.js → notes-page-CUMhjKKd.js} +1 -1
  114. package/dist/gateway/static/root/assets/{oauth-api-BsVPwufr.js → oauth-api-enDU_32p.js} +1 -1
  115. package/dist/gateway/static/root/assets/{oauth-provider-connect-Bu20kmPq.js → oauth-provider-connect-C2pfvPOI.js} +1 -1
  116. package/dist/gateway/static/root/assets/{page-context-capture-button-CDsnNXjS.js → page-context-capture-button-BaSooYGv.js} +1 -1
  117. package/dist/gateway/static/root/assets/{page-context-draft-D6tu8c_9.js → page-context-draft-4-3RtO0q.js} +1 -1
  118. package/dist/gateway/static/root/assets/page-header-store-C2ydtnXa.js +1 -0
  119. package/dist/gateway/static/root/assets/{personal-avatar-BboNc6e2.js → personal-avatar-BPQpvC34.js} +1 -1
  120. package/dist/gateway/static/root/assets/personal-page-POCG1_kK.js +1 -0
  121. package/dist/gateway/static/root/assets/{personal-profile-settings-Cd4QyseL.js → personal-profile-settings-DwMdjQ6H.js} +1 -1
  122. package/dist/gateway/static/root/assets/{personal-settings-panel-CtBY_Uk1.js → personal-settings-panel-DiNpP_g3.js} +1 -1
  123. package/dist/gateway/static/root/assets/{phone-dependencies-card-BgH1LluB.js → phone-dependencies-card-DUT-qRLZ.js} +1 -1
  124. package/dist/gateway/static/root/assets/{phone-model-connection-DkdKU5Kv.js → phone-model-connection-pvOciDNo.js} +1 -1
  125. package/dist/gateway/static/root/assets/{phone-model-picker-0g1z4RPL.js → phone-model-picker-CD97E6C5.js} +1 -1
  126. package/dist/gateway/static/root/assets/{phone-settings-page-DlIUajBY.js → phone-settings-page-BUZ1dh7s.js} +1 -1
  127. package/dist/gateway/static/root/assets/{phone-workspace-store-DW2sZtkh.js → phone-workspace-store-BwilERgv.js} +1 -1
  128. package/dist/gateway/static/root/assets/{plugin-details-dialog-9KUkZk_t.js → plugin-details-dialog-C_uOVmJv.js} +1 -1
  129. package/dist/gateway/static/root/assets/{preference-select-fields-DH5QZhIc.js → preference-select-fields-BSUgcO7-.js} +1 -1
  130. package/dist/gateway/static/root/assets/{product-automation-feedback-a1thJ0M9.js → product-automation-feedback-BlwtlUY7.js} +1 -1
  131. package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +1 -0
  132. package/dist/gateway/static/root/assets/{product-open-page-DCzQh7tr.js → product-open-page-Dy6D5exJ.js} +1 -1
  133. package/dist/gateway/static/root/assets/{product-preview-content-C5TLcagj.js → product-preview-content-DEUPAilo.js} +1 -1
  134. package/dist/gateway/static/root/assets/product-preview-modal-C4TV9RUd.js +2 -0
  135. package/dist/gateway/static/root/assets/project-detail-page-BjOzJyw1.js +7 -0
  136. package/dist/gateway/static/root/assets/{project-understanding-CoPBvlqf.js → project-understanding-lOJ5Tz2V.js} +1 -1
  137. package/dist/gateway/static/root/assets/{projects-page-k1v8Fry8.js → projects-page-B3aGdPHy.js} +1 -1
  138. package/dist/gateway/static/root/assets/{providers-api-BSJZyO8n.js → providers-api-C26HgxZY.js} +1 -1
  139. package/dist/gateway/static/root/assets/{recording-upload-CExCePtr.js → recording-upload-BJkXktA-.js} +1 -1
  140. package/dist/gateway/static/root/assets/{registry-api-CqcJj60w.js → registry-api-pQ0eInzG.js} +1 -1
  141. package/dist/gateway/static/root/assets/{remote-access-hub-BLFkNl1y.js → remote-access-hub-CjWrYzjf.js} +1 -1
  142. package/dist/gateway/static/root/assets/{resource-unavailable-B_BXTQa7.js → resource-unavailable-Y9WRHOnz.js} +1 -1
  143. package/dist/gateway/static/root/assets/{right-workspace-store-OceFhUjM.js → right-workspace-store-DHHyicqQ.js} +1 -1
  144. package/dist/gateway/static/root/assets/route-preload-DjYsRhY1.js +2 -0
  145. package/dist/gateway/static/root/assets/{routine-panel-BsE9o9uu.js → routine-panel-DSNsdpy8.js} +2 -2
  146. package/dist/gateway/static/root/assets/{runtime-tools-api-aAZChVm4.js → runtime-tools-api-BoJQ3u5o.js} +1 -1
  147. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bn9HTrK5.js → runtime-tools-settings-panel-DB7cfLrX.js} +1 -1
  148. package/dist/gateway/static/root/assets/schema-form-DXHzZPMr.js +1 -0
  149. package/dist/gateway/static/root/assets/send-1f1Ntw6E.js +1 -0
  150. package/dist/gateway/static/root/assets/{service-recommendation-list-BNIVRGDf.js → service-recommendation-list-_rFmwIwY.js} +1 -1
  151. package/dist/gateway/static/root/assets/{session-api-DdW7Wix2.js → session-api-a6wb0_Gf.js} +1 -1
  152. package/dist/gateway/static/root/assets/{session-channel-icon-DUJbB-Km.js → session-channel-icon-COynhpeK.js} +1 -1
  153. package/dist/gateway/static/root/assets/{session-identity-label-DjhlQ6LU.js → session-identity-label-DCIZvqbN.js} +1 -1
  154. package/dist/gateway/static/root/assets/session-manager-D5g6LOU-.js +25 -0
  155. package/dist/gateway/static/root/assets/{sessions-page-CfhKeUkZ.js → sessions-page-dEupc-3A.js} +1 -1
  156. package/dist/gateway/static/root/assets/settings-advanced-gate-DjyibJZ1.js +1 -0
  157. package/dist/gateway/static/root/assets/{settings-advanced-section-BOoJfJuB.js → settings-advanced-section-CnGJr2xp.js} +1 -1
  158. package/dist/gateway/static/root/assets/{settings-mode-store-BMh_BQ9a.js → settings-mode-store-DWRhupcY.js} +1 -1
  159. package/dist/gateway/static/root/assets/{settings-page-header-Bfu4cuQd.js → settings-page-header-wL2jvs-y.js} +1 -1
  160. package/dist/gateway/static/root/assets/{settings-page-layout-BnZa1qHH.js → settings-page-layout-BkUQVmyY.js} +1 -1
  161. package/dist/gateway/static/root/assets/{settings-page-M6XwzIyu.js → settings-page-u-U9D9qT.js} +1 -1
  162. package/dist/gateway/static/root/assets/{setup-interaction-page-CVlrVNrm.js → setup-interaction-page-D238tuw-.js} +1 -1
  163. package/dist/gateway/static/root/assets/{setup-status-panel-FFyDODEx.js → setup-status-panel-DXvYjIu3.js} +1 -1
  164. package/dist/gateway/static/root/assets/{share-link-dialog-Cv-eDEw_.js → share-link-dialog-DFDJyl3N.js} +1 -1
  165. package/dist/gateway/static/root/assets/{share-preview-page-BctH6eFs.js → share-preview-page-BYPdlPIb.js} +1 -1
  166. package/dist/gateway/static/root/assets/{shares-api-cLTEcQLE.js → shares-api-CfFiW03g.js} +1 -1
  167. package/dist/gateway/static/root/assets/{shares-settings-DcetAN8K.js → shares-settings-B85XIDFv.js} +1 -1
  168. package/dist/gateway/static/root/assets/{skill-api-CgEZJoy9.js → skill-api-CWRhFSkA.js} +1 -1
  169. package/dist/gateway/static/root/assets/{skill-list-api-BWVr2PL5.js → skill-list-api-CmPp2czp.js} +1 -1
  170. package/dist/gateway/static/root/assets/{skill-reload-api-BLhHNvaK.js → skill-reload-api-BGsSq3dj.js} +1 -1
  171. package/dist/gateway/static/root/assets/{skills-page-DIjcAvA0.js → skills-page-DqD0FPeH.js} +1 -1
  172. package/dist/gateway/static/root/assets/{system-settings-panel-C7LAPaN_.js → system-settings-panel-aw9C86I8.js} +1 -1
  173. package/dist/gateway/static/root/assets/task-detail-page-BPHt6S1V.js +3 -0
  174. package/dist/gateway/static/root/assets/{task-result-evidence-BsBn3n_l.js → task-result-evidence-C-zIBpzi.js} +1 -1
  175. package/dist/gateway/static/root/assets/{terminal-panel-store-DJbLuUku.js → terminal-panel-store-CgPqgrm7.js} +1 -1
  176. package/dist/gateway/static/root/assets/{theme-store-QGcjV6pN.js → theme-store-DxF7S6I2.js} +1 -1
  177. package/dist/gateway/static/root/assets/{tracing-settings-page-BKCiPwYL.js → tracing-settings-page-Dvlunx28.js} +1 -1
  178. package/dist/gateway/static/root/assets/{tunnel-api-S7J5Lpzt.js → tunnel-api-CIte6n0U.js} +1 -1
  179. package/dist/gateway/static/root/assets/{understanding-activity-store-BNVhtJkn.js → understanding-activity-store-C2RHmRo8.js} +1 -1
  180. package/dist/gateway/static/root/assets/{understanding-refresh-store-CM6bUcaJ.js → understanding-refresh-store-CPeQIXS_.js} +1 -1
  181. package/dist/gateway/static/root/assets/{usage-page-D-AqzjIx.js → usage-page-DPUjEj39.js} +1 -1
  182. package/dist/gateway/static/root/assets/{use-autosave-CqZbhhCc.js → use-autosave-xX2KrbXw.js} +1 -1
  183. package/dist/gateway/static/root/assets/{use-composer-attachments-BfLhIb2_.js → use-composer-attachments-UhypPQH_.js} +1 -1
  184. package/dist/gateway/static/root/assets/{use-file-preview-expanded-DufxDues.js → use-file-preview-expanded-BvEF3yHL.js} +3 -3
  185. package/dist/gateway/static/root/assets/{use-personal-profile-RnjxZnLa.js → use-personal-profile-BJgaheR4.js} +1 -1
  186. package/dist/gateway/static/root/assets/{use-realtime-voice-w3aHR2dr.js → use-realtime-voice-RQW5KnIN.js} +1 -1
  187. package/dist/gateway/static/root/assets/{use-workspace-tree-2Ck-ql5c.js → use-workspace-tree-B6QFV5gR.js} +1 -1
  188. package/dist/gateway/static/root/assets/{user-model-page-CBcGMhrR.js → user-model-page-hKnsTcMk.js} +1 -1
  189. package/dist/gateway/static/root/assets/{voice-api-key-field-C4rhpgco.js → voice-api-key-field-BeEF7Thh.js} +1 -1
  190. package/dist/gateway/static/root/assets/{voice-config-api-7AHN-ns6.js → voice-config-api-vbBoKnqd.js} +1 -1
  191. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-BbRrj833.js → voice-input-shortcut-events-CKn6X3qL.js} +1 -1
  192. package/dist/gateway/static/root/assets/{voice-settings-wamtp0lg.js → voice-settings-BUrk4mwV.js} +1 -1
  193. package/dist/gateway/static/root/assets/{work-discovery-overlay-fVofN7aP.js → work-discovery-overlay-Ddvqu02U.js} +1 -1
  194. package/dist/gateway/static/root/assets/{work-discovery-page-DcQG5GWy.js → work-discovery-page-BdBpri6P.js} +1 -1
  195. package/dist/gateway/static/root/assets/{working-directory-picker-modal-D8Stwszr.js → working-directory-picker-modal-DStgfCzQ.js} +1 -1
  196. package/dist/gateway/static/root/assets/{workspace-api-D3iuTdNK.js → workspace-api-CscTRODe.js} +2 -2
  197. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CyPjTDSx.js +1 -0
  198. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BXbL5Y1h.js → workspace-file-preview-dialog-BRQIf4sc.js} +1 -1
  199. package/dist/gateway/static/root/assets/{workspace-open-location-menu-1gFO_BdL.js → workspace-open-location-menu-CBHFZ2iQ.js} +1 -1
  200. package/dist/gateway/static/root/assets/{workspace-preview-store-adwmi4nx.js → workspace-preview-store-DNLnuHlf.js} +1 -1
  201. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DhGh4rm7.js → xopc-cloud-account-card-Cm0Saa8B.js} +1 -1
  202. package/dist/gateway/static/root/index.html +99 -97
  203. package/dist/package.js +1 -1
  204. package/dist/packages/gateway-contract/src/index.js +2 -0
  205. package/dist/packages/gateway-contract/src/product-delivery.js +2 -0
  206. package/dist/packages/gateway-contract/src/video-generation.js +75 -0
  207. package/dist/src/agent/embedded/runs.d.ts +1 -0
  208. package/dist/src/agent/embedded/runs.js +5 -2
  209. package/dist/src/agent/inbound/attachment-pipeline.d.ts +1 -1
  210. package/dist/src/agent/inbound/attachment-pipeline.js +16 -10
  211. package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
  212. package/dist/src/agent/inbound/turn-dispatcher.js +31 -13
  213. package/dist/src/agent/messaging/outbound-coordinator.js +1 -0
  214. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  215. package/dist/src/agent/tools/xopc-use-tool.js +12 -1
  216. package/dist/src/channels/bundled-channel-extensions.d.ts +1 -0
  217. package/dist/src/channels/bundled-channel-extensions.js +15 -0
  218. package/dist/src/channels/enterprise/config-surface.d.ts +1 -0
  219. package/dist/src/channels/enterprise/config-surface.js +19 -0
  220. package/dist/src/channels/enterprise/plugin.d.ts +39 -0
  221. package/dist/src/channels/enterprise/plugin.js +219 -0
  222. package/dist/src/channels/enterprise/setup.d.ts +34 -0
  223. package/dist/src/channels/enterprise/setup.js +262 -0
  224. package/dist/src/channels/enterprise/socket.d.ts +12 -0
  225. package/dist/src/channels/enterprise/socket.js +107 -0
  226. package/dist/src/channels/lifecycle-supervisor.js +11 -1
  227. package/dist/src/channels/plugin-types.d.ts +9 -0
  228. package/dist/src/channels/plugins/types.adapters.d.ts +12 -0
  229. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  230. package/dist/src/extensions/activation-planner.js +8 -2
  231. package/dist/src/extensions/bundled-extension-activation.js +9 -0
  232. package/dist/src/gateway/hono/app.js +6 -2
  233. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
  234. package/dist/src/gateway/hono/lib/config-payload.js +2 -1
  235. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +2 -1
  236. package/dist/src/gateway/hono/routes/channels.js +2 -1
  237. package/dist/src/gateway/hono/routes/home.js +1 -1
  238. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  239. package/dist/src/gateway/hono/routes/video-generation.d.ts +3 -0
  240. package/dist/src/gateway/hono/routes/video-generation.js +166 -0
  241. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  242. package/dist/src/gateway/service/session-input-coordinator.d.ts +2 -0
  243. package/dist/src/gateway/service/session-input-coordinator.js +11 -3
  244. package/dist/src/gateway/service.d.ts +1 -0
  245. package/dist/src/gateway/service.js +8 -4
  246. package/dist/src/home-intelligence/host.js +5 -5
  247. package/dist/src/session/client-history.d.ts +1 -0
  248. package/dist/src/session/client-history.js +5 -6
  249. package/dist/src/session/store.js +4 -0
  250. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  251. package/dist/src/storage/sqlite/schema.js +7 -7
  252. package/dist/src/storage/sqlite/schema.sql +31 -0
  253. package/dist/src/storage/sqlite/session-input-repository.js +5 -2
  254. package/dist/src/storage/sqlite/transcript-repository.js +12 -0
  255. package/dist/src/storage/sqlite/upgrades/275_video_generation.sql +28 -0
  256. package/dist/src/storage/sqlite/upgrades/276_video_provider_selection.sql +11 -0
  257. package/dist/src/video-generation/artifact.d.ts +5 -0
  258. package/dist/src/video-generation/artifact.js +91 -0
  259. package/dist/src/video-generation/provider-types.d.ts +21 -0
  260. package/dist/src/video-generation/provider-types.js +14 -0
  261. package/dist/src/video-generation/providers.d.ts +15 -0
  262. package/dist/src/video-generation/providers.js +72 -0
  263. package/dist/src/video-generation/repository.d.ts +58 -0
  264. package/dist/src/video-generation/repository.js +91 -0
  265. package/dist/src/video-generation/seedance.d.ts +4 -0
  266. package/dist/src/video-generation/seedance.js +72 -0
  267. package/dist/src/video-generation/settings.d.ts +5 -0
  268. package/dist/src/video-generation/settings.js +25 -0
  269. package/dist/src/video-generation/wan.d.ts +9 -0
  270. package/dist/src/video-generation/wan.js +59 -0
  271. package/dist/src/video-generation/worker.d.ts +8 -0
  272. package/dist/src/video-generation/worker.js +98 -0
  273. package/package.json +1 -1
  274. package/dist/gateway/static/root/assets/agents-C2xG8f56.js +0 -77
  275. package/dist/gateway/static/root/assets/arrow-up-right-T72JbQ1Q.js +0 -1
  276. package/dist/gateway/static/root/assets/automation-task-card-D3WXVKRs.js +0 -2
  277. package/dist/gateway/static/root/assets/automations-workspace-2SOvmw-f.js +0 -9
  278. package/dist/gateway/static/root/assets/capabilities-page-U_hQx5ou.js +0 -2
  279. package/dist/gateway/static/root/assets/capabilities-settings-panel-k5CcwhXN.js +0 -8
  280. package/dist/gateway/static/root/assets/channels-BUzno8Pi.js +0 -1
  281. package/dist/gateway/static/root/assets/chat-page-qnsMsF_s.js +0 -71
  282. package/dist/gateway/static/root/assets/gateway-realtime-store-OaEqjNTb.js +0 -1
  283. package/dist/gateway/static/root/assets/index-Cdo4_zon.js +0 -11
  284. package/dist/gateway/static/root/assets/index-DYTktubl.css +0 -1
  285. package/dist/gateway/static/root/assets/messages-e5MhDONm.js +0 -3
  286. package/dist/gateway/static/root/assets/new-chat-navigation-B6NPQ4h4.js +0 -1
  287. package/dist/gateway/static/root/assets/note-image-lightbox-DcDw5kp4.js +0 -1
  288. package/dist/gateway/static/root/assets/page-header-store-DeaRqZgV.js +0 -1
  289. package/dist/gateway/static/root/assets/personal-page-gMRmLCWG.js +0 -1
  290. package/dist/gateway/static/root/assets/product-delivery-BFfqdKLe.js +0 -1
  291. package/dist/gateway/static/root/assets/product-preview-modal-D9f-7kcI.js +0 -2
  292. package/dist/gateway/static/root/assets/project-detail-page-C4Z2HTRZ.js +0 -7
  293. package/dist/gateway/static/root/assets/route-preload-ClsAFFQc.js +0 -2
  294. package/dist/gateway/static/root/assets/schema-form-BxBDgLrg.js +0 -1
  295. package/dist/gateway/static/root/assets/session-manager-XgtApqIh.js +0 -25
  296. package/dist/gateway/static/root/assets/settings-advanced-gate-BBG8dTIY.js +0 -1
  297. package/dist/gateway/static/root/assets/task-detail-page-DmNEMg-l.js +0 -3
  298. package/dist/gateway/static/root/assets/workspace-editor-agent-store-C-J7vr2o.js +0 -1
@@ -1,77 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-BQ3amsRP.js","assets/rolldown-runtime-aKtaBQYM.js","assets/vendor-react-BOUWij0V.js","assets/locale-store-tI9VX7dp.js","assets/messages-e5MhDONm.js","assets/unlink-NsCMuCT1.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/notes-api-pVC1amyp.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/markdown-view-CSpQhSka.js","assets/diagnostics-Bo0Z42P_.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/chat-chart-block-DrtmYOIo.js","assets/skeleton-DzdOeGYz.js","assets/list-todo-CTVRto8O.js","assets/loader-circle-CifKLtgG.js","assets/mic-CuUb7zc-.js","assets/pause-DuPxgSxk.js","assets/pencil-DmIY3Oa-.js","assets/play-kxZvpBg8.js","assets/undo-2-6IMTwK4M.js","assets/vendor-swr-CdRzEUwF.js","assets/floating-ui.dom-seOukHzT.js","assets/linkify-it-BkqEorO0.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/with-selector-xonYxPoM.js","assets/note-image-lightbox-DcDw5kp4.js","assets/block-editor-Cvy3D_4T.css","assets/markdown-editor-CjQJ-Nho.js","assets/languages-kF11aUYU.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{l as o,n as s}from"./locale-store-tI9VX7dp.js";import{t as c}from"./messages-e5MhDONm.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./bot-DjLkhyZL.js";import{t as _}from"./briefcase-business-BsoCaI_t.js";import{i as v,s as y}from"./popover-select-CLsphyzA.js";import{t as b}from"./code-xml-DJtYhZUF.js";import{t as x}from"./ellipsis-0k4rZLoy.js";import{t as S}from"./eye-CABVeTq0.js";import{t as C}from"./heart-Cp4rgrqn.js";import{t as w}from"./markdown-view-CSpQhSka.js";import{t as T}from"./message-square-plus-XP0tGdlV.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as D}from"./plus-Q2yW6OE7.js";import{t as O}from"./rotate-ccw-JM1TBLpp.js";import{t as k}from"./settings-uiTATseT.js";import{t as A}from"./sliders-horizontal-DqsYor6I.js";import{t as j}from"./triangle-alert-2JXFNNKU.js";import{t as M}from"./upload-rrb46c3c.js";import{t as N}from"./x-B_N4OPjy.js";import{t as P}from"./cn-0WouolD0.js";import{t as F}from"./skeleton-DzdOeGYz.js";import{t as I}from"./specialists-xbB3xL9e.js";import{a as L}from"./new-session-preferences-gb411vZP.js";import{i as R}from"./vendor-swr-CdRzEUwF.js";import{r as z}from"./gateway-config-swr-DOwezeL2.js";import{n as B,t as V}from"./registry-api-CqcJj60w.js";import{c as H,i as U,l as W,n as G,o as K,r as ee,s as q,t as te}from"./agents-admin-api-CqQbYIiY.js";import{t as J}from"./button-Cc4hUNTt.js";import{i as ne,o as re}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as Y}from"./interaction-BdhHBbYa.js";import{i as ie}from"./theme-store-QGcjV6pN.js";import{t as ae}from"./page-tabs-oeTY7z3_.js";import{i as oe,r as se,s as ce,t as le}from"./agent-avatar-display-DBzgoHMD.js";import{n as ue}from"./composer-handoff-params-GKGdXjMZ.js";import{n as de,r as fe,t as pe}from"./agent-display-names-Bje7vfSn.js";import{t as me}from"./sliding-tab-list-CmcrqRzN.js";import{t as he}from"./confirm-dialog-DrA5mTQp.js";import{l as ge,m as _e,o as ve,r as ye,t as be}from"./dist-ZrL34Ps4.js";import{n as xe}from"./model-selector-B4oTiJI6.js";import{n as Se,t as Ce}from"./agents-app-path-ciChvpCS.js";import{t as we}from"./settings-advanced-section-BOoJfJuB.js";import{t as Te}from"./use-media-query-ady-FgjK.js";import{t as Ee}from"./number-input-El7Szeln.js";import{n as De}from"./settings-page-header-Bfu4cuQd.js";import"./settings-page-layout-BnZa1qHH.js";import{t as Oe}from"./phone-model-picker-0g1z4RPL.js";import{t as ke}from"./directory-picker-path-field-Y8snl5Xl.js";import{r as Ae,s as je}from"./image-generation-api-BvpAa3Lj.js";var X=e(t(),1),Z=n();function Me(e){let t=e.match(/^(---\r?\n[\s\S]*?\r?\n---(?:\r?\n)*)/);return t?{frontMatter:t[1],body:e.slice(t[1].length)}:{frontMatter:``,body:e}}function Ne(e,t){let{frontMatter:n}=Me(e);return`${n}${t}`}var Pe=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
3
-
4
- ## Core Truths
5
-
6
- **Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
7
-
8
- **Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
9
-
10
- **Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
11
-
12
- **Remember you're a guest.** You have access to someone's life. Treat it with respect.
13
-
14
- ## Boundaries
15
-
16
- - Private things stay private. Period.
17
- - When in doubt, ask before acting externally.
18
- - Never send half-baked replies to messaging surfaces.
19
-
20
- ## Vibe
21
-
22
- Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
23
-
24
- ## Core Truths
25
-
26
- **Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
27
-
28
- **Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
29
-
30
- **Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
31
-
32
- **Earn trust by being reliable.** Show up, follow through, and remember what matters.
33
-
34
- **Respect the intimacy.** You have access to someone's life. That's a privilege.
35
-
36
- ## Boundaries
37
-
38
- - Private things stay private. Always.
39
- - When in doubt, ask before acting externally.
40
- - Be careful in group chats — you're not the user's voice.
41
-
42
- ## Vibe
43
-
44
- Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑‍💻`,content:`# SOUL.md - Who You Are
45
-
46
- ## Core Truths
47
-
48
- **Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
49
-
50
- **Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
51
-
52
- **Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
53
-
54
- **Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
55
-
56
- **Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
57
-
58
- ## Boundaries
59
-
60
- - Private things stay private.
61
- - When in doubt, ask before acting externally.
62
- - Never send half-baked replies.
63
-
64
- ## Vibe
65
-
66
- Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}],Fe=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}],Q=r(),Ie=()=>i(()=>import(`./block-editor-BQ3amsRP.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47])),Le=()=>i(()=>import(`./markdown-editor-CjQJ-Nho.js`),__vite__mapDeps([48,1,2,44,49,18])),Re=(0,X.lazy)(()=>Ie().then(e=>({default:e.BlockEditor}))),ze=(0,X.lazy)(()=>Le().then(e=>({default:e.MarkdownEditor})));function Be(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`space-y-3 p-5`,"aria-busy":`true`,children:[(0,Q.jsx)(F,{className:`h-8 w-52`}),(0,Q.jsx)(F,{className:`h-4 w-full`}),(0,Q.jsx)(F,{className:`h-4 w-4/5`}),(0,Q.jsx)(F,{className:`h-4 w-11/12`})]}),e[0]=t):t=e[0],t}var Ve=(0,X.forwardRef)(function({agentId:e,file:t,zh:n,onDirtyChange:r},i){let a=ie(e=>e.resolved===`dark`),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!0),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[v,y]=(0,X.useState)(null),[x,T]=(0,X.useState)(!1),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(null),[j,M]=(0,X.useState)(`direct`);(0,X.useEffect)(()=>{let n=!1;return d(!0),p(!1),y(null),s(``),l(``),T(!1),A(null),(async()=>{try{let r=await U(e),i=new Set(r.files.filter(e=>!e.missing).map(e=>e.name)).has(t)?await ee(e,t):``;if(n)return;s(i),l(i)}catch(e){if(n)return;p(!0),y(e instanceof Error?e.message:String(e))}finally{n||d(!1)}})(),()=>{n=!0}},[e,t]);let N=o!==c;(0,X.useEffect)(()=>r(N),[N,r]);let F=(0,X.useCallback)(async()=>{if(N){h(!0),y(null);try{await q(e,t,o),l(o),T(!0),A(null)}catch(e){throw y(e instanceof Error?e.message:String(e)),e}finally{h(!1)}}},[e,t,N,o]);(0,X.useImperativeHandle)(i,()=>({save:F}),[F]);let I={"SOUL.md":{label:n?`个性与边界`:`Personality & boundaries`,description:n?`定义语气、价值观、行为原则与安全边界。`:`Tone, values, behavior principles, and safety boundaries.`},"TOOLS.md":{label:n?`工具使用约定`:`Tool guidance`,description:n?`补充工具偏好和使用约定,不负责授予权限。`:`Tool preferences and conventions; this does not grant access.`},"AGENTS.md":{label:n?`工作规范`:`Working instructions`,description:n?`该智能体长期遵循的协作和执行规范。`:`Persistent collaboration and execution instructions.`}},L=[_,C,b,E],R=Me(o).body;return(0,Q.jsx)(`div`,{className:`space-y-5`,children:(0,Q.jsx)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:(0,Q.jsxs)(`div`,{className:`p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:I[t].label}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:I[t].description})]}),(0,Q.jsx)(me,{className:`flex rounded-lg bg-surface-hover p-1`,role:`group`,"aria-label":n?`编辑模式`:`Editor mode`,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`direct`,E,n?`直接编辑`:`Visual`],[`source`,b,`Markdown`],[`preview`,S,n?`预览`:`Preview`]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>M(e),"aria-pressed":j===e,className:P(`inline-flex min-h-9 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,j===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:[(0,Q.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))})]}),t===`SOUL.md`&&!u?(0,Q.jsxs)(`div`,{className:`mt-4`,children:[(0,Q.jsx)(`button`,{type:`button`,disabled:f,"aria-expanded":D,onClick:()=>O(!D),className:`text-xs font-medium text-accent hover:underline`,children:n?`使用模板`:`Use a template`}),k===null?null:(0,Q.jsx)(`button`,{type:`button`,className:`ml-3 text-xs text-accent hover:underline`,onClick:()=>{s(k),A(null)},children:n?`撤销模板替换`:`Undo template replacement`}),D?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`my-2 text-xs text-fg-muted`,children:n?`模板会替换当前个性正文,保存前可以撤销。`:`A template replaces the personality text. You can undo before saving.`}),(0,Q.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:Pe.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>{e.content&&(A(o),s(t=>Ne(t,e.content))),M(`direct`)},className:`flex min-h-11 items-center gap-2 rounded-xl border border-edge px-3 py-2 text-left text-xs font-medium text-fg-muted transition-colors hover:border-accent/40 hover:bg-surface-hover hover:text-fg`,children:[(0,Q.jsx)(L[t]??g,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),n?e.labelZh:e.labelEn]},e.id))})]}):null]}):null,v?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,role:`alert`,children:v}):null,(0,Q.jsx)(`div`,{className:`mt-4 h-[min(40vh,22rem)] min-h-64 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:u?(0,Q.jsx)(Be,{}):f?(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-fg-muted`,children:n?`无法加载角色配置,未对文件进行任何更改。`:`Profile documents could not be loaded. No files were changed.`}):j===`direct`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Be,{}),children:(0,Q.jsx)(Re,{initialContent:R,onChange:e=>s(t=>Ne(t,e)),placeholder:n?`直接输入内容,或输入 / 使用快捷命令…`:`Start writing, or type / for commands…`},`${e}-${t}-direct`)}):j===`source`?(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(Be,{}),children:(0,Q.jsx)(ze,{initialContent:o,onChange:e=>s(e),isDark:a,lineWrap:!0,className:`min-h-0 flex-1`},`${e}-${t}-source`)}):(0,Q.jsx)(`div`,{className:`h-full overflow-y-auto p-5`,children:R.trim()?(0,Q.jsx)(w,{content:R}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:n?`暂无内容。`:`No content yet.`})})}),(0,Q.jsx)(`div`,{className:`mt-2 flex justify-end text-xs text-fg-muted`,"aria-live":`polite`,children:m?n?`正在保存角色配置…`:`Saving profile documents…`:N?n?`角色配置有未保存的更改`:`Profile documents have unsaved changes`:x?n?`文档更改已保存`:`Document changes saved`:n?`未修改`:`No changes`})]})})})});function He(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function Ue(e){let t=(0,Z.c)(74),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,modelKind:c,onChange:l}=e,u=o!==void 0&&o,d=s!==void 0&&s,f=c===void 0?`text`:c,p=i!=null,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[0]=m):m=t[0];let h=R(p&&f!==`image`?V:null,B,m),g;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(g={revalidateOnFocus:!1},t[1]=g):g=t[1];let _=R(p&&f===`image`?`agent-defaults-image-models`:null,Ae,g),v;t[2]===_.data?v=t[3]:(v=_.data??[],t[2]=_.data,t[3]=v);let y;t[4]===v?y=t[5]:(y=v.flatMap(Ge),t[4]=v,t[5]=y);let b=y,x;t[6]!==b||t[7]!==f||t[8]!==h?(x=f===`image`?b:h.data??[],t[6]=b,t[7]=f,t[8]=h,t[9]=x):x=t[9];let S=x,C;t[10]!==f||t[11]!==S?(C=f===`vision`?S.filter(We):S,t[10]=f,t[11]=S,t[12]=C):C=t[12];let w=C,T=f===`image`?_:h,E;t[13]===n?E=t[14]:(E=(0,Q.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[13]=n,t[14]=E);let D;t[15]!==i||t[16]!==a?(D=i===void 0?(0,Q.jsx)(He,{children:a?`继承全局`:`Inherited globally`}):null,t[15]=i,t[16]=a,t[17]=D):D=t[17];let O;t[18]!==d||t[19]!==i||t[20]!==a?(O=i===null?(0,Q.jsx)(He,{children:d?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[18]=d,t[19]=i,t[20]=a,t[21]=O):O=t[21];let k;t[22]!==E||t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,D,O]}),t[22]=E,t[23]=D,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==r?.primary||t[27]!==i||t[28]!==a?(A=i===void 0?(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[26]=r?.primary,t[27]=i,t[28]=a,t[29]=A):A=t[29];let j;t[30]!==k||t[31]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[30]=k,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==l||t[34]!==i||t[35]!==a?(M=i===void 0?null:(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(void 0),children:a?`继承全局`:`Inherit globally`}),t[33]=l,t[34]=i,t[35]=a,t[36]=M):M=t[36];let N;t[37]!==u||t[38]!==l||t[39]!==i||t[40]!==a?(N=u&&i!==null?(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`使用 Chat`:`Use Chat`}):null,t[37]=u,t[38]=l,t[39]=i,t[40]=a,t[41]=N):N=t[41];let P;t[42]!==d||t[43]!==l||t[44]!==i||t[45]!==a?(P=d&&i!==null?(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>l(null),children:a?`禁用`:`Disable`}):null,t[42]=d,t[43]=l,t[44]=i,t[45]=a,t[46]=P):P=t[46];let I;t[47]!==p||t[48]!==r?.fallbacks||t[49]!==r?.primary||t[50]!==l||t[51]!==a?(I=p?null:(0,Q.jsx)(J,{className:`px-2 py-1 text-xs`,onClick:()=>l({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`单独设置`:`Override for this agent`}),t[47]=p,t[48]=r?.fallbacks,t[49]=r?.primary,t[50]=l,t[51]=a,t[52]=I):I=t[52];let L;t[53]!==M||t[54]!==N||t[55]!==P||t[56]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[M,N,P,I]}),t[53]=M,t[54]=N,t[55]=P,t[56]=I,t[57]=L):L=t[57];let z;t[58]!==j||t[59]!==L?(z=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,L]}),t[58]=j,t[59]=L,t[60]=z):z=t[60];let H;t[61]!==w||t[62]!==p||t[63]!==n||t[64]!==f||t[65]!==S||t[66]!==l||t[67]!==T||t[68]!==i||t[69]!==a?(H=p?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:a?`主模型`:`Primary model`}),T.isLoading?(0,Q.jsx)(F,{className:`mt-1.5 h-11 w-full rounded-lg`}):(0,Q.jsx)(xe,{value:i.primary,models:S,modelsLoading:T.isLoading,modelsError:T.error,capabilitiesFilter:f===`vision`?`vision`:void 0,placeholder:a?`选择模型`:`Select a model`,searchPlaceholder:a?`搜索模型或服务商`:`Search models or providers`,noMatches:a?`没有匹配的模型`:`No matching models`,contentAlign:`start`,className:`mt-1.5 w-full`,ariaLabel:a?`${n}主模型`:`${n} primary model`,onChange:e=>l({...i,primary:e})})]}),(0,Q.jsx)(we,{title:a?`备用模型`:`Fallback models`,summary:a?`已配置 ${i.fallbacks.length} 个备用模型`:`${i.fallbacks.length} fallback models configured`,children:(0,Q.jsx)(je,{primary:i.primary,value:i.fallbacks,models:w,loading:T.isLoading,error:T.error,zh:a,onChange:e=>l({...i,fallbacks:e})})})]}):null,t[61]=w,t[62]=p,t[63]=n,t[64]=f,t[65]=S,t[66]=l,t[67]=T,t[68]=i,t[69]=a,t[70]=H):H=t[70];let U;return t[71]!==z||t[72]!==H?(U=(0,Q.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[z,H]}),t[71]=z,t[72]=H,t[73]=U):U=t[73],U}function We(e){return e.vision}function Ge(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}function Ke(e){let t=(0,Z.c)(88),{agentId:n,avatar:r,zh:i,disabled:a,pending:o,onPendingChange:s,onReadingChange:c,onChange:l}=e,[u,d]=(0,X.useState)(!1),f=(0,X.useRef)(null),p=(0,X.useRef)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),v,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=()=>()=>p.current?.abort(),y=[],t[0]=v,t[1]=y):(v=t[0],y=t[1]),(0,X.useEffect)(v,y);let b=i?`自动头像`:`Automatic`,x;t[2]===b?x=t[3]:(x={value:``,label:b},t[2]=b,t[3]=x);let S=i?`Loopi · 平静`:`Loopi · Calm`,C;t[4]===S?C=t[5]:(C={value:`xopc:loopi:idle`,label:S},t[4]=S,t[5]=C);let w=i?`Loopi · 温暖`:`Loopi · Warm`,T;t[6]===w?T=t[7]:(T={value:`xopc:loopi:care`,label:w},t[6]=w,t[7]=T);let E=i?`Loopi · 好奇`:`Loopi · Curious`,D;t[8]===E?D=t[9]:(D={value:`xopc:loopi:curious`,label:E},t[8]=E,t[9]=D);let O=i?`Loopi · 倾听`:`Loopi · Listening`,k;t[10]===O?k=t[11]:(k={value:`xopc:loopi:listen`,label:O},t[10]=O,t[11]=k);let A;t[12]===n?A=t[13]:(A=oe(`bottts`,n),t[12]=n,t[13]=A);let j=i?`机器人`:`Robot`,N;t[14]!==A||t[15]!==j?(N={value:A,label:j},t[14]=A,t[15]=j,t[16]=N):N=t[16];let F;t[17]===n?F=t[18]:(F=oe(`adventurer`,n),t[17]=n,t[18]=F);let I=i?`插画人物`:`Illustration`,L;t[19]!==F||t[20]!==I?(L={value:F,label:I},t[19]=F,t[20]=I,t[21]=L):L=t[21];let R;t[22]!==D||t[23]!==k||t[24]!==N||t[25]!==L||t[26]!==x||t[27]!==C||t[28]!==T?(R=[x,C,T,D,k,N,L],t[22]=D,t[23]=k,t[24]=N,t[25]=L,t[26]=x,t[27]=C,t[28]=T,t[29]=R):R=t[29];let z=R,B=z.find(e=>e.value===(r??``))?.label??(i?`自定义头像`:`Custom avatar`),V;t[30]!==l||t[31]!==s||t[32]!==c||t[33]!==i?(V=e=>{if(!e)return;if(_(null),![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){_(i?`请选择 PNG、JPG 或 WebP 图片。`:`Choose a PNG, JPG, or WebP image.`);return}if(!e.size||e.size>524288){_(i?`图片不能为空,且不能超过 512 KB。`:`The image must be non-empty and at most 512 KB.`);return}h(!0),c(!0);let t=new FileReader;p.current=t;let n=()=>{h(!1),c(!1),p.current=null};t.onload=()=>{let r=String(t.result);s({base64:r.slice(r.indexOf(`,`)+1),mimeType:e.type,preview:r}),l(se),n()},t.onerror=()=>{_(i?`图片读取失败,请重新选择。`:`Could not read the image. Choose it again.`),n()},t.readAsDataURL(e)},t[30]=l,t[31]=s,t[32]=c,t[33]=i,t[34]=V):V=t[34];let H=V,U;t[35]===H?U=t[36]:(U=(0,Q.jsx)(`input`,{ref:f,type:`file`,accept:`image/png,image/jpeg,image/webp`,hidden:!0,onChange:e=>{H(e.target.files?.[0]),e.target.value=``}}),t[35]=H,t[36]=U);let W=a||m,G;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(G=()=>f.current?.click(),t[37]=G):G=t[37];let K=i?`上传头像`:`Upload avatar`,ee=`avatar-help-${n}`,q;t[38]!==n||t[39]!==r||t[40]!==o?(q=o?(0,Q.jsx)(`img`,{src:o.preview,alt:``,width:64,height:64,className:`size-full object-cover`}):(0,Q.jsx)(le,{agentId:n,avatar:r,size:64}),t[38]=n,t[39]=r,t[40]=o,t[41]=q):q=t[41];let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(`span`,{className:`absolute inset-x-0 bottom-0 flex h-5 items-center justify-center bg-black/55 text-white`,children:(0,Q.jsx)(M,{className:`size-3`,"aria-hidden":!0})}),t[42]=te):te=t[42];let ne;t[43]!==W||t[44]!==K||t[45]!==ee||t[46]!==q?(ne=(0,Q.jsxs)(`button`,{type:`button`,disabled:W,onClick:G,"aria-label":K,"aria-describedby":ee,className:`group relative size-16 shrink-0 overflow-hidden rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,children:[q,te]}),t[43]=W,t[44]=K,t[45]=ee,t[46]=q,t[47]=ne):ne=t[47];let re=i?`头像`:`Avatar`,Y;t[48]===re?Y=t[49]:(Y=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:re}),t[48]=re,t[49]=Y);let ie=m?i?`正在读取图片…`:`Reading image…`:o?i?`新头像 · 保存后生效`:`New avatar · save to apply`:B,ae;t[50]===ie?ae=t[51]:(ae=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ie}),t[50]=ie,t[51]=ae);let ce=`avatar-help-${n}`,ue=i?`点击头像上传 · PNG、JPG、WebP · 最大 512 KB`:`Click to upload · PNG, JPG, WebP · Max 512 KB`,de;t[52]!==ce||t[53]!==ue?(de=(0,Q.jsx)(`p`,{id:ce,className:`mt-1 text-xs text-fg-muted`,children:ue}),t[52]=ce,t[53]=ue,t[54]=de):de=t[54];let fe;t[55]!==Y||t[56]!==ae||t[57]!==de?(fe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Y,ae,de]}),t[55]=Y,t[56]=ae,t[57]=de,t[58]=fe):fe=t[58];let pe=a||m,me=`avatar-options-${n}`,he;t[59]===u?he=t[60]:(he=()=>d(!u),t[59]=u,t[60]=he);let ge=u?i?`收起选择`:`Hide choices`:i?`默认头像`:`Built-in avatars`,_e;t[61]!==u||t[62]!==pe||t[63]!==me||t[64]!==he||t[65]!==ge?(_e=(0,Q.jsx)(J,{variant:`ghost`,disabled:pe,"aria-expanded":u,"aria-controls":me,onClick:he,children:ge}),t[61]=u,t[62]=pe,t[63]=me,t[64]=he,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==U||t[68]!==ne||t[69]!==fe||t[70]!==_e?(ve=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[U,ne,fe,_e]}),t[67]=U,t[68]=ne,t[69]=fe,t[70]=_e,t[71]=ve):ve=t[71];let ye;t[72]!==n||t[73]!==r||t[74]!==u||t[75]!==a||t[76]!==l||t[77]!==s||t[78]!==z||t[79]!==m||t[80]!==i?(ye=u?(0,Q.jsx)(`div`,{id:`avatar-options-${n}`,className:`grid grid-cols-3 gap-2 sm:grid-cols-4`,role:`group`,"aria-label":i?`选择头像`:`Choose avatar`,children:z.map(e=>(0,Q.jsxs)(`button`,{type:`button`,disabled:a||m,"aria-pressed":(r??``)===e.value,onClick:()=>{s(null),l(e.value),_(null)},className:P(`flex min-h-24 flex-col items-center gap-2 rounded-xl border p-3 text-xs transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,(r??``)===e.value?`border-accent bg-accent-soft text-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover`),children:[(0,Q.jsx)(le,{agentId:n,avatar:e.value,size:44}),e.label]},e.value))}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=a,t[76]=l,t[77]=s,t[78]=z,t[79]=m,t[80]=i,t[81]=ye):ye=t[81];let be;t[82]===g?be=t[83]:(be=g?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:g}):null,t[82]=g,t[83]=be);let xe;return t[84]!==ve||t[85]!==ye||t[86]!==be?(xe=(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[ve,ye,be]}),t[84]=ve,t[85]=ye,t[86]=be,t[87]=xe):xe=t[87],xe}var qe={version:1,domains:[],taskTypes:[],inputKinds:[],outputKinds:[],specialties:[],examples:[],limitations:[]},Je=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,Ye=e=>e.split(`
67
- `).map(e=>e.trim()).filter(Boolean);function Xe(e){let t=(0,Z.c)(21),{value:n,label:r,hint:i,onChange:a,max:o}=e,s;t[0]===n?s=t[1]:(s=n.join(`
68
- `),t[0]=n,t[1]=s);let[c,l]=(0,X.useState)(s),u,d;t[2]!==c||t[3]!==n?(u=()=>{JSON.stringify(Ye(c))!==JSON.stringify(n)&&l(n.join(`
69
- `))},d=[n,c],t[2]=c,t[3]=n,t[4]=u,t[5]=d):(u=t[4],d=t[5]),(0,X.useEffect)(u,d);let f;t[6]===a?f=t[7]:(f=e=>{l(e.target.value),a(Ye(e.target.value))},t[6]=a,t[7]=f);let p;t[8]!==i||t[9]!==f||t[10]!==c?(p=(0,Q.jsx)(`textarea`,{rows:3,className:Je,value:c,placeholder:i,onChange:f}),t[8]=i,t[9]=f,t[10]=c,t[11]=p):p=t[11];let m;t[12]===c?m=t[13]:(m=Ye(c),t[12]=c,t[13]=m);let h;t[14]!==o||t[15]!==m.length?(h=(0,Q.jsxs)(`span`,{className:`text-xs text-fg-subtle`,children:[m.length,`/`,o]}),t[14]=o,t[15]=m.length,t[16]=h):h=t[16];let g;return t[17]!==r||t[18]!==p||t[19]!==h?(g=(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[r,p,h]}),t[17]=r,t[18]=p,t[19]=h,t[20]=g):g=t[20],g}var Ze={general:`通用`,coordination:`协调`,software:`软件开发`,writing:`写作`,research:`研究`,data:`数据`,design:`设计`,operations:`运营`,general_assistance:`日常协助`,task_planning:`任务规划`,bug_fix:`修复 Bug`,implementation:`功能开发`,code_review:`代码审查`,editing:`编辑润色`,news_research:`新闻研究`,data_analysis:`数据分析`,data_cleaning:`数据清洗`,image_generation:`生成图片`,automation:`自动化`,text:`文本`,repository:`代码仓库`,csv:`CSV`,spreadsheet:`电子表格`,web_page:`网页`,image:`图片`,answer:`回答`,plan:`计划`,code_patch:`代码修改`,document:`文档`,report:`报告`,chart:`图表`,script:`脚本`,design_brief:`设计说明`};function Qe(e){let t=(0,Z.c)(48),{field:n,value:r,label:i,zh:a,onChange:o}=e,s=I[n],c;if(t[0]!==r||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>!s.includes(e),t[3]=s,t[4]=e),c=r.filter(e),t[0]=r,t[1]=s,t[2]=c}else c=t[2];let l=c,u;t[5]===a?u=t[6]:(u=e=>a?Ze[e]??e:e.replaceAll(`_`,` `),t[5]=a,t[6]=u);let d=u,f;t[7]!==d||t[8]!==r||t[9]!==a?(f=r.length?r.map(d).join(` · `):a?`选择适用项`:`Select applicable items`,t[7]=d,t[8]=r,t[9]=a,t[10]=f):f=t[10];let p;t[11]===f?p=t[12]:(p=(0,Q.jsx)(`span`,{className:`mt-1 block text-xs font-normal text-fg-muted`,children:f}),t[11]=f,t[12]=p);let m;t[13]!==i||t[14]!==p?(m=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[i,p]}),t[13]=i,t[14]=p,t[15]=m):m=t[15];let h;if(t[16]!==d||t[17]!==r||t[18]!==s){let e;t[20]!==d||t[21]!==r?(e=e=>({value:e,label:d(e),disabled:r.length>=16&&!r.includes(e)}),t[20]=d,t[21]=r,t[22]=e):e=t[22],h=s.map(e),t[16]=d,t[17]=r,t[18]=s,t[19]=h}else h=t[19];let g;t[23]!==i||t[24]!==o||t[25]!==h||t[26]!==r?(g=(0,Q.jsx)(v,{options:h,values:r,multiple:!0,ariaLabel:i,onChange:o}),t[23]=i,t[24]=o,t[25]=h,t[26]=r,t[27]=g):g=t[27];let _=a?`自定义标识`:`Custom identifiers`,y;t[28]===_?y=t[29]:(y=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:_}),t[28]=_,t[29]=y);let b=a?`其他标识`:`Other identifiers`,x=a?`每行一个英文标识`:`One identifier per line`,S;t[30]!==o||t[31]!==r||t[32]!==s?(S=e=>o([...new Set([...r.filter(e=>s.includes(e)),...e])]),t[30]=o,t[31]=r,t[32]=s,t[33]=S):S=t[33];let C;t[34]!==l||t[35]!==b||t[36]!==x||t[37]!==S?(C=(0,Q.jsx)(Xe,{value:l,label:b,hint:x,max:16,onChange:S}),t[34]=l,t[35]=b,t[36]=x,t[37]=S,t[38]=C):C=t[38];let w;t[39]!==C||t[40]!==y?(w=(0,Q.jsxs)(`details`,{children:[y,C]}),t[39]=C,t[40]=y,t[41]=w):w=t[41];let T;t[42]!==w||t[43]!==g?(T=(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[g,w]}),t[42]=w,t[43]=g,t[44]=T):T=t[44];let E;return t[45]!==T||t[46]!==m?(E=(0,Q.jsxs)(`details`,{className:`min-w-0 rounded-xl border border-edge p-3`,children:[m,T]}),t[45]=T,t[46]=m,t[47]=E):E=t[47],E}function $e(e){let t=(0,Z.c)(45),{profile:n,zh:r,onChange:i}=e,a=r?`领域`:`Domains`,o;t[0]===a?o=t[1]:(o=[`domains`,a,`software
70
- data
71
- research`,16],t[0]=a,t[1]=o);let s=r?`任务类型`:`Task types`,c;t[2]===s?c=t[3]:(c=[`taskTypes`,s,`bug_fix
72
- code_review
73
- data_analysis`,16],t[2]=s,t[3]=c);let l=r?`输入类型`:`Input kinds`,u;t[4]===l?u=t[5]:(u=[`inputKinds`,l,`repository
74
- csv
75
- text`,16],t[4]=l,t[5]=u);let d=r?`交付类型`:`Output kinds`,f;t[6]===d?f=t[7]:(f=[`outputKinds`,d,`code_patch
76
- report
77
- chart`,16],t[6]=d,t[7]=f);let p=r?`具体专长`:`Specialties`,m=r?`每行一项具体专长`:`One specialty per line`,h;t[8]!==m||t[9]!==p?(h=[`specialties`,p,m,8],t[8]=m,t[9]=p,t[10]=h):h=t[10];let g=r?`适用边界`:`Limitations`,_=r?`每行一项边界或注意事项`:`One limitation per line`,v;t[11]!==g||t[12]!==_?(v=[`limitations`,g,_,8],t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==h||t[15]!==v||t[16]!==o||t[17]!==c||t[18]!==u||t[19]!==f?(y=[o,c,u,f,h,v],t[14]=h,t[15]=v,t[16]=o,t[17]=c,t[18]=u,t[19]=f,t[20]=y):y=t[20];let b=y,x=r?`擅长的任务`:`Specialties`,S;t[21]===x?S=t[22]:(S=(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:x}),t[21]=x,t[22]=S);let C=r?`声明专长,帮助系统匹配任务。实际执行还需具备相应模型、技能、工具和账号权限。`:`Describe expertise for task matching. Execution also requires the appropriate models, skills, tools, and account access.`,w;t[23]===C?w=t[24]:(w=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C}),t[23]=C,t[24]=w);let T;t[25]!==S||t[26]!==w?(T=(0,Q.jsxs)(`div`,{children:[S,w]}),t[25]=S,t[26]=w,t[27]=T):T=t[27];let E;t[28]!==i||t[29]!==n?(E=()=>i(n?void 0:structuredClone(qe)),t[28]=i,t[29]=n,t[30]=E):E=t[30];let D=n?r?`清除档案`:`Clear profile`:r?`添加档案`:`Add profile`,O;t[31]!==E||t[32]!==D?(O=(0,Q.jsx)(J,{variant:`ghost`,onClick:E,children:D}),t[31]=E,t[32]=D,t[33]=O):O=t[33];let k;t[34]!==T||t[35]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,O]}),t[34]=T,t[35]=O,t[36]=k):k=t[36];let A;t[37]!==b||t[38]!==i||t[39]!==n||t[40]!==r?(A=n?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:b.slice(0,2).map(e=>{let[t,a]=e;return(0,Q.jsx)(Qe,{field:t,value:n[t],label:a,zh:r,onChange:e=>i({...n,[t]:e})},t)})}),(0,Q.jsx)(Xe,{value:n.specialties,label:r?`具体专长`:`Specialties`,hint:r?`每行一项,例如:React 应用调试`:`One specialty per line`,max:8,onChange:e=>i({...n,specialties:e})}),(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge p-4`,children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:[r?`任务匹配细节`:`Task matching details`,(0,Q.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r?`${n.inputKinds.length} 项输入 · ${n.outputKinds.length} 项交付 · ${n.examples.length} 个示例`:`${n.inputKinds.length} inputs · ${n.outputKinds.length} outputs · ${n.examples.length} examples`})]}),(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:b.slice(2,4).map(e=>{let[t,a]=e;return(0,Q.jsx)(Qe,{field:t,value:n[t],label:a,zh:r,onChange:e=>i({...n,[t]:e})},t)})}),(0,Q.jsx)(Xe,{value:n.limitations,label:r?`适用边界`:`Limitations`,hint:r?`每行一项边界或注意事项`:`One limitation per line`,max:8,onChange:e=>i({...n,limitations:e})}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`h5`,{className:`text-xs font-medium text-fg-muted`,children:r?`适用示例`:`Examples`}),n.examples.map((e,t)=>(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[(0,Q.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[r?`请求`:`Request`,(0,Q.jsx)(`textarea`,{rows:2,maxLength:200,className:Je,value:e.request,onChange:e=>i({...n,examples:n.examples.map((n,r)=>r===t?{...n,request:e.target.value}:n)})})]}),(0,Q.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[r?`交付成果`:`Deliverable`,(0,Q.jsx)(`textarea`,{rows:2,maxLength:200,className:Je,value:e.deliverable,onChange:e=>i({...n,examples:n.examples.map((n,r)=>r===t?{...n,deliverable:e.target.value}:n)})})]}),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>i({...n,examples:n.examples.filter((e,n)=>n!==t)}),children:r?`移除示例`:`Remove example`})]},t)),(0,Q.jsx)(J,{variant:`ghost`,disabled:n.examples.length>=4,onClick:()=>i({...n,examples:[...n.examples,{request:``,deliverable:``}]}),children:r?`添加示例`:`Add example`})]})]})]})]}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:r?`未设置档案时,继续按现有角色描述和执行条件匹配。`:`Without a profile, matching continues using the existing role and execution conditions.`}),t[37]=b,t[38]=i,t[39]=n,t[40]=r,t[41]=A):A=t[41];let j;return t[42]!==k||t[43]!==A?(j=(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[k,A]}),t[42]=k,t[43]=A,t[44]=j):j=t[44],j}var et=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],$=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function tt(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function nt(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function rt(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function it(e){let t=(0,Z.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Q.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function at(e){let t=(0,Z.c)(11),{label:n,value:r,detail:i,onClick:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=s);let c;t[4]===i?c=t[5]:(c=(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=c);let l;return t[6]!==a||t[7]!==o||t[8]!==s||t[9]!==c?(l=(0,Q.jsxs)(`button`,{type:`button`,onClick:a,className:`min-w-0 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[o,s,c]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function ot(e){let t=(0,Z.c)(10),{title:n,summary:r,children:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,Q.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r}):null,t[0]=r,t[1]=a);let o;t[2]!==a||t[3]!==n?(o=(0,Q.jsxs)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[n,a]}),t[2]=a,t[3]=n,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,Q.jsx)(`div`,{className:`mt-4`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function st(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function ct({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:o,onOpenDefaults:s,onChat:l,onDelete:u}){let[d,f]=(0,X.useState)(`overview`),p=Te(`(min-width: 640px)`),[m,h]=(0,X.useState)(`specialties`),[g,_]=(0,X.useState)(`directory`),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),S=(0,X.useRef)(null),C=(0,X.useRef)({}),[w,E]=(0,X.useState)(()=>structuredClone(e.override)),[D,k]=(0,X.useState)(!1),[A,M]=(0,X.useState)(null),[N,F]=(0,X.useState)(!1),[I,L]=(0,X.useState)({soul:!1,agents:!1,tools:!1}),R=Object.values(I).some(Boolean),z=(0,X.useRef)(null),B=(0,X.useRef)(null),V=(0,X.useRef)(null),[U,G]=(0,X.useState)(null),[K,ee]=(0,X.useState)(!1),q=JSON.stringify(w)!==JSON.stringify(e.override)||R||U!==null,te=[w.models?.chat,...Object.values(w.models?.intents??{}),w.models?.imageUnderstanding,w.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,X.useEffect)(()=>a(q),[q,a]);let ne=(0,X.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(w.tools??{}),...w.toolAllowlist??[]])].sort(),[e.effective.tools,w.toolAllowlist,w.tools,t]),re=[w.models?n?`模型`:`Models`:null,w.skills?n?`技能`:`Skills`:null,w.tools?n?`工具权限`:`Tool access`:null,null].filter(e=>!!e),Y=w.toolAllowlist,ie=Y?ne.filter(t=>Y.includes(t)&&e.effective.tools[t]?.mode!==`deny`).length:null,oe=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,se=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,le=w.profile?.name??e.name??e.id,ue=(t,n)=>{E(r=>({...r,profile:{...r.profile,name:r.profile?.name??e.name??e.id,[t]:n}}))},fe=c(n?`zh`:`en`).chat.workingDirectory,he={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},ge={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},_e=async()=>{let t=[];k(!0),M(null);try{await z.current?.save(),I.soul&&t.push(n?`个性与边界`:`Personality & boundaries`),await B.current?.save(),I.agents&&t.push(n?`工作规范`:`Working instructions`),await V.current?.save(),I.tools&&t.push(n?`工具使用约定`:`Tool guidance`),U&&(await W(e.id,U),ce(e.id),t.push(n?`头像图片`:`Avatar image`));let r=(await H(e.id,{expectedRevision:e.revision,specialistProfile:w.specialistProfile??null,workspace:w.workspace??null,profile:w.profile,models:w.models??null,skills:w.skills??null,tools:w.tools??null,toolAllowlist:w.toolAllowlist??null,runtime:w.runtime??null})).agents.find(t=>t.id===e.id);r&&E(structuredClone(r.override)),L({soul:!1,agents:!1,tools:!1}),x(!0),G(null)}catch(e){let r=e instanceof Error?e.message:String(e);M(t.length?n?`已保存:${t.join(`、`)}。其余更改未保存,请重试。${r}`:`Saved: ${t.join(`, `)}. Remaining changes were not saved; retry. ${r}`:r)}finally{k(!1)}},ve=async()=>{k(!0),M(null);try{await H(e.id,{setDefault:!0})}catch(e){M(e instanceof Error?e.message:String(e))}finally{k(!1)}},ye=(e,t)=>{let n={...w.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},E({...w,tools:Object.keys(n).length>0?n:void 0})},be=(t,n)=>{let r=new Set(w.toolAllowlist??[]);n?r.add(t):r.delete(t);let i={...w.tools??{}};n&&(i[t]?.mode===`deny`||e.effective.tools[t]?.mode===`deny`)&&(i[t]={...i[t],mode:`allow`}),E({...w,toolAllowlist:[...r],tools:Object.keys(i).length>0?i:void 0})},xe=(e,t)=>{let n={...w.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,E({...w,models:Object.keys(n).length>0?n:void 0})},Se=(0,X.useCallback)(e=>L(t=>({...t,soul:e})),[]),Ce=(0,X.useCallback)(e=>L(t=>({...t,agents:e})),[]),we=(0,X.useCallback)(e=>L(t=>({...t,tools:e})),[]),De=t=>t.some(t=>JSON.stringify(w[t])!==JSON.stringify(e.override[t])),Ae=JSON.stringify({...w.profile,instructions:void 0})!==JSON.stringify({...e.override.profile,instructions:void 0})||I.soul||U!==null,je=De([`models`,`skills`,`tools`,`toolAllowlist`,`specialistProfile`]),Z=De([`workspace`,`runtime`])||w.profile?.instructions!==e.override.profile?.instructions||I.agents||I.tools,Me=e=>e?(0,Q.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":n?`有未保存的更改`:`Unsaved changes`}):void 0,Ne=[{id:`overview`,label:n?`概览`:`Overview`},{id:`profile`,label:n?`个性`:`Personality`,suffix:Me(Ae)},{id:`capabilities`,label:n?`能力`:`Capabilities`,suffix:Me(je)},{id:`work`,label:n?`工作设置`:`Work settings`,suffix:Me(Z)}],Pe=d===`capabilities`?`${d}:${m}`:d===`work`?`${d}:${g}`:d,Ie=(e,t=m,n=g)=>{C.current[Pe]=S.current?.scrollTop??0,e===`profile`&&F(!0),e===`work`&&y(!0),f(e),h(t),_(n)};return(0,X.useEffect)(()=>{S.current&&(S.current.scrollTop=C.current[Pe]??0)},[Pe]),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsx)(`aside`,{className:`shrink-0 border-b border-edge px-3 py-2 sm:w-44 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:py-4`,children:(0,Q.jsx)(ae,{items:Ne,activeTab:d,onChange:Ie,ariaLabel:n?`智能体设置`:`Agent settings`,tabIdPrefix:`agent-tab`,panelIdPrefix:`agent-panel`,orientation:p?`vertical`:`horizontal`,className:`m-0 grid grid-cols-4 overflow-visible p-0 sm:flex sm:flex-col`,buttonClassName:`min-w-0 justify-center px-1 text-xs sm:justify-start sm:px-3 sm:py-3 sm:text-sm [&>span]:min-w-0 [&>span]:break-words`,selectedClassName:`bg-accent-soft text-accent-fg`})}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,Q.jsxs)(`main`,{ref:S,role:`tabpanel`,id:`agent-panel-${d}`,"aria-labelledby":`agent-tab-${d}`,tabIndex:0,className:`min-h-0 flex-1 overflow-y-auto p-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent sm:p-6`,children:[A||i?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:A??i}):null,d===`overview`?(0,Q.jsxs)(`div`,{className:`space-y-6`,children:[(0,Q.jsx)(it,{title:de({id:e.id,name:le},r),description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,Q.jsxs)(J,{onClick:l,children:[(0,Q.jsx)(T,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,Q.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:pe({id:e.id,description:w.profile?.description},r)||(n?`添加介绍,让这个智能体的定位更清晰。`:`Add a description to explain this agent’s role.`)}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(w.specialistProfile?.specialties??[]).map(e=>(0,Q.jsx)(`span`,{className:`rounded-lg bg-surface-hover px-2 py-1 text-xs text-fg-muted`,children:e},e)),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>Ie(`capabilities`,`specialties`),children:n?`查看专长`:`View specialties`}),(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>Ie(`profile`),children:n?`编辑个性`:`Edit personality`})]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:re.length>0?n?`已自定义:${re.join(`、`)}`:`Customized: ${re.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:re.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,Q.jsx)(J,{onClick:s,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsx)(at,{onClick:()=>Ie(`capabilities`,`models`),label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:w.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(at,{onClick:()=>Ie(`capabilities`,`tools`),label:n?`技能`:`Skills`,value:se,detail:w.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(at,{onClick:()=>Ie(`capabilities`,`tools`),label:n?`工具权限`:`Tool access`,value:ie===null?oe>0?n?`${oe} 个禁用`:`${oe} denied`:n?`全部可用`:`All available`:n?`${ie} 个已开放`:`${ie} in scope`,detail:Y?n?`受智能体工具范围限制`:`Limited by agent tool scope`:w.tools?n?`${Object.keys(w.tools).length} 个本地覆盖`:`${Object.keys(w.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,Q.jsx)(at,{onClick:()=>Ie(`work`,m,`directory`),label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:w.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,Q.jsx)(J,{onClick:()=>void ve(),disabled:D,children:n?`设为默认智能体`:`Make default agent`}),e.isDefault?(0,Q.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,Q.jsxs)(J,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,Q.jsx)(j,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null,N?(0,Q.jsxs)(`div`,{className:P(`space-y-6`,d!==`profile`&&`hidden`),children:[(0,Q.jsx)(it,{title:n?`资料与个性`:`Identity and personality`,description:n?`设置它是谁,以及如何与你交流。`:`Define who this agent is and how it communicates.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`grid items-center gap-4 sm:grid-cols-2`,children:[(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(Ke,{agentId:e.id,avatar:w.profile?.avatar,zh:n,disabled:D,pending:U,onPendingChange:G,onReadingChange:ee,onChange:e=>ue(`avatar`,e)})}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:le,onChange:e=>ue(`name`,e.target.value),placeholder:n?`例如:小助`:`e.g. Nova`})]})]}),(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted sm:col-span-2`,children:[n?`介绍`:`Description`,(0,Q.jsx)(`textarea`,{rows:2,className:`${$} mt-1.5 resize-y leading-6`,value:w.profile?.description??``,onChange:e=>ue(`description`,e.target.value),placeholder:n?`例如:帮你整理想法、查找资料,把复杂任务拆成可以执行的步骤。`:`e.g. Helps organize ideas, research topics, and turn complex tasks into actionable steps.`}),(0,Q.jsx)(`span`,{className:`mt-1.5 block text-xs font-normal`,children:n?`简要说明定位;详细行为在下方「个性与边界」设置。`:`Describe the agent’s purpose and how it helps. Set detailed behavior in Personality & boundaries below.`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`表达风格`:`Style`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:w.profile?.style??``,onChange:e=>ue(`style`,e.target.value),placeholder:n?`例如:直接、温和`:`e.g. direct and warm`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`主要语言`:`Primary language`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:w.profile?.language??``,onChange:e=>ue(`language`,e.target.value),placeholder:n?`例如:简体中文`:`e.g. English`})]})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(ot,{title:n?`更多身份设置`:`More identity settings`,summary:[w.profile?.creature,w.profile?.emoji].filter(Boolean).join(` · `),children:(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`签名表情(可选)`:`Signature emoji (optional)`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:w.profile?.emoji??``,onChange:e=>ue(`emoji`,e.target.value),placeholder:`✨`}),(0,Q.jsx)(`span`,{className:`mt-1.5 block text-xs font-normal`,children:n?`用于表达个性,与头像分开设置。`:`A personal touch, separate from the avatar.`})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`角色定位`:`Role`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,list:`agent-creatures-${e.id}`,value:w.profile?.creature??``,onChange:e=>ue(`creature`,e.target.value),placeholder:n?`AI 助手、研究伙伴…`:`AI assistant, research partner…`}),(0,Q.jsx)(`datalist`,{id:`agent-creatures-${e.id}`,children:Fe.map(e=>(0,Q.jsx)(`option`,{value:e.value,children:n?e.labelZh:e.labelEn},e.value))})]})]})})})]}),(0,Q.jsx)(Ve,{ref:z,file:`SOUL.md`,agentId:e.id,zh:n,onDirtyChange:Se})]}):null,d===`capabilities`?(0,Q.jsxs)(`div`,{className:`mb-5 space-y-3`,children:[(0,Q.jsx)(it,{title:n?`能力`:`Capabilities`,description:n?`声明擅长的任务,并配置实际可用的模型、技能与工具。`:`Describe specialties and configure the models, skills, and tools available to this agent.`}),(0,Q.jsx)(ae,{items:[{id:`specialties`,label:n?`擅长的任务`:`Specialties`},{id:`models`,label:n?`模型`:`Models`},{id:`tools`,label:n?`技能与工具`:`Skills & tools`}],activeTab:m,onChange:e=>Ie(`capabilities`,e),ariaLabel:n?`能力设置`:`Capability settings`,tabIdPrefix:`agent-capability-tab`,panelIdPrefix:`agent-capability-panel`})]}):null,d===`capabilities`&&m===`specialties`?(0,Q.jsx)(`div`,{role:`tabpanel`,id:`agent-capability-panel-specialties`,"aria-labelledby":`agent-capability-tab-specialties`,children:(0,Q.jsx)($e,{profile:w.specialistProfile,zh:n,onChange:e=>E(t=>({...t,specialistProfile:e}))})}):null,d===`capabilities`&&m===`models`?(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-capability-panel-models`,"aria-labelledby":`agent-capability-tab-models`,className:`space-y-6`,children:[(0,Q.jsx)(it,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:w.models?(0,Q.jsxs)(J,{variant:`ghost`,onClick:()=>E({...w,models:void 0}),children:[(0,Q.jsx)(O,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,Q.jsx)(Oe,{zh:n,value:w.models?.phoneUse,inherited:e.effective.models.phoneUse,onChange:e=>{let t={...w.models??{}};e===void 0?delete t.phoneUse:t.phoneUse=e,E({...w,models:Object.keys(t).length?t:void 0})}}),(0,Q.jsx)(Ue,{label:r.editorChatModel,inherited:e.effective.models.chat,value:w.models?.chat,zh:n,onChange:e=>{let t={...w.models??{}};e?t.chat=e:delete t.chat,E({...w,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(ot,{title:n?`任务模型路由`:`Task model routing`,summary:n?`当前任务路由继续生效;未覆盖的任务继承全局设置。`:`Task routes remain active; unspecified routes inherit global defaults.`,children:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,Q.jsx)(`div`,{className:`space-y-3`,children:et.map(t=>(0,Q.jsx)(Ue,{label:he[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:w.models?.intents?.[t],zh:n,allowChatFallback:!0,modelKind:t===`vision`?`vision`:`text`,onChange:e=>xe(t,e)},t))})]})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(Ue,{label:n?`图片理解`:`Image understanding`,modelKind:`vision`,inherited:e.effective.models.imageUnderstanding,value:w.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...w.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,E({...w,models:Object.keys(t).length>0?t:void 0})}}),(0,Q.jsx)(Ue,{label:n?`图片生成`:`Image generation`,modelKind:`image`,inherited:e.effective.models.imageGeneration,value:w.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...w.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:w.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:w.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},E({...w,models:Object.keys(n).length>0?n:void 0})}}),w.models?.imageGeneration?(0,Q.jsx)(ot,{title:n?`图片执行策略`:`Image execution policy`,summary:n?`当前超时和回退策略继续生效。`:`Current timeout and fallback settings remain active.`,children:(0,Q.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,Q.jsx)(Ee,{allowEmpty:!0,type:`number`,min:1,className:`${$} mt-1.5`,value:w.models.imageGeneration.timeoutMs??``,onChange:e=>E({...w,models:{...w.models,imageGeneration:{...w.models.imageGeneration,timeoutMs:nt(e.target.value)}}})})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,Q.jsx)(me,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":n?`自动切换服务`:`Automatic provider fallback`,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[!0,!1].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":w.models?.imageGeneration?.autoProviderFallback===e,type:`button`,onClick:()=>E({...w,models:{...w.models,imageGeneration:{...w.models.imageGeneration,autoProviderFallback:e}}}),className:P(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,w.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]})}):null]})]})]}):null,d===`capabilities`&&m===`tools`?(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-capability-panel-tools`,"aria-labelledby":`agent-capability-tab-tools`,className:`space-y-7`,children:[(0,Q.jsx)(it,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:w.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),w.skills?(0,Q.jsxs)(J,{variant:`ghost`,onClick:()=>E({...w,skills:void 0}),children:[(0,Q.jsx)(O,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,Q.jsxs)(me,{className:`mt-4 flex gap-2`,role:`group`,"aria-label":n?`技能策略`:`Skill policy`,indicatorClassName:`rounded-lg bg-surface-active`,children:[(0,Q.jsx)(J,{"aria-pressed":w.skills?.mode===`merge`,variant:`ghost`,onClick:()=>E({...w,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,Q.jsx)(J,{"aria-pressed":w.skills?.mode===`replace`,variant:`ghost`,onClick:()=>E({...w,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),w.skills?.mode===`merge`?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:w.skills.add.join(`, `),onChange:e=>E({...w,skills:{mode:`merge`,add:tt(e.target.value),remove:w.skills?.mode===`merge`?w.skills.remove:[]}})})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:w.skills.remove.join(`, `),onChange:e=>E({...w,skills:{mode:`merge`,add:w.skills?.mode===`merge`?w.skills.add:[],remove:tt(e.target.value)}})})]})]}):null,w.skills?.mode===`replace`?(0,Q.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,Q.jsx)(`input`,{className:`${$} mt-1.5`,value:w.skills.include.join(`, `),onChange:e=>E({...w,skills:{mode:`replace`,include:tt(e.target.value)}})})]}):null]}),(0,Q.jsxs)(`section`,{children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),w.tools?(0,Q.jsxs)(J,{variant:`ghost`,onClick:()=>E({...w,tools:void 0}),children:[(0,Q.jsx)(O,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),Y?(0,Q.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:n?`此智能体使用限定的工具范围。可在下方启用或移除工具,保存后从下一轮对话生效。`:`This agent uses a limited tool set. Add or remove tools below; changes apply from the next conversation turn.`}):null,(0,Q.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:ne.map(t=>{if(Y&&!Y.includes(t))return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg-muted`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:n?`未开放`:`Unavailable`})]}),(0,Q.jsx)(J,{variant:`secondary`,className:`px-3 py-1.5 text-xs`,onClick:()=>be(t,!0),children:n?`启用`:`Enable`})]},t);let r=w.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${ge[i]}`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(me,{className:`flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":t,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":e===`inherit`?!r:r===e,type:`button`,onClick:()=>ye(t,e),className:P(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:ge[e]},e))}),Y?(0,Q.jsx)(J,{variant:`ghost`,className:`px-2 py-1.5 text-xs`,onClick:()=>be(t,!1),children:n?`移除`:`Remove`}):null]})]},t)})})]})]}):null,v?(0,Q.jsxs)(`div`,{className:P(`space-y-6`,d!==`work`&&`hidden`),children:[(0,Q.jsx)(it,{title:n?`工作设置`:`Work settings`,description:n?`管理工作目录、执行规范与运行策略。`:`Manage the working directory, instructions, and execution policy.`}),(0,Q.jsx)(ae,{items:[{id:`directory`,label:n?`工作目录`:`Directory`,suffix:Me(De([`workspace`]))},{id:`instructions`,label:n?`工作规范`:`Instructions`,suffix:Me(I.agents||w.profile?.instructions!==e.override.profile?.instructions)},{id:`tools`,label:n?`工具约定`:`Tool guidance`,suffix:Me(I.tools)},{id:`runtime`,label:n?`运行策略`:`Runtime`,suffix:Me(De([`runtime`]))}],activeTab:g,onChange:e=>Ie(`work`,m,e),ariaLabel:n?`工作设置分区`:`Work settings sections`,tabIdPrefix:`agent-work-tab`,panelIdPrefix:`agent-work-panel`}),(0,Q.jsx)(`div`,{role:`tabpanel`,id:`agent-work-panel-directory`,"aria-labelledby":`agent-work-tab-directory`,hidden:g!==`directory`,className:`space-y-6`,children:(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4 sm:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作区`:`Workspace`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`选择这个智能体读写文件时使用的目录;留空则使用自动工作区。`:`Choose where this agent reads and writes files, or leave it empty to use the automatic workspace.`})]}),w.workspace?(0,Q.jsxs)(J,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>E(e=>({...e,workspace:void 0})),children:[(0,Q.jsx)(O,{className:`size-3.5`}),n?`恢复自动`:`Use automatic`]}):(0,Q.jsx)(rt,{children:n?`自动`:`Automatic`})]}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(ke,{value:w.workspace??``,onChange:e=>E(t=>({...t,workspace:e||void 0})),wd:fe,placeholder:e.effective.workspace,inputAriaLabel:n?`智能体工作区路径`:`Agent workspace path`,inputClassName:`${$} font-mono`,disabled:D})})]})}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-work-panel-instructions`,"aria-labelledby":`agent-work-tab-instructions`,hidden:g!==`instructions`,className:`space-y-6`,children:[(0,Q.jsx)(Ve,{ref:B,file:`AGENTS.md`,agentId:e.id,zh:n,onDirtyChange:Ce}),(0,Q.jsxs)(ot,{title:n?`附加规则`:`Additional rules`,summary:w.profile?.instructions?n?`已设置`:`Configured`:void 0,children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`附加指令`:`Additional instructions`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`补充简短的执行规则;长期工作规范请写入上方「工作规范」。`:`Add short execution rules. Keep lasting work guidance in Working instructions above.`}),(0,Q.jsx)(`textarea`,{rows:4,className:`${$} mt-4 resize-y leading-6`,value:w.profile?.instructions??``,onChange:t=>E(n=>({...n,profile:{...n.profile,name:n.profile?.name||e.name||e.id,instructions:t.target.value||void 0}})),placeholder:n?`可选:补充必须始终遵循的规则`:`Optional: add a rule that must always be followed`})]})]}),(0,Q.jsx)(`div`,{role:`tabpanel`,id:`agent-work-panel-tools`,"aria-labelledby":`agent-work-tab-tools`,hidden:g!==`tools`,className:`space-y-6`,children:(0,Q.jsx)(Ve,{ref:V,file:`TOOLS.md`,agentId:e.id,zh:n,onDirtyChange:we})}),(0,Q.jsxs)(`div`,{role:`tabpanel`,id:`agent-work-panel-runtime`,"aria-labelledby":`agent-work-tab-runtime`,hidden:g!==`runtime`,className:`space-y-6`,children:[(0,Q.jsx)(it,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:void 0}),(0,Q.jsx)(ot,{title:n?`执行限制`:`Execution limits`,summary:n?`保留当前运行限制;未覆盖的字段继承全局设置。`:`Current limits remain active; unspecified limits inherit globally.`,children:(0,Q.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,w.runtime?.[t]===void 0?(0,Q.jsx)(rt,{children:n?`继承`:`Inherited`}):null]}),(0,Q.jsx)(Ee,{allowEmpty:!0,type:`number`,min:1,className:`${$} mt-1.5`,value:w.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=st({...w.runtime??{},[t]:nt(e.target.value)});E({...w,runtime:n})}})]},t))})}),(0,Q.jsx)(ot,{title:n?`提示词缓存`:`Prompt cache`,summary:w.runtime?.promptCache?.mode??(n?`继承全局`:`Inherited globally`),children:(0,Q.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:w.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),w.runtime?.promptCache?(0,Q.jsxs)(J,{variant:`ghost`,onClick:()=>{let e=st({...w.runtime??{},promptCache:void 0});E({...w,runtime:e})},children:[(0,Q.jsx)(O,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),w.runtime?.promptCache?(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,Q.jsx)(me,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":n?`缓存模式`:`Cache mode`,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[`auto`,`off`].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":w.runtime?.promptCache?.mode===e,type:`button`,onClick:()=>E({...w,runtime:{...w.runtime,promptCache:{...w.runtime.promptCache,mode:e}}}),className:P(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,w.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,Q.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,Q.jsx)(me,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,role:`group`,"aria-label":n?`缓存周期`:`Cache lifetime`,indicatorClassName:`rounded-lg bg-surface-panel shadow-surface`,children:[`short`,`long`].map(e=>(0,Q.jsx)(`button`,{"aria-pressed":w.runtime?.promptCache?.lifetime===e,type:`button`,onClick:()=>E({...w,runtime:{...w.runtime,promptCache:{...w.runtime.promptCache,lifetime:e}}}),className:P(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,w.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,Q.jsx)(J,{className:`mt-4`,onClick:()=>E({...w,runtime:{...w.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})})]})]}):null]}),(0,Q.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:D?n?`保存中…`:`Saving…`:te?n?`请补全自定义模型`:`Complete the custom model reference`:q?n?`有未保存的更改`:`Unsaved changes`:b?n?`更改已保存`:`Changes saved`:n?`未修改`:`No changes`}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(J,{onClick:o,children:n?`关闭`:`Close`}),(0,Q.jsx)(J,{variant:`primary`,disabled:D||K||!q||te||w.profile!==void 0&&!w.profile.name.trim(),onClick:()=>void _e(),children:D?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function lt(e){let t=(0,Z.c)(21),{agent:n,tuiDefaultAgentId:r,messages:i}=e,a;t[0]===n.id?a=t[1]:(a=fe(n.id),t[0]=n.id,t[1]=a);let o=a,s=n.id===r,c;t[2]!==n.isDefault||t[3]!==i?(c=n.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:i.listDefaultBadge}):null,t[2]=n.isDefault,t[3]=i,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==i?(l=s?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg`,children:i.tuiDefaultBadge}):null,t[5]=s,t[6]=i,t[7]=l):l=t[7];let u;t[8]!==o||t[9]!==i?(u=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg`,children:i.listPersonalDefaultBadge}):null,t[8]=o,t[9]=i,t[10]=u):u=t[10];let d;t[11]!==n.isDefault||t[12]!==o||t[13]!==s||t[14]!==i?(d=!n.isDefault&&!s&&!o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i.listCustomBadge}):null,t[11]=n.isDefault,t[12]=o,t[13]=s,t[14]=i,t[15]=d):d=t[15];let f;return t[16]!==c||t[17]!==l||t[18]!==u||t[19]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-1`,children:[c,l,u,d]}),t[16]=c,t[17]=l,t[18]=u,t[19]=d,t[20]=f):f=t[20],f}function ut(e){let t=(0,Z.c)(37),{agent:n,tuiDefaultAgentId:r,messages:i,open:a,onOpenChange:o,children:s}=e,[c,g]=(0,X.useState)(null),_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(l,{className:P(`xopc-dialog-overlay fixed inset-0 bg-scrim`,re)}),t[0]=_):_=t[0];let v;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(v=P(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,ne,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=v):v=t[1];let b;t[2]!==n.avatar||t[3]!==n.id?(b=(0,Q.jsx)(le,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=b):b=t[4];let x;t[5]!==n||t[6]!==i?(x=de(n,i),t[5]=n,t[6]=i,t[7]=x):x=t[7];let S;t[8]===x?S=t[9]:(S=(0,Q.jsx)(m,{className:`truncate text-base font-semibold text-fg`,children:x}),t[8]=x,t[9]=S);let C;t[10]===n.id?C=t[11]:(C=(0,Q.jsx)(u,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=C);let w;t[12]!==S||t[13]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[12]=S,t[13]=C,t[14]=w):w=t[14];let T;t[15]!==n||t[16]!==i||t[17]!==r?(T=(0,Q.jsx)(lt,{agent:n,tuiDefaultAgentId:r,messages:i}),t[15]=n,t[16]=i,t[17]=r,t[18]=T):T=t[18];let E;t[19]!==b||t[20]!==w||t[21]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[b,w,T]}),t[19]=b,t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(N,{className:`size-4`}),t[23]=D):D=t[23];let O;t[24]===i.closeDialogAria?O=t[25]:(O=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.closeDialogAria,children:D})}),t[24]=i.closeDialogAria,t[25]=O);let k;t[26]!==O||t[27]!==E?(k=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[E,O]}),t[26]=O,t[27]=E,t[28]=k):k=t[28];let A;t[29]!==s||t[30]!==c||t[31]!==k?(A=(0,Q.jsxs)(f,{children:[_,(0,Q.jsx)(p,{ref:g,className:v,onOpenAutoFocus:dt,children:(0,Q.jsxs)(y,{layer:`modal`,portalContainer:c,children:[k,s]})})]}),t[29]=s,t[30]=c,t[31]=k,t[32]=A):A=t[32];let j;return t[33]!==o||t[34]!==a||t[35]!==A?(j=(0,Q.jsx)(h,{open:a,onOpenChange:o,children:A}),t[33]=o,t[34]=a,t[35]=A,t[36]=j):j=t[36],j}function dt(e){return e.preventDefault()}function ft(e){let t=(0,Z.c)(15),{agents:n,tuiDefaultAgentId:r,busy:i,messages:a,onOpen:o,onChat:s}=e,c;if(t[0]!==n||t[1]!==i||t[2]!==a||t[3]!==s||t[4]!==o||t[5]!==r){let e;t[7]!==i||t[8]!==a||t[9]!==s||t[10]!==o||t[11]!==r?(e=e=>{let t=de(e,a),n=pe(e,a);return(0,Q.jsx)(`li`,{className:`min-h-0`,children:(0,Q.jsxs)(`article`,{className:P(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,Q.jsx)(`button`,{type:`button`,disabled:i,"aria-label":a.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>o(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,Q.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Q.jsx)(le,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,Q.jsx)(lt,{agent:e,tuiDefaultAgentId:r,messages:a})]}),(0,Q.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||a.listUsesGlobalSettings}),(0,Q.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,Q.jsxs)(J,{className:`w-full`,disabled:i,onClick:t=>{t.stopPropagation(),s(e.id)},children:[(0,Q.jsx)(T,{className:`size-4`}),a.listChatWithAgent]})})]})},e.id)},t[7]=i,t[8]=a,t[9]=s,t[10]=o,t[11]=r,t[12]=e):e=t[12],c=n.map(e),t[0]=n,t[1]=i,t[2]=a,t[3]=s,t[4]=o,t[5]=r,t[6]=c}else c=t[6];let l;return t[13]===c?l=t[14]:(l=(0,Q.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:c}),t[13]=c,t[14]=l),l}var pt=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function mt(e){let t=(0,Z.c)(79),{draft:n,busy:r,error:i,messages:a,workingDirectoryMessages:o,onChange:s,onCreate:c,onOpenChange:g}=e,_=n.open,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(l,{className:P(`xopc-dialog-overlay fixed inset-0 bg-scrim`,re)}),t[0]=v):v=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=P(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-2rem))] w-[min(92vw,36rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,`overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,ne),t[1]=y):y=t[1];let b;t[2]===a.manualCreateTitle?b=t[3]:(b=(0,Q.jsx)(m,{className:`text-base font-semibold text-fg`,children:a.manualCreateTitle}),t[2]=a.manualCreateTitle,t[3]=b);let x;t[4]===a.manualCreateDescription?x=t[5]:(x=(0,Q.jsx)(u,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:a.manualCreateDescription}),t[4]=a.manualCreateDescription,t[5]=x);let S;t[6]!==b||t[7]!==x?(S=(0,Q.jsxs)(`div`,{children:[b,x]}),t[6]=b,t[7]=x,t[8]=S):S=t[8];let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[9]=C):C=t[9];let w;t[10]===a.manualCreateClose?w=t[11]:(w=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`touch-target shrink-0 rounded-lg p-2 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a.manualCreateClose,children:C})}),t[10]=a.manualCreateClose,t[11]=w);let T;t[12]!==S||t[13]!==w?(T=(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[S,w]}),t[12]=S,t[13]=w,t[14]=T):T=t[14];let E;t[15]===i?E=t[16]:(E=i?(0,Q.jsx)(`p`,{role:`alert`,className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[15]=i,t[16]=E);let D;t[17]===s?D=t[18]:(D=e=>s({name:e.target.value}),t[17]=s,t[18]=D);let O;t[19]!==n.name||t[20]!==a.manualCreateNamePlaceholder||t[21]!==D?(O=(0,Q.jsx)(`input`,{id:`manual-agent-name`,autoFocus:!0,className:`${pt} mt-1.5`,value:n.name,onChange:D,placeholder:a.manualCreateNamePlaceholder}),t[19]=n.name,t[20]=a.manualCreateNamePlaceholder,t[21]=D,t[22]=O):O=t[22];let k;t[23]!==a.manualCreateName||t[24]!==O?(k=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateName,O]}),t[23]=a.manualCreateName,t[24]=O,t[25]=k):k=t[25];let A;t[26]===s?A=t[27]:(A=e=>s({instructions:e.target.value}),t[26]=s,t[27]=A);let j;t[28]!==n.instructions||t[29]!==a.manualCreateInstructionsPlaceholder||t[30]!==A?(j=(0,Q.jsx)(`textarea`,{id:`manual-agent-instructions`,rows:4,className:`${pt} mt-1.5 resize-y leading-6`,value:n.instructions,onChange:A,placeholder:a.manualCreateInstructionsPlaceholder}),t[28]=n.instructions,t[29]=a.manualCreateInstructionsPlaceholder,t[30]=A,t[31]=j):j=t[31];let M;t[32]!==a.manualCreateInstructions||t[33]!==j?(M=(0,Q.jsxs)(`label`,{htmlFor:`manual-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[a.manualCreateInstructions,j]}),t[32]=a.manualCreateInstructions,t[33]=j,t[34]=M):M=t[34];let F;t[35]===a.manualCreateWorkspace?F=t[36]:(F=(0,Q.jsx)(`label`,{htmlFor:`manual-agent-workspace`,className:`block text-xs font-medium text-fg-muted`,children:a.manualCreateWorkspace}),t[35]=a.manualCreateWorkspace,t[36]=F);let I;t[37]===a.manualCreateWorkspaceHint?I=t[38]:(I=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:a.manualCreateWorkspaceHint}),t[37]=a.manualCreateWorkspaceHint,t[38]=I);let L;t[39]===s?L=t[40]:(L=e=>s({workspace:e}),t[39]=s,t[40]=L);let R;t[41]!==r||t[42]!==n.workspace||t[43]!==a.manualCreateWorkspace||t[44]!==a.manualCreateWorkspacePlaceholder||t[45]!==L||t[46]!==o?(R=(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(ke,{value:n.workspace,onChange:L,disabled:r,wd:o,placeholder:a.manualCreateWorkspacePlaceholder,inputAriaLabel:a.manualCreateWorkspace,inputClassName:`${pt} font-mono`})}),t[41]=r,t[42]=n.workspace,t[43]=a.manualCreateWorkspace,t[44]=a.manualCreateWorkspacePlaceholder,t[45]=L,t[46]=o,t[47]=R):R=t[47];let z;t[48]!==F||t[49]!==I||t[50]!==R?(z=(0,Q.jsxs)(`div`,{children:[F,I,R]}),t[48]=F,t[49]=I,t[50]=R,t[51]=z):z=t[51];let B;t[52]!==E||t[53]!==k||t[54]!==M||t[55]!==z?(B=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:[E,k,M,z]}),t[52]=E,t[53]=k,t[54]=M,t[55]=z,t[56]=B):B=t[56];let V;t[57]!==r||t[58]!==a.manualCreateCancel?(V=(0,Q.jsx)(d,{asChild:!0,children:(0,Q.jsx)(J,{disabled:r,children:a.manualCreateCancel})}),t[57]=r,t[58]=a.manualCreateCancel,t[59]=V):V=t[59];let H;t[60]!==r||t[61]!==n.name?(H=r||!n.name.trim(),t[60]=r,t[61]=n.name,t[62]=H):H=t[62];let U=r?a.manualCreating:a.manualCreateSubmit,W;t[63]!==r||t[64]!==c||t[65]!==H||t[66]!==U?(W=(0,Q.jsx)(J,{variant:`primary`,disabled:H,"aria-busy":r,onClick:c,children:U}),t[63]=r,t[64]=c,t[65]=H,t[66]=U,t[67]=W):W=t[67];let G;t[68]!==V||t[69]!==W?(G=(0,Q.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[V,W]}),t[68]=V,t[69]=W,t[70]=G):G=t[70];let K;t[71]!==B||t[72]!==G||t[73]!==T?(K=(0,Q.jsxs)(f,{children:[v,(0,Q.jsxs)(p,{className:y,children:[T,B,G]})]}),t[71]=B,t[72]=G,t[73]=T,t[74]=K):K=t[74];let ee;return t[75]!==n.open||t[76]!==g||t[77]!==K?(ee=(0,Q.jsx)(h,{open:_,onOpenChange:g,children:K}),t[75]=n.open,t[76]=g,t[77]=K,t[78]=ee):ee=t[78],ee}var ht=`px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,gt=`max-w-7xl`;function _t(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(F,{className:`h-7 w-28`}),(0,Q.jsx)(F,{className:`h-4 w-80 max-w-full`})]}),(0,Q.jsx)(F,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(De,{gap:`gap-5`,padding:ht,className:gt,children:[t,(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(vt)})]}),e[1]=n):n=e[1],n}function vt(e){return(0,Q.jsx)(F,{className:`h-64 rounded-2xl`},e)}function yt({agentId:e,onHeaderActionChange:t}){let n=o(e=>e.conversationId),r=s(e=>e.language),i=r===`zh`,l=c(r),u=l.agentsSettings,d=a(),{data:f,error:p,isLoading:m,mutate:h}=R(n?`settings-gateway-agents`:null,K),{data:g}=z(!!n),_=(g?.payload?.config)?.tui?.defaultAgent?.trim(),[v,y]=(0,X.useState)(!1),[b,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(null),[T,E]=(0,X.useState)(null),[O,j]=(0,X.useState)({open:!1,name:``,instructions:``,workspace:``}),M=(0,X.useRef)(!1),N=f?.agents.find(t=>t.id===e),F=(0,X.useCallback)(()=>{f&&(S(null),L(f.defaultId),d(ue(u.setupDraftPrefix),{state:{forceNewChat:!0,agentId:f.defaultId}}))},[u.setupDraftPrefix,f,d]),I=(0,X.useCallback)(async()=>{if(!(v||!O.name.trim())){y(!0),w(null);try{let e=await te({profile:{name:O.name.trim(),...O.instructions.trim()?{instructions:O.instructions.trim()}:{}},...O.workspace.trim()?{workspace:O.workspace.trim()}:{}});j({open:!1,name:``,instructions:``,workspace:``}),L(e.createdAgentId),d(`/chat/new?projectScope=none`,{state:{forceNewChat:!0,agentId:e.createdAgentId}})}catch(e){w(e instanceof Error?e.message:String(e))}finally{y(!1)}}},[v,O,d]),B=(0,X.useMemo)(()=>({overflow:(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(_e,{asChild:!0,children:(0,Q.jsx)(J,{variant:`secondary`,className:`size-9 shrink-0 p-0`,"aria-label":l.capabilitiesHub.moreActions,title:l.capabilitiesHub.moreActions,children:(0,Q.jsx)(x,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(ve,{children:(0,Q.jsxs)(be,{align:`end`,sideOffset:6,className:`z-50 min-w-48 rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,Q.jsxs)(ye,{className:P(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Y.transition),onSelect:()=>d(`/settings/agent-defaults`),children:[(0,Q.jsx)(k,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),i?`全局默认配置`:`Global defaults`]}),(0,Q.jsxs)(ye,{className:P(`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,Y.transition),onSelect:()=>{w(null),j(e=>({...e,open:!0}))},children:[(0,Q.jsx)(A,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),u.manualCreateMenu]})]})})]}),primary:(0,Q.jsxs)(J,{variant:`primary`,className:`shrink-0`,"aria-label":u.listNewAgentCard,onClick:F,children:[(0,Q.jsx)(D,{className:`size-4`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:u.listNewAgentCard})]})}),[u.listNewAgentCard,u.manualCreateMenu,l.capabilitiesHub.moreActions,d,F,i]);(0,X.useLayoutEffect)(()=>(t?.(B),()=>t?.(null)),[B,t]);let V=async e=>{y(!0),S(null);try{await G(e.id),d(Ce)}catch(e){S(e instanceof Error?e.message:String(e))}finally{y(!1)}},H=e=>{L(e),d(`/chat/new`)},U=e=>{M.current=!1,window.setTimeout(()=>d(Se(e)),0)},W=()=>{if(M.current){E({kind:`discard`,destination:Ce});return}M.current=!1,d(Ce)},ee=()=>{if(M.current){E({kind:`discard`,destination:`/settings/agent-defaults`});return}M.current=!1,d(`/settings/agent-defaults`)},q=()=>{if(!T)return;if(E(null),T.kind===`discard`){M.current=!1,d(T.destination);return}let e=f?.agents.find(e=>e.id===T.agentId);e&&V(e)},ne=(0,X.useCallback)(e=>{M.current=e},[]);return n?p&&!f?(0,Q.jsxs)(De,{className:gt,padding:ht,children:[(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(p)}),(0,Q.jsx)(J,{onClick:()=>void h(),children:i?`重试`:`Retry`})]}):m||!f?(0,Q.jsx)(_t,{}):(0,Q.jsxs)(De,{gap:`gap-5`,className:gt,padding:ht,children:[(p||b)&&!N?(0,Q.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:b??String(p)}):null,(0,Q.jsx)(ft,{agents:f.agents,tuiDefaultAgentId:_,busy:v,messages:u,onOpen:U,onChat:H}),N?(0,Q.jsx)(ut,{agent:N,tuiDefaultAgentId:_,messages:u,open:!0,onOpenChange:e=>{e||W()},children:(0,Q.jsx)(ct,{agent:N,toolIds:f.builtinToolIds,zh:i,messages:u,externalError:b,onDirtyChange:ne,onClose:W,onOpenDefaults:ee,onChat:()=>H(N.id),onDelete:()=>E({kind:`delete`,agentId:N.id,displayName:de(N,u)})},N.id)}):null,(0,Q.jsx)(mt,{draft:O,busy:v,error:C,messages:u,workingDirectoryMessages:l.chat.workingDirectory,onChange:e=>j(t=>({...t,...e})),onCreate:()=>void I(),onOpenChange:e=>{v||(j(t=>({...t,open:e})),e||w(null))}}),(0,Q.jsx)(he,{open:T!==null,title:T?.kind===`delete`?i?`删除智能体?`:`Delete agent?`:i?`放弃未保存的更改?`:`Discard unsaved changes?`,description:T?.kind===`delete`?i?`删除 ${T.displayName}?此操作无法撤销。`:`Delete ${T.displayName}? This cannot be undone.`:i?`当前更改尚未保存,离开后将丢失。`:`Your changes have not been saved. Leaving will discard them.`,confirmLabel:T?.kind===`delete`?i?`删除`:`Delete`:i?`放弃并离开`:`Discard and leave`,cancelLabel:i?`继续编辑`:`Keep editing`,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:q,onCancel:()=>E(null)})]}):(0,Q.jsx)(De,{className:gt,padding:ht,children:(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`需要本机服务令牌。`:`Local service token required.`})})}export{yt as AgentsSettingsPanel};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]);export{t};
@@ -1,2 +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{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{t as s}from"./messages-e5MhDONm.js";import{a as c,i as l,n as u,o as d,r as f,s as p,t as m}from"./dist-CY7CS_D3.js";import{d as h,f as g,i as _,r as v,t as y,u as b}from"./automation-display-DaVDNZz8.js";import{t as ee}from"./chevron-down-ccbiQQz_.js";import{t as x}from"./chevron-right-BweFrslA.js";import{n as S,r as C}from"./popover-select-CLsphyzA.js";import{O as w}from"./markdown-view-CSpQhSka.js";import{t as T}from"./message-circle-Badhj-4D.js";import{t as E}from"./pencil-DmIY3Oa-.js";import{t as te}from"./x-B_N4OPjy.js";import{t as D}from"./cn-0WouolD0.js";import{t as O}from"./skeleton-DzdOeGYz.js";import{i as k,o as A}from"./vendor-swr-CdRzEUwF.js";import{t as j}from"./chat-agents-api-C3JChTsh.js";import{t as M}from"./button-Cc4hUNTt.js";import{t as N}from"./automation-api-BOnIc_vw.js";import{n as P}from"./model-selector-B4oTiJI6.js";import{t as F}from"./date-picker-ClRDaNBJ.js";import{t as I}from"./time-picker-C1PXAXZF.js";var L=e(t(),1),R=n(),z=r(),B=`touch-manipulation inline-flex min-h-11 w-fit max-w-full min-w-0 items-center gap-2 rounded-[1.125rem] bg-surface-inset px-3 py-2 text-left text-sm text-fg transition-colors duration-150 motion-reduce:transition-none hover:bg-surface-hover active:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,ne=`m-0 flex w-full min-w-0 max-w-full list-none flex-col items-start gap-2 p-0`,V=`mt-2 min-w-0 max-w-full rounded-xl bg-surface-inset p-3 text-sm`;function H(e){let t=(0,R.c)(17),{icon:n,title:r,meta:i,trailing:a,fullTitle:o,className:s}=e,c=o!==void 0&&o,l;t[0]===n?l=t[1]:(l=(0,z.jsx)(`span`,{className:`flex size-[18px] shrink-0 items-center justify-center text-accent-fg [&>svg]:size-[18px]`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=l);let u=!c&&`line-clamp-2`,d;t[2]!==s||t[3]!==u?(d=D(`min-w-0 max-w-full break-words text-sm [overflow-wrap:anywhere]`,u,s),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f;t[5]!==d||t[6]!==r?(f=(0,z.jsx)(`span`,{className:d,children:r}),t[5]=d,t[6]=r,t[7]=f):f=t[7];let p;t[8]===i?p=t[9]:(p=i?(0,z.jsxs)(`span`,{className:`flex min-w-0 max-w-full items-center gap-1.5 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{className:`shrink-0`,"aria-hidden":!0,children:`·`}),(0,z.jsx)(`span`,{className:`min-w-0 line-clamp-2 break-words [overflow-wrap:anywhere]`,children:i})]}):null,t[8]=i,t[9]=p);let m;t[10]!==f||t[11]!==p?(m=(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5`,children:[f,p]}),t[10]=f,t[11]=p,t[12]=m):m=t[12];let h;return t[13]!==l||t[14]!==m||t[15]!==a?(h=(0,z.jsxs)(z.Fragment,{children:[l,m,a]}),t[13]=l,t[14]=m,t[15]=a,t[16]=h):h=t[16],h}function U({label:e,children:t}){let n=(0,L.useId)(),r,i=L.Children.map(t,(e,t)=>{if(!(0,L.isValidElement)(e)||e.type!==`input`&&e.type!==`textarea`&&e.type!==`select`&&e.type!==S)return e;let i=e,a=i.props.id??`${n}-${t}`;return r??=a,(0,L.cloneElement)(i,{id:a,...!i.props[`aria-label`]&&!i.props[`aria-labelledby`]?{"aria-labelledby":`${n}-label`}:{}})});return(0,z.jsxs)(`div`,{className:`grid gap-1.5`,role:`group`,"aria-labelledby":`${n}-label`,children:[r?(0,z.jsx)(`label`,{id:`${n}-label`,htmlFor:r,className:`text-xs font-medium text-fg-muted`,children:e}):(0,z.jsx)(`span`,{id:`${n}-label`,className:`text-xs font-medium text-fg-muted`,children:e}),i]})}async function W(e){let{conversationId:t}=await N.openConfiguration({automationId:e.automationId?.trim()||void 0,projectId:e.projectId?.trim()||void 0,...e.runId?{runId:e.runId}:{}}),n=new URLSearchParams(e.automationId?{automation:e.automationId.trim()}:{new:`1`,setupChat:t});return e.projectId?.trim()&&n.set(`projectId`,e.projectId.trim()),e.prompt?.trim()&&n.set(`chatDraft`,e.prompt.trim()),`/automations?${n.toString()}`}var G={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,model:``,instruction:``,taskId:``,safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,resultWebhookEndpoint:``,resultWebhookSecretId:``,disableAfterFailures:`3`},K=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function q(e){let[t,n]=e.time.split(`:`),r=Number.parseInt(t||`9`,10),i=Number.parseInt(n||`0`,10),a;if(e.triggerMode===`manual`)a={kind:`manual`};else if(e.triggerMode===`once`)a={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)a={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)a={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)a={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`sessionUpdated`)a={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;a={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else a=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:y(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:`${i} ${r} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,...e.timezone?.trim()?{tz:e.timezone.trim()}:{},expr:`${i} ${r} * * *`}};let o=e.actionMode===`task_command`?`auto_apply`:e.safetyMode,s;return s=e.actionMode===`task_command`?{kind:`task_command`,taskId:e.taskId.trim(),command:{type:`start`,executor:{kind:`agent`,agentId:e.agentId.trim()}}}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...e.model.trim()?{model:e.model.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:a,action:s,safety:{mode:o},conversationMode:e.conversationMode,delivery:{notificationPolicy:e.notificationPolicy,destinations:[{key:`gateway_event`,kind:`gateway_event`},...e.resultWebhookEndpoint.trim()&&e.resultWebhookSecretId.trim()?[{key:`result_webhook`,kind:`webhook`,endpoint:e.resultWebhookEndpoint.trim(),secretId:e.resultWebhookSecretId.trim()}]:[]]},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function re(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:G.time,weekday:G.weekday,cronExpr:e}}function ie(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function J(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function Y(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function X(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function ae(e){let t={triggerMode:`manual`};if(e.trigger.kind===`webhook`)t={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)t=Y(e.trigger);else if(e.trigger.kind===`schedule`){let n=e.trigger.schedule;n.kind===`cron`&&(t={...re(n.expr),timezone:n.tz??``}),n.kind===`interval`&&(t={triggerMode:`interval`,...ie(n.everyMs)}),n.kind===`once`&&(t={triggerMode:`once`,onceAt:J(n.at)})}let n=e.action,r=e.reliability?.executionTimeoutSeconds??(`timeoutSeconds`in n?n.timeoutSeconds:void 0)??1800;return{...G,...t,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:n.kind===`task_command`?`task_command`:`agent`,agentId:n.kind===`agent`?n.agentId??``:n.kind===`task_command`&&n.command.type===`start`&&n.command.executor.kind===`agent`?n.command.executor.agentId:``,model:n.kind===`agent`?n.model??``:``,instruction:n.kind===`agent`?n.instruction:``,taskId:n.kind===`task_command`?n.taskId:``,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(r),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.delivery.notificationPolicy,resultWebhookEndpoint:e.delivery.destinations.find(e=>e.kind===`webhook`)?.endpoint??``,resultWebhookSecretId:e.delivery.destinations.find(e=>e.kind===`webhook`)?.secretId??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function Z(e,t){let n=q(t),r=e.trigger.kind===`schedule`&&n.trigger.kind===`schedule`&&e.trigger.schedule.kind===n.trigger.schedule.kind?{...n.trigger,schedule:{...e.trigger.schedule,...n.trigger.schedule}}:n.trigger,i=n.action;e.action.kind===`agent`&&n.action.kind===`agent`?i={...e.action,...n.action,agentId:n.action.agentId,model:n.action.model}:e.action.kind===`task_command`&&n.action.kind===`task_command`&&(i=n.action);let a=e.delivery.destinations.filter(e=>e.kind===`gateway_event`),o=e.delivery.destinations.filter(e=>e.kind===`webhook`);return{...n,description:t.description.trim(),projectId:t.projectId.trim(),delivery:{notificationPolicy:t.notificationPolicy,destinations:[...a.length>0?a:[{key:`gateway_event`,kind:`gateway_event`}],...e.delivery.destinations.filter(e=>e.kind===`file`||e.kind===`card`),...o.slice(1),...t.resultWebhookEndpoint.trim()&&t.resultWebhookSecretId.trim()?[{key:o[0]?.key??`result_webhook`,kind:`webhook`,endpoint:t.resultWebhookEndpoint.trim(),secretId:t.resultWebhookSecretId.trim()}]:[]]},trigger:r,action:i,reliability:{...e.reliability,...n.reliability}}}var oe=h();function Q(e,t=new Date){let n=q(e);if(n.trigger.kind!==`schedule`||n.trigger.schedule.kind!==`cron`||!n.trigger.schedule.tz)return[];let r=oe.CronExpressionParser.parse(n.trigger.schedule.expr,{currentDate:t,tz:n.trigger.schedule.tz});return[new Date(r.next().getTime()).toISOString(),new Date(r.next().getTime()).toISOString(),new Date(r.next().getTime()).toISOString()]}function se(e){let t=(0,R.c)(35),{form:n,onChange:r,language:i}=e;if(![`daily`,`weekly`,`cron`,`once`].includes(n.triggerMode))return null;let a=i===`zh`;if(n.triggerMode===`once`){let e=a?`按当前浏览器时区输入,保存为绝对时间:`:`Entered in this browser timezone and stored as an absolute time: `,n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=Intl.DateTimeFormat().resolvedOptions(),t[0]=n):n=t[0];let r;return t[1]!==e||t[2]!==n.timeZone?(r=(0,z.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e,n.timeZone]}),t[1]=e,t[2]=n.timeZone,t[3]=r):r=t[3],r}let o,s,c,l,u,d;if(t[4]!==n||t[5]!==r||t[6]!==a){let e=[],i=!1;try{e=Q(n)}catch{i=!0}u=`rounded-lg bg-surface-base p-3`;let f=a?`时区与接下来的运行时间`:`Timezone and upcoming runs`,p=n.timezone?` · ${n.timezone}`:``;t[13]!==f||t[14]!==p?(d=(0,z.jsxs)(`summary`,{className:`cursor-pointer text-xs text-fg-muted focus-visible:outline-accent`,children:[f,p]}),t[13]=f,t[14]=p,t[15]=d):d=t[15],o=`mt-3 space-y-2`;let m=a?`时区`:`Timezone`,h=n.timezone??``,g;t[16]===r?g=t[17]:(g=e=>r({timezone:e.target.value}),t[16]=r,t[17]=g);let _;t[18]!==h||t[19]!==g?(_=(0,z.jsx)(`input`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,value:h,placeholder:`Asia/Shanghai`,onChange:g,"aria-invalid":i}),t[18]=h,t[19]=g,t[20]=_):_=t[20],t[21]!==_||t[22]!==m?(s=(0,z.jsx)(U,{label:m,children:_}),t[21]=_,t[22]=m,t[23]=s):s=t[23];let v=n.timezone?a?`按 ${n.timezone} 运行;下方显示执行时区时间与当前浏览器的当地时间。`:`Runs in ${n.timezone}; schedule-zone and browser-local times follow.`:a?`此规则未指定时区,沿用服务所在电脑的时区。指定时区后可预览;更改前请确认原定时间。`:`This legacy rule uses the service computer timezone. Specify a timezone to preview; confirm the intended schedule before changing it.`;t[24]===v?c=t[25]:(c=(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v}),t[24]=v,t[25]=c),l=i?(0,z.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a?`请检查时区和定时规则。`:`Check the timezone and schedule expression.`}):(0,z.jsx)(`ol`,{className:`space-y-1 text-xs text-fg-muted`,children:e.map(e=>(0,z.jsxs)(`li`,{children:[new Date(e).toLocaleString(a?`zh-CN`:`en-US`,{timeZone:n.timezone,timeZoneName:`short`}),` · `,a?`你这里:`:`Your local time: `,new Date(e).toLocaleString(a?`zh-CN`:`en-US`,{timeZoneName:`short`})]},e))}),t[4]=n,t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d}else o=t[7],s=t[8],c=t[9],l=t[10],u=t[11],d=t[12];let f;t[26]!==o||t[27]!==s||t[28]!==c||t[29]!==l?(f=(0,z.jsxs)(`div`,{className:o,children:[s,c,l]}),t[26]=o,t[27]=s,t[28]=c,t[29]=l,t[30]=f):f=t[30];let p;return t[31]!==u||t[32]!==d||t[33]!==f?(p=(0,z.jsxs)(`details`,{className:u,children:[d,f]}),t[31]=u,t[32]=d,t[33]=f,t[34]=p):p=t[34],p}async function ce(){await A(e=>typeof e==`string`?e.startsWith(`automation`):Array.isArray(e)&&typeof e[0]==`string`&&e[0].startsWith(`automation`))}var $=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-accent`;function le({automation:e,projectId:t,language:n,onClose:r,onCreated:i}){let{data:a,error:o}=k(`automation-chat-agents`,j),h=(0,L.useRef)(null),[g]=(0,L.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),[_,v]=(0,L.useState)(e),[b,x]=(0,L.useState)(()=>e?ae(e):{...G,projectId:t??``,safetyMode:`auto_apply`}),[w,T]=(0,L.useState)(b),[E,D]=(0,L.useState)(!1),[O,A]=(0,L.useState)(``),[R,B]=(0,L.useState)(!1),[ne,V]=(0,L.useState)(!1),H=n===`zh`,W=e=>T(t=>({...t,...e})),K=()=>{E||JSON.stringify(w)!==JSON.stringify(b)&&!window.confirm(H?`放弃尚未保存的修改?`:`Discard unsaved changes?`)||r()},re=async()=>{D(!0),A(``),B(!1);try{let e=!_||[`triggerMode`,`onceAt`,`time`,`weekday`,`timezone`,`cronExpr`,`intervalValue`,`intervalUnit`].some(e=>w[e]!==b[e]);if((e||_?.enabled)&&w.triggerMode===`once`&&(!w.onceAt||!Number.isFinite(new Date(w.onceAt).getTime())||new Date(w.onceAt).getTime()<=Date.now()))throw Error(H?`请选择未来的运行时间。`:`Choose a future run time.`);if(_&&_.action.kind!==`agent`)throw Error(H?`请在任务页编辑此类型任务。`:`Edit this task type on the task page.`);if([`daily`,`weekly`].includes(w.triggerMode)&&!/^(?:[01]\d|2[0-3]):[0-5]\d$/.test(w.time))throw Error(H?`请选择有效的运行时间。`:`Choose a valid run time.`);if(w.triggerMode===`interval`&&y(w.intervalValue,w.intervalUnit)<6e4)throw Error(H?`运行间隔至少为一分钟。`:`Use an interval of at least one minute.`);Q(w);let t=w.name.trim()||w.instruction.trim().split(`
2
- `)[0].slice(0,80),n=q({...w,name:t});if(_&&_.action.kind===`agent`)await N.update(_.id,{expectedRevision:_.updatedAtMs,name:t,action:{..._.action,instruction:w.instruction.trim(),agentId:w.agentId.trim()||void 0,model:w.model.trim()||void 0},...e?{trigger:n.trigger}:{},conversationMode:w.conversationMode,delivery:{..._.delivery,notificationPolicy:w.notificationPolicy}});else{let e=await N.create({...n,enabled:!0});i?.(e.automation)}await ce(),r()}catch(e){B(e?.status===409),A(e?.status===409?H?`任务已在其他地方更新,请核对最新设置后再保存。`:`This task changed elsewhere. Review the latest settings before saving.`:e instanceof Error?e.message:String(e))}finally{D(!1)}},ie=async()=>{if(!(!_||!window.confirm(H?`载入最新设置将替换当前未保存的修改,是否继续?`:`Loading the latest settings replaces your unsaved edits. Continue?`))){D(!0);try{let{automation:e}=await N.get(_.id),t=ae(e);v(e),x(t),T(t),A(``),B(!1)}catch{A(H?`暂时无法载入最新设置,请重试。`:`Could not load the latest settings. Try again.`)}finally{D(!1)}}},J=w.timezone||(H?`默认时区`:`Default timezone`);try{J=H&&w.timezone===`Asia/Shanghai`?`中国时间`:new Intl.DateTimeFormat(H?`zh-CN`:`en-US`,{timeZone:J,timeZoneName:`shortGeneric`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value||J}catch{}let Y=``;try{let e=Q(w)[0];e&&w.timezone!==Intl.DateTimeFormat().resolvedOptions().timeZone&&(Y=`${H?`你这里的下次时间:`:`Next run in your timezone: `}${new Date(e).toLocaleString(H?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`})}`)}catch{}let X=`flex min-h-12 items-center justify-between gap-4 border-b border-edge last:border-b-0`,Z=`min-h-10 w-32 shrink-0 justify-end border-0 bg-transparent py-2 pl-3 pr-0 text-right text-sm text-fg-muted shadow-none`;return(0,z.jsx)(m,{open:!0,onOpenChange:e=>{e||K()},children:(0,z.jsxs)(d,{children:[(0,z.jsx)(c,{className:`fixed inset-0 z-65 bg-scrim`}),(0,z.jsxs)(f,{onCloseAutoFocus:e=>{e.preventDefault(),g?.isConnected&&g.focus()},onOpenAutoFocus:e=>{e.preventDefault(),h.current?.focus()},style:{height:`min(${ne?760:_?600:440}px, calc(100dvh - 2rem))`},className:`fixed left-1/2 top-1/2 z-66 flex w-[min(42.5rem,calc(100%-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover`,children:[(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between px-5 pb-3 pt-5`,children:[(0,z.jsx)(p,{className:`text-base font-semibold text-fg`,children:_?H?`编辑定时任务`:`Edit scheduled task`:H?`设定定时任务`:`Schedule a task`}),(0,z.jsx)(u,{asChild:!0,children:(0,z.jsx)(M,{variant:`ghost`,disabled:E,"aria-label":H?`关闭`:`Close`,children:(0,z.jsx)(te,{className:`size-4`})})})]}),(0,z.jsx)(l,{className:`sr-only`,children:H?`描述要做的事,选择重复频率和时间。`:`Describe the task and choose its frequency and time.`}),(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pb-3`,children:[_?(0,z.jsx)(`input`,{"aria-label":H?`任务名称`:`Task name`,className:`w-full rounded-xl border border-edge bg-transparent px-4 py-3 text-sm text-fg focus-visible:outline-accent`,value:w.name,onChange:e=>W({name:e.target.value})}):null,(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:H?`要做什么`:`What should happen`}),(0,z.jsx)(`textarea`,{ref:h,"aria-label":H?`任务说明`:`Task description`,placeholder:H?`希望定期帮你做什么?`:`What would you like done regularly?`,className:`block h-32 w-full resize-none rounded-xl border border-edge bg-transparent px-4 py-3 text-sm leading-6 text-fg placeholder:text-fg-subtle focus-visible:outline-accent`,value:w.instruction,onChange:e=>W({instruction:e.target.value})})]}),(0,z.jsxs)(`section`,{"aria-label":H?`运行时间`:`Schedule`,className:`rounded-xl border border-edge px-4`,children:[(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:H?`重复`:`Repeat`}),(0,z.jsxs)(S,{"aria-label":H?`重复`:`Repeat`,className:Z,value:w.triggerMode,onChange:e=>W({triggerMode:e.target.value}),children:[(0,z.jsx)(C,{value:`once`,children:H?`仅一次`:`Once`}),(0,z.jsx)(C,{value:`daily`,children:H?`每天`:`Daily`}),(0,z.jsx)(C,{value:`weekly`,children:H?`每周`:`Weekly`}),(0,z.jsx)(C,{value:`interval`,children:H?`固定间隔`:`At intervals`}),(0,z.jsx)(C,{value:`cron`,children:H?`自定义`:`Custom`}),[`once`,`daily`,`weekly`,`interval`,`cron`].includes(w.triggerMode)?null:(0,z.jsx)(C,{value:w.triggerMode,children:H?`保持当前触发方式`:`Keep current trigger`})]})]}),[`daily`,`weekly`].includes(w.triggerMode)?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:H?`时间`:`Time`}),(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm text-fg-muted`,children:[(0,z.jsx)(`span`,{className:`truncate text-xs`,children:J}),(0,z.jsx)(I,{value:w.time,onChange:e=>W({time:e}),ariaLabel:H?`时间`:`Time`,className:`w-auto`,triggerClassName:`w-auto border-0 bg-transparent px-0 shadow-none`})]})]}):null,w.triggerMode===`weekly`?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:H?`星期`:`Day`}),(0,z.jsx)(S,{"aria-label":H?`星期`:`Day`,className:Z,value:w.weekday,onChange:e=>W({weekday:e.target.value}),children:Object.entries(H?{1:`星期一`,2:`星期二`,3:`星期三`,4:`星期四`,5:`星期五`,6:`星期六`,0:`星期日`}:{1:`Monday`,2:`Tuesday`,3:`Wednesday`,4:`Thursday`,5:`Friday`,6:`Saturday`,0:`Sunday`}).map(([e,t])=>(0,z.jsx)(C,{value:e,children:t},e))})]}):null,w.triggerMode===`once`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:H?`日期`:`Date`}),(0,z.jsx)(F,{ariaLabel:H?`运行日期`:`Run date`,className:`w-auto bg-transparent text-fg-muted`,value:w.onceAt.split(`T`)[0],onChange:e=>W({onceAt:`${e}T${w.onceAt.split(`T`)[1]||w.time}`})})]}),(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`span`,{className:`text-sm text-fg`,children:H?`时间`:`Time`}),(0,z.jsx)(I,{ariaLabel:H?`运行时间`:`Run time`,value:w.onceAt.split(`T`)[1]||w.time,onChange:e=>W({onceAt:`${w.onceAt.split(`T`)[0]}T${e}`}),triggerClassName:`border-0 bg-transparent text-fg-muted shadow-none`})]})]}):null,w.triggerMode===`cron`?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`label`,{htmlFor:`automation-cron`,className:`text-sm text-fg`,children:H?`时间规则`:`Schedule`}),(0,z.jsx)(`input`,{id:`automation-cron`,className:`min-w-0 bg-transparent py-3 text-right text-sm text-fg-muted`,value:w.cronExpr,onChange:e=>W({cronExpr:e.target.value})})]}):null,w.triggerMode===`interval`?(0,z.jsxs)(`div`,{className:X,children:[(0,z.jsx)(`label`,{htmlFor:`automation-interval`,className:`text-sm text-fg`,children:H?`每隔`:`Every`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsx)(`input`,{id:`automation-interval`,type:`number`,min:`1`,"aria-label":H?`间隔数值`:`Interval value`,className:`w-16 bg-transparent text-right text-sm text-fg-muted`,value:w.intervalValue,onChange:e=>W({intervalValue:e.target.value})}),(0,z.jsxs)(S,{"aria-label":H?`间隔单位`:`Interval unit`,className:Z,value:w.intervalUnit,onChange:e=>W({intervalUnit:e.target.value}),children:[(0,z.jsx)(C,{value:`minute`,children:H?`分钟`:`Minutes`}),(0,z.jsx)(C,{value:`hour`,children:H?`小时`:`Hours`}),(0,z.jsx)(C,{value:`day`,children:H?`天`:`Days`}),(0,z.jsx)(C,{value:`week`,children:H?`周`:`Weeks`})]})]})]}):null]}),Y?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,role:`status`,children:Y}):null,w.triggerMode===`once`?(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:H?`按你所在时区输入,换时区后仍在同一时刻运行。`:`Enter your local time. Changing timezone keeps the same instant.`}):null,(0,z.jsxs)(`details`,{className:`group`,onToggle:e=>V(e.currentTarget.open),children:[(0,z.jsxs)(`summary`,{className:`flex w-fit cursor-pointer list-none items-center gap-1 rounded-md px-1 py-2 text-sm text-fg-muted focus-visible:outline-accent`,children:[H?`高级`:`Advanced`,(0,z.jsx)(ee,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,z.jsxs)(`div`,{className:`mt-2 grid gap-4 pb-2`,children:[_?null:(0,z.jsx)(U,{label:H?`任务名称(可选)`:`Task name (optional)`,children:(0,z.jsx)(`input`,{className:$,value:w.name,onChange:e=>W({name:e.target.value}),placeholder:H?`根据说明自动命名`:`Named from your description`})}),(0,z.jsx)(U,{label:H?`时区`:`Timezone`,children:(0,z.jsx)(`input`,{className:$,value:w.timezone??``,placeholder:`Asia/Shanghai`,onChange:e=>W({timezone:e.target.value})})}),(0,z.jsxs)(U,{label:H?`执行助手`:`Run with`,children:[(0,z.jsxs)(S,{"aria-label":H?`执行助手`:`Run with`,className:$,value:w.agentId,onChange:e=>W({agentId:e.target.value}),children:[(0,z.jsx)(C,{value:``,children:H?`默认助手`:`Default assistant`}),w.agentId&&!a?.items.some(e=>e.id===w.agentId)?(0,z.jsx)(C,{value:w.agentId,children:w.agentId}):null,a?.items.map(e=>(0,z.jsx)(C,{value:e.id,children:e.name||e.id},e.id))]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o?H?`暂时无法加载助手,请稍后重试。`:`Could not load assistants. Try again later.`:H?`从下次运行生效,切换时衔接最近的执行结果。`:`Applies to the next run, carrying over the latest result when switching.`})]}),(0,z.jsx)(U,{label:H?`使用模型`:`Model`,children:(0,z.jsx)(P,{value:w.model,onChange:e=>W({model:e}),allowEmpty:!0,placeholder:s(n).automations.form.defaultModel,searchPlaceholder:s(n).automations.form.searchModels,noMatches:s(n).automations.form.noModels,emptyLabel:H?`默认模型`:`Default model`,ariaLabel:H?`使用模型`:`Model`})}),(0,z.jsx)(U,{label:H?`运行上下文`:`Run context`,children:(0,z.jsxs)(S,{className:$,value:w.conversationMode,onChange:e=>W({conversationMode:e.target.value}),children:[(0,z.jsx)(C,{value:`new_session`,children:H?`每次独立运行`:`Independent runs`}),(0,z.jsx)(C,{value:`continuous`,children:H?`延续之前的运行`:`Continue previous runs`})]})}),(0,z.jsx)(U,{label:H?`通知我`:`Notify me`,children:(0,z.jsxs)(S,{className:$,value:w.notificationPolicy,onChange:e=>W({notificationPolicy:e.target.value}),children:[(0,z.jsx)(C,{value:`attention`,children:H?`需要关注时`:`When attention is needed`}),(0,z.jsx)(C,{value:`all`,children:H?`每次完成时`:`After every run`}),(0,z.jsx)(C,{value:`none`,children:H?`不通知`:`Never`})]})})]})]}),O?(0,z.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,z.jsx)(`p`,{children:O}),R?(0,z.jsx)(M,{variant:`secondary`,disabled:E,onClick:()=>void ie(),children:H?`载入最新设置`:`Load latest settings`}):null,(0,z.jsx)(`p`,{children:H?`内容已保留,请核对后重试。`:`Your edits are preserved. Review and retry.`})]}):null]}),(0,z.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 px-5 pb-5 pt-3`,children:[(0,z.jsx)(M,{variant:`ghost`,className:`rounded-full bg-surface-base px-4`,disabled:E,onClick:K,children:H?`取消`:`Cancel`}),(0,z.jsx)(M,{variant:`primary`,className:`rounded-full px-4 disabled:bg-surface-active disabled:text-fg-subtle disabled:opacity-100`,disabled:E||!w.instruction.trim(),onClick:()=>void re(),children:E?H?`保存中…`:`Saving…`:_?H?`保存`:`Save`:H?`创建`:`Create`})]})]})]})})}function ue({automationId:e,runId:t,language:n,inConfiguration:r=!1,embedded:c=!1}){let l=i(),u=o(),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,y]=(0,L.useState)(``),{data:ee,error:S,isLoading:C,mutate:te}=k([`automation-card`,e],()=>N.get(e),{refreshInterval:5e3,shouldRetryOnError:!1}),A=n===`zh`,j=ee?.automation,P=s(n),F=c?void 0:`my-3 rounded-xl border border-edge`;if(C&&!j)return(0,z.jsx)(`div`,{className:D(F,!c&&`p-3`),children:(0,z.jsx)(O,{className:c?`h-11 w-48 max-w-full rounded-[1.125rem]`:`h-12 w-full rounded-lg`})});if(S||!j)return(0,z.jsxs)(`div`,{className:D(F,`p-3 text-sm text-fg-muted`),children:[(0,z.jsx)(`p`,{children:A?`任务已删除或暂时无法读取。`:`This task was deleted or is unavailable.`}),(0,z.jsx)(`button`,{type:`button`,className:`mt-2 underline`,onClick:()=>void te(),children:A?`重试`:`Retry`})]});if(t)return(0,z.jsx)(a,{className:D(c?B:F,!c&&`flex min-h-14 min-w-0 items-center gap-3 px-3 py-2 text-left hover:bg-surface-hover/65 active:bg-surface-active/70 transition-colors duration-150 motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`),"data-product-delivery":`automation`,to:w(`${l.pathname}${l.search}`,`/automations?automation=${encodeURIComponent(j.id)}&view=run&run=${encodeURIComponent(t)}`),children:c?(0,z.jsx)(H,{icon:(0,z.jsx)(g,{}),title:j.name,meta:A?`查看运行情况`:`View run`,trailing:(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(g,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:j.name}),(0,z.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:A?`查看运行情况`:`View run`})]}),(0,z.jsx)(x,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]})});let I=async()=>{m(!0),y(``);try{u(await W({automationId:j.id}))}catch(e){y(e instanceof Error?e.message:String(e))}finally{m(!1)}};return c?(0,z.jsxs)(`details`,{className:`group min-w-0 max-w-full`,"data-product-delivery":`automation`,children:[(0,z.jsx)(`summary`,{className:D(B,`cursor-pointer list-none`),title:j.name,children:(0,z.jsx)(H,{icon:(0,z.jsx)(g,{}),title:j.name,meta:b(j)?A?`已完成`:`Completed`:j.enabled?_(j.trigger,P.automations,P.cron,n):P.automations.paused,trailing:(0,z.jsx)(x,{className:`size-3.5 shrink-0 text-fg-subtle transition-transform group-open:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})})}),(0,z.jsxs)(`div`,{className:V,children:[(0,z.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[_(j.trigger,P.automations,P.cron,n),j.trigger.kind===`schedule`&&j.trigger.schedule.kind===`cron`&&j.trigger.schedule.tz?` · ${j.trigger.schedule.tz}`:``,` · `,b(j)?A?`已完成`:`Completed`:j.enabled?P.automations.enabled:P.automations.paused]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:j.enabled?`${A?`下次:`:`Next: `}${v(j,P.automations,n)}`:b(j)?A?`这项一次性任务已完成`:`This one-time task is complete`:A?`恢复后将按计划运行`:`Resume to run on schedule`}),(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[!j.management&&j.action.kind===`agent`?(0,z.jsxs)(M,{variant:`ghost`,onClick:()=>f(!0),children:[(0,z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),A?`编辑`:`Edit`]}):null,!r&&!j.management&&j.action.kind!==`system`?(0,z.jsxs)(M,{variant:`ghost`,disabled:p,onClick:()=>void I(),children:[(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),A?`继续对话`:`Continue in chat`]}):null,(0,z.jsx)(a,{className:`inline-flex min-h-11 items-center rounded-lg px-3 text-xs text-accent-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,to:`/automations?automation=${encodeURIComponent(j.id)}`,children:A?`打开`:`Open`})]}),[`failed`,`timeout`].includes(j.state.lastRunStatus??``)?(0,z.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:A?`上次运行未完成。可以在对话中说明“帮我修复”,再试运行。`:`The last run did not finish. Ask in chat to fix it, then try again.`}):null,h?(0,z.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:h}):null]}),d?(0,z.jsx)(le,{automation:j,language:n,onClose:()=>f(!1)}):null]}):(0,z.jsxs)(`div`,{className:D(F,`overflow-hidden`,!c&&`bg-surface-panel`),"data-product-delivery":`automation`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-3`,children:[(0,z.jsx)(g,{className:`size-6 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:j.name}),(0,z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[_(j.trigger,P.automations,P.cron,n),j.trigger.kind===`schedule`&&j.trigger.schedule.kind===`cron`&&j.trigger.schedule.tz?` · ${j.trigger.schedule.tz}`:``,` · `,b(j)?A?`已完成`:`Completed`:j.enabled?P.automations.enabled:P.automations.paused]}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:j.enabled?`${A?`下次:`:`Next: `}${v(j,P.automations,n)}`:b(j)?A?`这项一次性任务已完成`:`This one-time task is complete`:A?`恢复后将按计划运行`:`Resume to run on schedule`})]}),!j.management&&j.action.kind===`agent`?(0,z.jsxs)(M,{variant:`ghost`,onClick:()=>f(!0),children:[(0,z.jsx)(E,{className:`size-4`,"aria-hidden":!0}),A?`编辑`:`Edit`]}):null,!r&&!j.management&&j.action.kind!==`system`?(0,z.jsxs)(M,{variant:`ghost`,disabled:p,onClick:()=>void I(),children:[(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),A?`继续对话`:`Continue in chat`]}):null,(0,z.jsx)(a,{className:`rounded-md border border-edge px-3 py-2 text-xs text-fg hover:bg-surface-hover`,to:`/automations?automation=${encodeURIComponent(j.id)}`,children:A?`打开`:`Open`})]}),[`failed`,`timeout`].includes(j.state.lastRunStatus??``)?(0,z.jsx)(`p`,{className:`px-4 pb-3 text-xs text-fg-muted`,children:A?`上次运行未完成。可以在对话中说明“帮我修复”,再试运行。`:`The last run did not finish. Ask in chat to fix it, then try again.`}):null,h?(0,z.jsx)(`p`,{role:`alert`,className:`px-4 pb-3 text-sm text-danger`,children:h}):null,d?(0,z.jsx)(le,{automation:j,language:n,onClose:()=>f(!1)}):null]})}function de(e){let t=(0,R.c)(22),{conversationId:n,language:r,running:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):(a=[`automation-configuration`,n],o=()=>N.configuration(n),t[0]=n,t[1]=a,t[2]=o);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:3e3,shouldRetryOnError:!1},t[3]=s):s=t[3];let{data:c,error:l,mutate:u}=k(a,o,s),d;t[4]!==u||t[5]!==i?(d=()=>{i||(u(),ce())},t[4]=u,t[5]=i,t[6]=d):d=t[6];let f;if(t[7]!==n||t[8]!==u||t[9]!==i?(f=[i,n,u],t[7]=n,t[8]=u,t[9]=i,t[10]=f):f=t[10],(0,L.useEffect)(d,f),l){let e;t[11]===u?e=t[12]:(e=()=>void u(),t[11]=u,t[12]=e);let n=r===`zh`?`任务配置暂时无法读取,点击重试`:`Task configuration unavailable. Retry`,i;return t[13]!==e||t[14]!==n?(i=(0,z.jsx)(`button`,{type:`button`,className:`mb-4 text-sm text-fg-muted underline`,onClick:e,children:n}),t[13]=e,t[14]=n,t[15]=i):i=t[15],i}if(!c){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(O,{className:`mb-4 h-20 rounded-xl`}),t[16]=e):e=t[16],e}if(c.deleted){let e=r===`zh`?`这个定时任务已删除,配置讨论仍可查看。`:`This scheduled task was deleted. Its configuration discussion is preserved.`,n;return t[17]===e?n=t[18]:(n=(0,z.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e}),t[17]=e,t[18]=n),n}let p;return t[19]!==c.automation||t[20]!==r?(p=c.automation?(0,z.jsx)(ue,{automationId:c.automation.id,language:r,inConfiguration:!0}):null,t[19]=c.automation,t[20]=r,t[21]=p):p=t[21],p}function fe({automationId:e,language:t,runId:n,variant:r=`primary`}){let i=o(),[a,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(``),u=async()=>{s(!0),l(``);try{i(await W({automationId:e,runId:n,prompt:n?t===`zh`?`帮我看看这次为什么没有完成,并修复问题。`:`Help me understand why this did not finish and fix the problem.`:void 0}))}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,z.jsxs)(`span`,{children:[(0,z.jsxs)(M,{variant:r,disabled:a,onClick:()=>void u(),children:[(0,z.jsx)(T,{className:`size-4`,"aria-hidden":!0}),n?t===`zh`?`对话修复`:`Fix in chat`:t===`zh`?`继续对话`:`Continue in chat`]}),c?(0,z.jsx)(`span`,{role:`alert`,className:`ml-2 text-xs text-danger`,children:c}):null]})}export{V as _,se as a,Z as c,G as d,X as f,B as g,H as h,ue as i,q as l,U as m,fe as n,Q as o,W as p,le as r,K as s,de as t,ae as u,ne as v};