agent-tower 0.7.2-beta.8 → 0.7.2
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/utils/database-runtime.test.js +82 -5
- package/dist/utils/database-runtime.test.js.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +29 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-CtCYXopw.js → AgentDemoPage-BfXkNCdN.js} +1 -1
- package/dist/web/assets/{AgentEnvironmentSettingsPage-DSWN546Y.js → AgentEnvironmentSettingsPage-GHjKIWpb.js} +1 -1
- package/dist/web/assets/AttachmentPreview-CLN1lnLe.js +2 -0
- package/dist/web/assets/{BranchSelect-Dxs7HnMM.js → BranchSelect-Cofp8vYf.js} +1 -1
- package/dist/web/assets/{BrandLogo-Ilm880Xs.js → BrandLogo-BUimEX-9.js} +1 -1
- package/dist/web/assets/{ConversationPage-B55Bj_ft.js → ConversationPage-R7vNaOQv.js} +1 -1
- package/dist/web/assets/{CreateTaskInput-CxWPeToI.js → CreateTaskInput-CasITF8y.js} +1 -1
- package/dist/web/assets/{DemoPage-Dyn-U9JO.js → DemoPage-DK-ikg1_.js} +1 -1
- package/dist/web/assets/{DesignSystemPage-BxypsRUZ.js → DesignSystemPage-BhjNs2vP.js} +1 -1
- package/dist/web/assets/EditableTaskTitle-BJ9Rxggf.js +70 -0
- package/dist/web/assets/{ExecutionPermissionSelector-CQ_GNxR0.js → ExecutionPermissionSelector-B8befbxJ.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-CzoejPZP.js → GeneralSettingsPage-RMN2al8I.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-BlW2PJhI.js → LoadingPreviewPage-BDlf89rJ.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-DD7EqD4L.js → McpSettingsPage-CPNxFF67.js} +1 -1
- package/dist/web/assets/{MemberAvatar-B2pAdWUi.js → MemberAvatar-YVr_erAr.js} +1 -1
- package/dist/web/assets/{MobileTaskDetail-CvmNW0BQ.js → MobileTaskDetail-QNUHMq7u.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-BIqldIRf.js → NotificationSettingsPage-BEyuyu3Z.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-DMxpHmF1.js → ProfileSettingsPage-CHe4LlRp.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-CHW79td4.js → ProjectKanbanPage-Bt_01giW.js} +7 -7
- package/dist/web/assets/{ProjectSettingsPage-DKiEUkoa.js → ProjectSettingsPage-cus6Ns97.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-DZT7wyE2.js → ProviderSettingsPage-DqA_B1Ey.js} +1 -1
- package/dist/web/assets/{SettingsMasterDetail-DnF0lsV1.js → SettingsMasterDetail-DjWR9Sqk.js} +1 -1
- package/dist/web/assets/{TaskDetail-D_970BDY.js → TaskDetail-rEXNe2h3.js} +1 -1
- package/dist/web/assets/{TeamSettingsPage-BJIEZ7xL.js → TeamSettingsPage-DwWROtW6.js} +1 -1
- package/dist/web/assets/{TranslationSettingsPage-D3mazqEW.js → TranslationSettingsPage-Cod9c4Ug.js} +1 -1
- package/dist/web/assets/{arc-hUh7ykl8.js → arc-DEy33vTc.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-CcV9CLkm.js → architectureDiagram-3BPJPVTR-Ky1D1LBk.js} +1 -1
- package/dist/web/assets/{at-sign-B-nhoGyH.js → at-sign-C48_y345.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-5q3Y9y0e.js → blockDiagram-GPEHLZMM-BNgB7kNT.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-CorBXi06.js → c4Diagram-AAUBKEIU-4GMrPMgQ.js} +1 -1
- package/dist/web/assets/channel-DTP-syjA.js +1 -0
- package/dist/web/assets/check-BmiJ7qMY.js +1 -0
- package/dist/web/assets/{chevron-down-CPnvItQw.js → chevron-down-3y5Aiolp.js} +1 -1
- package/dist/web/assets/{chevron-up-B8PE5N0G.js → chevron-up-DqaYcjpq.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-BUf5B4z4.js → chunk-2J33WTMH-C439hRe_.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-CdnOHkro.js → chunk-4BX2VUAB-D8GK3M3t.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-U7edZDpP.js → chunk-55IACEB6-Dl4UhJ8X.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-B64Tuhla.js → chunk-727SXJPM-BSEeayBq.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-dXfe56jB.js → chunk-AQP2D5EJ-B6chbZfT.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-DDYbxc1Q.js → chunk-FMBD7UC4-DaLkiLdQ.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-BQDGMv0R.js → chunk-ND2GUHAM-DeQwZAAT.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-DB8q4xAj.js → chunk-QZHKN3VN-CLRr4YRM.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-CUKgurLa.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CUKgurLa.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-BSdICyOa.js → code-block-OCS4YCEC-CnoxUpOx.js} +1 -1
- package/dist/web/assets/{confirm-dialog-DxEBZEbV.js → confirm-dialog-ltNBFYCs.js} +1 -1
- package/dist/web/assets/{content-CMUL3HGx.js → content-DPQMfMae.js} +1 -1
- package/dist/web/assets/{copy-DyxlXxiU.js → copy-HRMhTkIG.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-Dx6eMnll.js → cose-bilkent-S5V4N54A-C1UiYzfk.js} +1 -1
- package/dist/web/assets/{cssMode-ZnNWfjZ6.js → cssMode-DkuSsGeg.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-Cxe8pLgD.js → dagre-BM42HDAG-CTJpBgye.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-RMsswEBe.js → diagram-2AECGRRQ-Dj1_TEYp.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-Bi4E0hzx.js → diagram-5GNKFQAL-V-KUpwqh.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-Mv6CDCyn.js → diagram-KO2AKTUF-CXG1ZIeX.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-CJ3qKNzK.js → diagram-LMA3HP47-BZSJUwk9.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-D8SBY4ft.js → diagram-OG6HWLK6-CCr4gq4u.js} +1 -1
- package/dist/web/assets/{dialog-BYdeYC2Y.js → dialog-CuFEdqLg.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-DwVSCU6X.js → erDiagram-TEJ5UH35-Djtyzh6z.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-CyipYAWd.js → flowDiagram-I6XJVG4X-BmSVSiXJ.js} +1 -1
- package/dist/web/assets/{freemarker2-DbH_yMCO.js → freemarker2-DdptX5f1.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-CsC6Wjt4.js → ganttDiagram-6RSMTGT7-r5vQX-b5.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-E5jNbqlq.js → gitGraphDiagram-PVQCEYII-Zj9aloh9.js} +1 -1
- package/dist/web/assets/{globe-B2rgTPH3.js → globe-B9I-jHBB.js} +1 -1
- package/dist/web/assets/{handlebars-C5VY_S-z.js → handlebars-B34f-LAf.js} +1 -1
- package/dist/web/assets/{hooks-Ct0srfV-.js → hooks-BLxb16IA.js} +1 -1
- package/dist/web/assets/{html-e5uLnAgN.js → html-CnvOQ63o.js} +1 -1
- package/dist/web/assets/{htmlMode-BeNiGozX.js → htmlMode-RdxZ8Svp.js} +1 -1
- package/dist/web/assets/{icon-button-BEMJj_6T.js → icon-button-CYiKa-7C.js} +1 -1
- package/dist/web/assets/{index-DNdMmXBr.js → index-B1oVmCie.js} +1 -1
- package/dist/web/assets/index-BJObbxud.js +122 -0
- package/dist/web/assets/{index-CAjqC8pT.js → index-Bhvt-E6d.js} +1 -1
- package/dist/web/assets/{index-CPGzLjEC.js → index-BtUQYU5l.js} +1 -1
- package/dist/web/assets/{index-IMdA08Ok.js → index-CThFsQNP.js} +1 -1
- package/dist/web/assets/{index-BYPOXP6w.js → index-DZLnTISJ.js} +1 -1
- package/dist/web/assets/{index-kr6U6_pi.js → index-DcOU2m2F.js} +1 -1
- package/dist/web/assets/{index-DppwrK2G.js → index-Dk3bRQAK.js} +1 -1
- package/dist/web/assets/{index-C-M0QDqc.js → index-DkRy6eNX.js} +4 -4
- package/dist/web/assets/{infoDiagram-5YYISTIA-5_0wrRXl.js → infoDiagram-5YYISTIA-BHtVaxZx.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-aQujIFZw.js → ishikawaDiagram-YF4QCWOH-BYmwjkbC.js} +1 -1
- package/dist/web/assets/javascript-BhombDEO.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-ClMzHdqI.js → journeyDiagram-JHISSGLW-c8BBqqRS.js} +1 -1
- package/dist/web/assets/{jsonMode-nHmLVf-n.js → jsonMode-BJGOUeaV.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-BFVlt0tz.js → kanban-definition-UN3LZRKU-D4Vr-oFT.js} +1 -1
- package/dist/web/assets/{kbd-Bfq5K6Ux.js → kbd-C88ut3t9.js} +1 -1
- package/dist/web/assets/{key-round-BqsaQdce.js → key-round-Cjbj2qNa.js} +1 -1
- package/dist/web/assets/{layers-DI4vFJ4F.js → layers-eaHAVcc3.js} +1 -1
- package/dist/web/assets/{linear-DZ-6PAPS.js → linear-opi90s0L.js} +1 -1
- package/dist/web/assets/{link-BU4PN723.js → link-BSGb85gq.js} +1 -1
- package/dist/web/assets/{liquid-BPIyogoj.js → liquid-Czy1WpPz.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DH4Z8jiM.js → lspLanguageFeatures-DWu2Ubf0.js} +1 -1
- package/dist/web/assets/{mdx-CI8yO2pV.js → mdx-DhXfoSnM.js} +1 -1
- package/dist/web/assets/{menu-C3uB3M7p.js → menu--sjyisSg.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-BqeX1osS.js → mermaid-NOHMQCX5-BSNbBj78.js} +35 -35
- package/dist/web/assets/{message-square-E5K8E3A-.js → message-square-BLEJN6p7.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-C7dea0db.js → mindmap-definition-RKZ34NQL-BN3ZjBh-.js} +1 -1
- package/dist/web/assets/{modal-Cz1iIVeD.js → modal-CSGOqphK.js} +1 -1
- package/dist/web/assets/{monaco-DM3DuGN5.js → monaco-BkuNyOkP.js} +3 -3
- package/dist/web/assets/{paperclip-COXNce_v.js → paperclip-CTNoXpUW.js} +1 -1
- package/dist/web/assets/{pencil-BFc4n44f.js → pencil-Cp70ZwtG.js} +1 -1
- package/dist/web/assets/{people-BaCetIqh.js → people-DT78SebR.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-2q5medug.js → pieDiagram-4H26LBE5-CfmFHpPI.js} +1 -1
- package/dist/web/assets/{popover-CJCQLoGu.js → popover-BiVxGGgp.js} +1 -1
- package/dist/web/assets/{python-CSxVPG9p.js → python-DIcQDjcf.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DHPEM56s.js → quadrantDiagram-W4KKPZXB-CeaumJAa.js} +1 -1
- package/dist/web/assets/{razor-CVoIieeS.js → razor-DYK6Rxer.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-B_KyH7PP.js → requirementDiagram-4Y6WPE33-BWWCDXCE.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-CrqkZAYW.js → sankeyDiagram-5OEKKPKP-DAJut743.js} +1 -1
- package/dist/web/assets/{search-CkiBPir_.js → search-DniD_AGC.js} +1 -1
- package/dist/web/assets/{search-field-CbM2P2KE.js → search-field-CQLDXLeA.js} +1 -1
- package/dist/web/assets/{select-DJsEG0jq.js → select-B5RYunTs.js} +1 -1
- package/dist/web/assets/{select-Br0TAs7A.js → select-BPdJrr5M.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-BRTm1WQA.js → sequenceDiagram-3UESZ5HK-CynjRGW4.js} +1 -1
- package/dist/web/assets/{server-DYeSE1wn.js → server-xswxWpKD.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-qN49iyR2.js → stateDiagram-AJRCARHV-amAtpx9w.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-V-lSceg1.js +1 -0
- package/dist/web/assets/{textarea-B7vtoRE3.js → textarea-BVyPl9rM.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-BzarcDi3.js → timeline-definition-PNZ67QCA-DZ9W7WlP.js} +1 -1
- package/dist/web/assets/{toggles-jo27o0AH.js → toggles-QcIz43DP.js} +1 -1
- package/dist/web/assets/{tooltip-DbVtCXcO.js → tooltip-CPqGK_WZ.js} +1 -1
- package/dist/web/assets/{track-C0vxnITw.js → track-Ckye0-tt.js} +1 -1
- package/dist/web/assets/{trash-2-CUM-XX8B.js → trash-2-CvUJsbtT.js} +1 -1
- package/dist/web/assets/{tsMode-7D3gqep6.js → tsMode-c5x0d47n.js} +1 -1
- package/dist/web/assets/{typescript-CbOVEQNg.js → typescript-i7eYblLt.js} +1 -1
- package/dist/web/assets/{upload-CJ6jVmte.js → upload-CsXAmAun.js} +1 -1
- package/dist/web/assets/{use-profiles-B0xXAf7Z.js → use-profiles-DuXaBRju.js} +1 -1
- package/dist/web/assets/{use-projects-BlTwWxkY.js → use-projects-Ddz0knyr.js} +1 -1
- package/dist/web/assets/{use-providers-FMSfyTD1.js → use-providers-Td1-gyrN.js} +1 -1
- package/dist/web/assets/use-translation-settings-NYM0lmBx.js +1 -0
- package/dist/web/assets/{use-workspaces-DYrEp0Lw.js → use-workspaces-CdJZLmGh.js} +1 -1
- package/dist/web/assets/{useNormalizedLogs-D0N8MJdH.js → useNormalizedLogs--RbVywYa.js} +1 -1
- package/dist/web/assets/{useTokenUsage-WB3ZQ25v.js → useTokenUsage-DDXf7E4p.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-B6oZetvf.js → vennDiagram-CIIHVFJN-CB2Ubvy9.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-Bzuhm76f.js → wardley-L42UT6IY-BXOkk77I.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-DaC-FUf5.js → wardleyDiagram-YWT4CUSO-VA6ywdQQ.js} +1 -1
- package/dist/web/assets/{xml-Cfa9tkdT.js → xml-D2EGActB.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-CCvRIJRL.js → xychartDiagram-2RQKCTM6-FNcvDj5G.js} +1 -1
- package/dist/web/assets/{yaml-C86f7VLL.js → yaml-jeiIZSL4.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/AttachmentPreview-DRG5_cfN.js +0 -2
- package/dist/web/assets/EditableTaskTitle-Dh-SmvFW.js +0 -70
- package/dist/web/assets/channel-By24WpLg.js +0 -1
- package/dist/web/assets/check-DqPSoX0r.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-DxHoimtR.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-DxHoimtR.js +0 -1
- package/dist/web/assets/index-Cm6snkmR.js +0 -122
- package/dist/web/assets/javascript-D7QVj9jR.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-B1clBPkJ.js +0 -1
- package/dist/web/assets/use-translation-settings-BOlszecX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ze,s as gt,u as bt,A as vt,T as Fe}from"./AttachmentPreview-DRG5_cfN.js";import{c as ne,q as he,p as je,aI as Je,s as T,t as yt,az as Nt,v as ge,o as et,r as a,ac as wt,ad as de,an as We,u as Ce,bi as tt,j as e,n as g,bj as jt,aK as Ct,T as kt,U as St,Q as we,aO as Ue,X as Et,aC as Mt,a_ as ye,aq as E,bk as He,av as It,a0 as Qe,O as Tt,aA as Rt,bl as Ot,bm as At}from"./index-Cm6snkmR.js";import{d as Lt}from"./use-projects-BlTwWxkY.js";import{M as Be}from"./MemberAvatar-B2pAdWUi.js";import{t as Ve}from"./tooltip-DbVtCXcO.js";import{a as Pt}from"./BrandLogo-Ilm880Xs.js";import{u as _t}from"./use-providers-FMSfyTD1.js";import{C as se}from"./check-DqPSoX0r.js";import{P as Dt}from"./trash-2-CUM-XX8B.js";import{C as xe}from"./chevron-down-CPnvItQw.js";import{l as zt}from"./ExecutionPermissionSelector-CQ_GNxR0.js";import{M as $t}from"./index-CPGzLjEC.js";import{P as Gt}from"./paperclip-COXNce_v.js";import{F as qt}from"./hooks-Ct0srfV-.js";const Kt=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Ft=ne("chevrons-down",Kt);const Wt=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ut=ne("chevrons-up",Wt);const Ht=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],Qt=ne("shield-off",Ht);const Bt=[["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"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Vt=ne("shield-question-mark",Bt);const Yt=[["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"}]],Xt=ne("shield",Yt);const Zt=[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]],Jt=ne("signal-high",Zt);const es=[["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"}]],ts=ne("zap",es);function ss(t){const s=he(),r=et({queryKey:T.sessions.runtime(t),queryFn:()=>ge.get(`/sessions/${t}/runtime`),enabled:!!t});return a.useEffect(()=>{if(!t)return;const i=wt.connect(),d=p=>{p.sessionId===t&&s.invalidateQueries({queryKey:T.sessions.runtime(t)})},l=p=>{p.sessionId===t&&s.setQueryData(T.sessions.runtime(t),p.state)},u=()=>{s.invalidateQueries({queryKey:T.sessions.runtime(t)})};return i.on(de.SESSION_PERMISSION_REQUESTED,d),i.on(de.SESSION_PERMISSION_INVALIDATED,d),i.on(de.SESSION_RUNTIME_STATE_CHANGED,l),i.on("connect",u),()=>{i.off(de.SESSION_PERMISSION_REQUESTED,d),i.off(de.SESSION_PERMISSION_INVALIDATED,d),i.off(de.SESSION_RUNTIME_STATE_CHANGED,l),i.off("connect",u)}},[t,s]),r}function ns(t){return t==="RUNNING"||t==="AWAITING_PERMISSION"||t==="CANCELLING"}function os(t){return t===We.RUNNING||t===We.PENDING}function Ws(t,s){const{data:r}=ss(t);return{runtimeState:r,isActive:os(s)||ns(r?.turnState),isCancelling:r?.turnState==="CANCELLING"}}function Us(){const t=he();return je({mutationFn:({sessionId:s,requestId:r,optionId:i})=>ge.post(`/sessions/${s}/permissions/${r}/resolve`,{optionId:i}),onSettled:(s,r,i)=>{t.invalidateQueries({queryKey:T.sessions.runtime(i.sessionId)})}})}function Hs(){const t=he();return je({mutationFn:s=>Ze(`start:${s}`,{},r=>ge.post(`/sessions/${s}/start`,r)),onSuccess:(s,r)=>{"operationId"in s&&Je(t,s.delivery),t.invalidateQueries({queryKey:T.sessions.detail(r)}),t.invalidateQueries({queryKey:T.tasks.all})}})}const rs=45e3;function Qs(){const t=he();return je({mutationFn:async s=>{try{return await ge.post(`/sessions/${s}/stop`,void 0,{signal:AbortSignal.timeout(rs)})}catch(r){throw r instanceof DOMException&&r.name==="TimeoutError"?new Error("Stop request timed out before the server answered. The session may still be stopping; refresh the status and retry."):r}},onError:s=>{yt.error(Nt("Failed to stop session. Refreshing status; check it and try again."),{description:s instanceof Error?s.message:void 0})},onSettled:(s,r,i)=>{t.setQueryData(T.sessions.runtime(i),d=>d?.turnState==="CANCELLING"?{...d,turnState:"IDLE"}:d),Promise.allSettled([t.invalidateQueries({queryKey:T.sessions.detail(i)}),t.invalidateQueries({queryKey:T.sessions.runtime(i)}),t.invalidateQueries({queryKey:T.workspaces.all}),t.invalidateQueries({queryKey:T.tasks.all})])}})}function Bs(){const t=he();return je({mutationFn:({id:s,...r})=>Ze(`message:${s}`,r,i=>gt(t,s,`/sessions/${s}/message`,i)),onSuccess:s=>{"operationId"in s&&Je(t,s.delivery),t.invalidateQueries({queryKey:T.workspaces.all}),t.invalidateQueries({queryKey:T.tasks.all})}})}function Ye({iconName:t,className:s}){switch(t){case"chevrons-up":return e.jsx(Ut,{className:s,"aria-hidden":"true"});case"signal-high":return e.jsx(Jt,{className:s,"aria-hidden":"true"});case"chevrons-down":return e.jsx(Ft,{className:s,"aria-hidden":"true"});default:return e.jsx($t,{className:s,"aria-hidden":"true"})}}function Vs({priority:t,className:s}){const r=tt(t);return e.jsx("span",{className:g("inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] font-semibold leading-none",r.className,s),title:`${r.code} · ${r.label}`,children:r.code})}function as({value:t,onChange:s,disabled:r=!1,compact:i=!1}){const{t:d}=Ce(),[l,u]=a.useState(!1),p=a.useRef(null),m=tt(t);return a.useEffect(()=>{if(!l)return;const f=j=>{p.current&&!p.current.contains(j.target)&&u(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),e.jsxs("div",{className:"relative",ref:p,children:[e.jsxs("button",{type:"button",disabled:r||!s,onClick:()=>u(f=>!f),"aria-haspopup":"listbox","aria-expanded":l,"aria-label":d("Task priority"),className:g("inline-flex items-center gap-1.5 rounded-md text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-50",i?"px-1.5 py-1":"px-2 py-1.5",m.className),children:[e.jsx(Ye,{iconName:m.iconName,className:"size-3.5"}),e.jsx("span",{children:d(m.label)}),s?e.jsx(xe,{className:g("size-3 transition-transform",l&&"rotate-180"),"aria-hidden":"true"}):null]}),l&&e.jsx("div",{className:"absolute right-0 top-full z-50 mt-1.5 w-36 rounded-lg border border-border bg-popover p-1 shadow-popover",role:"listbox","aria-label":d("Task priority"),children:jt.map(f=>{const j=f.value===m.value;return e.jsxs("button",{type:"button",role:"option","aria-selected":j,onClick:()=>{s?.(f.value),u(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-xs text-foreground/80 transition-colors hover:bg-accent",children:[e.jsx("span",{className:g("inline-flex size-5 items-center justify-center rounded",f.className),children:e.jsx(Ye,{iconName:f.iconName,className:"size-3.5"})}),e.jsxs("span",{className:"flex-1",children:[f.code," · ",d(f.label)]}),j?e.jsx(se,{className:"size-3.5 text-foreground","aria-hidden":"true"}):null]},f.value)})})]})}function Xe(t,s,r,i){if(r.filter(u=>u===i).length<=1)return t;const l=r.slice(0,s+1).filter(u=>u===i).length;return`${t} #${l}`}function is(t){return Object.values(t).filter(Boolean).length}function cs({mode:t,setMode:s,selectedTemplateId:r,setSelectedTemplateId:i,selectedMemberPresetIds:d,setSelectedMemberPresetIds:l,disabled:u=!1,compact:p=!1}){const{t:m}=Ce(),{preserveDesktopSearch:f}=Ct(),[j,y]=a.useState(!1),{data:N}=_t(),{data:c,isError:x,isFetching:_,isLoading:h,refetch:L}=kt(),{data:R,isError:C,isFetching:D,isLoading:Z,refetch:P}=St(),oe=a.useMemo(()=>new Map((N??[]).map(({provider:o,availability:b})=>[o.id,o.name+(b.type==="NOT_FOUND"?m(" (不可用)"):"")])),[N,m]),O=a.useMemo(()=>new Map((c??[]).map(o=>[o.id,o])),[c]),G=a.useMemo(()=>new Map((R??[]).map(o=>[o.id,o])),[R]),U=a.useMemo(()=>d.map(o=>O.get(o)).filter(o=>!!o),[O,d]);a.useEffect(()=>{c!==void 0&&l(o=>{const b=o.filter(M=>O.has(M));return b.length===o.length&&b.every((M,$)=>M===o[$])?o:b})},[c,O,l]),a.useEffect(()=>{R!==void 0&&i(o=>!o||G.has(o)?o:null)},[i,G,R]);const re=o=>{u||i(b=>b===o?null:o)},le=o=>{u||l(b=>[...b,o])},H=o=>{u||l(b=>b.filter((M,$)=>$!==o))},J=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:m("团队模板")}),C?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive-ink",children:[e.jsx("span",{children:m("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{P()},disabled:u||D,className:"ml-2 underline hover:no-underline",children:m("重试")})]}):Z?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(we,{size:12,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),m("加载中...")]}):(R??[]).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:[m("当前没有团队模板"),e.jsx(Ue,{to:f("/settings/team"),className:Ve("ml-1.5"),children:m("去创建")})]}):e.jsx("div",{className:g("space-y-1.5",p&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(R??[]).map(o=>{const b=o.id===r,M=o.members?.length??0,$=o.members?.map(B=>B.memberPresetId)??[],Q=o.members?.slice(0,3).map((B,ie)=>Xe(B.memberPreset?.name??B.memberPresetId,ie,$,B.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>re(o.id),disabled:u,className:g("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",b?"bg-background border-foreground/20 shadow-raised":"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:g("text-xs truncate",b?"font-medium text-foreground":"text-foreground"),children:o.name}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[M,m("人")]})]}),Q&&e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:Q})]}),b&&e.jsx(se,{size:13,className:"shrink-0 text-foreground"})]})},o.id)})})]}),q=U.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:U.map((o,b)=>{const M=Xe(o.name,b,d,o.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-xs text-foreground",children:[e.jsx(Be,{name:o.name,avatar:o.avatar,size:"xs",className:"size-3.5"}),e.jsx("span",{className:"max-w-[80px] truncate",children:M}),e.jsx("button",{type:"button",onClick:()=>H(b),disabled:u,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Et,{size:9})})]},`${o.id}-${b}`)})}),ae=x?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive-ink",children:[e.jsx("span",{children:m("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{L()},disabled:u||_,className:"ml-2 underline hover:no-underline",children:m("重试")})]}):h?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(we,{size:12,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),m("加载中...")]}):(c??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[m("当前没有成员预设"),e.jsx(Ue,{to:f("/settings/team"),className:Ve("ml-1.5"),children:m("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(c??[]).map(o=>{const b=d.filter(Q=>Q===o.id).length,M=oe.get(o.providerId)??o.providerId,$=is(o.capabilities);return e.jsxs("button",{type:"button",onClick:()=>le(o.id),disabled:u,className:g("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(Be,{name:o.name,avatar:o.avatar,className:"h-6 w-6 text-[10px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:o.name}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[M," · ",$,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[b>0&&e.jsxs("span",{className:"text-[11px] text-foreground font-semibold",children:["×",b]}),e.jsx(Dt,{size:12,className:"text-muted-foreground"})]})]},o.id)})}),K=U.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[11px] font-semibold text-primary-foreground px-1.5",children:U.length}),me=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:m("执行模式")}),e.jsx(Pt,{size:"sm","aria-label":m("执行模式"),value:t,onValueChange:o=>s(o),options:[{value:"AUTO",label:m("自动模式"),icon:e.jsx(ts,{}),disabled:u},{value:"CONFIRM",label:m("确认模式"),icon:e.jsx(Xt,{}),disabled:u}]})]});return p?e.jsxs("div",{className:"space-y-3",children:[me,J,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!u&&y(o=>!o),disabled:u,"aria-expanded":j,className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(xe,{size:12,className:g("transition-transform",j?"":"-rotate-90")}),m("追加独立成员"),K]}),j&&e.jsxs("div",{className:"mt-2",children:[q,ae]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[me,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[J,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-xs font-medium text-muted-foreground",children:m("追加成员")}),K]}),q,ae]})]})]})}function ds({commands:t,selectedIndex:s,query:r,hasCatalog:i,title:d="Slash Commands",queryPrefix:l="/",emptyCatalogMessage:u="No slash commands catalog for this agent yet.",emptyQueryMessage:p,insertionHint:m="Enter / Tab to insert",compact:f=!1,onSelect:j}){const y=f?"px-1.5 pb-1.5":"px-2 pb-2",N=f?"px-2 py-1.5":"px-2.5 py-2",c=f?"max-h-36":"max-h-48";return e.jsxs("div",{className:f?"pt-1.5":"pt-2",children:[e.jsxs("div",{className:`mb-1 flex items-center justify-between ${f?"px-2 pt-0.5":"px-3 pt-1"}`,children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e.jsx("span",{className:"text-xs text-muted-foreground",children:m})]}),t.length===0?e.jsx("div",{className:`${f?"px-2 pb-2 pt-1.5 text-xs":"px-3 pb-3 pt-2 text-xs"} text-muted-foreground`,children:i?p??`No matches for ${l}${r}`:u}):e.jsx("div",{className:`${y} ${c} overflow-y-auto`,children:t.map((x,_)=>e.jsxs("button",{type:"button",onMouseDown:h=>h.preventDefault(),onClick:()=>j(x),className:`w-full rounded-lg border text-left transition-colors ${_===s?"border-border bg-muted/50":"border-transparent hover:border-border hover:bg-accent"} ${N}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-mono text-[13px] text-foreground",children:x.command}),x.kind&&x.kind!=="builtin"?e.jsx("span",{className:"rounded-full border border-border px-1.5 py-0.5 text-[10px] uppercase tracking-[0.12em] text-muted-foreground",children:x.scope?`${x.scope} ${x.kind}`:x.kind}):null]}),e.jsx("div",{className:`${f?"mt-0.5 text-xs":"mt-1 text-xs"} text-muted-foreground`,children:x.description})]},x.command))})]})}const X=12,Ne=8;function ls({open:t,anchorRef:s,commands:r,selectedIndex:i,query:d,hasCatalog:l,title:u,queryPrefix:p,emptyCatalogMessage:m,emptyQueryMessage:f,insertionHint:j,compact:y=!1,onSelect:N}){const c=a.useRef(null),[x,_]=a.useState(null);return a.useLayoutEffect(()=>{if(!t){_(null);return}const h=s.current;if(!h)return;let L=0;const R=()=>{const Z=s.current;if(!Z)return;const P=Z.getBoundingClientRect(),oe=window.innerWidth,O=window.innerHeight,G=y?260:320,U=y?oe-X*2:560,re=Math.min(Math.max(P.width,G),Math.max(G,U)),le=Math.min(Math.max(X,P.left),Math.max(X,oe-X-re)),H=O-P.bottom-Ne-X,J=P.top-Ne-X,q=c.current?.offsetHeight??(y?220:280),ae=y?240:320,K=H<180&&J>H,o=Math.max(120,Math.min(ae,K?J:H)),b=K?Math.max(X,P.top-Ne-Math.min(q,o)):Math.min(O-X-Math.min(q,o),P.bottom+Ne);_({top:b,left:le,width:re,maxHeight:o})},C=()=>{cancelAnimationFrame(L),L=requestAnimationFrame(R)};C();const D=new ResizeObserver(C);return D.observe(h),c.current&&D.observe(c.current),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),window.visualViewport?.addEventListener("resize",C),window.visualViewport?.addEventListener("scroll",C),()=>{cancelAnimationFrame(L),D.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),window.visualViewport?.removeEventListener("resize",C),window.visualViewport?.removeEventListener("scroll",C)}},[s,r.length,y,t,d,i]),!t||!x||typeof document>"u"?null:Mt.createPortal(e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[120]",children:e.jsx("div",{ref:c,className:"pointer-events-auto fixed overflow-hidden rounded-xl border border-border bg-background shadow-popover ",style:{top:x.top,left:x.left,width:x.width,maxHeight:x.maxHeight},children:e.jsx(ds,{commands:r,selectedIndex:i,query:d,hasCatalog:l,title:u,queryPrefix:p,emptyCatalogMessage:m,emptyQueryMessage:f,insertionHint:j,compact:y,onSelect:N})})}),document.body)}function ms({agentType:t,workingDir:s}){return et({queryKey:T.system.slashCommandCatalog(t,s),queryFn:async()=>(await ge.get("/system/slash-command-catalog",{params:{agentType:String(t),...s?{workingDir:s}:{}}})).commands,enabled:!!t,staleTime:3e4})}function us(t,s){const r=new Set,i=[];for(const d of[...t,...s]){const l=d.command.trim().toLowerCase();!l||r.has(l)||(r.add(l),i.push(d.kind?d:{...d,kind:"builtin"}))}return i}function ke(t){return t.trim().toLowerCase().replace(/^[/$]/,"")}function ps(t){return ke(t.command)}function fs(t,s){if(!s)return 1e3;const r=ps(t),i=t.aliases?.map(ke)??[],d=[r,...i];let l=0;for(const p of d)p===s?l=Math.max(l,500):p.startsWith(s)?l=Math.max(l,400-(p.length-s.length)):p.includes(s)&&(l=Math.max(l,250-p.indexOf(s)));return l>0?l:`${r} ${i.join(" ")} ${t.description}`.toLowerCase().includes(s)?100:0}function Ys(t){const s=/(^|[\s])\$([^\s]*)$/.exec(t);if(!s||s.index===void 0)return null;const r=s.index+s[1].length;return{query:ke(s[2]),replaceStart:r}}function xs(t,s){const r=ke(s);return r?t.map((i,d)=>({command:i,index:d,score:fs(i,r)})).filter(i=>i.score>0).sort((i,d)=>d.score-i.score||i.index-d.index||i.command.command.localeCompare(d.command.command)).map(i=>i.command):t.slice()}const hs=[{command:"/permissions",description:"Manage what Codex can do without approval"},{command:"/sandbox-add-read-dir",description:"Grant read access to another directory"},{command:"/agent",description:"Switch between built-in agent personas"},{command:"/apps",description:"Manage connected apps"},{command:"/clear",description:"Start a fresh conversation"},{command:"/compact",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last assistant message to your clipboard"},{command:"/diff",description:"Show the current git diff"},{command:"/experimental",description:"Toggle experimental features"},{command:"/feedback",description:"Share feedback on Codex CLI"},{command:"/init",description:"Create or update AGENTS.md for the repo"},{command:"/logout",description:"Sign out of Codex"},{command:"/mcp",description:"Manage MCP servers"},{command:"/mention",description:"Add files or directories to the conversation context"},{command:"/model",description:"Change the active model"},{command:"/fast",description:"Toggle low reasoning mode"},{command:"/plan",description:"Toggle plan mode for code changes"},{command:"/personality",description:"Select how Codex communicates"},{command:"/ps",description:"List running background tasks"},{command:"/fork",description:"Fork the current conversation state"},{command:"/resume",description:"Resume a previous conversation"},{command:"/new",description:"Open a conversation picker to start or resume"},{command:"/quit",description:"Exit Codex CLI",aliases:["exit"]},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show session and configuration status"},{command:"/debug-config",description:"Inspect the effective configuration"},{command:"/statusline",description:"Configure the custom status line"},{command:"/skills",description:"Browse available skills and insert a $skill mention"}],gs=[{command:"/clear",description:"Clear the conversation history"},{command:"/compact",description:"Compact the conversation context",aliases:["compact focus"]},{command:"/config",description:"Open the configuration panel"},{command:"/cost",description:"Show token usage and cost"},{command:"/doctor",description:"Check Claude Code installation health"},{command:"/help",description:"Show help and available commands"},{command:"/init",description:"Initialize project instructions"},{command:"/login",description:"Sign in to Claude Code"},{command:"/logout",description:"Sign out of Claude Code"},{command:"/mcp",description:"Manage MCP servers"},{command:"/memory",description:"Edit project memory files"},{command:"/model",description:"Change the active model"},{command:"/permissions",description:"Review or update tool permissions"},{command:"/pr_comments",description:"Read pull request review comments"},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show account and system status"},{command:"/terminal-setup",description:"Configure terminal newline shortcuts"},{command:"/vim",description:"Toggle vim mode"}],bs=[{command:"/bug",description:"File an issue about Gemini CLI"},{command:"/chat",description:"Manage chat checkpoints and exports"},{command:"/clear",description:"Clear the terminal display"},{command:"/compress",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last Gemini CLI output"},{command:"/directory",description:"Manage additional workspace directories",aliases:["dir"]},{command:"/editor",description:"Choose the preferred editor"},{command:"/extensions",description:"List active Gemini CLI extensions"},{command:"/help",description:"Show help and command usage",aliases:["?"]},{command:"/mcp",description:"Show MCP servers and tools"},{command:"/memory",description:"Manage loaded GEMINI.md memory"},{command:"/restore",description:"Restore files from a tool checkpoint"},{command:"/settings",description:"Open the Gemini CLI settings editor"},{command:"/stats",description:"Show session statistics and token usage"},{command:"/theme",description:"Change the Gemini CLI theme"},{command:"/auth",description:"Change the authentication method"},{command:"/about",description:"Show version information"},{command:"/tools",description:"List currently available tools"},{command:"/privacy",description:"Review privacy and data collection settings"},{command:"/quit",description:"Exit Gemini CLI",aliases:["exit"]},{command:"/vim",description:"Toggle vim mode"},{command:"/init",description:"Generate a tailored GEMINI.md file"}],vs=[{command:"/model",description:"Change the active model"},{command:"/plan",description:"Create or reopen a plan"},{command:"/ask",description:"Toggle ask mode (read-only Q&A)"},{command:"/debug",description:"Toggle debug mode"},{command:"/clear",description:"Start a new chat session",aliases:["new","new-chat","newchat"]},{command:"/compress",description:"Summarize the conversation to reduce context"},{command:"/vim",description:"Toggle vim mode"},{command:"/shell",description:"Enter shell mode"},{command:"/about",description:"Show CLI, system, and account information"},{command:"/setup-terminal",description:"Configure terminal newline shortcuts"},{command:"/feedback",description:"Share feedback with the Cursor team"},{command:"/open",description:"Open the repository git root in Cursor"},{command:"/cursor",description:"Alias for /open",aliases:["open"]},{command:"/resume-chat",description:"Resume a previous chat by folder name",aliases:["resume"]},{command:"/copy-request-id",description:"Copy the last request ID"},{command:"/copy-conversation-id",description:"Copy the current conversation ID"},{command:"/logout",description:"Sign out from Cursor"},{command:"/quit",description:"Exit Cursor Agent",aliases:["exit"]},{command:"/mcp",description:"Manage MCP servers"}],ys={[ye.CODEX]:hs,[ye.CLAUDE_CODE]:gs,[ye.GEMINI_CLI]:bs,[ye.CURSOR_AGENT]:vs};function st(t){return t.trim().toLowerCase().replace(/^\//,"")}function Ns(t){return t?(ys[t]??[]).map(s=>({...s,kind:s.kind??"builtin"})):[]}function ws(t){const s=t.match(/^\s*\/([^\s]*)$/);return s?st(s[1]):null}function js(t,s){return xs(t,st(s))}function Cs(t){const s=t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229,r=t.key==="Tab"&&!t.shiftKey;return s||r}function ks({agentType:t,workingDir:s,input:r,setInput:i,textareaRef:d,minHeight:l,maxHeight:u}){const[p,m]=a.useState(0),{data:f=[]}=ms({agentType:t,workingDir:s}),j=a.useMemo(()=>us(Ns(t),f),[t,f]),y=a.useMemo(()=>ws(r),[r]),N=a.useMemo(()=>y===null?[]:js(j,y),[j,y]),c=a.useCallback(()=>{const h=d.current;h&&(h.style.height="auto",h.style.height=`${Math.max(l,Math.min(h.scrollHeight,u))}px`)},[u,l,d]);a.useEffect(()=>{m(0)},[t,y]),a.useEffect(()=>{p<N.length||m(0)},[N.length,p]);const x=a.useCallback(h=>{const R=`${r.match(/^(\s*)\/[^\s]*$/)?.[1]??""}${h.command} `;i(R),requestAnimationFrame(()=>{const C=d.current;C&&(c(),C.focus(),C.setSelectionRange(R.length,R.length))})},[r,c,i,d]),_=a.useCallback(h=>y===null||N.length===0?!1:h.key==="ArrowDown"?(h.preventDefault(),m(L=>(L+1)%N.length),!0):h.key==="ArrowUp"?(h.preventDefault(),m(L=>(L-1+N.length)%N.length),!0):Cs(h)?(h.preventDefault(),x(N[p]??N[0]),!0):!1,[x,N,y,p]);return{allCommands:j,query:y,filteredCommands:N,selectedIndex:p,setSelectedIndex:m,applyCommand:x,handleKeyDown:_}}const Ss={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Es={ASK:Vt,AUTO_SANDBOX:At,FULL_ACCESS:Qt};function Ms({mode:t}){const{t:s}=Ce(),r=Es[t],i=s("Required permission: {mode}",{mode:s(zt[t])});return e.jsx("span",{role:"img","aria-label":i,title:i,className:"ml-2 mt-0.5 inline-flex shrink-0 text-muted-foreground",children:e.jsx(r,{size:14,"aria-hidden":"true"})})}function Xs({variant:t="task",projects:s,providers:r,isProvidersLoading:i,onSubmit:d,defaultProjectId:l="",defaultProviderId:u="",onProjectChange:p,createStep:m,placeholder:f,submitLabel:j,pendingLabel:y,submitTitle:N}){const{t:c}=Ce(),[x,_]=a.useState(""),[h,L]=a.useState(l),[R,C]=a.useState(u),D=R||u,[Z,P]=a.useState("SOLO"),[oe,O]=a.useState(E.WORKTREE),[G,U]=a.useState(He.NORMAL),[re,le]=a.useState({}),[H,J]=a.useState("AUTO"),[q,ae]=a.useState(null),[K,me]=a.useState([]),[o,b]=a.useState(!1),[M,$]=a.useState(!1),[Q,B]=a.useState(!1),[ie,ee]=a.useState(!1),Se=a.useRef(null),Ee=a.useRef(null),Me=a.useRef(null),Ae=a.useRef(null),Le=a.useRef(null),Pe=a.useRef(null),{files:be,addFiles:ce,removeFile:Ie,buildMarkdownLinks:_e,getDoneAttachments:De,isUploading:ve}=bt(),ue=Lt(),v=t==="conversation",w=t==="task"||t==="conversation",nt=j??c(v?"开始":"创建");a.useEffect(()=>{L(l),p?.(l)},[l,p]),a.useEffect(()=>{if(!M)return;const n=k=>{Se.current&&!Se.current.contains(k.target)&&$(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[M]),a.useEffect(()=>{if(!Q)return;const n=k=>{Ee.current&&!Ee.current.contains(k.target)&&B(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[Q]),a.useEffect(()=>{if(!ie)return;const n=k=>{Me.current&&!Me.current.contains(k.target)&&ee(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[ie]);const z=a.useMemo(()=>s.find(n=>n.id===h),[s,h]),F=a.useMemo(()=>r.find(n=>n.id===D),[r,D]),Te=h?re[h]:void 0,ot=(Te?.isGitRepo??z?.isGitRepo)!==!1,rt=(Te?.worktreeReady??z?.worktreeReady)!==!1,A=!v&&!(ot&&rt),I=A?"SOLO":Z,V=A?E.MAIN_DIRECTORY:oe,at=V===E.MAIN_DIRECTORY?c("本地模式"):c("工作树模式"),ze=c("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),it=c("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),ct=Te?.reason??z?.reason,$e=c(ct==="NO_HEAD"?"已检测到 Git,但需要先提交一次才能使用工作树模式。":"初始化 Git 后可使用工作树模式。"),Ge=v||I==="SOLO"?F?.agentType:null,Y=ks({agentType:Ge,workingDir:v?void 0:z?.repoPath,input:x,setInput:_,textareaRef:Le,minHeight:76,maxHeight:220}),S=m!=="idle",qe=!!q||K.length>0,pe=!S&&!ve&&x.trim().length>0&&(v?F?.available===!0:!!h&&(I==="SOLO"?F?.available===!0:qe));a.useEffect(()=>{A&&(P("SOLO"),O(E.MAIN_DIRECTORY),b(!1),ee(!1))},[A]),a.useEffect(()=>{A||v||O(E.WORKTREE)},[v,A,z?.id]);const dt=a.useCallback(async()=>{if(!z||ue.isPending)return;const n=await ue.mutateAsync({id:z.id});le(k=>({...k,[z.id]:n})),n.worktreeReady&&(P("SOLO"),O(E.WORKTREE),ee(!1))},[ue,z]),Re=a.useCallback(async()=>{if(!pe)return;const n=w?_e():"",k=w?De().map(te=>te.id):[];try{const te=d({title:x.trim(),description:"",projectId:v?"":h,providerId:D,mode:v?"SOLO":I,workspaceMode:!v&&I==="SOLO"?V:E.WORKTREE,teamRunMode:v?"AUTO":H,teamTemplateId:v||A?null:q,memberPresetIds:v||A?[]:K,attachmentLinks:n,attachmentIds:k,priority:G}),fe=()=>{if(_(W=>W===x?"":W),U(W=>W===G?He.NORMAL:W),w)for(const W of be)Ie(W.tempId)};v&&fe(),await te,v||fe()}catch{}},[pe,w,_e,De,d,x,v,h,D,I,V,H,A,q,K,be,Ie,G]),lt=a.useCallback(n=>{Y.handleKeyDown(n)||n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),Re())},[Re,Y]),mt=a.useCallback(n=>{const k=n.target.files;k&&k.length>0&&ce(Array.from(k)),n.target.value=""},[ce]),ut=a.useCallback(n=>{L(n),p?.(n),$(!1)},[p]),pt=a.useCallback(n=>{if(!w)return;const k=n.clipboardData.items,te=[];for(const fe of k)if(fe.kind==="file"){const W=fe.getAsFile();W&&te.push(W)}te.length>0&&(n.preventDefault(),ce(te))},[ce,w]),[Ke,Oe]=a.useState(!1),ft=a.useCallback(n=>{w&&(n.preventDefault(),Oe(!0))},[w]),xt=a.useCallback(n=>{w&&(n.preventDefault(),Oe(!1))},[w]),ht=a.useCallback(n=>{if(!w)return;n.preventDefault(),Oe(!1);const k=n.dataTransfer.files;k.length>0&&ce(Array.from(k))},[ce,w]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{ref:Ae,className:g("relative bg-background rounded-xl border transition-colors duration-200","shadow-raised","hover:border-ring/40 focus-within:border-ring/60",Ke?"border-foreground/40 bg-foreground/[0.02]":"border-border",S&&"opacity-80"),onDragOver:w?ft:void 0,onDragLeave:w?xt:void 0,onDrop:w?ht:void 0,children:[w&&be.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(vt,{files:be,onRemove:Ie})}),e.jsx("textarea",{ref:Le,value:x,onChange:n=>_(n.target.value),onKeyDown:lt,onPaste:w?pt:void 0,placeholder:c(f||"Describe your task..."),disabled:S,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&&Ke&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-center py-3 border border-dashed border-foreground/30 rounded-lg text-xs font-medium text-foreground/80",children:c("Drop files here")})}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>Pe.current?.click(),disabled:S||ve,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:c("Attach files"),children:e.jsx(Gt,{size:18})}),e.jsx("input",{ref:Pe,type:"file",multiple:!0,onChange:mt,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[w&&ve&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(we,{size:14,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),c("Uploading...")]}),S&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(we,{size:14,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),c(y??Ss[m])]}),!v&&!S&&!ve&&I==="TEAM"&&!qe&&x.trim().length>0&&e.jsx("span",{className:"text-xs text-warning-ink",children:c("请选择团队模板或追加成员")}),pe&&e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-xs text-muted-foreground 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-[11px] font-medium text-muted-foreground leading-none",children:"⏎"}),nt]}),e.jsx("button",{type:"button",onClick:Re,disabled:!pe,className:g("flex items-center justify-center size-8 rounded-lg transition-all duration-200",pe?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-raised":"bg-muted text-muted-foreground cursor-not-allowed"),title:c(N||"Create & Start"),children:e.jsx(It,{size:16,strokeWidth:2.5})})]})]})]}),e.jsx(ls,{open:!!Ge&&Y.query!==null,anchorRef:Ae,commands:Y.filteredCommands,selectedIndex:Y.selectedIndex,query:Y.query??"",hasCatalog:Y.allCommands.length>0,compact:!0,onSelect:Y.applyCommand}),e.jsxs("div",{className:"relative flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!v&&e.jsxs("div",{className:"relative",ref:Se,children:[e.jsxs("button",{type:"button",onClick:()=>{S||$(n=>!n)},disabled:S,className:g("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",z?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(qt,{size:14,className:"shrink-0",style:{color:z?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:z?.name??c("Project")}),e.jsx(xe,{size:12,className:g("text-muted-foreground transition-transform",M&&"rotate-180")})]}),M&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-popover py-1 max-h-[240px] overflow-y-auto z-50",children:s.map(n=>e.jsxs("button",{type:"button",onClick:()=>ut(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:g("truncate flex-1",n.id===h?"text-foreground font-medium":"text-muted-foreground"),children:n.name}),e.jsx(se,{size:14,className:g("ml-2 shrink-0 text-foreground",n.id===h?"opacity-100":"opacity-0")})]},n.id))})]}),(v||I==="SOLO")&&e.jsxs("div",{className:"sm:relative",ref:Ee,children:[e.jsxs("button",{type:"button",onClick:()=>{S||B(n=>!n)},disabled:S,className:g("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",F?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(Qe,{agentType:F?.agentType,className:"size-3.5"}),e.jsx("span",{className:"max-w-[120px] truncate",children:F?.name??c(i?"Loading...":"Agent")}),e.jsx(xe,{size:12,className:g("text-muted-foreground transition-transform",Q&&"rotate-180")})]}),Q&&e.jsx("div",{className:"absolute top-full left-0 z-50 mt-1.5 max-h-[min(60vh,320px)] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-lg border border-border bg-popover py-1 shadow-popover sm:w-80",children:r.map(n=>e.jsx("div",{tabIndex:n.available?void 0:0,role:n.available?void 0:"group","aria-label":n.available?void 0:`${n.name}: ${c(n.reason||"Agent executable is unavailable.")}`,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:e.jsxs("button",{type:"button",disabled:!n.available,onClick:()=>{C(n.id),B(!1)},className:g("flex w-full items-start px-3 py-2 text-left text-xs transition-colors hover:bg-accent",!n.available&&"cursor-not-allowed"),children:[e.jsx(se,{size:14,className:g("mr-2 mt-0.5 shrink-0 text-foreground",n.id===D?"opacity-100":"opacity-0")}),e.jsx(Qe,{agentType:n.agentType,className:"mr-2 mt-0.5 size-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:g("block break-words",n.id===D?"font-medium text-foreground":"text-muted-foreground"),children:[n.name,n.available?"":c(" (unavailable)")]}),n.reason?e.jsx("span",{className:"mt-0.5 block break-words text-xs leading-snug text-destructive-ink",children:c(n.reason)}):null]}),n.permissionMode?e.jsx(Ms,{mode:n.permissionMode}):null]})},n.id))})]}),!v&&I==="SOLO"&&e.jsxs("div",{className:"relative",ref:Me,children:[e.jsxs("button",{type:"button",onClick:()=>{S||ee(n=>!n)},disabled:S,className:g("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(Tt,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:at}),e.jsx(xe,{size:12,className:g("text-muted-foreground transition-transform",ie&&"rotate-180")})]}),ie&&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-popover py-1 z-50",children:[A?e.jsx(Fe,{side:"bottom",className:"block w-full",content:$e,children:e.jsxs("div",{tabIndex:0,"aria-label":$e,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(se,{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:c("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-xs leading-snug text-muted-foreground",children:ze})]})]}),e.jsx("button",{type:"button",onClick:dt,disabled:ue.isPending,className:"flex w-full items-center px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:ue.isPending?c("检测中..."):c("重新检测 Git 状态")})]})}):e.jsxs("button",{type:"button",onClick:()=>{O(E.WORKTREE),ee(!1)},className:"flex w-full items-center px-3 py-2 text-left text-xs transition-colors hover:bg-accent",children:[e.jsx(se,{size:14,className:g("mr-2 mt-0.5 shrink-0 text-foreground",V===E.WORKTREE?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:g("block truncate",V===E.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:c("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-xs leading-snug text-muted-foreground",children:ze})]})]}),e.jsxs("button",{type:"button",onClick:()=>{O(E.MAIN_DIRECTORY),ee(!1)},className:"flex items-start w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(se,{size:14,className:g("mr-2 mt-0.5 shrink-0 text-foreground",V===E.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:g("block truncate",V===E.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:c("本地模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-xs leading-snug text-muted-foreground",children:it})]})]})]})]}),!v&&e.jsx(as,{value:G,compact:!0,disabled:S,onChange:U}),!v&&e.jsx(Fe,{side:"bottom",className:"ml-auto",content:A?c("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun."):V===E.MAIN_DIRECTORY?c("TeamRun 需要工作树模式。开启团队模式时会自动切换为工作树模式。"):c("启用 TeamRun 后可选择团队模板或成员。"),children:e.jsxs("button",{type:"button",role:"switch","aria-checked":I==="TEAM",onClick:()=>{S||A||(Z==="TEAM"?(P("SOLO"),b(!1)):(P("TEAM"),ee(!1),O(E.WORKTREE),b(!0)))},disabled:S||A,className:g("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":c("启用团队模式"),children:[e.jsx(Rt,{size:14,className:I==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:c("团队模式")}),(A||V===E.MAIN_DIRECTORY)&&I!=="TEAM"?e.jsx(Ot,{size:12,className:"text-muted-foreground/70","aria-hidden":"true"}):null,e.jsx("span",{className:g("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:g("inline-block size-3 rounded-full bg-background shadow-raised transition-transform",I==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})})]}),F&&!F.available?e.jsx("p",{role:"alert",className:"mt-2 break-words px-2 text-xs leading-snug text-destructive-ink",children:F.reason?c(F.reason):c("Agent executable is unavailable.")}):null,!v&&I==="TEAM"&&o&&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(cs,{mode:H,setMode:J,selectedTemplateId:q,setSelectedTemplateId:ae,selectedMemberPresetIds:K,setSelectedMemberPresetIds:me,disabled:S,compact:!0})})]})}export{Xs as C,ls as S,cs as T,ts as Z,ks as a,Bs as b,Hs as c,Qs as d,as as e,ss as f,Us as g,Vs as h,Xt as i,Ys as j,xs as k,Ws as u};
|
|
1
|
+
import{a as Ze,s as gt,u as bt,A as vt,T as Fe}from"./AttachmentPreview-CLN1lnLe.js";import{c as ne,q as he,p as je,aI as Je,s as T,t as yt,az as Nt,v as ge,o as et,r as a,ac as wt,ad as de,an as We,u as Ce,bj as tt,j as e,n as g,bk as jt,aK as Ct,T as kt,U as St,Q as we,aO as Ue,X as Et,aC as Mt,a_ as ye,aq as E,bl as He,av as It,a0 as Qe,O as Tt,aA as Rt,bm as Ot,bn as At}from"./index-BJObbxud.js";import{d as Lt}from"./use-projects-Ddz0knyr.js";import{M as Be}from"./MemberAvatar-YVr_erAr.js";import{t as Ve}from"./tooltip-CPqGK_WZ.js";import{a as Pt}from"./BrandLogo-BUimEX-9.js";import{u as _t}from"./use-providers-Td1-gyrN.js";import{C as se}from"./check-BmiJ7qMY.js";import{P as Dt}from"./trash-2-CvUJsbtT.js";import{C as xe}from"./chevron-down-3y5Aiolp.js";import{l as zt}from"./ExecutionPermissionSelector-B8befbxJ.js";import{M as $t}from"./index-BtUQYU5l.js";import{P as Gt}from"./paperclip-CTNoXpUW.js";import{F as qt}from"./hooks-BLxb16IA.js";const Kt=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Ft=ne("chevrons-down",Kt);const Wt=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ut=ne("chevrons-up",Wt);const Ht=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],Qt=ne("shield-off",Ht);const Bt=[["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"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Vt=ne("shield-question-mark",Bt);const Yt=[["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"}]],Xt=ne("shield",Yt);const Zt=[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]],Jt=ne("signal-high",Zt);const es=[["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"}]],ts=ne("zap",es);function ss(t){const s=he(),r=et({queryKey:T.sessions.runtime(t),queryFn:()=>ge.get(`/sessions/${t}/runtime`),enabled:!!t});return a.useEffect(()=>{if(!t)return;const i=wt.connect(),d=p=>{p.sessionId===t&&s.invalidateQueries({queryKey:T.sessions.runtime(t)})},l=p=>{p.sessionId===t&&s.setQueryData(T.sessions.runtime(t),p.state)},u=()=>{s.invalidateQueries({queryKey:T.sessions.runtime(t)})};return i.on(de.SESSION_PERMISSION_REQUESTED,d),i.on(de.SESSION_PERMISSION_INVALIDATED,d),i.on(de.SESSION_RUNTIME_STATE_CHANGED,l),i.on("connect",u),()=>{i.off(de.SESSION_PERMISSION_REQUESTED,d),i.off(de.SESSION_PERMISSION_INVALIDATED,d),i.off(de.SESSION_RUNTIME_STATE_CHANGED,l),i.off("connect",u)}},[t,s]),r}function ns(t){return t==="RUNNING"||t==="AWAITING_PERMISSION"||t==="CANCELLING"}function os(t){return t===We.RUNNING||t===We.PENDING}function Ws(t,s){const{data:r}=ss(t);return{runtimeState:r,isActive:os(s)||ns(r?.turnState),isCancelling:r?.turnState==="CANCELLING"}}function Us(){const t=he();return je({mutationFn:({sessionId:s,requestId:r,optionId:i})=>ge.post(`/sessions/${s}/permissions/${r}/resolve`,{optionId:i}),onSettled:(s,r,i)=>{t.invalidateQueries({queryKey:T.sessions.runtime(i.sessionId)})}})}function Hs(){const t=he();return je({mutationFn:s=>Ze(`start:${s}`,{},r=>ge.post(`/sessions/${s}/start`,r)),onSuccess:(s,r)=>{"operationId"in s&&Je(t,s.delivery),t.invalidateQueries({queryKey:T.sessions.detail(r)}),t.invalidateQueries({queryKey:T.tasks.all})}})}const rs=45e3;function Qs(){const t=he();return je({mutationFn:async s=>{try{return await ge.post(`/sessions/${s}/stop`,void 0,{signal:AbortSignal.timeout(rs)})}catch(r){throw r instanceof DOMException&&r.name==="TimeoutError"?new Error("Stop request timed out before the server answered. The session may still be stopping; refresh the status and retry."):r}},onError:s=>{yt.error(Nt("Failed to stop session. Refreshing status; check it and try again."),{description:s instanceof Error?s.message:void 0})},onSettled:(s,r,i)=>{t.setQueryData(T.sessions.runtime(i),d=>d?.turnState==="CANCELLING"?{...d,turnState:"IDLE"}:d),Promise.allSettled([t.invalidateQueries({queryKey:T.sessions.detail(i)}),t.invalidateQueries({queryKey:T.sessions.runtime(i)}),t.invalidateQueries({queryKey:T.workspaces.all}),t.invalidateQueries({queryKey:T.tasks.all})])}})}function Bs(){const t=he();return je({mutationFn:({id:s,...r})=>Ze(`message:${s}`,r,i=>gt(t,s,`/sessions/${s}/message`,i)),onSuccess:s=>{"operationId"in s&&Je(t,s.delivery),t.invalidateQueries({queryKey:T.workspaces.all}),t.invalidateQueries({queryKey:T.tasks.all})}})}function Ye({iconName:t,className:s}){switch(t){case"chevrons-up":return e.jsx(Ut,{className:s,"aria-hidden":"true"});case"signal-high":return e.jsx(Jt,{className:s,"aria-hidden":"true"});case"chevrons-down":return e.jsx(Ft,{className:s,"aria-hidden":"true"});default:return e.jsx($t,{className:s,"aria-hidden":"true"})}}function Vs({priority:t,className:s}){const r=tt(t);return e.jsx("span",{className:g("inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] font-semibold leading-none",r.className,s),title:`${r.code} · ${r.label}`,children:r.code})}function as({value:t,onChange:s,disabled:r=!1,compact:i=!1}){const{t:d}=Ce(),[l,u]=a.useState(!1),p=a.useRef(null),m=tt(t);return a.useEffect(()=>{if(!l)return;const f=j=>{p.current&&!p.current.contains(j.target)&&u(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l]),e.jsxs("div",{className:"relative",ref:p,children:[e.jsxs("button",{type:"button",disabled:r||!s,onClick:()=>u(f=>!f),"aria-haspopup":"listbox","aria-expanded":l,"aria-label":d("Task priority"),className:g("inline-flex items-center gap-1.5 rounded-md text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 disabled:cursor-not-allowed disabled:opacity-50",i?"px-1.5 py-1":"px-2 py-1.5",m.className),children:[e.jsx(Ye,{iconName:m.iconName,className:"size-3.5"}),e.jsx("span",{children:d(m.label)}),s?e.jsx(xe,{className:g("size-3 transition-transform",l&&"rotate-180"),"aria-hidden":"true"}):null]}),l&&e.jsx("div",{className:"absolute right-0 top-full z-50 mt-1.5 w-36 rounded-lg border border-border bg-popover p-1 shadow-popover",role:"listbox","aria-label":d("Task priority"),children:jt.map(f=>{const j=f.value===m.value;return e.jsxs("button",{type:"button",role:"option","aria-selected":j,onClick:()=>{s?.(f.value),u(!1)},className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-xs text-foreground/80 transition-colors hover:bg-accent",children:[e.jsx("span",{className:g("inline-flex size-5 items-center justify-center rounded",f.className),children:e.jsx(Ye,{iconName:f.iconName,className:"size-3.5"})}),e.jsxs("span",{className:"flex-1",children:[f.code," · ",d(f.label)]}),j?e.jsx(se,{className:"size-3.5 text-foreground","aria-hidden":"true"}):null]},f.value)})})]})}function Xe(t,s,r,i){if(r.filter(u=>u===i).length<=1)return t;const l=r.slice(0,s+1).filter(u=>u===i).length;return`${t} #${l}`}function is(t){return Object.values(t).filter(Boolean).length}function cs({mode:t,setMode:s,selectedTemplateId:r,setSelectedTemplateId:i,selectedMemberPresetIds:d,setSelectedMemberPresetIds:l,disabled:u=!1,compact:p=!1}){const{t:m}=Ce(),{preserveDesktopSearch:f}=Ct(),[j,y]=a.useState(!1),{data:N}=_t(),{data:c,isError:x,isFetching:_,isLoading:h,refetch:L}=kt(),{data:R,isError:C,isFetching:D,isLoading:Z,refetch:P}=St(),oe=a.useMemo(()=>new Map((N??[]).map(({provider:o,availability:b})=>[o.id,o.name+(b.type==="NOT_FOUND"?m(" (不可用)"):"")])),[N,m]),O=a.useMemo(()=>new Map((c??[]).map(o=>[o.id,o])),[c]),G=a.useMemo(()=>new Map((R??[]).map(o=>[o.id,o])),[R]),U=a.useMemo(()=>d.map(o=>O.get(o)).filter(o=>!!o),[O,d]);a.useEffect(()=>{c!==void 0&&l(o=>{const b=o.filter(M=>O.has(M));return b.length===o.length&&b.every((M,$)=>M===o[$])?o:b})},[c,O,l]),a.useEffect(()=>{R!==void 0&&i(o=>!o||G.has(o)?o:null)},[i,G,R]);const re=o=>{u||i(b=>b===o?null:o)},le=o=>{u||l(b=>[...b,o])},H=o=>{u||l(b=>b.filter((M,$)=>$!==o))},J=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-1.5",children:m("团队模板")}),C?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive-ink",children:[e.jsx("span",{children:m("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{P()},disabled:u||D,className:"ml-2 underline hover:no-underline",children:m("重试")})]}):Z?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(we,{size:12,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),m("加载中...")]}):(R??[]).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:[m("当前没有团队模板"),e.jsx(Ue,{to:f("/settings/team"),className:Ve("ml-1.5"),children:m("去创建")})]}):e.jsx("div",{className:g("space-y-1.5",p&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(R??[]).map(o=>{const b=o.id===r,M=o.members?.length??0,$=o.members?.map(B=>B.memberPresetId)??[],Q=o.members?.slice(0,3).map((B,ie)=>Xe(B.memberPreset?.name??B.memberPresetId,ie,$,B.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>re(o.id),disabled:u,className:g("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",b?"bg-background border-foreground/20 shadow-raised":"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:g("text-xs truncate",b?"font-medium text-foreground":"text-foreground"),children:o.name}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[M,m("人")]})]}),Q&&e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:Q})]}),b&&e.jsx(se,{size:13,className:"shrink-0 text-foreground"})]})},o.id)})})]}),q=U.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:U.map((o,b)=>{const M=Xe(o.name,b,d,o.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-xs text-foreground",children:[e.jsx(Be,{name:o.name,avatar:o.avatar,size:"xs",className:"size-3.5"}),e.jsx("span",{className:"max-w-[80px] truncate",children:M}),e.jsx("button",{type:"button",onClick:()=>H(b),disabled:u,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(Et,{size:9})})]},`${o.id}-${b}`)})}),ae=x?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive-ink",children:[e.jsx("span",{children:m("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{L()},disabled:u||_,className:"ml-2 underline hover:no-underline",children:m("重试")})]}):h?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(we,{size:12,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),m("加载中...")]}):(c??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[m("当前没有成员预设"),e.jsx(Ue,{to:f("/settings/team"),className:Ve("ml-1.5"),children:m("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(c??[]).map(o=>{const b=d.filter(Q=>Q===o.id).length,M=oe.get(o.providerId)??o.providerId,$=is(o.capabilities);return e.jsxs("button",{type:"button",onClick:()=>le(o.id),disabled:u,className:g("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(Be,{name:o.name,avatar:o.avatar,className:"h-6 w-6 text-[10px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:o.name}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[M," · ",$,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[b>0&&e.jsxs("span",{className:"text-[11px] text-foreground font-semibold",children:["×",b]}),e.jsx(Dt,{size:12,className:"text-muted-foreground"})]})]},o.id)})}),K=U.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[11px] font-semibold text-primary-foreground px-1.5",children:U.length}),me=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:m("执行模式")}),e.jsx(Pt,{size:"sm","aria-label":m("执行模式"),value:t,onValueChange:o=>s(o),options:[{value:"AUTO",label:m("自动模式"),icon:e.jsx(ts,{}),disabled:u},{value:"CONFIRM",label:m("确认模式"),icon:e.jsx(Xt,{}),disabled:u}]})]});return p?e.jsxs("div",{className:"space-y-3",children:[me,J,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!u&&y(o=>!o),disabled:u,"aria-expanded":j,className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(xe,{size:12,className:g("transition-transform",j?"":"-rotate-90")}),m("追加独立成员"),K]}),j&&e.jsxs("div",{className:"mt-2",children:[q,ae]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[me,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[J,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-xs font-medium text-muted-foreground",children:m("追加成员")}),K]}),q,ae]})]})]})}function ds({commands:t,selectedIndex:s,query:r,hasCatalog:i,title:d="Slash Commands",queryPrefix:l="/",emptyCatalogMessage:u="No slash commands catalog for this agent yet.",emptyQueryMessage:p,insertionHint:m="Enter / Tab to insert",compact:f=!1,onSelect:j}){const y=f?"px-1.5 pb-1.5":"px-2 pb-2",N=f?"px-2 py-1.5":"px-2.5 py-2",c=f?"max-h-36":"max-h-48";return e.jsxs("div",{className:f?"pt-1.5":"pt-2",children:[e.jsxs("div",{className:`mb-1 flex items-center justify-between ${f?"px-2 pt-0.5":"px-3 pt-1"}`,children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:d}),e.jsx("span",{className:"text-xs text-muted-foreground",children:m})]}),t.length===0?e.jsx("div",{className:`${f?"px-2 pb-2 pt-1.5 text-xs":"px-3 pb-3 pt-2 text-xs"} text-muted-foreground`,children:i?p??`No matches for ${l}${r}`:u}):e.jsx("div",{className:`${y} ${c} overflow-y-auto`,children:t.map((x,_)=>e.jsxs("button",{type:"button",onMouseDown:h=>h.preventDefault(),onClick:()=>j(x),className:`w-full rounded-lg border text-left transition-colors ${_===s?"border-border bg-muted/50":"border-transparent hover:border-border hover:bg-accent"} ${N}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-mono text-[13px] text-foreground",children:x.command}),x.kind&&x.kind!=="builtin"?e.jsx("span",{className:"rounded-full border border-border px-1.5 py-0.5 text-[10px] uppercase tracking-[0.12em] text-muted-foreground",children:x.scope?`${x.scope} ${x.kind}`:x.kind}):null]}),e.jsx("div",{className:`${f?"mt-0.5 text-xs":"mt-1 text-xs"} text-muted-foreground`,children:x.description})]},x.command))})]})}const X=12,Ne=8;function ls({open:t,anchorRef:s,commands:r,selectedIndex:i,query:d,hasCatalog:l,title:u,queryPrefix:p,emptyCatalogMessage:m,emptyQueryMessage:f,insertionHint:j,compact:y=!1,onSelect:N}){const c=a.useRef(null),[x,_]=a.useState(null);return a.useLayoutEffect(()=>{if(!t){_(null);return}const h=s.current;if(!h)return;let L=0;const R=()=>{const Z=s.current;if(!Z)return;const P=Z.getBoundingClientRect(),oe=window.innerWidth,O=window.innerHeight,G=y?260:320,U=y?oe-X*2:560,re=Math.min(Math.max(P.width,G),Math.max(G,U)),le=Math.min(Math.max(X,P.left),Math.max(X,oe-X-re)),H=O-P.bottom-Ne-X,J=P.top-Ne-X,q=c.current?.offsetHeight??(y?220:280),ae=y?240:320,K=H<180&&J>H,o=Math.max(120,Math.min(ae,K?J:H)),b=K?Math.max(X,P.top-Ne-Math.min(q,o)):Math.min(O-X-Math.min(q,o),P.bottom+Ne);_({top:b,left:le,width:re,maxHeight:o})},C=()=>{cancelAnimationFrame(L),L=requestAnimationFrame(R)};C();const D=new ResizeObserver(C);return D.observe(h),c.current&&D.observe(c.current),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),window.visualViewport?.addEventListener("resize",C),window.visualViewport?.addEventListener("scroll",C),()=>{cancelAnimationFrame(L),D.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),window.visualViewport?.removeEventListener("resize",C),window.visualViewport?.removeEventListener("scroll",C)}},[s,r.length,y,t,d,i]),!t||!x||typeof document>"u"?null:Mt.createPortal(e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[120]",children:e.jsx("div",{ref:c,className:"pointer-events-auto fixed overflow-hidden rounded-xl border border-border bg-background shadow-popover ",style:{top:x.top,left:x.left,width:x.width,maxHeight:x.maxHeight},children:e.jsx(ds,{commands:r,selectedIndex:i,query:d,hasCatalog:l,title:u,queryPrefix:p,emptyCatalogMessage:m,emptyQueryMessage:f,insertionHint:j,compact:y,onSelect:N})})}),document.body)}function ms({agentType:t,workingDir:s}){return et({queryKey:T.system.slashCommandCatalog(t,s),queryFn:async()=>(await ge.get("/system/slash-command-catalog",{params:{agentType:String(t),...s?{workingDir:s}:{}}})).commands,enabled:!!t,staleTime:3e4})}function us(t,s){const r=new Set,i=[];for(const d of[...t,...s]){const l=d.command.trim().toLowerCase();!l||r.has(l)||(r.add(l),i.push(d.kind?d:{...d,kind:"builtin"}))}return i}function ke(t){return t.trim().toLowerCase().replace(/^[/$]/,"")}function ps(t){return ke(t.command)}function fs(t,s){if(!s)return 1e3;const r=ps(t),i=t.aliases?.map(ke)??[],d=[r,...i];let l=0;for(const p of d)p===s?l=Math.max(l,500):p.startsWith(s)?l=Math.max(l,400-(p.length-s.length)):p.includes(s)&&(l=Math.max(l,250-p.indexOf(s)));return l>0?l:`${r} ${i.join(" ")} ${t.description}`.toLowerCase().includes(s)?100:0}function Ys(t){const s=/(^|[\s])\$([^\s]*)$/.exec(t);if(!s||s.index===void 0)return null;const r=s.index+s[1].length;return{query:ke(s[2]),replaceStart:r}}function xs(t,s){const r=ke(s);return r?t.map((i,d)=>({command:i,index:d,score:fs(i,r)})).filter(i=>i.score>0).sort((i,d)=>d.score-i.score||i.index-d.index||i.command.command.localeCompare(d.command.command)).map(i=>i.command):t.slice()}const hs=[{command:"/permissions",description:"Manage what Codex can do without approval"},{command:"/sandbox-add-read-dir",description:"Grant read access to another directory"},{command:"/agent",description:"Switch between built-in agent personas"},{command:"/apps",description:"Manage connected apps"},{command:"/clear",description:"Start a fresh conversation"},{command:"/compact",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last assistant message to your clipboard"},{command:"/diff",description:"Show the current git diff"},{command:"/experimental",description:"Toggle experimental features"},{command:"/feedback",description:"Share feedback on Codex CLI"},{command:"/init",description:"Create or update AGENTS.md for the repo"},{command:"/logout",description:"Sign out of Codex"},{command:"/mcp",description:"Manage MCP servers"},{command:"/mention",description:"Add files or directories to the conversation context"},{command:"/model",description:"Change the active model"},{command:"/fast",description:"Toggle low reasoning mode"},{command:"/plan",description:"Toggle plan mode for code changes"},{command:"/personality",description:"Select how Codex communicates"},{command:"/ps",description:"List running background tasks"},{command:"/fork",description:"Fork the current conversation state"},{command:"/resume",description:"Resume a previous conversation"},{command:"/new",description:"Open a conversation picker to start or resume"},{command:"/quit",description:"Exit Codex CLI",aliases:["exit"]},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show session and configuration status"},{command:"/debug-config",description:"Inspect the effective configuration"},{command:"/statusline",description:"Configure the custom status line"},{command:"/skills",description:"Browse available skills and insert a $skill mention"}],gs=[{command:"/clear",description:"Clear the conversation history"},{command:"/compact",description:"Compact the conversation context",aliases:["compact focus"]},{command:"/config",description:"Open the configuration panel"},{command:"/cost",description:"Show token usage and cost"},{command:"/doctor",description:"Check Claude Code installation health"},{command:"/help",description:"Show help and available commands"},{command:"/init",description:"Initialize project instructions"},{command:"/login",description:"Sign in to Claude Code"},{command:"/logout",description:"Sign out of Claude Code"},{command:"/mcp",description:"Manage MCP servers"},{command:"/memory",description:"Edit project memory files"},{command:"/model",description:"Change the active model"},{command:"/permissions",description:"Review or update tool permissions"},{command:"/pr_comments",description:"Read pull request review comments"},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show account and system status"},{command:"/terminal-setup",description:"Configure terminal newline shortcuts"},{command:"/vim",description:"Toggle vim mode"}],bs=[{command:"/bug",description:"File an issue about Gemini CLI"},{command:"/chat",description:"Manage chat checkpoints and exports"},{command:"/clear",description:"Clear the terminal display"},{command:"/compress",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last Gemini CLI output"},{command:"/directory",description:"Manage additional workspace directories",aliases:["dir"]},{command:"/editor",description:"Choose the preferred editor"},{command:"/extensions",description:"List active Gemini CLI extensions"},{command:"/help",description:"Show help and command usage",aliases:["?"]},{command:"/mcp",description:"Show MCP servers and tools"},{command:"/memory",description:"Manage loaded GEMINI.md memory"},{command:"/restore",description:"Restore files from a tool checkpoint"},{command:"/settings",description:"Open the Gemini CLI settings editor"},{command:"/stats",description:"Show session statistics and token usage"},{command:"/theme",description:"Change the Gemini CLI theme"},{command:"/auth",description:"Change the authentication method"},{command:"/about",description:"Show version information"},{command:"/tools",description:"List currently available tools"},{command:"/privacy",description:"Review privacy and data collection settings"},{command:"/quit",description:"Exit Gemini CLI",aliases:["exit"]},{command:"/vim",description:"Toggle vim mode"},{command:"/init",description:"Generate a tailored GEMINI.md file"}],vs=[{command:"/model",description:"Change the active model"},{command:"/plan",description:"Create or reopen a plan"},{command:"/ask",description:"Toggle ask mode (read-only Q&A)"},{command:"/debug",description:"Toggle debug mode"},{command:"/clear",description:"Start a new chat session",aliases:["new","new-chat","newchat"]},{command:"/compress",description:"Summarize the conversation to reduce context"},{command:"/vim",description:"Toggle vim mode"},{command:"/shell",description:"Enter shell mode"},{command:"/about",description:"Show CLI, system, and account information"},{command:"/setup-terminal",description:"Configure terminal newline shortcuts"},{command:"/feedback",description:"Share feedback with the Cursor team"},{command:"/open",description:"Open the repository git root in Cursor"},{command:"/cursor",description:"Alias for /open",aliases:["open"]},{command:"/resume-chat",description:"Resume a previous chat by folder name",aliases:["resume"]},{command:"/copy-request-id",description:"Copy the last request ID"},{command:"/copy-conversation-id",description:"Copy the current conversation ID"},{command:"/logout",description:"Sign out from Cursor"},{command:"/quit",description:"Exit Cursor Agent",aliases:["exit"]},{command:"/mcp",description:"Manage MCP servers"}],ys={[ye.CODEX]:hs,[ye.CLAUDE_CODE]:gs,[ye.GEMINI_CLI]:bs,[ye.CURSOR_AGENT]:vs};function st(t){return t.trim().toLowerCase().replace(/^\//,"")}function Ns(t){return t?(ys[t]??[]).map(s=>({...s,kind:s.kind??"builtin"})):[]}function ws(t){const s=t.match(/^\s*\/([^\s]*)$/);return s?st(s[1]):null}function js(t,s){return xs(t,st(s))}function Cs(t){const s=t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229,r=t.key==="Tab"&&!t.shiftKey;return s||r}function ks({agentType:t,workingDir:s,input:r,setInput:i,textareaRef:d,minHeight:l,maxHeight:u}){const[p,m]=a.useState(0),{data:f=[]}=ms({agentType:t,workingDir:s}),j=a.useMemo(()=>us(Ns(t),f),[t,f]),y=a.useMemo(()=>ws(r),[r]),N=a.useMemo(()=>y===null?[]:js(j,y),[j,y]),c=a.useCallback(()=>{const h=d.current;h&&(h.style.height="auto",h.style.height=`${Math.max(l,Math.min(h.scrollHeight,u))}px`)},[u,l,d]);a.useEffect(()=>{m(0)},[t,y]),a.useEffect(()=>{p<N.length||m(0)},[N.length,p]);const x=a.useCallback(h=>{const R=`${r.match(/^(\s*)\/[^\s]*$/)?.[1]??""}${h.command} `;i(R),requestAnimationFrame(()=>{const C=d.current;C&&(c(),C.focus(),C.setSelectionRange(R.length,R.length))})},[r,c,i,d]),_=a.useCallback(h=>y===null||N.length===0?!1:h.key==="ArrowDown"?(h.preventDefault(),m(L=>(L+1)%N.length),!0):h.key==="ArrowUp"?(h.preventDefault(),m(L=>(L-1+N.length)%N.length),!0):Cs(h)?(h.preventDefault(),x(N[p]??N[0]),!0):!1,[x,N,y,p]);return{allCommands:j,query:y,filteredCommands:N,selectedIndex:p,setSelectedIndex:m,applyCommand:x,handleKeyDown:_}}const Ss={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."},Es={ASK:Vt,AUTO_SANDBOX:At,FULL_ACCESS:Qt};function Ms({mode:t}){const{t:s}=Ce(),r=Es[t],i=s("Required permission: {mode}",{mode:s(zt[t])});return e.jsx("span",{role:"img","aria-label":i,title:i,className:"ml-2 mt-0.5 inline-flex shrink-0 text-muted-foreground",children:e.jsx(r,{size:14,"aria-hidden":"true"})})}function Xs({variant:t="task",projects:s,providers:r,isProvidersLoading:i,onSubmit:d,defaultProjectId:l="",defaultProviderId:u="",onProjectChange:p,createStep:m,placeholder:f,submitLabel:j,pendingLabel:y,submitTitle:N}){const{t:c}=Ce(),[x,_]=a.useState(""),[h,L]=a.useState(l),[R,C]=a.useState(u),D=R||u,[Z,P]=a.useState("SOLO"),[oe,O]=a.useState(E.WORKTREE),[G,U]=a.useState(He.NORMAL),[re,le]=a.useState({}),[H,J]=a.useState("AUTO"),[q,ae]=a.useState(null),[K,me]=a.useState([]),[o,b]=a.useState(!1),[M,$]=a.useState(!1),[Q,B]=a.useState(!1),[ie,ee]=a.useState(!1),Se=a.useRef(null),Ee=a.useRef(null),Me=a.useRef(null),Ae=a.useRef(null),Le=a.useRef(null),Pe=a.useRef(null),{files:be,addFiles:ce,removeFile:Ie,buildMarkdownLinks:_e,getDoneAttachments:De,isUploading:ve}=bt(),ue=Lt(),v=t==="conversation",w=t==="task"||t==="conversation",nt=j??c(v?"开始":"创建");a.useEffect(()=>{L(l),p?.(l)},[l,p]),a.useEffect(()=>{if(!M)return;const n=k=>{Se.current&&!Se.current.contains(k.target)&&$(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[M]),a.useEffect(()=>{if(!Q)return;const n=k=>{Ee.current&&!Ee.current.contains(k.target)&&B(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[Q]),a.useEffect(()=>{if(!ie)return;const n=k=>{Me.current&&!Me.current.contains(k.target)&&ee(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[ie]);const z=a.useMemo(()=>s.find(n=>n.id===h),[s,h]),F=a.useMemo(()=>r.find(n=>n.id===D),[r,D]),Te=h?re[h]:void 0,ot=(Te?.isGitRepo??z?.isGitRepo)!==!1,rt=(Te?.worktreeReady??z?.worktreeReady)!==!1,A=!v&&!(ot&&rt),I=A?"SOLO":Z,V=A?E.MAIN_DIRECTORY:oe,at=V===E.MAIN_DIRECTORY?c("本地模式"):c("工作树模式"),ze=c("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),it=c("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),ct=Te?.reason??z?.reason,$e=c(ct==="NO_HEAD"?"已检测到 Git,但需要先提交一次才能使用工作树模式。":"初始化 Git 后可使用工作树模式。"),Ge=v||I==="SOLO"?F?.agentType:null,Y=ks({agentType:Ge,workingDir:v?void 0:z?.repoPath,input:x,setInput:_,textareaRef:Le,minHeight:76,maxHeight:220}),S=m!=="idle",qe=!!q||K.length>0,pe=!S&&!ve&&x.trim().length>0&&(v?F?.available===!0:!!h&&(I==="SOLO"?F?.available===!0:qe));a.useEffect(()=>{A&&(P("SOLO"),O(E.MAIN_DIRECTORY),b(!1),ee(!1))},[A]),a.useEffect(()=>{A||v||O(E.WORKTREE)},[v,A,z?.id]);const dt=a.useCallback(async()=>{if(!z||ue.isPending)return;const n=await ue.mutateAsync({id:z.id});le(k=>({...k,[z.id]:n})),n.worktreeReady&&(P("SOLO"),O(E.WORKTREE),ee(!1))},[ue,z]),Re=a.useCallback(async()=>{if(!pe)return;const n=w?_e():"",k=w?De().map(te=>te.id):[];try{const te=d({title:x.trim(),description:"",projectId:v?"":h,providerId:D,mode:v?"SOLO":I,workspaceMode:!v&&I==="SOLO"?V:E.WORKTREE,teamRunMode:v?"AUTO":H,teamTemplateId:v||A?null:q,memberPresetIds:v||A?[]:K,attachmentLinks:n,attachmentIds:k,priority:G}),fe=()=>{if(_(W=>W===x?"":W),U(W=>W===G?He.NORMAL:W),w)for(const W of be)Ie(W.tempId)};v&&fe(),await te,v||fe()}catch{}},[pe,w,_e,De,d,x,v,h,D,I,V,H,A,q,K,be,Ie,G]),lt=a.useCallback(n=>{Y.handleKeyDown(n)||n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),Re())},[Re,Y]),mt=a.useCallback(n=>{const k=n.target.files;k&&k.length>0&&ce(Array.from(k)),n.target.value=""},[ce]),ut=a.useCallback(n=>{L(n),p?.(n),$(!1)},[p]),pt=a.useCallback(n=>{if(!w)return;const k=n.clipboardData.items,te=[];for(const fe of k)if(fe.kind==="file"){const W=fe.getAsFile();W&&te.push(W)}te.length>0&&(n.preventDefault(),ce(te))},[ce,w]),[Ke,Oe]=a.useState(!1),ft=a.useCallback(n=>{w&&(n.preventDefault(),Oe(!0))},[w]),xt=a.useCallback(n=>{w&&(n.preventDefault(),Oe(!1))},[w]),ht=a.useCallback(n=>{if(!w)return;n.preventDefault(),Oe(!1);const k=n.dataTransfer.files;k.length>0&&ce(Array.from(k))},[ce,w]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{ref:Ae,className:g("relative bg-background rounded-xl border transition-colors duration-200","shadow-raised","hover:border-ring/40 focus-within:border-ring/60",Ke?"border-foreground/40 bg-foreground/[0.02]":"border-border",S&&"opacity-80"),onDragOver:w?ft:void 0,onDragLeave:w?xt:void 0,onDrop:w?ht:void 0,children:[w&&be.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(vt,{files:be,onRemove:Ie})}),e.jsx("textarea",{ref:Le,value:x,onChange:n=>_(n.target.value),onKeyDown:lt,onPaste:w?pt:void 0,placeholder:c(f||"Describe your task..."),disabled:S,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&&Ke&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-center py-3 border border-dashed border-foreground/30 rounded-lg text-xs font-medium text-foreground/80",children:c("Drop files here")})}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>Pe.current?.click(),disabled:S||ve,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:c("Attach files"),children:e.jsx(Gt,{size:18})}),e.jsx("input",{ref:Pe,type:"file",multiple:!0,onChange:mt,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[w&&ve&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(we,{size:14,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),c("Uploading...")]}),S&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(we,{size:14,className:"animate-spin motion-reduce:[animation-duration:2.4s]"}),c(y??Ss[m])]}),!v&&!S&&!ve&&I==="TEAM"&&!qe&&x.trim().length>0&&e.jsx("span",{className:"text-xs text-warning-ink",children:c("请选择团队模板或追加成员")}),pe&&e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-xs text-muted-foreground 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-[11px] font-medium text-muted-foreground leading-none",children:"⏎"}),nt]}),e.jsx("button",{type:"button",onClick:Re,disabled:!pe,className:g("flex items-center justify-center size-8 rounded-lg transition-all duration-200",pe?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-raised":"bg-muted text-muted-foreground cursor-not-allowed"),title:c(N||"Create & Start"),children:e.jsx(It,{size:16,strokeWidth:2.5})})]})]})]}),e.jsx(ls,{open:!!Ge&&Y.query!==null,anchorRef:Ae,commands:Y.filteredCommands,selectedIndex:Y.selectedIndex,query:Y.query??"",hasCatalog:Y.allCommands.length>0,compact:!0,onSelect:Y.applyCommand}),e.jsxs("div",{className:"relative flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!v&&e.jsxs("div",{className:"relative",ref:Se,children:[e.jsxs("button",{type:"button",onClick:()=>{S||$(n=>!n)},disabled:S,className:g("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",z?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(qt,{size:14,className:"shrink-0",style:{color:z?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:z?.name??c("Project")}),e.jsx(xe,{size:12,className:g("text-muted-foreground transition-transform",M&&"rotate-180")})]}),M&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-popover py-1 max-h-[240px] overflow-y-auto z-50",children:s.map(n=>e.jsxs("button",{type:"button",onClick:()=>ut(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:g("truncate flex-1",n.id===h?"text-foreground font-medium":"text-muted-foreground"),children:n.name}),e.jsx(se,{size:14,className:g("ml-2 shrink-0 text-foreground",n.id===h?"opacity-100":"opacity-0")})]},n.id))})]}),(v||I==="SOLO")&&e.jsxs("div",{className:"sm:relative",ref:Ee,children:[e.jsxs("button",{type:"button",onClick:()=>{S||B(n=>!n)},disabled:S,className:g("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",F?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(Qe,{agentType:F?.agentType,className:"size-3.5"}),e.jsx("span",{className:"max-w-[120px] truncate",children:F?.name??c(i?"Loading...":"Agent")}),e.jsx(xe,{size:12,className:g("text-muted-foreground transition-transform",Q&&"rotate-180")})]}),Q&&e.jsx("div",{className:"absolute top-full left-0 z-50 mt-1.5 max-h-[min(60vh,320px)] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-lg border border-border bg-popover py-1 shadow-popover sm:w-80",children:r.map(n=>e.jsx("div",{tabIndex:n.available?void 0:0,role:n.available?void 0:"group","aria-label":n.available?void 0:`${n.name}: ${c(n.reason||"Agent executable is unavailable.")}`,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:e.jsxs("button",{type:"button",disabled:!n.available,onClick:()=>{C(n.id),B(!1)},className:g("flex w-full items-start px-3 py-2 text-left text-xs transition-colors hover:bg-accent",!n.available&&"cursor-not-allowed"),children:[e.jsx(se,{size:14,className:g("mr-2 mt-0.5 shrink-0 text-foreground",n.id===D?"opacity-100":"opacity-0")}),e.jsx(Qe,{agentType:n.agentType,className:"mr-2 mt-0.5 size-3.5 shrink-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:g("block break-words",n.id===D?"font-medium text-foreground":"text-muted-foreground"),children:[n.name,n.available?"":c(" (unavailable)")]}),n.reason?e.jsx("span",{className:"mt-0.5 block break-words text-xs leading-snug text-destructive-ink",children:c(n.reason)}):null]}),n.permissionMode?e.jsx(Ms,{mode:n.permissionMode}):null]})},n.id))})]}),!v&&I==="SOLO"&&e.jsxs("div",{className:"relative",ref:Me,children:[e.jsxs("button",{type:"button",onClick:()=>{S||ee(n=>!n)},disabled:S,className:g("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(Tt,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:at}),e.jsx(xe,{size:12,className:g("text-muted-foreground transition-transform",ie&&"rotate-180")})]}),ie&&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-popover py-1 z-50",children:[A?e.jsx(Fe,{side:"bottom",className:"block w-full",content:$e,children:e.jsxs("div",{tabIndex:0,"aria-label":$e,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(se,{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:c("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-xs leading-snug text-muted-foreground",children:ze})]})]}),e.jsx("button",{type:"button",onClick:dt,disabled:ue.isPending,className:"flex w-full items-center px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:ue.isPending?c("检测中..."):c("重新检测 Git 状态")})]})}):e.jsxs("button",{type:"button",onClick:()=>{O(E.WORKTREE),ee(!1)},className:"flex w-full items-center px-3 py-2 text-left text-xs transition-colors hover:bg-accent",children:[e.jsx(se,{size:14,className:g("mr-2 mt-0.5 shrink-0 text-foreground",V===E.WORKTREE?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:g("block truncate",V===E.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:c("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-xs leading-snug text-muted-foreground",children:ze})]})]}),e.jsxs("button",{type:"button",onClick:()=>{O(E.MAIN_DIRECTORY),ee(!1)},className:"flex items-start w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(se,{size:14,className:g("mr-2 mt-0.5 shrink-0 text-foreground",V===E.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:g("block truncate",V===E.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:c("本地模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-xs leading-snug text-muted-foreground",children:it})]})]})]})]}),!v&&e.jsx(as,{value:G,compact:!0,disabled:S,onChange:U}),!v&&e.jsx(Fe,{side:"bottom",className:"ml-auto",content:A?c("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun."):V===E.MAIN_DIRECTORY?c("TeamRun 需要工作树模式。开启团队模式时会自动切换为工作树模式。"):c("启用 TeamRun 后可选择团队模板或成员。"),children:e.jsxs("button",{type:"button",role:"switch","aria-checked":I==="TEAM",onClick:()=>{S||A||(Z==="TEAM"?(P("SOLO"),b(!1)):(P("TEAM"),ee(!1),O(E.WORKTREE),b(!0)))},disabled:S||A,className:g("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":c("启用团队模式"),children:[e.jsx(Rt,{size:14,className:I==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:c("团队模式")}),(A||V===E.MAIN_DIRECTORY)&&I!=="TEAM"?e.jsx(Ot,{size:12,className:"text-muted-foreground/70","aria-hidden":"true"}):null,e.jsx("span",{className:g("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:g("inline-block size-3 rounded-full bg-background shadow-raised transition-transform",I==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})})]}),F&&!F.available?e.jsx("p",{role:"alert",className:"mt-2 break-words px-2 text-xs leading-snug text-destructive-ink",children:F.reason?c(F.reason):c("Agent executable is unavailable.")}):null,!v&&I==="TEAM"&&o&&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(cs,{mode:H,setMode:J,selectedTemplateId:q,setSelectedTemplateId:ae,selectedMemberPresetIds:K,setSelectedMemberPresetIds:me,disabled:S,compact:!0})})]})}export{Xs as C,ls as S,cs as T,ts as Z,ks as a,Bs as b,Hs as c,Qs as d,as as e,ss as f,Us as g,Vs as h,Xt as i,Ys as j,xs as k,Ws as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,ac as j,ad as E,ae as T,j as s,n as M,u as P,v as I,B as O}from"./index-
|
|
1
|
+
import{r as a,ac as j,ad as E,ae as T,j as s,n as M,u as P,v as I,B as O}from"./index-BJObbxud.js";function U(t){const{sessionId:c,onOutput:k,onExit:x,onError:v}=t,[p,g]=a.useState(()=>j.isConnected()),[r,d]=a.useState(!1),m=a.useRef({onOutput:k,onExit:x,onError:v});m.current={onOutput:k,onExit:x,onError:v},a.useEffect(()=>{const n=j.getSocket();g(n.connected);const u=()=>g(!0),b=()=>{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",b),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",b),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 B(){const{t}=P(),[c,k]=a.useState([]),[x,v]=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),b=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:b,onExit:w,onError:C});a.useEffect(()=>{I.get("/demo/agents").then(e=>{k(e.agents);const o=e.agents.find(f=>f.available);o&&v(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:()=>v(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{B as DemoPage};
|