agent-tower 0.7.2-beta.8 → 0.7.3

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 (284) hide show
  1. package/dist/executors/__tests__/providers.test.js +53 -0
  2. package/dist/executors/__tests__/providers.test.js.map +1 -1
  3. package/dist/executors/providers.d.ts +2 -0
  4. package/dist/executors/providers.d.ts.map +1 -1
  5. package/dist/executors/providers.js +3 -2
  6. package/dist/executors/providers.js.map +1 -1
  7. package/dist/git/base-branch.d.ts +3 -0
  8. package/dist/git/base-branch.d.ts.map +1 -0
  9. package/dist/git/base-branch.js +17 -0
  10. package/dist/git/base-branch.js.map +1 -0
  11. package/dist/mcp/http-client.d.ts +2 -6
  12. package/dist/mcp/http-client.d.ts.map +1 -1
  13. package/dist/mcp/http-client.js.map +1 -1
  14. package/dist/mcp/tools/__tests__/providers.test.d.ts +2 -0
  15. package/dist/mcp/tools/__tests__/providers.test.d.ts.map +1 -0
  16. package/dist/mcp/tools/__tests__/providers.test.js +22 -0
  17. package/dist/mcp/tools/__tests__/providers.test.js.map +1 -0
  18. package/dist/mcp/tools/__tests__/tasks.test.d.ts +2 -0
  19. package/dist/mcp/tools/__tests__/tasks.test.d.ts.map +1 -0
  20. package/dist/mcp/tools/__tests__/tasks.test.js +17 -0
  21. package/dist/mcp/tools/__tests__/tasks.test.js.map +1 -0
  22. package/dist/mcp/tools/providers.d.ts.map +1 -1
  23. package/dist/mcp/tools/providers.js +3 -2
  24. package/dist/mcp/tools/providers.js.map +1 -1
  25. package/dist/mcp/tools/tasks.d.ts.map +1 -1
  26. package/dist/mcp/tools/tasks.js +1 -0
  27. package/dist/mcp/tools/tasks.js.map +1 -1
  28. package/dist/mcp/types.d.ts +3 -0
  29. package/dist/mcp/types.d.ts.map +1 -1
  30. package/dist/mcp/types.js +2 -0
  31. package/dist/mcp/types.js.map +1 -1
  32. package/dist/output/__tests__/text-block-lifecycle.test.js +37 -0
  33. package/dist/output/__tests__/text-block-lifecycle.test.js.map +1 -1
  34. package/dist/output/text-block-tracker.d.ts.map +1 -1
  35. package/dist/output/text-block-tracker.js +24 -1
  36. package/dist/output/text-block-tracker.js.map +1 -1
  37. package/dist/routes/__tests__/providers.test.js +67 -0
  38. package/dist/routes/__tests__/providers.test.js.map +1 -1
  39. package/dist/routes/__tests__/tasks.test.js +23 -0
  40. package/dist/routes/__tests__/tasks.test.js.map +1 -1
  41. package/dist/routes/providers.d.ts.map +1 -1
  42. package/dist/routes/providers.js +8 -0
  43. package/dist/routes/providers.js.map +1 -1
  44. package/dist/routes/tasks.d.ts.map +1 -1
  45. package/dist/routes/tasks.js +1 -0
  46. package/dist/routes/tasks.js.map +1 -1
  47. package/dist/runtime/acp/history-reconciler.js +1 -1
  48. package/dist/runtime/acp/history-reconciler.js.map +1 -1
  49. package/dist/services/__tests__/task.service.test.js +43 -0
  50. package/dist/services/__tests__/task.service.test.js.map +1 -1
  51. package/dist/services/__tests__/translation-protection.test.js +48 -18
  52. package/dist/services/__tests__/translation-protection.test.js.map +1 -1
  53. package/dist/services/__tests__/translation-session-blocks.test.js +66 -2
  54. package/dist/services/__tests__/translation-session-blocks.test.js.map +1 -1
  55. package/dist/services/__tests__/workspace.service.test.js +34 -0
  56. package/dist/services/__tests__/workspace.service.test.js.map +1 -1
  57. package/dist/services/message-delivery.service.d.ts +2 -1
  58. package/dist/services/message-delivery.service.d.ts.map +1 -1
  59. package/dist/services/project.service.d.ts +1 -0
  60. package/dist/services/project.service.d.ts.map +1 -1
  61. package/dist/services/provider-config.service.d.ts.map +1 -1
  62. package/dist/services/provider-config.service.js +1 -0
  63. package/dist/services/provider-config.service.js.map +1 -1
  64. package/dist/services/session-manager.d.ts +7 -4
  65. package/dist/services/session-manager.d.ts.map +1 -1
  66. package/dist/services/session-manager.js +1 -1
  67. package/dist/services/session-manager.js.map +1 -1
  68. package/dist/services/task.service.d.ts +10 -8
  69. package/dist/services/task.service.d.ts.map +1 -1
  70. package/dist/services/task.service.js +14 -1
  71. package/dist/services/task.service.js.map +1 -1
  72. package/dist/services/team-run.service.d.ts +1 -0
  73. package/dist/services/team-run.service.d.ts.map +1 -1
  74. package/dist/services/team-task-input.service.d.ts +1 -0
  75. package/dist/services/team-task-input.service.d.ts.map +1 -1
  76. package/dist/services/translation-protection.d.ts +3 -1
  77. package/dist/services/translation-protection.d.ts.map +1 -1
  78. package/dist/services/translation-protection.js +21 -67
  79. package/dist/services/translation-protection.js.map +1 -1
  80. package/dist/services/translation-settings.service.d.ts +4 -4
  81. package/dist/services/translation.service.d.ts.map +1 -1
  82. package/dist/services/translation.service.js +44 -20
  83. package/dist/services/translation.service.js.map +1 -1
  84. package/dist/services/workspace.service.d.ts +11 -6
  85. package/dist/services/workspace.service.d.ts.map +1 -1
  86. package/dist/services/workspace.service.js +6 -4
  87. package/dist/services/workspace.service.js.map +1 -1
  88. package/dist/utils/database-runtime.test.js +82 -5
  89. package/dist/utils/database-runtime.test.js.map +1 -1
  90. package/dist/utils/index.d.ts.map +1 -1
  91. package/dist/utils/index.js +29 -1
  92. package/dist/utils/index.js.map +1 -1
  93. package/dist/web/assets/{AgentDemoPage-CtCYXopw.js → AgentDemoPage-Dwux6TyV.js} +1 -1
  94. package/dist/web/assets/{AgentEnvironmentSettingsPage-DSWN546Y.js → AgentEnvironmentSettingsPage-CvvkMKT1.js} +1 -1
  95. package/dist/web/assets/AttachmentPreview-CFJ6MZ1f.js +2 -0
  96. package/dist/web/assets/BranchSelect-Cv92vEjG.js +1 -0
  97. package/dist/web/assets/BrandLogo-H4nCbVzs.js +1 -0
  98. package/dist/web/assets/ConversationPage-CZzGME21.js +1 -0
  99. package/dist/web/assets/CreateTaskInput-BM2tx4hJ.js +1 -0
  100. package/dist/web/assets/{DemoPage-Dyn-U9JO.js → DemoPage-CpYNBQhA.js} +1 -1
  101. package/dist/web/assets/DesignSystemPage-DLeH6DnV.js +12 -0
  102. package/dist/web/assets/EditableTaskTitle-BEsiULnD.js +70 -0
  103. package/dist/web/assets/{ExecutionPermissionSelector-CQ_GNxR0.js → ExecutionPermissionSelector-IoWR9YLb.js} +1 -1
  104. package/dist/web/assets/GeneralSettingsPage-BAYgxCqx.js +1 -0
  105. package/dist/web/assets/{LoadingPreviewPage-BlW2PJhI.js → LoadingPreviewPage-CumrzyxW.js} +1 -1
  106. package/dist/web/assets/McpSettingsPage-CFNwxT9Y.js +1 -0
  107. package/dist/web/assets/{MemberAvatar-B2pAdWUi.js → MemberAvatar-BVXD0jTy.js} +1 -1
  108. package/dist/web/assets/{MobileTaskDetail-CvmNW0BQ.js → MobileTaskDetail-IOQ1WnS8.js} +3 -3
  109. package/dist/web/assets/NotificationSettingsPage-B0s5YbG3.js +1 -0
  110. package/dist/web/assets/{ProfileSettingsPage-DMxpHmF1.js → ProfileSettingsPage-BuhoF-mL.js} +1 -1
  111. package/dist/web/assets/{ProjectKanbanPage-CHW79td4.js → ProjectKanbanPage-DMtv15rq.js} +7 -7
  112. package/dist/web/assets/ProjectSettingsPage-DDMg6axy.js +2 -0
  113. package/dist/web/assets/ProviderSettingsPage-DRt9m4mF.js +67 -0
  114. package/dist/web/assets/{SettingsMasterDetail-DnF0lsV1.js → SettingsMasterDetail-D7vStQjR.js} +1 -1
  115. package/dist/web/assets/TaskDetail-DzKbs5Jt.js +1 -0
  116. package/dist/web/assets/TeamSettingsPage-fjlaqaLo.js +1 -0
  117. package/dist/web/assets/{TranslationSettingsPage-D3mazqEW.js → TranslationSettingsPage-D2oks6OM.js} +1 -1
  118. package/dist/web/assets/{arc-hUh7ykl8.js → arc-vYWCZsE_.js} +1 -1
  119. package/dist/web/assets/{architectureDiagram-3BPJPVTR-CcV9CLkm.js → architectureDiagram-3BPJPVTR-Cu1VIpcJ.js} +1 -1
  120. package/dist/web/assets/{at-sign-B-nhoGyH.js → at-sign-BhSPafOS.js} +1 -1
  121. package/dist/web/assets/{blockDiagram-GPEHLZMM-5q3Y9y0e.js → blockDiagram-GPEHLZMM-C4x_nj5S.js} +1 -1
  122. package/dist/web/assets/{c4Diagram-AAUBKEIU-CorBXi06.js → c4Diagram-AAUBKEIU-jHOo5lal.js} +1 -1
  123. package/dist/web/assets/channel-D1cEj22-.js +1 -0
  124. package/dist/web/assets/check-D_VFGpIy.js +1 -0
  125. package/dist/web/assets/{chevron-down-CPnvItQw.js → chevron-down-BoS08pMa.js} +1 -1
  126. package/dist/web/assets/{chevron-up-B8PE5N0G.js → chevron-up-BWtKfdKT.js} +1 -1
  127. package/dist/web/assets/chip-Ck4dqxR3.js +1 -0
  128. package/dist/web/assets/{chunk-2J33WTMH-BUf5B4z4.js → chunk-2J33WTMH-BZcpjmfm.js} +1 -1
  129. package/dist/web/assets/{chunk-4BX2VUAB-CdnOHkro.js → chunk-4BX2VUAB-DZGB3q-I.js} +1 -1
  130. package/dist/web/assets/{chunk-55IACEB6-U7edZDpP.js → chunk-55IACEB6-CcNrOmyy.js} +1 -1
  131. package/dist/web/assets/{chunk-727SXJPM-B64Tuhla.js → chunk-727SXJPM-dWrxio8O.js} +1 -1
  132. package/dist/web/assets/{chunk-AQP2D5EJ-dXfe56jB.js → chunk-AQP2D5EJ-K4gkVzqE.js} +1 -1
  133. package/dist/web/assets/{chunk-FMBD7UC4-DDYbxc1Q.js → chunk-FMBD7UC4-CnHyY4qD.js} +1 -1
  134. package/dist/web/assets/{chunk-ND2GUHAM-BQDGMv0R.js → chunk-ND2GUHAM-CHUmcyDv.js} +1 -1
  135. package/dist/web/assets/{chunk-QZHKN3VN-DB8q4xAj.js → chunk-QZHKN3VN-Bzzjd-Qt.js} +1 -1
  136. package/dist/web/assets/classDiagram-4FO5ZUOK-DIrDMefa.js +1 -0
  137. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DIrDMefa.js +1 -0
  138. package/dist/web/assets/{code-block-OCS4YCEC-BSdICyOa.js → code-block-OCS4YCEC-B2hHBO_G.js} +1 -1
  139. package/dist/web/assets/{confirm-dialog-DxEBZEbV.js → confirm-dialog-CL_1pF4K.js} +1 -1
  140. package/dist/web/assets/content-D0qmHfHK.js +2 -0
  141. package/dist/web/assets/{copy-DyxlXxiU.js → copy-C4WnOY6Y.js} +1 -1
  142. package/dist/web/assets/{cose-bilkent-S5V4N54A-Dx6eMnll.js → cose-bilkent-S5V4N54A-Dcn8tOhb.js} +1 -1
  143. package/dist/web/assets/cssMode-CXBMyfYY.js +1 -0
  144. package/dist/web/assets/{dagre-BM42HDAG-Cxe8pLgD.js → dagre-BM42HDAG-DWBV4UfP.js} +1 -1
  145. package/dist/web/assets/{diagram-2AECGRRQ-RMsswEBe.js → diagram-2AECGRRQ-CnNTJQ3q.js} +1 -1
  146. package/dist/web/assets/{diagram-5GNKFQAL-Bi4E0hzx.js → diagram-5GNKFQAL-DlXJFzDF.js} +1 -1
  147. package/dist/web/assets/{diagram-KO2AKTUF-Mv6CDCyn.js → diagram-KO2AKTUF-DZ22YV4n.js} +1 -1
  148. package/dist/web/assets/{diagram-LMA3HP47-CJ3qKNzK.js → diagram-LMA3HP47-B4pQJjG9.js} +1 -1
  149. package/dist/web/assets/{diagram-OG6HWLK6-D8SBY4ft.js → diagram-OG6HWLK6-DJBLjtgL.js} +1 -1
  150. package/dist/web/assets/dialog-1o8KQWoQ.js +5 -0
  151. package/dist/web/assets/{erDiagram-TEJ5UH35-DwVSCU6X.js → erDiagram-TEJ5UH35-CDsfoJUT.js} +1 -1
  152. package/dist/web/assets/file-6qwbIga1.js +1 -0
  153. package/dist/web/assets/{flowDiagram-I6XJVG4X-CyipYAWd.js → flowDiagram-I6XJVG4X-CuGOAYmY.js} +1 -1
  154. package/dist/web/assets/folder-picker-Cj1VZOZU.js +1 -0
  155. package/dist/web/assets/{freemarker2-DbH_yMCO.js → freemarker2-BG8VyI2V.js} +1 -1
  156. package/dist/web/assets/{ganttDiagram-6RSMTGT7-CsC6Wjt4.js → ganttDiagram-6RSMTGT7-BjrSOqAM.js} +1 -1
  157. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-E5jNbqlq.js → gitGraphDiagram-PVQCEYII-4VVr4F8_.js} +1 -1
  158. package/dist/web/assets/{globe-B2rgTPH3.js → globe-CxeM27yy.js} +1 -1
  159. package/dist/web/assets/handlebars-Ci38FPsA.js +1 -0
  160. package/dist/web/assets/html-5hdYEgVF.js +1 -0
  161. package/dist/web/assets/htmlMode-BzU9qsw0.js +1 -0
  162. package/dist/web/assets/{icon-button-BEMJj_6T.js → icon-button-BmrJtYFC.js} +1 -1
  163. package/dist/web/assets/index-BR3Wg2fS.js +122 -0
  164. package/dist/web/assets/{index-IMdA08Ok.js → index-C1lMEjmZ.js} +1 -1
  165. package/dist/web/assets/{index-C-M0QDqc.js → index-CrKx8Yaz.js} +4 -4
  166. package/dist/web/assets/{index-BYPOXP6w.js → index-DSy5JLC1.js} +1 -1
  167. package/dist/web/assets/{index-CAjqC8pT.js → index-DVdiOmqt.js} +2 -2
  168. package/dist/web/assets/index-DZLg4-xM.css +1 -0
  169. package/dist/web/assets/{index-kr6U6_pi.js → index-Da2mWAtm.js} +1 -1
  170. package/dist/web/assets/{index-CPGzLjEC.js → index-Db28hRe8.js} +1 -1
  171. package/dist/web/assets/{index-DppwrK2G.js → index-cu8sedJH.js} +1 -1
  172. package/dist/web/assets/{index-DNdMmXBr.js → index-hHrknzh7.js} +1 -1
  173. package/dist/web/assets/{infoDiagram-5YYISTIA-5_0wrRXl.js → infoDiagram-5YYISTIA-Cy9ntb6t.js} +1 -1
  174. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-aQujIFZw.js → ishikawaDiagram-YF4QCWOH-D6UiVzRz.js} +1 -1
  175. package/dist/web/assets/javascript-Ib060GQ8.js +1 -0
  176. package/dist/web/assets/{journeyDiagram-JHISSGLW-ClMzHdqI.js → journeyDiagram-JHISSGLW-owdKzZoh.js} +1 -1
  177. package/dist/web/assets/{jsonMode-nHmLVf-n.js → jsonMode-CLmu6gzc.js} +1 -1
  178. package/dist/web/assets/{kanban-definition-UN3LZRKU-BFVlt0tz.js → kanban-definition-UN3LZRKU-v5TBnyp0.js} +1 -1
  179. package/dist/web/assets/{kbd-Bfq5K6Ux.js → kbd-Cl4AzzJp.js} +1 -1
  180. package/dist/web/assets/{key-round-BqsaQdce.js → key-round-CnYjSrCz.js} +1 -1
  181. package/dist/web/assets/{layers-DI4vFJ4F.js → layers-XImbMX-P.js} +1 -1
  182. package/dist/web/assets/{linear-DZ-6PAPS.js → linear-DNlKYt8R.js} +1 -1
  183. package/dist/web/assets/{link-BU4PN723.js → link-DQk-Vapq.js} +1 -1
  184. package/dist/web/assets/liquid-Bc7OSAPR.js +1 -0
  185. package/dist/web/assets/{lspLanguageFeatures-DH4Z8jiM.js → lspLanguageFeatures-DD_y1bZa.js} +1 -1
  186. package/dist/web/assets/mdx-CxJNHHTn.js +1 -0
  187. package/dist/web/assets/{menu-C3uB3M7p.js → menu-DXF6iUsq.js} +1 -1
  188. package/dist/web/assets/{mermaid-NOHMQCX5-BqeX1osS.js → mermaid-NOHMQCX5-CG_LpwAI.js} +59 -59
  189. package/dist/web/assets/{message-square-E5K8E3A-.js → message-square-BviHdb67.js} +1 -1
  190. package/dist/web/assets/{mindmap-definition-RKZ34NQL-C7dea0db.js → mindmap-definition-RKZ34NQL-Bn_rnnGT.js} +1 -1
  191. package/dist/web/assets/{modal-Cz1iIVeD.js → modal-D496f1fE.js} +1 -1
  192. package/dist/web/assets/{monaco-DM3DuGN5.js → monaco-yuGji-2E.js} +3 -3
  193. package/dist/web/assets/{paperclip-COXNce_v.js → paperclip-D9ka2IAB.js} +1 -1
  194. package/dist/web/assets/{pencil-BFc4n44f.js → pencil-isP1rXC-.js} +1 -1
  195. package/dist/web/assets/{people-BaCetIqh.js → people-CbmH8m4i.js} +1 -1
  196. package/dist/web/assets/{pieDiagram-4H26LBE5-2q5medug.js → pieDiagram-4H26LBE5-DIE_f9W_.js} +1 -1
  197. package/dist/web/assets/popover-D8VtO5qF.js +1 -0
  198. package/dist/web/assets/provider-selection-DSu7SCI7.js +1 -0
  199. package/dist/web/assets/python-C0E43gUo.js +1 -0
  200. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DHPEM56s.js → quadrantDiagram-W4KKPZXB-CavFxJCk.js} +1 -1
  201. package/dist/web/assets/razor-xarhYR9V.js +1 -0
  202. package/dist/web/assets/{requirementDiagram-4Y6WPE33-B_KyH7PP.js → requirementDiagram-4Y6WPE33-Dm1FwUUh.js} +1 -1
  203. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-CrqkZAYW.js → sankeyDiagram-5OEKKPKP-qeqcO27M.js} +1 -1
  204. package/dist/web/assets/{search-CkiBPir_.js → search-DOMr5jPS.js} +1 -1
  205. package/dist/web/assets/{select-DJsEG0jq.js → select-Cw5BaOLQ.js} +1 -1
  206. package/dist/web/assets/{select-Br0TAs7A.js → select-CzZNbe1Z.js} +1 -1
  207. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-BRTm1WQA.js → sequenceDiagram-3UESZ5HK-Dqtb3BYG.js} +1 -1
  208. package/dist/web/assets/{server-DYeSE1wn.js → server-u-PC-CcX.js} +1 -1
  209. package/dist/web/assets/{stateDiagram-AJRCARHV-qN49iyR2.js → stateDiagram-AJRCARHV-C_MqF9Fy.js} +1 -1
  210. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BxmbGAhh.js +1 -0
  211. package/dist/web/assets/{textarea-B7vtoRE3.js → textarea-xt2hLb-d.js} +1 -1
  212. package/dist/web/assets/{timeline-definition-PNZ67QCA-BzarcDi3.js → timeline-definition-PNZ67QCA-Bzov6t31.js} +1 -1
  213. package/dist/web/assets/{toggles-jo27o0AH.js → toggles-B6E1UBYN.js} +1 -1
  214. package/dist/web/assets/{tooltip-DbVtCXcO.js → tooltip-C8--8CNX.js} +1 -1
  215. package/dist/web/assets/{track-C0vxnITw.js → track-BeqaPopG.js} +1 -1
  216. package/dist/web/assets/{trash-2-CUM-XX8B.js → trash-2-5jI3_KHh.js} +1 -1
  217. package/dist/web/assets/{tsMode-7D3gqep6.js → tsMode-uT3sMVHt.js} +1 -1
  218. package/dist/web/assets/typescript-Dkdj2ks0.js +1 -0
  219. package/dist/web/assets/{upload-CJ6jVmte.js → upload-DUteazR7.js} +1 -1
  220. package/dist/web/assets/{use-profiles-B0xXAf7Z.js → use-profiles-T3saKiBg.js} +1 -1
  221. package/dist/web/assets/{use-providers-FMSfyTD1.js → use-providers-CQwBj9hp.js} +1 -1
  222. package/dist/web/assets/use-translation-settings-DBzFqP-d.js +1 -0
  223. package/dist/web/assets/useNormalizedLogs-DsdwmfS7.js +1 -0
  224. package/dist/web/assets/useTokenUsage-Drh3v3kx.js +1 -0
  225. package/dist/web/assets/{vennDiagram-CIIHVFJN-B6oZetvf.js → vennDiagram-CIIHVFJN-BqxICvT_.js} +1 -1
  226. package/dist/web/assets/{wardley-L42UT6IY-Bzuhm76f.js → wardley-L42UT6IY-BTdLPFcA.js} +1 -1
  227. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-DaC-FUf5.js → wardleyDiagram-YWT4CUSO-icnFsFn4.js} +1 -1
  228. package/dist/web/assets/xml-BO8gYu0L.js +1 -0
  229. package/dist/web/assets/{xychartDiagram-2RQKCTM6-CCvRIJRL.js → xychartDiagram-2RQKCTM6-BN2_ducK.js} +1 -1
  230. package/dist/web/assets/yaml-DlovbQzw.js +1 -0
  231. package/dist/web/index.html +2 -2
  232. package/node_modules/@agent-tower/shared/dist/translation.d.ts +12 -0
  233. package/node_modules/@agent-tower/shared/dist/translation.d.ts.map +1 -1
  234. package/node_modules/@agent-tower/shared/dist/translation.js +19 -0
  235. package/node_modules/@agent-tower/shared/dist/translation.js.map +1 -1
  236. package/node_modules/@agent-tower/shared/dist/types.d.ts +13 -1
  237. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  238. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  239. package/package.json +1 -1
  240. package/prisma/migrations/20261023000000_add_task_base_branch/migration.sql +2 -0
  241. package/prisma/schema.prisma +1 -0
  242. package/dist/web/assets/AttachmentPreview-DRG5_cfN.js +0 -2
  243. package/dist/web/assets/BranchSelect-Dxs7HnMM.js +0 -1
  244. package/dist/web/assets/BrandLogo-Ilm880Xs.js +0 -1
  245. package/dist/web/assets/ConversationPage-B55Bj_ft.js +0 -1
  246. package/dist/web/assets/CreateTaskInput-CxWPeToI.js +0 -1
  247. package/dist/web/assets/DesignSystemPage-BxypsRUZ.js +0 -12
  248. package/dist/web/assets/EditableTaskTitle-Dh-SmvFW.js +0 -70
  249. package/dist/web/assets/GeneralSettingsPage-CzoejPZP.js +0 -1
  250. package/dist/web/assets/McpSettingsPage-DD7EqD4L.js +0 -1
  251. package/dist/web/assets/NotificationSettingsPage-BIqldIRf.js +0 -1
  252. package/dist/web/assets/ProjectSettingsPage-DKiEUkoa.js +0 -2
  253. package/dist/web/assets/ProviderSettingsPage-DZT7wyE2.js +0 -67
  254. package/dist/web/assets/TaskDetail-D_970BDY.js +0 -1
  255. package/dist/web/assets/TeamSettingsPage-BJIEZ7xL.js +0 -1
  256. package/dist/web/assets/channel-By24WpLg.js +0 -1
  257. package/dist/web/assets/check-DqPSoX0r.js +0 -1
  258. package/dist/web/assets/classDiagram-4FO5ZUOK-DxHoimtR.js +0 -1
  259. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DxHoimtR.js +0 -1
  260. package/dist/web/assets/content-CMUL3HGx.js +0 -2
  261. package/dist/web/assets/cssMode-ZnNWfjZ6.js +0 -1
  262. package/dist/web/assets/dialog-BYdeYC2Y.js +0 -5
  263. package/dist/web/assets/handlebars-C5VY_S-z.js +0 -1
  264. package/dist/web/assets/hooks-Ct0srfV-.js +0 -1
  265. package/dist/web/assets/html-e5uLnAgN.js +0 -1
  266. package/dist/web/assets/htmlMode-BeNiGozX.js +0 -1
  267. package/dist/web/assets/index-0XPZayUU.css +0 -1
  268. package/dist/web/assets/index-Cm6snkmR.js +0 -122
  269. package/dist/web/assets/javascript-D7QVj9jR.js +0 -1
  270. package/dist/web/assets/liquid-BPIyogoj.js +0 -1
  271. package/dist/web/assets/mdx-CI8yO2pV.js +0 -1
  272. package/dist/web/assets/popover-CJCQLoGu.js +0 -1
  273. package/dist/web/assets/python-CSxVPG9p.js +0 -1
  274. package/dist/web/assets/razor-CVoIieeS.js +0 -1
  275. package/dist/web/assets/search-field-CbM2P2KE.js +0 -1
  276. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-B1clBPkJ.js +0 -1
  277. package/dist/web/assets/typescript-CbOVEQNg.js +0 -1
  278. package/dist/web/assets/use-projects-BlTwWxkY.js +0 -1
  279. package/dist/web/assets/use-translation-settings-BOlszecX.js +0 -1
  280. package/dist/web/assets/use-workspaces-DYrEp0Lw.js +0 -1
  281. package/dist/web/assets/useNormalizedLogs-D0N8MJdH.js +0 -1
  282. package/dist/web/assets/useTokenUsage-WB3ZQ25v.js +0 -1
  283. package/dist/web/assets/xml-Cfa9tkdT.js +0 -1
  284. package/dist/web/assets/yaml-C86f7VLL.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{u as I,r as o,v as ue,j as e,X as se,B as R,aQ as me,t as L,i as $,aR as xe,k as J,G as H,n as Q,ai as he,ad as pe,a9 as fe,at as ge}from"./index-BR3Wg2fS.js";import{f as je,g as re,B as ve,h as be,i as ye,j as Ne}from"./BranchSelect-Cv92vEjG.js";import{F as X}from"./file-6qwbIga1.js";import{F as V}from"./popover-D8VtO5qF.js";import{P as ne,T as ke}from"./trash-2-5jI3_KHh.js";import{F as Pe}from"./chip-Ck4dqxR3.js";import{M as Y}from"./modal-D496f1fE.js";import{F as we}from"./folder-picker-Cj1VZOZU.js";import{S as Se}from"./SettingsMasterDetail-D7vStQjR.js";import"./menu-styles-DWynpVVz.js";import"./chevron-down-BoS08pMa.js";import"./check-D_VFGpIy.js";import"./kbd-Cl4AzzJp.js";import"./search-DOMr5jPS.js";import"./index-Da2mWAtm.js";import"./index-DVdiOmqt.js";import"./index-hHrknzh7.js";import"./dialog-1o8KQWoQ.js";function Ce({value:t,onChange:x,repoPath:a,placeholder:b,disabled:i,disabledMessage:c}){const{t:u}=I(),[d,j]=o.useState(""),[m,n]=o.useState([]),[h,p]=o.useState(!1),[f,N]=o.useState(-1),k=o.useRef(null),A=o.useRef(null),D=o.useRef(void 0),q=o.useCallback(async s=>{if(i||!a||!s){n([]),p(!1);return}try{const l=await ue.get("/filesystem/complete",{params:{basePath:a,prefix:s}});n(l.results),p(l.results.length>0),N(-1)}catch{n([]),p(!1)}},[i,a]);o.useEffect(()=>{if(clearTimeout(D.current),!d){n([]),p(!1);return}return D.current=setTimeout(()=>q(d),200),()=>clearTimeout(D.current)},[d,q]),o.useEffect(()=>{const s=l=>{A.current&&!A.current.contains(l.target)&&k.current&&!k.current.contains(l.target)&&p(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(i)return;const l=s.trim();!l||t.includes(l)||(x([...t,l]),j(""),p(!1),k.current?.focus())},S=s=>{i||x(t.filter((l,z)=>z!==s))},F=s=>{i||(s.type==="directory"?(j(s.path),k.current?.focus()):w(s.path))},M=(s,l)=>{i||(l.stopPropagation(),w(s.path.replace(/\/$/,"")))},E=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||i||(h&&m.length>0?s.key==="ArrowDown"?(s.preventDefault(),N(l=>Math.min(l+1,m.length-1))):s.key==="ArrowUp"?(s.preventDefault(),N(l=>Math.max(l-1,-1))):s.key==="Enter"?(s.preventDefault(),f>=0?F(m[f]):w(d)):s.key==="Escape"&&p(!1):s.key==="Enter"&&(s.preventDefault(),w(d)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-border rounded-lg mb-2 divide-y divide-border/60",children:t.map((s,l)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(X,{size:14,className:"text-muted-foreground/70 shrink-0"}):e.jsx(V,{size:14,className:"text-warning shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-foreground/80 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(l),disabled:i,className:"p-0.5 text-muted-foreground hover:text-destructive-ink opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-muted-foreground",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:k,type:"text",value:d,onChange:s=>j(s.target.value),onKeyDown:E,onFocus:()=>{d&&m.length>0&&p(!0)},placeholder:b??u("输入文件路径..."),disabled:i,className:"flex-1 px-3 py-2 border border-border rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-ring/60 disabled:cursor-not-allowed disabled:bg-muted/50 disabled:text-muted-foreground"}),e.jsxs("button",{onClick:()=>w(d),disabled:i||!d.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(ne,{size:14}),e.jsx("span",{children:u("添加")})]})]}),h&&e.jsx("div",{ref:A,className:"absolute z-50 left-0 right-0 mt-1 bg-background border border-border rounded-lg shadow-popover max-h-[200px] overflow-y-auto",children:m.map((s,l)=>e.jsxs("button",{onClick:()=>F(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-accent transition-colors ${l===f?"bg-muted":""}`,children:[s.type==="directory"?e.jsx(V,{size:14,className:"text-warning shrink-0"}):e.jsx(X,{size:14,className:"text-muted-foreground/70 shrink-0"}),e.jsx("span",{className:"font-mono text-foreground/80 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:z=>M(s,z),className:"p-0.5 text-muted-foreground hover:text-success-ink shrink-0",title:u("添加此目录"),children:e.jsx(Pe,{size:14})})]},s.path))})]}),i&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function Re({value:t,onChange:x}){const{t:a}=I(),[b,i]=o.useState(""),[c,u]=o.useState(""),d=()=>{const n=b.trim(),h=c.trim();!n||!h||(x([...t,{name:n,command:h}]),i(""),u(""))},j=n=>{x(t.filter((h,p)=>p!==n))},m=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),d())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-border rounded-lg mb-2 divide-y divide-border/60",children:t.map((n,h)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-foreground/80 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-muted-foreground flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(h),className:"p-0.5 text-muted-foreground hover:text-destructive-ink opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},h))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:b,onChange:n=>i(n.target.value),onKeyDown:m,placeholder:a("名称"),className:"w-28 shrink-0 px-3 py-2 border border-border rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-ring/60"}),e.jsx("input",{type:"text",value:c,onChange:n=>u(n.target.value),onKeyDown:m,placeholder:a("命令"),className:"flex-1 px-3 py-2 border border-border rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-ring/60"}),e.jsxs("button",{onClick:d,disabled:!b.trim()||!c.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(ne,{size:14}),e.jsx("span",{children:a("添加")})]})]})]})}function De({projectId:t}){const{t:x}=I(),a=je(t);return e.jsxs("div",{className:"py-5 first:pt-0 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:x("Default base branch")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:x("New tasks default to this branch. Saved task and workspace bases remain unchanged.")})]}),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>{a.refetch()},disabled:a.isFetching,"aria-label":x("Refresh"),children:e.jsx(me,{size:13,className:a.isFetching?"animate-spin motion-reduce:[animation-duration:2.4s]":""})})]}),a.isPending?e.jsx("p",{className:"text-xs text-muted-foreground",children:x("Loading...")}):a.isError?e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:x("Could not load branches. Refresh to try again.")}):a.data&&e.jsx(Fe,{projectId:t,mainBranch:a.data.mainBranch,branches:a.data.branches,isRefreshing:a.isFetching,onRefresh:()=>{a.refetch()}},`${t}:${a.data.mainBranch}`)]})}function Fe({projectId:t,mainBranch:x,branches:a,isRefreshing:b,onRefresh:i}){const{t:c}=I(),u=o.useId(),[d,j]=o.useState(x),m=re(),n=async()=>{try{await m.mutateAsync({id:t,mainBranch:d}),L.success(c("Default base branch saved"))}catch{}};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{htmlFor:u,className:"block text-xs font-medium",children:c("Default base branch")}),e.jsx(ve,{id:u,label:c("Default base branch"),value:d,branches:a,disabled:m.isPending,isRefreshing:b,onOpen:i,onChange:h=>{j(h),m.reset()}}),m.isError&&e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:c("Could not save the default base branch. Refresh and choose an existing local branch.")}),e.jsx(R,{size:"sm",onClick:()=>{n()},disabled:d===x||!a.includes(d)||m.isPending||b,children:m.isPending?c("Saving"):c("Save default base branch")})]})}function Z(t){return t?t.split(",").map(x=>x.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function He(){const{t}=I(),{data:x,isLoading:a}=be({limit:100,includeArchived:!0}),b=re(),i=ye(),c=Ne(),[u,d]=o.useState(""),[j,m]=o.useState(null),[n,h]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[p,f]=o.useState(!1),[N,k]=o.useState(null),[A,D]=o.useState(!1),[q,w]=o.useState(!1),[S,F]=o.useState(!1),[M,E]=o.useState(!1),[s,l]=o.useState(""),[z,U]=o.useState(!1),C=x?.data??[],y=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),B=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),g=y.find(r=>r.id===u),T=o.useMemo(()=>C.find(r=>r.id===N)??null,[N,C]);if(o.useEffect(()=>{!u&&y.length>0&&d(y[0].id)},[y,u]),o.useEffect(()=>{if(j){y.some(r=>r.id===j)&&(d(j),m(null));return}u&&!y.some(r=>r.id===u)&&(d(y[0]?.id??""),f(!1))},[y,j,u]),o.useEffect(()=>{g&&!p&&h({copyFiles:Z(g.copyFiles),setupScript:g.setupScript??"",quickCommands:ee(g.quickCommands)})},[g,p]),a)return e.jsx($,{className:"max-w-5xl",children:e.jsx(xe,{})});if(C.length===0)return e.jsxs($,{className:"max-w-5xl",children:[e.jsx(J,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const oe=()=>{u&&b.mutate({id:u,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>f(!1)})},ie=r=>{m(null),d(r),f(!1),U(!0)},ae=()=>{g&&(k(g.id),F(!1),E(!1),D(!0))},G=()=>{i.isPending||(D(!1),k(null),F(!1),E(!1))},ce=async()=>{if(N)try{await i.mutateAsync({id:N,deleteRepo:S}),L.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),f(!1),G()}catch{}},le=r=>{const v=B.find(P=>P.id===r);k(r),l(v?.repoDeletedAt?v.repoPath:""),w(!0)},W=()=>{c.isPending||(w(!1),k(null),l(""))},de=async()=>{if(!(!N||T?.repoDeletedAt&&!s.trim()))try{const v=await c.mutateAsync({id:N,repoPath:s.trim()||void 0});L.success(t("项目已恢复"));for(const P of v.warnings)L.warning(P);f(!1),m(v.project.id),d(v.project.id),W()}catch{}},_=T?.name??t("this project"),K=!!T?.repoDeletedAt,O=g?.isGitRepo!==!1&&g?.worktreeReady!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs($,{className:"max-w-5xl",children:[e.jsx(J,{title:t("项目配置")}),y.length===0&&B.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(Se,{items:y,selectedId:u,onSelectItem:ie,getItemId:r=>r.id,mobileShowDetail:z,onMobileBack:()=>U(!1),renderListItem:r=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:Q("h-2 w-2 rounded-full shrink-0",te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:Q("truncate text-[11px] font-mono","text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:B.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:B.length})]}),B.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-xs hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(ge,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:Q("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx(he,{tone:"info",size:"sm",className:"mb-5",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[O&&e.jsx(De,{projectId:r.id},r.id),e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Ce,{value:n.copyFiles,onChange:v=>{h(P=>({...P,copyFiles:v})),f(!0)},repoPath:r.repoPath,disabled:!O,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:v=>{h(P=>({...P,setupScript:v.target.value})),f(!0)},placeholder:`pnpm install
2
+ pnpm run setup`,rows:4,disabled:!O,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!O&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(Re,{value:n.quickCommands,onChange:v=>{h(P=>({...P,quickCommands:v})),f(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(pe,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(R,{size:"sm",variant:"destructive",className:"shrink-0",onClick:ae,disabled:i.isPending||c.isPending,children:[e.jsx(ke,{size:13}),t("删除项目")]})]})}),p&&e.jsx(fe,{saving:b.isPending,onSave:oe,onCancel:()=>{g&&h({copyFiles:Z(g.copyFiles),setupScript:g.setupScript??"",quickCommands:ee(g.quickCommands)}),f(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:y.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(Y,{isOpen:A,onClose:G,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"outline",onClick:G,disabled:i.isPending,children:t("Cancel")}),e.jsx(R,{variant:"destructive",onClick:ce,disabled:i.isPending||S&&!M,children:i.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:_})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{F(r.target.checked),r.target.checked||E(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive-ink",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>E(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),i.isError&&e.jsx("p",{className:"text-xs text-destructive-ink",children:i.error instanceof Error?i.error.message:t("Failed to delete project")})]})}),e.jsx(Y,{isOpen:q,onClose:W,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"outline",onClick:W,disabled:c.isPending,children:t("Cancel")}),e.jsx(R,{onClick:de,disabled:c.isPending||K&&!s.trim(),children:c.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:K?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:_}):t("恢复后,项目会重新出现在默认项目列表中。")}),K&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(we,{value:s,onChange:l,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),c.isError&&e.jsx("p",{className:"text-xs text-destructive-ink",children:c.error instanceof Error?c.error.message:t("Failed to restore project")})]})})]})}export{He as ProjectSettingsPage};
@@ -0,0 +1,67 @@
1
+ import{c as dt,o as ct,s as mt,v as ut,u as J,r as y,j as e,n as D,a8 as Fe,ad as Ce,b0 as X,b1 as E,b2 as fe,I as ne,b3 as xt,b4 as pt,Z as le,B as A,a2 as ft,i as Oe,aR as gt,k as ht,b5 as vt,G as bt,b6 as jt,b7 as yt,t as U,at as Nt,m as pe,b8 as wt,az as ye}from"./index-BR3Wg2fS.js";import{c as Pt,b as Ct,r as Je,d as De,u as kt,e as Et,E as St,f as It,s as At,i as Re,h as Ue,a as $e,j as Ne,k as Tt,l as _t,m as Ot,p as Dt,n as Rt,o as Ut,q as Le,w as Lt,t as Kt}from"./ExecutionPermissionSelector-IoWR9YLb.js";import{a as Mt,b as Bt,u as zt,c as Ft,d as Jt,e as $t,f as qt,g as Gt,h as Wt}from"./use-providers-CQwBj9hp.js";import{C as Xt}from"./confirm-dialog-CL_1pF4K.js";import{M as ke}from"./modal-D496f1fE.js";import{S as Ke}from"./select-CzZNbe1Z.js";import{T as Me}from"./textarea-xt2hLb-d.js";import{S as Ee}from"./toggles-B6E1UBYN.js";import"./mermaid-NOHMQCX5-CG_LpwAI.js";import"./AttachmentPreview-CFJ6MZ1f.js";import{C as qe}from"./chevron-down-BoS08pMa.js";import{S as Vt}from"./SettingsMasterDetail-D7vStQjR.js";import{K as Yt}from"./key-round-CnYjSrCz.js";import{T as Ge,P as we}from"./trash-2-5jI3_KHh.js";import{U as Ht}from"./upload-DUteazR7.js";import{P as Zt}from"./pencil-isP1rXC-.js";import"./check-D_VFGpIy.js";import"./dialog-1o8KQWoQ.js";import"./index-DVdiOmqt.js";import"./select-Cw5BaOLQ.js";import"./menu-styles-DWynpVVz.js";import"./index-DSy5JLC1.js";import"./index-hHrknzh7.js";import"./index-C1lMEjmZ.js";import"./index-cu8sedJH.js";import"./index-Db28hRe8.js";import"./use-translation-settings-DBzFqP-d.js";import"./copy-C4WnOY6Y.js";import"./index-Da2mWAtm.js";import"./tooltip-C8--8CNX.js";import"./kbd-Cl4AzzJp.js";const Qt=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],es=dt("flask-conical",Qt);function ts(){return ct({queryKey:mt.system.cursorAgentModels,queryFn:()=>ut.get("/system/cursor-agent-models"),staleTime:1e3*60*10})}function ss({value:t,onChange:i}){const{t:a}=J(),{data:p,isLoading:f,isError:x}=ts(),s=p?.models??[],[S,r]=y.useState(!1),[j,P]=y.useState(""),b=y.useMemo(()=>{const g=j.trim().toLowerCase();return g?s.filter(u=>u.id.toLowerCase().includes(g)||u.label.toLowerCase().includes(g)):s},[s,j]);return e.jsxs("div",{className:"flex flex-col gap-2 flex-1 min-w-0",children:[e.jsx("input",{type:"text",value:t,onChange:g=>{const u=g.target.value;i(u===""?void 0:u)},placeholder:a("留空为 auto;或直接输入模型 ID(与 cursor-agent --model 一致)"),className:"w-full px-3 py-1.5 text-sm border border-border rounded focus:outline-none focus:ring-1 focus:ring-ring/60 font-mono"}),e.jsxs("button",{type:"button",onClick:()=>r(g=>!g),disabled:f,className:"flex items-center gap-1 text-xs text-foreground/70 hover:text-foreground disabled:opacity-50 w-fit",children:[e.jsx(qe,{size:14,className:D("transition-transform",S&&"rotate-180")}),f?a("正在加载 cursor-agent 模型列表…"):S?a("收起列表"):a("从本机 cursor-agent 选择({count} 个)",{count:s.length})]}),S&&!f&&e.jsxs("div",{className:"rounded-lg border border-border bg-background shadow-raised overflow-hidden",children:[e.jsx("input",{type:"text",value:j,onChange:g=>P(g.target.value),placeholder:a("筛选模型…"),className:"w-full px-3 py-2 text-sm border-b border-border/60 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-ring/60"}),e.jsxs("div",{className:"max-h-[min(50vh,22rem)] overflow-y-auto py-1",children:[e.jsx("button",{type:"button",onClick:()=>{i(void 0),r(!1),P("")},className:D("w-full px-3 py-2 text-left text-sm hover:bg-accent",t?"text-foreground/80":"bg-muted/50 font-medium"),children:a("默认 (auto)")}),b.map(g=>e.jsxs("button",{type:"button",onClick:()=>{i(g.id),r(!1),P("")},className:D("w-full px-3 py-2 text-left text-sm hover:bg-accent border-t border-border/60",t===g.id?"bg-foreground/[0.06]":""),children:[e.jsx("div",{className:"font-mono text-xs text-foreground break-all",children:g.id}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-words",children:g.label})]},g.id)),b.length===0&&e.jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground text-center",children:a("无匹配项")})]})]}),(x||p?.error)&&e.jsxs("p",{className:"text-xs text-warning-ink",children:[a("无法从本机加载模型列表({error})。仍可手动输入;或在安装 cursor-agent 的机器上运行",{error:p?.error??a("请求失败")}),e.jsx("code",{className:"mx-0.5 bg-muted px-1 rounded text-[11px]",children:"cursor-agent --list-models"}),a("查看 ID。")]})]})}function ns(t){if(!t)return null;try{const i=new URL(t);return i.protocol!=="http:"&&i.protocol!=="https:"?null:`${i.origin}${i.pathname}`}catch{return null}}function rs(t,i){if(!t)return null;const a=new Date(t);return Number.isNaN(a.getTime())?null:new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"medium"}).format(a)}function is({result:t}){const{locale:i,t:a}=J(),p=ns(t.target?.endpoint),f=rs(t.testedAt,i);return e.jsx("div",{"data-provider-test-result":!0,className:D("rounded-lg border px-4 py-3 text-sm",t.ok?"border-success/30 bg-success/10 text-success-ink":"border-warning/30 bg-warning/10 text-foreground"),children:e.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[t.ok?e.jsx(Fe,{size:16,className:"shrink-0"}):e.jsx(Ce,{size:16,className:"shrink-0 text-warning"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-medium",children:t.ok?t.stage==="connection"?a("连接测试通过"):a("本机可用性检查通过"):a("配置检查未通过")}),e.jsx("div",{className:"mt-0.5 break-words text-xs opacity-80",children:t.summary}),(p||f)&&e.jsxs("dl",{className:"mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1 text-xs opacity-80",children:[p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"font-medium",children:a("测试对象")}),e.jsx("dd",{className:"min-w-0",children:e.jsx("code",{className:"break-all",children:p})})]}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"font-medium",children:a("测试时间")}),e.jsx("dd",{className:"min-w-0 break-words",children:e.jsx("time",{dateTime:t.testedAt,children:f})})]})]}),!t.ok&&e.jsx("div",{className:"mt-1 text-xs opacity-80",children:a("测试失败不会阻止保存。")})]})]})})}function as({options:t,value:i,onChange:a,label:p,efficiencyLabel:f,intelligenceLabel:x,followCliLabel:s,currentLabel:S,disabled:r=!1,error:j}){const P=t.findIndex(h=>h.value===i),b=i==="",g=y.useRef(P>=0?i:void 0),u=y.useRef(null),C=y.useRef(null),[M,F]=y.useState(!1);y.useEffect(()=>{P>=0&&(g.current=i)},[P,i]);const $=h=>{if(r||b||t.length===0)return;const k=t[Math.max(0,Math.min(t.length-1,h))];k&&k.value!==i&&a(k.value)},V=h=>{const k=C.current?.getBoundingClientRect();if(!k||k.width<=0)return;const q=Math.max(0,Math.min(1,(h-k.left)/k.width));$(Math.round(q*(t.length-1)))},L=P>=0?t[P]:void 0,K=P<0||t.length<2?0:P/(t.length-1)*100,R=y.useId(),Y=`${R}-label`,T=`${R}-current`,O=`${R}-error`;return e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs("div",{className:"flex min-h-8 items-center justify-between gap-3",children:[e.jsx("label",{id:Y,className:"text-xs font-medium text-foreground",children:p}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e.jsx(Ee,{checked:b,disabled:r,onCheckedChange:h=>{a(h?"":g.current??t.find(k=>k.value==="medium")?.value??t[0]?.value??"")},"aria-label":s})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground","aria-hidden":"true",children:[e.jsx("span",{children:f}),e.jsx("span",{children:x})]}),e.jsxs("div",{id:R,ref:C,role:"slider",tabIndex:b||r?-1:0,"aria-labelledby":Y,"aria-disabled":b||r,"aria-valuemin":0,"aria-valuemax":Math.max(0,t.length-1),"aria-valuenow":P>=0?P:void 0,"aria-valuetext":L?`${L.label}, ${L.value}`:s,"aria-describedby":j?`${T} ${O}`:T,onKeyDown:h=>{if(b||r||P<0)return;let k=P;if(h.key==="ArrowLeft"||h.key==="ArrowDown")k-=1;else if(h.key==="ArrowRight"||h.key==="ArrowUp")k+=1;else if(h.key==="Home")k=0;else if(h.key==="End")k=t.length-1;else return;h.preventDefault(),$(k)},onPointerDown:h=>{b||r||(u.current=h.pointerId,F(!0),h.currentTarget.setPointerCapture?.(h.pointerId),V(h.clientX))},onPointerMove:h=>{u.current===h.pointerId&&V(h.clientX)},onPointerUp:h=>{u.current===h.pointerId&&(u.current=null,F(!1),h.currentTarget.releasePointerCapture?.(h.pointerId))},onPointerCancel:()=>{u.current=null,F(!1)},className:D("relative mx-2.5 flex h-11 touch-pan-y items-center outline-none select-none",b||r?"cursor-not-allowed opacity-55":"cursor-pointer","focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2"),children:[e.jsx("div",{className:"absolute inset-x-0 h-1 rounded-full bg-border"}),!b&&e.jsx("div",{className:"absolute left-0 h-1 rounded-full bg-primary transition-[width] duration-150 motion-reduce:transition-none",style:{width:`${K}%`}}),t.map((h,k)=>e.jsx("span",{"aria-hidden":"true",className:D("absolute size-3 -translate-x-1/2 rounded-full border-2 transition-colors motion-reduce:transition-none",!b&&k<=P?"border-primary bg-primary":"border-border bg-background"),style:{left:`${t.length<2?0:k/(t.length-1)*100}%`}},h.value)),!b&&L&&e.jsx("span",{"aria-hidden":"true",className:D("absolute size-5 -translate-x-1/2 rounded-full border-[5px] border-primary bg-background shadow-raised transition-[left,transform] duration-150 motion-reduce:transition-none",M&&"scale-110"),style:{left:`${K}%`}})]}),e.jsx("div",{id:T,className:"min-h-5 text-center text-xs text-muted-foreground",children:b?s:`${S}: ${L?.label??i} (${L?.value??i})`}),j&&e.jsx("p",{id:O,role:"alert",className:"text-xs text-destructive-ink",children:j})]})}const z={key:"appendPrompt",label:"追加 Prompt",type:"textarea",rows:3,placeholder:"追加到每次 prompt 末尾的文本"},We={[E.CLAUDE_CODE]:[{key:"dangerouslySkipPermissions",label:"跳过权限确认",type:"switch"},z],[E.GEMINI_CLI]:[{key:"yolo",label:"自动批准操作(YOLO)",type:"switch"},z],[E.CURSOR_AGENT]:[{key:"force",label:"强制执行",type:"switch"},z],[E.CODEX]:[{key:"dangerouslyBypassApprovalsAndSandbox",label:"跳过所有确认和沙盒",type:"switch"},{key:"fastMode",label:"Fast 模式",type:"switch"},{key:"disableResponsesWebsocket",label:"禁用 WebSocket",type:"switch"},{key:"profile",label:"Profile",type:"input",placeholder:"~/.codex/config.toml 中的 profile 名称"},z],[E.QWEN_CODE]:[z],[E.KIRO_CLI]:[{key:"trustAllTools",label:"信任所有工具",type:"switch"},z],[E.OPENCODE]:[{key:"autoApprove",label:"自动批准操作",type:"switch"},z],[E.PI_CODING_AGENT]:[{key:"autoApprove",label:"自动批准操作",type:"switch"},{key:"supportsImages",label:"模型支持图片输入",type:"switch"},z],[E.GROK_BUILD]:[{key:"alwaysApprove",label:"始终批准操作",type:"switch"},z],[E.MINION_CODE]:[{key:"dangerouslySkipPermissions",label:"跳过权限确认",type:"switch"},z]};function Be(){return{}}function Xe(t,i){return{...i}}const os=JSON.stringify({env:{ANTHROPIC_API_KEY:"",ANTHROPIC_BASE_URL:""}},null,2),ls=`# Codex config.toml 配置片段 — 通过 -c 参数注入,不会修改 ~/.codex/config.toml
2
+ # 参考: https://developers.openai.com/codex/config-sample
3
+
4
+ # ─── 模型与推理 ─────────────────────────────────────────────
5
+ # model_reasoning_effort = "medium" # minimal | low | medium | high | xhigh | max | ultra
6
+ # model_reasoning_summary = "auto" # auto | concise | detailed | none
7
+ # model_verbosity = "medium" # low | medium | high
8
+ # service_tier = "fast"
9
+ # features.fast_mode = true
10
+
11
+ # ─── 自定义 Model Provider ──────────────────────────────────
12
+ # model_provider = "azure"
13
+ #
14
+ # [model_providers.azure]
15
+ # name = "Azure OpenAI"
16
+ # base_url = "https://YOUR_PROJECT.openai.azure.com/openai"
17
+ # env_key = "AZURE_OPENAI_API_KEY"
18
+ # env_key_instructions = "Set AZURE_OPENAI_API_KEY in Provider env"
19
+ # wire_api = "responses"
20
+ # query_params = { api-version = "2025-04-01-preview" }
21
+
22
+ # ─── OpenAI 数据驻留 ────────────────────────────────────────
23
+ # [model_providers.openai-us]
24
+ # name = "OpenAI US"
25
+ # base_url = "https://us.api.openai.com/v1"
26
+ # wire_api = "responses"
27
+ # requires_openai_auth = true
28
+
29
+ # ─── 本地 OSS (Ollama) ──────────────────────────────────────
30
+ # [model_providers.ollama]
31
+ # name = "Ollama"
32
+ # base_url = "http://localhost:11434/v1"
33
+ # wire_api = "responses"
34
+ `,ds=`# Codex config.toml snippet — injected through -c; ~/.codex/config.toml is not modified.
35
+ # Reference: https://developers.openai.com/codex/config-sample
36
+
37
+ # ─── Model and reasoning ────────────────────────────────────
38
+ # model_reasoning_effort = "medium" # minimal | low | medium | high | xhigh | max | ultra
39
+ # model_reasoning_summary = "auto" # auto | concise | detailed | none
40
+ # model_verbosity = "medium" # low | medium | high
41
+ # service_tier = "fast"
42
+ # features.fast_mode = true
43
+
44
+ # ─── Custom Model Provider ──────────────────────────────────
45
+ # model_provider = "azure"
46
+ #
47
+ # [model_providers.azure]
48
+ # name = "Azure OpenAI"
49
+ # base_url = "https://YOUR_PROJECT.openai.azure.com/openai"
50
+ # env_key = "AZURE_OPENAI_API_KEY"
51
+ # env_key_instructions = "Set AZURE_OPENAI_API_KEY in Provider env"
52
+ # wire_api = "responses"
53
+ # query_params = { api-version = "2025-04-01-preview" }
54
+
55
+ # ─── OpenAI data residency ──────────────────────────────────
56
+ # [model_providers.openai-us]
57
+ # name = "OpenAI US"
58
+ # base_url = "https://us.api.openai.com/v1"
59
+ # wire_api = "responses"
60
+ # requires_openai_auth = true
61
+
62
+ # ─── Local OSS (Ollama) ─────────────────────────────────────
63
+ # [model_providers.ollama]
64
+ # name = "Ollama"
65
+ # base_url = "http://localhost:11434/v1"
66
+ # wire_api = "responses"
67
+ `;function cs(t,i){return t===E.CLAUDE_CODE?os:t===E.CODEX?i==="zh-CN"?ls:ds:""}function ms(t){return t===E.CLAUDE_CODE||t===E.CODEX}const Pe="::ACP";function ze(t,i){return i===X.ACP?`${t}${Pe}`:String(t)}function de(t,i){const a=yt(t);return i===X.ACP?`${a} (ACP)`:a}function us(t){return t.endsWith(Pe)?{agentType:t.slice(0,-Pe.length),runtimeType:X.ACP}:{agentType:t,runtimeType:X.CLI}}function xs(t,i){if(!t.trim())return t;try{const a=JSON.parse(t);if(!a.env||typeof a.env!="object"||Array.isArray(a.env))return t;const p=a.env;return i in p?(delete p[i],JSON.stringify(a,null,2)):t}catch{return t}}const Ve=Object.values(We).flat().reduce((t,i)=>(t[i.key]||(t[i.key]=i.label),t),{});Ve.permissionMode="权限策略";const Ye=Object.values(We).flat().reduce((t,i)=>(i.options&&(t[i.key]=Object.fromEntries(i.options.map(a=>[a.value,a.label]))),t),{});Ye.permissionMode={ASK:"每次询问",AUTO_APPROVE:"无限制",UNRESTRICTED:"无限制"};function ps(t,i){if(typeof i=="boolean")return i?ye("是"):ye("否");if(typeof i=="string"&&i){const a=Ye[t]?.[i];return a?ye(a):i}return String(i)}function W(t,i){return t instanceof Error?t.message:i}function fs(t){return t==="apiBaseUrl"?"API 地址":t==="apiKey"?"API Key":t==="reasoningEffort"?"思考强度":t==="model"?"模型":t==="executionPermission"?"执行权限":t==="fastMode"?"Fast 模式":t==="disableResponsesWebsocket"?"禁用 WebSocket":t}function gs(t){return{minimal:"最低",low:"低",medium:"中",high:"高",xhigh:"超高",max:"最高",ultra:"Ultra"}[t]??t}function hs(t){return`agent-tower-provider-backup-${t.replace(/[:.]/g,"-")}.json`}function vs(t,i){const a=new Blob([JSON.stringify(i,null,2)],{type:"application/json"}),p=URL.createObjectURL(a),f=document.createElement("a");f.href=p,f.download=t,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(p)}function bs(t){switch(t){case"CREATE":return{label:"新增",className:"bg-success/10 text-success-ink"};case"OVERWRITE":return{label:"覆盖",className:"bg-warning/10 text-warning-ink"};case"SKIP":return{label:"跳过",className:"bg-muted text-muted-foreground"}}}function js({issue:t,disabled:i=!1}){const{t:a}=J(),p=!i&&!t,f=a(i?"已禁用":p?"可用":"不可用");return e.jsx("span",{className:D("inline-block h-2 w-2 rounded-full shrink-0",p?"bg-success":"bg-border"),title:i?f:t?`${f}: ${a(t)}`:f,children:e.jsx("span",{className:"sr-only",children:f})})}function ys({issue:t,disabled:i=!1}){const{t:a}=J();return!i&&!t?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-xs font-medium text-success-ink",children:[e.jsx(Fe,{size:11,"aria-hidden":"true"}),a("可用")]}):e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:[e.jsx(wt,{size:11,"aria-hidden":"true"}),a(i?"已禁用":"不可用")]})}function Ns({title:t,status:i,defaultOpen:a=!1,children:p}){const[f,x]=y.useState(a);return e.jsxs("div",{className:"rounded-lg border border-border",children:[e.jsxs("button",{type:"button",onClick:()=>x(s=>!s),"aria-expanded":f,className:"w-full flex items-center justify-between rounded-lg px-4 py-2.5 text-sm font-medium text-foreground transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-inset",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{children:t}),i]}),e.jsx(qe,{size:14,"aria-hidden":"true",className:D("text-muted-foreground transition-transform motion-reduce:transition-none",f&&"rotate-180")})]}),f&&e.jsx("div",{className:"px-4 pb-4 space-y-3",children:p})]})}function ws({isOpen:t,onClose:i,providerId:a,initialData:p,onSave:f}){const{locale:x,t:s}=J(),S=Mt(),[r,j]=y.useState(p??{name:"",agentType:E.CLAUDE_CODE,runtimeType:X.CLI,executionPermission:"ASK",config:Be(),settings:"",env:[],simplified:{apiKey:{configured:!1,envKey:"ANTHROPIC_API_KEY"}},diagnostics:[],isDefault:!1}),[P,b]=y.useState(()=>JSON.stringify(r.config,null,2)),[g,u]=y.useState(""),[C,M]=y.useState(()=>r.diagnostics?.find(n=>n.field==="settings")?.message??""),[F,$]=y.useState(!1),[V,L]=y.useState(!1),[K,R]=y.useState(null),[Y,T]=y.useState(()=>new Set),[O,h]=y.useState(()=>r.diagnostics?.filter(n=>n.code==="CONFLICT")??[]),[k,q]=y.useState({}),Q=y.useRef(Pt()),{data:ge}=Bt(r.agentType,r.simplified.model,{providerId:a,runtimeType:r.runtimeType,config:r.config,settings:r.settings}),N=ge?.[r.agentType]??fe[r.agentType],B=N.apiBaseUrl?Ct(r.simplified.apiBaseUrl):null,re=Je(r),ee=r.executionPermission??re.mode,ie=N.executionPermissionOptions?.[r.runtimeType],ce=ie?.find(n=>n.mode===ee),H=re.diagnostics[0]?.message??(ie?ce?.selectable?null:ce?.reasons[0]?.message??s("This Agent has no available execution permission mode."):s("Loading permission support…")),Z=N.disableResponsesWebsocket,d=Z?De(r.config,Z):null,m=N.fastMode,I=m?De(r.config,m):null,G=m?r.config[m.path]:void 0,He=G===!0?"fast":G===!1?"standard":"inherit",he=r.simplified.reasoningEffort??"",me=he&&!N.reasoningEffort?.options?.includes(he)?s("请选择当前 Agent 支持的思考强度档位"):null,ve=n=>{Q.current.invalidate(),n&&j(n),L(!0),R(null)},_=n=>{ve(n)},Se=()=>{V&&!window.confirm(s("存在未保存的修改,确定放弃吗?"))||i()},Ze=n=>r.env.find(o=>Ne(o.key,n)),ae=(n,o,l="")=>{if(o.action!=="keep"){const c=n===N.apiBaseUrl?.path?"apiBaseUrl":n===N.apiKey?.path?"apiKey":null;c&&q(v=>{const w={...v};return delete w[c],w})}_(c=>{const v=c.env.findIndex(lt=>Ne(lt.key,n)),w=[...c.env],se=v>=0?w[v]:null,oe={key:se?.key??n,value:l,write:o,configured:se?.configured??!1,sensitive:Ne(n,c.simplified.apiKey?.envKey)||!!se?.sensitive||/key|token|secret|password|auth/i.test(n)};v>=0?w[v]=oe:w.push(oe);const ot=c.agentType===E.CLAUDE_CODE&&o.action!=="keep"&&(n===N.apiBaseUrl?.path||n===N.apiKey?.path);return{...c,env:w,settings:ot?xs(c.settings,n):c.settings}})},ue=(n,o)=>{q(l=>{if(!(n in l))return l;const c={...l};return delete c[n],c}),T(l=>new Set(l).add(n)),n==="apiBaseUrl"&&N.apiBaseUrl?.kind==="env"&&ae(N.apiBaseUrl.path,o?{action:"replace",value:o}:{action:"clear"},o),_(l=>{const c=Ut(l,n,o,N);return c.config!==l.config&&b(JSON.stringify(c.config,null,2)),c})},Qe=n=>{Z&&_(o=>{const l=Le(o,Z,n);return b(JSON.stringify(l.config,null,2)),l})},et=n=>{m&&_(o=>{const l=Le(o,m,n==="inherit"?void 0:n==="fast");return b(JSON.stringify(l.config,null,2)),l})},tt=n=>{if(V&&!window.confirm(s("切换 Agent 类型会清空当前类型的配置,是否继续?")))return;const{agentType:o,runtimeType:l}=us(n),c=fe[o],v=Be(),w={...r,agentType:o,runtimeType:l,executionPermission:ee,executionPermissionReviewRequired:void 0,config:v,settings:"",env:[],simplified:{apiKey:c.apiKey?{configured:!1,envKey:c.apiKey.path}:void 0}};ve(()=>w),b(JSON.stringify(v,null,2)),u(""),M(""),$(!1),T(new Set),h([]),q({})},Ie=(n=!1)=>{let o=!g&&!H&&!I?.error&&!d?.error&&!me;const l=r.settings.trim();if(l&&(F||n))try{if(r.agentType===E.CODEX)Dt(l);else if(r.agentType===E.CLAUDE_CODE){const c=JSON.parse(l);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(s("JSON 顶层必须是对象"))}M("")}catch(c){M(s("{format} 语法错误: {message}",{format:r.agentType===E.CODEX?"TOML":"JSON",message:c instanceof Error?c.message:String(c)})),o=!1}return o},Ae=()=>{const n=Rt(r.env),o=Object.fromEntries([...Y].map(l=>[l,r.simplified[l]]));return{providerId:a,name:r.name,agentType:r.agentType,runtimeType:r.runtimeType,executionPermission:ee,env:n,config:r.config,settings:r.settings,simplified:Y.size>0?o:void 0,conflictResolutions:k,isDefault:r.isDefault}},st=()=>{if(B||!Ie(!1))return;const o={...Ae()};delete o.providerId,a&&delete o.runtimeType,f(o)},nt=()=>{if(B||O.length>0||!Ie(!0))return;const n=Q.current.begin();R(null),S.mutate(Ae(),{onSuccess:o=>{Q.current.isCurrent(n)&&R(o)},onError:o=>{Q.current.isCurrent(n)&&R({ok:!1,stage:"connection",errorKind:"unknown",summary:W(o,s("测试配置失败"))})}})};if(!t)return null;const rt=ms(r.agentType),xe=r.agentType===E.CODEX,be=xe&&kt(r.settings),te=r.simplified.apiKey?.envKey??N.apiKey?.path,je=te?Ze(te):void 0,Te=Et(je,!!r.simplified.apiKey?.configured,k.apiKey),it=Te==="advanced",_e=Te!=="unconfigured",at=!r.name.trim()||!!B||!!g||!!H||!!I?.error||!!d?.error||!!me||!!C&&F||O.length>0;return e.jsx(e.Fragment,{children:e.jsx(ke,{isOpen:t,onClose:Se,title:s(p?"编辑 Provider":"新建 Provider"),className:"max-w-3xl",action:e.jsxs("div",{className:"flex w-full flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs(A,{variant:"outline",onClick:nt,disabled:S.isPending||!!B||!!g||!!H||!!I?.error||!!d?.error||!!me||!!C&&F||O.length>0,children:[S.isPending?e.jsx(ft,{className:"animate-spin motion-reduce:[animation-duration:2.4s]"}):e.jsx(es,{}),S.isPending?s("测试中..."):s("测试配置")]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(A,{variant:"outline",onClick:Se,children:s("取消")}),e.jsx(A,{onClick:st,disabled:at,children:s("保存 Provider")})]})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"provider-name",className:"mb-1 block text-xs font-medium text-foreground",children:s("名称")}),e.jsx(ne,{id:"provider-name",value:r.name,onChange:n=>_(o=>({...o,name:n.target.value})),placeholder:s("例如: Claude Code (官方)")})]}),!p&&e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-foreground",children:s("Agent 类型")}),e.jsx(Ke,{value:ze(r.agentType,r.runtimeType),onChange:tt,options:xt.flatMap(n=>pt[n].map(o=>({value:ze(n,o),label:de(n,o),icon:e.jsx(le,{agentType:n,className:"size-4"})}))),placeholder:s("选择 Agent 类型")})]}),p&&e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-foreground",children:s("Agent 类型")}),e.jsxs("div",{className:"flex h-9 items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 text-sm text-muted-foreground",children:[e.jsx(le,{agentType:r.agentType,className:"size-4"}),e.jsx("span",{className:"min-w-0 truncate",children:de(r.agentType,r.runtimeType)})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"isDefault",checked:r.isDefault,onChange:n=>_(o=>({...o,isDefault:n.target.checked})),className:"h-4 w-4 rounded border-border accent-primary"}),e.jsx("label",{htmlFor:"isDefault",className:"text-sm text-foreground",children:s("设为该类型的默认 Provider")})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/20 p-4",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:s("基本配置")}),e.jsx(St,{value:ee,agentType:r.agentType,options:ie,error:H,onChange:n=>_(o=>{const l=Lt(o.agentType,o.config);return b(JSON.stringify(l,null,2)),{...o,executionPermission:n,executionPermissionReviewRequired:void 0,config:l}})}),N.apiBaseUrl&&!be&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"provider-api-url",className:"mb-1 block text-xs font-medium text-foreground",children:s("API 地址")}),e.jsx(ne,{id:"provider-api-url",type:"url",value:r.simplified.apiBaseUrl??"",onChange:n=>ue("apiBaseUrl",n.target.value),placeholder:N.apiBaseUrl.placeholder,"aria-invalid":!!B,"aria-describedby":B?"provider-api-url-error":void 0}),B&&e.jsx("p",{id:"provider-api-url-error",role:"alert",className:"mt-1 text-xs text-destructive-ink",children:s("请输入以 http:// 或 https:// 开头的完整 API 地址")})]}),N.apiKey&&!be&&(r.agentType!==E.CODEX||!!r.simplified.apiKey)&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[e.jsx("label",{htmlFor:"provider-api-key",className:"text-xs font-medium text-foreground",children:"API Key"}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Yt,{size:12}),s(it?"由高级配置管理":_e?"已配置":"未配置")]})]}),je?.write.action==="replace"||!_e?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ne,{id:"provider-api-key",type:"password",autoComplete:"new-password",value:je?.value??"",onChange:n=>ae(te,{action:"replace",value:n.target.value},n.target.value),placeholder:s("输入 API Key")}),r.simplified.apiKey?.configured&&e.jsx(A,{variant:"outline",size:"sm",onClick:()=>ae(te,{action:"keep"}),children:s("取消替换")})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx(A,{variant:"outline",size:"sm",onClick:()=>ae(te,{action:"replace",value:""}),children:s("替换")}),e.jsx(A,{variant:"outline",size:"sm",onClick:()=>{window.confirm(s("确定清除此 API Key?"))&&ae(te,{action:"clear"})},children:s("清除")})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"provider-model",className:"mb-1 block text-xs font-medium text-foreground",children:s("模型")}),r.agentType===E.CURSOR_AGENT?e.jsx(ss,{value:r.simplified.model??"",onChange:n=>ue("model",n??"")}):e.jsx(ne,{id:"provider-model",value:r.simplified.model??"",onChange:n=>ue("model",n.target.value),placeholder:N.model.placeholder})]}),N.reasoningEffort&&e.jsx(as,{options:(N.reasoningEffort.options??[]).map(n=>({value:n,label:s(gs(n))})),value:he,onChange:n=>ue("reasoningEffort",n),label:s("思考强度"),efficiencyLabel:s("更高效"),intelligenceLabel:s("更智能"),followCliLabel:s("跟随 CLI"),currentLabel:s("当前"),error:me}),m&&I&&e.jsxs("section",{className:"border-t border-border pt-3","data-fast-mode-control":!0,children:[e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,1fr)_180px] sm:items-center",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-foreground",children:s("Fast 模式")}),e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:s("支持的模型速度约提升至 1.5 倍,并增加用量消耗。ChatGPT 登录消耗更多额度;API Key 按 Priority 处理计费。")})]}),e.jsx(Ke,{value:He,disabled:!!I.error,onChange:et,options:[{value:"inherit",label:s("跟随 Codex")},{value:"standard",label:s("标准速度")},{value:"fast",label:"Fast"}]})]}),I.error&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive-ink",children:s("Fast 模式字段必须为 true 或 false,请在运行配置 JSON 中修正。")})]}),Z&&d&&e.jsxs("section",{className:"border-t border-border pt-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-foreground",children:s("禁用 WebSocket")}),e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:s(be?"当前原生 Provider 已使用非 WebSocket 传输;此开关不会添加额外运行时覆盖。":"仅禁用 Codex Responses API 的 WebSocket 传输;新启动和后续继续的请求将使用 HTTP。")})]}),e.jsx(Ee,{checked:d.enabled,disabled:!!d.error,onCheckedChange:Qe,"aria-label":s("禁用 WebSocket")})]}),d.error&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive-ink",children:s("禁用 WebSocket 字段必须为 true 或 false,请在运行配置 JSON 中修正。")})]})]}),K&&e.jsx(is,{result:K}),O.length>0&&e.jsxs("div",{className:"space-y-3 rounded-lg border border-warning/30 bg-warning/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[e.jsx(Ce,{size:16,className:"text-warning"}),s("需要解决配置冲突")]}),O.map(n=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-md border border-warning/20 bg-background/70 p-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:s(fs(n.field))})," · ",s("简化字段与高级配置值不同")]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:["simple","advanced"].map(o=>e.jsx(A,{variant:"outline",size:"sm",onClick:()=>{const l=n.field,c=It(r,l,o,N);_(()=>c),b(JSON.stringify(c.config,null,2)),q(v=>({...v,[l]:o})),o==="advanced"&&(l==="apiBaseUrl"||l==="model"||l==="reasoningEffort")&&T(v=>{const w=new Set(v);return w.delete(l),w}),h(v=>v.filter(w=>w.field!==l))},children:s(o==="simple"?"采用简化值":"保留高级值")},o))})]},n.field))]}),e.jsxs(Ns,{title:s("高级配置"),defaultOpen:!!g||!!C||!!H||!!I?.error||O.length>0,children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-foreground",children:s("运行配置 (JSON)")}),e.jsx(Me,{value:P,onChange:n=>{const o=n.target.value;b(o);try{const l=JSON.parse(o);if(!l||typeof l!="object"||Array.isArray(l))throw new Error(s("JSON 顶层必须是对象"));const c=l;u(""),T(v=>{const w=new Set(v).add("model");return N.reasoningEffort?.kind==="config"&&w.add("reasoningEffort"),w}),_(v=>({...v,config:c,simplified:At(v.simplified,c,N)}))}catch(l){ve(),u(l instanceof Error?l.message:s("JSON 语法错误"))}},rows:7,className:"font-mono","aria-invalid":!!g}),g&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive-ink",children:g})]}),e.jsxs("div",{className:"border-t border-border pt-3",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-foreground",children:s("环境变量")}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:[s("注入到 Agent 进程的环境变量。Codex 的")," ",e.jsx("code",{className:"rounded bg-muted px-1",children:"env_key"})," ",s("指定的是变量名,实际值需在此处设置。")]}),e.jsxs("div",{className:"space-y-2",children:[r.env.map((n,o)=>n.write.action!=="clear"&&e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(ne,{value:n.key,disabled:n.configured,onChange:l=>{const c=l.target.value;_(v=>{const w=[...v.env],se=w[o];if(!se)return v;const oe={...se,key:c};return w[o]={...oe,sensitive:Re(oe,v.simplified)},{...v,env:w}})},placeholder:s("变量名,如 AZURE_OPENAI_API_KEY"),className:"flex-1 py-1.5 font-mono"}),e.jsx(ne,{value:n.value,type:Re(n,r.simplified)?"password":"text",onChange:l=>{const c=[...r.env];c[o]={...c[o],value:l.target.value,write:{action:"replace",value:l.target.value}},_(v=>({...v,env:c,simplified:n.key===N.apiBaseUrl?.path?{...v.simplified,apiBaseUrl:l.target.value}:v.simplified})),n.key===N.apiBaseUrl?.path&&T(v=>new Set(v).add("apiBaseUrl"))},placeholder:n.configured&&n.write.action==="keep"?s("已配置,输入新值以替换"):s("值"),className:"flex-1 py-1.5 font-mono"}),e.jsx("button",{type:"button",onClick:()=>{const l=[...r.env];n.configured?l[o]={...n,value:"",write:{action:"clear"}}:l.splice(o,1),_(c=>({...c,env:l,simplified:n.key===N.apiBaseUrl?.path?{...c.simplified,apiBaseUrl:""}:c.simplified})),n.key===N.apiBaseUrl?.path&&T(c=>new Set(c).add("apiBaseUrl"))},"aria-label":s("删除"),className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:e.jsx(Ge,{size:14})})]},o)),e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>_(n=>({...n,env:[...n.env,{key:"",value:"",write:{action:"replace",value:""},configured:!1,sensitive:!1}]})),children:[e.jsx(we,{size:12,className:"mr-1"}),s("添加变量")]})]})]}),rt&&e.jsxs("div",{className:"border-t border-border pt-3",children:[e.jsx("label",{className:"mb-2 block text-xs font-medium text-foreground",children:s(xe?"Agent 原生配置 (config.toml)":"Agent 原生配置 (settings.json)")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:xe?e.jsxs(e.Fragment,{children:[s("直接填写 Codex")," ",e.jsx("code",{className:"rounded bg-muted px-1",children:"config.toml"})," ",s("格式的配置片段,由当前 Runtime 注入。不会修改你的")," ",e.jsx("code",{className:"rounded bg-muted px-1",children:"~/.codex/config.toml"})," ",s("文件。")]}):e.jsxs(e.Fragment,{children:[s("对应 Claude Code 的")," ",e.jsx("code",{className:"rounded bg-muted px-1",children:"~/.claude/settings.json"}),",",s("由当前 Runtime 注入。在")," ",e.jsx("code",{className:"rounded bg-muted px-1",children:"env"})," ",s("中设置 ANTHROPIC_API_KEY、ANTHROPIC_BASE_URL 等。")]})}),e.jsx(Me,{value:r.settings,onChange:n=>{const o=n.target.value;$(!0),M("");let l;if(xe)try{l=Ue(r.simplified,o,E.CODEX),T(c=>new Set(c).add("reasoningEffort"))}catch{}_(c=>{const v=l===void 0?c.simplified:Ue(c.simplified,o,E.CODEX,new Set(c.env.flatMap(w=>w.write.action==="clear"?[]:w.write.action==="replace"?w.value?[w.key]:[]:w.configured?[w.key]:[])));return{...c,settings:o,env:Kt(c.env,v),simplified:v}})},rows:10,className:"font-mono",placeholder:cs(r.agentType,x),"aria-invalid":!!C}),C&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive-ink",children:C})]})]})]})})})}function Ps({isOpen:t,onClose:i,onConfirm:a,acknowledged:p,onAcknowledgedChange:f,isLoading:x}){const{t:s}=J();return e.jsx(ke,{isOpen:t,onClose:i,title:s("导出 Provider 备份"),className:"max-w-xl",action:e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outline",onClick:i,disabled:x,children:s("取消")}),e.jsx(A,{onClick:a,disabled:!p||x,children:s(x?"导出中...":"导出备份")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-warning/30 bg-warning/10 px-4 py-3 text-sm text-foreground",children:[e.jsx(Ce,{size:15,className:"mt-0.5 shrink-0 text-warning","aria-hidden":"true"}),e.jsx("span",{children:s("导出的备份文件将包含完整的 Provider 配置,包括环境变量、CLI settings 等敏感信息。任何拿到文件的人都可能直接使用这些 Provider。")})]}),e.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsx("p",{children:s("这个功能用于备份和迁移,不用于分享配置。")}),e.jsx("p",{children:s("导出内容只包含用户层配置:自定义 Provider,以及对内置 Provider 的覆盖。")})]}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border px-4 py-3 text-sm text-foreground",children:[e.jsx("input",{type:"checkbox",checked:p,onChange:S=>f(S.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:s("我已知晓该备份文件包含敏感信息,只会保存在安全位置。")})]})]})})}function Cs({isOpen:t,onClose:i,preview:a,backup:p,onConfirm:f,isLoading:x}){const{t:s}=J();if(!a||!p)return null;const S=a.summary.create+a.summary.overwrite,r=[...a.items].sort((j,P)=>{const b={CREATE:0,OVERWRITE:1,SKIP:2};return b[j.action]-b[P.action]});return e.jsx(ke,{isOpen:t,onClose:i,title:s("导入 Provider 备份"),className:"max-w-3xl",action:e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outline",onClick:i,disabled:x,children:s("取消")}),e.jsx(A,{onClick:f,disabled:S===0||x,children:x?s("导入中..."):s("确认导入 {count} 项",{count:S})})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx("div",{children:s("导出时间:{value}",{value:new Date(p.exportedAt).toLocaleString()})}),e.jsx("div",{children:s("模式:完整备份(含敏感信息)")}),e.jsx("div",{children:s("文件内 Provider 数量:{count}",{count:p.providers.length})})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-success/25 bg-success/10 px-4 py-3",children:[e.jsx("div",{className:"text-xs font-medium text-success-ink",children:s("新增")}),e.jsx("div",{className:"text-[15px] font-semibold text-foreground",children:a.summary.create})]}),e.jsxs("div",{className:"rounded-lg border border-warning/25 bg-warning/10 px-4 py-3",children:[e.jsx("div",{className:"text-xs font-medium text-warning-ink",children:s("覆盖")}),e.jsx("div",{className:"text-[15px] font-semibold text-foreground",children:a.summary.overwrite})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 px-4 py-3",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:s("跳过")}),e.jsx("div",{className:"text-[15px] font-semibold text-foreground",children:a.summary.skip})]})]}),e.jsx("div",{className:"max-h-[420px] overflow-y-auto space-y-3 pr-1",children:r.map(j=>{const P=bs(j.action);return e.jsxs("div",{className:"rounded-lg border border-border px-4 py-3",children:[e.jsx("div",{className:"flex items-center justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:"truncate text-sm font-medium text-foreground",children:j.incoming.name}),e.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${P.className}`,children:s(P.label)})]}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(le,{agentType:j.incoming.agentType,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:de(j.incoming.agentType,j.incoming.runtimeType)})," · ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j.incoming.id})]})]})}),j.action==="OVERWRITE"&&j.existing&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("将覆盖当前已有的 Provider:{name}",{name:j.existing.name})}),j.action==="SKIP"&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("当前同 ID Provider 配置一致,本次不会重复写入。")}),j.action==="CREATE"&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("当前不存在同 ID Provider,将直接新增。")})]},j.incoming.id)})})]})})}function ks({item:t,onEdit:i,onDelete:a,onEnabledChange:p,isUpdating:f}){const{t:x}=J(),s=t.provider,S=$e(t),r=Tt(s),j=Xe(s.agentType,s.config),P=fe[s.agentType],b=Object.entries(j).filter(([u])=>u!=="cmd"&&u!==P.executionPermission.path),g=Object.keys(s.redactedEnv||{});return e.jsxs("div",{className:"min-w-0 space-y-6",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("h3",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:s.name}),e.jsx(ys,{issue:S,disabled:s.enabled===!1})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[e.jsx(le,{agentType:s.agentType,className:"size-3.5"}),e.jsx("span",{className:"truncate",children:de(s.agentType,s.runtimeType)})]}),s.isDefault&&e.jsx("span",{className:"rounded-full bg-primary/[0.06] px-2 py-0.5 text-xs font-medium text-primary",children:x("默认")}),s.builtIn&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:x("内置")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:shrink-0",children:[e.jsxs(A,{size:"sm",variant:"outline",onClick:i,children:[e.jsx(Zt,{size:13}),x("编辑")]}),e.jsxs(A,{size:"sm",variant:s.builtIn?"outline":"destructive",onClick:a,disabled:s.deletable===!1,children:[s.builtIn?e.jsx(Nt,{size:13}):e.jsx(Ge,{size:13}),s.builtIn?x("恢复默认"):x("删除")]})]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("label",{htmlFor:"provider-enabled",className:"text-sm font-medium text-foreground",children:x("启用配置")}),e.jsx("p",{id:"provider-enabled-description",className:"mt-1 text-xs text-muted-foreground",children:x("禁用后不在 Agent 可选列表中显示,配置仍会保留,可随时重新启用。")})]}),e.jsx(Ee,{id:"provider-enabled",checked:s.enabled!==!1,disabled:f,onCheckedChange:p,"aria-describedby":"provider-enabled-description"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(pe,{children:x("Execution permission")}),e.jsx("p",{className:"text-sm",children:x(_t[Je(s).mode])}),r&&!s.diagnostics?.some(u=>u.field==="executionPermission")?e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:x(r)}):null,s.diagnostics?.filter(u=>u.field==="executionPermission").map((u,C)=>e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:x(u.message)},`${u.code}-${C}`)),S&&!r?e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:x(S)}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:x("Changes apply when a new runtime starts. Running sessions keep their launch mode.")})]}),b.length>0&&e.jsxs("div",{children:[e.jsx(pe,{className:"mb-3",children:x("运行配置")}),e.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-border bg-border/60",children:b.map(([u,C])=>e.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-1 bg-background px-4 py-2.5 sm:flex-row sm:items-center sm:gap-4",children:[e.jsx("span",{className:"min-w-0 break-words text-[13px] text-muted-foreground sm:w-32 sm:shrink-0",children:x(Ve[u]??u)}),e.jsx("span",{className:"min-w-0 max-w-full break-all font-mono text-[13px] text-foreground",children:ps(u,C)})]},u))})]}),g.length>0&&e.jsxs("div",{children:[e.jsx(pe,{className:"mb-3",children:x("环境变量")}),e.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-border bg-border/60",children:g.map(u=>e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 bg-background px-4 py-2.5 sm:gap-4",children:[e.jsx("span",{className:"min-w-0 max-w-full break-all font-mono text-[13px] text-foreground",children:u}),e.jsx("span",{className:"text-[13px] text-muted-foreground","aria-label":"hidden",children:"•••••"})]},u))})]}),s.settings?.trim()&&e.jsxs("div",{children:[e.jsx(pe,{className:"mb-3",children:x("Agent 原生配置")}),e.jsx("div",{className:"rounded-lg border border-border bg-muted/40 p-4",children:e.jsx("pre",{className:"max-h-[200px] overflow-y-auto whitespace-pre-wrap break-all font-mono text-xs text-muted-foreground",children:s.settings})})]}),b.length===0&&g.length===0&&!s.settings?.trim()&&e.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:x('该 Provider 未配置额外参数。点击"编辑"添加运行配置、环境变量或 Agent 原生配置。')})]})}function rn(){const{t}=J(),{data:i,isLoading:a}=zt(),p=Ft(),f=Jt(),x=$t(),s=qt(),S=Gt(),r=Wt(),j=y.useRef(null),[P,b]=y.useState(null),[g,u]=y.useState(null),[C,M]=y.useState(null),[F,$]=y.useState(!1),[V,L]=y.useState(!1),[K,R]=y.useState(null),[Y,T]=y.useState(!1),O=i??[],h=P??O[0]?.provider.id??null,k=d=>{p.mutate(d,{onSuccess:()=>u(null),onError:m=>U.error(W(m,t("创建 Provider 失败")))})},q=(d,m)=>{f.mutate({id:d,data:m},{onSuccess:()=>u(null),onError:I=>U.error(W(I,t("更新 Provider 失败")))})},Q=(d,m)=>{f.mutate({id:d,data:{enabled:m}},{onError:I=>U.error(W(I,t("更新 Provider 失败")))})},ge=d=>{if(!(d.deletable??!d.builtIn)){U.error(t("系统内置 Provider 不可删除"));return}M({id:d.id,name:d.name,builtIn:d.builtIn})},N=()=>{C&&x.mutate(C.id,{onSuccess:()=>{U.success(C.builtIn?t("已恢复默认 Provider 配置"):t("Provider 已删除")),h===C.id&&b(null),M(null),T(!1)},onError:d=>U.error(W(d,t("删除 Provider 失败")))})},B=()=>{$(!1),L(!1)},re=()=>R(null),ee=()=>{s.mutate(void 0,{onSuccess:d=>{vs(hs(d.exportedAt),d),U.success(t("Provider 备份已导出")),B()},onError:d=>U.error(W(d,t("导出 Provider 备份失败")))})},ie=()=>{j.current&&(j.current.value="",j.current.click())},ce=async d=>{const m=d.target.files?.[0];if(d.target.value="",!m)return;let I;try{I=JSON.parse(await m.text())}catch{U.error(t("备份文件不是有效的 JSON"));return}S.mutate(I,{onSuccess:G=>R({backup:I,preview:G}),onError:G=>U.error(W(G,t("导入预览失败")))})},H=()=>{K&&r.mutate(K.backup,{onSuccess:d=>{const m=d.summary.create+d.summary.overwrite;U.success(m===0?t("导入完成,当前配置无需变更"):t("导入完成:新增 {create},覆盖 {overwrite},跳过 {skip}",{create:d.summary.create,overwrite:d.summary.overwrite,skip:d.summary.skip})),re()},onError:d=>U.error(W(d,t("导入 Provider 备份失败")))})},Z=d=>{const m=d.provider,I=fe[m.agentType],G=Ot(m,I);u({id:m.id,data:{name:m.name,agentType:m.agentType,runtimeType:m.runtimeType===X.ACP?X.ACP:X.CLI,executionPermission:m.executionPermission,executionPermissionReviewRequired:m.executionPermissionReviewRequired,config:Xe(m.agentType,m.config),settings:m.settings??"",env:G,simplified:m.simplified??{},diagnostics:m.diagnostics,isDefault:m.isDefault}})};return a?e.jsx(Oe,{className:"max-w-5xl",children:e.jsx(gt,{})}):e.jsxs(Oe,{className:"max-w-5xl",children:[e.jsx("input",{ref:j,type:"file",accept:".json,application/json",className:"hidden",onChange:ce}),e.jsx(ht,{title:t("Agent 配置"),actions:e.jsxs(e.Fragment,{children:[e.jsxs(A,{variant:"outline",size:"sm",onClick:ie,disabled:S.isPending||r.isPending,children:[e.jsx(Ht,{size:13}),t("导入")]}),e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>$(!0),disabled:s.isPending,children:[e.jsx(vt,{size:13}),t("导出")]}),e.jsxs(A,{size:"sm",onClick:()=>u({}),children:[e.jsx(we,{size:13,className:"mr-1"}),t("新建")]})]})}),O.length===0?e.jsx(bt,{icon:jt,message:t("暂无 Agent 配置"),action:e.jsxs(A,{size:"sm",onClick:()=>u({}),children:[e.jsx(we,{size:13,className:"mr-1"}),t("新建配置")]})}):e.jsx(Vt,{items:O,selectedId:h,onSelectItem:d=>{b(d),T(!0)},getItemId:d=>d.provider.id,mobileShowDetail:Y,onMobileBack:()=>T(!1),renderListItem:d=>{const m=d.provider,I=$e(d);return e.jsxs(e.Fragment,{children:[e.jsx(js,{issue:I,disabled:m.enabled===!1}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:D("truncate text-[13px] font-medium",m.enabled===!1&&"text-muted-foreground"),children:m.name}),e.jsxs("div",{className:D("flex min-w-0 items-center gap-1.5 text-[11px]","text-muted-foreground"),children:[e.jsx(le,{agentType:m.agentType,className:"size-3.5",fallbackClassName:"text-muted-foreground"}),e.jsx("span",{className:"min-w-0 truncate",children:de(m.agentType,m.runtimeType)}),m.enabled===!1&&e.jsx("span",{className:"shrink-0",children:t("已禁用")})]}),I?e.jsx("div",{className:D("mt-0.5 break-words text-xs leading-snug text-destructive-ink"),children:t(I)}):null]}),m.isDefault&&e.jsx("span",{className:D("shrink-0 rounded px-1.5 py-0.5 text-xs font-medium","bg-primary/[0.06] text-primary"),children:t("默认")})]})},renderDetail:d=>d?e.jsx("div",{className:"min-w-0 p-5",children:e.jsx(ks,{item:d,onEdit:()=>Z(d),onDelete:()=>ge(d.provider),onEnabledChange:m=>Q(d.provider.id,m),isUpdating:f.isPending})}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:t("选择一个 Provider 查看详情")})}),g&&e.jsx(ws,{isOpen:!0,onClose:()=>u(null),providerId:g.id,initialData:g.data,onSave:d=>{g.id?q(g.id,d):k(d)}}),e.jsx(Xt,{isOpen:C!==null,onClose:()=>{x.isPending||M(null)},onConfirm:N,title:C?.builtIn?t("恢复默认 Provider"):t("删除 Provider"),description:C?.builtIn?t('确定删除 "{name}" 的自定义覆盖,并恢复系统默认配置?',{name:C?.name}):t('确定删除 "{name}"?此操作不可撤销。',{name:C?.name}),confirmText:C?.builtIn?t("恢复默认"):t("删除"),cancelText:t("取消"),variant:"danger",isLoading:x.isPending}),e.jsx(Ps,{isOpen:F,onClose:B,onConfirm:ee,acknowledged:V,onAcknowledgedChange:L,isLoading:s.isPending}),e.jsx(Cs,{isOpen:!!K,onClose:re,preview:K?.preview??null,backup:K?.backup??null,onConfirm:H,isLoading:r.isPending})]})}export{ws as ProviderFormModal,rn as ProviderSettingsPage};
@@ -1 +1 @@
1
- import{u as v,j as r,n as s,w as h}from"./index-Cm6snkmR.js";function j({items:o,selectedId:l,onSelectItem:a,getItemId:t,renderListItem:d,renderDetail:g,renderListFooter:u,mobileShowDetail:c,onMobileBack:x,listClassName:f,detailClassName:b}){const{t:m}=v(),p=o.find(e=>t(e)===l)??null;return r.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)] gap-5 lg:grid-cols-[240px_minmax(0,1fr)] lg:h-[calc(100vh-16rem)] lg:max-h-[640px]",children:[r.jsxs("div",{className:s("min-w-0 space-y-1 lg:overflow-y-auto lg:pr-1 scrollbar-app-thin",c&&"hidden lg:block",f),children:[o.map(e=>{const n=t(e),i=n===l;return r.jsx("button",{onClick:()=>a(n),"aria-current":i?"true":void 0,className:s("flex min-w-0 w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",i?"bg-background text-foreground shadow-raised ring-1 ring-border/80":"text-foreground hover:bg-accent"),children:d(e,i)},n)}),u?.()]}),r.jsxs("div",{className:s("min-w-0 rounded-xl border border-border bg-card lg:overflow-y-auto scrollbar-app-thin",!c&&"hidden lg:block",b),children:[r.jsxs("button",{onClick:x,className:"mb-4 flex items-center gap-1.5 px-5 pt-3 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 lg:hidden",children:[r.jsx(h,{size:14}),m("返回列表")]}),g(p)]})]})}export{j as S};
1
+ import{u as v,j as r,n as s,w as h}from"./index-BR3Wg2fS.js";function j({items:o,selectedId:l,onSelectItem:a,getItemId:t,renderListItem:d,renderDetail:g,renderListFooter:u,mobileShowDetail:c,onMobileBack:x,listClassName:f,detailClassName:b}){const{t:m}=v(),p=o.find(e=>t(e)===l)??null;return r.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)] gap-5 lg:grid-cols-[240px_minmax(0,1fr)] lg:h-[calc(100vh-16rem)] lg:max-h-[640px]",children:[r.jsxs("div",{className:s("min-w-0 space-y-1 lg:overflow-y-auto lg:pr-1 scrollbar-app-thin",c&&"hidden lg:block",f),children:[o.map(e=>{const n=t(e),i=n===l;return r.jsx("button",{onClick:()=>a(n),"aria-current":i?"true":void 0,className:s("flex min-w-0 w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",i?"bg-background text-foreground shadow-raised ring-1 ring-border/80":"text-foreground hover:bg-accent"),children:d(e,i)},n)}),u?.()]}),r.jsxs("div",{className:s("min-w-0 rounded-xl border border-border bg-card lg:overflow-y-auto scrollbar-app-thin",!c&&"hidden lg:block",b),children:[r.jsxs("button",{onClick:x,className:"mb-4 flex items-center gap-1.5 px-5 pt-3 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 lg:hidden",children:[r.jsx(h,{size:14}),m("返回列表")]}),g(p)]})]})}export{j as S};
@@ -0,0 +1 @@
1
+ import{u as Se,r as n,ah as Bt,j as e,B as ne,ai as zt,a4 as Xs,a5 as Ft,aj as Ut,ak as _t,al as Kt,am as qt,an as Vt,ao as L,ap as Gt,aq as Ht,q as Qt,v as $t,s as Ne,ar as us,as as Xt,ae as Ys,af as B,at as Yt,w as Jt,au as Js,av as Zt,a2 as en,aw as sn,ax as A,$ as tn,ay as nn}from"./index-BR3Wg2fS.js";import{r as rn,a as Zs,Q as on,s as an}from"./mermaid-NOHMQCX5-CG_LpwAI.js";import{u as ln,r as cn,c as dn,g as _e,a as un,b as mn,d as pn,e as fn,f as xn,h as gn,W as hn,E as bn,i as vn,C as jn,S as yn,T as et,R as kn,j as Cn,k as wn,l as Nn,m as In,n as Sn}from"./EditableTaskTitle-BEsiULnD.js";import{t as Rn,D as Tn}from"./ProjectKanbanPage-DMtv15rq.js";import{u as An,a as En,R as Wn,P as Pn,T as Dn}from"./useTokenUsage-Drh3v3kx.js";import{u as Mn,a as On,L as st,T as tt}from"./useNormalizedLogs-DsdwmfS7.js";import{g as Ln}from"./ExecutionPermissionSelector-IoWR9YLb.js";import{u as Bn,A as zn}from"./AttachmentPreview-CFJ6MZ1f.js";import{T as Fn,u as Un,a as _n,b as Kn,c as qn,d as Vn,e as Gn,S as nt}from"./CreateTaskInput-BM2tx4hJ.js";import{u as Hn,a as Qn,b as $n,c as Xn,d as Yn,e as Jn}from"./BranchSelect-Cv92vEjG.js";import{u as Zn}from"./use-providers-CQwBj9hp.js";import{i as er}from"./provider-selection-DSu7SCI7.js";import{M as sr}from"./modal-D496f1fE.js";import{C as tr}from"./confirm-dialog-CL_1pF4K.js";import{C as nr,P as ms}from"./content-D0qmHfHK.js";import{P as rt,T as rr}from"./trash-2-5jI3_KHh.js";import{P as or}from"./paperclip-D9ka2IAB.js";import"./use-translation-settings-DBzFqP-d.js";import"./copy-C4WnOY6Y.js";import"./index-Da2mWAtm.js";import"./index-DVdiOmqt.js";import"./index-hHrknzh7.js";import"./tooltip-C8--8CNX.js";import"./kbd-Cl4AzzJp.js";import"./index-cu8sedJH.js";import"./chevron-down-BoS08pMa.js";import"./MemberAvatar-BVXD0jTy.js";import"./people-CbmH8m4i.js";import"./chevron-up-BWtKfdKT.js";import"./at-sign-BhSPafOS.js";import"./check-D_VFGpIy.js";import"./BrandLogo-H4nCbVzs.js";import"./popover-D8VtO5qF.js";import"./search-DOMr5jPS.js";import"./index-Db28hRe8.js";import"./index-DSy5JLC1.js";import"./select-CzZNbe1Z.js";import"./select-Cw5BaOLQ.js";import"./menu-styles-DWynpVVz.js";import"./index-C1lMEjmZ.js";import"./layers-XImbMX-P.js";import"./message-square-BviHdb67.js";import"./textarea-xt2hLb-d.js";import"./menu-DXF6iUsq.js";import"./server-u-PC-CcX.js";import"./icon-button-BmrJtYFC.js";import"./upload-DUteazR7.js";import"./globe-CxeM27yy.js";import"./pencil-isP1rXC-.js";import"./chip-Ck4dqxR3.js";import"./folder-picker-Cj1VZOZU.js";import"./track-BeqaPopG.js";import"./dialog-1o8KQWoQ.js";import"./file-6qwbIga1.js";function ar({isOpen:t,onClose:c,taskId:P}){const{t:d}=Se(),[C,f]=n.useState("AUTO"),[I,o]=n.useState(null),[u,z]=n.useState([]),[Re,F]=n.useState(null),Te=Bt();n.useEffect(()=>{t&&(f("AUTO"),o(null),z([]),F(null))},[t]);const S=Te.isPending,Ke=!!I||u.length>0,re=async()=>{if(!S){if(!I&&u.length===0){F(d("请选择至少一个团队模板或成员预设。"));return}F(null);try{await Te.mutateAsync({taskId:P,mode:C,...I?{teamTemplateId:I}:{},...u.length>0?{memberPresetIds:u}:{}}),c()}catch(V){F(V instanceof Error?V.message:d("创建 TeamRun 失败"))}}},qe=S||!Ke;return e.jsxs(sr,{isOpen:t,onClose:S?()=>{}:c,title:d("创建 TeamRun"),className:"max-w-5xl",action:e.jsxs(e.Fragment,{children:[e.jsx(ne,{type:"button",variant:"outline",onClick:c,disabled:S,children:d("取消")}),e.jsx(ne,{type:"button",onClick:re,disabled:qe,children:d(S?"处理中...":"创建 TeamRun")})]}),children:[e.jsx(Fn,{mode:C,setMode:f,selectedTemplateId:I,setSelectedTemplateId:o,selectedMemberPresetIds:u,setSelectedMemberPresetIds:z,disabled:S}),Re&&e.jsx("div",{role:"alert",className:"rounded-lg border border-destructive/25 bg-destructive/10 px-4 py-3 text-sm text-destructive-ink",children:Re})]})}function ir({workspaceId:t,gitStatus:c,onResolve:P}){const{t:d}=Se(),C=Hn();if(c.operation==="idle"||c.conflictedFiles.length===0)return null;const f=c.operation==="rebase"?"Rebase":"Merge";return e.jsx(zt,{tone:"warning",className:"mx-6 mt-3 items-center",title:e.jsxs("span",{className:"flex items-center gap-2",children:[f," ",d("冲突"),e.jsxs(Ft,{tone:"warning",className:"tabular-nums",children:[c.conflictedFiles.length," ",d("个文件")]})]}),action:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Xs,{variant:"ghost",onClick:()=>C.mutate(t),loading:C.isPending,children:d("中止操作")}),e.jsx(Xs,{variant:"primary",onClick:P,children:d("解决冲突")})]})})}const lr=tn(),cr=t=>t.includes("://")||t.startsWith("/api/")?t:t.startsWith("/")?`${lr}/attachments/by-path?path=${encodeURIComponent(t)}`:t,te=520,ps=48,dr=4,ur=420;function mr(){const{t}=Se();return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-background text-muted-foreground select-none",children:[e.jsx("div",{className:"w-16 h-16 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-6",children:e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-muted-foreground",children:[e.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",fill:"currentColor"}),e.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsx("h3",{className:"text-foreground font-medium mb-2 text-[15px]",children:"Agent Tower"}),e.jsx("p",{className:"text-sm max-w-sm text-center text-muted-foreground leading-relaxed",children:t("Select a task from the sidebar to view logs, monitor execution, or interact with an agent.")})]})}function Ie(t){const c=nn[t].icon;return e.jsx(c,{className:"size-3"})}const ot=[{status:A.Review,className:"bg-warning/10 text-warning-ink",hoverClass:"hover:bg-warning/15",icon:Ie(A.Review)},{status:A.Running,className:"bg-info/10 text-info-ink",hoverClass:"hover:bg-info/15",icon:Ie(A.Running)},{status:A.Pending,className:"bg-muted/50 text-muted-foreground",hoverClass:"hover:bg-muted",icon:Ie(A.Pending)},{status:A.Done,className:"bg-success/10 text-success-ink",hoverClass:"hover:bg-success/15",icon:Ie(A.Done)},{status:A.Cancelled,className:"bg-muted/50 text-muted-foreground",hoverClass:"hover:bg-border",icon:Ie(A.Cancelled)}];function pr({status:t,onChangeStatus:c}){const{t:P}=Se(),[d,C]=n.useState(!1),f=n.useRef(null);n.useEffect(()=>{if(!d)return;const o=u=>{f.current&&!f.current.contains(u.target)&&C(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[d]);const I=ot.find(o=>o.status===t);return e.jsxs("div",{className:"relative",ref:f,children:[e.jsxs("button",{onClick:()=>c&&C(o=>!o),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium transition-colors ${I.className} ${c?"cursor-pointer hover:opacity-80":""}`,children:[I.icon,e.jsx("span",{children:P(t)}),c&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${d?"rotate-180":""}`,children:e.jsx("path",{d:"M2 3.5L5 6.5L8 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})})]}),d&&e.jsx("div",{className:"absolute right-0 top-full mt-2 w-40 bg-background rounded-lg border border-border shadow-popover z-50 py-1 animate-in fade-in zoom-in-95 duration-100",children:ot.filter(o=>o.status!==t).map(o=>e.jsxs("button",{onClick:()=>{c?.(o.status),C(!1)},className:`w-full flex items-center gap-2 px-3 py-2 text-xs font-medium transition-colors ${o.hoverClass}`,children:[e.jsx("span",{className:o.className.split(" ").find(u=>u.startsWith("text-")),children:o.icon}),e.jsx("span",{className:"text-foreground/80",children:P(o.status)})]},o.status))})]})}function xo({task:t,onDeleteTask:c,isDeleting:P,onTaskStatusChange:d,onTaskPriorityChange:C,autoStartState:f,onAutoStartRecovered:I}){const{t:o}=Se(),[u,z]=n.useState(""),[Re,F]=n.useState(!1),[Te,S]=n.useState(!1),[Ke,re]=n.useState(!1),[qe,V]=n.useState(!1),[at,fs]=n.useState(!1),Ae=n.useRef(null),[Ve,oe]=n.useState(!1),[R,Ge]=n.useState(null),[ae,G]=n.useState(void 0),[H,Ee]=n.useState(!1),He=n.useRef(null),Qe=n.useRef(null),ie=n.useRef(null),xs=n.useRef(null),{scrollRef:U,contentRef:gs,isAtBottom:hs,scrollToBottom:We,stopScroll:bs}=An({resize:"smooth",initial:"instant"}),[E,vs]=n.useState(!1),[$e,le]=n.useState(te),[Pe,js]=n.useState(!1),ys=n.useRef(0),ks=n.useRef(te),Cs=n.useRef(null),Xe=n.useCallback((s,r,i)=>{Ae.current?.openFile(s,r,i)},[]),{data:a,isLoading:it}=Qn(t?.id??""),ce=ln(t?.id),ws=ce?.status==="completed"&&f?.status!=="failed"?null:f,Ye=!!(ws||ce&&ce.status!=="completed"),{data:de}=Ut(t?.id??""),{data:lt}=_t(de?.id??""),Ns=Kt(de?.id??""),m=de??null,ue=!!m,Q=t?.isGitRepo!==!1&&t?.worktreeReady!==!1,De=de===null&&Q,ct=!!(t?.id&&de===null),{data:$,isLoading:Is}=qt(t?.id??"",ct);n.useEffect(()=>{Ee(!1),Ge(null),G(void 0)},[t?.id]);const _=n.useMemo(()=>cn(a,m,ae),[ae,m,a]);n.useEffect(()=>{ae&&!a?.some(s=>s.id===ae)&&G(void 0)},[ae,a]);const g=n.useMemo(()=>a?.find(s=>s.id===_),[_,a]),k=g?.status===Vt.ACTIVE?g.id:void 0,me=Q&&dn(g,m);n.useEffect(()=>{if(!H||!a)return;a.some(r=>r.status==="ACTIVE"&&r.sessions&&r.sessions.length>0)&&Ee(!1)},[a,H]);const h=n.useMemo(()=>{if(H||!a)return null;const s=l=>{const ds=l.createdAt,we=l.endedAt??l.startedAt??ds;if(!we)return 0;const se=Date.parse(we);return Number.isNaN(se)?0:se},r=(l,ds)=>{const we=l.filter(se=>ds.includes(se.status));return we.length===0?null:we.sort((se,Lt)=>s(Lt)-s(se))[0]??null},i=a.filter(l=>l.status==="ACTIVE"&&Array.isArray(l.sessions)).flatMap(l=>l.sessions??[]),p=r(i,[L.RUNNING])??r(i,[L.PENDING])??r(i,[L.COMPLETED,L.FAILED,L.CANCELLED]);if(p)return p;const N=a.filter(l=>(l.status==="MERGED"||l.status==="ABANDONED"||l.status==="HIBERNATED")&&Array.isArray(l.sessions)).flatMap(l=>l.sessions??[]);return r(N,[L.COMPLETED,L.FAILED,L.CANCELLED])},[a,H]),X=h?.id??"",b=ue?R??"":X,dt=n.useMemo(()=>{if(!R||!a)return null;for(const s of a){const r=s.sessions?.find(i=>i.id===R);if(r)return r}return null},[R,a]),Je=n.useMemo(()=>{if(!R||!m?.invocations)return null;const s=m.invocations.filter(r=>r.sessionId===R);return s.length===0?null:s.sort((r,i)=>{const p=Date.parse(r.updatedAt??r.createdAt??""),N=Date.parse(i.updatedAt??i.createdAt??"");return(Number.isNaN(N)?0:N)-(Number.isNaN(p)?0:p)})[0]??null},[R,m?.invocations]),ut=n.useMemo(()=>!Je?.memberId||!m?.members?null:m.members.find(s=>s.id===Je.memberId)??null,[Je?.memberId,m?.members]),v=R?dt:h??null,D=v?.id,Y=n.useMemo(()=>{if(v?.workspaceId)return v.workspaceId;if(!(!v||!a))return a.find(s=>s.sessions?.some(r=>r.id===v.id))?.id},[v,a]),Me=n.useCallback((s,r)=>{const p=(r&&a?.some(N=>N.id===r)?r:void 0)??Y??_??void 0;p&&G(p),Ae.current?.openPreview(s,p)},[Y,_,a]),Ze=n.useCallback((s,r)=>{Me({kind:"web",url:s},r)},[Me]),es=n.useCallback((s,r,i)=>{Me({kind:"visualization",sessionId:s,file:r},i)},[Me]),Ss=n.useCallback(s=>{Ze(s,Y)},[Y,Ze]),Rs=n.useCallback(s=>{D&&es(D,s,Y)},[D,Y,es]),{isActive:pe,isCancelling:fe}=Un(D??"",v?.status),x=!!t?.projectArchivedAt,Ts=!!t?.projectRepoDeletedAt,ss=o(Ts?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。"),{data:J}=Zn(),[Oe,As]=n.useState(null),Le=h?Ln(J,Oe??h.providerId):void 0;n.useEffect(()=>{As(h?.providerId??null)},[h?.providerId]);const mt=n.useMemo(()=>!h||!a?!1:!a.some(r=>r.status==="ACTIVE"&&r.sessions?.some(i=>i.id===h.id)),[h,a]),w=n.useMemo(()=>{if(!(!a||H)){if(g)return _e(g);for(const s of a)if(s.status==="ACTIVE"&&_e(s))return _e(s);return _e(a[0])}},[H,g,a]),K=_n({agentType:h?.agentType,workingDir:w,input:u,setInput:z,textareaRef:ie,minHeight:60,maxHeight:300}),q=un({agentType:h?.agentType,workingDir:w,input:u,setInput:z,textareaRef:ie,minHeight:60,maxHeight:300}),ts=Gt(s=>s.setVisibleContext),xe=!!(me&&k&&w&&!x),{data:T,isLoading:pt}=$n(k??"",{enabled:xe}),{data:ft}=mn(w,{enabled:xe});n.useEffect(()=>{if(!(E||!xe||!k||!w))return ts({workspaceId:k,workingDir:w,tab:"changes"}),()=>{ts(null)}},[E,k,ts,xe,w]);const xt=g?.sessions??[],ge=pn(g),Es=g?.commitMessage,he=n.useMemo(()=>fn(g,a,t?.mainBranch??""),[g,t?.mainBranch,a]),be=xn((a??[]).map(s=>s.id),!ue),{pendingConflictDetails:ve}=be,Ws=!!ve,j=n.useMemo(()=>ve||(T?.conflictOp&&T.conflictedFiles.length>0?Ht({conflictOp:T.conflictOp,conflictedFiles:T.conflictedFiles,resolutionContextToken:T.resolutionContextToken,sourceWorkspaceId:k,sourceWorktreePath:g?.worktreePath,sourceBranch:ge,targetBranch:he}):ve),[T,ve,k,g?.worktreePath,ge,he]),Ps=j?.targetWorkspaceId??k,gt=j?.targetWorktreePath??g?.worktreePath,ht=j?.sourceBranch??ge,bt=j?.targetBranch??he,y=Qt(),Be=n.useCallback(async()=>t?.id?y.fetchQuery({queryKey:Ne.tasks.body(t.id),queryFn:()=>$t.get(`/tasks/${t.id}/body`)}):null,[y,t?.id]),Ds=n.useCallback(()=>t?.id?y.invalidateQueries({queryKey:Ne.workspaces.list(t.id)}):Promise.resolve(),[t?.id,y]);n.useEffect(()=>{if(!Ve)return;const s=r=>{Qe.current&&!Qe.current.contains(r.target)&&oe(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[Ve]);const M=Kn(),Ms=Xn(),Os=Yn(t?.id??""),Ls=qn(),ns=Jn(),je=n.useMemo(()=>!a||a.some(r=>r.status==="ACTIVE")?null:a.find(r=>r.status==="HIBERNATED")??null,[a]),rs=n.useRef(null);n.useEffect(()=>{je&&rs.current!==je.id&&(ns.isPending||(rs.current=je.id,ns.mutate(je.id,{onSettled:()=>{rs.current=null}})))},[je,ns]);const vt=n.useCallback(async()=>{if(!t?.id)return;const s=h?.providerId??J?.find(r=>er(r)&&r.availability.type!=="NOT_FOUND")?.provider.id;if(s){V(!1),fs(!0);try{const i=(await Be())?.prompt??t.title;Ee(!0),await Rn(t.id,{providerId:s,prompt:i,retryTask:!0,workspaceKind:Q?us.WORKTREE:us.MAIN_DIRECTORY},{createWorkspace:p=>Os.mutateAsync({clientSubmissionId:p,workspaceKind:Q?void 0:us.MAIN_DIRECTORY}),startSession:p=>Ls.mutateAsync(p)}),await y.invalidateQueries({queryKey:Ne.workspaces.list(t.id)})}catch(r){console.error("[retry] failed:",r),Ee(!1)}finally{fs(!1)}}},[t?.id,t?.title,Q,h?.providerId,J,Be,Os,Ls,y]),os=n.useCallback(async()=>{t?.id&&(await Be(),F(!0))},[Be,t?.id]),jt=n.useCallback(()=>{g?.id&&Ms.mutate({workspaceId:g.id})},[Ms,g?.id]),yt=n.useCallback(()=>{!t?.id||!c||(c(t.id),re(!1))},[t?.id,c]),Bs=n.useCallback(s=>{Ge(s),requestAnimationFrame(()=>{We()})},[We]),kt=n.useCallback(()=>{Ge(null)},[]),ye=n.useCallback(s=>{const r=s??j;r&&be.openDialog(r)},[j,be]),Ct=n.useCallback(s=>Ns.mutateAsync(s),[Ns]),Z=n.useCallback(()=>{y.invalidateQueries({queryKey:Xt.all})},[y]),{isConnected:zs,isLoadingSnapshot:Fs,isOutputActive:Us,lastExitAt:_s,logs:ke,entries:wt,attach:ze}=Mn({sessionId:b,sessionStatus:v?.status,sessionStartedAt:v?.startedAt??v?.createdAt,sessionEndedAt:v?.endedAt??(pe?null:v?.updatedAt),onExit:n.useCallback(()=>{y.invalidateQueries({queryKey:["workspaces"]})},[y])});n.useEffect(()=>{if(!t?.id)return;const s=Ys.connect(),r=rn(t.id),i=l=>{l.taskId===t.id&&(y.invalidateQueries({queryKey:["tasks"]}),Z())},p=l=>{l.taskId===t.id&&(y.invalidateQueries({queryKey:Ne.workspaces.list(t.id)}),Z())},N=l=>{l.taskId===t.id&&(y.invalidateQueries({queryKey:Ne.workspaces.list(t.id)}),Z())};return s.on(B.TASK_UPDATED,i),s.on(B.WORKSPACE_COMMIT_MESSAGE_UPDATED,p),s.on(B.WORKSPACE_HIBERNATED,N),()=>{s.off(B.TASK_UPDATED,i),s.off(B.WORKSPACE_COMMIT_MESSAGE_UPDATED,p),s.off(B.WORKSPACE_HIBERNATED,N),r()}},[t?.id,y,Z]),n.useEffect(()=>{if(!b)return;const s=Ys.connect(),r=i=>{i.sessionId===b&&(y.invalidateQueries({queryKey:["workspaces"]}),Z())};return s.on(B.SESSION_COMPLETED,r),()=>{s.off(B.SESSION_COMPLETED,r)}},[b,y,Z]);const{todos:Fe}=On(wt),{files:Nt,addFiles:ee,removeFile:It,clear:Ks,getDoneAttachments:qs,hasFiles:Ce,isUploading:Ue}=Bn(),St=n.useMemo(()=>gn(v),[v?.tokenUsage]),Vs=En(ke,St);n.useEffect(()=>{b&&zs&&ze()},[b,zs,ze]);const Gs=n.useRef(t?.id);n.useEffect(()=>{if(Gs.current!==t?.id&&U.current){const s=U.current;requestAnimationFrame(()=>{s.scrollTop=s.scrollHeight})}Gs.current=t?.id},[t?.id,U]);const O=Vn(),as=n.useRef(!1),Hs=n.useCallback(async()=>{if(!u.trim()&&!Ce||!b||as.current||O.isPending||fe||Ue||Le)return;as.current=!0;const s=qs().map(i=>i.id),r=u.trim()||(s.length?" ":"");z(""),Ks(),ie.current&&(ie.current.style.height="60px"),M.mutate({id:b,message:r,attachmentIds:s,providerId:Oe??void 0},{onSuccess:()=>{ze()},onSettled:()=>{as.current=!1}})},[u,b,M,ze,Ce,Ue,qs,Ks,Oe,Le,O.isPending,fe]),Rt=n.useCallback(()=>{!b||O.isPending||O.mutate(b)},[b,O]),Tt=n.useCallback(s=>{const r=s.target.files;r&&r.length>0&&ee(Array.from(r)),s.target.value=""},[ee]),At=n.useCallback(s=>{const r=s.clipboardData.items,i=[];for(const p of r)if(p.kind==="file"){const N=p.getAsFile();N&&i.push(N)}i.length>0&&(s.preventDefault(),ee(i))},[ee]),[Qs,is]=n.useState(!1),Et=n.useCallback(s=>{s.preventDefault(),is(!0)},[]),Wt=n.useCallback(s=>{s.preventDefault(),is(!1)},[]),Pt=n.useCallback(s=>{s.preventDefault(),is(!1);const r=s.dataTransfer.files;r.length>0&&ee(Array.from(r))},[ee]),W=n.useCallback(s=>{const r=Cs.current?.getBoundingClientRect().width??(typeof window<"u"?window.innerWidth:void 0),i=r?Math.max(te,r-ps-dr-ur):te;return Math.max(te,Math.min(Math.round(s),i))},[]),ls=n.useCallback(s=>{const r=s.clientX-ys.current;le(W(ks.current-r))},[W]),cs=n.useCallback(()=>{js(!1),document.body.style.cursor="",document.body.style.userSelect=""},[]);n.useEffect(()=>{if(Pe)return document.addEventListener("mousemove",ls),document.addEventListener("mouseup",cs),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ls),document.removeEventListener("mouseup",cs),document.body.style.cursor="",document.body.style.userSelect=""}},[cs,ls,Pe]);const Dt=n.useCallback(s=>{s.preventDefault(),ys.current=s.clientX,ks.current=$e,js(!0)},[$e]);n.useEffect(()=>{!E||Pe||le(s=>W(s))},[W,E,Pe]),n.useEffect(()=>{if(!E)return;const s=()=>{le(r=>W(r))};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[W,E]);const Mt=n.useCallback(()=>{le(s=>W(s)),vs(!0),requestAnimationFrame(()=>{Ae.current?.setTab("review")})},[W]),Ot=n.useCallback(s=>{z(s.target.value);const r=s.target;r.style.height="auto";const i=r.scrollHeight;r.style.height=`${Math.max(60,Math.min(i,300))}px`},[]),$s=xe&&k?e.jsx(hn,{projectId:t?.projectId??"",workspaceId:k,branchName:ge,targetBranch:he,commitMessage:Es,changes:ft,gitStatus:T,isGitStatusLoading:pt,canRunGitOperations:me,onOpenChanges:Mt,onRefreshCommitMessage:Ds,onConflict:ye,className:"mb-1.5"}):null;return t?e.jsxs("div",{className:"flex-1 flex flex-col h-full bg-background relative overflow-hidden",children:[e.jsxs("div",{className:"px-6 py-3 flex items-center justify-between border-b border-border/60 bg-background z-20 flex-shrink-0",children:[e.jsxs("div",{className:"flex flex-col min-w-0 flex-1 mr-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${t.projectColor.replace("text-","bg-")}`}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.projectName}),t.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground shrink-0",children:t.projectRepoDeletedAt?o("源码已删除"):o("已删除")}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"/"}),e.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate",children:t.branch})]}),e.jsx(bn,{taskId:t.id,title:t.title,readOnly:x})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[e.jsx(pr,{status:t.status,onChangeStatus:!x&&d?s=>d(t.id,s):void 0}),e.jsx(Gn,{value:t.priority,onChange:!x&&C?s=>C(t.id,s):void 0}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:jt,disabled:!w||x,className:"w-8 h-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:o("Open in IDE"),children:e.jsx(nr,{size:16})}),(c||De)&&!x&&e.jsxs("div",{className:"relative",ref:Qe,children:[e.jsx("button",{onClick:()=>oe(s=>!s),className:"w-8 h-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",title:o("More actions"),children:e.jsx(vn,{size:16})}),Ve&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 w-44 bg-background rounded-lg border border-border shadow-popover z-50 py-1",children:[De&&e.jsxs("button",{onClick:()=>{S(!0),oe(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground/80 hover:bg-muted/50 transition-colors",children:[e.jsx(rt,{size:15}),e.jsx("span",{children:o("创建 TeamRun")})]}),e.jsxs("button",{onClick:()=>{V(!0),oe(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground/80 hover:bg-muted/50 transition-colors",children:[e.jsx(Yt,{size:15}),e.jsx("span",{children:o("重新开始")})]}),c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-1 border-t border-border/60"}),e.jsxs("button",{onClick:()=>{re(!0),oe(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive-ink hover:bg-destructive/10 transition-colors",children:[e.jsx(rr,{size:15}),e.jsx("span",{children:o("删除任务")})]})]})]})]})]})]})]}),!ue&&e.jsx(jn,{recovery:be,onRecover:s=>{G(s.sourceWorkspaceId),ye(s)}}),me&&k&&T&&e.jsx(ir,{workspaceId:k,gitStatus:T,onResolve:()=>ye()}),e.jsxs("div",{ref:Cs,className:"flex-1 flex overflow-hidden",children:[e.jsx("div",{className:"flex min-w-0 flex-1 flex-col bg-background relative",children:ue&&m?R?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-border px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:o("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:R})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(yn,{session:v,providers:J,usage:Vs,providerIdFallback:ut?.providerId,agentTypeFallback:v?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(ne,{type:"button",size:"sm",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-border/70 bg-background/60 px-2 text-xs font-medium text-muted-foreground hover:border-muted-foreground/40 hover:bg-muted hover:text-foreground",onClick:kt,children:[e.jsx(Jt,{size:13}),e.jsx("span",{children:o("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:U,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pt-6 pb-4",children:e.jsxs("div",{ref:gs,className:"w-full max-w-4xl mx-auto",children:[!m&&t&&e.jsx(et,{taskId:t.id}),Fs?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:o("Loading logs...")})]}):ke.length===0&&!b?e.jsx("div",{className:"text-muted-foreground text-center py-8",children:o(pe?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(st,{children:e.jsx(Zs,{logs:ke,sessionId:D,downloadSessionId:D,isOutputActive:Us,lastExitAt:_s,onUserToggleDetails:bs,workingDir:w,scrollElementRef:U,onOpenWorkspaceFile:Xe,onOpenPreviewUrl:Ss,onOpenVisualization:Rs})})]})}),!hs&&e.jsxs("button",{onClick:()=>We(),className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-muted-foreground hover:bg-background hover:text-foreground transition-all","aria-label":o("Scroll to bottom"),children:[e.jsx(Js,{size:14}),e.jsx("span",{children:o("回到底部")})]})]}),Fe.length>0&&e.jsx("div",{className:"px-6 pt-2 pb-1 bg-background flex-shrink-0 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(tt,{todos:Fe})})})]}):e.jsx(kn,{teamRun:m,messages:lt??m.messages??[],readOnly:x,readOnlyMessage:ss,onSendMessage:Ct,onViewInvocationSession:Bs,changeSummaryBar:$s,centered:!0,workingDir:w,onOpenWorkspaceFile:Xe,onOpenPreviewUrl:Ze,onOpenVisualization:es}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:U,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pt-6 pb-4",children:e.jsxs("div",{ref:gs,className:"w-full min-w-0 max-w-4xl mx-auto",children:[!m&&t&&e.jsx(et,{taskId:t.id}),(Is||$?.body)&&e.jsx("div",{className:"mb-4 pb-4 border-b border-border/60 min-w-0",children:Is?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:o("Loading...")}):$?.body?e.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed prose prose-sm max-w-none break-words overflow-hidden",children:e.jsx(on,{urlTransform:cr,components:an,children:$.body})}):null}),!x&&e.jsx(Cn,{state:ws,setupProgress:ce,sessionStarted:!!h?.startedAt,onRetry:X&&f?.status==="failed"?os:void 0},t.id),it?(!Ye||x)&&e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:o("Loading...")})]}):X?Fs?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:o("Loading logs...")})]}):ke.length===0&&!b?e.jsx("div",{className:"text-muted-foreground text-center py-8",children:o(pe?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(st,{children:e.jsx(Zs,{logs:ke,sessionId:D,downloadSessionId:D,isOutputActive:Us,lastExitAt:_s,onUserToggleDetails:bs,workingDir:w,scrollElementRef:U,onOpenWorkspaceFile:Xe,onOpenPreviewUrl:Ss,onOpenVisualization:Rs})}):!Ye||f?.status==="failed"||ce?.status==="failed"||x?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(!Ye||x)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-14 h-14 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-5",children:e.jsx(ms,{size:24,className:"text-muted-foreground/70 ml-0.5"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-1.5",children:o(x?"项目为只读历史":"尚未启动 Agent")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-xs",children:x?ss:o("选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。")})]}),!x&&(!f||f.status==="failed")&&e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[e.jsxs(ne,{onClick:os,disabled:!!(f&&f.status!=="failed"),children:[e.jsx(ms,{size:16,className:"mr-1.5"}),f?.status==="failed"?o("重试启动 Agent"):o("启动 Agent")]}),De&&e.jsxs(ne,{variant:"outline",onClick:()=>S(!0),children:[e.jsx(rt,{size:16,className:"mr-1.5"}),o("创建 TeamRun")]})]})]}):null]})}),!hs&&e.jsxs("button",{onClick:()=>We(),className:"absolute bottom-3 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 px-3 py-1.5 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-muted-foreground hover:bg-background hover:text-foreground transition-all","aria-label":o("Scroll to bottom"),children:[e.jsx(Js,{size:14}),e.jsx("span",{children:o("回到底部")})]})]}),Fe.length>0&&e.jsx("div",{className:"px-6 pt-2 pb-1 bg-background flex-shrink-0 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx(tt,{todos:Fe})})}),x?e.jsx("div",{className:"p-6 pt-3 bg-background flex-shrink-0 w-full z-10 pb-6 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsx("div",{className:"bg-muted/50 rounded-xl border border-border px-4 py-3 text-sm text-muted-foreground",children:ss})})}):mt?e.jsx("div",{className:"p-6 pt-3 bg-background flex-shrink-0 w-full z-10 pb-6 border-t border-border/60",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"flex items-center justify-between bg-muted/50 rounded-xl border border-border px-4 py-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:o("代码已合并,以上为历史沟通记录")}),e.jsxs(ne,{size:"sm",onClick:os,children:[e.jsx(ms,{size:14,className:"mr-1.5"}),o("启动新 Agent")]})]})})}):e.jsxs("div",{className:"p-6 pt-2 bg-background flex-shrink-0 w-full z-10 pb-6 border-t border-transparent",onDragOver:Et,onDragLeave:Wt,onDrop:Pt,children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[$s,b?e.jsx(Wn,{sessionId:b}):null,e.jsxs("div",{ref:He,className:`relative bg-background rounded-xl border hover:border-ring/40 focus-within:border-ring/60 transition-colors duration-200 ${Qs?"border-foreground/40 bg-foreground/[0.02]":"border-border"}`,children:[e.jsx(zn,{files:Nt,onRemove:It}),e.jsx("textarea",{ref:ie,value:u,onChange:Ot,onPaste:At,onKeyDown:s=>{q.handleKeyDown(s)||K.handleKeyDown(s)||s.key==="Enter"&&!s.shiftKey&&!s.repeat&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),Hs())},rows:1,placeholder:o(Qs?"Drop files here...":X&&!pe?"Continue conversation...":"Message Agent..."),className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-sm text-foreground placeholder-muted-foreground/70 leading-relaxed",style:{minHeight:"60px",maxHeight:"300px"}}),e.jsx("input",{ref:xs,type:"file",multiple:!0,className:"hidden",onChange:Tt}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("button",{onClick:()=>xs.current?.click(),className:"p-2 text-muted-foreground hover:text-muted-foreground hover:bg-muted rounded-lg transition-colors",title:o("Upload file"),children:e.jsx(or,{size:18})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[h&&J&&e.jsx(Pn,{providers:J,currentProviderId:Oe,agentType:h.agentType,runtimeType:h.runtimeType,onSelect:As}),e.jsx(Dn,{usage:Vs}),pe&&!M.isPending&&!u.trim()&&!Ce?e.jsx("button",{onClick:Rt,disabled:O.isPending||fe,"aria-label":o("Stop"),title:o("Stop"),className:"p-2 rounded-lg transition-all duration-200 bg-destructive-ink text-white hover:bg-destructive-ink/90 disabled:opacity-50",children:e.jsx(Zt,{size:14})}):e.jsx("button",{onClick:Hs,"aria-label":o(M.isPending?"发送中...":"Send"),"aria-busy":M.isPending,disabled:!u.trim()&&!Ce||Ue||M.isPending||O.isPending||fe||!!Le,className:`p-2 rounded-lg transition-all duration-200 ${(u.trim()||Ce)&&!Ue&&!M.isPending&&!O.isPending&&!fe&&!Le?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-transparent text-muted-foreground cursor-not-allowed"}`,children:M.isPending?e.jsx(en,{size:18,className:"animate-spin"}):e.jsx(sn,{size:18})})]})]})]})]}),e.jsx(nt,{open:K.query!==null,anchorRef:He,commands:K.filteredCommands,selectedIndex:K.selectedIndex,query:K.query??"",hasCatalog:K.allCommands.length>0,onSelect:K.applyCommand}),e.jsx(nt,{open:q.query!==null,anchorRef:He,commands:q.filteredSkills,selectedIndex:q.selectedIndex,query:q.query??"",hasCatalog:q.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",onSelect:q.applySkill})]})]})}),E&&e.jsx("div",{className:"w-1 cursor-col-resize hover:bg-border active:bg-ring/40 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",onMouseDown:Dt,role:"separator","aria-orientation":"vertical","aria-label":o("调整工作区宽度")}),e.jsx("div",{className:"flex h-full flex-shrink-0 bg-background",style:{width:E?ps+$e:ps},children:e.jsx(wn,{sessionId:X||void 0,workspaceId:_,workingDir:w,projectId:t.projectId,readOnly:x,repoDeleted:Ts,teamRun:m,teamStatus:m?e.jsx(Nn,{teamRun:m,workspaces:a,selectedWorkspaceId:_,onSelectWorkspace:G,onViewInvocationSession:Bs}):void 0,workspaces:a,selectedWorkspaceId:_,onSelectWorkspace:G,variant:"rail",expanded:E,onExpandedChange:s=>{s&&le(r=>W(r)),vs(s)},minContentWidth:te,tabRef:Ae,gitAvailable:Q,gitProps:me&&k?{branchName:ge,targetBranch:he,commitMessage:Es,canRunGitOperations:!0,onRefreshCommitMessage:Ds,onConflict:ye,onResolveConflicts:()=>ye()}:void 0})})]}),!x&&e.jsx(In,{isOpen:Re,onClose:()=>F(!1),taskId:t.id,projectId:t.projectId,taskTitle:$?.title??t.title,taskDescription:$?.body??"",taskPrompt:$?.prompt,projectIsGitRepo:t.isGitRepo,projectWorktreeReady:t.worktreeReady,projectGitReason:t.reason,onStarted:()=>I?.(t.id)}),De&&!x&&e.jsx(ar,{isOpen:Te,onClose:()=>S(!1),taskId:t.id}),Ws&&me&&Ps&&j&&e.jsx(Sn,{open:Ws,onOpenChange:s=>{s||be.closeDialog()},workspaceId:Ps,conflictOp:j.conflictOp,conflictedFiles:j.conflictedFiles,resolutionContextToken:j.resolutionContextToken,sourceBranch:ht,targetBranch:bt,operation:T?.operation,worktreePath:gt,mergeAborted:j.mergeAborted,mergeStrategy:j.mergeStrategy,sourceWorkspaceId:j.sourceWorkspaceId,targetWorkspaceId:j.targetWorkspaceId,sourceWorktreePath:j.sourceWorktreePath,targetWorktreePath:j.targetWorktreePath,sessions:xt,currentSessionId:ue?void 0:X,teamRunId:m?.id}),e.jsx(tr,{isOpen:qe,onClose:()=>V(!1),onConfirm:vt,title:o("重新开始任务"),description:e.jsx("p",{children:o("将归档当前工作区并自动在新 Worktree 中重新启动 Agent,旧工作区内容保留供参考。")}),confirmText:o("确认重试"),variant:"default",isLoading:at}),e.jsx(Tn,{isOpen:Ke,onClose:()=>re(!1),onConfirm:yt,taskId:t.id,taskTitle:t.title,workspaces:a,isLoading:P})]}):e.jsx(mr,{})}export{xo as TaskDetail};
@@ -0,0 +1 @@
1
+ import{u as Re,N as gt,O as bt,Q as ft,T as ht,U as vt,V as jt,W as yt,Y as Pt,r as i,j as e,Z as Nt,i as Ee,_ as kt,k as Tt,n as B,w as Ae,B as p,G as _e,t as c,$ as wt}from"./index-BR3Wg2fS.js";import{C as Fe}from"./confirm-dialog-CL_1pF4K.js";import{M as Ct}from"./modal-D496f1fE.js";import{S as R}from"./select-CzZNbe1Z.js";import"./mermaid-NOHMQCX5-CG_LpwAI.js";import{i as It}from"./provider-selection-DSu7SCI7.js";import"./AttachmentPreview-CFJ6MZ1f.js";import{M as U}from"./MemberAvatar-BVXD0jTy.js";import{u as St}from"./use-providers-CQwBj9hp.js";import{T as ue,P as D}from"./trash-2-5jI3_KHh.js";import{C as Mt}from"./chevron-up-BWtKfdKT.js";import{C as Et}from"./chevron-down-BoS08pMa.js";import"./dialog-1o8KQWoQ.js";import"./index-DVdiOmqt.js";import"./select-Cw5BaOLQ.js";import"./menu-styles-DWynpVVz.js";import"./check-D_VFGpIy.js";import"./index-DSy5JLC1.js";import"./index-hHrknzh7.js";import"./index-C1lMEjmZ.js";import"./index-cu8sedJH.js";import"./use-translation-settings-DBzFqP-d.js";import"./copy-C4WnOY6Y.js";import"./index-Da2mWAtm.js";import"./tooltip-C8--8CNX.js";import"./kbd-Cl4AzzJp.js";import"./people-CbmH8m4i.js";const o="/avatars/presets",At=[{id:"developer",label:"Developer",src:`${o}/avatar-preset-01-developer.png`},{id:"architect",label:"Architect",src:`${o}/avatar-preset-02-architect.png`},{id:"tester",label:"Tester",src:`${o}/avatar-preset-03-tester.png`},{id:"devops",label:"DevOps",src:`${o}/avatar-preset-04-devops.png`},{id:"data-scientist",label:"Data scientist",src:`${o}/avatar-preset-05-data-scientist.png`},{id:"frontend",label:"Frontend",src:`${o}/avatar-preset-06-frontend.png`},{id:"backend",label:"Backend",src:`${o}/avatar-preset-07-backend.png`},{id:"security",label:"Security",src:`${o}/avatar-preset-08-security.png`},{id:"project-manager",label:"Project manager",src:`${o}/avatar-preset-09-project-manager.png`},{id:"product-manager",label:"Product manager",src:`${o}/avatar-preset-10-product-manager.png`},{id:"scrum-master",label:"Scrum master",src:`${o}/avatar-preset-11-scrum-master.png`},{id:"tech-lead",label:"Tech lead",src:`${o}/avatar-preset-12-tech-lead.png`},{id:"coordinator",label:"Coordinator",src:`${o}/avatar-preset-13-coordinator.png`},{id:"mentor",label:"Mentor",src:`${o}/avatar-preset-14-mentor.png`},{id:"reviewer",label:"Reviewer",src:`${o}/avatar-preset-15-reviewer.png`},{id:"ui-designer",label:"UI designer",src:`${o}/avatar-preset-16-ui-designer.png`},{id:"ux-researcher",label:"UX researcher",src:`${o}/avatar-preset-17-ux-researcher.png`},{id:"documenter",label:"Documenter",src:`${o}/avatar-preset-18-documenter.png`},{id:"translator",label:"Translator",src:`${o}/avatar-preset-19-translator.png`},{id:"analyst",label:"Analyst",src:`${o}/avatar-preset-20-analyst.png`},{id:"consultant",label:"Consultant",src:`${o}/avatar-preset-21-consultant.png`},{id:"creative-director",label:"Creative director",src:`${o}/avatar-preset-22-creative-director.png`},{id:"support",label:"Support",src:`${o}/avatar-preset-23-support.png`},{id:"assistant",label:"Assistant",src:`${o}/avatar-preset-24-assistant.png`},{id:"robot",label:"Robot",src:`${o}/avatar-preset-25-robot.png`}],De=wt(),_t=2*1024*1024,Ft=[],$t=[],Ot=[],ze=[{key:"readRoom",label:"读房间"},{key:"postRoomMessage",label:"发房间消息"},{key:"mentionMembers",label:"提及成员"},{key:"stopMemberWork",label:"停止成员工作"},{key:"markReadyForReview",label:"标记可审查"},{key:"readFiles",label:"读文件"},{key:"writeFiles",label:"写文件"},{key:"runCommands",label:"运行命令"},{key:"readDiff",label:"读 diff"},{key:"mergeWorkspace",label:"合并工作区"}],Le={readRoom:!1,postRoomMessage:!1,mentionMembers:!1,stopMemberWork:!1,markReadyForReview:!1,readFiles:!1,writeFiles:!1,runCommands:!1,readDiff:!1,mergeWorkspace:!1},$e=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],Rt=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],Dt=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],zt=[{value:"own_only",label:"仅自己队列"},{value:"team_pending",label:"全队列待处理"}];function Y(){return{name:"",aliasesText:"",providerId:"",rolePrompt:"",capabilities:{...Le},workspacePolicy:"none",triggerPolicy:"MENTION_ONLY",sessionPolicy:"new_per_request",queueManagementPolicy:"own_only",avatar:""}}function xe(r){return{name:r.name,aliasesText:r.aliases.join(", "),providerId:r.providerId,rolePrompt:r.rolePrompt,capabilities:{...Le,...r.capabilities},workspacePolicy:r.workspacePolicy,triggerPolicy:r.triggerPolicy,sessionPolicy:r.sessionPolicy,queueManagementPolicy:r.queueManagementPolicy,avatar:r.avatar??""}}function q(){return{name:"",heartbeatTimeoutMinutes:10,memberPresetIds:[]}}function pe(r){return{name:r.name,heartbeatTimeoutMinutes:r.heartbeatTimeoutMinutes??10,memberPresetIds:r.members?.map(l=>l.memberPresetId)??[]}}function Lt(r,l,d,m){if(d.filter(_=>_===m).length<=1)return r;const W=d.slice(0,l+1).filter(_=>_===m).length;return`${r} #${W}`}function Bt(r){return Array.from(new Set(r.split(/[\n,]/).map(l=>l.trim()).filter(Boolean)))}function Ut(r){return r.trim()||null}function Oe(r){return ze.reduce((l,d)=>l+(r[d.key]?1:0),0)}function A(r,l){return r instanceof Error?r.message:l}function Yt(r){return["image/png","image/jpeg","image/webp"].includes(r.type)}async function qt(r){const l=new FormData;l.append("file",r);const d=await fetch(`${De}/attachments/upload`,{method:"POST",body:l});if(!d.ok){const m=await d.json().catch(()=>({}));throw new Error(m.error||m.message||`Upload failed (${d.status})`)}return d.json()}function G({title:r,error:l,isFetching:d,onRetry:m}){const{t:T}=Re();return e.jsx("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive-ink",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium",children:r}),e.jsx("div",{className:"mt-1 text-xs text-destructive-ink",children:A(l,T("请稍后重试。"))})]}),e.jsx(p,{type:"button",size:"sm",variant:"outline",onClick:m,disabled:d,children:T(d?"加载中...":"重试")})]})})}function hr(){const{t:r}=Re(),{data:l,error:d,isError:m,isFetching:T,isLoading:W,refetch:_}=St(),{data:Be,error:ge,isError:w,isFetching:be,isLoading:V,refetch:fe}=gt(),{data:Ue,error:Ye,isError:z,isFetching:qe,isLoading:Q,refetch:Ge}=bt(),H=ft(),X=ht(),he=vt(),J=jt(),K=yt(),ve=Pt(),[Z,je]=i.useState("presets"),[C,ee]=i.useState("edit"),[h,te]=i.useState(null),[a,j]=i.useState(Y()),[ye,F]=i.useState(!1),[y,re]=i.useState(null),[We,se]=i.useState(!1),[Pe,Ne]=i.useState(!1),ke=i.useRef(null),[I,ae]=i.useState("edit"),[v,ne]=i.useState(null),[g,b]=i.useState(q()),[Te,P]=i.useState(!1),[N,oe]=i.useState(null),[we,$]=i.useState(!1),u=Be??Ft,f=Ue??$t,S=l??Ot,O=i.useMemo(()=>new Map(u.map(t=>[t.id,t])),[u]),ie=i.useMemo(()=>new Map(f.map(t=>[t.id,t])),[f]),Ve=i.useMemo(()=>{const t=S.filter(It).map(({provider:s,availability:n})=>({value:s.id,label:s.name+(n.type==="NOT_FOUND"?r(" (不可用)"):""),icon:e.jsx(Nt,{agentType:s.agentType,className:"size-4"}),disabled:n.type==="NOT_FOUND"}));return a.providerId&&!S.some(s=>s.provider.id===a.providerId)&&!t.some(s=>s.value===a.providerId)&&t.unshift({value:a.providerId,label:`${a.providerId}${r(" (不可用)")}`,disabled:!0}),t},[a.providerId,S,r]),le=h?O.get(h)??null:null,de=v?ie.get(v)??null:null,Qe=i.useMemo(()=>new Map(S.map(({provider:t,availability:s})=>[t.id,t.name+(s.type==="NOT_FOUND"?r(" (不可用)"):"")])),[S,r]);if(i.useEffect(()=>{if(!(V||w||ye)){if(C==="create"){j(Y());return}if(h){const t=O.get(h);t&&j(xe(t));return}if(u.length>0){const t=u[0];te(t.id),ee("edit"),j(xe(t));return}ee("create"),te(null),j(Y())}},[O,ye,C,u,w,V,h]),i.useEffect(()=>{if(!(Q||z||Te)){if(I==="create"){b(q());return}if(v){const t=ie.get(v);t&&b(pe(t));return}if(f.length>0){const t=f[0];ne(t.id),ae("edit"),b(pe(t));return}ae("create"),ne(null),b(q())}},[v,ie,Te,I,f,z,Q]),W||V||Q)return e.jsx(Ee,{className:"max-w-6xl",children:e.jsx(kt,{cards:6})});const x=(t,s)=>{j(n=>({...n,[t]:s})),F(!0)},He=(t,s)=>{j(n=>({...n,capabilities:{...n.capabilities,[t]:s}})),F(!0)},Xe=t=>{x("avatar",t),se(!1)},Je=()=>{x("avatar","")},Ke=async t=>{const s=t.target.files?.[0];if(t.target.value="",!!s){if(!Yt(s)){c.error(r("仅支持 PNG、JPG、WebP 头像。"));return}if(s.size>_t){c.error(r("头像图片不能超过 2MB。"));return}Ne(!0);try{const n=await qt(s);x("avatar",`${De}${n.url}`),c.success(r("头像已上传"))}catch(n){c.error(A(n,r("头像上传失败")))}finally{Ne(!1)}}},M=(t,s)=>{ee(t),te(s?.id??null),j(s?xe(s):Y()),F(!1)},Ce=(t,s)=>{b(n=>({...n,[t]:s})),P(!0)},E=(t,s)=>{ae(t),ne(s?.id??null),b(s?pe(s):q()),P(!1)},Ze=async()=>{const t={name:a.name.trim(),aliases:Bt(a.aliasesText),providerId:a.providerId.trim(),rolePrompt:a.rolePrompt.trim(),capabilities:{...a.capabilities},workspacePolicy:a.workspacePolicy,triggerPolicy:a.triggerPolicy,sessionPolicy:a.sessionPolicy,queueManagementPolicy:a.queueManagementPolicy,avatar:Ut(a.avatar)};try{if(C==="create"||!h){const s=await H.mutateAsync(t);M("edit",s),c.success(r("已创建"))}else{const s=await X.mutateAsync({id:h,data:t});M("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},et=async()=>{if(y)try{await he.mutateAsync(y.id),c.success(r("Deleted"));const t=u.filter(s=>s.id!==y.id);h===y.id&&(t.length>0?M("edit",t[0]):M("create",null)),re(null)}catch(t){c.error(A(t,r("删除失败")))}},tt=async()=>{const t={name:g.name.trim(),heartbeatTimeoutMinutes:g.heartbeatTimeoutMinutes,memberPresetIds:g.memberPresetIds};try{if(I==="create"||!v){const s=await J.mutateAsync(t);E("edit",s),c.success(r("已创建"))}else{const s=await K.mutateAsync({id:v,data:t});E("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},rt=async()=>{if(N)try{await ve.mutateAsync(N.id),c.success(r("Deleted"));const t=f.filter(s=>s.id!==N.id);v===N.id&&(t.length>0?E("edit",t[0]):E("create",null)),oe(null)}catch(t){c.error(A(t,r("删除失败")))}},st=Oe(a.capabilities),at=!!a.name.trim()&&!!a.providerId.trim()&&!!a.rolePrompt.trim()&&!m&&!w&&!H.isPending&&!X.isPending,nt=!!g.name.trim()&&!z&&!w&&!J.isPending&&!K.isPending,ce=g.memberPresetIds.map(t=>O.get(t)).filter(t=>!!t),ot=t=>{F(!1),M("edit",t)},it=()=>{F(!1),M("create",null)},lt=t=>{P(!1),E("edit",t)},dt=()=>{P(!1),E("create",null)},ct=t=>{b(s=>({...s,memberPresetIds:[...s.memberPresetIds,t]})),P(!0)},mt=t=>{b(s=>({...s,memberPresetIds:s.memberPresetIds.filter((n,k)=>k!==t)})),P(!0)},Ie=(t,s)=>{b(n=>{const k=t+s;if(k<0||k>=n.memberPresetIds.length)return n;const me=[...n.memberPresetIds],[pt]=me.splice(t,1);return me.splice(k,0,pt),{...n,memberPresetIds:me}}),P(!0)},ut=t=>{ot(t),$(!0)},Se=()=>{it(),$(!0)},xt=t=>{lt(t),$(!0)},Me=()=>{dt(),$(!0)},L=()=>$(!1);return e.jsxs(Ee,{className:"max-w-6xl",children:[e.jsx(Tt,{title:r("团队协作设置"),actions:e.jsxs("div",{className:"inline-flex rounded-lg border border-border bg-muted/80 p-0.5",children:[e.jsx("button",{type:"button",onClick:()=>{je("presets"),L()},className:B("rounded-md px-3 py-1.5 text-[12px] font-medium transition-all",Z==="presets"?"bg-background text-foreground shadow-raised":"text-muted-foreground hover:text-foreground"),children:r("成员预设")}),e.jsx("button",{type:"button",onClick:()=>{je("templates"),L()},className:B("rounded-md px-3 py-1.5 text-[12px] font-medium transition-all",Z==="templates"?"bg-background text-foreground shadow-raised":"text-muted-foreground hover:text-foreground"),children:r("团队模板")})]})}),m&&e.jsx(G,{title:r("Provider 列表加载失败"),error:d,isFetching:T,onRetry:()=>{_()}}),Z==="presets"?we?e.jsxs("div",{className:"rounded-xl border border-border bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Ae,{size:14}),r("返回")]}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:C==="create"?r("创建新预设"):le?.name??r("编辑预设")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[C==="edit"&&le&&e.jsx("button",{onClick:()=>re(le),className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:r("删除"),children:e.jsx(ue,{size:14})}),e.jsx(p,{size:"sm",onClick:Ze,disabled:!at,children:H.isPending||X.isPending?r("保存中..."):r(C==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("div",{className:"shrink-0",children:[e.jsx(U,{name:a.name||r("Agent"),avatar:a.avatar,className:"h-14 w-14 text-sm"}),e.jsxs("div",{className:"flex justify-center gap-1 mt-2",children:[e.jsx("button",{type:"button",onClick:()=>se(!0),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r("选择")}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),e.jsx("button",{type:"button",onClick:()=>ke.current?.click(),disabled:Pe,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r(Pe?"...":"上传")}),a.avatar.trim()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"·"}),e.jsx("button",{type:"button",onClick:Je,className:"text-xs text-muted-foreground hover:text-destructive-ink transition-colors",children:r("清除")})]})]}),e.jsx("input",{ref:ke,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:Ke})]}),e.jsxs("div",{className:"flex-1 min-w-0 grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("名称")}),e.jsx("input",{value:a.name,onChange:t=>x("name",t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("别名")}),e.jsx("input",{value:a.aliasesText,onChange:t=>x("aliasesText",t.target.value),placeholder:r("alice, a, reviewer"),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("Provider")}),e.jsx(R,{value:a.providerId,onChange:t=>x("providerId",t),options:Ve,placeholder:S.find(t=>t.provider.id===a.providerId)?.provider.name,disabled:m}),m&&e.jsx("p",{className:"mt-1 text-xs text-destructive-ink",children:r("Provider 列表加载失败。")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("角色提示词")}),e.jsx("textarea",{value:a.rolePrompt,onChange:t=>x("rolePrompt",t.target.value),rows:4,className:"w-full rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-y"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-end justify-between gap-3 mb-2",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted-foreground",children:r("可用能力")}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[st,"/10"]})]}),e.jsx("div",{className:"grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:ze.map(t=>e.jsxs("label",{className:"flex items-center gap-2 rounded px-2.5 py-1.5 text-[12px] text-foreground hover:bg-muted transition-colors cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a.capabilities[t.key],onChange:s=>He(t.key,s.target.checked),className:"h-3.5 w-3.5 rounded border-border"}),e.jsx("span",{children:r(t.label)})]},t.key))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("工作区")}),e.jsx(R,{value:a.workspacePolicy,onChange:t=>x("workspacePolicy",t),options:$e.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("触发")}),e.jsx(R,{value:a.triggerPolicy,onChange:t=>x("triggerPolicy",t),options:Rt.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("会话")}),e.jsx(R,{value:a.sessionPolicy,onChange:t=>x("sessionPolicy",t),options:Dt.map(t=>({value:t.value,label:r(t.label)}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("队列")}),e.jsx(R,{value:a.queueManagementPolicy,onChange:t=>x("queueManagementPolicy",t),options:zt.map(t=>({value:t.value,label:r(t.label)}))})]})]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r("{count} 个成员预设",{count:u.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Se,children:[e.jsx(D,{size:13})," ",r("新增预设")]})]}),w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx(_e,{message:r("暂无成员预设"),action:e.jsxs(p,{size:"sm",onClick:Se,children:[e.jsx(D,{size:13,className:"mr-1"})," ",r("新增预设")]})}):e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:u.map(t=>{const s=Oe(t.capabilities);return e.jsxs("button",{type:"button",onClick:()=>ut(t),className:"flex items-start gap-3 rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-raised",children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-10 w-10 text-xs shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),t.aliases.length>0&&e.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:t.aliases.join(", ")}),e.jsx("div",{className:"truncate text-xs text-muted-foreground mt-1",children:Qe.get(t.providerId)??t.providerId}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 mt-2",children:[e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:r($e.find(n=>n.value===t.workspacePolicy)?.label??t.workspacePolicy)}),e.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:[s,"/10 ",r("能力")]})]})]})]},t.id)})})]}):we?e.jsxs("div",{className:"rounded-xl border border-border bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border/60 px-5 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Ae,{size:14}),r("返回")]}),e.jsx("span",{className:"text-muted-foreground",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:I==="create"?r("创建新模板"):de?.name??r("编辑模板")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[I==="edit"&&de&&e.jsx("button",{onClick:()=>oe(de),className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors",title:r("删除"),children:e.jsx(ue,{size:14})}),e.jsx(p,{size:"sm",onClick:tt,disabled:!nt,children:J.isPending||K.isPending?r("保存中..."):r(I==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("模板名称")}),e.jsx("input",{value:g.name,onChange:t=>Ce("name",t.target.value),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("成员心跳检测时间(分钟)")}),e.jsx("input",{type:"number",min:1,max:120,step:1,value:g.heartbeatTimeoutMinutes,onChange:t=>Ce("heartbeatTimeoutMinutes",Math.min(120,Math.max(1,Number(t.target.value)||1))),className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm transition-colors focus:border-ring focus:outline-none"})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-2",children:r("可用预设")}),e.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto scrollbar-app-thin",children:w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center text-[12px] text-muted-foreground",children:r("先创建成员预设")}):u.map(t=>{const s=g.memberPresetIds.filter(n=>n===t.id).length;return e.jsxs("button",{type:"button",onClick:()=>ct(t.id),className:B("flex w-full items-center gap-2.5 rounded-lg border px-3 py-2 text-left transition-all",s>0?"border-foreground bg-muted":"border-border bg-background hover:border-border"),children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-7 w-7 text-[10px] shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:t.name})}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s>0&&e.jsxs("span",{className:"rounded-full bg-primary px-1.5 py-0.5 text-[11px] font-medium text-primary-foreground",children:["x",s]}),e.jsx(D,{size:13,className:"text-muted-foreground"})]})]},t.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-2",children:r("已选成员")}),e.jsx("div",{className:"max-h-[400px] space-y-1 overflow-y-auto scrollbar-app-thin",children:ce.length===0?e.jsx("div",{className:"rounded-lg border border-dashed border-border p-3 text-center text-[12px] text-muted-foreground",children:r("尚未选择")}):ce.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(U,{name:t.name,avatar:t.avatar,className:"h-7 w-7 text-[10px] shrink-0"}),e.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:Lt(t.name,s,g.memberPresetIds,t.id)})]}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ie(s,-1),disabled:s===0,children:e.jsx(Mt,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ie(s,1),disabled:s===ce.length-1,children:e.jsx(Et,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>mt(s),children:e.jsx(ue,{size:13})})]})]},`${t.id}-${s}`))})]})]})]})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r("{count} 个团队模板",{count:f.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Me,children:[e.jsx(D,{size:13})," ",r("新增模板")]})]}),z?e.jsx(G,{title:r("加载失败"),error:Ye,isFetching:qe,onRetry:()=>{Ge()}}):f.length===0?e.jsx(_e,{message:r("暂无团队模板"),action:e.jsxs(p,{size:"sm",onClick:Me,children:[e.jsx(D,{size:13,className:"mr-1"})," ",r("新增模板")]})}):e.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:f.map(t=>{const s=t.members?.length??0,n=(t.members??[]).slice(0,3).map(k=>O.get(k.memberPresetId)?.name).filter(Boolean);return e.jsxs("button",{type:"button",onClick:()=>xt(t),className:"flex flex-col rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-raised",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:r("{count} 个成员",{count:s})}),n.length>0&&e.jsxs("div",{className:"truncate text-xs text-muted-foreground mt-1.5",children:[n.join(", "),s>3?` +${s-3}`:""]})]},t.id)})})]}),e.jsx(Fe,{isOpen:!!y,onClose:()=>re(null),onConfirm:et,title:r("删除"),description:y?r('确定删除 "{name}"?此操作不可撤销。',{name:y.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:he.isPending}),e.jsx(Ct,{isOpen:We,onClose:()=>se(!1),title:r("选择预设头像"),className:"max-w-2xl",children:e.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-5",children:At.map(t=>{const s=a.avatar===t.src;return e.jsxs("button",{type:"button",onClick:()=>Xe(t.src),className:B("group rounded-xl border bg-background p-2 text-center transition-all hover:border-foreground/20 hover:bg-muted focus:outline-none focus:ring-2 focus:ring-ring/60",s?"border-foreground ring-2 ring-foreground":"border-border"),"aria-pressed":s,"aria-label":r("选择 {name} 头像",{name:t.label}),children:[e.jsx("img",{src:t.src,alt:t.label,loading:"lazy",className:"mx-auto h-14 w-14 rounded-full object-cover sm:h-16 sm:w-16"}),e.jsx("span",{className:"mt-1 block truncate text-xs font-medium text-muted-foreground",children:t.label})]},t.id)})})}),e.jsx(Fe,{isOpen:!!N,onClose:()=>oe(null),onConfirm:rt,title:r("删除"),description:N?r('确定删除 "{name}"?此操作不可撤销。',{name:N.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:ve.isPending})]})}export{hr as TeamSettingsPage};