agent-tower 0.5.3-beta.5 → 0.5.3-beta.6

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 (152) hide show
  1. package/dist/routes/__tests__/filesystem.test.js +5 -2
  2. package/dist/routes/__tests__/filesystem.test.js.map +1 -1
  3. package/dist/routes/__tests__/git.test.d.ts +2 -0
  4. package/dist/routes/__tests__/git.test.d.ts.map +1 -0
  5. package/dist/routes/__tests__/git.test.js +47 -0
  6. package/dist/routes/__tests__/git.test.js.map +1 -0
  7. package/dist/routes/__tests__/workspaces.test.d.ts +2 -0
  8. package/dist/routes/__tests__/workspaces.test.d.ts.map +1 -0
  9. package/dist/routes/__tests__/workspaces.test.js +85 -0
  10. package/dist/routes/__tests__/workspaces.test.js.map +1 -0
  11. package/dist/routes/filesystem.d.ts.map +1 -1
  12. package/dist/routes/filesystem.js +4 -3
  13. package/dist/routes/filesystem.js.map +1 -1
  14. package/dist/routes/git.d.ts.map +1 -1
  15. package/dist/routes/git.js +32 -0
  16. package/dist/routes/git.js.map +1 -1
  17. package/dist/services/__tests__/project.service.test.js +56 -0
  18. package/dist/services/__tests__/project.service.test.js.map +1 -1
  19. package/dist/services/__tests__/task.service.test.js +49 -0
  20. package/dist/services/__tests__/task.service.test.js.map +1 -1
  21. package/dist/services/__tests__/team-reconciler.service.test.js +15 -9
  22. package/dist/services/__tests__/team-reconciler.service.test.js.map +1 -1
  23. package/dist/services/__tests__/team-run.service.test.js +27 -3
  24. package/dist/services/__tests__/team-run.service.test.js.map +1 -1
  25. package/dist/services/__tests__/workspace.service.test.js +49 -1
  26. package/dist/services/__tests__/workspace.service.test.js.map +1 -1
  27. package/dist/services/project-guards.d.ts +4 -0
  28. package/dist/services/project-guards.d.ts.map +1 -1
  29. package/dist/services/project-guards.js +10 -0
  30. package/dist/services/project-guards.js.map +1 -1
  31. package/dist/services/project.service.d.ts +6 -1
  32. package/dist/services/project.service.d.ts.map +1 -1
  33. package/dist/services/project.service.js +31 -29
  34. package/dist/services/project.service.js.map +1 -1
  35. package/dist/services/task.service.d.ts +152 -3
  36. package/dist/services/task.service.d.ts.map +1 -1
  37. package/dist/services/task.service.js +54 -9
  38. package/dist/services/task.service.js.map +1 -1
  39. package/dist/services/team-run.service.d.ts.map +1 -1
  40. package/dist/services/team-run.service.js +11 -2
  41. package/dist/services/team-run.service.js.map +1 -1
  42. package/dist/services/workspace.service.d.ts.map +1 -1
  43. package/dist/services/workspace.service.js +9 -1
  44. package/dist/services/workspace.service.js.map +1 -1
  45. package/dist/web/assets/{AgentDemoPage-DC61uZJ_.js → AgentDemoPage-BqUFGORQ.js} +1 -1
  46. package/dist/web/assets/{AgentLogo-CGrwilQJ.js → AgentLogo-O_lfAIQi.js} +1 -1
  47. package/dist/web/assets/{ConversationPage-DvD_lYUj.js → ConversationPage-t8BHC8qL.js} +1 -1
  48. package/dist/web/assets/CreateTaskInput-D5aroK_o.js +2 -0
  49. package/dist/web/assets/{DemoPage-BDUjXkK3.js → DemoPage-DohwggTK.js} +1 -1
  50. package/dist/web/assets/{GeneralSettingsPage-DuYC1Vhv.js → GeneralSettingsPage-BqSO35vU.js} +1 -1
  51. package/dist/web/assets/{Icons-BqZeUyTx.js → Icons-B5Qr68Dp.js} +1 -1
  52. package/dist/web/assets/{LoadingPreviewPage-DPA8HxNr.js → LoadingPreviewPage-DBVTXpq2.js} +1 -1
  53. package/dist/web/assets/{McpSettingsPage-BO_Fd_mA.js → McpSettingsPage-B4hjk8Q6.js} +1 -1
  54. package/dist/web/assets/{MemberAvatar-BesdHRgJ.js → MemberAvatar-DmWOKCwf.js} +1 -1
  55. package/dist/web/assets/{NotificationSettingsPage-F5HPtn9-.js → NotificationSettingsPage-DiUyq7V-.js} +1 -1
  56. package/dist/web/assets/{ProfileSettingsPage-DweTPF_t.js → ProfileSettingsPage-BcUtq3sY.js} +1 -1
  57. package/dist/web/assets/{ProjectKanbanPage-taUI2xm6.js → ProjectKanbanPage-klp2fAN1.js} +35 -35
  58. package/dist/web/assets/ProjectSettingsPage-D2gQsbTJ.js +2 -0
  59. package/dist/web/assets/{ProviderSettingsPage-Cio0LIzm.js → ProviderSettingsPage-CX8WeQ3x.js} +1 -1
  60. package/dist/web/assets/{SettingsMasterDetail-BnqVBe7H.js → SettingsMasterDetail-BtiI8TDc.js} +1 -1
  61. package/dist/web/assets/TeamSettingsPage-CZgtzFUH.js +1 -0
  62. package/dist/web/assets/{arc-CYddG-Kz.js → arc-BP5t0cJz.js} +1 -1
  63. package/dist/web/assets/{architectureDiagram-3BPJPVTR-B3RXX4-J.js → architectureDiagram-3BPJPVTR-B4nGdxyB.js} +1 -1
  64. package/dist/web/assets/{arrow-left-CufhOEz9.js → arrow-left-CH7x-bnE.js} +1 -1
  65. package/dist/web/assets/{blockDiagram-GPEHLZMM-a7Dr_zcs.js → blockDiagram-GPEHLZMM-C0obS1hu.js} +1 -1
  66. package/dist/web/assets/{c4Diagram-AAUBKEIU-BLwSao_g.js → c4Diagram-AAUBKEIU-DLOq2msX.js} +1 -1
  67. package/dist/web/assets/channel-ByQ8jatA.js +1 -0
  68. package/dist/web/assets/check-EXzHBr5H.js +1 -0
  69. package/dist/web/assets/{chevron-down-BQyZkT4A.js → chevron-down-CBY3fFTT.js} +1 -1
  70. package/dist/web/assets/{chevron-right-94xg9kiO.js → chevron-right-DZo7j27r.js} +1 -1
  71. package/dist/web/assets/{chevron-up-BZM-aGAU.js → chevron-up-721LBv_e.js} +1 -1
  72. package/dist/web/assets/{chunk-2J33WTMH-CV8jFvSt.js → chunk-2J33WTMH-C07Su0AF.js} +1 -1
  73. package/dist/web/assets/{chunk-4BX2VUAB-DXquqZ4n.js → chunk-4BX2VUAB-DAdn-ED3.js} +1 -1
  74. package/dist/web/assets/{chunk-55IACEB6-BowEEH_6.js → chunk-55IACEB6-BL4-BcAX.js} +1 -1
  75. package/dist/web/assets/{chunk-727SXJPM-Cbn9G9U_.js → chunk-727SXJPM-BmmMDMNV.js} +1 -1
  76. package/dist/web/assets/{chunk-AQP2D5EJ-C-0K23VQ.js → chunk-AQP2D5EJ-CeLsYTvJ.js} +1 -1
  77. package/dist/web/assets/{chunk-FMBD7UC4-BJv0I_Lt.js → chunk-FMBD7UC4-Bs7S01MB.js} +1 -1
  78. package/dist/web/assets/{chunk-ND2GUHAM-DJBjsrJO.js → chunk-ND2GUHAM-uqytV5JO.js} +1 -1
  79. package/dist/web/assets/{chunk-QZHKN3VN-CBw_GG0t.js → chunk-QZHKN3VN-DGM3LKCe.js} +1 -1
  80. package/dist/web/assets/{circle-alert-lbce0dXY.js → circle-alert-Dkp6R_Ml.js} +1 -1
  81. package/dist/web/assets/classDiagram-4FO5ZUOK-BTR6CDm1.js +1 -0
  82. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BTR6CDm1.js +1 -0
  83. package/dist/web/assets/{code-block-OCS4YCEC-CRG-xCnX.js → code-block-OCS4YCEC-C_fs5i5h.js} +1 -1
  84. package/dist/web/assets/{confirm-dialog-Cnw_rxtM.js → confirm-dialog-IGqDL03n.js} +1 -1
  85. package/dist/web/assets/{cose-bilkent-S5V4N54A-DCNqQrFt.js → cose-bilkent-S5V4N54A-2VABc7UM.js} +1 -1
  86. package/dist/web/assets/{dagre-BM42HDAG-oecZRFap.js → dagre-BM42HDAG-D0-HOAOA.js} +1 -1
  87. package/dist/web/assets/{diagram-2AECGRRQ-BXx6WNMi.js → diagram-2AECGRRQ-Cyt7AAOQ.js} +1 -1
  88. package/dist/web/assets/{diagram-5GNKFQAL-Bu66xpEW.js → diagram-5GNKFQAL-BBv9SoKB.js} +1 -1
  89. package/dist/web/assets/{diagram-KO2AKTUF-ZGMyoO90.js → diagram-KO2AKTUF-DV5NTHkX.js} +1 -1
  90. package/dist/web/assets/{diagram-LMA3HP47-riQUwPgu.js → diagram-LMA3HP47-eNPojcJF.js} +1 -1
  91. package/dist/web/assets/{diagram-OG6HWLK6-H_PHYJoy.js → diagram-OG6HWLK6-DYNkChUG.js} +1 -1
  92. package/dist/web/assets/{erDiagram-TEJ5UH35-ePGpWuWD.js → erDiagram-TEJ5UH35-ZXZ2vyVY.js} +1 -1
  93. package/dist/web/assets/{flowDiagram-I6XJVG4X-BZUDzSVZ.js → flowDiagram-I6XJVG4X-E8oqHUJx.js} +1 -1
  94. package/dist/web/assets/{folder-Ca5RFac7.js → folder-BxT7ExMF.js} +1 -1
  95. package/dist/web/assets/folder-picker-57gIIPSi.js +1 -0
  96. package/dist/web/assets/{ganttDiagram-6RSMTGT7-D2UOmWEL.js → ganttDiagram-6RSMTGT7-CEAjt7Nr.js} +1 -1
  97. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-DEzWWRW3.js → gitGraphDiagram-PVQCEYII-3dNQBESX.js} +1 -1
  98. package/dist/web/assets/{index-M-QRACZK.js → index-B2TV-FU2.js} +3 -3
  99. package/dist/web/assets/index-D1vY2KQU.css +1 -0
  100. package/dist/web/assets/{index-JK3A62-g.js → index-DhYpUXuu.js} +4 -4
  101. package/dist/web/assets/{infoDiagram-5YYISTIA-BNClnI_5.js → infoDiagram-5YYISTIA-DkDDpqvX.js} +1 -1
  102. package/dist/web/assets/{input-7UYarzFy.js → input-CupQF5Np.js} +1 -1
  103. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-B1aSs8GW.js → ishikawaDiagram-YF4QCWOH-BSm79ZFA.js} +1 -1
  104. package/dist/web/assets/{journeyDiagram-JHISSGLW-DlXxUTcw.js → journeyDiagram-JHISSGLW-BCP6kLky.js} +1 -1
  105. package/dist/web/assets/{kanban-definition-UN3LZRKU-Ctkuw8kN.js → kanban-definition-UN3LZRKU-jzLQwKw3.js} +1 -1
  106. package/dist/web/assets/{layers-C89p38EX.js → layers-CCP9NEZU.js} +1 -1
  107. package/dist/web/assets/{linear--QsFiowO.js → linear-DWq5jvYH.js} +1 -1
  108. package/dist/web/assets/{loader-circle-DolxjVmY.js → loader-circle-RvIxJahM.js} +1 -1
  109. package/dist/web/assets/{mermaid-NOHMQCX5-CW_FGpKP.js → mermaid-NOHMQCX5-v8DEF9xx.js} +3 -3
  110. package/dist/web/assets/{message-square-KV4Azzxs.js → message-square-tSoG7yGO.js} +1 -1
  111. package/dist/web/assets/{mindmap-definition-RKZ34NQL-Dm6rZMiM.js → mindmap-definition-RKZ34NQL-C5FxGBPQ.js} +1 -1
  112. package/dist/web/assets/{modal-PZSR91HW.js → modal-Dc2shjmi.js} +1 -1
  113. package/dist/web/assets/{pencil-9lMJOuw2.js → pencil-BOmVWDhP.js} +1 -1
  114. package/dist/web/assets/{pieDiagram-4H26LBE5-DbQPjRBP.js → pieDiagram-4H26LBE5-CmWVRs82.js} +1 -1
  115. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DeRrMc4Y.js → quadrantDiagram-W4KKPZXB-B4s3NNDO.js} +1 -1
  116. package/dist/web/assets/{requirementDiagram-4Y6WPE33-aajAoXSH.js → requirementDiagram-4Y6WPE33-C2KmzOV2.js} +1 -1
  117. package/dist/web/assets/{rotate-ccw-D7tnDKF_.js → rotate-ccw-BJfFrvl2.js} +1 -1
  118. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-DWsta0ns.js → sankeyDiagram-5OEKKPKP-CJbPnzq8.js} +1 -1
  119. package/dist/web/assets/{select-CTiftuHJ.js → select-C_UWYFsQ.js} +1 -1
  120. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-BGBP9NTB.js → sequenceDiagram-3UESZ5HK-BFea2ow4.js} +1 -1
  121. package/dist/web/assets/{stateDiagram-AJRCARHV-Dl0Q7uMb.js → stateDiagram-AJRCARHV-osdtBRSX.js} +1 -1
  122. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-ChsboHHf.js +1 -0
  123. package/dist/web/assets/{switch-BhqMnTiu.js → switch-C6O0UllM.js} +1 -1
  124. package/dist/web/assets/{terminal-BR0PXV2W.js → terminal-BKrr_mRJ.js} +1 -1
  125. package/dist/web/assets/{textarea-eWIZ3eZW.js → textarea-Cj61Z7ha.js} +1 -1
  126. package/dist/web/assets/{timeline-definition-PNZ67QCA-DuDIvs1s.js → timeline-definition-PNZ67QCA-BlXV0jf2.js} +1 -1
  127. package/dist/web/assets/{trash-2-C7F85sIB.js → trash-2-D2zJVeEr.js} +1 -1
  128. package/dist/web/assets/{upload-CQTsuurY.js → upload-Q5mYpwnh.js} +1 -1
  129. package/dist/web/assets/{use-profiles-Btexu_oH.js → use-profiles-BSYIQUHp.js} +1 -1
  130. package/dist/web/assets/{use-providers-BEPU5ALg.js → use-providers-Ct5qGj1d.js} +1 -1
  131. package/dist/web/assets/{useNormalizedLogs-CvCCSYxy.js → useNormalizedLogs-DqPhzW9t.js} +1 -1
  132. package/dist/web/assets/{vennDiagram-CIIHVFJN-BDyKeyr8.js → vennDiagram-CIIHVFJN-CCuhn7zI.js} +1 -1
  133. package/dist/web/assets/{wardley-L42UT6IY-DAOA5Zsv.js → wardley-L42UT6IY-Xu-SY-Xt.js} +1 -1
  134. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CCmLvkBT.js → wardleyDiagram-YWT4CUSO-BDVBG-Eu.js} +1 -1
  135. package/dist/web/assets/{xychartDiagram-2RQKCTM6-EsyeKzfj.js → xychartDiagram-2RQKCTM6-DC5IWyMr.js} +1 -1
  136. package/dist/web/index.html +2 -2
  137. package/node_modules/@agent-tower/shared/dist/types.d.ts +4 -0
  138. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  139. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  140. package/node_modules/@prisma/client/.prisma/client/edge.js +3 -4
  141. package/node_modules/@prisma/client/.prisma/client/index.js +3 -4
  142. package/package.json +1 -1
  143. package/dist/web/assets/CreateTaskInput-CstzayW9.js +0 -2
  144. package/dist/web/assets/ProjectSettingsPage-BfTQwRb7.js +0 -2
  145. package/dist/web/assets/TeamSettingsPage-CHoLj7rL.js +0 -1
  146. package/dist/web/assets/channel-BTbcDemz.js +0 -1
  147. package/dist/web/assets/check-C5Ba8Rby.js +0 -1
  148. package/dist/web/assets/classDiagram-4FO5ZUOK-D4Noh8IG.js +0 -1
  149. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-D4Noh8IG.js +0 -1
  150. package/dist/web/assets/folder-picker-CZIjxGNQ.js +0 -1
  151. package/dist/web/assets/index-17XUvLGe.css +0 -1
  152. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BEhmiwth.js +0 -1
@@ -379,7 +379,7 @@ const config = {
379
379
  "value": "prisma-client-js"
380
380
  },
381
381
  "output": {
382
- "value": "/Users/shitian/Work/shitian/agent-tower/core/node_modules/.pnpm/@prisma+client@5.22.0_prisma@5.22.0/node_modules/@prisma/client",
382
+ "value": "/Users/shitian/Work/shitian/agent-tower/.worktrees/at/team/6b3ac1ac/main/7f074404/node_modules/.pnpm/@prisma+client@5.22.0_prisma@5.22.0/node_modules/@prisma/client",
383
383
  "fromEnvVar": null
384
384
  },
385
385
  "config": {
@@ -397,11 +397,10 @@ const config = {
397
397
  }
398
398
  ],
399
399
  "previewFeatures": [],
400
- "sourceFilePath": "/Users/shitian/Work/shitian/agent-tower/core/packages/server/prisma/schema.prisma"
400
+ "sourceFilePath": "/Users/shitian/Work/shitian/agent-tower/.worktrees/at/team/6b3ac1ac/main/7f074404/packages/server/prisma/schema.prisma"
401
401
  },
402
402
  "relativeEnvPaths": {
403
- "rootEnvPath": null,
404
- "schemaEnvPath": "../../../../../../packages/server/.env"
403
+ "rootEnvPath": null
405
404
  },
406
405
  "relativePath": "../../../../../../packages/server/prisma",
407
406
  "clientVersion": "5.22.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-tower",
3
- "version": "0.5.3-beta.5",
3
+ "version": "0.5.3-beta.6",
4
4
  "description": "AI Agent Task Management Dashboard",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +0,0 @@
1
- import{h as F,j as e,u as ae,r,a0 as we,X as Ee,i as $e,m as Be,M as Ue,s as We,v as qe,N as Te,g as N,a1 as Ke,a2 as He}from"./index-M-QRACZK.js";import{W as O}from"./mermaid-NOHMQCX5-CW_FGpKP.js";import{A as Q}from"./AgentLogo-CGrwilQJ.js";import{C as ee}from"./chevron-down-BQyZkT4A.js";import{C as V}from"./check-C5Ba8Rby.js";import{L as te}from"./loader-circle-DolxjVmY.js";import{M as Ce}from"./MemberAvatar-BesdHRgJ.js";import{u as Ye}from"./use-providers-BEPU5ALg.js";import{P as Ge}from"./trash-2-C7F85sIB.js";import{P as Ve}from"./useNormalizedLogs-CvCCSYxy.js";import{F as Xe}from"./folder-Ca5RFac7.js";const Ze=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ut=F("arrow-down",Ze);const Je=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Qe=F("arrow-up",Je);const et=[["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"}]],tt=F("file-text",et);const st=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],rt=F("gauge",st);const nt=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],at=F("git-branch",nt);const ot=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],it=F("image",ot);const lt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Wt=F("search",lt);const ct=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],dt=F("shield",ct);const ut=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],qt=F("square-pen",ut);const mt=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],ft=F("zap",mt);function xt({content:s,children:i,className:l="",side:d="top"}){const h=d==="bottom"?"top-full mt-2":"bottom-full mb-2",b=d==="bottom"?"bottom-full border-b-neutral-900":"top-full border-t-neutral-900";return e.jsxs("div",{className:`group/tooltip relative ${l}`,children:[i,e.jsxs("div",{className:`absolute ${h} left-1/2 -translate-x-1/2 px-3 py-2 bg-neutral-900 text-white text-xs rounded-lg opacity-0 group-hover/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-[100] shadow-lg`,children:[s,e.jsx("div",{className:`absolute ${b} left-1/2 -translate-x-1/2 border-4 border-transparent`})]})]})}function ne(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function pt(s){return s>=.9?"text-red-500":s>=.7?"text-amber-500":"text-neutral-400"}function Kt({usage:s,tooltipSide:i="top"}){const{t:l}=ae();if(!s)return null;const d=s.modelContextWindow,h=d?s.totalTokens/d:0,b=d?Math.min(Math.round(h*100),100):null,f=d?pt(h):"text-neutral-400",y=d?e.jsx("span",{children:l("上下文: {used} / {max} tokens",{used:ne(s.totalTokens),max:ne(d)})}):e.jsx("span",{children:l("已使用: {used} tokens",{used:ne(s.totalTokens)})});return e.jsx(xt,{content:y,side:i,children:e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[e.jsx(rt,{size:14,className:f}),e.jsxs("span",{className:`tabular-nums ${f}`,children:[ne(s.totalTokens),b!==null&&e.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",b,"%"]})]})]})})}const gt={damping:.7,stiffness:.05,mass:1.25},ht=70,bt=1e3/60,vt=350;let oe=!1;globalThis.document?.addEventListener("mousedown",()=>{oe=!0});globalThis.document?.addEventListener("mouseup",()=>{oe=!1});globalThis.document?.addEventListener("click",()=>{oe=!1});const Ht=(s={})=>{const[i,l]=r.useState(!1),[d,h]=r.useState(s.initial!==!1),[b,f]=r.useState(!1),y=r.useRef(null);y.current=s;const x=r.useCallback(()=>{if(!oe)return!1;const o=window.getSelection();if(!o||!o.rangeCount)return!1;const g=o.getRangeAt(0);return g.commonAncestorContainer.contains(m.current)||m.current?.contains(g.commonAncestorContainer)},[]),v=r.useCallback(o=>{t.isAtBottom=o,h(o)},[]),p=r.useCallback(o=>{t.escapedFromLock=o,l(o)},[]),t=r.useMemo(()=>{let o;return{escapedFromLock:i,isAtBottom:d,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return m.current?.scrollTop??0},set scrollTop(g){m.current&&(m.current.scrollTop=g,t.ignoreScrollToTop=m.current.scrollTop)},get targetScrollTop(){return!m.current||!P.current?0:m.current.scrollHeight-1-m.current.clientHeight},get calculatedTargetScrollTop(){if(!m.current||!P.current)return 0;const{targetScrollTop:g}=this;if(!s.targetScrollTop)return g;if(o?.targetScrollTop===g)return o.calculatedScrollTop;const u=Math.max(Math.min(s.targetScrollTop(g,{scrollElement:m.current,contentElement:P.current}),g),0);return o={targetScrollTop:g,calculatedScrollTop:u},requestAnimationFrame(()=>{o=void 0}),u},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=ht}}},[]),k=r.useCallback((o={})=>{typeof o=="string"&&(o={animation:o}),o.preserveScrollPosition||v(!0);const g=Date.now()+(Number(o.wait)||0),u=xe(y.current,o.animation),{ignoreEscapes:M=!1}=o;let w,_=t.calculatedTargetScrollTop;o.duration instanceof Promise?o.duration.finally(()=>{w=Date.now()}):w=g+(o.duration??0);const z=async()=>{const W=new Promise(requestAnimationFrame).then(()=>{if(!t.isAtBottom)return t.animation=void 0,!1;const{scrollTop:L}=t,q=performance.now(),B=(q-(t.lastTick??q))/bt;if(t.animation||(t.animation={behavior:u,promise:W,ignoreEscapes:M}),t.animation.behavior===u&&(t.lastTick=q),x()||g>Date.now())return z();if(L<Math.min(_,t.calculatedTargetScrollTop)){if(t.animation?.behavior===u){if(u==="instant")return t.scrollTop=t.calculatedTargetScrollTop,z();t.velocity=(u.damping*t.velocity+u.stiffness*t.scrollDifference)/u.mass,t.accumulated+=t.velocity*B,t.scrollTop+=t.accumulated,t.scrollTop!==L&&(t.accumulated=0)}return z()}return w>Date.now()?(_=t.calculatedTargetScrollTop,z()):(t.animation=void 0,t.scrollTop<t.calculatedTargetScrollTop?k({animation:xe(y.current,y.current.resize),ignoreEscapes:M,duration:Math.max(0,w-Date.now())||void 0}):t.isAtBottom)});return W.then(L=>(requestAnimationFrame(()=>{t.animation||(t.lastTick=void 0,t.velocity=0)}),L))};return o.wait!==!0&&(t.animation=void 0),t.animation?.behavior===u?t.animation.promise:z()},[v,x,t]),c=r.useCallback(()=>{p(!0),v(!1)},[p,v]),C=r.useCallback(({target:o})=>{if(o!==m.current)return;const{scrollTop:g,ignoreScrollToTop:u}=t;let{lastScrollTop:M=g}=t;t.lastScrollTop=g,t.ignoreScrollToTop=void 0,u&&u>g&&(M=u),f(t.isNearBottom),setTimeout(()=>{if(t.resizeDifference||g===u)return;if(x()){p(!0),v(!1);return}const w=g>M,_=g<M;if(t.animation?.ignoreEscapes){t.scrollTop=M;return}_&&(p(!0),v(!1)),w&&p(!1),!t.escapedFromLock&&t.isNearBottom&&v(!0)},1)},[p,v,x,t]),S=r.useCallback(({target:o,deltaY:g})=>{let u=o;for(;!["scroll","auto"].includes(getComputedStyle(u).overflow);){if(!u.parentElement)return;u=u.parentElement}u===m.current&&g<0&&m.current.scrollHeight>m.current.clientHeight&&!t.animation?.ignoreEscapes&&(p(!0),v(!1))},[p,v,t]),m=Se(o=>{m.current?.removeEventListener("scroll",C),m.current?.removeEventListener("wheel",S),o?.addEventListener("scroll",C,{passive:!0}),o?.addEventListener("wheel",S,{passive:!0})},[]),P=Se(o=>{if(t.resizeObserver?.disconnect(),!o)return;let g;t.resizeObserver=new ResizeObserver(([u])=>{const{height:M}=u.contentRect,w=M-(g??M);if(t.resizeDifference=w,t.scrollTop>t.targetScrollTop&&(t.scrollTop=t.targetScrollTop),f(t.isNearBottom),w>=0){const _=xe(y.current,g?y.current.resize:y.current.initial);k({animation:_,wait:!0,preserveScrollPosition:!0,duration:_==="instant"?void 0:vt})}else t.isNearBottom&&(p(!1),v(!0));g=M,requestAnimationFrame(()=>{setTimeout(()=>{t.resizeDifference===w&&(t.resizeDifference=0)},1)})}),t.resizeObserver?.observe(o)},[]);return{contentRef:P,scrollRef:m,scrollToBottom:k,stopScroll:c,isAtBottom:d||b,isNearBottom:b,escapedFromLock:i,state:t}};function Se(s,i){const l=r.useCallback(d=>(l.current=d,s(d)),i);return l}const fe=new Map;function xe(...s){const i={...gt};let l=!1;for(const h of s){if(h==="instant"){l=!0;continue}typeof h=="object"&&(l=!1,i.damping=h.damping??i.damping,i.stiffness=h.stiffness??i.stiffness,i.mass=h.mass??i.mass)}const d=JSON.stringify(i);return fe.has(d)||fe.set(d,Object.freeze(i)),l?"instant":fe.get(d)}function Yt({providers:s,currentProviderId:i,agentType:l,onSelect:d}){const{t:h}=ae(),[b,f]=r.useState(!1),y=r.useRef(null),x=s.filter(p=>String(p.provider.agentType)===l),v=s.find(p=>p.provider.id===i);return r.useEffect(()=>{function p(t){y.current&&!y.current.contains(t.target)&&f(!1)}if(b)return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[b]),x.length<=1?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral-400 px-2 py-1.5 select-none cursor-default",children:[e.jsx(Q,{agentType:v?.provider.agentType??l,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:v?.provider.name?we(v.provider.name,12):l})]}):e.jsxs("div",{className:"relative",ref:y,children:[e.jsxs("button",{onClick:()=>f(!b),className:"flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg transition-colors cursor-pointer hover:bg-neutral-100 text-neutral-400 hover:text-neutral-600",title:`Provider: ${v?.provider.name??l} (click to change)`,children:[e.jsx(Q,{agentType:v?.provider.agentType??l,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:v?.provider.name?we(v.provider.name,12):l}),e.jsx(ee,{size:12,className:`shrink-0 transition-transform ${b?"rotate-180":""}`})]}),b&&e.jsxs("div",{className:"absolute bottom-full right-0 mb-1 bg-white rounded-lg border border-neutral-200 shadow-lg py-1 min-w-[160px] z-50",children:[e.jsx("div",{className:"px-2 py-1 text-xs text-neutral-400 border-b border-neutral-100",children:h("切换渠道")}),x.map(p=>e.jsxs("button",{onClick:()=>{d(p.provider.id),f(!1)},className:`w-full flex items-center justify-between px-3 py-2 text-sm text-left hover:bg-neutral-50 transition-colors ${p.provider.id===i?"bg-blue-50 text-blue-600":"text-neutral-700"}`,children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Q,{agentType:p.provider.agentType,className:"size-4"}),e.jsx("span",{className:"truncate max-w-[120px]",children:p.provider.name}),p.provider.isDefault&&e.jsx("span",{className:"text-xs text-neutral-400",children:h("(默认)")})]}),p.provider.id===i&&e.jsx(V,{size:14,className:"shrink-0"})]},p.provider.id))]})]})}const jt="/api";function Nt(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}function yt({files:s,onRemove:i}){return s.length===0?null:e.jsx("div",{"aria-label":"Attachments",className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:s.map(l=>e.jsx(kt,{item:l,onRemove:i},l.tempId))})}function kt({item:s,onRemove:i}){const l=s.file.type.startsWith("image/"),d=s.status==="error",h=s.status==="uploading";return e.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${d?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[l&&s.status==="done"&&s.attachment?e.jsx("img",{src:`${jt}${s.attachment.url}`,alt:s.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):e.jsx("span",{className:"flex-shrink-0",children:h?e.jsx(te,{size:16,className:"animate-spin text-neutral-400"}):l?e.jsx(it,{size:16,className:"text-neutral-400"}):e.jsx(tt,{size:16,className:"text-neutral-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:s.file.name}),d?e.jsx("div",{className:"truncate text-red-500",children:s.error}):e.jsx("div",{className:"text-neutral-400",children:Nt(s.file.size)})]}),e.jsx("button",{onClick:()=>i(s.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:e.jsx(Ee,{size:10})})]})}const wt="/api";async function Tt(s){const i=new FormData;i.append("file",s);const l=await fetch(`${wt}/attachments/upload`,{method:"POST",body:i});if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.error||`Upload failed (${l.status})`)}return l.json()}let Ct=0;function St(){const[s,i]=r.useState([]),l=r.useRef(s);l.current=s;const d=r.useCallback(async t=>{const k=t.map(c=>({tempId:`tmp-${++Ct}`,file:c,progress:0,status:"uploading"}));i(c=>[...c,...k]),await Promise.allSettled(k.map(async c=>{try{const C=await Tt(c.file);i(S=>S.map(m=>m.tempId===c.tempId?{...m,status:"done",progress:100,attachment:C}:m))}catch(C){i(S=>S.map(m=>m.tempId===c.tempId?{...m,status:"error",error:C instanceof Error?C.message:"Upload failed"}:m))}}))},[]),h=r.useCallback(()=>l.current.filter(t=>t.status==="done"&&t.attachment).map(t=>t.attachment),[]),b=r.useCallback(t=>{i(k=>k.filter(c=>c.tempId!==t))},[]),f=r.useCallback(()=>{i([])},[]),y=r.useCallback(t=>{t.length!==0&&i(k=>{const c=new Set(k.map(S=>S.attachment?.id??S.tempId)),C=t.filter(S=>{const m=S.attachment?.id??S.tempId;return c.has(m)?!1:(c.add(m),!0)});return C.length>0?[...k,...C]:k})},[]),x=r.useCallback(()=>{const t=h();return t.length===0?"":t.map(k=>`${k.mimeType.startsWith("image/")?"!":""}[${k.originalName}](${k.storagePath})`).join(`
2
- `)},[h]),v=s.length>0,p=s.some(t=>t.status==="uploading");return{files:s,addFiles:d,removeFile:b,clear:f,restoreFiles:y,buildMarkdownLinks:x,getDoneAttachments:h,hasFiles:v,isUploading:p}}function Gt(s){const i=r.useMemo(()=>Array.from(new Set(s.filter(Boolean))),[s]);return $e({queryKey:["attachments","metadata",i],queryFn:()=>Be.get("/attachments/metadata",{params:{ids:i.join(",")}}),enabled:i.length>0,staleTime:300*1e3})}function Vt(s,i){return r.useMemo(()=>{for(let l=s.length-1;l>=0;l--){const d=s[l];if(d.tokenUsage&&typeof d.tokenUsage.totalTokens=="number"&&d.tokenUsage.totalTokens>0)return{totalTokens:d.tokenUsage.totalTokens,modelContextWindow:d.tokenUsage.modelContextWindow}}return i??null},[s,i])}function Me(s,i,l,d){if(l.filter(f=>f===d).length<=1)return s;const b=l.slice(0,i+1).filter(f=>f===d).length;return`${s} #${b}`}function Mt(s){return Object.values(s).filter(Boolean).length}function Et({mode:s,setMode:i,selectedTemplateId:l,setSelectedTemplateId:d,selectedMemberPresetIds:h,setSelectedMemberPresetIds:b,disabled:f=!1,compact:y=!1}){const{t:x}=ae(),{preserveDesktopSearch:v}=Ue(),[p,t]=r.useState(!1),{data:k}=Ye(),{data:c,isError:C,isFetching:S,isLoading:m,refetch:P}=We(),{data:o,isError:g,isFetching:u,isLoading:M,refetch:w}=qe(),_=r.useMemo(()=>new Map((k??[]).map(({provider:a,availability:j})=>[a.id,a.name+(j.type==="NOT_FOUND"?x(" (不可用)"):"")])),[k,x]),z=r.useMemo(()=>new Map((c??[]).map(a=>[a.id,a])),[c]),W=r.useMemo(()=>new Map((o??[]).map(a=>[a.id,a])),[o]),L=r.useMemo(()=>h.map(a=>z.get(a)).filter(a=>!!a),[z,h]);r.useEffect(()=>{c!==void 0&&b(a=>{const j=a.filter(E=>z.has(E));return j.length===a.length&&j.every((E,D)=>E===a[D])?a:j})},[c,z,b]),r.useEffect(()=>{o!==void 0&&d(a=>!a||W.has(a)?a:null)},[d,W,o]);const q=a=>{f||d(j=>j===a?null:a)},B=a=>{f||b(j=>[...j,a])},ie=a=>{f||b(j=>j.filter((E,D)=>D!==a))},se=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:x("团队模板")}),g?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:x("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{w()},disabled:f||u,className:"ml-2 underline hover:no-underline",children:x("重试")})]}):M?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(te,{size:12,className:"animate-spin"}),x("加载中...")]}):(o??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[x("当前没有团队模板"),e.jsx(Te,{to:v("/settings/team"),className:"ml-1.5 text-info hover:underline",children:x("去创建")})]}):e.jsx("div",{className:N("space-y-1.5",y&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(o??[]).map(a=>{const j=a.id===l,E=a.members?.length??0,D=a.members?.map($=>$.memberPresetId)??[],U=a.members?.slice(0,3).map(($,le)=>Me($.memberPreset?.name??$.memberPresetId,le,D,$.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>q(a.id),disabled:f,className:N("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",j?"bg-background border-foreground/20 shadow-sm":"bg-background border-border/60 hover:border-border hover:bg-accent"),children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:N("text-xs truncate",j?"font-medium text-foreground":"text-foreground"),children:a.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[E,x("人")]})]}),U&&e.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground truncate",children:U})]}),j&&e.jsx(V,{size:13,className:"shrink-0 text-foreground"})]})},a.id)})})]}),X=L.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:L.map((a,j)=>{const E=Me(a.name,j,h,a.id);return e.jsxs("div",{className:"inline-flex items-center gap-1 pl-1 pr-0.5 py-0.5 rounded-md border border-border/60 bg-background text-[10px] text-foreground",children:[e.jsx(Ce,{name:a.name,avatar:a.avatar,className:"h-3.5 w-3.5 text-[7px]"}),e.jsx("span",{className:"max-w-[80px] truncate",children:E}),e.jsx("button",{type:"button",onClick:()=>ie(j),disabled:f,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Ee,{size:9})})]},`${a.id}-${j}`)})}),K=C?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:x("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{P()},disabled:f||S,className:"ml-2 underline hover:no-underline",children:x("重试")})]}):m?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(te,{size:12,className:"animate-spin"}),x("加载中...")]}):(c??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[x("当前没有成员预设"),e.jsx(Te,{to:v("/settings/team"),className:"ml-1.5 text-info hover:underline",children:x("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(c??[]).map(a=>{const j=h.filter(U=>U===a.id).length,E=_.get(a.providerId)??a.providerId,D=Mt(a.capabilities);return e.jsxs("button",{type:"button",onClick:()=>B(a.id),disabled:f,className:N("flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-left border border-transparent transition-all",f&&"cursor-not-allowed opacity-60","bg-background hover:bg-accent hover:border-border/60"),children:[e.jsx(Ce,{name:a.name,avatar:a.avatar,className:"h-6 w-6 text-[9px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:a.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate",children:[E," · ",D,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j>0&&e.jsxs("span",{className:"text-[10px] text-foreground font-semibold",children:["×",j]}),e.jsx(Ge,{size:12,className:"text-muted-foreground"})]})]},a.id)})}),Y=L.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[10px] font-semibold text-primary-foreground px-1.5",children:L.length}),H=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground shrink-0",children:x("执行模式")}),e.jsxs("div",{className:"inline-flex items-center h-7 rounded-md border border-border/70 bg-background p-0.5",children:[e.jsxs("button",{type:"button",onClick:()=>!f&&i("AUTO"),disabled:f,className:N("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",s==="AUTO"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(ft,{size:11}),x("自动模式")]}),e.jsxs("button",{type:"button",onClick:()=>!f&&i("CONFIRM"),disabled:f,className:N("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",s==="CONFIRM"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(dt,{size:11}),x("确认模式")]})]})]});return y?e.jsxs("div",{className:"space-y-3",children:[H,se,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!f&&t(a=>!a),disabled:f,"aria-expanded":p,className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(ee,{size:12,className:N("transition-transform",p?"":"-rotate-90")}),x("追加独立成员"),Y]}),p&&e.jsxs("div",{className:"mt-2",children:[X,K]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[H,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[se,e.jsxs("section",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:x("追加成员")}),Y]}),X,K]})]})]})}function Xt({className:s="h-7 w-7"}){return e.jsx("img",{src:Ke,alt:"Agent Tower",className:`block shrink-0 object-contain ${s}`})}function Zt({className:s=""}){return e.jsx("span",{className:`font-semibold text-foreground tracking-tight text-base ${s}`,children:"Agent Tower"})}const At={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."};function Jt({variant:s="task",projects:i,providers:l,isProvidersLoading:d,onSubmit:h,defaultProjectId:b="",defaultProviderId:f="",onProjectChange:y,createStep:x,placeholder:v,submitLabel:p,pendingLabel:t,submitTitle:k}){const{t:c}=ae(),[C,S]=r.useState(""),[m,P]=r.useState(b),[o,g]=r.useState(f),[u,M]=r.useState("SOLO"),[w,_]=r.useState(O.WORKTREE),[z,W]=r.useState("AUTO"),[L,q]=r.useState(null),[B,ie]=r.useState([]),[se,X]=r.useState(!1),[K,Y]=r.useState(!1),[H,a]=r.useState(!1),[j,E]=r.useState(!1),D=r.useRef(null),U=r.useRef(null),$=r.useRef(null),le=r.useRef(null),pe=r.useRef(null),{files:ge,addFiles:G,removeFile:Ae,clear:he,buildMarkdownLinks:be,getDoneAttachments:ve,isUploading:re}=St(),A=s==="conversation",T=s==="task"||s==="conversation",Ie=p??c(A?"开始":"创建");r.useEffect(()=>{P(b),y?.(b)},[b,y]),r.useEffect(()=>{g(f)},[f]),r.useEffect(()=>{if(!K)return;const n=I=>{D.current&&!D.current.contains(I.target)&&Y(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[K]),r.useEffect(()=>{if(!H)return;const n=I=>{U.current&&!U.current.contains(I.target)&&a(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[H]),r.useEffect(()=>{if(!j)return;const n=I=>{$.current&&!$.current.contains(I.target)&&E(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[j]);const ce=r.useMemo(()=>i.find(n=>n.id===m),[i,m]),de=r.useMemo(()=>l.find(n=>n.id===o),[l,o]),ze=w===O.MAIN_DIRECTORY?c("本地模式"):c("工作树模式"),R=x!=="idle",je=!!L||B.length>0,Z=!R&&!re&&C.trim().length>0&&(A?!!o:!!m&&(u==="SOLO"?!!o:je)),ue=r.useCallback(async()=>{if(!Z)return;const n=T?be():"",I=T?ve().map(J=>J.id):[];try{await h({title:C.trim(),description:"",projectId:A?"":m,providerId:o,mode:A?"SOLO":u,workspaceMode:!A&&u==="SOLO"?w:O.WORKTREE,teamRunMode:A?"AUTO":z,teamTemplateId:A?null:L,memberPresetIds:A?[]:B,attachmentLinks:n,attachmentIds:I}),S(""),T&&he()}catch{}},[Z,T,be,ve,h,C,A,m,o,u,w,z,L,B,he]),Re=r.useCallback(n=>{n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),ue())},[ue]),Le=r.useCallback(n=>{const I=n.target.files;I&&I.length>0&&G(Array.from(I)),n.target.value=""},[G]),_e=r.useCallback(n=>{P(n),y?.(n),Y(!1)},[y]),De=r.useCallback(n=>{if(!T)return;const I=n.clipboardData.items,J=[];for(const ye of I)if(ye.kind==="file"){const ke=ye.getAsFile();ke&&J.push(ke)}J.length>0&&(n.preventDefault(),G(J))},[G,T]),[Ne,me]=r.useState(!1),Oe=r.useCallback(n=>{T&&(n.preventDefault(),me(!0))},[T]),Fe=r.useCallback(n=>{T&&(n.preventDefault(),me(!1))},[T]),Pe=r.useCallback(n=>{if(!T)return;n.preventDefault(),me(!1);const I=n.dataTransfer.files;I.length>0&&G(Array.from(I))},[G,T]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:N("relative bg-background rounded-xl border transition-colors duration-200","shadow-[0_1px_2px_rgba(0,0,0,0.05)]","hover:border-ring/40 focus-within:border-ring/60",Ne?"border-info bg-info/5":"border-border",R&&"opacity-80"),onDragOver:T?Oe:void 0,onDragLeave:T?Fe:void 0,onDrop:T?Pe:void 0,children:[T&&ge.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(yt,{files:ge,onRemove:Ae})}),e.jsx("textarea",{ref:le,value:C,onChange:n=>S(n.target.value),onKeyDown:Re,onPaste:T?De:void 0,placeholder:c(v||"Describe your task..."),disabled:R,autoFocus:!0,rows:1,className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/80 leading-relaxed",style:{minHeight:"76px",maxHeight:"220px",fieldSizing:"content"}}),T&&Ne&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-center py-3 border border-dashed border-info/40 rounded-lg text-xs font-medium text-info",children:c("Drop files here")})}),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:T?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>pe.current?.click(),disabled:R||re,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:c("Attach files"),children:e.jsx(Ve,{size:18})}),e.jsx("input",{ref:pe,type:"file",multiple:!0,onChange:Le,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[T&&re&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(te,{size:14,className:"animate-spin"}),c("Uploading...")]}),R&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(te,{size:14,className:"animate-spin"}),c(t??At[x])]}),!A&&!R&&!re&&u==="TEAM"&&!je&&C.trim().length>0&&e.jsx("span",{className:"text-[11px] text-warning",children:c("请选择团队模板或追加成员")}),Z&&e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-[11px] text-muted-foreground/80 select-none",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded border border-border bg-muted/60 text-[10px] font-medium text-muted-foreground leading-none",children:"⏎"}),Ie]}),e.jsx("button",{type:"button",onClick:ue,disabled:!Z,className:N("flex items-center justify-center size-8 rounded-lg transition-all duration-200",Z?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm":"bg-muted text-muted-foreground/40 cursor-not-allowed"),title:c(k||"Create & Start"),children:e.jsx(Qe,{size:16,strokeWidth:2.5})})]})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!A&&e.jsxs("div",{className:"relative",ref:D,children:[e.jsxs("button",{type:"button",onClick:()=>{R||Y(n=>!n)},disabled:R,className:N("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",ce?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(Xe,{size:14,className:"shrink-0",style:{color:ce?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:ce?.name??c("Project")}),e.jsx(ee,{size:12,className:N("text-muted-foreground transition-transform",K&&"rotate-180")})]}),K&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:i.map(n=>e.jsxs("button",{type:"button",onClick:()=>_e(n.id),className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx("span",{className:"size-2 rounded-full shrink-0 mr-2",style:{backgroundColor:n.color??"var(--muted-foreground)"}}),e.jsx("span",{className:N("truncate flex-1",n.id===m?"text-foreground font-medium":"text-muted-foreground"),children:n.name}),e.jsx(V,{size:14,className:N("ml-2 shrink-0 text-foreground",n.id===m?"opacity-100":"opacity-0")})]},n.id))})]}),(A||u==="SOLO")&&e.jsxs("div",{className:"relative",ref:U,children:[e.jsxs("button",{type:"button",onClick:()=>{R||a(n=>!n)},disabled:R,className:N("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",de?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(Q,{agentType:de?.agentType,className:"size-3.5"}),e.jsx("span",{className:"max-w-[120px] truncate",children:de?.name??c(d?"Loading...":"Agent")}),e.jsx(ee,{size:12,className:N("text-muted-foreground transition-transform",H&&"rotate-180")})]}),H&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:l.map(n=>e.jsxs("button",{type:"button",disabled:!n.available,onClick:()=>{g(n.id),a(!1)},className:N("flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",!n.available&&"opacity-40 cursor-not-allowed"),children:[e.jsx(V,{size:14,className:N("mr-2 shrink-0 text-foreground",n.id===o?"opacity-100":"opacity-0")}),e.jsx(Q,{agentType:n.agentType,className:"mr-2 size-3.5"}),e.jsxs("span",{className:N("min-w-0 truncate",n.id===o?"text-foreground font-medium":"text-muted-foreground"),children:[n.name,n.available?"":c(" (unavailable)")]})]},n.id))})]}),!A&&u==="SOLO"&&e.jsxs("div",{className:"relative",ref:$,children:[e.jsxs("button",{type:"button",onClick:()=>{R||E(n=>!n)},disabled:R,className:N("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-foreground/80"),children:[e.jsx(at,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:ze}),e.jsx(ee,{size:12,className:N("text-muted-foreground transition-transform",j&&"rotate-180")})]}),j&&e.jsxs("div",{className:"absolute top-full left-0 mt-1.5 w-44 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 z-50",children:[e.jsxs("button",{type:"button",onClick:()=>{_(O.WORKTREE),E(!1)},className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(V,{size:14,className:N("mr-2 shrink-0 text-foreground",w===O.WORKTREE?"opacity-100":"opacity-0")}),e.jsx("span",{className:N("truncate",w===O.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:c("工作树模式")})]}),e.jsxs("button",{type:"button",onClick:()=>{_(O.MAIN_DIRECTORY),E(!1)},className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(V,{size:14,className:N("mr-2 shrink-0 text-foreground",w===O.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsx("span",{className:N("truncate",w===O.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:c("本地模式")})]})]})]}),!A&&e.jsxs("button",{type:"button",role:"switch","aria-checked":u==="TEAM",onClick:()=>{R||(u==="TEAM"?(M("SOLO"),X(!1)):(M("TEAM"),E(!1),_(O.WORKTREE),X(!0)))},disabled:R,className:N("ml-auto flex items-center gap-2 h-7 pl-2 pr-2 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",u==="TEAM"?"text-foreground/80":"text-muted-foreground"),title:c("启用团队模式"),children:[e.jsx(He,{size:14,className:u==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:c("团队模式")}),e.jsx("span",{className:N("relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors",u==="TEAM"?"bg-primary":"bg-border"),children:e.jsx("span",{className:N("inline-block size-3 rounded-full bg-background shadow-sm transition-transform",u==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})]}),!A&&u==="SOLO"&&w===O.MAIN_DIRECTORY&&e.jsx("div",{className:"mt-2.5",children:e.jsx("div",{className:"rounded-lg border border-warning/25 bg-warning/8 px-3 py-2 text-xs leading-relaxed text-warning/90",children:c("Agent 将直接修改项目主目录;不会自动提交,也不能使用 Merge、Rebase 或冲突解决流程。")})}),!A&&u==="TEAM"&&se&&e.jsx("div",{className:"mt-2.5 rounded-xl border border-border/60 bg-muted/40 p-3 animate-[fadeInUp_0.25s_cubic-bezier(0.16,1,0.3,1)]",children:e.jsx(Et,{mode:z,setMode:W,selectedTemplateId:L,setSelectedTemplateId:q,selectedMemberPresetIds:B,setSelectedMemberPresetIds:ie,disabled:R,compact:!0})})]})}export{Ut as A,Xt as B,Jt as C,tt as F,at as G,it as I,Yt as P,qt as S,Kt as T,ft as Z,Vt as a,St as b,yt as c,Qe as d,Zt as e,Wt as f,Gt as g,Et as h,dt as i,Ht as u};
@@ -1,2 +0,0 @@
1
- import{u as G,r as o,m as ce,j as e,X as ee,S as L,P as de,d as _,n as J,g as K,B as A,Q as ue,t as W}from"./index-M-QRACZK.js";import{F as $,a as me,u as xe,b as pe,c as he,d as fe,e as ge}from"./folder-picker-CZIjxGNQ.js";import{F as H}from"./folder-Ca5RFac7.js";import{P as te,T as je}from"./trash-2-C7F85sIB.js";import{T as ve,M as X}from"./modal-PZSR91HW.js";import{S as be}from"./SettingsMasterDetail-BnqVBe7H.js";import{R as Ne}from"./rotate-ccw-D7tnDKF_.js";import"./chevron-right-94xg9kiO.js";import"./loader-circle-DolxjVmY.js";import"./circle-alert-lbce0dXY.js";import"./check-C5Ba8Rby.js";import"./arrow-left-CufhOEz9.js";function ye({value:t,onChange:j,repoPath:v,placeholder:P}){const{t:l}=G(),[i,c]=o.useState(""),[x,p]=o.useState([]),[b,n]=o.useState(!1),[d,N]=o.useState(-1),u=o.useRef(null),g=o.useRef(null),k=o.useRef(void 0),I=o.useCallback(async s=>{if(!v||!s){p([]),n(!1);return}try{const a=await ce.get("/filesystem/complete",{params:{basePath:v,prefix:s}});p(a.results),n(a.results.length>0),N(-1)}catch{p([]),n(!1)}},[v]);o.useEffect(()=>{if(clearTimeout(k.current),!i){p([]),n(!1);return}return k.current=setTimeout(()=>I(i),200),()=>clearTimeout(k.current)},[i,I]),o.useEffect(()=>{const s=a=>{g.current&&!g.current.contains(a.target)&&u.current&&!u.current.contains(a.target)&&n(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{const a=s.trim();!a||t.includes(a)||(j([...t,a]),c(""),n(!1),u.current?.focus())},z=s=>{j(t.filter((a,S)=>S!==s))},D=s=>{s.type==="directory"?(c(s.path),u.current?.focus()):w(s.path)},C=(s,a)=>{a.stopPropagation(),w(s.path.replace(/\/$/,""))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||(b&&x.length>0?s.key==="ArrowDown"?(s.preventDefault(),N(a=>Math.min(a+1,x.length-1))):s.key==="ArrowUp"?(s.preventDefault(),N(a=>Math.max(a-1,-1))):s.key==="Enter"?(s.preventDefault(),d>=0?D(x[d]):w(i)):s.key==="Escape"&&n(!1):s.key==="Enter"&&(s.preventDefault(),w(i)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx($,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(H,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>z(a),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(ee,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:u,type:"text",value:i,onChange:s=>c(s.target.value),onKeyDown:F,onFocus:()=>{i&&x.length>0&&n(!0)},placeholder:P??l("输入文件路径..."),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:()=>w(i),disabled:!i.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(te,{size:14}),e.jsx("span",{children:l("添加")})]})]}),b&&e.jsx("div",{ref:g,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:x.map((s,a)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${a===d?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(H,{size:14,className:"text-amber-500 shrink-0"}):e.jsx($,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:S=>C(s,S),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:l("添加此目录"),children:e.jsx(me,{size:14})})]},s.path))})]})]})}function Pe({value:t,onChange:j}){const{t:v}=G(),[P,l]=o.useState(""),[i,c]=o.useState(""),x=()=>{const n=P.trim(),d=i.trim();!n||!d||(j([...t,{name:n,command:d}]),l(""),c(""))},p=n=>{j(t.filter((d,N)=>N!==n))},b=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),x())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,d)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>p(d),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(ee,{size:14})})]},d))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:P,onChange:n=>l(n.target.value),onKeyDown:b,placeholder:v("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:i,onChange:n=>c(n.target.value),onKeyDown:b,placeholder:v("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:x,disabled:!P.trim()||!i.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(te,{size:14}),e.jsx("span",{children:v("添加")})]})]})]})}function V(t){return t?t.split(",").map(j=>j.trim()).filter(Boolean):[]}function Y(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function Z(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function Me(){const{t}=G(),{data:j,isLoading:v}=xe({limit:100,includeArchived:!0}),P=pe(),l=he(),i=fe(),[c,x]=o.useState(""),[p,b]=o.useState(null),[n,d]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[N,u]=o.useState(!1),[g,k]=o.useState(null),[I,w]=o.useState(!1),[z,D]=o.useState(!1),[C,F]=o.useState(!1),[s,a]=o.useState(!1),[S,q]=o.useState(""),[se,Q]=o.useState(!1),R=j?.data??[],h=o.useMemo(()=>R.filter(r=>!r.archivedAt),[R]),E=o.useMemo(()=>R.filter(r=>r.archivedAt),[R]),f=h.find(r=>r.id===c),M=o.useMemo(()=>R.find(r=>r.id===g)??null,[g,R]);if(o.useEffect(()=>{!c&&h.length>0&&x(h[0].id)},[h,c]),o.useEffect(()=>{if(p){h.some(r=>r.id===p)&&(x(p),b(null));return}c&&!h.some(r=>r.id===c)&&(x(h[0]?.id??""),u(!1))},[h,p,c]),o.useEffect(()=>{f&&!N&&d({copyFiles:V(f.copyFiles),setupScript:f.setupScript??"",quickCommands:Y(f.quickCommands)})},[f,N]),v)return e.jsx(L,{className:"max-w-5xl",children:e.jsx(de,{})});if(R.length===0)return e.jsxs(L,{className:"max-w-5xl",children:[e.jsx(_,{title:t("项目配置")}),e.jsx(J,{message:t("暂无项目,请先创建项目")})]});const re=()=>{c&&P.mutate({id:c,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>u(!1)})},ne=r=>{b(null),x(r),u(!1),Q(!0)},oe=()=>{f&&(k(f.id),F(!1),a(!1),w(!0))},O=()=>{l.isPending||(w(!1),k(null),F(!1),a(!1))},ae=async()=>{if(g)try{await l.mutateAsync({id:g,deleteRepo:C}),W.success(t(C?"项目已删除,并清理了本地文件":"项目已删除")),u(!1),O()}catch{}},ie=r=>{const m=E.find(y=>y.id===r);k(r),q(m?.repoDeletedAt?m.repoPath:""),D(!0)},T=()=>{i.isPending||(D(!1),k(null),q(""))},le=async()=>{if(!(!g||M?.repoDeletedAt&&!S.trim()))try{const m=await i.mutateAsync({id:g,repoPath:S.trim()||void 0});W.success(t("项目已恢复"));for(const y of m.warnings)W.warning(y);u(!1),b(m.project.id),x(m.project.id),T()}catch{}},U=M?.name??t("this project"),B=!!M?.repoDeletedAt;return e.jsxs(e.Fragment,{children:[e.jsxs(L,{className:"max-w-5xl",children:[e.jsx(_,{title:t("项目配置")}),h.length===0&&E.length===0?e.jsx(J,{message:t("暂无项目,请先创建项目")}):e.jsx(be,{items:h,selectedId:c,onSelectItem:ne,getItemId:r=>r.id,mobileShowDetail:se,onMobileBack:()=>Q(!1),renderListItem:(r,m)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:K("h-2 w-2 rounded-full shrink-0",m?"bg-primary-foreground/60":Z(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:K("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:E.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:E.length})]}),E.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>ie(r.id),disabled:i.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(Ne,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:K("h-2.5 w-2.5 rounded-full shrink-0",Z(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(ye,{value:n.copyFiles,onChange:m=>{d(y=>({...y,copyFiles:m})),u(!0)},repoPath:r.repoPath})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{d(y=>({...y,setupScript:m.target.value})),u(!0)},placeholder:`pnpm install
2
- pnpm run setup`,rows:4,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none"})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(Pe,{value:n.quickCommands,onChange:m=>{d(y=>({...y,quickCommands:m})),u(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ve,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(A,{size:"sm",variant:"destructive",className:"shrink-0",onClick:oe,disabled:l.isPending||i.isPending,children:[e.jsx(je,{size:13}),t("删除项目")]})]})}),N&&e.jsx(ue,{saving:P.isPending,onSave:re,onCancel:()=>{f&&d({copyFiles:V(f.copyFiles),setupScript:f.setupScript??"",quickCommands:Y(f.quickCommands)}),u(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:h.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(X,{isOpen:I,onClose:O,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outline",onClick:O,disabled:l.isPending,children:t("Cancel")}),e.jsx(A,{variant:"destructive",onClick:ae,disabled:l.isPending||C&&!s,children:l.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:U})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:r=>{F(r.target.checked),r.target.checked||a(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除 repoPath 指向的本地仓库目录,并禁用代码/Git 相关能力。")})]})]}),C&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的 Git 仓库路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r=>a(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),l.isError&&e.jsx("p",{className:"text-xs text-destructive",children:l.error instanceof Error?l.error.message:t("Failed to delete project")})]})}),e.jsx(X,{isOpen:z,onClose:T,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outline",onClick:T,disabled:i.isPending,children:t("Cancel")}),e.jsx(A,{onClick:le,disabled:i.isPending||B&&!S.trim(),children:i.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:B?t("项目「{title}」的本地仓库文件已删除。恢复前需要重新绑定一个有效的 Git 仓库路径。",{title:U}):t("恢复后,项目会重新出现在默认项目列表中。")}),B&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Repository Path")}),e.jsx(ge,{value:S,onChange:q}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验仓库 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),i.isError&&e.jsx("p",{className:"text-xs text-destructive",children:i.error instanceof Error?i.error.message:t("Failed to restore project")})]})})]})}export{Me as ProjectSettingsPage};
@@ -1 +0,0 @@
1
- import{u as Oe,s as gt,v as bt,w as ft,x as ht,y as vt,z as jt,A as yt,D as Pt,r as l,j as e,S as Ee,E as Nt,d as kt,g as B,B as p,n as Ae,t as c}from"./index-M-QRACZK.js";import{C as Me}from"./confirm-dialog-Cnw_rxtM.js";import{M as Tt}from"./modal-PZSR91HW.js";import{S as O}from"./select-CTiftuHJ.js";import{M as U}from"./MemberAvatar-BesdHRgJ.js";import{u as wt}from"./use-providers-BEPU5ALg.js";import{A as _e}from"./arrow-left-CufhOEz9.js";import{T as ue,P as R}from"./trash-2-C7F85sIB.js";import{C as Ct}from"./chevron-up-BZM-aGAU.js";import{C as It}from"./chevron-down-BQyZkT4A.js";import"./check-C5Ba8Rby.js";const o="/avatars/presets",St=[{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`}],Re="/api",Et=2*1024*1024,At=[],Mt=[],_t=[],De=[{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:"合并工作区"}],ze={readRoom:!1,postRoomMessage:!1,mentionMembers:!1,stopMemberWork:!1,markReadyForReview:!1,readFiles:!1,writeFiles:!1,runCommands:!1,readDiff:!1,mergeWorkspace:!1},Fe=[{value:"none",label:"无"},{value:"shared",label:"共享"},{value:"dedicated",label:"独占"}],Ft=[{value:"MENTION_ONLY",label:"仅提及"},{value:"USER_MESSAGES",label:"所有用户消息"}],$t=[{value:"new_per_request",label:"每次新会话"},{value:"resume_last",label:"复用上次会话"}],Ot=[{value:"own_only",label:"仅自己队列"},{value:"team_pending",label:"全队列待处理"}];function Y(){return{name:"",aliasesText:"",providerId:"",rolePrompt:"",capabilities:{...ze},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:{...ze,...r.capabilities},workspacePolicy:r.workspacePolicy,triggerPolicy:r.triggerPolicy,sessionPolicy:r.sessionPolicy,queueManagementPolicy:r.queueManagementPolicy,avatar:r.avatar??""}}function q(){return{name:"",memberPresetIds:[]}}function pe(r){return{name:r.name,memberPresetIds:r.members?.map(i=>i.memberPresetId)??[]}}function Rt(r,i,d,m){if(d.filter(M=>M===m).length<=1)return r;const W=d.slice(0,i+1).filter(M=>M===m).length;return`${r} #${W}`}function Dt(r){return Array.from(new Set(r.split(/[\n,]/).map(i=>i.trim()).filter(Boolean)))}function zt(r){return r.trim()||null}function $e(r){return De.reduce((i,d)=>i+(r[d.key]?1:0),0)}function A(r,i){return r instanceof Error?r.message:i}function Lt(r){return["image/png","image/jpeg","image/webp"].includes(r.type)}async function Bt(r){const i=new FormData;i.append("file",r);const d=await fetch(`${Re}/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:T}=Oe();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:A(i,T("请稍后重试。"))})]}),e.jsx(p,{type:"button",size:"sm",variant:"outline",onClick:m,disabled:d,children:T(d?"加载中...":"重试")})]})})}function Zt(){const{t:r}=Oe(),{data:i,error:d,isError:m,isFetching:T,isLoading:W,refetch:M}=wt(),{data:Le,error:ge,isError:w,isFetching:be,isLoading:V,refetch:fe}=gt(),{data:Be,error:Ue,isError:D,isFetching:Ye,isLoading:H,refetch:qe}=bt(),Q=ft(),X=ht(),he=vt(),J=jt(),K=yt(),ve=Pt(),[Z,je]=l.useState("presets"),[C,ee]=l.useState("edit"),[f,te]=l.useState(null),[a,v]=l.useState(Y()),[ye,_]=l.useState(!1),[j,re]=l.useState(null),[Ge,se]=l.useState(!1),[Pe,Ne]=l.useState(!1),ke=l.useRef(null),[I,ae]=l.useState("edit"),[h,ne]=l.useState(null),[y,g]=l.useState(q()),[Te,P]=l.useState(!1),[N,oe]=l.useState(null),[we,F]=l.useState(!1),u=Le??At,b=Be??Mt,z=i??_t,$=l.useMemo(()=>new Map(u.map(t=>[t.id,t])),[u]),le=l.useMemo(()=>new Map(b.map(t=>[t.id,t])),[b]),We=l.useMemo(()=>{const t=z.map(({provider:s,availability:n})=>({value:s.id,label:s.name+(n.type==="NOT_FOUND"?r(" (不可用)"):""),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=f?$.get(f)??null:null,de=h?le.get(h)??null:null,Ve=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"){v(Y());return}if(f){const t=$.get(f);t&&v(xe(t));return}if(u.length>0){const t=u[0];te(t.id),ee("edit"),v(xe(t));return}ee("create"),te(null),v(Y())}},[$,ye,C,u,w,V,f]),l.useEffect(()=>{if(!(H||D||Te)){if(I==="create"){g(q());return}if(h){const t=le.get(h);t&&g(pe(t));return}if(b.length>0){const t=b[0];ne(t.id),ae("edit"),g(pe(t));return}ae("create"),ne(null),g(q())}},[h,le,Te,I,b,D,H]),W||V||H)return e.jsx(Ee,{className:"max-w-6xl",children:e.jsx(Nt,{cards:6})});const x=(t,s)=>{v(n=>({...n,[t]:s})),_(!0)},He=(t,s)=>{v(n=>({...n,capabilities:{...n.capabilities,[t]:s}})),_(!0)},Qe=t=>{x("avatar",t),se(!1)},Xe=()=>{x("avatar","")},Je=async t=>{const s=t.target.files?.[0];if(t.target.value="",!!s){if(!Lt(s)){c.error(r("仅支持 PNG、JPG、WebP 头像。"));return}if(s.size>Et){c.error(r("头像图片不能超过 2MB。"));return}Ne(!0);try{const n=await Bt(s);x("avatar",`${Re}${n.url}`),c.success(r("头像已上传"))}catch(n){c.error(A(n,r("头像上传失败")))}finally{Ne(!1)}}},S=(t,s)=>{ee(t),te(s?.id??null),v(s?xe(s):Y()),_(!1)},Ke=(t,s)=>{g(n=>({...n,[t]:s})),P(!0)},E=(t,s)=>{ae(t),ne(s?.id??null),g(s?pe(s):q()),P(!1)},Ze=async()=>{const t={name:a.name.trim(),aliases:Dt(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:zt(a.avatar)};try{if(C==="create"||!f){const s=await Q.mutateAsync(t);S("edit",s),c.success(r("已创建"))}else{const s=await X.mutateAsync({id:f,data:t});S("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},et=async()=>{if(j)try{await he.mutateAsync(j.id),c.success(r("Deleted"));const t=u.filter(s=>s.id!==j.id);f===j.id&&(t.length>0?S("edit",t[0]):S("create",null)),re(null)}catch(t){c.error(A(t,r("删除失败")))}},tt=async()=>{const t={name:y.name.trim(),memberPresetIds:y.memberPresetIds};try{if(I==="create"||!h){const s=await J.mutateAsync(t);E("edit",s),c.success(r("已创建"))}else{const s=await K.mutateAsync({id:h,data:t});E("edit",s),c.success(r("已保存"))}}catch(s){c.error(A(s,r("保存失败")))}},rt=async()=>{if(N)try{await ve.mutateAsync(N.id),c.success(r("Deleted"));const t=b.filter(s=>s.id!==N.id);h===N.id&&(t.length>0?E("edit",t[0]):E("create",null)),oe(null)}catch(t){c.error(A(t,r("删除失败")))}},st=$e(a.capabilities),at=!!a.name.trim()&&!!a.providerId.trim()&&!!a.rolePrompt.trim()&&!m&&!w&&!Q.isPending&&!X.isPending,nt=!!y.name.trim()&&!D&&!w&&!J.isPending&&!K.isPending,ce=y.memberPresetIds.map(t=>$.get(t)).filter(t=>!!t),ot=t=>{_(!1),S("edit",t)},lt=()=>{_(!1),S("create",null)},it=t=>{P(!1),E("edit",t)},dt=()=>{P(!1),E("create",null)},ct=t=>{g(s=>({...s,memberPresetIds:[...s.memberPresetIds,t]})),P(!0)},mt=t=>{g(s=>({...s,memberPresetIds:s.memberPresetIds.filter((n,k)=>k!==t)})),P(!0)},Ce=(t,s)=>{g(n=>{const k=t+s;if(k<0||k>=n.memberPresetIds.length)return n;const me=[...n.memberPresetIds],[pt]=me.splice(t,1);return me.splice(k,0,pt),{...n,memberPresetIds:me}}),P(!0)},ut=t=>{ot(t),F(!0)},Ie=()=>{lt(),F(!0)},xt=t=>{it(t),F(!0)},Se=()=>{dt(),F(!0)},L=()=>F(!1);return e.jsxs(Ee,{className:"max-w-6xl",children:[e.jsx(kt,{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:T,onRetry:()=>{M()}}),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(_e,{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||X.isPending?r("保存中..."):r(C==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("div",{className:"shrink-0",children:[e.jsx(U,{name:a.name||r("Agent"),avatar:a.avatar,className:"h-14 w-14 text-sm"}),e.jsxs("div",{className:"flex justify-center gap-1 mt-2",children:[e.jsx("button",{type:"button",onClick:()=>se(!0),className:"text-[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:()=>ke.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:Xe,className:"text-[10px] text-muted-foreground hover:text-destructive transition-colors",children:r("清除")})]})]}),e.jsx("input",{ref:ke,type:"file",accept:"image/png,image/jpeg,image/webp",className:"hidden",onChange:Je})]}),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(O,{value:a.providerId,onChange:t=>x("providerId",t),options:We,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:De.map(t=>e.jsxs("label",{className:"flex items-center gap-2 rounded px-2.5 py-1.5 text-[12px] text-foreground hover:bg-muted transition-colors cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a.capabilities[t.key],onChange:s=>He(t.key,s.target.checked),className:"h-3.5 w-3.5 rounded border-border"}),e.jsx("span",{children:r(t.label)})]},t.key))})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("工作区")}),e.jsx(O,{value:a.workspacePolicy,onChange:t=>x("workspacePolicy",t),options:Fe.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(O,{value:a.triggerPolicy,onChange:t=>x("triggerPolicy",t),options:Ft.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(O,{value:a.sessionPolicy,onChange:t=>x("sessionPolicy",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(O,{value:a.queueManagementPolicy,onChange:t=>x("queueManagementPolicy",t),options:Ot.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:Ie,children:[e.jsx(R,{size:13})," ",r("新增预设")]})]}),w?e.jsx(G,{title:r("加载失败"),error:ge,isFetching:be,onRetry:()=>{fe()}}):u.length===0?e.jsx(Ae,{message:r("暂无成员预设"),action:e.jsxs(p,{size:"sm",onClick:Ie,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:Ve.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(Fe.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(_e,{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:J.isPending||K.isPending?r("保存中..."):r(I==="create"?"创建":"保存")})]})]}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-muted-foreground mb-1",children:r("模板名称")}),e.jsx("input",{value:y.name,onChange:t=>Ke("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",{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=y.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:Rt(t.name,s,y.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:()=>Ce(s,-1),disabled:s===0,children:e.jsx(Ct,{size:13})}),e.jsx(p,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>Ce(s,1),disabled:s===ce.length-1,children:e.jsx(It,{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:b.length})}),e.jsxs(p,{size:"sm",variant:"outline",onClick:Se,children:[e.jsx(R,{size:13})," ",r("新增模板")]})]}),D?e.jsx(G,{title:r("加载失败"),error:Ue,isFetching:Ye,onRetry:()=>{qe()}}):b.length===0?e.jsx(Ae,{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:b.map(t=>{const s=t.members?.length??0,n=(t.members??[]).slice(0,3).map(k=>$.get(k.memberPresetId)?.name).filter(Boolean);return e.jsxs("button",{type:"button",onClick:()=>xt(t),className:"flex flex-col rounded-xl border border-border bg-background p-4 text-left transition-all hover:border-border hover:shadow-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(Me,{isOpen:!!j,onClose:()=>re(null),onConfirm:et,title:r("删除"),description:j?r('确定删除 "{name}"?此操作不可撤销。',{name:j.name}):"",variant:"danger",confirmText:r("删除"),cancelText:r("取消"),isLoading:he.isPending}),e.jsx(Tt,{isOpen:Ge,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:St.map(t=>{const s=a.avatar===t.src;return e.jsxs("button",{type:"button",onClick:()=>Qe(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(Me,{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{Zt as TeamSettingsPage};
@@ -1 +0,0 @@
1
- import{V as a,W as n}from"./index-JK3A62-g.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{h as c}from"./index-M-QRACZK.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{s as a,c as s,a as e,C as t}from"./chunk-727SXJPM-Cbn9G9U_.js";import{_ as i}from"./index-JK3A62-g.js";import"./chunk-FMBD7UC4-BJv0I_Lt.js";import"./chunk-ND2GUHAM-DJBjsrJO.js";import"./chunk-55IACEB6-BowEEH_6.js";import"./chunk-2J33WTMH-CV8jFvSt.js";import"./index-M-QRACZK.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-Cbn9G9U_.js";import{_ as i}from"./index-JK3A62-g.js";import"./chunk-FMBD7UC4-BJv0I_Lt.js";import"./chunk-ND2GUHAM-DJBjsrJO.js";import"./chunk-55IACEB6-BowEEH_6.js";import"./chunk-2J33WTMH-CV8jFvSt.js";import"./index-M-QRACZK.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{h as V,i as A,k as y,l as j,q as i,m as p,u as O,r as n,j as e,g as x,_ as Q}from"./index-M-QRACZK.js";import{F as v}from"./folder-Ca5RFac7.js";import{C as P}from"./chevron-right-94xg9kiO.js";import{L as D}from"./loader-circle-DolxjVmY.js";import{C as R}from"./circle-alert-lbce0dXY.js";import{C as T}from"./check-C5Ba8Rby.js";const X=[["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"}]],ie=V("file",X);const Y=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],oe=V("folder-plus",Y);function ce(t){const a={};return t?.page!=null&&(a.page=String(t.page)),t?.limit!=null&&(a.limit=String(t.limit)),t?.includeArchived&&(a.includeArchived="true"),A({queryKey:i.projects.list(t),queryFn:()=>p.get("/projects",{params:a})})}function ue(t){return A({queryKey:i.projects.detail(t),queryFn:()=>p.get(`/projects/${t}`),enabled:!!t})}function de(){const t=y();return j({mutationFn:a=>p.post("/projects",a),onSuccess:()=>{t.invalidateQueries({queryKey:i.projects.all})}})}function pe(){const t=y();return j({mutationFn:({id:a,...l})=>p.put(`/projects/${a}`,l),onSuccess:(a,l)=>{t.invalidateQueries({queryKey:i.projects.all}),t.invalidateQueries({queryKey:i.projects.detail(l.id)})}})}function xe(){const t=y();return j({mutationFn:({id:a,deleteRepo:l})=>p.post(`/projects/${a}/archive`,{deleteRepo:l??!1}),onSuccess:(a,l)=>{t.invalidateQueries({queryKey:i.projects.all}),t.invalidateQueries({queryKey:i.projects.detail(l.id)}),t.invalidateQueries({queryKey:i.tasks.all}),t.invalidateQueries({queryKey:i.workspaces.all})}})}function me(){const t=y();return j({mutationFn:({id:a,repoPath:l})=>p.post(`/projects/${a}/restore`,l?{repoPath:l}:{}),onSuccess:(a,l)=>{t.invalidateQueries({queryKey:i.projects.all}),t.invalidateQueries({queryKey:i.projects.detail(l.id)}),t.invalidateQueries({queryKey:i.tasks.all}),t.invalidateQueries({queryKey:i.workspaces.all})}})}function ee(t){return t.isGitRepo?"select-and-browse":"browse"}function he({value:t,onChange:a,validationMode:l="git",placeholder:G}){const{t:g}=O(),[u,L]=n.useState(""),[N,_]=n.useState([]),[k,I]=n.useState(""),[$,B]=n.useState("/"),[C,U]=n.useState([]),[M,w]=n.useState(!1),[q,S]=n.useState(null),[b,K]=n.useState(t),[z,d]=n.useState(null),[W,E]=n.useState(!1),F=n.useRef(!1);n.useEffect(()=>{K(t)},[t]);const o=n.useCallback(async s=>{w(!0),S(null);try{const r={};s&&(r.path=s);const c=await p.get("/filesystem/browse",{params:r});L(c.current),I(c.parent),B(c.sep||"/"),_(c.dirs),c.drives&&U(c.drives)}catch(r){S(r instanceof Error?r.message:"Failed to browse directory")}finally{w(!1)}},[]);n.useEffect(()=>{F.current||(F.current=!0,o())},[o]);const m=n.useCallback(async s=>{if(l==="directory"){a(s),d(null);return}E(!0),d(null);try{const r=await p.get("/filesystem/validate",{params:{path:s}});r.valid?(a(s),d(null)):d(r.error??"Not a Git repository")}catch(r){d(r instanceof Error?r.message:"Validation failed")}finally{E(!1)}},[a,l]),Z=n.useCallback(s=>{ee(s)==="select-and-browse"?(m(s.path),o(s.path)):(o(s.path),d(null))},[m,o]),h=$==="\\",f=n.useMemo(()=>u?u.split(/[\\/]/).filter(Boolean):[],[u]),H=n.useCallback(s=>{const r=f.slice(0,s+1);let c;h?(c=r.join("\\"),r.length===1&&/^[A-Za-z]:$/.test(r[0])&&(c+="\\")):c="/"+r.join("/"),o(c),d(null)},[f,o,h]),J=n.useCallback(s=>{if(s.key==="Enter"&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229){s.preventDefault();const r=b.trim();r&&(o(r),m(r))}},[b,o,m]);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:b,onChange:s=>K(s.target.value),onKeyDown:J,placeholder:G??"e.g., /Users/me/projects/my-repo",className:x("w-full px-3 py-2 border rounded-lg text-sm font-mono focus:outline-none transition-colors pr-8",t?"border-emerald-300 bg-emerald-50/50 focus:border-emerald-400":"border-neutral-200 focus:border-neutral-400")}),t&&(l==="git"?e.jsx(Q,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-emerald-500"}):e.jsx(v,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-emerald-500"}))]}),e.jsx("p",{className:"text-xs text-neutral-400",children:g(l==="git"?"Browse and select a Git repository, or type a path and press Enter":"Browse and select a directory, or type a path and press Enter")}),C.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:C.map(s=>e.jsx("button",{onClick:()=>{o(s),d(null)},className:x("px-2 py-0.5 rounded text-xs font-mono transition-colors border",u.toUpperCase().startsWith(s.toUpperCase())?"bg-neutral-900 text-white border-neutral-900":"border-neutral-200 text-neutral-600 hover:bg-neutral-100"),children:s.replace("\\","")},s))}),e.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-neutral-500 overflow-x-auto pb-1 scrollbar-none",children:[!h&&e.jsx("button",{onClick:()=>o("/"),className:"hover:text-neutral-900 transition-colors flex-shrink-0 px-1 py-0.5 rounded hover:bg-neutral-100",children:"/"}),f.map((s,r)=>e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[(h?r>0:!0)&&e.jsx(P,{size:10,className:"text-neutral-300"}),e.jsx("button",{onClick:()=>H(r),className:x("px-1 py-0.5 rounded transition-colors truncate max-w-[120px]",r===f.length-1?"font-medium text-neutral-900":"hover:text-neutral-900 hover:bg-neutral-100"),children:s})]},r))]}),e.jsx("div",{className:"border border-neutral-200 rounded-lg overflow-hidden",children:e.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:M?e.jsxs("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:[e.jsx(D,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-xs",children:"Loading..."})]}):q?e.jsxs("div",{className:"flex items-center justify-center py-8 text-red-500 gap-2",children:[e.jsx(R,{size:14}),e.jsx("span",{className:"text-xs",children:q})]}):N.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-8 text-neutral-400",children:[e.jsx("span",{className:"text-xs",children:"No subdirectories"}),l==="directory"&&u&&e.jsxs("button",{type:"button",onClick:()=>m(u),className:x("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors",u===t?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-neutral-200 bg-white text-neutral-700 hover:bg-neutral-50"),children:[e.jsx(T,{size:13}),e.jsx("span",{children:g("Select Current")})]})]}):e.jsxs("ul",{className:"divide-y divide-neutral-100",children:[u!==k&&e.jsx("li",{children:e.jsxs("button",{onClick:()=>o(k),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-neutral-50 transition-colors group",children:[e.jsx(v,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-neutral-500 group-hover:text-neutral-700",children:".."})]})}),N.map(s=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>Z(s),className:x("w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors group",s.path===t?"bg-emerald-50":"hover:bg-neutral-50"),children:[s.isGitRepo?e.jsx(Q,{size:14,className:"text-emerald-500 flex-shrink-0"}):e.jsx(v,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:x("text-xs truncate",s.path===t?"font-medium text-emerald-700":"text-neutral-700 group-hover:text-neutral-900"),children:s.name}),s.isGitRepo&&e.jsx("span",{className:"ml-auto flex-shrink-0 text-[10px] font-medium bg-emerald-100 text-emerald-600 px-1.5 py-0.5 rounded",children:"Git"}),!s.isGitRepo&&e.jsx(P,{size:12,className:"ml-auto text-neutral-300 group-hover:text-neutral-400 flex-shrink-0"})]})},s.path))]})})}),W&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400",children:[e.jsx(D,{size:12,className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}),z&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-500",children:[e.jsx(R,{size:12}),e.jsx("span",{children:z})]})]})}export{ie as F,oe as a,pe as b,xe as c,me as d,he as e,ue as f,de as g,ce as u};