agent-tower 0.5.4-beta.0 → 0.5.4-beta.1

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 (281) hide show
  1. package/README.md +6 -1
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +15 -1
  4. package/dist/app.js.map +1 -1
  5. package/dist/app.test.js +12 -0
  6. package/dist/app.test.js.map +1 -1
  7. package/dist/cli.js +18 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/core/event-bus.d.ts +3 -0
  10. package/dist/core/event-bus.d.ts.map +1 -1
  11. package/dist/core/event-bus.js.map +1 -1
  12. package/dist/executors/__tests__/base.executor.test.js +29 -1
  13. package/dist/executors/__tests__/base.executor.test.js.map +1 -1
  14. package/dist/executors/__tests__/codex.executor.test.js +13 -0
  15. package/dist/executors/__tests__/codex.executor.test.js.map +1 -1
  16. package/dist/executors/base.executor.d.ts.map +1 -1
  17. package/dist/executors/base.executor.js +4 -0
  18. package/dist/executors/base.executor.js.map +1 -1
  19. package/dist/executors/execution-env.d.ts +1 -1
  20. package/dist/executors/execution-env.d.ts.map +1 -1
  21. package/dist/executors/execution-env.js +7 -0
  22. package/dist/executors/execution-env.js.map +1 -1
  23. package/dist/index.js +2 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/mcp/http-client.d.ts +2 -0
  26. package/dist/mcp/http-client.d.ts.map +1 -1
  27. package/dist/mcp/http-client.js +7 -0
  28. package/dist/mcp/http-client.js.map +1 -1
  29. package/dist/mcp/index.js +4 -1
  30. package/dist/mcp/index.js.map +1 -1
  31. package/dist/mcp/server.d.ts +3 -1
  32. package/dist/mcp/server.d.ts.map +1 -1
  33. package/dist/mcp/server.js +2 -1
  34. package/dist/mcp/server.js.map +1 -1
  35. package/dist/middleware/__tests__/access-auth.test.d.ts +2 -0
  36. package/dist/middleware/__tests__/access-auth.test.d.ts.map +1 -0
  37. package/dist/middleware/__tests__/access-auth.test.js +249 -0
  38. package/dist/middleware/__tests__/access-auth.test.js.map +1 -0
  39. package/dist/middleware/access-auth.d.ts +3 -0
  40. package/dist/middleware/access-auth.d.ts.map +1 -0
  41. package/dist/middleware/access-auth.js +110 -0
  42. package/dist/middleware/access-auth.js.map +1 -0
  43. package/dist/routes/__tests__/files.test.d.ts +2 -0
  44. package/dist/routes/__tests__/files.test.d.ts.map +1 -0
  45. package/dist/routes/__tests__/files.test.js +101 -0
  46. package/dist/routes/__tests__/files.test.js.map +1 -0
  47. package/dist/routes/__tests__/previews.integration.test.d.ts +2 -0
  48. package/dist/routes/__tests__/previews.integration.test.d.ts.map +1 -0
  49. package/dist/routes/__tests__/previews.integration.test.js +269 -0
  50. package/dist/routes/__tests__/previews.integration.test.js.map +1 -0
  51. package/dist/routes/__tests__/previews.test.js +103 -1
  52. package/dist/routes/__tests__/previews.test.js.map +1 -1
  53. package/dist/routes/access-auth.d.ts +3 -0
  54. package/dist/routes/access-auth.d.ts.map +1 -0
  55. package/dist/routes/access-auth.js +89 -0
  56. package/dist/routes/access-auth.js.map +1 -0
  57. package/dist/routes/files.d.ts.map +1 -1
  58. package/dist/routes/files.js +46 -0
  59. package/dist/routes/files.js.map +1 -1
  60. package/dist/routes/index.d.ts.map +1 -1
  61. package/dist/routes/index.js +3 -0
  62. package/dist/routes/index.js.map +1 -1
  63. package/dist/routes/previews.d.ts +7 -2
  64. package/dist/routes/previews.d.ts.map +1 -1
  65. package/dist/routes/previews.js +106 -32
  66. package/dist/routes/previews.js.map +1 -1
  67. package/dist/routes/projects.d.ts.map +1 -1
  68. package/dist/routes/projects.js +9 -0
  69. package/dist/routes/projects.js.map +1 -1
  70. package/dist/services/__tests__/access-auth.service.test.d.ts +2 -0
  71. package/dist/services/__tests__/access-auth.service.test.d.ts.map +1 -0
  72. package/dist/services/__tests__/access-auth.service.test.js +316 -0
  73. package/dist/services/__tests__/access-auth.service.test.js.map +1 -0
  74. package/dist/services/__tests__/member-heartbeat.test.d.ts +2 -0
  75. package/dist/services/__tests__/member-heartbeat.test.d.ts.map +1 -0
  76. package/dist/services/__tests__/member-heartbeat.test.js +344 -0
  77. package/dist/services/__tests__/member-heartbeat.test.js.map +1 -0
  78. package/dist/services/__tests__/project.service.test.js +29 -0
  79. package/dist/services/__tests__/project.service.test.js.map +1 -1
  80. package/dist/services/__tests__/session-manager.team-run.test.js +69 -0
  81. package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
  82. package/dist/services/__tests__/task.service.test.js +34 -0
  83. package/dist/services/__tests__/task.service.test.js.map +1 -1
  84. package/dist/services/__tests__/team-reconciler.service.test.js +180 -3
  85. package/dist/services/__tests__/team-reconciler.service.test.js.map +1 -1
  86. package/dist/services/__tests__/team-run.service.test.js +196 -2
  87. package/dist/services/__tests__/team-run.service.test.js.map +1 -1
  88. package/dist/services/__tests__/team-scheduler.service.test.js +12 -5
  89. package/dist/services/__tests__/team-scheduler.service.test.js.map +1 -1
  90. package/dist/services/__tests__/workspace.service.test.js +32 -0
  91. package/dist/services/__tests__/workspace.service.test.js.map +1 -1
  92. package/dist/services/access-auth.service.d.ts +82 -0
  93. package/dist/services/access-auth.service.d.ts.map +1 -0
  94. package/dist/services/access-auth.service.js +385 -0
  95. package/dist/services/access-auth.service.js.map +1 -0
  96. package/dist/services/mcp-config.service.d.ts.map +1 -1
  97. package/dist/services/mcp-config.service.js +8 -2
  98. package/dist/services/mcp-config.service.js.map +1 -1
  99. package/dist/services/mcp-config.service.test.js +18 -3
  100. package/dist/services/mcp-config.service.test.js.map +1 -1
  101. package/dist/services/member-heartbeat-scheduler.d.ts +33 -0
  102. package/dist/services/member-heartbeat-scheduler.d.ts.map +1 -0
  103. package/dist/services/member-heartbeat-scheduler.js +83 -0
  104. package/dist/services/member-heartbeat-scheduler.js.map +1 -0
  105. package/dist/services/project-guards.d.ts +5 -0
  106. package/dist/services/project-guards.d.ts.map +1 -1
  107. package/dist/services/project-guards.js +47 -0
  108. package/dist/services/project-guards.js.map +1 -1
  109. package/dist/services/project.service.d.ts +6 -4
  110. package/dist/services/project.service.d.ts.map +1 -1
  111. package/dist/services/project.service.js +16 -7
  112. package/dist/services/project.service.js.map +1 -1
  113. package/dist/services/session-manager.d.ts +11 -0
  114. package/dist/services/session-manager.d.ts.map +1 -1
  115. package/dist/services/session-manager.js +60 -0
  116. package/dist/services/session-manager.js.map +1 -1
  117. package/dist/services/task.service.d.ts +11 -9
  118. package/dist/services/task.service.d.ts.map +1 -1
  119. package/dist/services/task.service.js +17 -12
  120. package/dist/services/task.service.js.map +1 -1
  121. package/dist/services/team-reconciler.service.d.ts +39 -0
  122. package/dist/services/team-reconciler.service.d.ts.map +1 -1
  123. package/dist/services/team-reconciler.service.js +234 -3
  124. package/dist/services/team-reconciler.service.js.map +1 -1
  125. package/dist/services/team-run.service.d.ts +2 -0
  126. package/dist/services/team-run.service.d.ts.map +1 -1
  127. package/dist/services/team-run.service.js +35 -7
  128. package/dist/services/team-run.service.js.map +1 -1
  129. package/dist/services/team-scheduler.service.d.ts.map +1 -1
  130. package/dist/services/team-scheduler.service.js +22 -7
  131. package/dist/services/team-scheduler.service.js.map +1 -1
  132. package/dist/services/terminal-manager.d.ts.map +1 -1
  133. package/dist/services/terminal-manager.js +1 -0
  134. package/dist/services/terminal-manager.js.map +1 -1
  135. package/dist/services/workspace.service.d.ts.map +1 -1
  136. package/dist/services/workspace.service.js +5 -5
  137. package/dist/services/workspace.service.js.map +1 -1
  138. package/dist/socket/__tests__/socket-gateway.test.d.ts +2 -0
  139. package/dist/socket/__tests__/socket-gateway.test.d.ts.map +1 -0
  140. package/dist/socket/__tests__/socket-gateway.test.js +119 -0
  141. package/dist/socket/__tests__/socket-gateway.test.js.map +1 -0
  142. package/dist/socket/middleware/__tests__/auth.test.js +102 -2
  143. package/dist/socket/middleware/__tests__/auth.test.js.map +1 -1
  144. package/dist/socket/middleware/auth.d.ts +1 -0
  145. package/dist/socket/middleware/auth.d.ts.map +1 -1
  146. package/dist/socket/middleware/auth.js +22 -2
  147. package/dist/socket/middleware/auth.js.map +1 -1
  148. package/dist/socket/socket-gateway.d.ts +6 -2
  149. package/dist/socket/socket-gateway.d.ts.map +1 -1
  150. package/dist/socket/socket-gateway.js +78 -15
  151. package/dist/socket/socket-gateway.js.map +1 -1
  152. package/dist/utils/internal-api-token.d.ts +9 -0
  153. package/dist/utils/internal-api-token.d.ts.map +1 -0
  154. package/dist/utils/internal-api-token.js +74 -0
  155. package/dist/utils/internal-api-token.js.map +1 -0
  156. package/dist/utils/preview-path.d.ts +11 -0
  157. package/dist/utils/preview-path.d.ts.map +1 -0
  158. package/dist/utils/preview-path.js +46 -0
  159. package/dist/utils/preview-path.js.map +1 -0
  160. package/dist/utils/process-launch.test.js +14 -0
  161. package/dist/utils/process-launch.test.js.map +1 -1
  162. package/dist/web/assets/{AgentDemoPage-DMLw4xpg.js → AgentDemoPage-UmBBXiZq.js} +1 -1
  163. package/dist/web/assets/{AgentEnvironmentSettingsPage-NgRdouLu.js → AgentEnvironmentSettingsPage-DeMVC_O2.js} +1 -1
  164. package/dist/web/assets/{AgentLogo-ThhvSi7G.js → AgentLogo-sxp-yGLB.js} +1 -1
  165. package/dist/web/assets/{ConversationPage-B1ZcyF_h.js → ConversationPage-ykUuKcMG.js} +2 -2
  166. package/dist/web/assets/CreateTaskInput-WmNhRnVp.js +1 -0
  167. package/dist/web/assets/{DemoPage-CN2OBKzu.js → DemoPage-Cx-F46PV.js} +3 -3
  168. package/dist/web/assets/GeneralSettingsPage-DM4iy6dp.js +1 -0
  169. package/dist/web/assets/{Icons-DIZBOtuC.js → Icons-CO02_BMI.js} +1 -1
  170. package/dist/web/assets/{LoadingPreviewPage-CRBcypeY.js → LoadingPreviewPage-C58uR8H7.js} +1 -1
  171. package/dist/web/assets/McpSettingsPage-CTe-SNfY.js +1 -0
  172. package/dist/web/assets/{MemberAvatar-Y_pJlw-N.js → MemberAvatar-CZegYpYl.js} +1 -1
  173. package/dist/web/assets/NotificationSettingsPage-D17SAmMK.js +1 -0
  174. package/dist/web/assets/ProfileSettingsPage-B2rHV2eU.js +3 -0
  175. package/dist/web/assets/{ProjectKanbanPage-CBfocvKp.js → ProjectKanbanPage-SpCqpcZ0.js} +31 -32
  176. package/dist/web/assets/ProjectSettingsPage-2dD_ahm-.js +2 -0
  177. package/dist/web/assets/{ProviderSettingsPage-D-1Fyh5B.js → ProviderSettingsPage-D9vu3rO0.js} +6 -6
  178. package/dist/web/assets/{SettingsMasterDetail-CZfVaFo2.js → SettingsMasterDetail-CwRB1WBt.js} +1 -1
  179. package/dist/web/assets/{TeamSettingsPage-DysTmOGE.js → TeamSettingsPage-QXwc1AJE.js} +1 -1
  180. package/dist/web/assets/{arc-CgLBAHTH.js → arc-BRCC5BeU.js} +1 -1
  181. package/dist/web/assets/{architectureDiagram-3BPJPVTR-CP9eQfdk.js → architectureDiagram-3BPJPVTR-7lTGsSu5.js} +1 -1
  182. package/dist/web/assets/{arrow-left-y1LwO7sB.js → arrow-left-CNgpy5r6.js} +1 -1
  183. package/dist/web/assets/{blockDiagram-GPEHLZMM-BURZnUwn.js → blockDiagram-GPEHLZMM-CnscyQkX.js} +1 -1
  184. package/dist/web/assets/{c4Diagram-AAUBKEIU-Dzgp3z3S.js → c4Diagram-AAUBKEIU-DDhuPTLZ.js} +1 -1
  185. package/dist/web/assets/channel-S-3oxkZZ.js +1 -0
  186. package/dist/web/assets/check-DRdZLPss.js +1 -0
  187. package/dist/web/assets/{chevron-down--B7iZqBL.js → chevron-down-CqZBsPeR.js} +1 -1
  188. package/dist/web/assets/{chevron-right-7PShDIwg.js → chevron-right-YWciNkox.js} +1 -1
  189. package/dist/web/assets/{chevron-up-3n_vHdrD.js → chevron-up-BJ4i5iAn.js} +1 -1
  190. package/dist/web/assets/{chunk-2J33WTMH-CIpasa01.js → chunk-2J33WTMH-B96XJhZG.js} +1 -1
  191. package/dist/web/assets/{chunk-4BX2VUAB-DeSe2m1y.js → chunk-4BX2VUAB-IUZUHtbw.js} +1 -1
  192. package/dist/web/assets/{chunk-55IACEB6-BkJ6ogdn.js → chunk-55IACEB6-DcO4xSOO.js} +1 -1
  193. package/dist/web/assets/{chunk-727SXJPM-Bkbv-knP.js → chunk-727SXJPM-DuQwKkk-.js} +1 -1
  194. package/dist/web/assets/{chunk-AQP2D5EJ-BG9wGFIo.js → chunk-AQP2D5EJ-QotCqjAo.js} +1 -1
  195. package/dist/web/assets/{chunk-FMBD7UC4-Cvl_2za9.js → chunk-FMBD7UC4-C7hUbfZh.js} +1 -1
  196. package/dist/web/assets/{chunk-ND2GUHAM-B_zdzkWX.js → chunk-ND2GUHAM-B_C5eChQ.js} +1 -1
  197. package/dist/web/assets/{chunk-QZHKN3VN-Ch6dvKNw.js → chunk-QZHKN3VN-DRgZY4LJ.js} +1 -1
  198. package/dist/web/assets/{circle-alert-W13JkYj3.js → circle-alert-Ch4pQ3zT.js} +1 -1
  199. package/dist/web/assets/classDiagram-4FO5ZUOK-C00aPgpD.js +1 -0
  200. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-C00aPgpD.js +1 -0
  201. package/dist/web/assets/{code-block-OCS4YCEC-CYhJ9OPu.js → code-block-OCS4YCEC-h5zD4EvJ.js} +1 -1
  202. package/dist/web/assets/confirm-dialog-DG0L1v-9.js +1 -0
  203. package/dist/web/assets/{copy-bJ2sut_L.js → copy-JHS-5tjr.js} +1 -1
  204. package/dist/web/assets/{cose-bilkent-S5V4N54A-DWlnxyfH.js → cose-bilkent-S5V4N54A-6Gv8U8Cj.js} +1 -1
  205. package/dist/web/assets/{dagre-BM42HDAG-Bt3QI02a.js → dagre-BM42HDAG-Cf4rsmyS.js} +1 -1
  206. package/dist/web/assets/{diagram-2AECGRRQ-EaJBYSnS.js → diagram-2AECGRRQ-DW3DQ8NA.js} +1 -1
  207. package/dist/web/assets/{diagram-5GNKFQAL-BGyRb-_h.js → diagram-5GNKFQAL-C5cQ_MTX.js} +1 -1
  208. package/dist/web/assets/{diagram-KO2AKTUF-CZhDTMfm.js → diagram-KO2AKTUF-Dcs4NTfn.js} +1 -1
  209. package/dist/web/assets/{diagram-LMA3HP47-Be8BAxmL.js → diagram-LMA3HP47-lLI-OolH.js} +1 -1
  210. package/dist/web/assets/{diagram-OG6HWLK6-DEdQ7Cml.js → diagram-OG6HWLK6-BTdMG1u6.js} +1 -1
  211. package/dist/web/assets/{erDiagram-TEJ5UH35-CG9SNlbz.js → erDiagram-TEJ5UH35-BrKfSMWb.js} +1 -1
  212. package/dist/web/assets/{flowDiagram-I6XJVG4X-BUpx5PVX.js → flowDiagram-I6XJVG4X-BFT9EHqo.js} +1 -1
  213. package/dist/web/assets/folder-picker--V79noua.js +1 -0
  214. package/dist/web/assets/{ganttDiagram-6RSMTGT7-D7vRxMpE.js → ganttDiagram-6RSMTGT7-D_44EJ_y.js} +1 -1
  215. package/dist/web/assets/{gitGraphDiagram-PVQCEYII-3lhH-RcD.js → gitGraphDiagram-PVQCEYII-COrCr27e.js} +1 -1
  216. package/dist/web/assets/index-BC5stA77.js +122 -0
  217. package/dist/web/assets/{index-CGMjRoF7.js → index-Cjaho2ST.js} +4 -4
  218. package/dist/web/assets/index-DRJLGAPR.css +1 -0
  219. package/dist/web/assets/{infoDiagram-5YYISTIA-C5SNbJpO.js → infoDiagram-5YYISTIA-Derwhgw-.js} +1 -1
  220. package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-Ca7tX9_0.js → ishikawaDiagram-YF4QCWOH-Dv_SKfKy.js} +1 -1
  221. package/dist/web/assets/{journeyDiagram-JHISSGLW-B2oo6nxY.js → journeyDiagram-JHISSGLW-BvL0Myto.js} +1 -1
  222. package/dist/web/assets/{kanban-definition-UN3LZRKU-D1CzIzX9.js → kanban-definition-UN3LZRKU-D9iCCF7g.js} +1 -1
  223. package/dist/web/assets/{layers-BbLzQqyy.js → layers-D-OLv40U.js} +1 -1
  224. package/dist/web/assets/{linear-BWowtcGw.js → linear-DLebIyPZ.js} +1 -1
  225. package/dist/web/assets/{mermaid-NOHMQCX5-B42ziicV.js → mermaid-NOHMQCX5-CyA4Kmm7.js} +40 -40
  226. package/dist/web/assets/{message-square-Bd_m34OX.js → message-square-ByVmnBN0.js} +1 -1
  227. package/dist/web/assets/{mindmap-definition-RKZ34NQL-CYbO6QCk.js → mindmap-definition-RKZ34NQL-CJXkujXD.js} +1 -1
  228. package/dist/web/assets/{modal-CxOKWOjZ.js → modal-KKPLseLk.js} +1 -1
  229. package/dist/web/assets/{pencil-h5kxwbcu.js → pencil-B7ylaB7k.js} +1 -1
  230. package/dist/web/assets/{pieDiagram-4H26LBE5-DXQghKRy.js → pieDiagram-4H26LBE5-C8DfXjYu.js} +1 -1
  231. package/dist/web/assets/{quadrantDiagram-W4KKPZXB-C6lAMMQB.js → quadrantDiagram-W4KKPZXB-BxaUhA-J.js} +1 -1
  232. package/dist/web/assets/{requirementDiagram-4Y6WPE33-Di9Le7Wy.js → requirementDiagram-4Y6WPE33-CkP381y3.js} +1 -1
  233. package/dist/web/assets/{sankeyDiagram-5OEKKPKP-BGpnptvR.js → sankeyDiagram-5OEKKPKP-Ciot-1f1.js} +1 -1
  234. package/dist/web/assets/{select-DFuN9DX8.js → select-CLvHC1t4.js} +1 -1
  235. package/dist/web/assets/{sequenceDiagram-3UESZ5HK-DjfkfaQL.js → sequenceDiagram-3UESZ5HK-ZrO6aulq.js} +1 -1
  236. package/dist/web/assets/{stateDiagram-AJRCARHV-DsELotm9.js → stateDiagram-AJRCARHV-BDC3J_xT.js} +1 -1
  237. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-C_4zupNH.js +1 -0
  238. package/dist/web/assets/{switch-gL7lBFj6.js → switch-DqXAu8pW.js} +1 -1
  239. package/dist/web/assets/{textarea-Lr4GZaYW.js → textarea-ByV2n54w.js} +1 -1
  240. package/dist/web/assets/{timeline-definition-PNZ67QCA-Cq1BWC0T.js → timeline-definition-PNZ67QCA-CG898aCW.js} +1 -1
  241. package/dist/web/assets/{trash-2-B7GFt5Wl.js → trash-2-D-MBxpK4.js} +1 -1
  242. package/dist/web/assets/{upload-L8hpDFoO.js → upload-CkkorsYk.js} +1 -1
  243. package/dist/web/assets/{use-profiles-zIsoigD8.js → use-profiles-B62R9Kbn.js} +1 -1
  244. package/dist/web/assets/use-projects-JMhtZFd6.js +1 -0
  245. package/dist/web/assets/{use-providers-erJ2iHLz.js → use-providers-Cg1RDnUJ.js} +1 -1
  246. package/dist/web/assets/{useNormalizedLogs-CXAn7xj_.js → useNormalizedLogs-BMa5-cCl.js} +1 -1
  247. package/dist/web/assets/{vennDiagram-CIIHVFJN-DdOfNtRo.js → vennDiagram-CIIHVFJN-CNRNbGoo.js} +1 -1
  248. package/dist/web/assets/{wardley-L42UT6IY-BeKcEIgK.js → wardley-L42UT6IY-Fm0b_w6O.js} +1 -1
  249. package/dist/web/assets/{wardleyDiagram-YWT4CUSO-DPKOxABd.js → wardleyDiagram-YWT4CUSO-C_xf1EWg.js} +1 -1
  250. package/dist/web/assets/{xychartDiagram-2RQKCTM6-olIy_aaY.js → xychartDiagram-2RQKCTM6-D9yke6dF.js} +1 -1
  251. package/dist/web/index.html +2 -2
  252. package/node_modules/@agent-tower/shared/dist/types.d.ts +30 -1
  253. package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
  254. package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
  255. package/node_modules/@prisma/client/.prisma/client/edge.js +18 -5
  256. package/node_modules/@prisma/client/.prisma/client/index-browser.js +13 -0
  257. package/node_modules/@prisma/client/.prisma/client/index.d.ts +1450 -215
  258. package/node_modules/@prisma/client/.prisma/client/index.js +18 -5
  259. package/node_modules/@prisma/client/.prisma/client/package.json +1 -1
  260. package/node_modules/@prisma/client/.prisma/client/schema.prisma +13 -0
  261. package/node_modules/@prisma/client/.prisma/client/wasm.js +13 -0
  262. package/package.json +1 -1
  263. package/prisma/migrations/20260701000000_add_access_auth_settings/migration.sql +9 -0
  264. package/prisma/schema.prisma +13 -0
  265. package/dist/web/assets/CreateTaskInput-Cb3aRHr3.js +0 -1
  266. package/dist/web/assets/GeneralSettingsPage-CE7P3t_v.js +0 -1
  267. package/dist/web/assets/McpSettingsPage-gp1XDMUd.js +0 -1
  268. package/dist/web/assets/NotificationSettingsPage-BhZeHEef.js +0 -1
  269. package/dist/web/assets/ProfileSettingsPage-D_y3ePFs.js +0 -3
  270. package/dist/web/assets/ProjectSettingsPage-V38j8T61.js +0 -2
  271. package/dist/web/assets/channel-CWEYGfCJ.js +0 -1
  272. package/dist/web/assets/check-D2WWIhwV.js +0 -1
  273. package/dist/web/assets/classDiagram-4FO5ZUOK-CcU8zfK8.js +0 -1
  274. package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CcU8zfK8.js +0 -1
  275. package/dist/web/assets/confirm-dialog-BAqfLDT8.js +0 -1
  276. package/dist/web/assets/folder-picker-DFB9_pv4.js +0 -1
  277. package/dist/web/assets/folder-u7fKAtz_.js +0 -1
  278. package/dist/web/assets/index-7nw4fV42.js +0 -122
  279. package/dist/web/assets/index-YCjjSSLC.css +0 -1
  280. package/dist/web/assets/input-CKwRYuUJ.js +0 -1
  281. package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CudtEyHd.js +0 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "prisma-client-bf1ec758f6396e55f79a58dfb50036200f73ffdc72811e12769dfcb63bd331d7",
2
+ "name": "prisma-client-bfe332351c16fa79f28c54c782de0f4d5f8554a773f62e88efad4d8da72493d7",
3
3
  "main": "index.js",
4
4
  "types": "index.d.ts",
5
5
  "browser": "index-browser.js",
@@ -243,6 +243,8 @@ model AgentInvocation {
243
243
  status String @default("QUEUED")
244
244
  roomReplyReminderCount Int @default(0)
245
245
  nextRoomReplyReminderAt DateTime?
246
+ lastHeartbeatAt DateTime? // 最近一次真实进展(session:patch / room message)时间,心跳 watchdog 比对用
247
+ firstNudgeAt DateTime? // 首次心跳唤醒时间,作为绝对兜底起点(收到 room message 或终态时清空)
246
248
  createdAt DateTime @default(now())
247
249
  updatedAt DateTime @updatedAt
248
250
 
@@ -402,6 +404,17 @@ model AppSettings {
402
404
  commitMessagePrompt String?
403
405
  }
404
406
 
407
+ // 访问密码配置 (单例,只有一行)
408
+ model AccessAuthSettings {
409
+ id String @id @default("singleton")
410
+ enabled Boolean @default(false)
411
+ passwordHash String?
412
+ sessionSecret String
413
+ passwordUpdatedAt DateTime?
414
+ createdAt DateTime @default(now())
415
+ updatedAt DateTime @updatedAt
416
+ }
417
+
405
418
  // 通知配置 (单例,只有一行)
406
419
  // thirdPartyChannel: none, feishu
407
420
  model NotificationSettings {
@@ -293,6 +293,8 @@ exports.Prisma.AgentInvocationScalarFieldEnum = {
293
293
  status: 'status',
294
294
  roomReplyReminderCount: 'roomReplyReminderCount',
295
295
  nextRoomReplyReminderAt: 'nextRoomReplyReminderAt',
296
+ lastHeartbeatAt: 'lastHeartbeatAt',
297
+ firstNudgeAt: 'firstNudgeAt',
296
298
  createdAt: 'createdAt',
297
299
  updatedAt: 'updatedAt'
298
300
  };
@@ -389,6 +391,16 @@ exports.Prisma.AppSettingsScalarFieldEnum = {
389
391
  commitMessagePrompt: 'commitMessagePrompt'
390
392
  };
391
393
 
394
+ exports.Prisma.AccessAuthSettingsScalarFieldEnum = {
395
+ id: 'id',
396
+ enabled: 'enabled',
397
+ passwordHash: 'passwordHash',
398
+ sessionSecret: 'sessionSecret',
399
+ passwordUpdatedAt: 'passwordUpdatedAt',
400
+ createdAt: 'createdAt',
401
+ updatedAt: 'updatedAt'
402
+ };
403
+
392
404
  exports.Prisma.NotificationSettingsScalarFieldEnum = {
393
405
  id: 'id',
394
406
  osNotificationEnabled: 'osNotificationEnabled',
@@ -431,6 +443,7 @@ exports.Prisma.ModelName = {
431
443
  ExecutionLog: 'ExecutionLog',
432
444
  Attachment: 'Attachment',
433
445
  AppSettings: 'AppSettings',
446
+ AccessAuthSettings: 'AccessAuthSettings',
434
447
  NotificationSettings: 'NotificationSettings'
435
448
  };
436
449
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-tower",
3
- "version": "0.5.4-beta.0",
3
+ "version": "0.5.4-beta.1",
4
4
  "description": "AI Agent Task Management Dashboard",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,9 @@
1
+ CREATE TABLE "AccessAuthSettings" (
2
+ "id" TEXT NOT NULL PRIMARY KEY DEFAULT 'singleton',
3
+ "enabled" BOOLEAN NOT NULL DEFAULT false,
4
+ "passwordHash" TEXT,
5
+ "sessionSecret" TEXT NOT NULL,
6
+ "passwordUpdatedAt" DATETIME,
7
+ "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
8
+ "updatedAt" DATETIME NOT NULL
9
+ );
@@ -243,6 +243,8 @@ model AgentInvocation {
243
243
  status String @default("QUEUED")
244
244
  roomReplyReminderCount Int @default(0)
245
245
  nextRoomReplyReminderAt DateTime?
246
+ lastHeartbeatAt DateTime? // 最近一次真实进展(session:patch / room message)时间,心跳 watchdog 比对用
247
+ firstNudgeAt DateTime? // 首次心跳唤醒时间,作为绝对兜底起点(收到 room message 或终态时清空)
246
248
  createdAt DateTime @default(now())
247
249
  updatedAt DateTime @updatedAt
248
250
 
@@ -402,6 +404,17 @@ model AppSettings {
402
404
  commitMessagePrompt String?
403
405
  }
404
406
 
407
+ // 访问密码配置 (单例,只有一行)
408
+ model AccessAuthSettings {
409
+ id String @id @default("singleton")
410
+ enabled Boolean @default(false)
411
+ passwordHash String?
412
+ sessionSecret String
413
+ passwordUpdatedAt DateTime?
414
+ createdAt DateTime @default(now())
415
+ updatedAt DateTime @updatedAt
416
+ }
417
+
405
418
  // 通知配置 (单例,只有一行)
406
419
  // thirdPartyChannel: none, feishu
407
420
  model NotificationSettings {
@@ -1 +0,0 @@
1
- import{g as q,j as e,u as ce,r as n,aa as Re,O as Ye,x as Ge,y as Ve,$ as le,P as Ae,h as b,X as Xe,ab as Ze,ac as Je,ad as Qe}from"./index-7nw4fV42.js";import{W as L,u as et,A as tt}from"./mermaid-NOHMQCX5-B42ziicV.js";import{A as se}from"./AgentLogo-ThhvSi7G.js";import{C as re}from"./chevron-down--B7iZqBL.js";import{C as X}from"./check-D2WWIhwV.js";import{M as ze}from"./MemberAvatar-Y_pJlw-N.js";import{u as st}from"./use-providers-erJ2iHLz.js";import{P as rt}from"./trash-2-B7GFt5Wl.js";import{P as nt}from"./useNormalizedLogs-CXAn7xj_.js";import{F as ot}from"./folder-u7fKAtz_.js";const at=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ot=q("arrow-down",at);const it=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],lt=q("arrow-up",it);const ct=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],dt=q("gauge",ct);const ut=[["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"}]],mt=q("git-branch",ut);const ft=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Pt=q("search",ft);const xt=[["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"}]],pt=q("shield",xt);const gt=[["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"}]],Ft=q("square-pen",gt);const ht=[["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"}]],bt=q("zap",ht);function be({content:a,children:c,className:d="",side:l="top"}){const j=l==="bottom"?"top-full mt-2":"bottom-full mb-2",v=l==="bottom"?"bottom-full border-b-neutral-900":"top-full border-t-neutral-900";return e.jsxs("div",{className:`group/tooltip relative inline-block ${d}`,children:[c,e.jsxs("div",{className:`invisible absolute ${j} left-1/2 -translate-x-1/2 max-w-[260px] px-3 py-2 bg-neutral-900 text-white text-xs leading-relaxed rounded-lg opacity-0 group-hover/tooltip:visible group-hover/tooltip:opacity-100 group-focus-within/tooltip:visible group-focus-within/tooltip:opacity-100 transition-opacity pointer-events-none whitespace-normal z-[100] shadow-lg`,children:[a,e.jsx("div",{className:`absolute ${v} left-1/2 -translate-x-1/2 border-4 border-transparent`})]})]})}function ie(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:a.toString()}function vt(a){return a>=.9?"text-red-500":a>=.7?"text-amber-500":"text-neutral-400"}function Bt({usage:a,tooltipSide:c="top"}){const{t:d}=ce();if(!a)return null;const l=a.modelContextWindow,j=l?a.totalTokens/l:0,v=l?Math.min(Math.round(j*100),100):null,u=l?vt(j):"text-neutral-400",y=l?e.jsx("span",{children:d("上下文: {used} / {max} tokens",{used:ie(a.totalTokens),max:ie(l)})}):e.jsx("span",{children:d("已使用: {used} tokens",{used:ie(a.totalTokens)})});return e.jsx(be,{content:y,side:c,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(dt,{size:14,className:u}),e.jsxs("span",{className:`tabular-nums ${u}`,children:[ie(a.totalTokens),v!==null&&e.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",v,"%"]})]})]})})}const Nt={damping:.7,stiffness:.05,mass:1.25},jt=70,yt=1e3/60,kt=350;let de=!1;globalThis.document?.addEventListener("mousedown",()=>{de=!0});globalThis.document?.addEventListener("mouseup",()=>{de=!1});globalThis.document?.addEventListener("click",()=>{de=!1});const $t=(a={})=>{const[c,d]=n.useState(!1),[l,j]=n.useState(a.initial!==!1),[v,u]=n.useState(!1),y=n.useRef(null);y.current=a;const f=n.useCallback(()=>{if(!de)return!1;const o=window.getSelection();if(!o||!o.rangeCount)return!1;const m=o.getRangeAt(0);return m.commonAncestorContainer.contains(g.current)||g.current?.contains(m.commonAncestorContainer)},[]),N=n.useCallback(o=>{t.isAtBottom=o,j(o)},[]),x=n.useCallback(o=>{t.escapedFromLock=o,d(o)},[]),t=n.useMemo(()=>{let o;return{escapedFromLock:c,isAtBottom:l,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(m){g.current&&(g.current.scrollTop=m,t.ignoreScrollToTop=g.current.scrollTop)},get targetScrollTop(){return!g.current||!F.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!F.current)return 0;const{targetScrollTop:m}=this;if(!a.targetScrollTop)return m;if(o?.targetScrollTop===m)return o.calculatedScrollTop;const p=Math.max(Math.min(a.targetScrollTop(m,{scrollElement:g.current,contentElement:F.current}),m),0);return o={targetScrollTop:m,calculatedScrollTop:p},requestAnimationFrame(()=>{o=void 0}),p},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=jt}}},[]),P=n.useCallback((o={})=>{typeof o=="string"&&(o={animation:o}),o.preserveScrollPosition||N(!0);const m=Date.now()+(Number(o.wait)||0),p=he(y.current,o.animation),{ignoreEscapes:w=!1}=o;let R,A=t.calculatedTargetScrollTop;o.duration instanceof Promise?o.duration.finally(()=>{R=Date.now()}):R=m+(o.duration??0);const M=async()=>{const H=new Promise(requestAnimationFrame).then(()=>{if(!t.isAtBottom)return t.animation=void 0,!1;const{scrollTop:z}=t,Y=performance.now(),U=(Y-(t.lastTick??Y))/yt;if(t.animation||(t.animation={behavior:p,promise:H,ignoreEscapes:w}),t.animation.behavior===p&&(t.lastTick=Y),f()||m>Date.now())return M();if(z<Math.min(A,t.calculatedTargetScrollTop)){if(t.animation?.behavior===p){if(p==="instant")return t.scrollTop=t.calculatedTargetScrollTop,M();t.velocity=(p.damping*t.velocity+p.stiffness*t.scrollDifference)/p.mass,t.accumulated+=t.velocity*U,t.scrollTop+=t.accumulated,t.scrollTop!==z&&(t.accumulated=0)}return M()}return R>Date.now()?(A=t.calculatedTargetScrollTop,M()):(t.animation=void 0,t.scrollTop<t.calculatedTargetScrollTop?P({animation:he(y.current,y.current.resize),ignoreEscapes:w,duration:Math.max(0,R-Date.now())||void 0}):t.isAtBottom)});return H.then(z=>(requestAnimationFrame(()=>{t.animation||(t.lastTick=void 0,t.velocity=0)}),z))};return o.wait!==!0&&(t.animation=void 0),t.animation?.behavior===p?t.animation.promise:M()},[N,f,t]),i=n.useCallback(()=>{x(!0),N(!1)},[x,N]),O=n.useCallback(({target:o})=>{if(o!==g.current)return;const{scrollTop:m,ignoreScrollToTop:p}=t;let{lastScrollTop:w=m}=t;t.lastScrollTop=m,t.ignoreScrollToTop=void 0,p&&p>m&&(w=p),u(t.isNearBottom),setTimeout(()=>{if(t.resizeDifference||m===p)return;if(f()){x(!0),N(!1);return}const R=m>w,A=m<w;if(t.animation?.ignoreEscapes){t.scrollTop=w;return}A&&(x(!0),N(!1)),R&&x(!1),!t.escapedFromLock&&t.isNearBottom&&N(!0)},1)},[x,N,f,t]),K=n.useCallback(({target:o,deltaY:m})=>{let p=o;for(;!["scroll","auto"].includes(getComputedStyle(p).overflow);){if(!p.parentElement)return;p=p.parentElement}p===g.current&&m<0&&g.current.scrollHeight>g.current.clientHeight&&!t.animation?.ignoreEscapes&&(x(!0),N(!1))},[x,N,t]),g=Ie(o=>{g.current?.removeEventListener("scroll",O),g.current?.removeEventListener("wheel",K),o?.addEventListener("scroll",O,{passive:!0}),o?.addEventListener("wheel",K,{passive:!0})},[]),F=Ie(o=>{if(t.resizeObserver?.disconnect(),!o)return;let m;t.resizeObserver=new ResizeObserver(([p])=>{const{height:w}=p.contentRect,R=w-(m??w);if(t.resizeDifference=R,t.scrollTop>t.targetScrollTop&&(t.scrollTop=t.targetScrollTop),u(t.isNearBottom),R>=0){const A=he(y.current,m?y.current.resize:y.current.initial);P({animation:A,wait:!0,preserveScrollPosition:!0,duration:A==="instant"?void 0:kt})}else t.isNearBottom&&(x(!1),N(!0));m=w,requestAnimationFrame(()=>{setTimeout(()=>{t.resizeDifference===R&&(t.resizeDifference=0)},1)})}),t.resizeObserver?.observe(o)},[]);return{contentRef:F,scrollRef:g,scrollToBottom:P,stopScroll:i,isAtBottom:l||v,isNearBottom:v,escapedFromLock:c,state:t}};function Ie(a,c){const d=n.useCallback(l=>(d.current=l,a(l)),c);return d}const ge=new Map;function he(...a){const c={...Nt};let d=!1;for(const j of a){if(j==="instant"){d=!0;continue}typeof j=="object"&&(d=!1,c.damping=j.damping??c.damping,c.stiffness=j.stiffness??c.stiffness,c.mass=j.mass??c.mass)}const l=JSON.stringify(c);return ge.has(l)||ge.set(l,Object.freeze(c)),d?"instant":ge.get(l)}function Ut({providers:a,currentProviderId:c,agentType:d,onSelect:l}){const{t:j}=ce(),[v,u]=n.useState(!1),y=n.useRef(null),f=a.filter(x=>String(x.provider.agentType)===d),N=a.find(x=>x.provider.id===c);return n.useEffect(()=>{function x(t){y.current&&!y.current.contains(t.target)&&u(!1)}if(v)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[v]),f.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(se,{agentType:N?.provider.agentType??d,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:N?.provider.name?Re(N.provider.name,12):d})]}):e.jsxs("div",{className:"relative",ref:y,children:[e.jsxs("button",{onClick:()=>u(!v),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: ${N?.provider.name??d} (click to change)`,children:[e.jsx(se,{agentType:N?.provider.agentType??d,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:N?.provider.name?Re(N.provider.name,12):d}),e.jsx(re,{size:12,className:`shrink-0 transition-transform ${v?"rotate-180":""}`})]}),v&&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:j("切换渠道")}),f.map(x=>e.jsxs("button",{onClick:()=>{l(x.provider.id),u(!1)},className:`w-full flex items-center justify-between px-3 py-2 text-sm text-left hover:bg-neutral-50 transition-colors ${x.provider.id===c?"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(se,{agentType:x.provider.agentType,className:"size-4"}),e.jsx("span",{className:"truncate max-w-[120px]",children:x.provider.name}),x.provider.isDefault&&e.jsx("span",{className:"text-xs text-neutral-400",children:j("(默认)")})]}),x.provider.id===c&&e.jsx(X,{size:14,className:"shrink-0"})]},x.provider.id))]})]})}function Wt(a,c){return n.useMemo(()=>{for(let d=a.length-1;d>=0;d--){const l=a[d];if(l.tokenUsage&&typeof l.tokenUsage.totalTokens=="number"&&l.tokenUsage.totalTokens>0)return{totalTokens:l.tokenUsage.totalTokens,modelContextWindow:l.tokenUsage.modelContextWindow}}return c??null},[a,c])}function Le(a,c,d,l){if(d.filter(u=>u===l).length<=1)return a;const v=d.slice(0,c+1).filter(u=>u===l).length;return`${a} #${v}`}function wt(a){return Object.values(a).filter(Boolean).length}function Tt({mode:a,setMode:c,selectedTemplateId:d,setSelectedTemplateId:l,selectedMemberPresetIds:j,setSelectedMemberPresetIds:v,disabled:u=!1,compact:y=!1}){const{t:f}=ce(),{preserveDesktopSearch:N}=Ye(),[x,t]=n.useState(!1),{data:P}=st(),{data:i,isError:O,isFetching:K,isLoading:g,refetch:F}=Ge(),{data:o,isError:m,isFetching:p,isLoading:w,refetch:R}=Ve(),A=n.useMemo(()=>new Map((P??[]).map(({provider:r,availability:h})=>[r.id,r.name+(h.type==="NOT_FOUND"?f(" (不可用)"):"")])),[P,f]),M=n.useMemo(()=>new Map((i??[]).map(r=>[r.id,r])),[i]),H=n.useMemo(()=>new Map((o??[]).map(r=>[r.id,r])),[o]),z=n.useMemo(()=>j.map(r=>M.get(r)).filter(r=>!!r),[M,j]);n.useEffect(()=>{i!==void 0&&v(r=>{const h=r.filter(T=>M.has(T));return h.length===r.length&&h.every((T,_)=>T===r[_])?r:h})},[i,M,v]),n.useEffect(()=>{o!==void 0&&l(r=>!r||H.has(r)?r:null)},[l,H,o]);const Y=r=>{u||l(h=>h===r?null:r)},U=r=>{u||v(h=>[...h,r])},ue=r=>{u||v(h=>h.filter((T,_)=>_!==r))},ne=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:f("团队模板")}),m?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:f("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{R()},disabled:u||p,className:"ml-2 underline hover:no-underline",children:f("重试")})]}):w?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(le,{size:12,className:"animate-spin"}),f("加载中...")]}):(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:[f("当前没有团队模板"),e.jsx(Ae,{to:N("/settings/team"),className:"ml-1.5 text-info hover:underline",children:f("去创建")})]}):e.jsx("div",{className:b("space-y-1.5",y&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(o??[]).map(r=>{const h=r.id===d,T=r.members?.length??0,_=r.members?.map(B=>B.memberPresetId)??[],W=r.members?.slice(0,3).map((B,me)=>Le(B.memberPreset?.name??B.memberPresetId,me,_,B.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>Y(r.id),disabled:u,className:b("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",h?"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:b("text-xs truncate",h?"font-medium text-foreground":"text-foreground"),children:r.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[T,f("人")]})]}),W&&e.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground truncate",children:W})]}),h&&e.jsx(X,{size:13,className:"shrink-0 text-foreground"})]})},r.id)})})]}),Z=z.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:z.map((r,h)=>{const T=Le(r.name,h,j,r.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(ze,{name:r.name,avatar:r.avatar,className:"h-3.5 w-3.5 text-[7px]"}),e.jsx("span",{className:"max-w-[80px] truncate",children:T}),e.jsx("button",{type:"button",onClick:()=>ue(h),disabled:u,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Xe,{size:9})})]},`${r.id}-${h}`)})}),G=O?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:f("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{F()},disabled:u||K,className:"ml-2 underline hover:no-underline",children:f("重试")})]}):g?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(le,{size:12,className:"animate-spin"}),f("加载中...")]}):(i??[]).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:[f("当前没有成员预设"),e.jsx(Ae,{to:N("/settings/team"),className:"ml-1.5 text-info hover:underline",children:f("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(i??[]).map(r=>{const h=j.filter(W=>W===r.id).length,T=A.get(r.providerId)??r.providerId,_=wt(r.capabilities);return e.jsxs("button",{type:"button",onClick:()=>U(r.id),disabled:u,className:b("flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-left border border-transparent transition-all",u&&"cursor-not-allowed opacity-60","bg-background hover:bg-accent hover:border-border/60"),children:[e.jsx(ze,{name:r.name,avatar:r.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:r.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate",children:[T," · ",_,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[h>0&&e.jsxs("span",{className:"text-[10px] text-foreground font-semibold",children:["×",h]}),e.jsx(rt,{size:12,className:"text-muted-foreground"})]})]},r.id)})}),J=z.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:z.length}),V=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground shrink-0",children:f("执行模式")}),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:()=>!u&&c("AUTO"),disabled:u,className:b("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",a==="AUTO"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(bt,{size:11}),f("自动模式")]}),e.jsxs("button",{type:"button",onClick:()=>!u&&c("CONFIRM"),disabled:u,className:b("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",a==="CONFIRM"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(pt,{size:11}),f("确认模式")]})]})]});return y?e.jsxs("div",{className:"space-y-3",children:[V,ne,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!u&&t(r=>!r),disabled:u,"aria-expanded":x,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(re,{size:12,className:b("transition-transform",x?"":"-rotate-90")}),f("追加独立成员"),J]}),x&&e.jsxs("div",{className:"mt-2",children:[Z,G]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[V,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[ne,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:f("追加成员")}),J]}),Z,G]})]})]})}function qt({className:a="h-7 w-7"}){return e.jsx("img",{src:Ze,alt:"Agent Tower",className:`block shrink-0 object-contain ${a}`})}function Kt({className:a=""}){return e.jsx("span",{className:`font-semibold text-foreground tracking-tight text-base ${a}`,children:"Agent Tower"})}const Ct={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."};function Ht({variant:a="task",projects:c,providers:d,isProvidersLoading:l,onSubmit:j,defaultProjectId:v="",defaultProviderId:u="",onProjectChange:y,createStep:f,placeholder:N,submitLabel:x,pendingLabel:t,submitTitle:P}){const{t:i}=ce(),[O,K]=n.useState(""),[g,F]=n.useState(v),[o,m]=n.useState(u),[p,w]=n.useState("SOLO"),[R,A]=n.useState(L.WORKTREE),[M,H]=n.useState("AUTO"),[z,Y]=n.useState(null),[U,ue]=n.useState([]),[ne,Z]=n.useState(!1),[G,J]=n.useState(!1),[V,r]=n.useState(!1),[h,T]=n.useState(!1),_=n.useRef(null),W=n.useRef(null),B=n.useRef(null),me=n.useRef(null),ve=n.useRef(null),{files:Ne,addFiles:Q,removeFile:De,clear:je,buildMarkdownLinks:ye,getDoneAttachments:ke,isUploading:oe}=et(),C=a==="conversation",k=a==="task"||a==="conversation",_e=x??i(C?"开始":"创建");n.useEffect(()=>{F(v),y?.(v)},[v,y]),n.useEffect(()=>{m(u)},[u]),n.useEffect(()=>{if(!G)return;const s=S=>{_.current&&!_.current.contains(S.target)&&J(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[G]),n.useEffect(()=>{if(!V)return;const s=S=>{W.current&&!W.current.contains(S.target)&&r(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[V]),n.useEffect(()=>{if(!h)return;const s=S=>{B.current&&!B.current.contains(S.target)&&T(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[h]);const ae=n.useMemo(()=>c.find(s=>s.id===g),[c,g]),fe=n.useMemo(()=>d.find(s=>s.id===o),[d,o]),Oe=ae?.isGitRepo!==!1,D=!C&&!Oe,I=D?"SOLO":p,$=D?L.MAIN_DIRECTORY:R,Pe=$===L.MAIN_DIRECTORY?i("本地模式"):i("工作树模式"),we=i("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),Fe=i("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),Te=i("初始化 Git 后可使用工作树模式。"),E=f!=="idle",Ce=!!z||U.length>0,ee=!E&&!oe&&O.trim().length>0&&(C?!!o:!!g&&(I==="SOLO"?!!o:Ce));n.useEffect(()=>{D&&(w("SOLO"),A(L.MAIN_DIRECTORY),Z(!1),T(!1))},[D]);const xe=n.useCallback(async()=>{if(!ee)return;const s=k?ye():"",S=k?ke().map(te=>te.id):[];try{await j({title:O.trim(),description:"",projectId:C?"":g,providerId:o,mode:C?"SOLO":I,workspaceMode:!C&&I==="SOLO"?$:L.WORKTREE,teamRunMode:C?"AUTO":M,teamTemplateId:C||D?null:z,memberPresetIds:C||D?[]:U,attachmentLinks:s,attachmentIds:S}),K(""),k&&je()}catch{}},[ee,k,ye,ke,j,O,C,g,o,I,$,M,D,z,U,je]),Be=n.useCallback(s=>{s.key==="Enter"&&!s.shiftKey&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),xe())},[xe]),$e=n.useCallback(s=>{const S=s.target.files;S&&S.length>0&&Q(Array.from(S)),s.target.value=""},[Q]),Ue=n.useCallback(s=>{F(s),y?.(s),J(!1)},[y]),We=n.useCallback(s=>{if(!k)return;const S=s.clipboardData.items,te=[];for(const Me of S)if(Me.kind==="file"){const Ee=Me.getAsFile();Ee&&te.push(Ee)}te.length>0&&(s.preventDefault(),Q(te))},[Q,k]),[Se,pe]=n.useState(!1),qe=n.useCallback(s=>{k&&(s.preventDefault(),pe(!0))},[k]),Ke=n.useCallback(s=>{k&&(s.preventDefault(),pe(!1))},[k]),He=n.useCallback(s=>{if(!k)return;s.preventDefault(),pe(!1);const S=s.dataTransfer.files;S.length>0&&Q(Array.from(S))},[Q,k]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:b("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",Se?"border-info bg-info/5":"border-border",E&&"opacity-80"),onDragOver:k?qe:void 0,onDragLeave:k?Ke:void 0,onDrop:k?He:void 0,children:[k&&Ne.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(tt,{files:Ne,onRemove:De})}),e.jsx("textarea",{ref:me,value:O,onChange:s=>K(s.target.value),onKeyDown:Be,onPaste:k?We:void 0,placeholder:i(N||"Describe your task..."),disabled:E,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"}}),k&&Se&&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:i("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:k?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>ve.current?.click(),disabled:E||oe,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:i("Attach files"),children:e.jsx(nt,{size:18})}),e.jsx("input",{ref:ve,type:"file",multiple:!0,onChange:$e,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[k&&oe&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(le,{size:14,className:"animate-spin"}),i("Uploading...")]}),E&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(le,{size:14,className:"animate-spin"}),i(t??Ct[f])]}),!C&&!E&&!oe&&I==="TEAM"&&!Ce&&O.trim().length>0&&e.jsx("span",{className:"text-[11px] text-warning",children:i("请选择团队模板或追加成员")}),ee&&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:"⏎"}),_e]}),e.jsx("button",{type:"button",onClick:xe,disabled:!ee,className:b("flex items-center justify-center size-8 rounded-lg transition-all duration-200",ee?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm":"bg-muted text-muted-foreground/40 cursor-not-allowed"),title:i(P||"Create & Start"),children:e.jsx(lt,{size:16,strokeWidth:2.5})})]})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!C&&e.jsxs("div",{className:"relative",ref:_,children:[e.jsxs("button",{type:"button",onClick:()=>{E||J(s=>!s)},disabled:E,className:b("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",ae?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(ot,{size:14,className:"shrink-0",style:{color:ae?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:ae?.name??i("Project")}),e.jsx(re,{size:12,className:b("text-muted-foreground transition-transform",G&&"rotate-180")})]}),G&&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:c.map(s=>e.jsxs("button",{type:"button",onClick:()=>Ue(s.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:s.color??"var(--muted-foreground)"}}),e.jsx("span",{className:b("truncate flex-1",s.id===g?"text-foreground font-medium":"text-muted-foreground"),children:s.name}),e.jsx(X,{size:14,className:b("ml-2 shrink-0 text-foreground",s.id===g?"opacity-100":"opacity-0")})]},s.id))})]}),(C||I==="SOLO")&&e.jsxs("div",{className:"relative",ref:W,children:[e.jsxs("button",{type:"button",onClick:()=>{E||r(s=>!s)},disabled:E,className:b("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",fe?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(se,{agentType:fe?.agentType,className:"size-3.5"}),e.jsx("span",{className:"max-w-[120px] truncate",children:fe?.name??i(l?"Loading...":"Agent")}),e.jsx(re,{size:12,className:b("text-muted-foreground transition-transform",V&&"rotate-180")})]}),V&&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:d.map(s=>e.jsxs("button",{type:"button",disabled:!s.available,onClick:()=>{m(s.id),r(!1)},className:b("flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",!s.available&&"opacity-40 cursor-not-allowed"),children:[e.jsx(X,{size:14,className:b("mr-2 shrink-0 text-foreground",s.id===o?"opacity-100":"opacity-0")}),e.jsx(se,{agentType:s.agentType,className:"mr-2 size-3.5"}),e.jsxs("span",{className:b("min-w-0 truncate",s.id===o?"text-foreground font-medium":"text-muted-foreground"),children:[s.name,s.available?"":i(" (unavailable)")]})]},s.id))})]}),!C&&I==="SOLO"&&e.jsxs("div",{className:"relative",ref:B,children:[e.jsxs("button",{type:"button",onClick:()=>{E||T(s=>!s)},disabled:E,className:b("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(mt,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:Pe}),e.jsx(re,{size:12,className:b("text-muted-foreground transition-transform",h&&"rotate-180")})]}),h&&e.jsxs("div",{className:"absolute top-full left-0 mt-1.5 w-72 max-w-[calc(100vw-2rem)] bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 z-50",children:[D?e.jsx(be,{side:"bottom",className:"block w-full",content:Te,children:e.jsx("div",{tabIndex:0,"aria-label":Te,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:e.jsxs("button",{type:"button",disabled:!0,className:"flex w-full cursor-not-allowed items-center px-3 py-2 text-left text-xs opacity-40 transition-colors",children:[e.jsx(X,{size:14,className:"mr-2 mt-0.5 shrink-0 text-foreground opacity-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-muted-foreground",children:i("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:we})]})]})})}):e.jsxs("button",{type:"button",onClick:()=>{A(L.WORKTREE),T(!1)},className:"flex w-full items-center px-3 py-2 text-left text-xs transition-colors hover:bg-accent",children:[e.jsx(X,{size:14,className:b("mr-2 mt-0.5 shrink-0 text-foreground",$===L.WORKTREE?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:b("block truncate",$===L.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:i("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:we})]})]}),e.jsxs("button",{type:"button",onClick:()=>{A(L.MAIN_DIRECTORY),T(!1)},className:"flex items-start w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(X,{size:14,className:b("mr-2 mt-0.5 shrink-0 text-foreground",$===L.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:b("block truncate",$===L.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:i("本地模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:Fe})]})]})]})]}),!C&&e.jsx(be,{side:"bottom",className:"ml-auto",content:D?i("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun."):$===L.MAIN_DIRECTORY?i("TeamRun 需要工作树模式。开启团队模式时会自动切换为工作树模式。"):i("启用 TeamRun 后可选择团队模板或成员。"),children:e.jsxs("button",{type:"button",role:"switch","aria-checked":I==="TEAM",onClick:()=>{E||D||(p==="TEAM"?(w("SOLO"),Z(!1)):(w("TEAM"),T(!1),A(L.WORKTREE),Z(!0)))},disabled:E||D,className:b("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",I==="TEAM"?"text-foreground/80":"text-muted-foreground"),"aria-label":i("启用团队模式"),children:[e.jsx(Je,{size:14,className:I==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:i("团队模式")}),(D||$===L.MAIN_DIRECTORY)&&I!=="TEAM"?e.jsx(Qe,{size:12,className:"text-muted-foreground/70","aria-hidden":"true"}):null,e.jsx("span",{className:b("relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors",I==="TEAM"?"bg-primary":"bg-border"),children:e.jsx("span",{className:b("inline-block size-3 rounded-full bg-background shadow-sm transition-transform",I==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})})]}),!C&&I==="TEAM"&&ne&&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(Tt,{mode:M,setMode:H,selectedTemplateId:z,setSelectedTemplateId:Y,selectedMemberPresetIds:U,setSelectedMemberPresetIds:ue,disabled:E,compact:!0})})]})}export{Ot as A,qt as B,Ht as C,mt as G,Ut as P,Ft as S,Bt as T,bt as Z,Wt as a,lt as b,Kt as c,Pt as d,be as e,Tt as f,pt as g,$t as u};
@@ -1 +0,0 @@
1
- import{u as y,a as _,b as A,c as E,r as i,t as m,j as s,S as T,d as I,e as p,f as M,B as g}from"./index-7nw4fV42.js";import{S as v}from"./select-DFuN9DX8.js";import{T as O}from"./textarea-Lr4GZaYW.js";import{u as k}from"./use-providers-erJ2iHLz.js";import"./chevron-down--B7iZqBL.js";import"./check-D2WWIhwV.js";const L=[{value:"zh-CN",label:"简体中文"},{value:"en",label:"English"}],l="__follow_task__";function F(){const{locale:x,setLocale:S,t:e}=y(),{data:r}=_(),{data:f}=k(),{data:o}=A(),a=E(),[h,u]=i.useState(l),[c,d]=i.useState(""),[j,n]=i.useState(!1);i.useEffect(()=>{!r||!o||(u(r.commitMessageProviderId||l),d(r.commitMessagePrompt||o.prompt),n(!1))},[r,o]);const P=[{value:l,label:e("跟随任务")},...(f??[]).filter(t=>t.availability.type!=="NOT_FOUND").map(t=>({value:t.provider.id,label:t.provider.name}))],b=i.useCallback(t=>{u(t);const N=t===l?null:t;a.mutate({commitMessageProviderId:N},{onError:()=>m.error(e("保存失败"))})},[a,e]),C=i.useCallback(()=>{const t=c.trim()||null;a.mutate({commitMessagePrompt:t},{onSuccess:()=>{n(!1),m.success(e("已保存"))},onError:()=>m.error(e("保存失败"))})},[c,a,e]);return s.jsxs(T,{children:[s.jsx(I,{title:e("通用设置"),className:"mb-1"}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(p,{label:e("显示语言"),description:e("界面语言会保存到本地数据库,重启后继续生效。"),align:"center",children:s.jsx(v,{value:x,onChange:t=>S(t),options:L})})}),s.jsx(M,{className:"mt-8 mb-1",children:e("Git Commit Message")}),s.jsxs("div",{className:"divide-y divide-border/60",children:[s.jsx(p,{label:e("Agent 渠道"),description:e('"跟随任务"表示使用当前任务所用的 Agent 渠道。选择具体渠道可使用更经济的模型。'),children:s.jsx(v,{value:h,onChange:b,options:P})}),s.jsx(p,{label:e("提示词模板"),description:e("自定义生成 commit message 的提示词。留空则使用内置默认模板。"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(O,{value:c,onChange:t=>{d(t.target.value),n(!0)},rows:5,className:"font-mono resize-y"}),j&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(g,{size:"sm",variant:"ghost",onClick:()=>{d(r?.commitMessagePrompt||o?.prompt||""),n(!1)},children:e("取消")}),s.jsx(g,{size:"sm",onClick:C,disabled:a.isPending,children:a.isPending?e("保存中..."):e("保存")})]})]})})]})]})}export{F as GeneralSettingsPage};
@@ -1 +0,0 @@
1
- import{g as x,i as m,q as o,m as u,u as p,r as g,t as n,j as e,S as a,$ as f,B as i,a1 as h}from"./index-7nw4fV42.js";import{C as j}from"./copy-bJ2sut_L.js";import{C as b}from"./check-D2WWIhwV.js";const y=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],N=x("server",y);function C(){return m({queryKey:o.system.mcpConfig,queryFn:()=>u.get("/system/mcp-config")})}function v({mode:s,label:t}){const r=s==="desktop-packaged";return e.jsx("span",{className:`inline-flex items-center rounded-md px-2 py-1 text-[11px] font-medium ${r?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"}`,children:t})}function z(){const{t:s}=p(),{data:t,isLoading:r,isError:l,refetch:d}=C(),c=g.useCallback(async()=>{if(t?.configJson)try{await navigator.clipboard.writeText(t.configJson),n.success(s("MCP 配置已复制"))}catch{n.error(s("复制 MCP 配置失败"))}},[t?.configJson,s]);return r?e.jsx(a,{children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(f,{className:"h-5 w-5 animate-spin text-neutral-500"})})}):l||!t?e.jsxs(a,{children:[e.jsx("h2",{className:"mb-1 text-base font-semibold text-neutral-900",children:s("MCP 配置")}),e.jsx("div",{className:"mt-5 rounded-lg border border-red-100 bg-red-50 px-4 py-3 text-sm text-red-700",children:s("MCP 配置加载失败")}),e.jsx(i,{className:"mt-4",size:"sm",variant:"outline",onClick:()=>{d()},children:s("重试")})]}):e.jsxs(a,{children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-neutral-900",children:s("MCP 配置")}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-neutral-500",children:s("复制下面的 JSON 到支持 MCP 的客户端配置中。桌面打包版使用 App 内置 runtime,不需要全局安装 agent-tower。")})]}),e.jsxs(i,{size:"sm",onClick:c,children:[e.jsx(j,{size:14}),s("复制配置")]})]}),e.jsxs("div",{className:"space-y-3 border-b border-neutral-100 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(v,{mode:t.runtimeMode,label:t.runtimeMode==="desktop-packaged"?s("桌面打包 runtime"):s("工作区 runtime")}),e.jsx("span",{className:"text-[12px] text-neutral-400",children:t.serverName})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-neutral-100 bg-neutral-50/70 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-neutral-400",children:[e.jsx(h,{size:12}),"Command"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-neutral-800",children:t.command})]}),e.jsxs("div",{className:"rounded-lg border border-neutral-100 bg-neutral-50/70 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-neutral-400",children:[e.jsx(N,{size:12}),"Entry"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-neutral-800",children:t.args[0]??""})]})]})]}),e.jsxs("div",{className:"pt-5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("label",{className:"text-[12px] font-medium text-neutral-600",children:"mcpServers JSON"}),t.runtimeMode==="desktop-packaged"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-emerald-600",children:[e.jsx(b,{size:12}),s("无需全局 CLI")]})]}),e.jsx("textarea",{readOnly:!0,value:t.configJson,rows:14,className:"w-full resize-y rounded-lg border border-neutral-200 bg-neutral-950 px-3 py-3 font-mono text-[12px] leading-relaxed text-neutral-100 outline-none"}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-neutral-400",children:s("当前版本只生成通用 MCP 配置,不会自动修改 Claude、Codex 或其他第三方客户端配置文件。")})]})]})}export{z as McpSettingsPage};
@@ -1 +0,0 @@
1
- import{g as P,i as q,k as E,l as k,q as v,m as h,u as R,r as o,j as e,S as g,Z as B,d as W,e as j,_ as z,B as L,$ as M,a0 as A,f as K,W as Q}from"./index-7nw4fV42.js";import{S as _}from"./select-DFuN9DX8.js";import{I as d}from"./input-CKwRYuUJ.js";import{S as O}from"./switch-gL7lBFj6.js";import{M as D}from"./message-square-Bd_m34OX.js";import{C as H}from"./circle-alert-W13JkYj3.js";import"./chevron-down--B7iZqBL.js";import"./check-D2WWIhwV.js";const Z=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],$=P("link",Z);function G(){return q({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function J(){const t=E();return k({mutationFn:i=>h.put("/notifications/settings",i),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function V(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function oe(){const{t}=R(),{data:i,isLoading:y}=G(),l=J(),n=V(),N=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[a,x]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,p]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{i&&!m&&x({webhookUrl:i.feishuWebhookUrl??"",baseUrl:i.thirdPartyBaseUrl??"",titleTemplate:i.taskInReviewTitleTemplate??"",bodyTemplate:i.taskInReviewBodyTemplate??""})},[i,m]),o.useEffect(()=>(n.isSuccess?(r("success"),u.current=setTimeout(()=>r("idle"),3e3)):n.isError&&(r("error"),u.current=setTimeout(()=>r("idle"),5e3)),()=>clearTimeout(u.current)),[n.isSuccess,n.isError]),y)return e.jsx(g,{children:e.jsx(B,{rows:3})});const T=i?.osNotificationEnabled??!0,b=i?.thirdPartyChannel??"none",c=(s,I)=>{x(F=>({...F,[s]:I})),p(!0)},S=s=>{l.mutate({osNotificationEnabled:s})},C=s=>{l.mutate({thirdPartyChannel:s})},U=()=>{l.mutate({feishuWebhookUrl:a.webhookUrl.trim()||null,thirdPartyBaseUrl:a.baseUrl.trim()||null,taskInReviewTitleTemplate:a.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:a.bodyTemplate.trim()||t('✅ "{taskTitle}" 已完成,等待审查')},{onSuccess:()=>p(!1)})},w=()=>{a.webhookUrl.trim()&&n.mutate({channel:"feishu",webhookUrl:a.webhookUrl.trim(),baseUrl:a.baseUrl.trim()||void 0})};return e.jsxs(g,{children:[e.jsx(W,{title:t("通知设置"),className:"mb-1"}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:z,label:t("桌面通知"),description:t("任务完成时弹出系统通知"),align:"center",controlWidth:"auto",children:e.jsx(O,{checked:T,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:D,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(_,{value:b,onChange:s=>C(s),options:N})}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4 sm:pl-11",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-webhook-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Webhook URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"feishu-webhook-url",value:a.webhookUrl,onChange:s=>c("webhookUrl",s.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"min-w-0 flex-1 font-mono"}),e.jsxs(L,{size:"sm",variant:"outline",onClick:w,disabled:!a.webhookUrl.trim()||n.isPending,className:"h-auto shrink-0",children:[n.isPending&&e.jsx(M,{size:12,className:"mr-1 animate-spin motion-reduce:animate-none"}),t("测试")]})]}),f==="success"&&e.jsxs("div",{role:"status",className:"mt-2 flex items-center gap-1.5 text-xs text-success",children:[e.jsx(A,{size:12,"aria-hidden":"true"}),t("测试消息发送成功")]}),f==="error"&&e.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-xs text-destructive",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t("发送失败,请检查 Webhook 地址")]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-base-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx($,{size:11,"aria-hidden":"true"}),t("跳转地址")]})}),e.jsx(d,{id:"feishu-base-url",value:a.baseUrl,onChange:s=>c("baseUrl",s.target.value),placeholder:"http://localhost:5173",className:"font-mono"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t('通知卡片中的"查看任务"按钮跳转地址前缀')})]})]})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(K,{children:t("通知模板")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("支持变量: {taskTitle}, {taskId}, {projectId}, {projectName}, {status}",{taskTitle:"{taskTitle}",taskId:"{taskId}",projectId:"{projectId}",projectName:"{projectName}",status:"{status}"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-title-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("标题")}),e.jsx(d,{id:"notification-title-template",value:a.titleTemplate,onChange:s=>c("titleTemplate",s.target.value),placeholder:"Agent Tower"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-body-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("内容")}),e.jsx(d,{id:"notification-body-template",value:a.bodyTemplate,onChange:s=>c("bodyTemplate",s.target.value),placeholder:t('✅ "{taskTitle}" 已完成,等待审查')})]})]})]})]}),m&&e.jsx(Q,{saving:l.isPending,onSave:U})]})}export{oe as NotificationSettingsPage};
@@ -1,3 +0,0 @@
1
- import{u as T,r as g,j as e,S,d as J,n as M,o as w,B as E,p,h as P}from"./index-7nw4fV42.js";import{u as U,a as _,b as z,c as B}from"./use-profiles-zIsoigD8.js";import{M as F}from"./modal-CxOKWOjZ.js";import{C as G}from"./confirm-dialog-BAqfLDT8.js";import{I as $}from"./input-CKwRYuUJ.js";import{T as R}from"./textarea-Lr4GZaYW.js";import{L as H}from"./layers-BbLzQqyy.js";import{C as q}from"./chevron-down--B7iZqBL.js";import{P as K,T as Q}from"./trash-2-B7GFt5Wl.js";import{P as W}from"./pencil-h5kxwbcu.js";function X(t){const a=Object.entries(t);return a.length===0?"(empty)":a.map(([m,c])=>`${m}: ${JSON.stringify(c)}`).join(", ")}const y={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent"};function Y({agentType:t,variants:a,isBuiltIn:m,onEdit:c,onNew:h,onDelete:j}){const{t:n}=T(),[r,b]=g.useState(!0),u=Object.entries(a);return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 bg-muted/40 px-4 py-3",children:[e.jsxs("button",{type:"button",onClick:()=>b(i=>!i),"aria-expanded":r,className:"flex items-center gap-3 rounded-md transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:y[t]??t}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[u.length," ",n("个变体")]}),e.jsx(q,{size:14,"aria-hidden":"true",className:P("text-muted-foreground transition-transform motion-reduce:transition-none",r&&"rotate-180")})]}),e.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx(K,{size:12,"aria-hidden":"true"}),n("新增")]})]}),r&&e.jsxs("div",{className:"divide-y divide-border/60",children:[u.map(([i,x])=>{const f=m(i);return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-muted/40",children:[e.jsx("span",{className:P("inline-flex shrink-0 items-center rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide",i==="DEFAULT"?"bg-primary/[0.06] text-primary":"bg-muted text-muted-foreground"),children:i}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:X(x)}),f&&e.jsx("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground/70",children:n("内置")}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx("button",{onClick:()=>c(i,x),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("编辑"),"aria-label":n("编辑"),children:e.jsx(W,{size:12})}),!f&&e.jsx("button",{onClick:()=>j(i),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("删除"),"aria-label":n("删除"),children:e.jsx(Q,{size:12})})]})]},i)}),u.length===0&&e.jsx("div",{className:"px-4 py-4 text-center text-xs text-muted-foreground",children:n("暂无变体")})]})]})}function Z(){return e.jsxs("div",{role:"status","aria-label":"Loading",children:[e.jsx(p,{className:"h-7 w-36"}),e.jsx(p,{className:"mt-2 h-3.5 w-72 max-w-full"}),e.jsx("div",{className:"mt-5 space-y-3",children:Array.from({length:2}).map((t,a)=>e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-muted/40 px-4 py-3",children:[e.jsx(p,{className:"h-4 w-28"}),e.jsx(p,{className:"h-3 w-14"})]}),e.jsx("div",{className:"divide-y divide-border/60",children:Array.from({length:2}).map((m,c)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.jsx(p,{className:"h-5 w-16 rounded"}),e.jsx(p,{className:"h-3.5 flex-1"})]},c))})]},a))})]})}function ce(){const{t}=T(),{data:a,isLoading:m}=U(),{data:c}=_(),h=z(),j=B(),[n,r]=g.useState(null),[b,u]=g.useState(""),[i,x]=g.useState(""),[f,v]=g.useState(""),[o,N]=g.useState(null),k=(s,l,d)=>{r({agentType:s,variant:l,config:d,isNew:!1}),x(l),u(JSON.stringify(d,null,2)),v("")},O=s=>{r({agentType:s,variant:"",config:{},isNew:!0}),x(""),u(`{
2
-
3
- }`),v("")},D=()=>{if(!(!n||!i.trim()))try{const s=JSON.parse(b);v(""),h.mutate({agentType:n.agentType,variant:i.trim().toUpperCase(),config:s},{onSuccess:()=>r(null)})}catch{v(t("JSON 格式错误"))}},L=(s,l)=>{N({agentType:s,variant:l})},A=()=>{o&&j.mutate({agentType:o.agentType,variant:o.variant},{onSettled:()=>N(null)})},I=(s,l)=>!!c?.executors[s]?.[l];if(m)return e.jsx(S,{children:e.jsx(Z,{})});const C=a?.executors??{};return e.jsxs(S,{children:[e.jsx(J,{title:t("Profile 配置"),description:t("管理 Agent 执行器的配置变体。每个变体定义一组运行参数。"),className:"mb-4"}),e.jsx("div",{className:"space-y-3",children:Object.entries(C).map(([s,l])=>e.jsx(Y,{agentType:s,variants:l,isBuiltIn:d=>I(s,d),onEdit:(d,V)=>k(s,d,V),onNew:()=>O(s),onDelete:d=>L(s,d)},s))}),Object.keys(C).length===0&&e.jsx(M,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(F,{isOpen:!!n,onClose:()=>r(null),title:n?.isNew?t("新增 Variant — {agentType}",{agentType:y[n.agentType]??n.agentType}):t("编辑 {variant}",{variant:n?.variant??""}),action:e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"outline",onClick:()=>r(null),children:t("取消")}),e.jsx(E,{onClick:D,disabled:h.isPending,children:h.isPending?t("保存中..."):t("保存")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{label:t("Variant 名称"),htmlFor:"profile-variant-name",children:e.jsx($,{id:"profile-variant-name",value:i,onChange:s=>x(s.target.value),disabled:!n?.isNew,placeholder:t("例如: CUSTOM"),className:"font-mono"})}),e.jsxs(w,{label:t("配置 (JSON)"),htmlFor:"profile-variant-json",children:[e.jsx(R,{id:"profile-variant-json",value:b,onChange:s=>{u(s.target.value),v("")},rows:6,className:"resize-none font-mono","aria-invalid":!!f}),f&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:f})]})]})}),e.jsx(G,{isOpen:o!==null,onClose:()=>{j.isPending||N(null)},onConfirm:A,title:t("删除 Profile Variant"),description:o?t('确定删除 "{name}"?此操作不可撤销。',{name:`${y[o.agentType]??o.agentType} / ${o.variant}`}):"",confirmText:t("删除"),cancelText:t("取消"),variant:"danger",isLoading:j.isPending})]})}export{ce as ProfileSettingsPage};
@@ -1,2 +0,0 @@
1
- import{u as _,r as o,m as de,j as e,X as se,S as W,V as ue,d as $,n as H,h as K,T as me,B as z,W as xe,Y as pe,t as U}from"./index-7nw4fV42.js";import{F as V,a as he,u as fe,b as ge,c as je,d as ve,e as be}from"./folder-picker-DFB9_pv4.js";import{F as X}from"./folder-u7fKAtz_.js";import{P as re,T as Ne}from"./trash-2-B7GFt5Wl.js";import{M as Y}from"./modal-CxOKWOjZ.js";import{S as ye}from"./SettingsMasterDetail-CZfVaFo2.js";import"./chevron-right-7PShDIwg.js";import"./circle-alert-W13JkYj3.js";import"./check-D2WWIhwV.js";import"./arrow-left-y1LwO7sB.js";function Pe({value:t,onChange:N,repoPath:y,placeholder:k,disabled:i,disabledMessage:c}){const{t:d}=_(),[l,j]=o.useState(""),[h,n]=o.useState([]),[u,x]=o.useState(!1),[p,v]=o.useState(-1),b=o.useRef(null),E=o.useRef(null),R=o.useRef(void 0),q=o.useCallback(async s=>{if(i||!y||!s){n([]),x(!1);return}try{const a=await de.get("/filesystem/complete",{params:{basePath:y,prefix:s}});n(a.results),x(a.results.length>0),v(-1)}catch{n([]),x(!1)}},[i,y]);o.useEffect(()=>{if(clearTimeout(R.current),!l){n([]),x(!1);return}return R.current=setTimeout(()=>q(l),200),()=>clearTimeout(R.current)},[l,q]),o.useEffect(()=>{const s=a=>{E.current&&!E.current.contains(a.target)&&b.current&&!b.current.contains(a.target)&&x(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(i)return;const a=s.trim();!a||t.includes(a)||(N([...t,a]),j(""),x(!1),b.current?.focus())},S=s=>{i||N(t.filter((a,A)=>A!==s))},D=s=>{i||(s.type==="directory"?(j(s.path),b.current?.focus()):w(s.path))},M=(s,a)=>{i||(a.stopPropagation(),w(s.path.replace(/\/$/,"")))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||i||(u&&h.length>0?s.key==="ArrowDown"?(s.preventDefault(),v(a=>Math.min(a+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),v(a=>Math.max(a-1,-1))):s.key==="Enter"?(s.preventDefault(),p>=0?D(h[p]):w(l)):s.key==="Escape"&&x(!1):s.key==="Enter"&&(s.preventDefault(),w(l)))};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(V,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(X,{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:()=>S(a),disabled:i,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:b,type:"text",value:l,onChange:s=>j(s.target.value),onKeyDown:F,onFocus:()=>{l&&h.length>0&&x(!0)},placeholder:k??d("输入文件路径..."),disabled:i,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 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(l),disabled:i||!l.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(re,{size:14}),e.jsx("span",{children:d("添加")})]})]}),u&&e.jsx("div",{ref:E,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:h.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===p?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(V,{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:A=>M(s,A),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:d("添加此目录"),children:e.jsx(he,{size:14})})]},s.path))})]}),i&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function ke({value:t,onChange:N}){const{t:y}=_(),[k,i]=o.useState(""),[c,d]=o.useState(""),l=()=>{const n=k.trim(),u=c.trim();!n||!u||(N([...t,{name:n,command:u}]),i(""),d(""))},j=n=>{N(t.filter((u,x)=>x!==n))},h=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),l())};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,u)=>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:()=>j(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:k,onChange:n=>i(n.target.value),onKeyDown:h,placeholder:y("名称"),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:c,onChange:n=>d(n.target.value),onKeyDown:h,placeholder:y("命令"),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:l,disabled:!k.trim()||!c.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(re,{size:14}),e.jsx("span",{children:y("添加")})]})]})]})}function Z(t){return t?t.split(",").map(N=>N.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function qe(){const{t}=_(),{data:N,isLoading:y}=fe({limit:100,includeArchived:!0}),k=ge(),i=je(),c=ve(),[d,l]=o.useState(""),[j,h]=o.useState(null),[n,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),[v,b]=o.useState(null),[E,R]=o.useState(!1),[q,w]=o.useState(!1),[S,D]=o.useState(!1),[M,F]=o.useState(!1),[s,a]=o.useState(""),[A,J]=o.useState(!1),C=N?.data??[],g=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),f=g.find(r=>r.id===d),T=o.useMemo(()=>C.find(r=>r.id===v)??null,[v,C]);if(o.useEffect(()=>{!d&&g.length>0&&l(g[0].id)},[g,d]),o.useEffect(()=>{if(j){g.some(r=>r.id===j)&&(l(j),h(null));return}d&&!g.some(r=>r.id===d)&&(l(g[0]?.id??""),p(!1))},[g,j,d]),o.useEffect(()=>{f&&!x&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)})},[f,x]),y)return e.jsx(W,{className:"max-w-5xl",children:e.jsx(ue,{})});if(C.length===0)return e.jsxs(W,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ne=()=>{d&&k.mutate({id:d,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:()=>p(!1)})},oe=r=>{h(null),l(r),p(!1),J(!0)},ie=()=>{f&&(b(f.id),D(!1),F(!1),R(!0))},O=()=>{i.isPending||(R(!1),b(null),D(!1),F(!1))},ae=async()=>{if(v)try{await i.mutateAsync({id:v,deleteRepo:S}),U.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),p(!1),O()}catch{}},le=r=>{const m=I.find(P=>P.id===r);b(r),a(m?.repoDeletedAt?m.repoPath:""),w(!0)},L=()=>{c.isPending||(w(!1),b(null),a(""))},ce=async()=>{if(!(!v||T?.repoDeletedAt&&!s.trim()))try{const m=await c.mutateAsync({id:v,repoPath:s.trim()||void 0});U.success(t("项目已恢复"));for(const P of m.warnings)U.warning(P);p(!1),h(m.project.id),l(m.project.id),L()}catch{}},Q=T?.name??t("this project"),G=!!T?.repoDeletedAt,B=f?.isGitRepo!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs(W,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),g.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(ye,{items:g,selectedId:d,onSelectItem:oe,getItemId:r=>r.id,mobileShowDetail:A,onMobileBack:()=>J(!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":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:K("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.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:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-[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(pe,{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",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[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(Pe,{value:n.copyFiles,onChange:m=>{u(P=>({...P,copyFiles:m})),p(!0)},repoPath:r.repoPath,disabled:!B,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{u(P=>({...P,setupScript:m.target.value})),p(!0)},placeholder:`pnpm install
2
- pnpm run setup`,rows:4,disabled:!B,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!B&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(ke,{value:n.quickCommands,onChange:m=>{u(P=>({...P,quickCommands:m})),p(!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(me,{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(z,{size:"sm",variant:"destructive",className:"shrink-0",onClick:ie,disabled:i.isPending||c.isPending,children:[e.jsx(Ne,{size:13}),t("删除项目")]})]})}),x&&e.jsx(xe,{saving:k.isPending,onSave:ne,onCancel:()=>{f&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)}),p(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:g.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(Y,{isOpen:E,onClose:O,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:O,disabled:i.isPending,children:t("Cancel")}),e.jsx(z,{variant:"destructive",onClick:ae,disabled:i.isPending||S&&!M,children:i.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:Q})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{D(r.target.checked),r.target.checked||F(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>F(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),i.isError&&e.jsx("p",{className:"text-xs text-destructive",children:i.error instanceof Error?i.error.message:t("Failed to delete project")})]})}),e.jsx(Y,{isOpen:q,onClose:L,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:L,disabled:c.isPending,children:t("Cancel")}),e.jsx(z,{onClick:ce,disabled:c.isPending||G&&!s.trim(),children:c.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:G?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:Q}):t("恢复后,项目会重新出现在默认项目列表中。")}),G&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(be,{value:s,onChange:a,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),c.isError&&e.jsx("p",{className:"text-xs text-destructive",children:c.error instanceof Error?c.error.message:t("Failed to restore project")})]})})]})}export{qe as ProjectSettingsPage};
@@ -1 +0,0 @@
1
- import{V as a,W as n}from"./index-CGMjRoF7.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1 +0,0 @@
1
- import{g as c}from"./index-7nw4fV42.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-Bkbv-knP.js";import{_ as i}from"./index-CGMjRoF7.js";import"./chunk-FMBD7UC4-Cvl_2za9.js";import"./chunk-ND2GUHAM-B_zdzkWX.js";import"./chunk-55IACEB6-BkJ6ogdn.js";import"./chunk-2J33WTMH-CIpasa01.js";import"./index-7nw4fV42.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-Bkbv-knP.js";import{_ as i}from"./index-CGMjRoF7.js";import"./chunk-FMBD7UC4-Cvl_2za9.js";import"./chunk-ND2GUHAM-B_zdzkWX.js";import"./chunk-55IACEB6-BkJ6ogdn.js";import"./chunk-2J33WTMH-CIpasa01.js";import"./index-7nw4fV42.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{u as m,j as e,T as u,h}from"./index-7nw4fV42.js";import{M as b}from"./modal-CxOKWOjZ.js";const g=({isOpen:l,onClose:a,onConfirm:n,title:i,description:d,confirmText:c="确认",cancelText:o="取消",variant:x="default",isLoading:t=!1})=>{const{t:s}=m(),r=x==="danger";return e.jsx(b,{isOpen:l,onClose:a,title:i,className:"max-w-sm",action:e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:a,disabled:t,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:s(o)}),e.jsx("button",{onClick:n,disabled:t,className:h("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",r?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:s(t?"处理中...":c)})]}),children:e.jsxs("div",{className:"flex gap-4",children:[r&&e.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:e.jsx(u,{size:20,className:"text-red-500"})}),e.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:d})]})})};export{g as C};
@@ -1 +0,0 @@
1
- import{g as V,i as A,k as y,l as j,q as i,m as p,u as X,r as n,j as e,h as x,a6 as Q,$ as P}from"./index-7nw4fV42.js";import{F as N}from"./folder-u7fKAtz_.js";import{C as R}from"./chevron-right-7PShDIwg.js";import{C as G}from"./circle-alert-W13JkYj3.js";import{C as D}from"./check-D2WWIhwV.js";const Y=[["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"}]],ne=V("file",Y);const M=[["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"}]],ie=V("folder-plus",M);function oe(s){const l={};return s?.page!=null&&(l.page=String(s.page)),s?.limit!=null&&(l.limit=String(s.limit)),s?.includeArchived&&(l.includeArchived="true"),A({queryKey:i.projects.list(s),queryFn:()=>p.get("/projects",{params:l})})}function ce(s){return A({queryKey:i.projects.detail(s),queryFn:()=>p.get(`/projects/${s}`),enabled:!!s})}function ue(){const s=y();return j({mutationFn:l=>p.post("/projects",l),onSuccess:()=>{s.invalidateQueries({queryKey:i.projects.all})}})}function de(){const s=y();return j({mutationFn:({id:l,...a})=>p.put(`/projects/${l}`,a),onSuccess:(l,a)=>{s.invalidateQueries({queryKey:i.projects.all}),s.invalidateQueries({queryKey:i.projects.detail(a.id)})}})}function pe(){const s=y();return j({mutationFn:({id:l,deleteRepo:a})=>p.post(`/projects/${l}/archive`,{deleteRepo:a??!1}),onSuccess:(l,a)=>{s.invalidateQueries({queryKey:i.projects.all}),s.invalidateQueries({queryKey:i.projects.detail(a.id)}),s.invalidateQueries({queryKey:i.tasks.all}),s.invalidateQueries({queryKey:i.workspaces.all})}})}function xe(){const s=y();return j({mutationFn:({id:l,repoPath:a})=>p.post(`/projects/${l}/restore`,a?{repoPath:a}:{}),onSuccess:(l,a)=>{s.invalidateQueries({queryKey:i.projects.all}),s.invalidateQueries({queryKey:i.projects.detail(a.id)}),s.invalidateQueries({queryKey:i.tasks.all}),s.invalidateQueries({queryKey:i.workspaces.all})}})}function ee(s,l="git"){return l==="directory"||s.isGitRepo?"select-and-browse":"browse"}function me({value:s,onChange:l,validationMode:a="git",placeholder:L}){const{t:g}=X(),[u,_]=n.useState(""),[k,$]=n.useState([]),[C,I]=n.useState(""),[B,U]=n.useState("/"),[w,W]=n.useState([]),[Z,q]=n.useState(!1),[S,z]=n.useState(null),[b,v]=n.useState(s),[K,d]=n.useState(null),[H,E]=n.useState(!1),F=n.useRef(!1);n.useEffect(()=>{v(s)},[s]);const o=n.useCallback(async t=>{q(!0),z(null);try{const r={};t&&(r.path=t);const c=await p.get("/filesystem/browse",{params:r});_(c.current),I(c.parent),U(c.sep||"/"),$(c.dirs),c.drives&&W(c.drives)}catch(r){z(r instanceof Error?r.message:"Failed to browse directory")}finally{q(!1)}},[]);n.useEffect(()=>{F.current||(F.current=!0,o())},[o]);const m=n.useCallback(async t=>{if(v(t),a==="directory"){l(t),d(null);return}E(!0),d(null);try{const r=await p.get("/filesystem/validate",{params:{path:t}});r.valid&&r.isGitRepo!==!1?(l(t),d(null)):d(r.error??"Not a Git repository")}catch(r){d(r instanceof Error?r.message:"Validation failed")}finally{E(!1)}},[l,a]),J=n.useCallback(t=>{ee(t,a)==="select-and-browse"?(m(t.path),o(t.path)):(o(t.path),d(null))},[m,o,a]),h=B==="\\",f=n.useMemo(()=>u?u.split(/[\\/]/).filter(Boolean):[],[u]),O=n.useCallback(t=>{const r=f.slice(0,t+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]),T=n.useCallback(t=>{if(t.key==="Enter"&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229){t.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:t=>v(t.target.value),onKeyDown:T,placeholder:L??"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",s?"border-emerald-300 bg-emerald-50/50 focus:border-emerald-400":"border-neutral-200 focus:border-neutral-400")}),s&&(a==="git"?e.jsx(Q,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-emerald-500"}):e.jsx(N,{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(a==="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")}),w.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:w.map(t=>e.jsx("button",{onClick:()=>{o(t),d(null)},className:x("px-2 py-0.5 rounded text-xs font-mono transition-colors border",u.toUpperCase().startsWith(t.toUpperCase())?"bg-neutral-900 text-white border-neutral-900":"border-neutral-200 text-neutral-600 hover:bg-neutral-100"),children:t.replace("\\","")},t))}),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((t,r)=>e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[(h?r>0:!0)&&e.jsx(R,{size:10,className:"text-neutral-300"}),e.jsx("button",{onClick:()=>O(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:t})]},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:Z?e.jsxs("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:[e.jsx(P,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-xs",children:"Loading..."})]}):S?e.jsxs("div",{className:"flex items-center justify-center py-8 text-red-500 gap-2",children:[e.jsx(G,{size:14}),e.jsx("span",{className:"text-xs",children:S})]}):k.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"}),a==="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===s?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-neutral-200 bg-white text-neutral-700 hover:bg-neutral-50"),children:[e.jsx(D,{size:13}),e.jsx("span",{children:g("Select Current")})]})]}):e.jsxs("ul",{className:"divide-y divide-neutral-100",children:[u!==C&&e.jsx("li",{children:e.jsxs("button",{onClick:()=>o(C),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(N,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-neutral-500 group-hover:text-neutral-700",children:".."})]})}),k.map(t=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>J(t),className:x("w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors group",t.path===s?"bg-emerald-50":"hover:bg-neutral-50"),children:[t.isGitRepo?e.jsx(Q,{size:14,className:"text-emerald-500 flex-shrink-0"}):e.jsx(N,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:x("text-xs truncate",t.path===s?"font-medium text-emerald-700":"text-neutral-700 group-hover:text-neutral-900"),children:t.name}),t.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"}),!t.isGitRepo&&a!=="directory"&&e.jsx(R,{size:12,className:"ml-auto text-neutral-300 group-hover:text-neutral-400 flex-shrink-0"}),!t.isGitRepo&&a==="directory"&&e.jsx(D,{size:12,className:x("ml-auto flex-shrink-0",t.path===s?"text-emerald-500":"text-neutral-300 group-hover:text-neutral-400")})]})},t.path))]})})}),H&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400",children:[e.jsx(P,{size:12,className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}),K&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-500",children:[e.jsx(G,{size:12}),e.jsx("span",{children:K})]})]})}export{ne as F,ie as a,de as b,pe as c,xe as d,me as e,ce as f,ue as g,oe as u};
@@ -1 +0,0 @@
1
- import{g as o}from"./index-7nw4fV42.js";const a=[["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"}]],t=o("folder",a);export{t as F};