agent-tower 0.5.3-beta.6 → 0.5.3-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +13 -0
- package/dist/app.js.map +1 -1
- package/dist/cli.js +26 -3
- package/dist/cli.js.map +1 -1
- package/dist/executors/__tests__/base.executor.test.js +83 -8
- package/dist/executors/__tests__/base.executor.test.js.map +1 -1
- package/dist/executors/__tests__/claude-code.executor.test.d.ts +2 -0
- package/dist/executors/__tests__/claude-code.executor.test.d.ts.map +1 -0
- package/dist/executors/__tests__/claude-code.executor.test.js +72 -0
- package/dist/executors/__tests__/claude-code.executor.test.js.map +1 -0
- package/dist/executors/__tests__/providers-availability.test.d.ts +2 -0
- package/dist/executors/__tests__/providers-availability.test.d.ts.map +1 -0
- package/dist/executors/__tests__/providers-availability.test.js +92 -0
- package/dist/executors/__tests__/providers-availability.test.js.map +1 -0
- package/dist/executors/__tests__/stdin-prompt.executors.test.d.ts +2 -0
- package/dist/executors/__tests__/stdin-prompt.executors.test.d.ts.map +1 -0
- package/dist/executors/__tests__/stdin-prompt.executors.test.js +177 -0
- package/dist/executors/__tests__/stdin-prompt.executors.test.js.map +1 -0
- package/dist/executors/base.executor.d.ts.map +1 -1
- package/dist/executors/base.executor.js +131 -33
- package/dist/executors/base.executor.js.map +1 -1
- package/dist/executors/claude-code.executor.d.ts.map +1 -1
- package/dist/executors/claude-code.executor.js +22 -52
- package/dist/executors/claude-code.executor.js.map +1 -1
- package/dist/executors/codex.executor.js +4 -4
- package/dist/executors/codex.executor.js.map +1 -1
- package/dist/executors/cursor-agent.executor.d.ts.map +1 -1
- package/dist/executors/cursor-agent.executor.js +4 -6
- package/dist/executors/cursor-agent.executor.js.map +1 -1
- package/dist/executors/gemini-cli.executor.d.ts.map +1 -1
- package/dist/executors/gemini-cli.executor.js +9 -8
- package/dist/executors/gemini-cli.executor.js.map +1 -1
- package/dist/executors/image-utils.d.ts.map +1 -1
- package/dist/executors/image-utils.js +4 -22
- package/dist/executors/image-utils.js.map +1 -1
- package/dist/index.js +37 -2
- package/dist/index.js.map +1 -1
- package/dist/pipeline/agent-pipeline.d.ts.map +1 -1
- package/dist/pipeline/agent-pipeline.js +27 -2
- package/dist/pipeline/agent-pipeline.js.map +1 -1
- package/dist/services/__tests__/conversation.service.test.js +63 -0
- package/dist/services/__tests__/conversation.service.test.js.map +1 -1
- package/dist/services/conversation.service.d.ts.map +1 -1
- package/dist/services/conversation.service.js +17 -1
- package/dist/services/conversation.service.js.map +1 -1
- package/dist/services/session-manager.d.ts +9 -8
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +129 -16
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/task.service.d.ts +2 -2
- package/dist/services/terminal-manager.d.ts.map +1 -1
- package/dist/services/terminal-manager.js +39 -7
- package/dist/services/terminal-manager.js.map +1 -1
- package/dist/services/workspace.service.d.ts +7 -7
- package/dist/utils/error-log.d.ts +20 -0
- package/dist/utils/error-log.d.ts.map +1 -0
- package/dist/utils/error-log.js +176 -0
- package/dist/utils/error-log.js.map +1 -0
- package/dist/utils/error-log.test.d.ts +2 -0
- package/dist/utils/error-log.test.d.ts.map +1 -0
- package/dist/utils/error-log.test.js +233 -0
- package/dist/utils/error-log.test.js.map +1 -0
- package/dist/utils/prisma-cli-env.d.ts +3 -0
- package/dist/utils/prisma-cli-env.d.ts.map +1 -0
- package/dist/utils/prisma-cli-env.js +15 -0
- package/dist/utils/prisma-cli-env.js.map +1 -0
- package/dist/utils/prisma-cli-env.test.d.ts +2 -0
- package/dist/utils/prisma-cli-env.test.d.ts.map +1 -0
- package/dist/utils/prisma-cli-env.test.js +34 -0
- package/dist/utils/prisma-cli-env.test.js.map +1 -0
- package/dist/utils/process-launch.d.ts +4 -0
- package/dist/utils/process-launch.d.ts.map +1 -1
- package/dist/utils/process-launch.js +99 -15
- package/dist/utils/process-launch.js.map +1 -1
- package/dist/utils/process-launch.test.js +120 -3
- package/dist/utils/process-launch.test.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-BqUFGORQ.js → AgentDemoPage-C3_t3lf0.js} +1 -1
- package/dist/web/assets/{AgentLogo-O_lfAIQi.js → AgentLogo-BiGSdOLM.js} +1 -1
- package/dist/web/assets/ConversationPage-D3BaVRNK.js +3 -0
- package/dist/web/assets/CreateTaskInput-C6ZA8Cnu.js +2 -0
- package/dist/web/assets/{DemoPage-DohwggTK.js → DemoPage-BGdrlCk3.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-BqSO35vU.js → GeneralSettingsPage-DRP9x8ha.js} +1 -1
- package/dist/web/assets/{Icons-B5Qr68Dp.js → Icons-U8HyAFg8.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-DBVTXpq2.js → LoadingPreviewPage-BR3n6lWz.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-B4hjk8Q6.js → McpSettingsPage-BQ4HNeR-.js} +1 -1
- package/dist/web/assets/{MemberAvatar-DmWOKCwf.js → MemberAvatar-BjHhs0Hs.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-DiUyq7V-.js → NotificationSettingsPage-nAYf_v-C.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-BcUtq3sY.js → ProfileSettingsPage-CvVvZlDS.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-G5OQeJvU.css → ProjectKanbanPage-DcpNTP1B.css} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-klp2fAN1.js → ProjectKanbanPage-DpWuiq4x.js} +34 -34
- package/dist/web/assets/{ProjectSettingsPage-D2gQsbTJ.js → ProjectSettingsPage-B1V5vUQk.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-CX8WeQ3x.js → ProviderSettingsPage-CXq-sGzZ.js} +1 -1
- package/dist/web/assets/{SettingsMasterDetail-BtiI8TDc.js → SettingsMasterDetail-BOKbstXF.js} +1 -1
- package/dist/web/assets/{TeamSettingsPage-CZgtzFUH.js → TeamSettingsPage-DFx7ZKTf.js} +1 -1
- package/dist/web/assets/{arc-BP5t0cJz.js → arc-D4qG1SmX.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-B4nGdxyB.js → architectureDiagram-3BPJPVTR-C1KQ-nPu.js} +1 -1
- package/dist/web/assets/{arrow-left-CH7x-bnE.js → arrow-left-DKU68PPE.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-C0obS1hu.js → blockDiagram-GPEHLZMM-CHBz_0R-.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-DLOq2msX.js → c4Diagram-AAUBKEIU-spmGspVf.js} +1 -1
- package/dist/web/assets/channel-BzXNFc3j.js +1 -0
- package/dist/web/assets/check-ugjfD3Li.js +1 -0
- package/dist/web/assets/{chevron-down-CBY3fFTT.js → chevron-down-Bqq-PI_B.js} +1 -1
- package/dist/web/assets/{chevron-right-DZo7j27r.js → chevron-right-K0xCrJxO.js} +1 -1
- package/dist/web/assets/{chevron-up-721LBv_e.js → chevron-up-Rnt9gnA4.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-C07Su0AF.js → chunk-2J33WTMH-BoBYuHA8.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-DAdn-ED3.js → chunk-4BX2VUAB-Bmb_y0KF.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-BL4-BcAX.js → chunk-55IACEB6-B_KS5xlb.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-BmmMDMNV.js → chunk-727SXJPM-DI9KppWM.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-CeLsYTvJ.js → chunk-AQP2D5EJ-C3F0DJdJ.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-Bs7S01MB.js → chunk-FMBD7UC4-C6-Jfc2f.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-uqytV5JO.js → chunk-ND2GUHAM-Crt5iCMS.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-DGM3LKCe.js → chunk-QZHKN3VN-CSYfO5_E.js} +1 -1
- package/dist/web/assets/{circle-alert-Dkp6R_Ml.js → circle-alert-BA6H1Efg.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-DWVhCasm.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DWVhCasm.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-C_fs5i5h.js → code-block-OCS4YCEC-BNCfYHwe.js} +1 -1
- package/dist/web/assets/{confirm-dialog-IGqDL03n.js → confirm-dialog-xFGalfma.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-2VABc7UM.js → cose-bilkent-S5V4N54A-CsfM-xa6.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-D0-HOAOA.js → dagre-BM42HDAG-a0_McFXq.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-Cyt7AAOQ.js → diagram-2AECGRRQ-Dc-ZrrCl.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-BBv9SoKB.js → diagram-5GNKFQAL-CVTae_wQ.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-DV5NTHkX.js → diagram-KO2AKTUF-DkfB2YqP.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-eNPojcJF.js → diagram-LMA3HP47-k45WlYTa.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-DYNkChUG.js → diagram-OG6HWLK6-D6oP9231.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-ZXZ2vyVY.js → erDiagram-TEJ5UH35-DCsStITe.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-E8oqHUJx.js → flowDiagram-I6XJVG4X-BpnMpo54.js} +1 -1
- package/dist/web/assets/{folder-BxT7ExMF.js → folder-aqzIYw0B.js} +1 -1
- package/dist/web/assets/{folder-picker-57gIIPSi.js → folder-picker-CFznZBP-.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-CEAjt7Nr.js → ganttDiagram-6RSMTGT7-CzoF4UuV.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-3dNQBESX.js → gitGraphDiagram-PVQCEYII-AlRFGn3n.js} +1 -1
- package/dist/web/assets/{index-B2TV-FU2.js → index-BMsh00ht.js} +20 -20
- package/dist/web/assets/{index-DhYpUXuu.js → index-BvCxcy2E.js} +4 -4
- package/dist/web/assets/index-CMlcurFO.css +1 -0
- package/dist/web/assets/{infoDiagram-5YYISTIA-DkDDpqvX.js → infoDiagram-5YYISTIA-DYmUMa5y.js} +1 -1
- package/dist/web/assets/{input-CupQF5Np.js → input-BOQDrqKN.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BSm79ZFA.js → ishikawaDiagram-YF4QCWOH-BbR4k44d.js} +1 -1
- package/dist/web/assets/{journeyDiagram-JHISSGLW-BCP6kLky.js → journeyDiagram-JHISSGLW-B3BgsbGr.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-jzLQwKw3.js → kanban-definition-UN3LZRKU-CAw6dg5S.js} +1 -1
- package/dist/web/assets/{layers-CCP9NEZU.js → layers-CHCOcaOD.js} +1 -1
- package/dist/web/assets/{linear-DWq5jvYH.js → linear-DuhwDM_T.js} +1 -1
- package/dist/web/assets/{loader-circle-RvIxJahM.js → loader-circle-ZTtR7VFf.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-v8DEF9xx.js → mermaid-NOHMQCX5-BfcG134x.js} +3 -3
- package/dist/web/assets/{message-square-tSoG7yGO.js → message-square-8nr39Elw.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-C5FxGBPQ.js → mindmap-definition-RKZ34NQL-Dn4_OJVF.js} +1 -1
- package/dist/web/assets/{modal-Dc2shjmi.js → modal-Ct5Hq4HV.js} +1 -1
- package/dist/web/assets/{pencil-BOmVWDhP.js → pencil-CHhoqtja.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-CmWVRs82.js → pieDiagram-4H26LBE5-BazLj2iZ.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-B4s3NNDO.js → quadrantDiagram-W4KKPZXB-By8b3yLK.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-C2KmzOV2.js → requirementDiagram-4Y6WPE33-Y8tQe-HW.js} +1 -1
- package/dist/web/assets/{rotate-ccw-BJfFrvl2.js → rotate-ccw-DacB7Wa2.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-CJbPnzq8.js → sankeyDiagram-5OEKKPKP-CsWPn5i_.js} +1 -1
- package/dist/web/assets/select-BAGWw5mB.js +1 -0
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-BFea2ow4.js → sequenceDiagram-3UESZ5HK-CRYTLL5B.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-osdtBRSX.js → stateDiagram-AJRCARHV-CRAWuvD-.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-DLPzRpsU.js +1 -0
- package/dist/web/assets/{switch-C6O0UllM.js → switch-DEDPfm5p.js} +1 -1
- package/dist/web/assets/{terminal-BKrr_mRJ.js → terminal-D9ZyN65O.js} +1 -1
- package/dist/web/assets/{textarea-Cj61Z7ha.js → textarea-Bwf5qeVw.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-BlXV0jf2.js → timeline-definition-PNZ67QCA-CNyG_LiR.js} +1 -1
- package/dist/web/assets/{trash-2-D2zJVeEr.js → trash-2-CAJaQyy-.js} +1 -1
- package/dist/web/assets/{upload-Q5mYpwnh.js → upload-CvRhSiH5.js} +1 -1
- package/dist/web/assets/{use-profiles-BSYIQUHp.js → use-profiles-CXwrOP0r.js} +1 -1
- package/dist/web/assets/{use-providers-Ct5qGj1d.js → use-providers-cM1M1P2G.js} +1 -1
- package/dist/web/assets/{useNormalizedLogs-DqPhzW9t.js → useNormalizedLogs-Bpa12fkI.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-CCuhn7zI.js → vennDiagram-CIIHVFJN-Ccs0W2eH.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-Xu-SY-Xt.js → wardley-L42UT6IY-DZ98ClK4.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-BDVBG-Eu.js → wardleyDiagram-YWT4CUSO-CFZaMuWx.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-DC5IWyMr.js → xychartDiagram-2RQKCTM6-DupmVBai.js} +1 -1
- package/dist/web/index.html +2 -2
- package/node_modules/@prisma/client/.prisma/client/edge.js +4 -3
- package/node_modules/@prisma/client/.prisma/client/index.js +4 -3
- package/package.json +1 -1
- package/dist/web/assets/ConversationPage-t8BHC8qL.js +0 -3
- package/dist/web/assets/CreateTaskInput-D5aroK_o.js +0 -2
- package/dist/web/assets/channel-ByQ8jatA.js +0 -1
- package/dist/web/assets/check-EXzHBr5H.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-BTR6CDm1.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BTR6CDm1.js +0 -1
- package/dist/web/assets/index-D1vY2KQU.css +0 -1
- package/dist/web/assets/select-C_UWYFsQ.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-ChsboHHf.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as $,j as e,u as ce,r,a0 as Ie,X as Le,i as Ge,m as Ve,M as Xe,s as Ze,v as Je,N as Ae,g as N,a1 as Qe,a2 as et}from"./index-BMsh00ht.js";import{W as O}from"./mermaid-NOHMQCX5-BfcG134x.js";import{A as se}from"./AgentLogo-BiGSdOLM.js";import{C as re}from"./chevron-down-Bqq-PI_B.js";import{C as X}from"./check-ugjfD3Li.js";import{L as ne}from"./loader-circle-ZTtR7VFf.js";import{M as Re}from"./MemberAvatar-BjHhs0Hs.js";import{u as tt}from"./use-providers-cM1M1P2G.js";import{P as st}from"./trash-2-CAJaQyy-.js";import{P as rt}from"./useNormalizedLogs-Bpa12fkI.js";import{F as nt}from"./folder-aqzIYw0B.js";const at=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Zt=$("arrow-down",at);const ot=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],it=$("arrow-up",ot);const lt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ct=$("file-text",lt);const dt=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],ut=$("gauge",dt);const mt=[["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"}]],ft=$("git-branch",mt);const xt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],pt=$("image",xt);const ht=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],gt=$("info",ht);const bt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Jt=$("search",bt);const vt=[["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"}]],jt=$("shield",vt);const Nt=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Qt=$("square-pen",Nt);const yt=[["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"}]],kt=$("zap",yt);function be({content:s,children:i,className:c="",side:d="top"}){const h=d==="bottom"?"top-full mt-2":"bottom-full mb-2",b=d==="bottom"?"bottom-full border-b-neutral-900":"top-full border-t-neutral-900";return e.jsxs("div",{className:`group/tooltip relative inline-block ${c}`,children:[i,e.jsxs("div",{className:`invisible absolute ${h} 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:[s,e.jsx("div",{className:`absolute ${b} left-1/2 -translate-x-1/2 border-4 border-transparent`})]})]})}function le(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toString()}function wt(s){return s>=.9?"text-red-500":s>=.7?"text-amber-500":"text-neutral-400"}function es({usage:s,tooltipSide:i="top"}){const{t:c}=ce();if(!s)return null;const d=s.modelContextWindow,h=d?s.totalTokens/d:0,b=d?Math.min(Math.round(h*100),100):null,m=d?wt(h):"text-neutral-400",y=d?e.jsx("span",{children:c("上下文: {used} / {max} tokens",{used:le(s.totalTokens),max:le(d)})}):e.jsx("span",{children:c("已使用: {used} tokens",{used:le(s.totalTokens)})});return e.jsx(be,{content:y,side:i,children:e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[e.jsx(ut,{size:14,className:m}),e.jsxs("span",{className:`tabular-nums ${m}`,children:[le(s.totalTokens),b!==null&&e.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",b,"%"]})]})]})})}const Tt={damping:.7,stiffness:.05,mass:1.25},Ct=70,Mt=1e3/60,St=350;let de=!1;globalThis.document?.addEventListener("mousedown",()=>{de=!0});globalThis.document?.addEventListener("mouseup",()=>{de=!1});globalThis.document?.addEventListener("click",()=>{de=!1});const ts=(s={})=>{const[i,c]=r.useState(!1),[d,h]=r.useState(s.initial!==!1),[b,m]=r.useState(!1),y=r.useRef(null);y.current=s;const f=r.useCallback(()=>{if(!de)return!1;const o=window.getSelection();if(!o||!o.rangeCount)return!1;const p=o.getRangeAt(0);return p.commonAncestorContainer.contains(u.current)||u.current?.contains(p.commonAncestorContainer)},[]),v=r.useCallback(o=>{t.isAtBottom=o,h(o)},[]),x=r.useCallback(o=>{t.escapedFromLock=o,c(o)},[]),t=r.useMemo(()=>{let o;return{escapedFromLock:i,isAtBottom:d,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return u.current?.scrollTop??0},set scrollTop(p){u.current&&(u.current.scrollTop=p,t.ignoreScrollToTop=u.current.scrollTop)},get targetScrollTop(){return!u.current||!B.current?0:u.current.scrollHeight-1-u.current.clientHeight},get calculatedTargetScrollTop(){if(!u.current||!B.current)return 0;const{targetScrollTop:p}=this;if(!s.targetScrollTop)return p;if(o?.targetScrollTop===p)return o.calculatedScrollTop;const g=Math.max(Math.min(s.targetScrollTop(p,{scrollElement:u.current,contentElement:B.current}),p),0);return o={targetScrollTop:p,calculatedScrollTop:g},requestAnimationFrame(()=>{o=void 0}),g},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Ct}}},[]),k=r.useCallback((o={})=>{typeof o=="string"&&(o={animation:o}),o.preserveScrollPosition||v(!0);const p=Date.now()+(Number(o.wait)||0),g=ge(y.current,o.animation),{ignoreEscapes:M=!1}=o;let z,_=t.calculatedTargetScrollTop;o.duration instanceof Promise?o.duration.finally(()=>{z=Date.now()}):z=p+(o.duration??0);const A=async()=>{const H=new Promise(requestAnimationFrame).then(()=>{if(!t.isAtBottom)return t.animation=void 0,!1;const{scrollTop:L}=t,Y=performance.now(),q=(Y-(t.lastTick??Y))/Mt;if(t.animation||(t.animation={behavior:g,promise:H,ignoreEscapes:M}),t.animation.behavior===g&&(t.lastTick=Y),f()||p>Date.now())return A();if(L<Math.min(_,t.calculatedTargetScrollTop)){if(t.animation?.behavior===g){if(g==="instant")return t.scrollTop=t.calculatedTargetScrollTop,A();t.velocity=(g.damping*t.velocity+g.stiffness*t.scrollDifference)/g.mass,t.accumulated+=t.velocity*q,t.scrollTop+=t.accumulated,t.scrollTop!==L&&(t.accumulated=0)}return A()}return z>Date.now()?(_=t.calculatedTargetScrollTop,A()):(t.animation=void 0,t.scrollTop<t.calculatedTargetScrollTop?k({animation:ge(y.current,y.current.resize),ignoreEscapes:M,duration:Math.max(0,z-Date.now())||void 0}):t.isAtBottom)});return H.then(L=>(requestAnimationFrame(()=>{t.animation||(t.lastTick=void 0,t.velocity=0)}),L))};return o.wait!==!0&&(t.animation=void 0),t.animation?.behavior===g?t.animation.promise:A()},[v,f,t]),l=r.useCallback(()=>{x(!0),v(!1)},[x,v]),T=r.useCallback(({target:o})=>{if(o!==u.current)return;const{scrollTop:p,ignoreScrollToTop:g}=t;let{lastScrollTop:M=p}=t;t.lastScrollTop=p,t.ignoreScrollToTop=void 0,g&&g>p&&(M=g),m(t.isNearBottom),setTimeout(()=>{if(t.resizeDifference||p===g)return;if(f()){x(!0),v(!1);return}const z=p>M,_=p<M;if(t.animation?.ignoreEscapes){t.scrollTop=M;return}_&&(x(!0),v(!1)),z&&x(!1),!t.escapedFromLock&&t.isNearBottom&&v(!0)},1)},[x,v,f,t]),C=r.useCallback(({target:o,deltaY:p})=>{let g=o;for(;!["scroll","auto"].includes(getComputedStyle(g).overflow);){if(!g.parentElement)return;g=g.parentElement}g===u.current&&p<0&&u.current.scrollHeight>u.current.clientHeight&&!t.animation?.ignoreEscapes&&(x(!0),v(!1))},[x,v,t]),u=ze(o=>{u.current?.removeEventListener("scroll",T),u.current?.removeEventListener("wheel",C),o?.addEventListener("scroll",T,{passive:!0}),o?.addEventListener("wheel",C,{passive:!0})},[]),B=ze(o=>{if(t.resizeObserver?.disconnect(),!o)return;let p;t.resizeObserver=new ResizeObserver(([g])=>{const{height:M}=g.contentRect,z=M-(p??M);if(t.resizeDifference=z,t.scrollTop>t.targetScrollTop&&(t.scrollTop=t.targetScrollTop),m(t.isNearBottom),z>=0){const _=ge(y.current,p?y.current.resize:y.current.initial);k({animation:_,wait:!0,preserveScrollPosition:!0,duration:_==="instant"?void 0:St})}else t.isNearBottom&&(x(!1),v(!0));p=M,requestAnimationFrame(()=>{setTimeout(()=>{t.resizeDifference===z&&(t.resizeDifference=0)},1)})}),t.resizeObserver?.observe(o)},[]);return{contentRef:B,scrollRef:u,scrollToBottom:k,stopScroll:l,isAtBottom:d||b,isNearBottom:b,escapedFromLock:i,state:t}};function ze(s,i){const c=r.useCallback(d=>(c.current=d,s(d)),i);return c}const he=new Map;function ge(...s){const i={...Tt};let c=!1;for(const h of s){if(h==="instant"){c=!0;continue}typeof h=="object"&&(c=!1,i.damping=h.damping??i.damping,i.stiffness=h.stiffness??i.stiffness,i.mass=h.mass??i.mass)}const d=JSON.stringify(i);return he.has(d)||he.set(d,Object.freeze(i)),c?"instant":he.get(d)}function ss({providers:s,currentProviderId:i,agentType:c,onSelect:d}){const{t:h}=ce(),[b,m]=r.useState(!1),y=r.useRef(null),f=s.filter(x=>String(x.provider.agentType)===c),v=s.find(x=>x.provider.id===i);return r.useEffect(()=>{function x(t){y.current&&!y.current.contains(t.target)&&m(!1)}if(b)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[b]),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:v?.provider.agentType??c,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:v?.provider.name?Ie(v.provider.name,12):c})]}):e.jsxs("div",{className:"relative",ref:y,children:[e.jsxs("button",{onClick:()=>m(!b),className:"flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg transition-colors cursor-pointer hover:bg-neutral-100 text-neutral-400 hover:text-neutral-600",title:`Provider: ${v?.provider.name??c} (click to change)`,children:[e.jsx(se,{agentType:v?.provider.agentType??c,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:v?.provider.name?Ie(v.provider.name,12):c}),e.jsx(re,{size:12,className:`shrink-0 transition-transform ${b?"rotate-180":""}`})]}),b&&e.jsxs("div",{className:"absolute bottom-full right-0 mb-1 bg-white rounded-lg border border-neutral-200 shadow-lg py-1 min-w-[160px] z-50",children:[e.jsx("div",{className:"px-2 py-1 text-xs text-neutral-400 border-b border-neutral-100",children:h("切换渠道")}),f.map(x=>e.jsxs("button",{onClick:()=>{d(x.provider.id),m(!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===i?"bg-blue-50 text-blue-600":"text-neutral-700"}`,children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(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:h("(默认)")})]}),x.provider.id===i&&e.jsx(X,{size:14,className:"shrink-0"})]},x.provider.id))]})]})}const Et="/api";function It(s){return s<1024?`${s}B`:s<1024*1024?`${(s/1024).toFixed(1)}KB`:`${(s/(1024*1024)).toFixed(1)}MB`}function At({files:s,onRemove:i}){return s.length===0?null:e.jsx("div",{"aria-label":"Attachments",className:"flex flex-wrap gap-2 px-4 pt-3 pb-1",children:s.map(c=>e.jsx(Rt,{item:c,onRemove:i},c.tempId))})}function Rt({item:s,onRemove:i}){const c=s.file.type.startsWith("image/"),d=s.status==="error",h=s.status==="uploading";return e.jsxs("div",{className:`relative group flex items-center gap-2 px-3 py-2 rounded-lg border text-xs max-w-[200px] ${d?"border-red-200 bg-red-50 text-red-600":"border-neutral-200 bg-neutral-50 text-neutral-700"}`,children:[c&&s.status==="done"&&s.attachment?e.jsx("img",{src:`${Et}${s.attachment.url}`,alt:s.file.name,className:"w-8 h-8 rounded object-cover flex-shrink-0"}):e.jsx("span",{className:"flex-shrink-0",children:h?e.jsx(ne,{size:16,className:"animate-spin text-neutral-400"}):c?e.jsx(pt,{size:16,className:"text-neutral-400"}):e.jsx(ct,{size:16,className:"text-neutral-400"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate font-medium",children:s.file.name}),d?e.jsx("div",{className:"truncate text-red-500",children:s.error}):e.jsx("div",{className:"text-neutral-400",children:It(s.file.size)})]}),e.jsx("button",{onClick:()=>i(s.tempId),className:"absolute -top-1.5 -right-1.5 hidden group-hover:flex items-center justify-center w-5 h-5 rounded-full bg-neutral-700 text-white hover:bg-neutral-900 transition-colors",children:e.jsx(Le,{size:10})})]})}const zt="/api";async function _t(s){const i=new FormData;i.append("file",s);const c=await fetch(`${zt}/attachments/upload`,{method:"POST",body:i});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error(d.error||`Upload failed (${c.status})`)}return c.json()}let Lt=0;function Dt(){const[s,i]=r.useState([]),c=r.useRef(s);c.current=s;const d=r.useCallback(async t=>{const k=t.map(l=>({tempId:`tmp-${++Lt}`,file:l,progress:0,status:"uploading"}));i(l=>[...l,...k]),await Promise.allSettled(k.map(async l=>{try{const T=await _t(l.file);i(C=>C.map(u=>u.tempId===l.tempId?{...u,status:"done",progress:100,attachment:T}:u))}catch(T){i(C=>C.map(u=>u.tempId===l.tempId?{...u,status:"error",error:T instanceof Error?T.message:"Upload failed"}:u))}}))},[]),h=r.useCallback(()=>c.current.filter(t=>t.status==="done"&&t.attachment).map(t=>t.attachment),[]),b=r.useCallback(t=>{i(k=>k.filter(l=>l.tempId!==t))},[]),m=r.useCallback(()=>{i([])},[]),y=r.useCallback(t=>{t.length!==0&&i(k=>{const l=new Set(k.map(C=>C.attachment?.id??C.tempId)),T=t.filter(C=>{const u=C.attachment?.id??C.tempId;return l.has(u)?!1:(l.add(u),!0)});return T.length>0?[...k,...T]:k})},[]),f=r.useCallback(()=>{const t=h();return t.length===0?"":t.map(k=>`${k.mimeType.startsWith("image/")?"!":""}[${k.originalName}](${k.storagePath})`).join(`
|
|
2
|
+
`)},[h]),v=s.length>0,x=s.some(t=>t.status==="uploading");return{files:s,addFiles:d,removeFile:b,clear:m,restoreFiles:y,buildMarkdownLinks:f,getDoneAttachments:h,hasFiles:v,isUploading:x}}function rs(s){const i=r.useMemo(()=>Array.from(new Set(s.filter(Boolean))),[s]);return Ge({queryKey:["attachments","metadata",i],queryFn:()=>Ve.get("/attachments/metadata",{params:{ids:i.join(",")}}),enabled:i.length>0,staleTime:300*1e3})}function ns(s,i){return r.useMemo(()=>{for(let c=s.length-1;c>=0;c--){const d=s[c];if(d.tokenUsage&&typeof d.tokenUsage.totalTokens=="number"&&d.tokenUsage.totalTokens>0)return{totalTokens:d.tokenUsage.totalTokens,modelContextWindow:d.tokenUsage.modelContextWindow}}return i??null},[s,i])}function _e(s,i,c,d){if(c.filter(m=>m===d).length<=1)return s;const b=c.slice(0,i+1).filter(m=>m===d).length;return`${s} #${b}`}function Ot(s){return Object.values(s).filter(Boolean).length}function Ft({mode:s,setMode:i,selectedTemplateId:c,setSelectedTemplateId:d,selectedMemberPresetIds:h,setSelectedMemberPresetIds:b,disabled:m=!1,compact:y=!1}){const{t:f}=ce(),{preserveDesktopSearch:v}=Xe(),[x,t]=r.useState(!1),{data:k}=tt(),{data:l,isError:T,isFetching:C,isLoading:u,refetch:B}=Ze(),{data:o,isError:p,isFetching:g,isLoading:M,refetch:z}=Je(),_=r.useMemo(()=>new Map((k??[]).map(({provider:a,availability:j})=>[a.id,a.name+(j.type==="NOT_FOUND"?f(" (不可用)"):"")])),[k,f]),A=r.useMemo(()=>new Map((l??[]).map(a=>[a.id,a])),[l]),H=r.useMemo(()=>new Map((o??[]).map(a=>[a.id,a])),[o]),L=r.useMemo(()=>h.map(a=>A.get(a)).filter(a=>!!a),[A,h]);r.useEffect(()=>{l!==void 0&&b(a=>{const j=a.filter(S=>A.has(S));return j.length===a.length&&j.every((S,P)=>S===a[P])?a:j})},[l,A,b]),r.useEffect(()=>{o!==void 0&&d(a=>!a||H.has(a)?a:null)},[d,H,o]);const Y=a=>{m||d(j=>j===a?null:a)},q=a=>{m||b(j=>[...j,a])},ue=a=>{m||b(j=>j.filter((S,P)=>P!==a))},ae=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:f("团队模板")}),p?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:()=>{z()},disabled:m||g,className:"ml-2 underline hover:no-underline",children:f("重试")})]}):M?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(ne,{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:v("/settings/team"),className:"ml-1.5 text-info hover:underline",children:f("去创建")})]}):e.jsx("div",{className:N("space-y-1.5",y&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(o??[]).map(a=>{const j=a.id===c,S=a.members?.length??0,P=a.members?.map(U=>U.memberPresetId)??[],K=a.members?.slice(0,3).map((U,me)=>_e(U.memberPreset?.name??U.memberPresetId,me,P,U.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>Y(a.id),disabled:m,className:N("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",j?"bg-background border-foreground/20 shadow-sm":"bg-background border-border/60 hover:border-border hover:bg-accent"),children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:N("text-xs truncate",j?"font-medium text-foreground":"text-foreground"),children:a.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[S,f("人")]})]}),K&&e.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground truncate",children:K})]}),j&&e.jsx(X,{size:13,className:"shrink-0 text-foreground"})]})},a.id)})})]}),Z=L.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:L.map((a,j)=>{const S=_e(a.name,j,h,a.id);return e.jsxs("div",{className:"inline-flex items-center gap-1 pl-1 pr-0.5 py-0.5 rounded-md border border-border/60 bg-background text-[10px] text-foreground",children:[e.jsx(Re,{name:a.name,avatar:a.avatar,className:"h-3.5 w-3.5 text-[7px]"}),e.jsx("span",{className:"max-w-[80px] truncate",children:S}),e.jsx("button",{type:"button",onClick:()=>ue(j),disabled:m,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Le,{size:9})})]},`${a.id}-${j}`)})}),G=T?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:()=>{B()},disabled:m||C,className:"ml-2 underline hover:no-underline",children:f("重试")})]}):u?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(ne,{size:12,className:"animate-spin"}),f("加载中...")]}):(l??[]).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:v("/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:(l??[]).map(a=>{const j=h.filter(K=>K===a.id).length,S=_.get(a.providerId)??a.providerId,P=Ot(a.capabilities);return e.jsxs("button",{type:"button",onClick:()=>q(a.id),disabled:m,className:N("flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-left border border-transparent transition-all",m&&"cursor-not-allowed opacity-60","bg-background hover:bg-accent hover:border-border/60"),children:[e.jsx(Re,{name:a.name,avatar:a.avatar,className:"h-6 w-6 text-[9px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:a.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate",children:[S," · ",P,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[j>0&&e.jsxs("span",{className:"text-[10px] text-foreground font-semibold",children:["×",j]}),e.jsx(st,{size:12,className:"text-muted-foreground"})]})]},a.id)})}),J=L.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[10px] font-semibold text-primary-foreground px-1.5",children:L.length}),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:()=>!m&&i("AUTO"),disabled:m,className:N("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",s==="AUTO"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(kt,{size:11}),f("自动模式")]}),e.jsxs("button",{type:"button",onClick:()=>!m&&i("CONFIRM"),disabled:m,className:N("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",s==="CONFIRM"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(jt,{size:11}),f("确认模式")]})]})]});return y?e.jsxs("div",{className:"space-y-3",children:[V,ae,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!m&&t(a=>!a),disabled:m,"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:N("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:[ae,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 as({className:s="h-7 w-7"}){return e.jsx("img",{src:Qe,alt:"Agent Tower",className:`block shrink-0 object-contain ${s}`})}function os({className:s=""}){return e.jsx("span",{className:`font-semibold text-foreground tracking-tight text-base ${s}`,children:"Agent Tower"})}const Pt={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."};function is({variant:s="task",projects:i,providers:c,isProvidersLoading:d,onSubmit:h,defaultProjectId:b="",defaultProviderId:m="",onProjectChange:y,createStep:f,placeholder:v,submitLabel:x,pendingLabel:t,submitTitle:k}){const{t:l}=ce(),[T,C]=r.useState(""),[u,B]=r.useState(b),[o,p]=r.useState(m),[g,M]=r.useState("SOLO"),[z,_]=r.useState(O.WORKTREE),[A,H]=r.useState("AUTO"),[L,Y]=r.useState(null),[q,ue]=r.useState([]),[ae,Z]=r.useState(!1),[G,J]=r.useState(!1),[V,a]=r.useState(!1),[j,S]=r.useState(!1),P=r.useRef(null),K=r.useRef(null),U=r.useRef(null),me=r.useRef(null),ve=r.useRef(null),{files:je,addFiles:Q,removeFile:De,clear:Ne,buildMarkdownLinks:ye,getDoneAttachments:ke,isUploading:oe}=Dt(),E=s==="conversation",w=s==="task"||s==="conversation",Oe=x??l(E?"开始":"创建");r.useEffect(()=>{B(b),y?.(b)},[b,y]),r.useEffect(()=>{p(m)},[m]),r.useEffect(()=>{if(!G)return;const n=I=>{P.current&&!P.current.contains(I.target)&&J(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[G]),r.useEffect(()=>{if(!V)return;const n=I=>{K.current&&!K.current.contains(I.target)&&a(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[V]),r.useEffect(()=>{if(!j)return;const n=I=>{U.current&&!U.current.contains(I.target)&&S(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[j]);const ie=r.useMemo(()=>i.find(n=>n.id===u),[i,u]),fe=r.useMemo(()=>c.find(n=>n.id===o),[c,o]),Fe=ie?.isGitRepo!==!1,F=!E&&!Fe,D=F?"SOLO":g,W=F?O.MAIN_DIRECTORY:z,Pe=W===O.MAIN_DIRECTORY?l("本地模式"):l("工作树模式"),we=l("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),$e=l("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),Te=l("初始化 Git 后可使用工作树模式。"),R=f!=="idle",Ce=!!L||q.length>0,ee=!R&&!oe&&T.trim().length>0&&(E?!!o:!!u&&(D==="SOLO"?!!o:Ce));r.useEffect(()=>{F&&(M("SOLO"),_(O.MAIN_DIRECTORY),Z(!1),S(!1))},[F]);const xe=r.useCallback(async()=>{if(!ee)return;const n=w?ye():"",I=w?ke().map(te=>te.id):[];try{await h({title:T.trim(),description:"",projectId:E?"":u,providerId:o,mode:E?"SOLO":D,workspaceMode:!E&&D==="SOLO"?W:O.WORKTREE,teamRunMode:E?"AUTO":A,teamTemplateId:E||F?null:L,memberPresetIds:E||F?[]:q,attachmentLinks:n,attachmentIds:I}),C(""),w&&Ne()}catch{}},[ee,w,ye,ke,h,T,E,u,o,D,W,A,F,L,q,Ne]),Be=r.useCallback(n=>{n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),xe())},[xe]),Ue=r.useCallback(n=>{const I=n.target.files;I&&I.length>0&&Q(Array.from(I)),n.target.value=""},[Q]),We=r.useCallback(n=>{B(n),y?.(n),J(!1)},[y]),qe=r.useCallback(n=>{if(!w)return;const I=n.clipboardData.items,te=[];for(const Se of I)if(Se.kind==="file"){const Ee=Se.getAsFile();Ee&&te.push(Ee)}te.length>0&&(n.preventDefault(),Q(te))},[Q,w]),[Me,pe]=r.useState(!1),Ke=r.useCallback(n=>{w&&(n.preventDefault(),pe(!0))},[w]),He=r.useCallback(n=>{w&&(n.preventDefault(),pe(!1))},[w]),Ye=r.useCallback(n=>{if(!w)return;n.preventDefault(),pe(!1);const I=n.dataTransfer.files;I.length>0&&Q(Array.from(I))},[Q,w]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:N("relative bg-background rounded-xl border transition-colors duration-200","shadow-[0_1px_2px_rgba(0,0,0,0.05)]","hover:border-ring/40 focus-within:border-ring/60",Me?"border-info bg-info/5":"border-border",R&&"opacity-80"),onDragOver:w?Ke:void 0,onDragLeave:w?He:void 0,onDrop:w?Ye:void 0,children:[w&&je.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(At,{files:je,onRemove:De})}),e.jsx("textarea",{ref:me,value:T,onChange:n=>C(n.target.value),onKeyDown:Be,onPaste:w?qe:void 0,placeholder:l(v||"Describe your task..."),disabled:R,autoFocus:!0,rows:1,className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/80 leading-relaxed",style:{minHeight:"76px",maxHeight:"220px",fieldSizing:"content"}}),w&&Me&&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:l("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:w?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>ve.current?.click(),disabled:R||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:l("Attach files"),children:e.jsx(rt,{size:18})}),e.jsx("input",{ref:ve,type:"file",multiple:!0,onChange:Ue,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[w&&oe&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ne,{size:14,className:"animate-spin"}),l("Uploading...")]}),R&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ne,{size:14,className:"animate-spin"}),l(t??Pt[f])]}),!E&&!R&&!oe&&D==="TEAM"&&!Ce&&T.trim().length>0&&e.jsx("span",{className:"text-[11px] text-warning",children:l("请选择团队模板或追加成员")}),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:"⏎"}),Oe]}),e.jsx("button",{type:"button",onClick:xe,disabled:!ee,className:N("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:l(k||"Create & Start"),children:e.jsx(it,{size:16,strokeWidth:2.5})})]})]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!E&&e.jsxs("div",{className:"relative",ref:P,children:[e.jsxs("button",{type:"button",onClick:()=>{R||J(n=>!n)},disabled:R,className:N("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",ie?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(nt,{size:14,className:"shrink-0",style:{color:ie?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:ie?.name??l("Project")}),e.jsx(re,{size:12,className:N("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:i.map(n=>e.jsxs("button",{type:"button",onClick:()=>We(n.id),className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx("span",{className:"size-2 rounded-full shrink-0 mr-2",style:{backgroundColor:n.color??"var(--muted-foreground)"}}),e.jsx("span",{className:N("truncate flex-1",n.id===u?"text-foreground font-medium":"text-muted-foreground"),children:n.name}),e.jsx(X,{size:14,className:N("ml-2 shrink-0 text-foreground",n.id===u?"opacity-100":"opacity-0")})]},n.id))})]}),(E||D==="SOLO")&&e.jsxs("div",{className:"relative",ref:K,children:[e.jsxs("button",{type:"button",onClick:()=>{R||a(n=>!n)},disabled:R,className:N("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",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??l(d?"Loading...":"Agent")}),e.jsx(re,{size:12,className:N("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:c.map(n=>e.jsxs("button",{type:"button",disabled:!n.available,onClick:()=>{p(n.id),a(!1)},className:N("flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",!n.available&&"opacity-40 cursor-not-allowed"),children:[e.jsx(X,{size:14,className:N("mr-2 shrink-0 text-foreground",n.id===o?"opacity-100":"opacity-0")}),e.jsx(se,{agentType:n.agentType,className:"mr-2 size-3.5"}),e.jsxs("span",{className:N("min-w-0 truncate",n.id===o?"text-foreground font-medium":"text-muted-foreground"),children:[n.name,n.available?"":l(" (unavailable)")]})]},n.id))})]}),!E&&D==="SOLO"&&e.jsxs("div",{className:"relative",ref:U,children:[e.jsxs("button",{type:"button",onClick:()=>{R||S(n=>!n)},disabled:R,className:N("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-foreground/80"),children:[e.jsx(ft,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:Pe}),e.jsx(re,{size:12,className:N("text-muted-foreground transition-transform",j&&"rotate-180")})]}),j&&e.jsxs("div",{className:"absolute top-full left-0 mt-1.5 w-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:[F?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:l("工作树模式")}),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:()=>{_(O.WORKTREE),S(!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:N("mr-2 mt-0.5 shrink-0 text-foreground",W===O.WORKTREE?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:N("block truncate",W===O.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:l("工作树模式")}),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:()=>{_(O.MAIN_DIRECTORY),S(!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:N("mr-2 mt-0.5 shrink-0 text-foreground",W===O.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:N("block truncate",W===O.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:l("本地模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:$e})]})]})]})]}),!E&&e.jsx(be,{side:"bottom",className:"ml-auto",content:F?l("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun."):W===O.MAIN_DIRECTORY?l("TeamRun 需要工作树模式。开启团队模式时会自动切换为工作树模式。"):l("启用 TeamRun 后可选择团队模板或成员。"),children:e.jsxs("button",{type:"button",role:"switch","aria-checked":D==="TEAM",onClick:()=>{R||F||(g==="TEAM"?(M("SOLO"),Z(!1)):(M("TEAM"),S(!1),_(O.WORKTREE),Z(!0)))},disabled:R||F,className:N("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",D==="TEAM"?"text-foreground/80":"text-muted-foreground"),"aria-label":l("启用团队模式"),children:[e.jsx(et,{size:14,className:D==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:l("团队模式")}),(F||W===O.MAIN_DIRECTORY)&&D!=="TEAM"?e.jsx(gt,{size:12,className:"text-muted-foreground/70","aria-hidden":"true"}):null,e.jsx("span",{className:N("relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors",D==="TEAM"?"bg-primary":"bg-border"),children:e.jsx("span",{className:N("inline-block size-3 rounded-full bg-background shadow-sm transition-transform",D==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})})]}),!E&&D==="TEAM"&&ae&&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(Ft,{mode:A,setMode:H,selectedTemplateId:L,setSelectedTemplateId:Y,selectedMemberPresetIds:q,setSelectedMemberPresetIds:ue,disabled:R,compact:!0})})]})}export{Zt as A,as as B,is as C,ct as F,ft as G,pt as I,ss as P,Qt as S,es as T,kt as Z,ns as a,Dt as b,At as c,it as d,os as e,Jt as f,rs as g,gt as h,be as i,Ft as j,jt as k,ts as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,I as j,J as E,K as T,j as s,g as M,u as P,m as I,B as O}from"./index-
|
|
1
|
+
import{r as a,I as j,J as E,K as T,j as s,g as M,u as P,m as I,B as O}from"./index-BMsh00ht.js";function U(t){const{sessionId:c,onOutput:k,onExit:x,onError:b}=t,[p,g]=a.useState(()=>j.isConnected()),[r,d]=a.useState(!1),m=a.useRef({onOutput:k,onExit:x,onError:b});m.current={onOutput:k,onExit:x,onError:b},a.useEffect(()=>{const n=j.getSocket();g(n.connected);const u=()=>g(!0),v=()=>{g(!1),d(!1)},w=l=>{l.sessionId===c&&m.current.onOutput?.(l.data)},C=l=>{l.sessionId===c&&(d(!1),m.current.onExit?.(l.exitCode))},S=l=>{l.sessionId===c&&m.current.onError?.(l.message)};return n.on("connect",u),n.on("disconnect",v),n.on(E.SESSION_STDOUT,w),n.on(E.SESSION_EXIT,C),n.on(E.SESSION_ERROR,S),g(n.connected),()=>{n.off("connect",u),n.off("disconnect",v),n.off(E.SESSION_STDOUT,w),n.off(E.SESSION_EXIT,C),n.off(E.SESSION_ERROR,S),d(!1)}},[c]);const i=a.useCallback(()=>new Promise(n=>{if(!j.getSocket().connected){n(!1);return}d(!0),n(!0)}),[]),y=a.useCallback(()=>{d(!1)},[]),N=a.useCallback(n=>{j.getSocket().emit(T.INPUT,{sessionId:c,data:n})},[c]),h=a.useCallback((n,u)=>{j.getSocket().emit(T.RESIZE,{sessionId:c,cols:n,rows:u})},[c]);return{isConnected:p,isAttached:r,attach:i,detach:y,sendInput:N,resize:h}}function $({className:t,...c}){return s.jsx("div",{"data-slot":"card",className:M("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...c})}function z(){const{t}=P(),[c,k]=a.useState([]),[x,b]=a.useState(""),[p,g]=a.useState(""),[r,d]=a.useState(null),[m,i]=a.useState([]),[y,N]=a.useState(!1),[h,n]=a.useState(""),u=a.useRef(null),v=a.useCallback(e=>{i(o=>{const f=o[o.length-1];return f&&f.role==="agent"?[...o.slice(0,-1),{...f,content:f.content+e}]:[...o,{role:"agent",content:e,timestamp:new Date}]})},[]),w=a.useCallback(e=>{i(o=>[...o,{role:"agent",content:`
|
|
2
2
|
[${t("Process exited with code {code}",{code:e})}]`,timestamp:new Date}]),d(null)},[t]),C=a.useCallback(e=>{i(o=>[...o,{role:"agent",content:`
|
|
3
3
|
[${t("Error: {message}",{message:e})}]`,timestamp:new Date}])},[t]),{isConnected:S,isAttached:l,attach:D}=U({sessionId:r||"",onOutput:v,onExit:w,onError:C});a.useEffect(()=>{I.get("/demo/agents").then(e=>{k(e.agents);const o=e.agents.find(f=>f.available);o&&b(o.type)})},[]),a.useEffect(()=>{u.current?.scrollIntoView({behavior:"smooth"})},[m]),a.useEffect(()=>{r&&S&&!l&&D()},[r,S,l,D]);const R=async()=>{if(!(!x||!p.trim())){N(!0),i([{role:"user",content:p,timestamp:new Date}]);try{const e=await I.post("/demo/start",{agentType:x,prompt:p.trim()});d(e.sessionId),g("")}catch(e){i(o=>[...o,{role:"agent",content:t("启动失败: {message}",{message:e instanceof Error?e.message:t("未知错误")}),timestamp:new Date}])}finally{N(!1)}}},A=async()=>{if(!r||!h.trim())return;const e=h.trim();i(o=>[...o,{role:"user",content:e,timestamp:new Date}]),n("");try{await I.post(`/demo/${r}/message`,{message:e})}catch(o){i(f=>[...f,{role:"agent",content:t("发送失败: {message}",{message:o instanceof Error?o.message:t("未知错误")}),timestamp:new Date}])}},_=async()=>{if(r)try{await I.post(`/demo/${r}/stop`),i(e=>[...e,{role:"agent",content:`
|
|
4
4
|
[${t("会话已停止")}]`,timestamp:new Date}]),d(null)}catch(e){console.error("Stop failed:",e)}};return s.jsxs("div",{className:"flex flex-col h-full max-w-4xl mx-auto p-4 gap-4",children:[s.jsx("h1",{className:"text-2xl font-bold",children:t("Agent 交互演示")}),!r&&s.jsxs($,{className:"p-4",children:[s.jsx("h2",{className:"text-lg font-semibold mb-3",children:t("选择 Agent")}),s.jsx("div",{className:"flex gap-2 flex-wrap mb-4",children:c.map(e=>s.jsxs(O,{variant:x===e.type?"default":"outline",disabled:!e.available,onClick:()=>b(e.type),children:[e.name,e.available&&e.version&&` (${e.version})`,!e.available&&t(" (不可用)")]},e.type))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:p,onChange:e=>g(e.target.value),onKeyDown:e=>e.key==="Enter"&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&R(),placeholder:t("输入你的问题或任务..."),className:"flex-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),s.jsx(O,{onClick:R,disabled:y||!x||!p.trim(),children:t(y?"启动中...":"开始")})]})]}),s.jsxs($,{className:"flex-1 p-4 overflow-hidden flex flex-col",children:[s.jsxs("div",{className:"flex justify-between items-center mb-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:t("对话")}),r&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-gray-500",children:t(S?l?"已连接":"连接中...":"未连接")}),s.jsx(O,{variant:"outline",size:"sm",onClick:_,children:t("停止")})]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[m.length===0?s.jsx("div",{className:"text-gray-400 text-center py-8",children:t("选择 Agent 并输入问题开始对话")}):m.map((e,o)=>s.jsxs("div",{className:`p-3 rounded-lg ${e.role==="user"?"bg-blue-100 ml-8":"bg-gray-100 mr-8"}`,children:[s.jsx("div",{className:"text-xs text-gray-500 mb-1",children:e.role==="user"?t("你"):"Agent"}),s.jsx("pre",{className:"whitespace-pre-wrap font-mono text-sm",children:e.content})]},o)),s.jsx("div",{ref:u})]}),r&&s.jsxs("div",{className:"flex gap-2 mt-3 pt-3 border-t",children:[s.jsx("input",{type:"text",value:h,onChange:e=>n(e.target.value),onKeyDown:e=>e.key==="Enter"&&!e.repeat&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&A(),placeholder:t("发送后续消息..."),className:"flex-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),s.jsx(O,{onClick:A,disabled:!h.trim(),children:t("发送")})]})]})]})}export{z as DemoPage};
|
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-BMsh00ht.js";import{S as v}from"./select-BAGWw5mB.js";import{T as O}from"./textarea-Bwf5qeVw.js";import{u as k}from"./use-providers-cM1M1P2G.js";import"./chevron-down-Bqq-PI_B.js";import"./check-ugjfD3Li.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 +1 @@
|
|
|
1
|
-
import{h as t,j as o}from"./index-
|
|
1
|
+
import{h as t,j as o}from"./index-BMsh00ht.js";const r=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],c=t("at-sign",r);const s=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],i=t("globe",s),l=({className:e})=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:e,xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("path",{d:"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1z",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M8 1a7 7 0 0 0 0 14V1z",fill:"currentColor"})]}),h=({className:e})=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:e,xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",opacity:"0.4"}),o.jsx("circle",{cx:"8",cy:"8",r:"3",fill:"currentColor"})]}),x=({className:e})=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:e,xmlns:"http://www.w3.org/2000/svg",children:o.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})}),d=({className:e})=>o.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:e,xmlns:"http://www.w3.org/2000/svg",children:o.jsx("path",{d:"M13.5 4.5L6.5 11.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),w=({className:e})=>o.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:e,xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M5.5 5.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});export{c as A,i as G,h as I,d as a,x as b,w as c,l as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-
|
|
1
|
+
import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-BMsh00ht.js";function p(){const{t:s}=f(),[a,c]=o.useState(null),x=o.useRef(null),d=o.useRef(null),i=o.useRef(null),t=a?u.find(r=>r.id===a):null,l=o.useCallback(()=>{c(null)},[]);return o.useEffect(()=>{if(!t){i.current?.focus(),i.current=null;return}d.current?.focus();const r=n=>{if(n.key==="Escape"){n.preventDefault(),l();return}n.key==="Tab"&&(n.preventDefault(),d.current?.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,l]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("style",{children:h}),e.jsx("header",{className:"border-b border-border px-6 py-4",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Loading Animation Preview"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("10 个首屏加载动画候选 · 颜色遵循 Agent Tower 设计规范 · 点击卡片查看全屏效果")})]})}),e.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",inert:t?!0:void 0,"aria-hidden":t?!0:void 0,children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map((r,n)=>{const m=r.component;return e.jsxs("button",{onClick:g=>{i.current=g.currentTarget,c(r.id)},className:"group relative flex flex-col bg-card border border-border rounded-lg p-5 text-left transition-shadow hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:[e.jsxs("span",{className:"absolute top-3 right-3 text-[11px] font-semibold text-muted-foreground/60 tabular-nums",children:["#",n+1]}),e.jsx("div",{className:"flex items-center justify-center h-28 mb-4",children:e.jsx(m,{})}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:s(r.description)})]},r.id)})}),e.jsxs("div",{className:"mt-10 p-5 border border-border rounded-lg bg-muted/30",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground mb-2",children:s("设计推荐")}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1.5 leading-relaxed",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("首选:Charcoal Breathe (#10)")})," — ",s("品牌感最强,Charcoal 色块+Tower 图标呼吸,用户对产品的第一印象即品牌本身。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选A:Tower Pulse (#1)")})," — ",s("品牌图标直接出现,脉冲节奏稳定,不浮夸,适合工作台场景。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选B:Terminal Cursor (#4)")})," — ",s("终端光标闪烁,贴合 Agent/终端协作的核心场景,开发者亲切感强。")]})]})]})]}),t&&e.jsxs("div",{ref:x,className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:r=>{r.target===r.currentTarget&&l()},role:"dialog","aria-modal":"true","aria-label":s("全屏预览:{name}",{name:t.name}),children:[e.jsx("button",{ref:d,onClick:l,className:"absolute top-4 right-4 p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none","aria-label":s("关闭预览"),children:e.jsx(b,{size:20})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx("div",{className:"scale-[2] origin-center",children:e.jsx(t.component,{})}),e.jsxs("div",{className:"text-center mt-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm",children:s(t.description)})]}),e.jsx("span",{className:"text-xs text-muted-foreground/60 mt-2",children:s("按 Esc 或点击关闭按钮退出")})]})]})]})}export{p as LoadingPreviewPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h 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,B as i}from"./index-
|
|
1
|
+
import{h 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,B as i}from"./index-BMsh00ht.js";import{L as f}from"./loader-circle-ZTtR7VFf.js";import{C as h,T as j}from"./terminal-D9ZyN65O.js";import{C as b}from"./check-ugjfD3Li.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 P(){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(h,{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(j,{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{P as McpSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as n,g as o}from"./index-
|
|
1
|
+
import{r as i,j as n,g as o}from"./index-BMsh00ht.js";function d(r){const t=r.trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);return e.length>=2?`${e[0][0]??""}${e[1][0]??""}`.toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function a(r){const t=r.trim();return/^#([0-9a-f]{3,8})$/i.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)}function l(r){const t=r.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("blob:")}function h(r,t){const e=r?.trim()??"";return!e||a(e)||l(e)?d(t):e.length<=2?e.toUpperCase():e.slice(0,2).toUpperCase()}function p(r){const t=r?.trim()??"";if(!(!t||!a(t)))return{backgroundColor:t,color:"#ffffff"}}function g({name:r,avatar:t,className:e}){const[u,c]=i.useState(null),s=t?.trim()??"",f=!!s&&l(s)&&u!==s,m=i.useMemo(()=>h(s,r),[r,s]);return f?n.jsx("img",{src:s,alt:r,loading:"lazy",onError:()=>c(s),className:o("h-7 w-7 shrink-0 rounded-full border border-neutral-200 bg-white object-cover",e)}):n.jsx("div",{className:o("flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-neutral-200 bg-neutral-100 text-[10px] font-semibold text-neutral-600",e),style:p(s),"aria-label":r,children:m})}export{g as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h 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,T as B,d as L,e as j,U as W,B as z,f as M,Q as A}from"./index-
|
|
1
|
+
import{h 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,T as B,d as L,e as j,U as W,B as z,f as M,Q as A}from"./index-BMsh00ht.js";import{S as Q}from"./select-BAGWw5mB.js";import{I as d}from"./input-BOQDrqKN.js";import{S as K,C as O}from"./switch-DEDPfm5p.js";import{M as _}from"./message-square-8nr39Elw.js";import{L as D}from"./loader-circle-ZTtR7VFf.js";import{C as H}from"./circle-alert-BA6H1Efg.js";import"./chevron-down-Bqq-PI_B.js";import"./check-ugjfD3Li.js";const G=[["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"}]],J=P("link",G);function V(){return q({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function X(){const t=E();return k({mutationFn:i=>h.put("/notifications/settings",i),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function Y(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function le(){const{t}=R(),{data:i,isLoading:T}=V(),l=X(),n=Y(),y=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[a,p]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,x]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{i&&!m&&p({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]),T)return e.jsx(g,{children:e.jsx(B,{rows:3})});const N=i?.osNotificationEnabled??!0,b=i?.thirdPartyChannel??"none",c=(s,I)=>{p(F=>({...F,[s]:I})),x(!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:()=>x(!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(L,{title:t("通知设置"),className:"mb-1"}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:W,label:t("桌面通知"),description:t("任务完成时弹出系统通知"),align:"center",controlWidth:"auto",children:e.jsx(K,{checked:N,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:_,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(Q,{value:b,onChange:s=>C(s),options:y})}),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(z,{size:"sm",variant:"outline",onClick:w,disabled:!a.webhookUrl.trim()||n.isPending,className:"h-auto shrink-0",children:[n.isPending&&e.jsx(D,{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(O,{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(J,{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(M,{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(A,{saving:l.isPending,onSave:U})]})}export{le as NotificationSettingsPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
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,g as P}from"./index-
|
|
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,g as P}from"./index-BMsh00ht.js";import{u as U,a as _,b as z,c as B}from"./use-profiles-CXwrOP0r.js";import{M as F}from"./modal-Ct5Hq4HV.js";import{C as G}from"./confirm-dialog-xFGalfma.js";import{I as $}from"./input-BOQDrqKN.js";import{T as R}from"./textarea-Bwf5qeVw.js";import{L as H}from"./layers-CHCOcaOD.js";import{C as q}from"./chevron-down-Bqq-PI_B.js";import{P as K,T as Q}from"./trash-2-CAJaQyy-.js";import{P as W}from"./pencil-CHhoqtja.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
2
|
|
|
3
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 +1 @@
|
|
|
1
|
-
.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility,.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}
|
|
1
|
+
.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;inset:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility,.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.terminal-xterm-host{--scrollbar-current-size: var(--scrollbar-thin-size)}.terminal-xterm-host .xterm{width:100%;height:100%;min-width:0;min-height:0}.terminal-xterm-host .xterm-viewport{background-color:transparent;scrollbar-color:var(--scrollbar-thumb) var(--scrollbar-track);scrollbar-width:thin}.terminal-xterm-host .xterm-viewport::-webkit-scrollbar{width:var(--scrollbar-current-size);height:var(--scrollbar-current-size)}.terminal-xterm-host .xterm-viewport::-webkit-scrollbar-track,.terminal-xterm-host .xterm-viewport::-webkit-scrollbar-corner{background:var(--scrollbar-track)}.terminal-xterm-host .xterm-viewport::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:var(--scrollbar-radius)}.terminal-xterm-host .xterm-viewport::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover)}
|