agent-tower 0.7.2-beta.6 → 0.7.2-beta.7

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 (195) hide show
  1. package/dist/web/assets/AgentDemoPage-CaR_Yk9_.js +1 -0
  2. package/dist/web/assets/{AgentEnvironmentSettingsPage-BnWVgvNe.js → AgentEnvironmentSettingsPage-SnxiaHvN.js} +1 -1
  3. package/dist/web/assets/BranchSelect-D-kqavDG.js +1 -0
  4. package/dist/web/assets/BrandLogo-CC1alVsd.js +1 -0
  5. package/dist/web/assets/ConversationPage-RWKLxe1j.js +3 -0
  6. package/dist/web/assets/CreateTaskInput-SHJ1YpRe.js +1 -0
  7. package/dist/web/assets/{DemoPage-BwX2SvcN.js → DemoPage-BHbnnZFF.js} +1 -1
  8. package/dist/web/assets/DesignSystemPage-ChCrzeKT.js +12 -0
  9. package/dist/web/assets/EditableTaskTitle-CGVeZUSt.js +70 -0
  10. package/dist/web/assets/{ExecutionPermissionSelector-DeeNd4Kh.js → ExecutionPermissionSelector-DcC4IBOF.js} +10 -10
  11. package/dist/web/assets/GeneralSettingsPage-C_tkwpmF.js +1 -0
  12. package/dist/web/assets/{LoadingPreviewPage-BxEFnEQh.js → LoadingPreviewPage-dE_jyl19.js} +1 -1
  13. package/dist/web/assets/McpSettingsPage-CIuQ4bvy.js +1 -0
  14. package/dist/web/assets/MemberAvatar-BG0VDZKf.js +1 -0
  15. package/dist/web/assets/MobileTaskDetail-DxE6ZDAS.js +5 -0
  16. package/dist/web/assets/NotificationSettingsPage-B-Ot2OMg.js +1 -0
  17. package/dist/web/assets/ProfileSettingsPage-Dn1lrjJr.js +3 -0
  18. package/dist/web/assets/ProjectKanbanPage-jcW8sA7x.js +12 -0
  19. package/dist/web/assets/ProjectSettingsPage-BFPty2eA.js +2 -0
  20. package/dist/web/assets/ProviderSettingsPage-DLq-GBxp.js +67 -0
  21. package/dist/web/assets/SettingsMasterDetail-UfyoKAum.js +1 -0
  22. package/dist/web/assets/TaskDetail-a1jalILy.js +3 -0
  23. package/dist/web/assets/TeamSettingsPage-BxGc4W7K.js +1 -0
  24. package/dist/web/assets/{arc-Bm_QIbJA.js → arc-dhk0OSs5.js} +1 -1
  25. package/dist/web/assets/{architectureDiagram-3BPJPVTR-B5EIiXuX.js → architectureDiagram-3BPJPVTR-BCNj6ZWE.js} +1 -1
  26. package/dist/web/assets/{at-sign-BE17rU5b.js → at-sign-C4VhWike.js} +1 -1
  27. package/dist/web/assets/{blockDiagram-GPEHLZMM-GFwnvSLM.js → blockDiagram-GPEHLZMM-D1kmB9gz.js} +1 -1
  28. package/dist/web/assets/{c4Diagram-AAUBKEIU-iJfLTxEa.js → c4Diagram-AAUBKEIU-DbWKTkSe.js} +1 -1
  29. package/dist/web/assets/channel-K0AG6Tl1.js +1 -0
  30. package/dist/web/assets/check-DYlb0A_N.js +1 -0
  31. package/dist/web/assets/{chevron-up-D0y6skqr.js → chevron-up-DOkDFvIc.js} +1 -1
  32. package/dist/web/assets/{chunk-2J33WTMH-CDxRPp-8.js → chunk-2J33WTMH-B3TA0-LD.js} +1 -1
  33. package/dist/web/assets/{chunk-4BX2VUAB-mzPbgyiz.js → chunk-4BX2VUAB-CvPTiBSV.js} +1 -1
  34. package/dist/web/assets/{chunk-55IACEB6-KNAJbQyw.js → chunk-55IACEB6-xGe9Fu9Z.js} +1 -1
  35. package/dist/web/assets/{chunk-727SXJPM-BqGfqkDK.js → chunk-727SXJPM-H8pz3amK.js} +1 -1
  36. package/dist/web/assets/{chunk-AQP2D5EJ-D27ue-H0.js → chunk-AQP2D5EJ-BmYYNxcL.js} +1 -1
  37. package/dist/web/assets/{chunk-FMBD7UC4-DRza-3q8.js → chunk-FMBD7UC4-BmOEsLTE.js} +1 -1
  38. package/dist/web/assets/{chunk-ND2GUHAM-CUgkviLu.js → chunk-ND2GUHAM-C5MfA0xc.js} +1 -1
  39. package/dist/web/assets/{chunk-QZHKN3VN-BAlOJwZb.js → chunk-QZHKN3VN-BcrGYZ7V.js} +1 -1
  40. package/dist/web/assets/classDiagram-4FO5ZUOK-BTJ44hwx.js +1 -0
  41. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BTJ44hwx.js +1 -0
  42. package/dist/web/assets/code-block-OCS4YCEC-DLPrDBDy.js +2 -0
  43. package/dist/web/assets/confirm-dialog-BRkrtULz.js +1 -0
  44. package/dist/web/assets/content-DPCGELMz.js +2 -0
  45. package/dist/web/assets/{copy-DejkmIHZ.js → copy-CdzVE3kf.js} +1 -1
  46. package/dist/web/assets/{cose-bilkent-S5V4N54A-8TBY7BP_.js → cose-bilkent-S5V4N54A-CLQ-m71G.js} +1 -1
  47. package/dist/web/assets/cssMode-ChMyv9Nj.js +1 -0
  48. package/dist/web/assets/{dagre-BM42HDAG-CkMzDiim.js → dagre-BM42HDAG-CmDqxOfn.js} +1 -1
  49. package/dist/web/assets/{diagram-2AECGRRQ-CAOQJ2N1.js → diagram-2AECGRRQ-D-fSbEll.js} +1 -1
  50. package/dist/web/assets/{diagram-5GNKFQAL-DKhE0hiI.js → diagram-5GNKFQAL-HPywThAf.js} +1 -1
  51. package/dist/web/assets/{diagram-KO2AKTUF-DBdkXSpa.js → diagram-KO2AKTUF-DAzLhllz.js} +1 -1
  52. package/dist/web/assets/{diagram-LMA3HP47-DRi2t32c.js → diagram-LMA3HP47-DXYB9h8L.js} +1 -1
  53. package/dist/web/assets/{diagram-OG6HWLK6-DtP92tI1.js → diagram-OG6HWLK6-vv4kz4Zo.js} +1 -1
  54. package/dist/web/assets/dialog-B_vC5R4B.js +5 -0
  55. package/dist/web/assets/{erDiagram-TEJ5UH35-DWFKXtst.js → erDiagram-TEJ5UH35-Cu6aVKAa.js} +1 -1
  56. package/dist/web/assets/{flowDiagram-I6XJVG4X-LDE0h4ri.js → flowDiagram-I6XJVG4X-BKDe8WSQ.js} +1 -1
  57. package/dist/web/assets/{freemarker2-CLksOOZX.js → freemarker2-DI2giuAo.js} +2 -2
  58. package/dist/web/assets/{ganttDiagram-6RSMTGT7-DD2RfdyV.js → ganttDiagram-6RSMTGT7-DMVLzmAE.js} +1 -1
  59. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DkKrR8ex.js → gitGraphDiagram-PVQCEYII-vogzYdKn.js} +1 -1
  60. package/dist/web/assets/{globe-CD4g63c9.js → globe-Rnn-nKw-.js} +1 -1
  61. package/dist/web/assets/handlebars-B9tmKQPV.js +1 -0
  62. package/dist/web/assets/hooks-DK4m7-FN.js +1 -0
  63. package/dist/web/assets/html-B_E2U0g5.js +1 -0
  64. package/dist/web/assets/htmlMode-DRHM_Cwq.js +1 -0
  65. package/dist/web/assets/icon-button-CuSuXgr_.js +1 -0
  66. package/dist/web/assets/index-B6Lvy5Sr.js +1 -0
  67. package/dist/web/assets/{index-D_QVcsLn.js → index-B88xAivn.js} +4 -4
  68. package/dist/web/assets/index-BCV57B4O.js +41 -0
  69. package/dist/web/assets/index-CMjLMilU.js +1 -0
  70. package/dist/web/assets/index-CTG-4w90.js +1 -0
  71. package/dist/web/assets/index-Cz73HpYH.js +122 -0
  72. package/dist/web/assets/index-CzvAGoau.css +1 -0
  73. package/dist/web/assets/index-DENY_U7o.js +1 -0
  74. package/dist/web/assets/index-ZO2tqdha.js +1 -0
  75. package/dist/web/assets/{infoDiagram-5YYISTIA-BdPA9Xfi.js → infoDiagram-5YYISTIA-CEfSHkNq.js} +1 -1
  76. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-220u4uiv.js → ishikawaDiagram-YF4QCWOH-BXKZuWtD.js} +1 -1
  77. package/dist/web/assets/javascript-ClWqjgn3.js +1 -0
  78. package/dist/web/assets/{journeyDiagram-JHISSGLW-BvE0Y3tZ.js → journeyDiagram-JHISSGLW-wsOUYlu7.js} +1 -1
  79. package/dist/web/assets/{jsonMode-Dz0hnnvg.js → jsonMode-DVAoDfae.js} +2 -2
  80. package/dist/web/assets/{kanban-definition-UN3LZRKU-Q0JH1P6D.js → kanban-definition-UN3LZRKU-DNsuvOrU.js} +1 -1
  81. package/dist/web/assets/kbd-B3m64lRd.js +1 -0
  82. package/dist/web/assets/{key-round-DZm1FLLr.js → key-round-DpYSyeDH.js} +1 -1
  83. package/dist/web/assets/{layers-Dda7MM7a.js → layers-CxqMQVmH.js} +1 -1
  84. package/dist/web/assets/{linear-Dr6SfnSn.js → linear-BmmCZdOQ.js} +1 -1
  85. package/dist/web/assets/{link-BUeSP3T7.js → link-DbSpzB1w.js} +1 -1
  86. package/dist/web/assets/liquid-CZf3xdoq.js +1 -0
  87. package/dist/web/assets/{lspLanguageFeatures-Bbp4PWlJ.js → lspLanguageFeatures-WhdC7zdf.js} +1 -1
  88. package/dist/web/assets/mdx-xzVEPP01.js +1 -0
  89. package/dist/web/assets/menu-0A0v_lRV.js +1 -0
  90. package/dist/web/assets/menu-styles-DWynpVVz.js +1 -0
  91. package/dist/web/assets/{mermaid-NOHMQCX5-C72362la.js → mermaid-NOHMQCX5-DmKVQY9m.js} +55 -55
  92. package/dist/web/assets/{message-square-CFriSt4D.js → message-square-CfNb-MTd.js} +1 -1
  93. package/dist/web/assets/{mindmap-definition-RKZ34NQL-bvDaNfKs.js → mindmap-definition-RKZ34NQL-0RzXjZ9G.js} +1 -1
  94. package/dist/web/assets/modal-Kpqn-nDO.js +1 -0
  95. package/dist/web/assets/{monaco-BuDK9Fat.js → monaco-I1fXAMIt.js} +3 -3
  96. package/dist/web/assets/{paperclip-BOSklTt7.js → paperclip-BBrzKZQC.js} +1 -1
  97. package/dist/web/assets/{pencil-BRQ9W_a-.js → pencil-pzVKblxj.js} +1 -1
  98. package/dist/web/assets/people-C6b3eeLq.js +1 -0
  99. package/dist/web/assets/{pieDiagram-4H26LBE5-BQCca9Cq.js → pieDiagram-4H26LBE5-Bcvzb8TW.js} +1 -1
  100. package/dist/web/assets/popover-BYz89aiY.js +1 -0
  101. package/dist/web/assets/python-DL05HvW4.js +1 -0
  102. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-BEM2U7Cd.js → quadrantDiagram-W4KKPZXB-DwNhxMxj.js} +1 -1
  103. package/dist/web/assets/razor-BCZ3_uDf.js +1 -0
  104. package/dist/web/assets/{requirementDiagram-4Y6WPE33-CcmFIALZ.js → requirementDiagram-4Y6WPE33-D2wSGYn2.js} +1 -1
  105. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-D9Nrfbqk.js → sankeyDiagram-5OEKKPKP-l3LLF--T.js} +1 -1
  106. package/dist/web/assets/search-field-B5czD2Pl.js +1 -0
  107. package/dist/web/assets/select-DGwKE4l0.js +1 -0
  108. package/dist/web/assets/select-yem-xN9Z.js +1 -0
  109. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-5udQDi0x.js → sequenceDiagram-3UESZ5HK-BAGsbTS_.js} +1 -1
  110. package/dist/web/assets/{server-DJaSJ9m1.js → server-BIPZ9Ka-.js} +1 -1
  111. package/dist/web/assets/{stateDiagram-AJRCARHV-D-cF1NGV.js → stateDiagram-AJRCARHV-C0BHmXYX.js} +1 -1
  112. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Be3UCkeQ.js +1 -0
  113. package/dist/web/assets/{textarea-Ft9KMoEI.js → textarea-Bnfq7adW.js} +1 -1
  114. package/dist/web/assets/{timeline-definition-PNZ67QCA-DXS236a-.js → timeline-definition-PNZ67QCA-Dt-DcRrG.js} +1 -1
  115. package/dist/web/assets/toggles-DxNDJZsN.js +1 -0
  116. package/dist/web/assets/tooltip-CHOgkFbE.js +1 -0
  117. package/dist/web/assets/track-B_K578io.js +1 -0
  118. package/dist/web/assets/{trash-2-Bc-URu8c.js → trash-2-ALAYDudv.js} +1 -1
  119. package/dist/web/assets/tsMode-kXxq-Lw7.js +11 -0
  120. package/dist/web/assets/typescript-E3_QcT_u.js +1 -0
  121. package/dist/web/assets/{upload-C9Z4jLtv.js → upload-D7hKT2VA.js} +1 -1
  122. package/dist/web/assets/use-attachments-CK7y5KsN.js +2 -0
  123. package/dist/web/assets/use-profiles-Ncqxdw7S.js +1 -0
  124. package/dist/web/assets/{use-projects-DI27nNwl.js → use-projects-Dwy9AfAG.js} +1 -1
  125. package/dist/web/assets/{use-providers-DB9ghBPq.js → use-providers-BRyZjuBG.js} +1 -1
  126. package/dist/web/assets/use-workspaces-BBbahdwU.js +1 -0
  127. package/dist/web/assets/useNormalizedLogs-CRHRedwp.js +1 -0
  128. package/dist/web/assets/useTokenUsage-YwiF0xnT.js +1 -0
  129. package/dist/web/assets/{vennDiagram-CIIHVFJN-BzyNrP06.js → vennDiagram-CIIHVFJN-Cr55FtiY.js} +1 -1
  130. package/dist/web/assets/{wardley-L42UT6IY-BQ4SyU9_.js → wardley-L42UT6IY-CtwMk9MJ.js} +1 -1
  131. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CcCqmB58.js → wardleyDiagram-YWT4CUSO-BeyHmTu3.js} +1 -1
  132. package/dist/web/assets/xml-DxKND8qX.js +1 -0
  133. package/dist/web/assets/{xychartDiagram-2RQKCTM6-RWm1MtQk.js → xychartDiagram-2RQKCTM6-9g34Lq8E.js} +1 -1
  134. package/dist/web/assets/yaml-BqpCqTY6.js +1 -0
  135. package/dist/web/index.html +2 -2
  136. package/package.json +1 -1
  137. package/dist/web/assets/AgentDemoPage-D0LQRcXm.js +0 -1
  138. package/dist/web/assets/AgentLogo-BDyW3ihb.js +0 -1
  139. package/dist/web/assets/BranchSelect-Dmp5hq0i.js +0 -1
  140. package/dist/web/assets/BrandLogo-YGT4Vlw5.js +0 -1
  141. package/dist/web/assets/ConversationPage-BhapUYGe.js +0 -3
  142. package/dist/web/assets/CreateTaskInput-GLF3Oyc1.js +0 -1
  143. package/dist/web/assets/DesignSystemPage-j-1-1JtQ.js +0 -16
  144. package/dist/web/assets/EditableTaskTitle-mHT39coo.js +0 -70
  145. package/dist/web/assets/GeneralSettingsPage-BBe3EXcj.js +0 -1
  146. package/dist/web/assets/McpSettingsPage-DDA8yUxu.js +0 -1
  147. package/dist/web/assets/MemberAvatar-CCRbS97s.js +0 -1
  148. package/dist/web/assets/MobileTaskDetail-BOIFPybn.js +0 -5
  149. package/dist/web/assets/NotificationSettingsPage-B2kUnE8w.js +0 -1
  150. package/dist/web/assets/ProfileSettingsPage-DPZpUoFd.js +0 -3
  151. package/dist/web/assets/ProjectKanbanPage-DQnwUBFg.js +0 -12
  152. package/dist/web/assets/ProjectSettingsPage-CcXAOYb7.js +0 -2
  153. package/dist/web/assets/ProviderSettingsPage-BAIRvcAS.js +0 -67
  154. package/dist/web/assets/SettingsMasterDetail-BuxwsR9R.js +0 -1
  155. package/dist/web/assets/TaskDetail-B3pOSx3f.js +0 -3
  156. package/dist/web/assets/TeamSettingsPage-DoWmzvKu.js +0 -1
  157. package/dist/web/assets/agent-meta-MzuGtqxl.js +0 -1
  158. package/dist/web/assets/arrow-down-BVePf1ZM.js +0 -1
  159. package/dist/web/assets/channel-CYYV7_Oi.js +0 -1
  160. package/dist/web/assets/check-qs0S_9rB.js +0 -1
  161. package/dist/web/assets/chevron-down-BaQEBzp3.js +0 -1
  162. package/dist/web/assets/circle-alert-Cbvy2cMo.js +0 -1
  163. package/dist/web/assets/classDiagram-4FO5ZUOK-Cl-3ikxt.js +0 -1
  164. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Cl-3ikxt.js +0 -1
  165. package/dist/web/assets/code-block-OCS4YCEC-CO23R1Os.js +0 -2
  166. package/dist/web/assets/confirm-dialog-BrgNTypL.js +0 -1
  167. package/dist/web/assets/cssMode-hzDRnxMx.js +0 -1
  168. package/dist/web/assets/gauge-CPlvCZUV.js +0 -1
  169. package/dist/web/assets/handlebars-C1M9t0Lo.js +0 -1
  170. package/dist/web/assets/html-DKVKQovh.js +0 -1
  171. package/dist/web/assets/htmlMode-BSWjg5ir.js +0 -1
  172. package/dist/web/assets/index-BnqdwOEH.css +0 -1
  173. package/dist/web/assets/index-CMJV-mgF.js +0 -122
  174. package/dist/web/assets/javascript-WwrMY2Bg.js +0 -1
  175. package/dist/web/assets/liquid-CzGEh0ls.js +0 -1
  176. package/dist/web/assets/mdx-y6S3OMMk.js +0 -1
  177. package/dist/web/assets/modal-DeigO7aN.js +0 -1
  178. package/dist/web/assets/play-Mxkwq69n.js +0 -1
  179. package/dist/web/assets/python-CMnGKsU9.js +0 -1
  180. package/dist/web/assets/razor-mLurbGgY.js +0 -1
  181. package/dist/web/assets/select-DKS02St6.js +0 -1
  182. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-a4ugQnZs.js +0 -1
  183. package/dist/web/assets/status-styles-sQm4KLdp.js +0 -1
  184. package/dist/web/assets/switch-7LWQ_sEx.js +0 -1
  185. package/dist/web/assets/task-CDYaC_No.js +0 -42
  186. package/dist/web/assets/task-priority-acVgTiil.js +0 -1
  187. package/dist/web/assets/tsMode-Vr3bndW1.js +0 -11
  188. package/dist/web/assets/typescript-BfjoaUSn.js +0 -1
  189. package/dist/web/assets/use-attachments-EypT-7PI.js +0 -2
  190. package/dist/web/assets/use-profiles-nMPGwy3v.js +0 -1
  191. package/dist/web/assets/use-workspaces-d4n9m9cX.js +0 -1
  192. package/dist/web/assets/useNormalizedLogs-DRoPbP0w.js +0 -1
  193. package/dist/web/assets/useTokenUsage-4qTDa8SY.js +0 -1
  194. package/dist/web/assets/xml-BGVoPR0b.js +0 -1
  195. package/dist/web/assets/yaml-eFhNavrs.js +0 -1
@@ -1,67 +0,0 @@
1
- import{c as dt,m as ct,q as mt,p as ut,u as $,r as j,j as e,l as U,W as ze,T as Pe,I as se,B as A,E as xt,S as _e,al as pt,h as ft,ao as gt,v as ht,C as vt,t as M,aa as bt,k as xe,ap as yt,ac as ye}from"./index-CMJV-mgF.js";import{c as jt,b as Nt,r as Fe,d as Oe,u as wt,e as Pt,E as Ct,f as Et,s as St,i as De,h as Re,a as Je,j as je,k as kt,l as It,m as At,p as Tt,n as _t,o as Ot,q as Ue,w as Dt,t as Rt}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{a as Ut,b as Lt,u as Kt,c as Mt,d as Bt,e as zt,f as Ft,g as Jt,h as $t}from"./use-providers-DB9ghBPq.js";import{C as qt}from"./confirm-dialog-BrgNTypL.js";import{M as Ce}from"./modal-DeigO7aN.js";import{S as Le}from"./select-DKS02St6.js";import{T as Ke}from"./textarea-Ft9KMoEI.js";import{S as $e}from"./switch-7LWQ_sEx.js";import{R as G,A as P,P as pe,U as Wt,b as Gt,c as Xt}from"./agent-meta-MzuGtqxl.js";import"./mermaid-NOHMQCX5-C72362la.js";import"./use-attachments-EypT-7PI.js";import{A as ae}from"./AgentLogo-BDyW3ihb.js";import{C as qe}from"./chevron-down-BaQEBzp3.js";import{S as Vt}from"./SettingsMasterDetail-BuxwsR9R.js";import{K as Yt}from"./key-round-DZm1FLLr.js";import{T as We,P as Ne}from"./trash-2-Bc-URu8c.js";import{U as Ht}from"./upload-C9Z4jLtv.js";import{P as Zt}from"./pencil-BRQ9W_a-.js";import"./check-qs0S_9rB.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}=$(),{data:u,isLoading:m,isError:C}=ts(),s=u?.models??[],[k,r]=j.useState(!1),[v,b]=j.useState(""),x=j.useMemo(()=>{const f=v.trim().toLowerCase();return f?s.filter(E=>E.id.toLowerCase().includes(f)||E.label.toLowerCase().includes(f)):s},[s,v]);return e.jsxs("div",{className:"flex flex-col gap-2 flex-1 min-w-0",children:[e.jsx("input",{type:"text",value:t,onChange:f=>{const E=f.target.value;i(E===""?void 0:E)},placeholder:a("留空为 auto;或直接输入模型 ID(与 cursor-agent --model 一致)"),className:"w-full px-3 py-1.5 text-sm border border-neutral-200 rounded focus:outline-none focus:ring-1 focus:ring-neutral-900 font-mono"}),e.jsxs("button",{type:"button",onClick:()=>r(f=>!f),disabled:m,className:"flex items-center gap-1 text-xs text-neutral-600 hover:text-neutral-900 disabled:opacity-50 w-fit",children:[e.jsx(qe,{size:14,className:U("transition-transform",k&&"rotate-180")}),m?a("正在加载 cursor-agent 模型列表…"):k?a("收起列表"):a("从本机 cursor-agent 选择({count} 个)",{count:s.length})]}),k&&!m&&e.jsxs("div",{className:"rounded-lg border border-neutral-200 bg-white shadow-sm overflow-hidden",children:[e.jsx("input",{type:"text",value:v,onChange:f=>b(f.target.value),placeholder:a("筛选模型…"),className:"w-full px-3 py-2 text-sm border-b border-neutral-100 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-neutral-300"}),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),b("")},className:U("w-full px-3 py-2 text-left text-sm hover:bg-neutral-50",t?"text-neutral-700":"bg-neutral-50 font-medium"),children:a("默认 (auto)")}),x.map(f=>e.jsxs("button",{type:"button",onClick:()=>{i(f.id),r(!1),b("")},className:U("w-full px-3 py-2 text-left text-sm hover:bg-neutral-50 border-t border-neutral-100",t===f.id?"bg-blue-50/80":""),children:[e.jsx("div",{className:"font-mono text-xs text-neutral-900 break-all",children:f.id}),e.jsx("div",{className:"text-xs text-neutral-500 mt-0.5 break-words",children:f.label})]},f.id)),x.length===0&&e.jsx("div",{className:"px-3 py-4 text-xs text-neutral-400 text-center",children:a("无匹配项")})]})]}),(C||u?.error)&&e.jsxs("p",{className:"text-xs text-amber-700",children:[a("无法从本机加载模型列表({error})。仍可手动输入;或在安装 cursor-agent 的机器上运行",{error:u?.error??a("请求失败")}),e.jsx("code",{className:"mx-0.5 bg-neutral-100 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}=$(),u=ns(t.target?.endpoint),m=rs(t.testedAt,i);return e.jsx("div",{"data-provider-test-result":!0,className:U("rounded-lg border px-4 py-3 text-sm",t.ok?"border-success/30 bg-success/10 text-success":"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(ze,{size:16,className:"shrink-0"}):e.jsx(Pe,{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}),(u||m)&&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:[u&&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:u})})]}),m&&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:m})})]})]}),!t.ok&&e.jsx("div",{className:"mt-1 text-xs opacity-80",children:a("测试失败不会阻止保存。")})]})]})})}function as({options:t,value:i,onChange:a,label:u,efficiencyLabel:m,intelligenceLabel:C,followCliLabel:s,currentLabel:k,disabled:r=!1,error:v}){const b=t.findIndex(g=>g.value===i),x=i==="",f=j.useRef(b>=0?i:void 0),E=j.useRef(null),I=j.useRef(null),[B,J]=j.useState(!1);j.useEffect(()=>{b>=0&&(f.current=i)},[b,i]);const q=g=>{if(r||x||t.length===0)return;const w=t[Math.max(0,Math.min(t.length-1,g))];w&&w.value!==i&&a(w.value)},X=g=>{const w=I.current?.getBoundingClientRect();if(!w||w.width<=0)return;const W=Math.max(0,Math.min(1,(g-w.left)/w.width));q(Math.round(W*(t.length-1)))},L=b>=0?t[b]:void 0,K=b<0||t.length<2?0:b/(t.length-1)*100,R=j.useId(),V=`${R}-label`,_=`${R}-current`,D=`${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:V,className:"text-xs font-medium text-foreground",children:u}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e.jsx($e,{checked:x,disabled:r,onCheckedChange:g=>{a(g?"":f.current??t.find(w=>w.value==="medium")?.value??t[0]?.value??"")},"aria-label":s})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground","aria-hidden":"true",children:[e.jsx("span",{children:m}),e.jsx("span",{children:C})]}),e.jsxs("div",{id:R,ref:I,role:"slider",tabIndex:x||r?-1:0,"aria-labelledby":V,"aria-disabled":x||r,"aria-valuemin":0,"aria-valuemax":Math.max(0,t.length-1),"aria-valuenow":b>=0?b:void 0,"aria-valuetext":L?`${L.label}, ${L.value}`:s,"aria-describedby":v?`${_} ${D}`:_,onKeyDown:g=>{if(x||r||b<0)return;let w=b;if(g.key==="ArrowLeft"||g.key==="ArrowDown")w-=1;else if(g.key==="ArrowRight"||g.key==="ArrowUp")w+=1;else if(g.key==="Home")w=0;else if(g.key==="End")w=t.length-1;else return;g.preventDefault(),q(w)},onPointerDown:g=>{x||r||(E.current=g.pointerId,J(!0),g.currentTarget.setPointerCapture?.(g.pointerId),X(g.clientX))},onPointerMove:g=>{E.current===g.pointerId&&X(g.clientX)},onPointerUp:g=>{E.current===g.pointerId&&(E.current=null,J(!1),g.currentTarget.releasePointerCapture?.(g.pointerId))},onPointerCancel:()=>{E.current=null,J(!1)},className:U("relative mx-2.5 flex h-11 touch-pan-y items-center outline-none select-none",x||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"}),!x&&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((g,w)=>e.jsx("span",{"aria-hidden":"true",className:U("absolute size-3 -translate-x-1/2 rounded-full border-2 transition-colors motion-reduce:transition-none",!x&&w<=b?"border-primary bg-primary":"border-border bg-background"),style:{left:`${t.length<2?0:w/(t.length-1)*100}%`}},g.value)),!x&&L&&e.jsx("span",{"aria-hidden":"true",className:U("absolute size-5 -translate-x-1/2 rounded-full border-[5px] border-primary bg-background shadow-sm transition-[left,transform] duration-150 motion-reduce:transition-none",B&&"scale-110"),style:{left:`${K}%`}})]}),e.jsx("div",{id:_,className:"min-h-5 text-center text-xs text-muted-foreground",children:x?s:`${k}: ${L?.label??i} (${L?.value??i})`}),v&&e.jsx("p",{id:D,role:"alert",className:"text-xs text-destructive",children:v})]})}const F={key:"appendPrompt",label:"追加 Prompt",type:"textarea",rows:3,placeholder:"追加到每次 prompt 末尾的文本"},Ge={[P.CLAUDE_CODE]:[{key:"dangerouslySkipPermissions",label:"跳过权限确认",type:"switch"},F],[P.GEMINI_CLI]:[{key:"yolo",label:"自动批准操作(YOLO)",type:"switch"},F],[P.CURSOR_AGENT]:[{key:"force",label:"强制执行",type:"switch"},F],[P.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 名称"},F],[P.QWEN_CODE]:[F],[P.KIRO_CLI]:[{key:"trustAllTools",label:"信任所有工具",type:"switch"},F],[P.OPENCODE]:[{key:"autoApprove",label:"自动批准操作",type:"switch"},F],[P.PI_CODING_AGENT]:[{key:"autoApprove",label:"自动批准操作",type:"switch"},{key:"supportsImages",label:"模型支持图片输入",type:"switch"},F],[P.GROK_BUILD]:[{key:"alwaysApprove",label:"始终批准操作",type:"switch"},F],[P.MINION_CODE]:[{key:"dangerouslySkipPermissions",label:"跳过权限确认",type:"switch"},F]};function Me(){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===P.CLAUDE_CODE?os:t===P.CODEX?i==="zh-CN"?ls:ds:""}function ms(t){return t===P.CLAUDE_CODE||t===P.CODEX}const we="::ACP";function Be(t,i){return i===G.ACP?`${t}${we}`:String(t)}function oe(t,i){const a=Xt(t);return i===G.ACP?`${a} (ACP)`:a}function us(t){return t.endsWith(we)?{agentType:t.slice(0,-we.length),runtimeType:G.ACP}:{agentType:t,runtimeType:G.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 u=a.env;return i in u?(delete u[i],JSON.stringify(a,null,2)):t}catch{return t}}const Ve=Object.values(Ge).flat().reduce((t,i)=>(t[i.key]||(t[i.key]=i.label),t),{});Ve.permissionMode="权限策略";const Ye=Object.values(Ge).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 H(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"}),u=URL.createObjectURL(a),m=document.createElement("a");m.href=u,m.download=t,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}function bs(t){switch(t){case"CREATE":return{label:"新增",className:"bg-success/10 text-success"};case"OVERWRITE":return{label:"覆盖",className:"bg-warning/10 text-warning"};case"SKIP":return{label:"跳过",className:"bg-muted text-muted-foreground"}}}function ys({issue:t}){const{t:i}=$(),a=!t;return e.jsx("span",{className:U("inline-block h-2 w-2 rounded-full shrink-0",a?"bg-success":"bg-border"),title:t?`${i("不可用")}: ${i(t)}`:i("可用"),children:e.jsx("span",{className:"sr-only",children:i(a?"可用":"不可用")})})}function js({issue:t}){const{t:i}=$();return t?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:[e.jsx(yt,{size:11,"aria-hidden":"true"}),i("不可用")]}):e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-success/10 px-2 py-0.5 text-[11px] font-medium text-success",children:[e.jsx(ze,{size:11,"aria-hidden":"true"}),i("可用")]})}function Ns({title:t,status:i,defaultOpen:a=!1,children:u}){const[m,C]=j.useState(a);return e.jsxs("div",{className:"rounded-lg border border-border",children:[e.jsxs("button",{type:"button",onClick:()=>C(s=>!s),"aria-expanded":m,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:U("text-muted-foreground transition-transform motion-reduce:transition-none",m&&"rotate-180")})]}),m&&e.jsx("div",{className:"px-4 pb-4 space-y-3",children:u})]})}function ws({isOpen:t,onClose:i,providerId:a,initialData:u,onSave:m}){const{locale:C,t:s}=$(),k=Ut(),[r,v]=j.useState(u??{name:"",agentType:P.CLAUDE_CODE,runtimeType:G.CLI,executionPermission:"ASK",config:Me(),settings:"",env:[],simplified:{apiKey:{configured:!1,envKey:"ANTHROPIC_API_KEY"}},diagnostics:[],isDefault:!1}),[b,x]=j.useState(()=>JSON.stringify(r.config,null,2)),[f,E]=j.useState(""),[I,B]=j.useState(()=>r.diagnostics?.find(n=>n.field==="settings")?.message??""),[J,q]=j.useState(!1),[X,L]=j.useState(!1),[K,R]=j.useState(null),[V,_]=j.useState(()=>new Set),[D,g]=j.useState(()=>r.diagnostics?.filter(n=>n.code==="CONFLICT")??[]),[w,W]=j.useState({}),Z=j.useRef(jt()),{data:fe}=Lt(r.agentType,r.simplified.model,{providerId:a,runtimeType:r.runtimeType,config:r.config,settings:r.settings}),y=fe?.[r.agentType]??pe[r.agentType],z=y.apiBaseUrl?Nt(r.simplified.apiBaseUrl):null,le=Fe(r),Q=r.executionPermission??le.mode,ne=y.executionPermissionOptions?.[r.runtimeType],de=ne?.find(n=>n.mode===Q),Y=le.diagnostics[0]?.message??(ne?de?.selectable?null:de?.reasons[0]?.message??s("This Agent has no available execution permission mode."):s("Loading permission support…")),c=y.disableResponsesWebsocket,p=c?Oe(r.config,c):null,S=y.fastMode,T=S?Oe(r.config,S):null,Ee=S?r.config[S.path]:void 0,He=Ee===!0?"fast":Ee===!1?"standard":"inherit",ge=r.simplified.reasoningEffort??"",ce=ge&&!y.reasoningEffort?.options?.includes(ge)?s("请选择当前 Agent 支持的思考强度档位"):null,he=n=>{Z.current.invalidate(),n&&v(n),L(!0),R(null)},O=n=>{he(n)},Se=()=>{X&&!window.confirm(s("存在未保存的修改,确定放弃吗?"))||i()},Ze=n=>r.env.find(o=>je(o.key,n)),re=(n,o,l="")=>{if(o.action!=="keep"){const d=n===y.apiBaseUrl?.path?"apiBaseUrl":n===y.apiKey?.path?"apiKey":null;d&&W(h=>{const N={...h};return delete N[d],N})}O(d=>{const h=d.env.findIndex(lt=>je(lt.key,n)),N=[...d.env],te=h>=0?N[h]:null,ie={key:te?.key??n,value:l,write:o,configured:te?.configured??!1,sensitive:je(n,d.simplified.apiKey?.envKey)||!!te?.sensitive||/key|token|secret|password|auth/i.test(n)};h>=0?N[h]=ie:N.push(ie);const ot=d.agentType===P.CLAUDE_CODE&&o.action!=="keep"&&(n===y.apiBaseUrl?.path||n===y.apiKey?.path);return{...d,env:N,settings:ot?xs(d.settings,n):d.settings}})},me=(n,o)=>{W(l=>{if(!(n in l))return l;const d={...l};return delete d[n],d}),_(l=>new Set(l).add(n)),n==="apiBaseUrl"&&y.apiBaseUrl?.kind==="env"&&re(y.apiBaseUrl.path,o?{action:"replace",value:o}:{action:"clear"},o),O(l=>{const d=Ot(l,n,o,y);return d.config!==l.config&&x(JSON.stringify(d.config,null,2)),d})},Qe=n=>{c&&O(o=>{const l=Ue(o,c,n);return x(JSON.stringify(l.config,null,2)),l})},et=n=>{S&&O(o=>{const l=Ue(o,S,n==="inherit"?void 0:n==="fast");return x(JSON.stringify(l.config,null,2)),l})},tt=n=>{if(X&&!window.confirm(s("切换 Agent 类型会清空当前类型的配置,是否继续?")))return;const{agentType:o,runtimeType:l}=us(n),d=pe[o],h=Me(),N={...r,agentType:o,runtimeType:l,executionPermission:Q,executionPermissionReviewRequired:void 0,config:h,settings:"",env:[],simplified:{apiKey:d.apiKey?{configured:!1,envKey:d.apiKey.path}:void 0}};he(()=>N),x(JSON.stringify(h,null,2)),E(""),B(""),q(!1),_(new Set),g([]),W({})},ke=(n=!1)=>{let o=!f&&!Y&&!T?.error&&!p?.error&&!ce;const l=r.settings.trim();if(l&&(J||n))try{if(r.agentType===P.CODEX)Tt(l);else if(r.agentType===P.CLAUDE_CODE){const d=JSON.parse(l);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(s("JSON 顶层必须是对象"))}B("")}catch(d){B(s("{format} 语法错误: {message}",{format:r.agentType===P.CODEX?"TOML":"JSON",message:d instanceof Error?d.message:String(d)})),o=!1}return o},Ie=()=>{const n=_t(r.env),o=Object.fromEntries([...V].map(l=>[l,r.simplified[l]]));return{providerId:a,name:r.name,agentType:r.agentType,runtimeType:r.runtimeType,executionPermission:Q,env:n,config:r.config,settings:r.settings,simplified:V.size>0?o:void 0,conflictResolutions:w,isDefault:r.isDefault}},st=()=>{if(z||!ke(!1))return;const o={...Ie()};delete o.providerId,a&&delete o.runtimeType,m(o)},nt=()=>{if(z||D.length>0||!ke(!0))return;const n=Z.current.begin();R(null),k.mutate(Ie(),{onSuccess:o=>{Z.current.isCurrent(n)&&R(o)},onError:o=>{Z.current.isCurrent(n)&&R({ok:!1,stage:"connection",errorKind:"unknown",summary:H(o,s("测试配置失败"))})}})};if(!t)return null;const rt=ms(r.agentType),ue=r.agentType===P.CODEX,ve=ue&&wt(r.settings),ee=r.simplified.apiKey?.envKey??y.apiKey?.path,be=ee?Ze(ee):void 0,Ae=Pt(be,!!r.simplified.apiKey?.configured,w.apiKey),it=Ae==="advanced",Te=Ae!=="unconfigured",at=!r.name.trim()||!!z||!!f||!!Y||!!T?.error||!!p?.error||!!ce||!!I&&J||D.length>0;return e.jsx(e.Fragment,{children:e.jsx(Ce,{isOpen:t,onClose:Se,title:s(u?"编辑 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:k.isPending||!!z||!!f||!!Y||!!T?.error||!!p?.error||!!ce||!!I&&J||D.length>0,children:[k.isPending?e.jsx(xt,{className:"animate-spin"}):e.jsx(es,{}),k.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(se,{id:"provider-name",value:r.name,onChange:n=>O(o=>({...o,name:n.target.value})),placeholder:s("例如: Claude Code (官方)")})]}),!u&&e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-foreground",children:s("Agent 类型")}),e.jsx(Le,{value:Be(r.agentType,r.runtimeType),onChange:tt,options:Wt.flatMap(n=>Gt[n].map(o=>({value:Be(n,o),label:oe(n,o),icon:e.jsx(ae,{agentType:n,className:"size-4"})}))),placeholder:s("选择 Agent 类型")})]}),u&&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-neutral-200 bg-muted/30 px-3 text-sm text-muted-foreground",children:[e.jsx(ae,{agentType:r.agentType,className:"size-4"}),e.jsx("span",{className:"min-w-0 truncate",children:oe(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=>({...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(Ct,{value:Q,agentType:r.agentType,options:ne,error:Y,onChange:n=>O(o=>{const l=Dt(o.agentType,o.config);return x(JSON.stringify(l,null,2)),{...o,executionPermission:n,executionPermissionReviewRequired:void 0,config:l}})}),y.apiBaseUrl&&!ve&&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(se,{id:"provider-api-url",type:"url",value:r.simplified.apiBaseUrl??"",onChange:n=>me("apiBaseUrl",n.target.value),placeholder:y.apiBaseUrl.placeholder,"aria-invalid":!!z,"aria-describedby":z?"provider-api-url-error":void 0}),z&&e.jsx("p",{id:"provider-api-url-error",role:"alert",className:"mt-1 text-xs text-destructive",children:s("请输入以 http:// 或 https:// 开头的完整 API 地址")})]}),y.apiKey&&!ve&&(r.agentType!==P.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?"由高级配置管理":Te?"已配置":"未配置")]})]}),be?.write.action==="replace"||!Te?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(se,{id:"provider-api-key",type:"password",autoComplete:"new-password",value:be?.value??"",onChange:n=>re(ee,{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:()=>re(ee,{action:"keep"}),children:s("取消替换")})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx(A,{variant:"outline",size:"sm",onClick:()=>re(ee,{action:"replace",value:""}),children:s("替换")}),e.jsx(A,{variant:"outline",size:"sm",onClick:()=>{window.confirm(s("确定清除此 API Key?"))&&re(ee,{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===P.CURSOR_AGENT?e.jsx(ss,{value:r.simplified.model??"",onChange:n=>me("model",n??"")}):e.jsx(se,{id:"provider-model",value:r.simplified.model??"",onChange:n=>me("model",n.target.value),placeholder:y.model.placeholder})]}),y.reasoningEffort&&e.jsx(as,{options:(y.reasoningEffort.options??[]).map(n=>({value:n,label:s(gs(n))})),value:ge,onChange:n=>me("reasoningEffort",n),label:s("思考强度"),efficiencyLabel:s("更高效"),intelligenceLabel:s("更智能"),followCliLabel:s("跟随 CLI"),currentLabel:s("当前"),error:ce}),S&&T&&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(Le,{value:He,disabled:!!T.error,onChange:et,options:[{value:"inherit",label:s("跟随 Codex")},{value:"standard",label:s("标准速度")},{value:"fast",label:"Fast"}]})]}),T.error&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:s("Fast 模式字段必须为 true 或 false,请在运行配置 JSON 中修正。")})]}),c&&p&&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(ve?"当前原生 Provider 已使用非 WebSocket 传输;此开关不会添加额外运行时覆盖。":"仅禁用 Codex Responses API 的 WebSocket 传输;新启动和后续继续的请求将使用 HTTP。")})]}),e.jsx($e,{checked:p.enabled,disabled:!!p.error,onCheckedChange:Qe,"aria-label":s("禁用 WebSocket")})]}),p.error&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:s("禁用 WebSocket 字段必须为 true 或 false,请在运行配置 JSON 中修正。")})]})]}),K&&e.jsx(is,{result:K}),D.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(Pe,{size:16,className:"text-warning"}),s("需要解决配置冲突")]}),D.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,d=Et(r,l,o,y);O(()=>d),x(JSON.stringify(d.config,null,2)),W(h=>({...h,[l]:o})),o==="advanced"&&(l==="apiBaseUrl"||l==="model"||l==="reasoningEffort")&&_(h=>{const N=new Set(h);return N.delete(l),N}),g(h=>h.filter(N=>N.field!==l))},children:s(o==="simple"?"采用简化值":"保留高级值")},o))})]},n.field))]}),e.jsxs(Ns,{title:s("高级配置"),defaultOpen:!!f||!!I||!!Y||!!T?.error||D.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(Ke,{value:b,onChange:n=>{const o=n.target.value;x(o);try{const l=JSON.parse(o);if(!l||typeof l!="object"||Array.isArray(l))throw new Error(s("JSON 顶层必须是对象"));const d=l;E(""),_(h=>{const N=new Set(h).add("model");return y.reasoningEffort?.kind==="config"&&N.add("reasoningEffort"),N}),O(h=>({...h,config:d,simplified:St(h.simplified,d,y)}))}catch(l){he(),E(l instanceof Error?l.message:s("JSON 语法错误"))}},rows:7,className:"font-mono","aria-invalid":!!f}),f&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:f})]}),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(se,{value:n.key,disabled:n.configured,onChange:l=>{const d=l.target.value;O(h=>{const N=[...h.env],te=N[o];if(!te)return h;const ie={...te,key:d};return N[o]={...ie,sensitive:De(ie,h.simplified)},{...h,env:N}})},placeholder:s("变量名,如 AZURE_OPENAI_API_KEY"),className:"flex-1 py-1.5 font-mono"}),e.jsx(se,{value:n.value,type:De(n,r.simplified)?"password":"text",onChange:l=>{const d=[...r.env];d[o]={...d[o],value:l.target.value,write:{action:"replace",value:l.target.value}},O(h=>({...h,env:d,simplified:n.key===y.apiBaseUrl?.path?{...h.simplified,apiBaseUrl:l.target.value}:h.simplified})),n.key===y.apiBaseUrl?.path&&_(h=>new Set(h).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),O(d=>({...d,env:l,simplified:n.key===y.apiBaseUrl?.path?{...d.simplified,apiBaseUrl:""}:d.simplified})),n.key===y.apiBaseUrl?.path&&_(d=>new Set(d).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(We,{size:14})})]},o)),e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>O(n=>({...n,env:[...n.env,{key:"",value:"",write:{action:"replace",value:""},configured:!1,sensitive:!1}]})),children:[e.jsx(Ne,{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(ue?"Agent 原生配置 (config.toml)":"Agent 原生配置 (settings.json)")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:ue?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(Ke,{value:r.settings,onChange:n=>{const o=n.target.value;q(!0),B("");let l;if(ue)try{l=Re(r.simplified,o,P.CODEX),_(d=>new Set(d).add("reasoningEffort"))}catch{}O(d=>{const h=l===void 0?d.simplified:Re(d.simplified,o,P.CODEX,new Set(d.env.flatMap(N=>N.write.action==="clear"?[]:N.write.action==="replace"?N.value?[N.key]:[]:N.configured?[N.key]:[])));return{...d,settings:o,env:Rt(d.env,h),simplified:h}})},rows:10,className:"font-mono",placeholder:cs(r.agentType,C),"aria-invalid":!!I}),I&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:I})]})]})]})})})}function Ps({isOpen:t,onClose:i,onConfirm:a,acknowledged:u,onAcknowledgedChange:m,isLoading:C}){const{t:s}=$();return e.jsx(Ce,{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:C,children:s("取消")}),e.jsx(A,{onClick:a,disabled:!u||C,children:s(C?"导出中...":"导出备份")})]}),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(Pe,{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:u,onChange:k=>m(k.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:u,onConfirm:m,isLoading:C}){const{t:s}=$();if(!a||!u)return null;const k=a.summary.create+a.summary.overwrite,r=[...a.items].sort((v,b)=>{const x={CREATE:0,OVERWRITE:1,SKIP:2};return x[v.action]-x[b.action]});return e.jsx(Ce,{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:C,children:s("取消")}),e.jsx(A,{onClick:m,disabled:k===0||C,children:C?s("导入中..."):s("确认导入 {count} 项",{count:k})})]}),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(u.exportedAt).toLocaleString()})}),e.jsx("div",{children:s("模式:完整备份(含敏感信息)")}),e.jsx("div",{children:s("文件内 Provider 数量:{count}",{count:u.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",children:s("新增")}),e.jsx("div",{className:"text-lg 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",children:s("覆盖")}),e.jsx("div",{className:"text-lg 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-lg 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(v=>{const b=bs(v.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:v.incoming.name}),e.jsx("span",{className:`inline-flex rounded-full px-2 py-0.5 text-[11px] font-medium ${b.className}`,children:s(b.label)})]}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ae,{agentType:v.incoming.agentType,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:oe(v.incoming.agentType,v.incoming.runtimeType)})," · ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:v.incoming.id})]})]})}),v.action==="OVERWRITE"&&v.existing&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("将覆盖当前已有的 Provider:{name}",{name:v.existing.name})}),v.action==="SKIP"&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("当前同 ID Provider 配置一致,本次不会重复写入。")}),v.action==="CREATE"&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:s("当前不存在同 ID Provider,将直接新增。")})]},v.incoming.id)})})]})})}function Es({item:t,onEdit:i,onDelete:a}){const{t:u}=$(),m=t.provider,C=Je(t),s=kt(m),k=Xe(m.agentType,m.config),r=pe[m.agentType],v=Object.entries(k).filter(([x])=>x!=="cmd"&&x!==r.executionPermission.path),b=Object.keys(m.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:m.name}),e.jsx(js,{issue:C})]}),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(ae,{agentType:m.agentType,className:"size-3.5"}),e.jsx("span",{className:"truncate",children:oe(m.agentType,m.runtimeType)})]}),m.isDefault&&e.jsx("span",{className:"rounded-full bg-primary/[0.06] px-2 py-0.5 text-[11px] font-medium text-primary",children:u("默认")}),m.builtIn&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:u("内置")})]})]}),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}),u("编辑")]}),e.jsxs(A,{size:"sm",variant:m.builtIn?"outline":"destructive",onClick:a,disabled:m.deletable===!1,children:[m.builtIn?e.jsx(bt,{size:13}):e.jsx(We,{size:13}),m.builtIn?u("恢复默认"):u("删除")]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(xe,{children:u("Execution permission")}),e.jsx("p",{className:"text-sm",children:u(It[Fe(m).mode])}),s&&!m.diagnostics?.some(x=>x.field==="executionPermission")?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:u(s)}):null,m.diagnostics?.filter(x=>x.field==="executionPermission").map((x,f)=>e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:u(x.message)},`${x.code}-${f}`)),C&&!s?e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:u(C)}):null,e.jsx("p",{className:"text-xs text-muted-foreground",children:u("Changes apply when a new runtime starts. Running sessions keep their launch mode.")})]}),v.length>0&&e.jsxs("div",{children:[e.jsx(xe,{className:"mb-3",children:u("运行配置")}),e.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-border bg-border/60",children:v.map(([x,f])=>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:u(Ve[x]??x)}),e.jsx("span",{className:"min-w-0 max-w-full break-all font-mono text-[13px] text-foreground",children:ps(x,f)})]},x))})]}),b.length>0&&e.jsxs("div",{children:[e.jsx(xe,{className:"mb-3",children:u("环境变量")}),e.jsx("div",{className:"grid gap-px overflow-hidden rounded-lg border border-border bg-border/60",children:b.map(x=>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:x}),e.jsx("span",{className:"text-[13px] text-muted-foreground","aria-label":"hidden",children:"•••••"})]},x))})]}),m.settings?.trim()&&e.jsxs("div",{children:[e.jsx(xe,{className:"mb-3",children:u("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:m.settings})})]}),v.length===0&&b.length===0&&!m.settings?.trim()&&e.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:u('该 Provider 未配置额外参数。点击"编辑"添加运行配置、环境变量或 Agent 原生配置。')})]})}function Ws(){const{t}=$(),{data:i,isLoading:a}=Kt(),u=Mt(),m=Bt(),C=zt(),s=Ft(),k=Jt(),r=$t(),v=j.useRef(null),[b,x]=j.useState(null),[f,E]=j.useState(null),[I,B]=j.useState(null),[J,q]=j.useState(!1),[X,L]=j.useState(!1),[K,R]=j.useState(null),[V,_]=j.useState(!1),D=i??[],g=b??D[0]?.provider.id??null,w=c=>{u.mutate(c,{onSuccess:()=>E(null),onError:p=>M.error(H(p,t("创建 Provider 失败")))})},W=(c,p)=>{m.mutate({id:c,data:p},{onSuccess:()=>E(null),onError:S=>M.error(H(S,t("更新 Provider 失败")))})},Z=c=>{if(!(c.deletable??!c.builtIn)){M.error(t("系统内置 Provider 不可删除"));return}B({id:c.id,name:c.name,builtIn:c.builtIn})},fe=()=>{I&&C.mutate(I.id,{onSuccess:()=>{M.success(I.builtIn?t("已恢复默认 Provider 配置"):t("Provider 已删除")),g===I.id&&x(null),B(null),_(!1)},onError:c=>M.error(H(c,t("删除 Provider 失败")))})},y=()=>{q(!1),L(!1)},z=()=>R(null),le=()=>{s.mutate(void 0,{onSuccess:c=>{vs(hs(c.exportedAt),c),M.success(t("Provider 备份已导出")),y()},onError:c=>M.error(H(c,t("导出 Provider 备份失败")))})},Q=()=>{v.current&&(v.current.value="",v.current.click())},ne=async c=>{const p=c.target.files?.[0];if(c.target.value="",!p)return;let S;try{S=JSON.parse(await p.text())}catch{M.error(t("备份文件不是有效的 JSON"));return}k.mutate(S,{onSuccess:T=>R({backup:S,preview:T}),onError:T=>M.error(H(T,t("导入预览失败")))})},de=()=>{K&&r.mutate(K.backup,{onSuccess:c=>{const p=c.summary.create+c.summary.overwrite;M.success(p===0?t("导入完成,当前配置无需变更"):t("导入完成:新增 {create},覆盖 {overwrite},跳过 {skip}",{create:c.summary.create,overwrite:c.summary.overwrite,skip:c.summary.skip})),z()},onError:c=>M.error(H(c,t("导入 Provider 备份失败")))})},Y=c=>{const p=c.provider,S=pe[p.agentType],T=At(p,S);E({id:p.id,data:{name:p.name,agentType:p.agentType,runtimeType:p.runtimeType===G.ACP?G.ACP:G.CLI,executionPermission:p.executionPermission,executionPermissionReviewRequired:p.executionPermissionReviewRequired,config:Xe(p.agentType,p.config),settings:p.settings??"",env:T,simplified:p.simplified??{},diagnostics:p.diagnostics,isDefault:p.isDefault}})};return a?e.jsx(_e,{className:"max-w-5xl",children:e.jsx(pt,{})}):e.jsxs(_e,{className:"max-w-5xl",children:[e.jsx("input",{ref:v,type:"file",accept:".json,application/json",className:"hidden",onChange:ne}),e.jsx(ft,{title:t("Agent 配置"),actions:e.jsxs(e.Fragment,{children:[e.jsxs(A,{variant:"outline",size:"sm",onClick:Q,disabled:k.isPending||r.isPending,children:[e.jsx(Ht,{size:13}),t("导入")]}),e.jsxs(A,{variant:"outline",size:"sm",onClick:()=>q(!0),disabled:s.isPending,children:[e.jsx(gt,{size:13}),t("导出")]}),e.jsxs(A,{size:"sm",onClick:()=>E({}),children:[e.jsx(Ne,{size:13,className:"mr-1"}),t("新建")]})]})}),D.length===0?e.jsx(ht,{icon:vt,message:t("暂无 Agent 配置"),action:e.jsxs(A,{size:"sm",onClick:()=>E({}),children:[e.jsx(Ne,{size:13,className:"mr-1"}),t("新建配置")]})}):e.jsx(Vt,{items:D,selectedId:g,onSelectItem:c=>{x(c),_(!0)},getItemId:c=>c.provider.id,mobileShowDetail:V,onMobileBack:()=>_(!1),renderListItem:(c,p)=>{const S=c.provider,T=Je(c);return e.jsxs(e.Fragment,{children:[e.jsx(ys,{issue:T}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:S.name}),e.jsxs("div",{className:U("flex min-w-0 items-center gap-1.5 text-[11px]",p?"text-primary-foreground/60":"text-muted-foreground"),children:[e.jsx(ae,{agentType:S.agentType,className:"size-3.5",fallbackClassName:p?"text-primary-foreground/70":"text-muted-foreground"}),e.jsx("span",{className:"min-w-0 truncate",children:oe(S.agentType,S.runtimeType)})]}),T?e.jsx("div",{className:U("mt-0.5 break-words text-[11px] leading-snug",p?"text-primary-foreground/80":"text-destructive"),children:t(T)}):null]}),S.isDefault&&e.jsx("span",{className:U("shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium",p?"bg-white/20 text-primary-foreground":"bg-primary/[0.06] text-primary"),children:t("默认")})]})},renderDetail:c=>c?e.jsx("div",{className:"min-w-0 p-5",children:e.jsx(Es,{item:c,onEdit:()=>Y(c),onDelete:()=>Z(c.provider)})}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:t("选择一个 Provider 查看详情")})}),f&&e.jsx(ws,{isOpen:!0,onClose:()=>E(null),providerId:f.id,initialData:f.data,onSave:c=>{f.id?W(f.id,c):w(c)}}),e.jsx(qt,{isOpen:I!==null,onClose:()=>{C.isPending||B(null)},onConfirm:fe,title:I?.builtIn?t("恢复默认 Provider"):t("删除 Provider"),description:I?.builtIn?t('确定删除 "{name}" 的自定义覆盖,并恢复系统默认配置?',{name:I?.name}):t('确定删除 "{name}"?此操作不可撤销。',{name:I?.name}),confirmText:I?.builtIn?t("恢复默认"):t("删除"),cancelText:t("取消"),variant:"danger",isLoading:C.isPending}),e.jsx(Ps,{isOpen:J,onClose:y,onConfirm:le,acknowledged:X,onAcknowledgedChange:L,isLoading:s.isPending}),e.jsx(Cs,{isOpen:!!K,onClose:z,preview:K?.preview??null,backup:K?.backup??null,onConfirm:de,isLoading:r.isPending})]})}export{ws as ProviderFormModal,Ws as ProviderSettingsPage};
@@ -1 +0,0 @@
1
- import{u as v,j as r,l as s,s as h}from"./index-CMJV-mgF.js";function w({items:o,selectedId:l,onSelectItem:c,getItemId:t,renderListItem:d,renderDetail:u,renderListFooter:g,mobileShowDetail:a,onMobileBack:x,listClassName:m,detailClassName:f}){const{t:p}=v(),b=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",a&&"hidden lg:block",m),children:[o.map(e=>{const i=t(e),n=i===l;return r.jsx("button",{onClick:()=>c(i),"aria-current":n?"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",n?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted/50"),children:d(e,n)},i)}),g?.()]}),r.jsxs("div",{className:s("min-w-0 rounded-xl border border-border bg-card lg:overflow-y-auto scrollbar-app-thin",!a&&"hidden lg:block",f),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}),p("返回列表")]}),u(b)]})]})}export{w as S};
@@ -1,3 +0,0 @@
1
- import{u as je,r as t,a1 as zt,j as e,B as U,a2 as Ut,T as Ft,a3 as _t,a4 as Kt,a5 as qt,a6 as Vt,a7 as Gt,o as Ht,p as Xs,q as be,a8 as Qt,a9 as $t,_ as Js,a0 as Ys,$ as B,aa as Xt,s as Jt,ab as Yt,Q as Zt}from"./index-CMJV-mgF.js";import{W as en,S as z,a as sn}from"./agent-meta-MzuGtqxl.js";import{a as Zs,Q as tn,s as nn}from"./mermaid-NOHMQCX5-C72362la.js";import{u as rn,a as on,R as an,P as ln,T as cn}from"./useTokenUsage-4qTDa8SY.js";import{u as dn,a as un,L as et,T as st}from"./useNormalizedLogs-DRoPbP0w.js";import{g as mn}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{u as fn,A as pn}from"./use-attachments-EypT-7PI.js";import{T as xn,u as gn,a as hn,b as bn,c as vn,d as jn,e as yn,S as tt}from"./CreateTaskInput-GLF3Oyc1.js";import{u as kn,r as Cn,c as wn,g as Le,a as Nn,b as Sn,d as In,e as Rn,f as An,W as Tn,E as En,h as Wn,S as Mn,R as Dn,T as Pn,i as On,j as Ln,k as Bn,l as zn}from"./EditableTaskTitle-mHT39coo.js";import{u as Un,a as Fn,b as _n,c as Kn,d as qn,e as Vn}from"./use-workspaces-d4n9m9cX.js";import{u as Gn}from"./use-providers-DB9ghBPq.js";import{M as Hn}from"./modal-DeigO7aN.js";import{C as Qn}from"./confirm-dialog-BrgNTypL.js";import{D as $n}from"./ProjectKanbanPage-DQnwUBFg.js";import{U as T,S as Xn}from"./status-styles-sQm4KLdp.js";import{C as Jn,P as cs}from"./play-Mxkwq69n.js";import{P as nt,T as Yn}from"./trash-2-Bc-URu8c.js";import{A as rt}from"./arrow-down-BVePf1ZM.js";import{P as Zn}from"./paperclip-BOSklTt7.js";import{A as er}from"./task-priority-acVgTiil.js";import"./chevron-down-BaQEBzp3.js";import"./gauge-CPlvCZUV.js";import"./AgentLogo-BDyW3ihb.js";import"./check-qs0S_9rB.js";import"./use-projects-DI27nNwl.js";import"./MemberAvatar-CCRbS97s.js";import"./BrandLogo-YGT4Vlw5.js";import"./chevron-up-D0y6skqr.js";import"./at-sign-BE17rU5b.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./message-square-CFriSt4D.js";import"./textarea-Ft9KMoEI.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./copy-DejkmIHZ.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./pencil-BRQ9W_a-.js";import"./circle-alert-Cbvy2cMo.js";function sr({isOpen:n,onClose:l,taskId:M}){const{t:c}=je(),[C,u]=t.useState("AUTO"),[S,o]=t.useState(null),[d,D]=t.useState([]),[ye,P]=t.useState(null),ke=zt();t.useEffect(()=>{n&&(u("AUTO"),o(null),D([]),P(null))},[n]);const I=ke.isPending,Be=!!S||d.length>0,se=async()=>{if(!I){if(!S&&d.length===0){P(c("请选择至少一个团队模板或成员预设。"));return}P(null);try{await ke.mutateAsync({taskId:M,mode:C,...S?{teamTemplateId:S}:{},...d.length>0?{memberPresetIds:d}:{}}),l()}catch(O){if(O instanceof Ut&&O.status===409){P(c("该任务已经存在 TeamRun。请刷新后再试。"));return}P(O instanceof Error?O.message:c("创建 TeamRun 失败"))}}},ze=I||!Be;return e.jsxs(Hn,{isOpen:n,onClose:I?()=>{}:l,title:c("创建 TeamRun"),className:"max-w-5xl",action:e.jsxs(e.Fragment,{children:[e.jsx(U,{type:"button",variant:"outline",onClick:l,disabled:I,children:c("取消")}),e.jsx(U,{type:"button",onClick:se,disabled:ze,children:c(I?"处理中...":"创建 TeamRun")})]}),children:[e.jsx(xn,{mode:C,setMode:u,selectedTemplateId:S,setSelectedTemplateId:o,selectedMemberPresetIds:d,setSelectedMemberPresetIds:D,disabled:I}),ye&&e.jsx("div",{role:"alert",className:"rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:ye})]})}function tr({workspaceId:n,gitStatus:l,onResolve:M}){const{t:c}=je(),C=Un();if(l.operation==="idle"||l.conflictedFiles.length===0)return null;const u=l.operation==="rebase"?"Rebase":"Merge";return e.jsxs("div",{className:"mx-6 mt-3 flex items-center gap-3 rounded-lg border border-warning/25 bg-warning/[0.06] px-4 py-2.5",children:[e.jsx(Ft,{size:15,className:"text-warning shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium text-foreground",children:[u," ",c("冲突")]}),e.jsxs("span",{className:"inline-flex items-center rounded-full bg-warning/15 px-2 py-0.5 text-xs font-semibold text-warning tabular-nums",children:[l.conflictedFiles.length," ",c("个文件")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(U,{variant:"ghost",size:"sm",onClick:()=>C.mutate(n),disabled:C.isPending,className:"text-muted-foreground hover:text-foreground",children:c("中止操作")}),e.jsx(U,{size:"sm",onClick:M,children:c("解决冲突")})]})]})}const nr=Zt(),rr=n=>n.includes("://")||n.startsWith("/api/")?n:n.startsWith("/")?`${nr}/attachments/by-path?path=${encodeURIComponent(n)}`:n,ee=520,ds=48,or=4,ar=420;function ir(){const{t:n}=je();return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-background text-muted-foreground/70 select-none",children:[e.jsx("div",{className:"w-16 h-16 bg-muted/50 rounded-2xl 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/50",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-lg",children:"Agent Tower"}),e.jsx("p",{className:"text-sm max-w-sm text-center text-muted-foreground leading-relaxed",children:n("Select a task from the sidebar to view logs, monitor execution, or interact with an agent.")})]})}function ve(n){const l=Xn[n].icon;return e.jsx(l,{className:"size-3"})}const ot=[{status:T.Review,className:"bg-warning/10 text-warning",hoverClass:"hover:bg-warning/15",icon:ve(T.Review)},{status:T.Running,className:"bg-info/10 text-info",hoverClass:"hover:bg-info/15",icon:ve(T.Running)},{status:T.Pending,className:"bg-muted/50 text-muted-foreground",hoverClass:"hover:bg-muted",icon:ve(T.Pending)},{status:T.Done,className:"bg-success/10 text-success",hoverClass:"hover:bg-success/15",icon:ve(T.Done)},{status:T.Cancelled,className:"bg-muted/50 text-muted-foreground",hoverClass:"hover:bg-border",icon:ve(T.Cancelled)}];function lr({status:n,onChangeStatus:l}){const{t:M}=je(),[c,C]=t.useState(!1),u=t.useRef(null);t.useEffect(()=>{if(!c)return;const o=d=>{u.current&&!u.current.contains(d.target)&&C(!1)};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[c]);const S=ot.find(o=>o.status===n);return e.jsxs("div",{className:"relative",ref:u,children:[e.jsxs("button",{onClick:()=>l&&C(o=>!o),className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium transition-colors ${S.className} ${l?"cursor-pointer hover:opacity-80":""}`,children:[S.icon,e.jsx("span",{children:M(n)}),l&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",className:`ml-0.5 transition-transform ${c?"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"})})]}),c&&e.jsx("div",{className:"absolute right-0 top-full mt-2 w-40 bg-background rounded-lg border border-border shadow-lg z-50 py-1 animate-in fade-in zoom-in-95 duration-100",children:ot.filter(o=>o.status!==n).map(o=>e.jsxs("button",{onClick:()=>{l?.(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(d=>d.startsWith("text-")),children:o.icon}),e.jsx("span",{className:"text-foreground/80",children:M(o.status)})]},o.status))})]})}function Xr({task:n,onDeleteTask:l,isDeleting:M,onTaskStatusChange:c,onTaskPriorityChange:C,autoStartState:u,onAutoStartRecovered:S}){const{t:o}=je(),[d,D]=t.useState(""),[ye,P]=t.useState(!1),[ke,I]=t.useState(!1),[Be,se]=t.useState(!1),[ze,O]=t.useState(!1),[at,us]=t.useState(!1),[it,ms]=t.useState(!1),[fs,ps]=t.useState(null),Ce=t.useRef(null),[Ue,te]=t.useState(!1),[R,Fe]=t.useState(null),[ne,re]=t.useState(void 0),[V,we]=t.useState(!1),_e=t.useRef(null),Ke=t.useRef(null),oe=t.useRef(null),xs=t.useRef(null),{scrollRef:F,contentRef:gs,isAtBottom:hs,scrollToBottom:Ne,stopScroll:bs}=rn({resize:"smooth",initial:"instant"}),[E,vs]=t.useState(!1),[qe,ae]=t.useState(ee),[Se,js]=t.useState(!1),ys=t.useRef(0),ks=t.useRef(ee),Cs=t.useRef(null),Ve=t.useCallback((s,r,i)=>{Ce.current?.openFile(s,r,i)},[]),{data:a,isLoading:lt}=Fn(n?.id??""),ie=kn(n?.id),ws=ie?.status==="completed"&&u?.status!=="failed"?null:u,Ge=!!(ws||ie&&ie.status!=="completed"),{data:le}=_t(n?.id??""),{data:ct}=Kt(le?.id??""),Ns=qt(le?.id??""),f=le??null,He=!!f,ce=n?.isGitRepo!==!1&&n?.worktreeReady!==!1,Ie=le===null&&ce,dt=!!(n?.id&&le===null),{data:G,isLoading:Ss}=Vt(n?.id??"",dt);t.useEffect(()=>{we(!1),Fe(null),re(void 0)},[n?.id]);const _=t.useMemo(()=>Cn(a,f,ne),[ne,f,a]);t.useEffect(()=>{ne&&!a?.some(s=>s.id===ne)&&re(void 0)},[ne,a]);const j=t.useMemo(()=>a?.find(s=>s.id===_),[_,a]),N=j?.status===en.ACTIVE?j.id:void 0,de=ce&&wn(j,f);t.useEffect(()=>{if(!V||!a)return;a.some(r=>r.status==="ACTIVE"&&r.sessions&&r.sessions.length>0)&&we(!1)},[a,V]);const p=t.useMemo(()=>{if(V||!a)return null;const s=h=>{const ls=h.createdAt,he=h.endedAt??h.startedAt??ls;if(!he)return 0;const Z=Date.parse(he);return Number.isNaN(Z)?0:Z},r=(h,ls)=>{const he=h.filter(Z=>ls.includes(Z.status));return he.length===0?null:he.sort((Z,Bt)=>s(Bt)-s(Z))[0]??null},i=a.filter(h=>h.status==="ACTIVE"&&Array.isArray(h.sessions)).flatMap(h=>h.sessions??[]),x=r(i,[z.RUNNING])??r(i,[z.PENDING])??r(i,[z.COMPLETED,z.FAILED,z.CANCELLED]);if(x)return x;const g=a.filter(h=>(h.status==="MERGED"||h.status==="ABANDONED"||h.status==="HIBERNATED")&&Array.isArray(h.sessions)).flatMap(h=>h.sessions??[]);return r(g,[z.COMPLETED,z.FAILED,z.CANCELLED])},[a,V]),H=p?.id??"",y=He?R??"":H,ut=t.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]),Qe=t.useMemo(()=>{if(!R||!f?.invocations)return null;const s=f.invocations.filter(r=>r.sessionId===R);return s.length===0?null:s.sort((r,i)=>{const x=Date.parse(r.updatedAt??r.createdAt??""),g=Date.parse(i.updatedAt??i.createdAt??"");return(Number.isNaN(g)?0:g)-(Number.isNaN(x)?0:x)})[0]??null},[R,f?.invocations]),mt=t.useMemo(()=>!Qe?.memberId||!f?.members?null:f.members.find(s=>s.id===Qe.memberId)??null,[Qe?.memberId,f?.members]),b=R?ut:p??null,Q=b?.id,$=t.useMemo(()=>{if(b?.workspaceId)return b.workspaceId;if(!(!b||!a))return a.find(s=>s.sessions?.some(r=>r.id===b.id))?.id},[b,a]),Re=t.useCallback((s,r)=>{const x=(r&&a?.some(g=>g.id===r)?r:void 0)??$??_??void 0;x&&re(x),Ce.current?.openPreview(s,x)},[$,_,a]),$e=t.useCallback((s,r)=>{Re({kind:"web",url:s},r)},[Re]),Xe=t.useCallback((s,r,i)=>{Re({kind:"visualization",sessionId:s,file:r},i)},[Re]),Is=t.useCallback(s=>{$e(s,$)},[$,$e]),Rs=t.useCallback(s=>{Q&&Xe(Q,s,$)},[Q,$,Xe]),{isActive:ue,isCancelling:me}=gn(Q??"",b?.status),m=!!n?.projectArchivedAt,As=!!n?.projectRepoDeletedAt,Je=o(As?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。"),{data:X}=Gn(),[Ae,Ts]=t.useState(null),Te=p?mn(X,Ae??p.providerId):void 0;t.useEffect(()=>{Ts(p?.providerId??null)},[p?.providerId]);const ft=t.useMemo(()=>!p||!a?!1:!a.some(r=>r.status==="ACTIVE"&&r.sessions?.some(i=>i.id===p.id)),[p,a]),w=t.useMemo(()=>{if(!(!a||V)){if(j)return Le(j);for(const s of a)if(s.status==="ACTIVE"&&Le(s))return Le(s);return Le(a[0])}},[V,j,a]),K=hn({agentType:p?.agentType,workingDir:w,input:d,setInput:D,textareaRef:oe,minHeight:60,maxHeight:300}),q=Nn({agentType:p?.agentType,workingDir:w,input:d,setInput:D,textareaRef:oe,minHeight:60,maxHeight:300}),Ye=Gt(s=>s.setVisibleContext),fe=!!(de&&N&&w&&!m),{data:A,isLoading:pt}=_n(N??"",{enabled:fe}),{data:xt}=Sn(w,{enabled:fe});t.useEffect(()=>{if(!(E||!fe||!N||!w))return Ye({workspaceId:N,workingDir:w,tab:"changes"}),()=>{Ye(null)}},[E,N,Ye,fe,w]);const gt=j?.sessions??[],Ze=In(j),Es=j?.commitMessage,es=t.useMemo(()=>Rn(j,a,n?.mainBranch??""),[j,n?.mainBranch,a]),k=t.useMemo(()=>A?.conflictOp&&A.conflictedFiles.length>0?{conflictOp:A.conflictOp,conflictedFiles:A.conflictedFiles}:fs,[A?.conflictOp,A?.conflictedFiles,fs]),Ws=k?.targetWorkspaceId??N,ht=k?.targetWorktreePath??j?.worktreePath,bt=k?.sourceBranch??Ze,vt=k?.targetBranch??es,v=Ht(),Ee=t.useCallback(async()=>n?.id?v.fetchQuery({queryKey:be.tasks.body(n.id),queryFn:()=>Xs.get(`/tasks/${n.id}/body`)}):null,[v,n?.id]),Ms=t.useCallback(()=>n?.id?v.invalidateQueries({queryKey:be.workspaces.list(n.id)}):Promise.resolve(),[n?.id,v]);t.useEffect(()=>{if(!Ue)return;const s=r=>{Ke.current&&!Ke.current.contains(r.target)&&te(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[Ue]);const We=bn(),Ds=Kn(),Ps=Qt(),Os=qn(n?.id??""),Ls=vn(),ss=Vn(),pe=t.useMemo(()=>!a||a.some(r=>r.status==="ACTIVE")?null:a.find(r=>r.status==="HIBERNATED")??null,[a]),ts=t.useRef(null);t.useEffect(()=>{pe&&ts.current!==pe.id&&(ss.isPending||(ts.current=pe.id,ss.mutate(pe.id,{onSettled:()=>{ts.current=null}})))},[pe,ss]);const jt=t.useCallback(async()=>{if(!n?.id)return;const s=p?.providerId??X?.find(r=>r.availability.type!=="NOT_FOUND")?.provider.id;if(s){O(!1),us(!0);try{const i=(await Ee())?.prompt??n.title;await Ps.mutateAsync(n.id),we(!0);const x=await Os.mutateAsync({workspaceKind:ce?void 0:sn.MAIN_DIRECTORY}),g=await Xs.post(`/workspaces/${x.id}/sessions`,{providerId:s,prompt:i});await Ls.mutateAsync(g.id),await v.invalidateQueries({queryKey:be.workspaces.list(n.id)})}catch(r){console.error("[retry] failed:",r),we(!1)}finally{us(!1)}}},[n?.id,n?.title,ce,p?.providerId,X,Ee,Ps,Os,Ls,v]),ns=t.useCallback(async()=>{n?.id&&(await Ee(),P(!0))},[Ee,n?.id]),yt=t.useCallback(()=>{j?.id&&Ds.mutate({workspaceId:j.id})},[Ds,j?.id]),kt=t.useCallback(()=>{!n?.id||!l||(l(n.id),se(!1))},[n?.id,l]),Bs=t.useCallback(s=>{Fe(s),requestAnimationFrame(()=>{Ne()})},[Ne]),Ct=t.useCallback(()=>{Fe(null)},[]),Me=t.useCallback(s=>{ps(s??null),ms(!0)},[]),wt=t.useCallback(s=>Ns.mutateAsync(s),[Ns]),J=t.useCallback(()=>{v.invalidateQueries({queryKey:$t.all})},[v]),{isConnected:zs,isLoadingSnapshot:Us,isOutputActive:Fs,lastExitAt:_s,logs:xe,entries:Nt,attach:De}=dn({sessionId:y,sessionStatus:b?.status,sessionStartedAt:b?.startedAt??b?.createdAt,sessionEndedAt:b?.endedAt??(ue?null:b?.updatedAt),onExit:t.useCallback(()=>{v.invalidateQueries({queryKey:["workspaces"]})},[v])});t.useEffect(()=>{if(!n?.id)return;const s=Js.connect();s.emit(Ys.SUBSCRIBE,{topic:"task",id:n.id});const r=g=>{g.taskId===n.id&&(v.invalidateQueries({queryKey:["tasks"]}),J())},i=g=>{g.taskId===n.id&&(v.invalidateQueries({queryKey:be.workspaces.list(n.id)}),J())},x=g=>{g.taskId===n.id&&(v.invalidateQueries({queryKey:be.workspaces.list(n.id)}),J())};return s.on(B.TASK_UPDATED,r),s.on(B.WORKSPACE_COMMIT_MESSAGE_UPDATED,i),s.on(B.WORKSPACE_HIBERNATED,x),()=>{s.off(B.TASK_UPDATED,r),s.off(B.WORKSPACE_COMMIT_MESSAGE_UPDATED,i),s.off(B.WORKSPACE_HIBERNATED,x),s.emit(Ys.UNSUBSCRIBE,{topic:"task",id:n.id})}},[n?.id,v,J]),t.useEffect(()=>{if(!y)return;const s=Js.connect(),r=i=>{i.sessionId===y&&(v.invalidateQueries({queryKey:["workspaces"]}),J())};return s.on(B.SESSION_COMPLETED,r),()=>{s.off(B.SESSION_COMPLETED,r)}},[y,v,J]);const{todos:Pe}=un(Nt),{files:St,addFiles:Y,removeFile:It,clear:Ks,buildMarkdownLinks:qs,hasFiles:ge,isUploading:Oe}=fn(),Rt=t.useMemo(()=>An(b),[b?.tokenUsage]),Vs=on(xe,Rt);t.useEffect(()=>{y&&zs&&De()},[y,zs,De]);const Gs=t.useRef(n?.id);t.useEffect(()=>{if(Gs.current!==n?.id&&F.current){const s=F.current;requestAnimationFrame(()=>{s.scrollTop=s.scrollHeight})}Gs.current=n?.id},[n?.id,F]);const L=jn(),rs=t.useRef(!1),Hs=t.useCallback(async()=>{if(!d.trim()&&!ge||!y||rs.current||L.isPending||me||Oe||Te)return;rs.current=!0;const s=qs(),r=[d.trim(),s].filter(Boolean).join(`
2
-
3
- `);D(""),Ks(),oe.current&&(oe.current.style.height="60px"),We.mutate({id:y,message:r,providerId:Ae??void 0},{onSuccess:()=>{De()},onError:()=>{D(i=>i||r)},onSettled:()=>{rs.current=!1}})},[d,y,We,De,ge,Oe,qs,Ks,Ae,Te,L.isPending,me]),At=t.useCallback(()=>{!y||L.isPending||L.mutate(y)},[y,L]),Tt=t.useCallback(s=>{const r=s.target.files;r&&r.length>0&&Y(Array.from(r)),s.target.value=""},[Y]),Et=t.useCallback(s=>{const r=s.clipboardData.items,i=[];for(const x of r)if(x.kind==="file"){const g=x.getAsFile();g&&i.push(g)}i.length>0&&(s.preventDefault(),Y(i))},[Y]),[Qs,os]=t.useState(!1),Wt=t.useCallback(s=>{s.preventDefault(),os(!0)},[]),Mt=t.useCallback(s=>{s.preventDefault(),os(!1)},[]),Dt=t.useCallback(s=>{s.preventDefault(),os(!1);const r=s.dataTransfer.files;r.length>0&&Y(Array.from(r))},[Y]),W=t.useCallback(s=>{const r=Cs.current?.getBoundingClientRect().width??(typeof window<"u"?window.innerWidth:void 0),i=r?Math.max(ee,r-ds-or-ar):ee;return Math.max(ee,Math.min(Math.round(s),i))},[]),as=t.useCallback(s=>{const r=s.clientX-ys.current;ae(W(ks.current-r))},[W]),is=t.useCallback(()=>{js(!1),document.body.style.cursor="",document.body.style.userSelect=""},[]);t.useEffect(()=>{if(Se)return document.addEventListener("mousemove",as),document.addEventListener("mouseup",is),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",as),document.removeEventListener("mouseup",is),document.body.style.cursor="",document.body.style.userSelect=""}},[is,as,Se]);const Pt=t.useCallback(s=>{s.preventDefault(),ys.current=s.clientX,ks.current=qe,js(!0)},[qe]);t.useEffect(()=>{!E||Se||ae(s=>W(s))},[W,E,Se]),t.useEffect(()=>{if(!E)return;const s=()=>{ae(r=>W(r))};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[W,E]);const Ot=t.useCallback(()=>{ae(s=>W(s)),vs(!0),requestAnimationFrame(()=>{Ce.current?.setTab("review")})},[W]),Lt=t.useCallback(s=>{D(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=fe&&N?e.jsx(Tn,{projectId:n?.projectId??"",workspaceId:N,branchName:Ze,targetBranch:es,commitMessage:Es,changes:xt,gitStatus:A,isGitStatusLoading:pt,canRunGitOperations:de,onOpenChanges:Ot,onRefreshCommitMessage:Ms,onConflict:Me,className:"mb-1.5"}):null;return n?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 ${n.projectColor.replace("text-","bg-")}`}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:n.projectName}),n.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground shrink-0",children:n.projectRepoDeletedAt?o("源码已删除"):o("已删除")}),e.jsx("span",{className:"text-muted-foreground/40 text-xs",children:"/"}),e.jsx("span",{className:"text-xs text-muted-foreground/70 font-mono truncate",children:n.branch})]}),e.jsx(En,{taskId:n.id,title:n.title,readOnly:m})]}),e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[e.jsx(lr,{status:n.status,onChangeStatus:!m&&c?s=>c(n.id,s):void 0}),e.jsx(yn,{value:n.priority,onChange:!m&&C?s=>C(n.id,s):void 0}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:yt,disabled:!w||m,className:"w-8 h-8 flex items-center justify-center rounded-md text-muted-foreground/70 hover:text-foreground hover:bg-muted transition-colors disabled:opacity-30 disabled:cursor-not-allowed",title:o("Open in IDE"),children:e.jsx(Jn,{size:16})}),(l||Ie)&&!m&&e.jsxs("div",{className:"relative",ref:Ke,children:[e.jsx("button",{onClick:()=>te(s=>!s),className:"w-8 h-8 flex items-center justify-center rounded-md text-muted-foreground/70 hover:text-foreground hover:bg-muted transition-colors",title:o("More actions"),children:e.jsx(Wn,{size:16})}),Ue&&e.jsxs("div",{className:"absolute right-0 top-full mt-2 w-44 bg-background rounded-lg border border-border shadow-lg z-50 py-1",children:[Ie&&e.jsxs("button",{onClick:()=>{I(!0),te(!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(nt,{size:15}),e.jsx("span",{children:o("创建 TeamRun")})]}),e.jsxs("button",{onClick:()=>{O(!0),te(!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(Xt,{size:15}),e.jsx("span",{children:o("重新开始")})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-1 border-t border-border/60"}),e.jsxs("button",{onClick:()=>{se(!0),te(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive hover:bg-destructive/10 transition-colors",children:[e.jsx(Yn,{size:15}),e.jsx("span",{children:o("删除任务")})]})]})]})]})]})]})]}),de&&N&&A&&e.jsx(tr,{workspaceId:N,gitStatus:A,onResolve:()=>Me()}),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:He&&f?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(Mn,{session:b,providers:X,usage:Vs,providerIdFallback:mt?.providerId,agentTypeFallback:b?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(U,{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:Ct,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:F,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pt-6 pb-4",children:e.jsx("div",{ref:gs,className:"w-full max-w-4xl mx-auto",children:Us?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground/70",children:[e.jsxs("svg",{className:"animate-spin 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...")})]}):xe.length===0?e.jsx("div",{className:"text-muted-foreground/70 text-center py-8",children:o(ue?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(et,{children:e.jsx(Zs,{logs:xe,downloadSessionId:Q,isOutputActive:Fs,lastExitAt:_s,onUserToggleDetails:bs,workingDir:w,scrollElementRef:F,onOpenWorkspaceFile:Ve,onOpenPreviewUrl:Is,onOpenVisualization:Rs})})})}),!hs&&e.jsxs("button",{onClick:()=>Ne(),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-md text-xs text-muted-foreground hover:bg-background hover:text-foreground transition-all","aria-label":o("Scroll to bottom"),children:[e.jsx(rt,{size:14}),e.jsx("span",{children:o("回到底部")})]})]}),Pe.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(st,{todos:Pe})})})]}):e.jsx(Dn,{teamRun:f,messages:ct??f.messages??[],readOnly:m,readOnlyMessage:Je,onSendMessage:wt,onViewInvocationSession:Bs,changeSummaryBar:$s,centered:!0,workingDir:w,onOpenWorkspaceFile:Ve,onOpenPreviewUrl:$e,onOpenVisualization:Xe}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:F,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:[(Ss||G?.body)&&e.jsx("div",{className:"mb-4 pb-4 border-b border-border/60 min-w-0",children:Ss?e.jsx("p",{className:"text-sm text-muted-foreground/70 italic",children:o("Loading...")}):G?.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(tn,{urlTransform:rr,components:nn,children:G.body})}):null}),!m&&e.jsx(Pn,{state:ws,setupProgress:ie,sessionStarted:!!p?.startedAt,onRetry:H&&u?.status==="failed"?ns:void 0},n.id),lt?(!Ge||m)&&e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground/70",children:[e.jsxs("svg",{className:"animate-spin 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...")})]}):H?Us?e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground/70",children:[e.jsxs("svg",{className:"animate-spin 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...")})]}):xe.length===0?e.jsx("div",{className:"text-muted-foreground/70 text-center py-8",children:o(ue?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(et,{children:e.jsx(Zs,{logs:xe,downloadSessionId:Q,isOutputActive:Fs,lastExitAt:_s,onUserToggleDetails:bs,workingDir:w,scrollElementRef:F,onOpenWorkspaceFile:Ve,onOpenPreviewUrl:Is,onOpenVisualization:Rs})}):!Ge||u?.status==="failed"||ie?.status==="failed"||m?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(!Ge||m)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-14 h-14 bg-muted/50 rounded-2xl border border-border/60 flex items-center justify-center mb-5",children:e.jsx(cs,{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(m?"项目为只读历史":"尚未启动 Agent")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-xs",children:m?Je:o("选择一个 Agent 来执行此任务,Agent 将自动创建工作空间并开始工作。")})]}),!m&&(!u||u.status==="failed")&&e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[e.jsxs(U,{onClick:ns,disabled:!!(u&&u.status!=="failed"),children:[e.jsx(cs,{size:16,className:"mr-1.5"}),u?.status==="failed"?o("重试启动 Agent"):o("启动 Agent")]}),Ie&&e.jsxs(U,{variant:"outline",onClick:()=>I(!0),children:[e.jsx(nt,{size:16,className:"mr-1.5"}),o("创建 TeamRun")]})]})]}):null]})}),!hs&&e.jsxs("button",{onClick:()=>Ne(),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-md text-xs text-muted-foreground hover:bg-background hover:text-foreground transition-all","aria-label":o("Scroll to bottom"),children:[e.jsx(rt,{size:14}),e.jsx("span",{children:o("回到底部")})]})]}),Pe.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(st,{todos:Pe})})}),m?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:Je})})}):ft?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(U,{size:"sm",onClick:ns,children:[e.jsx(cs,{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:Wt,onDragLeave:Mt,onDrop:Dt,children:[e.jsxs("div",{className:"max-w-4xl mx-auto",children:[$s,y?e.jsx(an,{sessionId:y}):null,e.jsxs("div",{ref:_e,className:`relative bg-background rounded-xl border hover:border-ring/40 focus-within:border-ring/60 transition-colors duration-200 ${Qs?"border-info bg-info/5":"border-border"}`,children:[e.jsx(pn,{files:St,onRemove:It}),e.jsx("textarea",{ref:oe,value:d,onChange:Lt,onPaste:Et,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...":H&&!ue?"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/70 hover:text-muted-foreground hover:bg-muted rounded-lg transition-colors",title:o("Upload file"),children:e.jsx(Zn,{size:18})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[p&&X&&e.jsx(ln,{providers:X,currentProviderId:Ae,agentType:p.agentType,runtimeType:p.runtimeType,onSelect:Ts}),e.jsx(cn,{usage:Vs}),ue&&!d.trim()&&!ge?e.jsx("button",{onClick:At,disabled:L.isPending||me,className:"p-2 rounded-lg transition-all duration-200 bg-destructive text-white hover:bg-destructive/90 disabled:opacity-50",children:e.jsx(Yt,{size:14})}):e.jsx("button",{onClick:Hs,disabled:!d.trim()&&!ge||Oe||We.isPending||L.isPending||me||!!Te,className:`p-2 rounded-lg transition-all duration-200 ${(d.trim()||ge)&&!Oe&&!We.isPending&&!L.isPending&&!me&&!Te?"bg-primary text-primary-foreground hover:bg-primary/90":"bg-transparent text-muted-foreground/50 cursor-not-allowed"}`,children:e.jsx(er,{size:18})})]})]})]})]}),e.jsx(tt,{open:K.query!==null,anchorRef:_e,commands:K.filteredCommands,selectedIndex:K.selectedIndex,query:K.query??"",hasCatalog:K.allCommands.length>0,onSelect:K.applyCommand}),e.jsx(tt,{open:q.query!==null,anchorRef:_e,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:Pt,role:"separator","aria-orientation":"vertical","aria-label":o("调整工作区宽度")}),e.jsx("div",{className:"flex h-full flex-shrink-0 bg-background",style:{width:E?ds+qe:ds},children:e.jsx(On,{sessionId:H||void 0,workspaceId:_,workingDir:w,projectId:n.projectId,readOnly:m,repoDeleted:As,teamRun:f,teamStatus:f?e.jsx(Ln,{teamRun:f,workspaces:a,selectedWorkspaceId:_,onSelectWorkspace:re,onViewInvocationSession:Bs}):void 0,workspaces:a,selectedWorkspaceId:_,onSelectWorkspace:re,variant:"rail",expanded:E,onExpandedChange:s=>{s&&ae(r=>W(r)),vs(s)},minContentWidth:ee,tabRef:Ce,gitAvailable:ce,gitProps:de&&N?{branchName:Ze,targetBranch:es,commitMessage:Es,canRunGitOperations:!0,onRefreshCommitMessage:Ms,onConflict:Me,onResolveConflicts:()=>Me()}:void 0})})]}),!m&&e.jsx(Bn,{isOpen:ye,onClose:()=>P(!1),taskId:n.id,projectId:n.projectId,taskTitle:G?.title??n.title,taskDescription:G?.body??"",taskPrompt:G?.prompt,projectIsGitRepo:n.isGitRepo,projectWorktreeReady:n.worktreeReady,projectGitReason:n.reason,onStarted:()=>S?.(n.id)}),Ie&&!m&&e.jsx(sr,{isOpen:ke,onClose:()=>I(!1),taskId:n.id}),de&&Ws&&k&&e.jsx(zn,{open:it,onOpenChange:s=>{ms(s),s||ps(null)},workspaceId:Ws,conflictOp:k.conflictOp,conflictedFiles:k.conflictedFiles,sourceBranch:bt,targetBranch:vt,operation:A?.operation,worktreePath:ht,mergeAborted:k.mergeAborted,mergeStrategy:k.mergeStrategy,sourceWorkspaceId:k.sourceWorkspaceId,targetWorkspaceId:k.targetWorkspaceId,sourceWorktreePath:k.sourceWorktreePath,targetWorktreePath:k.targetWorktreePath,sessions:gt,currentSessionId:He?void 0:H,teamRunId:f?.id}),e.jsx(Qn,{isOpen:ze,onClose:()=>O(!1),onConfirm:jt,title:o("重新开始任务"),description:e.jsx("p",{children:o("将归档当前工作区并自动在新 Worktree 中重新启动 Agent,旧工作区内容保留供参考。")}),confirmText:o("确认重试"),variant:"default",isLoading:at}),e.jsx($n,{isOpen:Be,onClose:()=>se(!1),onConfirm:kt,taskId:n.id,taskTitle:n.title,workspaces:a,isLoading:M})]}):e.jsx(ir,{})}export{Xr as TaskDetail};
@@ -1 +0,0 @@
1
- import{u as Re,F as gt,G as bt,H as ft,J as ht,K as vt,M as jt,N as yt,O as Pt,r as l,j as e,S as Ee,P as Nt,h as Tt,l as B,s as Ae,B as p,v as _e,t as c,Q as kt}from"./index-CMJV-mgF.js";import{C as Fe}from"./confirm-dialog-BrgNTypL.js";import{M as wt}from"./modal-DeigO7aN.js";import{S as $}from"./select-DKS02St6.js";import"./mermaid-NOHMQCX5-C72362la.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import{A as Ct}from"./AgentLogo-BDyW3ihb.js";import{M as U}from"./MemberAvatar-CCRbS97s.js";import{u as It}from"./use-providers-DB9ghBPq.js";import{T as ue,P as R}from"./trash-2-Bc-URu8c.js";import{C as St}from"./chevron-up-D0y6skqr.js";import{C as Mt}from"./chevron-down-BaQEBzp3.js";import"./check-qs0S_9rB.js";const o="/avatars/presets",Et=[{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=kt(),At=2*1024*1024,_t=[],Ft=[],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},Oe=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],$t=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],Rt=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],Dt=[{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(i=>i.memberPresetId)??[]}}function zt(r,i,d,m){if(d.filter(A=>A===m).length<=1)return r;const W=d.slice(0,i+1).filter(A=>A===m).length;return`${r} #${W}`}function Lt(r){return Array.from(new Set(r.split(/[\n,]/).map(i=>i.trim()).filter(Boolean)))}function Bt(r){return r.trim()||null}function $e(r){return ze.reduce((i,d)=>i+(r[d.key]?1:0),0)}function E(r,i){return r instanceof Error?r.message:i}function Ut(r){return["image/png","image/jpeg","image/webp"].includes(r.type)}async function Yt(r){const i=new FormData;i.append("file",r);const d=await fetch(`${De}/attachments/upload`,{method:"POST",body:i});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:i,isFetching:d,onRetry:m}){const{t:k}=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",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/90",children:E(i,k("请稍后重试。"))})]}),e.jsx(p,{type:"button",size:"sm",variant:"outline",onClick:m,disabled:d,children:k(d?"加载中...":"重试")})]})})}function ar(){const{t:r}=Re(),{data:i,error:d,isError:m,isFetching:k,isLoading:W,refetch:A}=It(),{data:Be,error:ge,isError:w,isFetching:be,isLoading:V,refetch:fe}=gt(),{data:Ue,error:Ye,isError:D,isFetching:qe,isLoading:H,refetch:Ge}=bt(),Q=ft(),J=ht(),he=vt(),K=jt(),X=yt(),ve=Pt(),[Z,je]=l.useState("presets"),[C,ee]=l.useState("edit"),[h,te]=l.useState(null),[a,j]=l.useState(Y()),[ye,_]=l.useState(!1),[y,re]=l.useState(null),[We,se]=l.useState(!1),[Pe,Ne]=l.useState(!1),Te=l.useRef(null),[I,ae]=l.useState("edit"),[v,ne]=l.useState(null),[g,b]=l.useState(q()),[ke,P]=l.useState(!1),[N,oe]=l.useState(null),[we,F]=l.useState(!1),u=Be??_t,f=Ue??Ft,z=i??Ot,O=l.useMemo(()=>new Map(u.map(t=>[t.id,t])),[u]),le=l.useMemo(()=>new Map(f.map(t=>[t.id,t])),[f]),Ve=l.useMemo(()=>{const t=z.map(({provider:s,availability:n})=>({value:s.id,label:s.name+(n.type==="NOT_FOUND"?r(" (不可用)"):""),icon:e.jsx(Ct,{agentType:s.agentType,className:"size-4"}),disabled:n.type==="NOT_FOUND"}));return a.providerId&&!t.some(s=>s.value===a.providerId)&&t.unshift({value:a.providerId,label:`${a.providerId}${r(" (不可用)")}`,disabled:!0}),t},[a.providerId,z,r]),ie=h?O.get(h)??null:null,de=v?le.get(v)??null:null,He=l.useMemo(()=>new Map(z.map(({provider:t,availability:s})=>[t.id,t.name+(s.type==="NOT_FOUND"?r(" (不可用)"):"")])),[z,r]);if(l.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]),l.useEffect(()=>{if(!(H||D||ke)){if(I==="create"){b(q());return}if(v){const t=le.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,le,ke,I,f,D,H]),W||V||H)return e.jsx(Ee,{className:"max-w-6xl",children:e.jsx(Nt,{cards:6})});const x=(t,s)=>{j(n=>({...n,[t]:s})),_(!0)},Qe=(t,s)=>{j(n=>({...n,capabilities:{...n.capabilities,[t]:s}})),_(!0)},Je=t=>{x("avatar",t),se(!1)},Ke=()=>{x("avatar","")},Xe=async t=>{const s=t.target.files?.[0];if(t.target.value="",!!s){if(!Ut(s)){c.error(r("仅支持 PNG、JPG、WebP 头像。"));return}if(s.size>At){c.error(r("头像图片不能超过 2MB。"));return}Ne(!0);try{const n=await Yt(s);x("avatar",`${De}${n.url}`),c.success(r("头像已上传"))}catch(n){c.error(E(n,r("头像上传失败")))}finally{Ne(!1)}}},S=(t,s)=>{ee(t),te(s?.id??null),j(s?xe(s):Y()),_(!1)},Ce=(t,s)=>{b(n=>({...n,[t]:s})),P(!0)},M=(t,s)=>{ae(t),ne(s?.id??null),b(s?pe(s):q()),P(!1)},Ze=async()=>{const t={name:a.name.trim(),aliases:Lt(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:Bt(a.avatar)};try{if(C==="create"||!h){const s=await Q.mutateAsync(t);S("edit",s),c.success(r("已创建"))}else{const s=await J.mutateAsync({id:h,data:t});S("edit",s),c.success(r("已保存"))}}catch(s){c.error(E(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?S("edit",t[0]):S("create",null)),re(null)}catch(t){c.error(E(t,r("删除失败")))}},tt=async()=>{const t={name:g.name.trim(),heartbeatTimeoutMinutes:g.heartbeatTimeoutMinutes,memberPresetIds:g.memberPresetIds};try{if(I==="create"||!v){const s=await K.mutateAsync(t);M("edit",s),c.success(r("已创建"))}else{const s=await X.mutateAsync({id:v,data:t});M("edit",s),c.success(r("已保存"))}}catch(s){c.error(E(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?M("edit",t[0]):M("create",null)),oe(null)}catch(t){c.error(E(t,r("删除失败")))}},st=$e(a.capabilities),at=!!a.name.trim()&&!!a.providerId.trim()&&!!a.rolePrompt.trim()&&!m&&!w&&!Q.isPending&&!J.isPending,nt=!!g.name.trim()&&!D&&!w&&!K.isPending&&!X.isPending,ce=g.memberPresetIds.map(t=>O.get(t)).filter(t=>!!t),ot=t=>{_(!1),S("edit",t)},lt=()=>{_(!1),S("create",null)},it=t=>{P(!1),M("edit",t)},dt=()=>{P(!1),M("create",null)},ct=t=>{b(s=>({...s,memberPresetIds:[...s.memberPresetIds,t]})),P(!0)},mt=t=>{b(s=>({...s,memberPresetIds:s.memberPresetIds.filter((n,T)=>T!==t)})),P(!0)},Ie=(t,s)=>{b(n=>{const T=t+s;if(T<0||T>=n.memberPresetIds.length)return n;const me=[...n.memberPresetIds],[pt]=me.splice(t,1);return me.splice(T,0,pt),{...n,memberPresetIds:me}}),P(!0)},ut=t=>{ot(t),F(!0)},Se=()=>{lt(),F(!0)},xt=t=>{it(t),F(!0)},Me=()=>{dt(),F(!0)},L=()=>F(!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-sm":"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-sm":"text-muted-foreground hover:text-foreground"),children:r("团队模板")})]})}),m&&e.jsx(G,{title:r("Provider 列表加载失败"),error:d,isFetching:k,onRetry:()=>{A()}}),Z==="presets"?we?e.jsxs("div",{className:"rounded-xl border border-border bg-white",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-neutral-200",children:"|"}),e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:C==="create"?r("创建新预设"):ie?.name??r("编辑预设")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[C==="edit"&&ie&&e.jsx("button",{onClick:()=>re(ie),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:Q.isPending||J.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-[10px] text-muted-foreground hover:text-foreground transition-colors",children:r("选择")}),e.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),e.jsx("button",{type:"button",onClick:()=>Te.current?.click(),disabled:Pe,className:"text-[10px] 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/60",children:"·"}),e.jsx("button",{type:"button",onClick:Ke,className:"text-[10px] text-muted-foreground hover:text-destructive transition-colors",children:r("清除")})]})]}),e.jsx("input",{ref:Te,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:Xe})]}),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($,{value:a.providerId,onChange:t=>x("providerId",t),options:Ve,disabled:m}),m&&e.jsx("p",{className:"mt-1 text-[11px] text-destructive",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=>Qe(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($,{value:a.workspacePolicy,onChange:t=>x("workspacePolicy",t),options:Oe.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($,{value:a.triggerPolicy,onChange:t=>x("triggerPolicy",t),options:$t.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($,{value:a.sessionPolicy,onChange:t=>x("sessionPolicy",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($,{value:a.queueManagementPolicy,onChange:t=>x("queueManagementPolicy",t),options:Dt.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(R,{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(R,{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=$e(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-sm",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-[11px] text-muted-foreground mt-0.5",children:t.aliases.join(", ")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground mt-1",children:He.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-[10px] font-medium text-muted-foreground",children:r(Oe.find(n=>n.value===t.workspacePolicy)?.label??t.workspacePolicy)}),e.jsxs("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:[s,"/10 ",r("能力")]})]})]})]},t.id)})})]}):we?e.jsxs("div",{className:"rounded-xl border border-border bg-white",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-neutral-200",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:K.isPending||X.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-neutral-900 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-neutral-900 px-1.5 py-0.5 text-[10px] font-medium text-white",children:["x",s]}),e.jsx(R,{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:zt(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(St,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ie(s,1),disabled:s===ce.length-1,children:e.jsx(Mt,{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(R,{size:13})," ",r("新增模板")]})]}),D?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(R,{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(T=>O.get(T.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-sm",children:[e.jsx("div",{className:"truncate text-[13px] font-semibold text-foreground",children:t.name}),e.jsx("div",{className:"text-[11px] text-muted-foreground mt-1",children:r("{count} 个成员",{count:s})}),n.length>0&&e.jsxs("div",{className:"truncate text-[11px] 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(wt,{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:Et.map(t=>{const s=a.avatar===t.src;return e.jsxs("button",{type:"button",onClick:()=>Je(t.src),className:B("group rounded-xl border bg-background p-2 text-center transition-all hover:border-neutral-400 hover:bg-muted focus:outline-none focus:ring-2 focus:ring-neutral-900/15",s?"border-neutral-900 ring-2 ring-neutral-900/10":"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-[10px] 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{ar as TeamSettingsPage};
@@ -1 +0,0 @@
1
- import{c as O}from"./index-CMJV-mgF.js";const N=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],S=O("chevron-right",N);const h=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],K=O("file-text",h);var d;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(d||(d={}));var c;(function(e){e[e.LOW=-1]="LOW",e[e.NORMAL=0]="NORMAL",e[e.HIGH=1]="HIGH",e[e.URGENT=2]="URGENT"})(c||(c={}));var p;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED",e.HIBERNATED="HIBERNATED"})(p||(p={}));var l;(function(e){e.WORKTREE="WORKTREE",e.MAIN_DIRECTORY="MAIN_DIRECTORY"})(l||(l={}));var o;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT",e.CODEX="CODEX",e.QWEN_CODE="QWEN_CODE",e.KIRO_CLI="KIRO_CLI",e.OPENCODE="OPENCODE",e.PI_CODING_AGENT="PI_CODING_AGENT",e.GROK_BUILD="GROK_BUILD",e.MINION_CODE="MINION_CODE",e.DEEPSEEK_HERMES="DEEPSEEK_HERMES"})(o||(o={}));var t;(function(e){e.CLI="CLI",e.ACP="ACP"})(t||(t={}));var r;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(r||(r={}));var m;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(m||(m={}));var _;(function(e){e.WORKSPACE="WORKSPACE",e.CONVERSATION="CONVERSATION"})(_||(_={}));var I;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(I||(I={}));const A=["oss","ollama","lmstudio","amazon-bedrock"];function T(e){return A.includes(e)}const f={[o.CLAUDE_CODE]:{agentType:o.CLAUDE_CODE,apiBaseUrl:{kind:"env",path:"ANTHROPIC_BASE_URL",placeholder:"https://api.anthropic.com"},apiKey:{kind:"env",path:"ANTHROPIC_API_KEY"},model:{kind:"config",path:"model",placeholder:"claude-sonnet-4-20250514"},reasoningEffort:{kind:"config",path:"effort",options:["low","medium","high","xhigh","max"]},executionPermission:{kind:"config",path:"dangerouslySkipPermissions",riskKind:"skip-permissions"},settingsFormat:"json"},[o.CODEX]:{agentType:o.CODEX,apiBaseUrl:{kind:"settings",path:"openai_base_url",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model",placeholder:"gpt-5.3-codex"},reasoningEffort:{kind:"settings",path:"model_reasoning_effort",options:["minimal","low","medium","high","xhigh"]},executionPermission:{kind:"config",path:"dangerouslyBypassApprovalsAndSandbox",riskKind:"bypass-approvals-and-sandbox"},fastMode:{kind:"config",path:"fastMode"},disableResponsesWebsocket:{kind:"config",path:"disableResponsesWebsocket"},settingsFormat:"toml"},[o.GEMINI_CLI]:{agentType:o.GEMINI_CLI,apiKey:{kind:"env",path:"GEMINI_API_KEY"},model:{kind:"config",path:"model",placeholder:"gemini-2.5-pro"},executionPermission:{kind:"config",path:"yolo",riskKind:"auto-approve"}},[o.CURSOR_AGENT]:{agentType:o.CURSOR_AGENT,model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"force",riskKind:"force-execution"}},[o.QWEN_CODE]:{agentType:o.QWEN_CODE,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://dashscope.aliyuncs.com/compatible-mode/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model",placeholder:"qwen3-coder-plus"},executionPermission:{kind:"config",path:"yolo",riskKind:"auto-approve"}},[o.KIRO_CLI]:{agentType:o.KIRO_CLI,model:{kind:"config",path:"model"},reasoningEffort:{kind:"config",path:"effort",options:["low","medium","high","xhigh","max"]},executionPermission:{kind:"config",path:"trustAllTools",riskKind:"auto-approve"}},[o.OPENCODE]:{agentType:o.OPENCODE,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"autoApprove",riskKind:"auto-approve"}},[o.PI_CODING_AGENT]:{agentType:o.PI_CODING_AGENT,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},reasoningEffort:{kind:"config",path:"effort",options:["minimal","low","medium","high","xhigh"]},executionPermission:{kind:"config",path:"autoApprove",riskKind:"auto-approve"}},[o.GROK_BUILD]:{agentType:o.GROK_BUILD,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.x.ai/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"alwaysApprove",riskKind:"auto-approve"}},[o.MINION_CODE]:{agentType:o.MINION_CODE,apiBaseUrl:{kind:"env",path:"OPENAI_BASE_URL",placeholder:"https://api.openai.com/v1"},apiKey:{kind:"env",path:"OPENAI_API_KEY"},model:{kind:"config",path:"model"},executionPermission:{kind:"config",path:"dangerouslySkipPermissions",riskKind:"skip-permissions"}},[o.DEEPSEEK_HERMES]:{agentType:o.DEEPSEEK_HERMES,apiBaseUrl:{kind:"env",path:"DEEPSEEK_BASE_URL",placeholder:"https://api.deepseek.com"},apiKey:{kind:"env",path:"DEEPSEEK_API_KEY"},model:{kind:"config",path:"model",placeholder:"deepseek-v4-pro"},reasoningEffort:{kind:"config",path:"effort",options:["off","low","high","max"]},executionPermission:{kind:"config",riskKind:"auto-approve"}}};function G(e){return f[e]}var n;(function(e){e.Action="Action",e.Assistant="Assistant",e.Info="Info",e.Tool="Tool",e.User="User",e.Cursor="Cursor",e.Error="Error",e.Warning="Warning"})(n||(n={}));function D(e){const a=e.metadata?.toolName||"Tool",i=e.metadata?.action,s=e.metadata?.status,u={file_read:"Read File",file_edit:"Edit File",command_run:"Run Command",search:"Search",web_fetch:"Fetch URL",tool:"Tool",task_create:"Create Task",plan_presentation:"Present Plan",todo_management:"Manage Todo",other:"Action"},E=e.metadata?.toolKind?a:i?u[i]:a;return s==="success"?`${E} ✓`:s==="failed"?`${E} ✗`:s==="pending_approval"?`${E} (待审批)`:E}function C(e){switch(e.entryType){case"user_message":case"user_feedback":return{id:e.id,timestamp:e.timestamp,type:n.User,content:e.content};case"assistant_message":return{id:e.id,timestamp:e.timestamp,type:n.Assistant,content:e.content};case"next_action":return{id:e.id,timestamp:e.timestamp,type:n.Action,content:e.content};case"thinking":return{id:e.id,timestamp:e.timestamp,type:n.Info,title:"Thinking",content:e.content};case"tool_use":return{id:e.id,timestamp:e.timestamp,type:n.Tool,title:D(e),content:e.content,isCollapsed:e.metadata?.status==="success",tool:{action:e.metadata?.action,name:e.metadata?.toolName,id:e.metadata?.toolId,kind:e.metadata?.toolKind,status:e.metadata?.status,content:e.metadata?.toolContent,locations:e.metadata?.toolLocations,inputSummary:e.metadata?.toolInputSummary,outputSummary:e.metadata?.toolOutputSummary}};case"error_message":return{id:e.id,timestamp:e.timestamp,type:n.Error,content:e.content};case"warning_message":return{id:e.id,timestamp:e.timestamp,type:n.Warning,content:e.content};case"system_message":return{id:e.id,timestamp:e.timestamp,type:n.Info,content:e.content};case"loading":return{id:e.id,timestamp:e.timestamp,type:n.Cursor,content:"",cursorActivity:{processingStartedAt:e.timestamp}};case"token_usage_info":if(e.metadata?.tokenUsage){const{totalTokens:a=0,modelContextWindow:i}=e.metadata.tokenUsage;return{id:e.id,timestamp:e.timestamp,type:n.Info,content:e.content,tokenUsage:{totalTokens:a,modelContextWindow:i}}}return null;default:return null}}const g=new WeakMap;function R(e){if(typeof e!="object"||e===null)return C(e);const a=g.get(e);if(a!==void 0)return a;const i=C(e);return g.set(e,i),i}function M(e){const a=[];for(const i of e){const s=R(i);s!==null&&a.push(s)}return a}function U(e){return{id:`cursor-${Date.now()}`,timestamp:e?.processingStartedAt??Date.now(),type:n.Cursor,content:"",cursorActivity:e}}const b={[o.CLAUDE_CODE]:[t.CLI,t.ACP],[o.GEMINI_CLI]:[t.CLI,t.ACP],[o.CURSOR_AGENT]:[t.CLI,t.ACP],[o.CODEX]:[t.CLI,t.ACP],[o.QWEN_CODE]:[t.ACP],[o.KIRO_CLI]:[t.ACP],[o.OPENCODE]:[t.ACP],[o.PI_CODING_AGENT]:[t.ACP],[o.GROK_BUILD]:[t.ACP],[o.MINION_CODE]:[t.ACP],[o.DEEPSEEK_HERMES]:[t.ACP]},P=Object.freeze(Object.values(o).filter(e=>e!==o.MINION_CODE));new Set(P);const k={[o.CLAUDE_CODE]:{agentType:o.CLAUDE_CODE,label:"Claude Code",logoSrc:"/agent-icons/claude-code.svg"},[o.GEMINI_CLI]:{agentType:o.GEMINI_CLI,label:"Gemini CLI",logoSrc:"/agent-icons/gemini-cli.svg"},[o.CURSOR_AGENT]:{agentType:o.CURSOR_AGENT,label:"Cursor Agent",logoSrc:"/agent-icons/cursor-agent.svg"},[o.CODEX]:{agentType:o.CODEX,label:"Codex",logoSrc:"/agent-icons/codex.svg"},[o.QWEN_CODE]:{agentType:o.QWEN_CODE,label:"Qwen Code",logoSrc:"/agent-icons/qwen-code.svg"},[o.KIRO_CLI]:{agentType:o.KIRO_CLI,label:"Kiro CLI",logoSrc:"/agent-icons/kiro-cli.svg"},[o.OPENCODE]:{agentType:o.OPENCODE,label:"OpenCode",logoSrc:"/agent-icons/opencode.svg"},[o.PI_CODING_AGENT]:{agentType:o.PI_CODING_AGENT,label:"Pi Coding Agent",logoSrc:"/agent-icons/pi-coding-agent.svg"},[o.GROK_BUILD]:{agentType:o.GROK_BUILD,label:"Grok Build",logoSrc:"/agent-icons/grok-build.svg"},[o.MINION_CODE]:{agentType:o.MINION_CODE,label:"Minion Code"},[o.DEEPSEEK_HERMES]:{agentType:o.DEEPSEEK_HERMES,label:"DeepSeek Harness",logoSrc:"/agent-icons/deepseek-hermes.svg"}};function v(e){return e?k[e]??null:null}function B(e,a){return v(e)?.label??a??(e?String(e):"")}export{o as A,S as C,K as F,n as L,f as P,t as R,r as S,c as T,P as U,p as W,l as a,b,B as c,U as d,G as e,d as f,v as g,I as h,T as i,k as j,M as n};
@@ -1 +0,0 @@
1
- import{c as o}from"./index-CMJV-mgF.js";const e=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],c=o("arrow-down",e);export{c as A};
@@ -1 +0,0 @@
1
- import{U as a,R as n}from"./index-D_QVcsLn.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{c}from"./index-CMJV-mgF.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
@@ -1 +0,0 @@
1
- import{c as o}from"./index-CMJV-mgF.js";const n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};
@@ -1 +0,0 @@
1
- import{c as e}from"./index-CMJV-mgF.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y=e("circle-alert",c);export{y as C};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-BqGfqkDK.js";import{_ as i}from"./index-D_QVcsLn.js";import"./chunk-FMBD7UC4-DRza-3q8.js";import"./chunk-ND2GUHAM-CUgkviLu.js";import"./chunk-55IACEB6-KNAJbQyw.js";import"./chunk-2J33WTMH-CDxRPp-8.js";import"./index-CMJV-mgF.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-BqGfqkDK.js";import{_ as i}from"./index-D_QVcsLn.js";import"./chunk-FMBD7UC4-DRza-3q8.js";import"./chunk-ND2GUHAM-CUgkviLu.js";import"./chunk-55IACEB6-KNAJbQyw.js";import"./chunk-2J33WTMH-CDxRPp-8.js";import"./index-CMJV-mgF.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
@@ -1,2 +0,0 @@
1
- import{L as h,Z as x,I as p,g as u}from"./mermaid-NOHMQCX5-C72362la.js";import{r as i,j as a}from"./index-CMJV-mgF.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import"./chevron-down-BaQEBzp3.js";var v=u("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),k=r=>{let e={};for(let l of r.split(";")){let n=l.indexOf(":");if(n>0){let c=l.slice(0,n).trim(),o=l.slice(n+1).trim();c&&o&&(e[c]=o)}}return e},j=i.memo(({children:r,result:e,language:l,className:n,...c})=>{let o=i.useMemo(()=>{let s={};return e.bg&&(s["--sdm-bg"]=e.bg),e.fg&&(s["--sdm-fg"]=e.fg),e.rootStyle&&Object.assign(s,k(e.rootStyle)),s},[e.bg,e.fg,e.rootStyle]);return a.jsx("pre",{className:u(n,"p-4 text-sm","bg-[var(--sdm-bg,transparent)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,transparent))]"),"data-language":l,"data-streamdown":"code-block-body",style:o,...c,children:a.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:e.tokens.map((s,d)=>a.jsx("span",{className:v,children:s.map((t,b)=>a.jsx("span",{className:u("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",t.bgColor&&"bg-[var(--sdm-tbg)]",t.bgColor&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:{...t.color?{"--sdm-c":t.color}:{},...t.bgColor?{"--sdm-tbg":t.bgColor}:{},...t.htmlStyle},...t.htmlAttrs,children:t.content},b))},d))})})},(r,e)=>r.result===e.result&&r.language===e.language&&r.className===e.className),y=({className:r,language:e,style:l,...n})=>a.jsx("div",{className:u("my-4 w-full overflow-hidden rounded-xl border border-border",r),"data-language":e,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...l},...n}),N=({language:r,children:e})=>a.jsxs("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":r,"data-streamdown":"code-block-header",children:[a.jsx("span",{className:"ml-1 font-mono lowercase",children:r}),a.jsx("div",{className:"flex items-center gap-2",children:e})]}),w=/\n+$/,B=({code:r,language:e,className:l,children:n,...c})=>{let{shikiTheme:o}=i.useContext(h),s=x(),d=i.useMemo(()=>r.replace(w,""),[r]),t=i.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
2
- `).map(g=>[{content:g,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[d]),[b,m]=i.useState(t);return i.useEffect(()=>{if(!s){m(t);return}let g=s.highlight({code:d,language:e,themes:o},f=>{m(f)});if(g){m(g);return}m(t)},[d,e,o,s,t]),a.jsx(p.Provider,{value:{code:r},children:a.jsxs(y,{language:e,children:[a.jsx(N,{language:e,children:n}),a.jsx(j,{className:l,language:e,result:b,...c})]})})};export{B as CodeBlock};
@@ -1 +0,0 @@
1
- import{u as m,j as e,T as u,l as h}from"./index-CMJV-mgF.js";import{M as b}from"./modal-DeigO7aN.js";const g=({isOpen:l,onClose:a,onConfirm:n,title:i,description:d,confirmText:c="确认",cancelText:o="取消",variant:x="default",isLoading:t=!1})=>{const{t:s}=m(),r=x==="danger";return e.jsx(b,{isOpen:l,onClose:a,title:i,className:"max-w-sm",action:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:a,disabled:t,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:s(o)}),e.jsx("button",{onClick:n,disabled:t,className:h("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",r?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:s(t?"处理中...":c)})]}),children:e.jsxs("div",{className:"flex gap-4",children:[r&&e.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:e.jsx(u,{size:20,className:"text-red-500"})}),e.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:d})]})})};export{g as C};
@@ -1 +0,0 @@
1
- import{c as g,l as o}from"./monaco-BuDK9Fat.js";import{C as l,H as h,D as c,a as u,R as f,b as _,c as w,d as k,F as v,e as D,S as P,f as R,g as I}from"./lspLanguageFeatures-Bbp4PWlJ.js";import{h as we,i as ke,j as ve,t as De,k as Pe}from"./lspLanguageFeatures-Bbp4PWlJ.js";import"./EditableTaskTitle-mHT39coo.js";import"./index-CMJV-mgF.js";import"./mermaid-NOHMQCX5-C72362la.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import"./chevron-down-BaQEBzp3.js";import"./use-providers-DB9ghBPq.js";import"./AgentLogo-BDyW3ihb.js";import"./MemberAvatar-CCRbS97s.js";import"./chevron-up-D0y6skqr.js";import"./arrow-down-BVePf1ZM.js";import"./at-sign-BE17rU5b.js";import"./paperclip-BOSklTt7.js";import"./task-priority-acVgTiil.js";import"./check-qs0S_9rB.js";import"./useTokenUsage-4qTDa8SY.js";import"./CreateTaskInput-GLF3Oyc1.js";import"./use-projects-DI27nNwl.js";import"./trash-2-Bc-URu8c.js";import"./ExecutionPermissionSelector-DeeNd4Kh.js";import"./BrandLogo-YGT4Vlw5.js";import"./gauge-CPlvCZUV.js";import"./confirm-dialog-BrgNTypL.js";import"./modal-DeigO7aN.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./message-square-CFriSt4D.js";import"./textarea-Ft9KMoEI.js";import"./play-Mxkwq69n.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./status-styles-sQm4KLdp.js";import"./copy-DejkmIHZ.js";import"./use-workspaces-d4n9m9cX.js";import"./circle-alert-Cbvy2cMo.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./useNormalizedLogs-DRoPbP0w.js";import"./pencil-BRQ9W_a-.js";const C=120*1e3;class A{constructor(n){this._defaults=n,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>C&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=g({moduleId:"vs/language/css/cssWorker",createWorker:()=>new Worker(new URL("/assets/css.worker-DBVD8oXr.js",import.meta.url),{type:"module"}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...n){let e;return this._getClient().then(a=>{e=a}).then(a=>{if(this._worker)return this._worker.withSyncedResources(n)}).then(a=>e)}}function ue(s){const n=[],e=[],a=new A(s);n.push(a);const r=(...t)=>a.getLanguageServiceWorker(...t);function d(){const{languageId:t,modeConfiguration:i}=s;m(e),i.completionItems&&e.push(o.registerCompletionItemProvider(t,new l(r,["/","-",":"]))),i.hovers&&e.push(o.registerHoverProvider(t,new h(r))),i.documentHighlights&&e.push(o.registerDocumentHighlightProvider(t,new c(r))),i.definitions&&e.push(o.registerDefinitionProvider(t,new u(r))),i.references&&e.push(o.registerReferenceProvider(t,new f(r))),i.documentSymbols&&e.push(o.registerDocumentSymbolProvider(t,new _(r))),i.rename&&e.push(o.registerRenameProvider(t,new w(r))),i.colors&&e.push(o.registerColorProvider(t,new k(r))),i.foldingRanges&&e.push(o.registerFoldingRangeProvider(t,new v(r))),i.diagnostics&&e.push(new D(t,r,s.onDidChange)),i.selectionRanges&&e.push(o.registerSelectionRangeProvider(t,new P(r))),i.documentFormattingEdits&&e.push(o.registerDocumentFormattingEditProvider(t,new R(r))),i.documentRangeFormattingEdits&&e.push(o.registerDocumentRangeFormattingEditProvider(t,new I(r)))}return d(),n.push(p(e)),p(n)}function p(s){return{dispose:()=>m(s)}}function m(s){for(;s.length;)s.pop().dispose()}export{l as CompletionAdapter,u as DefinitionAdapter,D as DiagnosticsAdapter,k as DocumentColorAdapter,R as DocumentFormattingEditProvider,c as DocumentHighlightAdapter,we as DocumentLinkAdapter,I as DocumentRangeFormattingEditProvider,_ as DocumentSymbolAdapter,v as FoldingRangeAdapter,h as HoverAdapter,f as ReferenceAdapter,w as RenameAdapter,P as SelectionRangeAdapter,A as WorkerManager,ke as fromPosition,ve as fromRange,ue as setupMode,De as toRange,Pe as toTextEdit};
@@ -1 +0,0 @@
1
- import{c as a}from"./index-CMJV-mgF.js";const e=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],c=a("gauge",e);export{c as G};
@@ -1 +0,0 @@
1
- import{l as t}from"./monaco-BuDK9Fat.js";import"./EditableTaskTitle-mHT39coo.js";import"./index-CMJV-mgF.js";import"./mermaid-NOHMQCX5-C72362la.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import"./chevron-down-BaQEBzp3.js";import"./use-providers-DB9ghBPq.js";import"./AgentLogo-BDyW3ihb.js";import"./MemberAvatar-CCRbS97s.js";import"./chevron-up-D0y6skqr.js";import"./arrow-down-BVePf1ZM.js";import"./at-sign-BE17rU5b.js";import"./paperclip-BOSklTt7.js";import"./task-priority-acVgTiil.js";import"./check-qs0S_9rB.js";import"./useTokenUsage-4qTDa8SY.js";import"./CreateTaskInput-GLF3Oyc1.js";import"./use-projects-DI27nNwl.js";import"./trash-2-Bc-URu8c.js";import"./ExecutionPermissionSelector-DeeNd4Kh.js";import"./BrandLogo-YGT4Vlw5.js";import"./gauge-CPlvCZUV.js";import"./confirm-dialog-BrgNTypL.js";import"./modal-DeigO7aN.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./message-square-CFriSt4D.js";import"./textarea-Ft9KMoEI.js";import"./play-Mxkwq69n.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./status-styles-sQm4KLdp.js";import"./copy-DejkmIHZ.js";import"./use-workspaces-d4n9m9cX.js";import"./circle-alert-Cbvy2cMo.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./useNormalizedLogs-DRoPbP0w.js";import"./pencil-BRQ9W_a-.js";const e=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],N={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:["{{!--","--}}"]},brackets:[["<!--","-->"],["<",">"],["{{","}}"],["{","}"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:new RegExp(`<(?!(?:${e.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),afterText:/^<\/(\w[\w\d]*)\s*>$/i,action:{indentAction:t.IndentAction.IndentOutdent}},{beforeText:new RegExp(`<(?!(?:${e.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),action:{indentAction:t.IndentAction.Indent}}]},_={defaultToken:"",tokenPostfix:"",tokenizer:{root:[[/\{\{!--/,"comment.block.start.handlebars","@commentBlock"],[/\{\{!/,"comment.start.handlebars","@comment"],[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.root"}],[/<!DOCTYPE/,"metatag.html","@doctype"],[/<!--/,"comment.html","@commentHtml"],[/(<)(\w+)(\/>)/,["delimiter.html","tag.html","delimiter.html"]],[/(<)(script)/,["delimiter.html",{token:"tag.html",next:"@script"}]],[/(<)(style)/,["delimiter.html",{token:"tag.html",next:"@style"}]],[/(<)([:\w]+)/,["delimiter.html",{token:"tag.html",next:"@otherTag"}]],[/(<\/)(\w+)/,["delimiter.html",{token:"tag.html",next:"@otherTag"}]],[/</,"delimiter.html"],[/\{/,"delimiter.html"],[/[^<{]+/]],doctype:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.comment"}],[/[^>]+/,"metatag.content.html"],[/>/,"metatag.html","@pop"]],comment:[[/\}\}/,"comment.end.handlebars","@pop"],[/./,"comment.content.handlebars"]],commentBlock:[[/--\}\}/,"comment.block.end.handlebars","@pop"],[/./,"comment.content.handlebars"]],commentHtml:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.comment"}],[/-->/,"comment.html","@pop"],[/[^-]+/,"comment.content.html"],[/./,"comment.content.html"]],otherTag:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.otherTag"}],[/\/?>/,"delimiter.html","@pop"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/]],script:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.script"}],[/type/,"attribute.name","@scriptAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.text/javascript",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,["delimiter.html","tag.html",{token:"delimiter.html",next:"@pop"}]]],scriptAfterType:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.scriptAfterType"}],[/=/,"delimiter","@scriptAfterTypeEquals"],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.text/javascript",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptAfterTypeEquals:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.scriptAfterTypeEquals"}],[/"([^"]*)"/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.text/javascript",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptWithCustomType:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.scriptWithCustomType.$S2"}],[/>/,{token:"delimiter.html",next:"@scriptEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptEmbedded:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInEmbeddedState.scriptEmbedded.$S2",nextEmbedded:"@pop"}],[/<\/script/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}]],style:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.style"}],[/type/,"attribute.name","@styleAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter.html",next:"@styleEmbedded.text/css",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,["delimiter.html","tag.html",{token:"delimiter.html",next:"@pop"}]]],styleAfterType:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.styleAfterType"}],[/=/,"delimiter","@styleAfterTypeEquals"],[/>/,{token:"delimiter.html",next:"@styleEmbedded.text/css",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleAfterTypeEquals:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.styleAfterTypeEquals"}],[/"([^"]*)"/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/>/,{token:"delimiter.html",next:"@styleEmbedded.text/css",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleWithCustomType:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInSimpleState.styleWithCustomType.$S2"}],[/>/,{token:"delimiter.html",next:"@styleEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleEmbedded:[[/\{\{/,{token:"@rematch",switchTo:"@handlebarsInEmbeddedState.styleEmbedded.$S2",nextEmbedded:"@pop"}],[/<\/style/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}]],handlebarsInSimpleState:[[/\{\{\{?/,"delimiter.handlebars"],[/\}\}\}?/,{token:"delimiter.handlebars",switchTo:"@$S2.$S3"}],{include:"handlebarsRoot"}],handlebarsInEmbeddedState:[[/\{\{\{?/,"delimiter.handlebars"],[/\}\}\}?/,{token:"delimiter.handlebars",switchTo:"@$S2.$S3",nextEmbedded:"$S3"}],{include:"handlebarsRoot"}],handlebarsRoot:[[/"[^"]*"/,"string.handlebars"],[/[#/][^\s}]+/,"keyword.helper.handlebars"],[/else\b/,"keyword.helper.handlebars"],[/[\s]+/],[/[^}]/,"variable.parameter.handlebars"]]}};export{N as conf,_ as language};
@@ -1 +0,0 @@
1
- import{l as t}from"./monaco-BuDK9Fat.js";import"./EditableTaskTitle-mHT39coo.js";import"./index-CMJV-mgF.js";import"./mermaid-NOHMQCX5-C72362la.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import"./chevron-down-BaQEBzp3.js";import"./use-providers-DB9ghBPq.js";import"./AgentLogo-BDyW3ihb.js";import"./MemberAvatar-CCRbS97s.js";import"./chevron-up-D0y6skqr.js";import"./arrow-down-BVePf1ZM.js";import"./at-sign-BE17rU5b.js";import"./paperclip-BOSklTt7.js";import"./task-priority-acVgTiil.js";import"./check-qs0S_9rB.js";import"./useTokenUsage-4qTDa8SY.js";import"./CreateTaskInput-GLF3Oyc1.js";import"./use-projects-DI27nNwl.js";import"./trash-2-Bc-URu8c.js";import"./ExecutionPermissionSelector-DeeNd4Kh.js";import"./BrandLogo-YGT4Vlw5.js";import"./gauge-CPlvCZUV.js";import"./confirm-dialog-BrgNTypL.js";import"./modal-DeigO7aN.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./message-square-CFriSt4D.js";import"./textarea-Ft9KMoEI.js";import"./play-Mxkwq69n.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./status-styles-sQm4KLdp.js";import"./copy-DejkmIHZ.js";import"./use-workspaces-d4n9m9cX.js";import"./circle-alert-Cbvy2cMo.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./useNormalizedLogs-DRoPbP0w.js";import"./pencil-BRQ9W_a-.js";const e=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"],B={wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<!--","-->"],["<",">"],["{","}"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:'"',close:'"'},{open:"'",close:"'"},{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"}],onEnterRules:[{beforeText:new RegExp(`<(?!(?:${e.join("|")}))([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),afterText:/^<\/([_:\w][_:\w-.\d]*)\s*>$/i,action:{indentAction:t.IndentAction.IndentOutdent}},{beforeText:new RegExp(`<(?!(?:${e.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,"i"),action:{indentAction:t.IndentAction.Indent}}],folding:{markers:{start:new RegExp("^\\s*<!--\\s*#region\\b.*-->"),end:new RegExp("^\\s*<!--\\s*#endregion\\b.*-->")}}},F={defaultToken:"",tokenPostfix:".html",ignoreCase:!0,tokenizer:{root:[[/<!DOCTYPE/,"metatag","@doctype"],[/<!--/,"comment","@comment"],[/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/,["delimiter","tag","","delimiter"]],[/(<)(script)/,["delimiter",{token:"tag",next:"@script"}]],[/(<)(style)/,["delimiter",{token:"tag",next:"@style"}]],[/(<)((?:[\w\-]+:)?[\w\-]+)/,["delimiter",{token:"tag",next:"@otherTag"}]],[/(<\/)((?:[\w\-]+:)?[\w\-]+)/,["delimiter",{token:"tag",next:"@otherTag"}]],[/</,"delimiter"],[/[^<]+/]],doctype:[[/[^>]+/,"metatag.content"],[/>/,"metatag","@pop"]],comment:[[/-->/,"comment","@pop"],[/[^-]+/,"comment.content"],[/./,"comment.content"]],otherTag:[[/\/?>/,"delimiter","@pop"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/]],script:[[/type/,"attribute.name","@scriptAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/(<\/)(script\s*)(>)/,["delimiter","tag",{token:"delimiter",next:"@pop"}]]],scriptAfterType:[[/=/,"delimiter","@scriptAfterTypeEquals"],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptAfterTypeEquals:[[/"module"/,{token:"attribute.value",switchTo:"@scriptWithCustomType.text/javascript"}],[/'module'/,{token:"attribute.value",switchTo:"@scriptWithCustomType.text/javascript"}],[/"([^"]*)"/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@scriptWithCustomType.$1"}],[/>/,{token:"delimiter",next:"@scriptEmbedded",nextEmbedded:"text/javascript"}],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptWithCustomType:[[/>/,{token:"delimiter",next:"@scriptEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/script\s*>/,{token:"@rematch",next:"@pop"}]],scriptEmbedded:[[/<\/script/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}],[/[^<]+/,""]],style:[[/type/,"attribute.name","@styleAfterType"],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/(<\/)(style\s*)(>)/,["delimiter","tag",{token:"delimiter",next:"@pop"}]]],styleAfterType:[[/=/,"delimiter","@styleAfterTypeEquals"],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleAfterTypeEquals:[[/"([^"]*)"/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/'([^']*)'/,{token:"attribute.value",switchTo:"@styleWithCustomType.$1"}],[/>/,{token:"delimiter",next:"@styleEmbedded",nextEmbedded:"text/css"}],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleWithCustomType:[[/>/,{token:"delimiter",next:"@styleEmbedded.$S2",nextEmbedded:"$S2"}],[/"([^"]*)"/,"attribute.value"],[/'([^']*)'/,"attribute.value"],[/[\w\-]+/,"attribute.name"],[/=/,"delimiter"],[/[ \t\r\n]+/],[/<\/style\s*>/,{token:"@rematch",next:"@pop"}]],styleEmbedded:[[/<\/style/,{token:"@rematch",next:"@pop",nextEmbedded:"@pop"}],[/[^<]+/,""]]}};export{B as conf,F as language};
@@ -1 +0,0 @@
1
- import{c as D,l as t}from"./monaco-BuDK9Fat.js";import{H as g,D as p,h as d,F as l,b as c,S as u,c as h,f as w,g as _,C as R}from"./lspLanguageFeatures-Bbp4PWlJ.js";import{a as _e,e as fe,d as ve,R as ke,i as Pe,j as De,t as Re,k as Ie}from"./lspLanguageFeatures-Bbp4PWlJ.js";import"./EditableTaskTitle-mHT39coo.js";import"./index-CMJV-mgF.js";import"./mermaid-NOHMQCX5-C72362la.js";import"./agent-meta-MzuGtqxl.js";import"./use-attachments-EypT-7PI.js";import"./chevron-down-BaQEBzp3.js";import"./use-providers-DB9ghBPq.js";import"./AgentLogo-BDyW3ihb.js";import"./MemberAvatar-CCRbS97s.js";import"./chevron-up-D0y6skqr.js";import"./arrow-down-BVePf1ZM.js";import"./at-sign-BE17rU5b.js";import"./paperclip-BOSklTt7.js";import"./task-priority-acVgTiil.js";import"./check-qs0S_9rB.js";import"./useTokenUsage-4qTDa8SY.js";import"./CreateTaskInput-GLF3Oyc1.js";import"./use-projects-DI27nNwl.js";import"./trash-2-Bc-URu8c.js";import"./ExecutionPermissionSelector-DeeNd4Kh.js";import"./BrandLogo-YGT4Vlw5.js";import"./gauge-CPlvCZUV.js";import"./confirm-dialog-BrgNTypL.js";import"./modal-DeigO7aN.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./message-square-CFriSt4D.js";import"./textarea-Ft9KMoEI.js";import"./play-Mxkwq69n.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./status-styles-sQm4KLdp.js";import"./copy-DejkmIHZ.js";import"./use-workspaces-d4n9m9cX.js";import"./circle-alert-Cbvy2cMo.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./useNormalizedLogs-DRoPbP0w.js";import"./pencil-BRQ9W_a-.js";const I=120*1e3;class f{constructor(o){this._defaults=o,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>I&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=D({moduleId:"vs/language/html/htmlWorker",createWorker:()=>new Worker(new URL("/assets/html.worker-CwpTb9lJ.js",import.meta.url),{type:"module"}),createData:{languageSettings:this._defaults.options,languageId:this._defaults.languageId},label:this._defaults.languageId}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...o){let e;return this._getClient().then(r=>{e=r}).then(r=>{if(this._worker)return this._worker.withSyncedResources(o)}).then(r=>e)}}class v extends R{constructor(o){super(o,[".",":","<",'"',"=","/"])}}function ce(i){const o=new f(i),e=(...n)=>o.getLanguageServiceWorker(...n);let r=i.languageId;t.registerCompletionItemProvider(r,new v(e)),t.registerHoverProvider(r,new g(e)),t.registerDocumentHighlightProvider(r,new p(e)),t.registerLinkProvider(r,new d(e)),t.registerFoldingRangeProvider(r,new l(e)),t.registerDocumentSymbolProvider(r,new c(e)),t.registerSelectionRangeProvider(r,new u(e)),t.registerRenameProvider(r,new h(e)),r==="html"&&(t.registerDocumentFormattingEditProvider(r,new w(e)),t.registerDocumentRangeFormattingEditProvider(r,new _(e)))}function ue(i){const o=[],e=[],r=new f(i);o.push(r);const n=(...s)=>r.getLanguageServiceWorker(...s);function P(){const{languageId:s,modeConfiguration:a}=i;k(e),a.completionItems&&e.push(t.registerCompletionItemProvider(s,new v(n))),a.hovers&&e.push(t.registerHoverProvider(s,new g(n))),a.documentHighlights&&e.push(t.registerDocumentHighlightProvider(s,new p(n))),a.links&&e.push(t.registerLinkProvider(s,new d(n))),a.documentSymbols&&e.push(t.registerDocumentSymbolProvider(s,new c(n))),a.rename&&e.push(t.registerRenameProvider(s,new h(n))),a.foldingRanges&&e.push(t.registerFoldingRangeProvider(s,new l(n))),a.selectionRanges&&e.push(t.registerSelectionRangeProvider(s,new u(n))),a.documentFormattingEdits&&e.push(t.registerDocumentFormattingEditProvider(s,new w(n))),a.documentRangeFormattingEdits&&e.push(t.registerDocumentRangeFormattingEditProvider(s,new _(n)))}return P(),o.push(m(e)),m(o)}function m(i){return{dispose:()=>k(i)}}function k(i){for(;i.length;)i.pop().dispose()}export{R as CompletionAdapter,_e as DefinitionAdapter,fe as DiagnosticsAdapter,ve as DocumentColorAdapter,w as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,d as DocumentLinkAdapter,_ as DocumentRangeFormattingEditProvider,c as DocumentSymbolAdapter,l as FoldingRangeAdapter,g as HoverAdapter,ke as ReferenceAdapter,h as RenameAdapter,u as SelectionRangeAdapter,f as WorkerManager,Pe as fromPosition,De as fromRange,ue as setupMode,ce as setupMode1,Re as toRange,Ie as toTextEdit};