@saluzi/saluzi-edu 0.2.69 → 0.2.71
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/cli.js +254 -251
- package/dist/guide/guide-data.json +177 -173
- package/dist/rcs-web/assets/{AdminPanel-Ox9LWuFz.js → AdminPanel-8HNxSZw0.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ArtifactView-B7a8Khfb.js → dist/rcs-web/assets/ArtifactView-2di4r0Cr.js} +2 -2
- package/dist/rcs-web/assets/{ArtifactsGallery-CnV0vYtl.js → ArtifactsGallery-DQj98ptl.js} +2 -2
- package/{packages/remote-control-server/web/dist/assets/Claim-Ck2lSDQo.js → dist/rcs-web/assets/Claim-Dfdhnggp.js} +1 -1
- package/dist/rcs-web/assets/{Dashboard-C60GVEEA.js → Dashboard-DnLE2gtW.js} +1 -1
- package/dist/rcs-web/assets/{Join-B-PK9ZgC.js → Join-Cgq7v-Sb.js} +1 -1
- package/dist/rcs-web/assets/{Login-DQ6FPOKM.js → Login-CpRVSamw.js} +1 -1
- package/dist/rcs-web/assets/{Register-U7f5H-s4.js → Register-CvCuP-ww.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-CTa4JN6V.js +60 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-DCKNddif.js → SessionVisibilityBadge-7ElYQ4hP.js} +1 -1
- package/dist/rcs-web/assets/{Setup-DdUvqcnS.js → Setup-DH5NCalW.js} +1 -1
- package/dist/rcs-web/assets/{ShareLanding-BIZozDi0.js → ShareLanding-B48Z1tak.js} +1 -1
- package/dist/rcs-web/assets/{TeamCreate-DTEQa91s.js → TeamCreate-tXM5yKmq.js} +1 -1
- package/dist/rcs-web/assets/{TeamDetail-DSbAaI5T.js → TeamDetail-3jPhrX5z.js} +1 -1
- package/dist/rcs-web/assets/{TeamList-B8CkSRFk.js → TeamList-DylGNt59.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-afAMifTT.js → TeamSettings-CoBx_q55.js} +1 -1
- package/dist/rcs-web/assets/{UserSearchInput-CCwTLowu.js → UserSearchInput-DM6V0r1B.js} +1 -1
- package/dist/rcs-web/assets/{UserSettings-BS14QbPw.js → UserSettings-CxuLje2z.js} +1 -1
- package/dist/rcs-web/assets/{arc-D92zl5sb.js → arc-BrQup1CU.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-BFS0ptEo.js → architectureDiagram-3BPJPVTR-l1NuwJAC.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BcDcn0zW.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-CfTZRvdU.js → c4Diagram-AAUBKEIU-C8IgW5pQ.js} +1 -1
- package/dist/rcs-web/assets/channel-DqfyWDcz.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-D7uMaXAF.js → chunk-2J33WTMH-Cz-fnX8Q.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-Cl8kGA_R.js → chunk-4BX2VUAB-s0k1FsPS.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-B4zl1V4D.js → chunk-55IACEB6-k7MztSxj.js} +1 -1
- package/dist/rcs-web/assets/{chunk-727SXJPM-DlSsa2cu.js → chunk-727SXJPM-DCD6b_gA.js} +1 -1
- package/dist/rcs-web/assets/{chunk-AQP2D5EJ-C1rrenok.js → chunk-AQP2D5EJ-ByLnKNaa.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-DyKwyEWK.js → chunk-FMBD7UC4-DnoA9fQr.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-1AD_FvlP.js → chunk-ND2GUHAM-BsbvPHC6.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-EdHsPut0.js → chunk-QZHKN3VN-DnHGOmkn.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-CFM8l45C.js → code-block-IT6T5CEO-Br6udBTB.js} +1 -1
- package/dist/rcs-web/assets/{copy-CxPcy5Mr.js → copy-BFkM6GS4.js} +1 -1
- package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-DIM61nZa.js → cose-bilkent-S5V4N54A-ChN-rm-T.js} +1 -1
- package/dist/rcs-web/assets/{dagre-BM42HDAG-kszq2R0H.js → dagre-BM42HDAG-Dy0qgRIV.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-CYJKb2wC.js → diagram-2AECGRRQ-ByiBm-x4.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-Czogc4aD.js → diagram-5GNKFQAL-rGbxhf-H.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-CkIjVAxE.js → diagram-KO2AKTUF-COdwodvi.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-DGjTtYRO.js → diagram-LMA3HP47-EjqjzeZY.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-CG5exhuD.js → dist/rcs-web/assets/diagram-OG6HWLK6-DSPVSdmJ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dialog-BU8x6OfJ.js → dist/rcs-web/assets/dialog-aHICCHyK.js} +1 -1
- package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-BXY3YoP3.js → erDiagram-TEJ5UH35-DZBAaLMb.js} +1 -1
- package/dist/rcs-web/assets/{external-link-BlJ3ree6.js → external-link-Cb0Qh2uy.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-C6V4IR9e.js → flowDiagram-I6XJVG4X-DJHAIGo5.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-BuvlJCin.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BWi6Gk9P.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-C4E3g5J9.js → infoDiagram-5YYISTIA-n-NVaNrp.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-RwMP4JwJ.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-D7nU29iu.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-C3EZeQ-B.js → journeyDiagram-JHISSGLW-De0htrHG.js} +1 -1
- package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-EFaG-oyy.js → kanban-definition-UN3LZRKU-C5rnfLlw.js} +1 -1
- package/dist/rcs-web/assets/{linear-zW0xy8Vx.js → linear-BkfmaOFV.js} +1 -1
- package/dist/rcs-web/assets/{main-Cmt5Bx4n.js → main-2FF76CHO.js} +58 -58
- package/dist/rcs-web/assets/{mermaid-VLURNSYL-DWAG6oY9.js → mermaid-VLURNSYL-CAb8MsJr.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-BaQbfV6b.js → mermaid.core-dT6jK4cB.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-mV3CmTd-.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-KBR776rc.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-b6H9mmnO.js → pieDiagram-4H26LBE5-aGUqFGVT.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-BRD9QNPh.js → quadrantDiagram-W4KKPZXB-DbWbBGjW.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-CyhGkHSk.js → requirementDiagram-4Y6WPE33-CRIIsSnh.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-Dc7zSCp0.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-5xTDzgqj.js → sequenceDiagram-3UESZ5HK-DpwCRJwm.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CM5SjDk5.js → stateDiagram-AJRCARHV-Dx-tpSSo.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-BVU9LVsH.js → stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-DbLe-_KB.js → timeline-definition-PNZ67QCA-CUVrbUF6.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/vennDiagram-CIIHVFJN-CE3RaCv3.js → dist/rcs-web/assets/vennDiagram-CIIHVFJN-Bjoy1hva.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Bl3rIzYJ.js → wardleyDiagram-YWT4CUSO-Xv7_ml_a.js} +1 -1
- package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-BdfXvNSc.js → xychartDiagram-2RQKCTM6-CMv6nVsy.js} +1 -1
- package/dist/rcs-web/index.html +1 -1
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/routes.test.ts +46 -0
- package/packages/remote-control-server/src/__tests__/services.test.ts +8 -0
- package/packages/remote-control-server/src/__tests__/ws-handler.test.ts +29 -0
- package/packages/remote-control-server/src/routes/web/sessions.ts +20 -32
- package/packages/remote-control-server/src/services/session-clear.ts +49 -0
- package/packages/remote-control-server/src/services/session.ts +12 -0
- package/packages/remote-control-server/src/transport/ws-handler.ts +14 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-Ox9LWuFz.js → AdminPanel-8HNxSZw0.js} +1 -1
- package/{dist/rcs-web/assets/ArtifactView-B7a8Khfb.js → packages/remote-control-server/web/dist/assets/ArtifactView-2di4r0Cr.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-CnV0vYtl.js → ArtifactsGallery-DQj98ptl.js} +2 -2
- package/{dist/rcs-web/assets/Claim-Ck2lSDQo.js → packages/remote-control-server/web/dist/assets/Claim-Dfdhnggp.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Dashboard-C60GVEEA.js → Dashboard-DnLE2gtW.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Join-B-PK9ZgC.js → Join-Cgq7v-Sb.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-DQ6FPOKM.js → Login-CpRVSamw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-U7f5H-s4.js → Register-CvCuP-ww.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-CTa4JN6V.js +60 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-DCKNddif.js → SessionVisibilityBadge-7ElYQ4hP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Setup-DdUvqcnS.js → Setup-DH5NCalW.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-BIZozDi0.js → ShareLanding-B48Z1tak.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamCreate-DTEQa91s.js → TeamCreate-tXM5yKmq.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamDetail-DSbAaI5T.js → TeamDetail-3jPhrX5z.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamList-B8CkSRFk.js → TeamList-DylGNt59.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-afAMifTT.js → TeamSettings-CoBx_q55.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-CCwTLowu.js → UserSearchInput-DM6V0r1B.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSettings-BS14QbPw.js → UserSettings-CxuLje2z.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-D92zl5sb.js → arc-BrQup1CU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-BFS0ptEo.js → architectureDiagram-3BPJPVTR-l1NuwJAC.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-BcDcn0zW.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-CfTZRvdU.js → c4Diagram-AAUBKEIU-C8IgW5pQ.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-DqfyWDcz.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-D7uMaXAF.js → chunk-2J33WTMH-Cz-fnX8Q.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-Cl8kGA_R.js → chunk-4BX2VUAB-s0k1FsPS.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-B4zl1V4D.js → chunk-55IACEB6-k7MztSxj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-727SXJPM-DlSsa2cu.js → chunk-727SXJPM-DCD6b_gA.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-C1rrenok.js → chunk-AQP2D5EJ-ByLnKNaa.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DyKwyEWK.js → chunk-FMBD7UC4-DnoA9fQr.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-1AD_FvlP.js → chunk-ND2GUHAM-BsbvPHC6.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-EdHsPut0.js → chunk-QZHKN3VN-DnHGOmkn.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-CFM8l45C.js → code-block-IT6T5CEO-Br6udBTB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-CxPcy5Mr.js → copy-BFkM6GS4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-DIM61nZa.js → cose-bilkent-S5V4N54A-ChN-rm-T.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-kszq2R0H.js → dagre-BM42HDAG-Dy0qgRIV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-CYJKb2wC.js → diagram-2AECGRRQ-ByiBm-x4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-Czogc4aD.js → diagram-5GNKFQAL-rGbxhf-H.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-CkIjVAxE.js → diagram-KO2AKTUF-COdwodvi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-DGjTtYRO.js → diagram-LMA3HP47-EjqjzeZY.js} +1 -1
- package/{dist/rcs-web/assets/diagram-OG6HWLK6-CG5exhuD.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-DSPVSdmJ.js} +1 -1
- package/{dist/rcs-web/assets/dialog-BU8x6OfJ.js → packages/remote-control-server/web/dist/assets/dialog-aHICCHyK.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-BXY3YoP3.js → erDiagram-TEJ5UH35-DZBAaLMb.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{external-link-BlJ3ree6.js → external-link-Cb0Qh2uy.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-C6V4IR9e.js → flowDiagram-I6XJVG4X-DJHAIGo5.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-BuvlJCin.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js} +1 -1
- package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BWi6Gk9P.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-C4E3g5J9.js → infoDiagram-5YYISTIA-n-NVaNrp.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-RwMP4JwJ.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-D7nU29iu.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-C3EZeQ-B.js → journeyDiagram-JHISSGLW-De0htrHG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-EFaG-oyy.js → kanban-definition-UN3LZRKU-C5rnfLlw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-zW0xy8Vx.js → linear-BkfmaOFV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{main-Cmt5Bx4n.js → main-2FF76CHO.js} +58 -58
- package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-DWAG6oY9.js → mermaid-VLURNSYL-CAb8MsJr.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-BaQbfV6b.js → mermaid.core-dT6jK4cB.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-mV3CmTd-.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-KBR776rc.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-b6H9mmnO.js → pieDiagram-4H26LBE5-aGUqFGVT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-BRD9QNPh.js → quadrantDiagram-W4KKPZXB-DbWbBGjW.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-CyhGkHSk.js → requirementDiagram-4Y6WPE33-CRIIsSnh.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-Dc7zSCp0.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-5xTDzgqj.js → sequenceDiagram-3UESZ5HK-DpwCRJwm.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CM5SjDk5.js → stateDiagram-AJRCARHV-Dx-tpSSo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-BVU9LVsH.js → stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-DbLe-_KB.js → timeline-definition-PNZ67QCA-CUVrbUF6.js} +1 -1
- package/{dist/rcs-web/assets/vennDiagram-CIIHVFJN-CE3RaCv3.js → packages/remote-control-server/web/dist/assets/vennDiagram-CIIHVFJN-Bjoy1hva.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Bl3rIzYJ.js → wardleyDiagram-YWT4CUSO-Xv7_ml_a.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-BdfXvNSc.js → xychartDiagram-2RQKCTM6-CMv6nVsy.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +1 -1
- package/dist/rcs-web/assets/SessionDetail-_9-CUGIK.js +0 -60
- package/dist/rcs-web/assets/channel-YxmbxUMR.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BGm2vpEN.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BGm2vpEN.js +0 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-_9-CUGIK.js +0 -60
- package/packages/remote-control-server/web/dist/assets/channel-YxmbxUMR.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BGm2vpEN.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BGm2vpEN.js +0 -1
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var lt=Object.defineProperty;var ct=(s,t,r)=>t in s?lt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var T=(s,t,r)=>ct(s,typeof t!="symbol"?t+"":t,r);import{e as u,j as e}from"./vendor-DE_-CLIE.js";import{ab as P,_ as dt,aj as ut,a5 as mt,af as pe,a4 as O,$ as xt,x as Pe,g as ve,ae as qe,L as De,z as pt,w as ht,ad as $,a9 as J,d as Ue,am as _e,a0 as ft,J as yt,a3 as gt,aq as Oe,al as k,A as bt,ag as jt,G as wt,an as kt,ac as Nt,N as vt,a1 as _t,y as Fe,P as St,F as Ct,c as Mt,C as Et,R as Se,Z as Tt,ai as Rt,D as At,a as $t,q as Le,s as He,v as It,f as ze,e as Be,r as Ve,M as Pt}from"./main-Cmt5Bx4n.js";import{g as qt}from"./workerType-Bd-zteMi.js";import{D as We,a as Qe,c as Ge,d as Ke,b as Dt}from"./dialog-BU8x6OfJ.js";import{E as Ut}from"./external-link-BlJ3ree6.js";import{S as Ot}from"./SessionVisibilityBadge-DCKNddif.js";import{U as Ft}from"./UserSearchInput-CCwTLowu.js";import{ArtifactsGallery as Lt}from"./ArtifactsGallery-CnV0vYtl.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";import"./copy-CxPcy5Mr.js";/**
|
|
2
|
-
* @license lucide-react v0.555.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ht=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],zt=P("activity",Ht);/**
|
|
7
|
-
* @license lucide-react v0.555.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Bt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vt=P("chevron-right",Bt);/**
|
|
12
|
-
* @license lucide-react v0.555.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Wt=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Ye=P("cpu",Wt);/**
|
|
17
|
-
* @license lucide-react v0.555.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Qt=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Gt=P("hash",Qt);/**
|
|
22
|
-
* @license lucide-react v0.555.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Kt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Yt=P("info",Kt);/**
|
|
27
|
-
* @license lucide-react v0.555.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Jt=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],Xt=P("message-square-text",Jt);/**
|
|
32
|
-
* @license lucide-react v0.555.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const Zt=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],es=P("play",Zt);/**
|
|
37
|
-
* @license lucide-react v0.555.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const ts=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],ss=P("server-cog",ts);/**
|
|
42
|
-
* @license lucide-react v0.555.0 - ISC
|
|
43
|
-
*
|
|
44
|
-
* This source code is licensed under the ISC license.
|
|
45
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const ns=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],rs=P("share-2",ns);/**
|
|
47
|
-
* @license lucide-react v0.555.0 - ISC
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the ISC license.
|
|
50
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const as=[["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 12 2 2 4-4",key:"dzmm74"}]],os=P("shield-check",as);/**
|
|
52
|
-
* @license lucide-react v0.555.0 - ISC
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the ISC license.
|
|
55
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const is=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ls=P("triangle-alert",is);function Je(){return{tasks:{}}}const Ce=3e4;function re(s){const t=s.trim();if(!t)return"agent";const r=t.split(/\s+/).slice(0,2).join(" ");return r.length>40?r.slice(0,40)+"…":r}function cs(s,t){var d,x,p,m,g,j,w,_,a,o,f,y;const r=t.subtype;if(r!=="task_started"&&r!=="task_progress"&&r!=="task_notification")return s;const n=t.task_id;if(!n)return s;const l=Date.now(),c=s.tasks[n];if(r==="task_started"){if(c)return{tasks:{...s.tasks,[n]:{...c,description:t.description??c.description,name:re(t.description??c.description),taskType:t.task_type??c.taskType,workflowName:t.workflow_name??c.workflowName,prompt:t.prompt??c.prompt,toolUseId:t.tool_use_id??c.toolUseId,status:"running",startTime:l,evictAfter:void 0}}};const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:re(b),description:b,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:l}}}}if(r==="task_progress"){if(!c){const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:re(b),description:b,toolUseId:t.tool_use_id,status:"running",startTime:l,tokenCount:(d=t.usage)==null?void 0:d.total_tokens,toolUseCount:(x=t.usage)==null?void 0:x.tool_uses,durationMs:(p=t.usage)==null?void 0:p.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...s.tasks,[n]:{...c,description:t.description??c.description,tokenCount:((m=t.usage)==null?void 0:m.total_tokens)??c.tokenCount,toolUseCount:((g=t.usage)==null?void 0:g.tool_uses)??c.toolUseCount,durationMs:((j=t.usage)==null?void 0:j.duration_ms)??c.durationMs,lastToolName:t.last_tool_name??c.lastToolName,summary:t.summary??c.summary}}}}return c?{tasks:{...s.tasks,[n]:{...c,status:t.status??"completed",endTime:l,finalSummary:t.summary??c.finalSummary,outputFile:t.output_file??c.outputFile,tokenCount:((o=t.usage)==null?void 0:o.total_tokens)??c.tokenCount,toolUseCount:((f=t.usage)==null?void 0:f.tool_uses)??c.toolUseCount,durationMs:((y=t.usage)==null?void 0:y.duration_ms)??c.durationMs,evictAfter:l+Ce}}}:{tasks:{...s.tasks,[n]:{taskId:n,name:re(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:l,endTime:l,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(w=t.usage)==null?void 0:w.total_tokens,toolUseCount:(_=t.usage)==null?void 0:_.tool_uses,durationMs:(a=t.usage)==null?void 0:a.duration_ms,evictAfter:l+Ce}}}}function ds(s,t=Date.now()){return Object.values(s.tasks).filter(r=>r.evictAfter===void 0||r.evictAfter>t).sort((r,n)=>r.startTime-n.startTime)}class us{constructor(){T(this,"listeners",new Set);T(this,"eventSource",null);T(this,"_lastSeqNum",0)}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}connect(t){this.disconnect();const r=`/web/sessions/${t}/events`,n=new EventSource(r,{withCredentials:!0});this.eventSource=n,n.addEventListener("message",l=>{try{const c=JSON.parse(l.data);if(c.seqNum!==void 0&&c.seqNum<=this._lastSeqNum)return;c.seqNum!==void 0&&(this._lastSeqNum=c.seqNum);for(const d of this.listeners)d(c)}catch{}})}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._lastSeqNum=0}}const he=new us;function Me(s){if(typeof s.content=="string")return s.content;if(s.message&&typeof s.message=="object"){const t=s.message;if(typeof t.content=="string")return t.content;if(Array.isArray(t.content))return t.content.filter(r=>r.type==="text"&&typeof r.text=="string").map(r=>r.text).join("")}return""}function Ee(s,t){for(let r=s.length-1;r>=0;r--){const n=s[r];if(n&&n.type==="tool_call"&&n.toolCall.id===t)return r}return-1}const fe="streaming-";function ms(s){const t=s.message;if(!t||typeof t!="object"||!Array.isArray(t.content))return"";const r=[];for(const n of t.content)if((n==null?void 0:n.type)==="thinking"){const l=typeof n.thinking=="string"&&n.thinking||typeof n.text=="string"&&n.text||"";l&&r.push(l)}return r.join("")}function Te(s){return s.filter(t=>typeof t.subject=="string"&&t.subject).map(t=>({content:t.subject,priority:"medium",status:t.status==="completed"?"completed":t.status==="in_progress"?"in_progress":"pending"}))}class xs{constructor(t,r,n){T(this,"sessionId");T(this,"setEntries");T(this,"unsub",null);T(this,"onStatusChange");T(this,"onError");T(this,"onPermissionRequest");T(this,"onModelsStateChange");T(this,"onSubagentUpdate");T(this,"onControlResponse");T(this,"onPermissionModeChange");T(this,"onUsageChange");T(this,"onElicitationRequest");T(this,"subagentState",Je());T(this,"seenUuids",new Set);T(this,"seenToolCallIds",new Set);T(this,"pendingControlRequests",new Map);T(this,"turnEnded",!1);T(this,"userSinceTurnEnd",!1);this.sessionId=t,this.setEntries=r,this.onStatusChange=n==null?void 0:n.onStatusChange,this.onError=n==null?void 0:n.onError,this.onPermissionRequest=n==null?void 0:n.onPermissionRequest,this.onModelsStateChange=n==null?void 0:n.onModelsStateChange,this.onSubagentUpdate=n==null?void 0:n.onSubagentUpdate,this.onControlResponse=n==null?void 0:n.onControlResponse,this.onPermissionModeChange=n==null?void 0:n.onPermissionModeChange,this.onUsageChange=n==null?void 0:n.onUsageChange,this.onElicitationRequest=n==null?void 0:n.onElicitationRequest}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var m,g,j;const{events:t}=await dt(this.sessionId);if(!t||t.length===0)return;const r=[];let n=null;const l=()=>{n&&(r.push(n),n=null)};for(const w of t){if(/Remote Control connecting/i.test(JSON.stringify(w)))continue;const _=w.payload||{},a=_.uuid;if(typeof a=="string"&&a&&this.seenUuids.add(a),w.type==="tool_use"){const o=_.tool_call_id;typeof o=="string"&&o&&this.seenToolCallIds.add(o)}if(w.type==="user"){if(w.direction==="inbound")continue;l();const o=Me(_);o&&r.push({type:"user_message",id:w.id||`hist-user-${r.length}`,content:o})}else if(w.type==="assistant"){l();const o=Me(_),f=[],y=_.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){for(const b of y.content)if(b.type==="tool_use"){const N=b.id;N&&this.seenToolCallIds.add(N),f.push({type:"tool_call",toolCall:{id:N||`hist-tool-${r.length}`,title:b.name||"tool",status:"complete",rawInput:b.input||{}}})}}if(o||f.length>0){n={type:"assistant_message",id:w.id||`hist-asst-${r.length}`,chunks:o?[{type:"message",text:o}]:[]},r.push(n);for(const b of f)r.push(b);n=null}}else if(w.type==="tool_use"){const o=_,f={type:"tool_call",toolCall:{id:o.tool_call_id||`hist-tool-${r.length}`,title:o.tool_name||"tool",status:"complete",rawInput:o.tool_input||{}}};r.push(f)}else if(w.type==="tool_result"){const o=_,f=Ee(r,o.tool_call_id||"");if(f>=0){const y=r[f];r[f]={type:"tool_call",toolCall:{...y.toolCall,rawOutput:{output:o.content||o.output||""}}}}}}l();let c=null;for(const w of t){if(w.type!=="task_state")continue;const _=w.payload||{};Array.isArray(_.tasks)&&(c=_.tasks)}if(c&&c.length>0){const w=Te(c);w.length>0&&r.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:w})}this.setEntries(r);let d=null,x=null,p=null;for(const w of t){const _=w.payload||{};if(w.type==="user"?p="user":(w.type==="result"||w.type==="result_success"||w.type==="interrupt")&&(p="turn_end"),w.type==="models_state"){const a=_.raw,o=a&&typeof a=="object"?a.models_state:_.models_state;o&&Array.isArray(o.availableModels)&&typeof o.currentModelId=="string"&&(d=o)}else if(w.type==="result"||w.type==="result_success"){const a=_.usage,o=typeof _.total_cost_usd=="number"?_.total_cost_usd:null;(a||o!==null)&&(x={inputTokens:((a==null?void 0:a.input_tokens)??0)+((a==null?void 0:a.cache_read_input_tokens)??0)+((a==null?void 0:a.cache_creation_input_tokens)??0),outputTokens:(a==null?void 0:a.output_tokens)??0,totalCostUsd:o})}}d&&((m=this.onModelsStateChange)==null||m.call(this,d)),x&&((g=this.onUsageChange)==null||g.call(this,x)),this.turnEnded=p==="turn_end",this.userSinceTurnEnd=p==="user",this.turnEnded&&((j=this.onStatusChange)==null||j.call(this,"idle"))}connectSSE(){he.connect(this.sessionId),this.unsub=he.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),he.disconnect()}handleEvent(t){var c,d,x,p,m,g,j,w,_;const r=t.type,n=t.payload||{},l=JSON.stringify(t);if(!/Remote Control connecting/i.test(l))switch(r){case"user":{this.userSinceTurnEnd=!0;break}case"assistant":{const a=n.uuid;if(typeof a=="string"&&a){if(this.seenUuids.has(a))break;this.seenUuids.add(a)}const o=typeof n.content=="string"?n.content:"",f=ms(n);this.setEntries(b=>{const N=b[b.length-1];if((N==null?void 0:N.type)==="assistant_message"&&N.id.startsWith(fe))return[...b.slice(0,-1),{...N,id:`assistant-${Date.now()}`,chunks:[...f?[{type:"thought",text:f}]:[],{type:"message",text:o}]}];if((N==null?void 0:N.type)==="assistant_message"){const M=N.chunks[N.chunks.length-1];return(M==null?void 0:M.type)==="message"?[...b.slice(0,-1),{...N,chunks:[...N.chunks.slice(0,-1),{type:"message",text:M.text+o}]}]:[...b.slice(0,-1),{...N,chunks:[...N.chunks,{type:"message",text:o}]}]}if(o&&o.trim()||f){const M={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...f?[{type:"thought",text:f}]:[],...o?[{type:"message",text:o}]:[]]};return[...b,M]}return b});const y=n.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){const b=y.content.filter(N=>N.type==="tool_use");for(const N of b){const M=N.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(M))continue;this.seenToolCallIds.add(M);const R={id:M,title:N.name||"tool",status:"running",rawInput:N.input||{}};this.setEntries(E=>[...E,{type:"tool_call",toolCall:R}])}}break}case"tool_use":{const a=n,o=a.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(o))break;this.seenToolCallIds.add(o);const f={id:o,title:a.tool_name||"tool",status:"running",rawInput:a.tool_input||{}};this.setEntries(y=>[...y,{type:"tool_call",toolCall:f}]);break}case"tool_result":{const a=n,o=a.tool_call_id||"";this.setEntries(f=>{const y=Ee(f,o);if(y<0)return f;const b=f[y];return f.map((N,M)=>M===y?{type:"tool_call",toolCall:{...b.toolCall,status:"complete",rawOutput:{output:a.content||a.output||""}}}:N)});break}case"control_request":case"permission_request":{const a=n.request;if(a&&a.subtype==="can_use_tool"){const o=n.request_id||"",f=a.tool_name||"unknown",y=a.input||a.tool_input||{},b=a.description||"",N=Array.isArray(a.permission_suggestions)?a.permission_suggestions:[];this.setEntries(M=>{const R=[...M].reverse().findIndex(E=>E.type==="tool_call");if(R>=0){const E=M.length-1-R,D=M[E];if(D.toolCall.status==="running")return M.map((H,W)=>W===E?{type:"tool_call",toolCall:{...D.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:o,options:[]}}}:H)}return M}),(c=this.onPermissionRequest)==null||c.call(this,{requestId:o,toolName:f,toolInput:y,description:b,suggestions:N})}else a&&a.subtype==="elicitation"&&((d=this.onElicitationRequest)==null||d.call(this,{requestId:n.request_id||"",serverName:a.mcp_server_name||"",message:a.message||"",mode:a.mode==="url"?"url":"form",url:typeof a.url=="string"?a.url:void 0,requestedSchema:a.requested_schema||void 0}));break}case"session_status":{if(ut(n)){this.setEntries([]);break}if(typeof n.status=="string"){if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(x=this.onStatusChange)==null||x.call(this,n.status)}break}case"error":{const a=String(n.message||n.content||"Unknown error");(p=this.onError)==null||p.call(this,a);break}case"models_state":{const a=n.raw,o=typeof a=="object"&&a!==null?a.models_state:n.models_state;o&&Array.isArray(o.availableModels)&&typeof o.currentModelId=="string"&&((m=this.onModelsStateChange)==null||m.call(this,o));break}case"system":{const a=n.raw,o=a&&typeof a=="object"?a:n,f=typeof o.subtype=="string"?o.subtype:void 0;if(f==="task_started"||f==="task_progress"||f==="task_notification"){const b={subtype:f,task_id:typeof o.task_id=="string"?o.task_id:void 0,tool_use_id:typeof o.tool_use_id=="string"?o.tool_use_id:void 0,description:typeof o.description=="string"?o.description:void 0,task_type:typeof o.task_type=="string"?o.task_type:void 0,workflow_name:typeof o.workflow_name=="string"?o.workflow_name:void 0,prompt:typeof o.prompt=="string"?o.prompt:void 0,usage:o.usage&&typeof o.usage=="object"?o.usage:void 0,last_tool_name:typeof o.last_tool_name=="string"?o.last_tool_name:void 0,summary:typeof o.summary=="string"?o.summary:void 0,status:o.status==="completed"||o.status==="failed"||o.status==="stopped"?o.status:void 0,output_file:typeof o.output_file=="string"?o.output_file:void 0};this.subagentState=cs(this.subagentState,b)}const y=typeof o.permissionMode=="string"?o.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;y&&((g=this.onPermissionModeChange)==null||g.call(this,y));break}case"control_response":{const a=n.response;if(a&&typeof a=="object"){const o=typeof a.request_id=="string"?a.request_id:"",f=typeof a.subtype=="string"?a.subtype:"";if(o){(j=this.onControlResponse)==null||j.call(this,{subtype:f,requestId:o,error:typeof a.error=="string"?a.error:void 0});const y=this.pendingControlRequests.get(o);y&&(this.pendingControlRequests.delete(o),y(f==="success"&&a.response&&typeof a.response=="object"?a.response:null))}}break}case"stream_event":{const a=n.event;if(!a||typeof a.type!="string")break;if(a.type==="content_block_delta"){const o=a.delta;if(!o||typeof o.type!="string")break;const f=o.type==="text_delta"?"message":o.type==="thinking_delta"?"thought":null;if(!f)break;const y=o.text??o.thinking;if(typeof y!="string"||!y)break;this.appendStreamingDelta(f,y)}break}case"partial_assistant":{const a=typeof n.content=="string"?n.content:"";a&&this.appendStreamingDelta("message",a);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,(w=this.onStatusChange)==null||w.call(this,"idle");const a=n.usage,o=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(a||o!==null){const f=((a==null?void 0:a.input_tokens)??0)+((a==null?void 0:a.cache_read_input_tokens)??0)+((a==null?void 0:a.cache_creation_input_tokens)??0);(_=this.onUsageChange)==null||_.call(this,{inputTokens:f,outputTokens:(a==null?void 0:a.output_tokens)??0,totalCostUsd:o})}break}case"task_state":{const a=Array.isArray(n.tasks)?n.tasks:[];if(a.length===0)break;const o=Te(a);if(o.length===0)break;this.setEntries(f=>[...f.filter(b=>b.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:o}]);break}}}appendStreamingDelta(t,r){this.setEntries(n=>{const l=n[n.length-1];if((l==null?void 0:l.type)==="assistant_message"&&l.id.startsWith(fe)){const d=l.chunks[l.chunks.length-1];return(d==null?void 0:d.type)===t?[...n.slice(0,-1),{...l,chunks:[...l.chunks.slice(0,-1),{type:t,text:d.text+r}]}]:[...n.slice(0,-1),{...l,chunks:[...l.chunks,{type:t,text:r}]}]}const c={type:"assistant_message",id:`${fe}${Date.now()}`,chunks:[{type:t,text:r}]};return[...n,c]})}async sendMessage(t,r,n){const l=r&&r.length>0,c=n&&n.length>0;if(!t.trim()&&!l&&!c)return;const d={type:"user_message",id:`user-${Date.now()}`,content:t,images:l?r:void 0,attachments:c?n:void 0};this.setEntries(m=>[...m,d]);const x=[];if(t&&x.push({type:"text",text:t}),l)for(const m of r)x.push({type:"image",source:{type:"base64",media_type:m.mimeType,data:m.data}});if(c){for(const m of n)if(m.kind==="text"||m.kind==="table"){const g=`📎 ${m.name}${m.size!=null?` (${ps(m.size)})`:""}`,j=m.textContent||"(空文件)";x.push({type:"text",text:`${g}
|
|
57
|
-
\`\`\`
|
|
58
|
-
${j}
|
|
59
|
-
\`\`\``})}else if(m.kind==="directory"){const g=`📁 目录: ${m.name}${m.files!=null?` (${m.files.length} 个文件)`:""}`,j=m.textContent||"(空目录)";x.push({type:"text",text:`${g}
|
|
60
|
-
${j}`})}}const p=x.length===1&&x[0].type==="text"?x[0].text||t:x.length>0?x:t;await mt(this.sessionId,{type:"user",uuid:pe(),content:t,message:{content:p}})}async respondPermission(t,r,n){await O(this.sessionId,{type:"permission_response",approved:r,request_id:t,...n}),this.setEntries(l=>l.map(c=>{var d;return c.type!=="tool_call"||((d=c.toolCall.permissionRequest)==null?void 0:d.requestId)!==t?c:{type:"tool_call",toolCall:{...c.toolCall,status:r?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.setEntries(t=>t.map(r=>r.type!=="tool_call"||r.toolCall.status!=="running"&&r.toolCall.status!=="waiting_for_confirmation"?r:{type:"tool_call",toolCall:{...r.toolCall,status:"canceled",permissionRequest:void 0}})),await xt(this.sessionId)}async setPermissionMode(t){const r=pe();return await O(this.sessionId,{type:"control_request",request_id:r,request:{subtype:"set_permission_mode",mode:t}}),r}async searchFiles(t,r=20){const n=pe(),l=new Promise(d=>{this.pendingControlRequests.set(n,d)});await O(this.sessionId,{type:"control_request",request_id:n,request:{subtype:"file_search",query:t,limit:r}});const c=setTimeout(()=>{const d=this.pendingControlRequests.get(n);d&&(this.pendingControlRequests.delete(n),d(null))},8e3);try{const d=await l;if(!d||!Array.isArray(d.suggestions))return[];const x=[];for(const p of d.suggestions)p&&typeof p=="object"&&typeof p.path=="string"&&x.push(p.path);return x}finally{clearTimeout(c)}}async respondElicitation(t,r,n){await O(this.sessionId,{type:"permission_response",approved:r==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:r,...n?{content:n}:{}}}})}}function ps(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function hs(s){if(!s)return"never";const t=Math.max(0,Date.now()-s);return t<5e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function fs(s){return s?Date.now()-s<6e4:!1}function ys({onClose:s,session:t,liveStatus:r,pendingPermissions:n,onInterrupt:l,onDelete:c}){const[d,x]=u.useState(!1),p=async()=>{await navigator.clipboard.writeText(t.id),x(!0),setTimeout(()=>x(!1),1500)},m=n.length,g=t.worker,j=t.work_item,w=t.environment;return e.jsx(We,{open:!0,onOpenChange:_=>{_||s()},children:e.jsxs(Qe,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-96 h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md overflow-y-auto",children:[e.jsx(Ge,{children:e.jsx(Ke,{className:"font-display font-semibold text-text-primary",children:"Session Ops"})}),e.jsxs("div",{className:"mt-3 space-y-5 text-sm",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(zt,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{status:r||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:g&&(fs(g.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[g&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:hs(g.last_heartbeat_at)})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Ye,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:w.machine_name||w.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(ve,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:qe(t.created_at)})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(De,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),m>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[m," permission request",m>1?"s":""," awaiting your approval"]}):e.jsx("p",{className:"text-xs text-text-muted",children:"No pending actions"})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(ss,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:l,className:"flex-1 rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-2 transition-colors",children:"Interrupt"}),e.jsxs("button",{onClick:c,className:"flex-1 rounded-md border border-status-error/30 px-3 py-1.5 text-xs text-status-error hover:bg-status-error/10 transition-colors",children:[e.jsx(pt,{className:"mr-1 inline h-3 w-3"}),"Delete"]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(Gt,{className:"h-3.5 w-3.5"}),"Session Info"]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("dt",{children:"Session ID"}),e.jsxs("dd",{className:"flex items-center gap-1 min-w-0",children:[e.jsx("code",{className:"break-all font-mono text-text-secondary text-right",children:t.id}),e.jsx("button",{onClick:p,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:d?"✓":"⧉"})]})]}),j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Spawn mode"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:j.spawn_mode??"default"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Work state"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:j.state})]})]}),t.source&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Source"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:t.source})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:w.worker_type})]})]})]})]})]})})}const Re="rcs:subagent-panel:collapsed";function gs(s){if(s<1e3)return"0s";const t=Math.floor(s/1e3);if(t<60)return`${t}s`;const r=Math.floor(t/60),n=t%60;if(r<60)return n?`${r}m${n}s`:`${r}m`;const l=Math.floor(r/60),c=r%60;return c?`${l}h${c}m`:`${l}h`}function bs(s){return s===void 0||s<=0?"":s<1e3?`${s}`:s<1e6?`${(s/1e3).toFixed(s<1e4?1:0)}k`:`${(s/1e6).toFixed(1)}M`}function js({status:s}){return s==="running"?e.jsx(De,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(es,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(ht,{className:"h-3 w-3 text-status-error"}):null}function ws({task:s}){const t=s.status==="running",r=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,n=bs(s.tokenCount),l=s.toolUseCount!==void 0&&s.toolUseCount>0?`${s.toolUseCount} tool${s.toolUseCount>1?"s":""}`:"",c=s.summary||s.description||"(no description)";return e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-xs",children:[e.jsx("div",{className:"mt-0.5 flex-shrink-0",children:e.jsx(js,{status:s.status})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:s.name}),e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:gs(r)})]}),e.jsx("div",{className:"mt-0.5 truncate text-text-secondary",children:c}),(n||l||s.lastToolName)&&e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-text-muted",children:[n&&e.jsxs("span",{children:["↕ ",n," tok"]}),l&&e.jsxs("span",{children:["· ",l]}),s.lastToolName&&e.jsxs("span",{className:"truncate",children:["· last: ",s.lastToolName]})]}),!t&&s.finalSummary&&e.jsx("div",{className:"mt-1 rounded bg-status-success/10 px-1.5 py-0.5 text-[10px] text-status-success",children:s.finalSummary})]})]})}function ks({state:s}){const[t,r]=u.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Re)==="1"}catch{return!1}}),n=()=>{r(p=>{const m=!p;try{window.localStorage.setItem(Re,m?"1":"0")}catch{}return m})},[,l]=u.useState(0);u.useEffect(()=>{const p=Object.values(s.tasks).some(j=>j.status==="running"),m=Object.values(s.tasks).some(j=>j.status!=="running"&&j.evictAfter!==void 0);if(!p&&!m)return;const g=setInterval(()=>{l(j=>j+1)},1e3);return()=>clearInterval(g)},[s]);const c=ds(s);if(c.length===0)return null;const d=c.filter(p=>p.status==="running").length,x=d>0?`${d} running`:`${c.length} recent`;return e.jsx("section",{"aria-label":"Subagents",className:"border-t border-border bg-surface-1 px-4 py-2",children:e.jsxs("div",{className:"mx-auto max-w-3xl space-y-1.5",children:[e.jsxs("button",{type:"button",onClick:n,"aria-expanded":!t,"aria-controls":"subagent-list",className:"flex w-full items-center justify-between text-[10px] font-medium uppercase tracking-wide text-text-muted hover:text-text-secondary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Vt,{className:`h-3 w-3 transition-transform ${t?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:x})]}),!t&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:c.map(p=>e.jsx(ws,{task:p},p.taskId))})]})})}function Ae(s,t){var l;const r=(l=t==null?void 0:t.find(c=>c.type==="addRules"||c.type==="replaceRules"))==null?void 0:l.rules,n=r==null?void 0:r[0];return n!=null&&n.ruleContent?`${n.toolName}(${n.ruleContent})`:n!=null&&n.toolName?n.toolName:s}function Ns({requestId:s,toolName:t,toolInput:r,description:n,suggestions:l,onApprove:c,onApproveAlways:d,onReject:x}){const p=typeof r=="string"?r:JSON.stringify(r,null,2),m=Array.isArray(l)&&l.length>0;return e.jsxs("div",{className:"rounded-xl border border-warning-border/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-warning-border/15 text-warning-text",children:e.jsx(ls,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold text-warning-text",children:"Permission Request"})]}),n&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:$(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:$(t)}),t!=="AskUserQuestion"&&e.jsx("pre",{className:"mb-3 max-h-40 overflow-auto rounded-lg bg-surface-1 p-2 text-xs text-text-secondary font-mono",children:_e(p,500)}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:c,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Approve"}),m&&d&&e.jsxs("button",{onClick:d,className:"flex items-center gap-1.5 rounded-lg border border-brand/40 bg-brand/10 px-4 py-2 text-sm font-medium text-brand hover:bg-brand/20 transition-colors",title:`允许并记住规则:${Ae(t,l)}`,children:[e.jsx(os,{className:"h-3.5 w-3.5"}),"Always allow ",_e(Ae(t,l),40)]}),e.jsx("button",{onClick:x,className:"rounded-lg bg-status-error/20 px-4 py-2 text-sm font-medium text-status-error hover:bg-status-error/30 transition-colors",children:"Reject"})]})]})}function vs({questions:s,description:t,onSubmit:r,onSkip:n}){const[l,c]=u.useState({}),[d,x]=u.useState({}),[p,m]=u.useState(0),g=(a,o,f)=>{if(f){const y=l[a]||[],b=y.includes(o)?y.filter(N=>N!==o):[...y,o];c({...l,[a]:b})}else c({...l,[a]:o})},j=a=>{var f;const o=(f=d[a])==null?void 0:f.trim();o&&(c({...l,[a]:o}),x({...d,[a]:""}))},w=()=>{var o,f;const a={};for(const[y,b]of Object.entries(l)){const N=s[parseInt(y,10)];N&&(typeof b=="number"?a[y]=((f=(o=N.options)==null?void 0:o[b])==null?void 0:f.label)||String(b):Array.isArray(b)?a[y]=b.map(M=>{var R,E;return((E=(R=N.options)==null?void 0:R[M])==null?void 0:E.label)||String(M)}):a[y]=b)}r(a)};if(s.length<=1){const a=s[0]||{question:t,options:[],multiSelect:!1},o=a.multiSelect||!1;return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:$(t||a.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(a.options||[]).map((f,y)=>{const b=o?(l[0]||[]).includes(y):l[0]===y;return e.jsxs("button",{onClick:()=>g(0,y,o),className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",b?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:$(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:$(f.description)})]},y)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:d[0]||"",onChange:f=>x({...d,0:f.target.value}),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:f=>f.key==="Enter"&&j(0)}),e.jsx("button",{onClick:()=>j(0),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:w,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit"}),e.jsx("button",{onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})}const _=s[p];return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:$(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((a,o)=>e.jsx("button",{onClick:()=>m(o),className:J("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",p===o?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:a.header||`Q${o+1}`},o))}),_&&e.jsx(_s,{question:_,qIdx:p,answers:l,otherTexts:d,onSelect:g,onOtherTextChange:(a,o)=>x({...d,[a]:o}),onOtherSubmit:j}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[p+1," / ",s.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:w,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit All"}),e.jsx("button",{onClick:n,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})]})}function _s({question:s,qIdx:t,answers:r,otherTexts:n,onSelect:l,onOtherTextChange:c,onOtherSubmit:d}){const x=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:$(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((p,m)=>{const g=x?(r[t]||[]).includes(m):r[t]===m;return e.jsxs("button",{onClick:()=>l(t,m,x),className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",g?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:$(p.label)}),p.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:$(p.description)})]},m)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:p=>c(t,p.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:p=>p.key==="Enter"&&d(t)}),e.jsx("button",{onClick:()=>d(t),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]})]})}function Ss({planContent:s,description:t,onSubmit:r}){const[n,l]=u.useState(null),[c,d]=u.useState(""),x=!s||!s.trim(),p=()=>{n&&r(n,n==="no"?c:void 0)};return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand",children:e.jsx(Ue,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold text-text-primary",children:x?"Exit plan mode?":"Ready to code?"})]}),!x&&e.jsx("div",{className:"mb-4 max-h-64 overflow-auto rounded-lg bg-tool-card p-4 text-sm text-text-secondary",dangerouslySetInnerHTML:{__html:Cs(s)}}),e.jsx("div",{className:"space-y-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(Y,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes"}),e.jsx(Y,{selected:n==="no",onClick:()=>l("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{selected:n==="yes-accept-edits",onClick:()=>l("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(Y,{selected:n==="yes-default",onClick:()=>l("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Y,{selected:n==="no",onClick:()=>l("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:c,onChange:m=>d(m.target.value),placeholder:"Tell Saluzi what to change...",className:"mt-3 w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",rows:3}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:p,disabled:!n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Y({selected:s,onClick:t,label:r,desc:n}){return e.jsxs("button",{onClick:t,className:J("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",s?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:J("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",s?"border-brand bg-brand text-white":"border-border"),children:s&&"✓"}),e.jsx("span",{className:"font-medium",children:r})]}),n&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs text-text-muted",children:n})]})}function Cs(s){let t=$(s);return t=t.replace(/```(\w*)\n?([\s\S]*?)```/g,(r,n,l)=>`<pre class="my-2 overflow-x-auto rounded-lg bg-tool-card p-3 font-mono text-xs">${l.trim()}</pre>`),t=t.replace(/`([^`]+)`/g,'<code class="rounded bg-tool-card px-1.5 py-0.5 font-mono text-xs">$1</code>'),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t}function Ms({request:s,onSubmit:t}){const r=Es(s.requestedSchema),n=Ts(s.requestedSchema),[l,c]=u.useState({}),d=r.length===0||n.every(x=>(l[x]??"").trim()!=="");return s.mode==="url"&&s.url?e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx($e,{serverName:s.serverName,message:s.message}),e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex w-full items-center justify-between rounded-lg border border-border bg-surface-2 px-4 py-2.5 text-sm text-brand hover:bg-brand/10 transition-colors",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:s.url}),e.jsx(Ut,{className:"ml-2 h-4 w-4 flex-shrink-0"})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:()=>t("accept"),className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"完成"}),e.jsx("button",{onClick:()=>t("cancel"),className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"取消"})]})]}):e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx($e,{serverName:s.serverName,message:s.message}),r.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:r.map(({name:x,prop:p})=>e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs font-medium text-text-primary",children:x}),n.includes(x)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:"必填"})]}),p.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:$(p.description)}),e.jsx("input",{type:p.type==="number"?"number":"text",value:l[x]??"",onChange:m=>c(g=>({...g,[x]:m.target.value})),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]},x))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const x={};for(const{name:p,prop:m}of r){const g=(l[p]??"").trim();g&&(x[p]=m.type==="number"?Number(g):g)}t("accept",x)},disabled:!d,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"提交"}),e.jsx("button",{onClick:()=>t("decline"),className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"拒绝"})]})]})}function $e({serverName:s,message:t}){return e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand",children:e.jsx(Xt,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-sm font-semibold text-text-primary",children:["MCP 请求输入 ",e.jsx("span",{className:"font-mono text-xs text-text-muted",children:$(s)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:$(t)})]})}function Es(s){const t=s==null?void 0:s.properties;return!t||typeof t!="object"?[]:Object.entries(t).filter(([,r])=>r&&typeof r=="object").map(([r,n])=>({name:r,prop:n}))}function Ts(s){const t=s==null?void 0:s.required;return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function Rs(s){const[t,r]=u.useState([]),[n,l]=u.useState(!0),[c,d]=u.useState(null),x=u.useCallback(async()=>{l(!0),d(null);try{const g=await ft(s);r(g)}catch(g){d(g instanceof Error?g.message:"Failed to load shares")}finally{l(!1)}},[s]);u.useEffect(()=>{x()},[x]);const p=u.useCallback(async g=>{d(null);try{const j=await yt(s,g);return await x(),j}catch(j){throw d(j instanceof Error?j.message:"Failed to create share"),j}},[s,x]),m=u.useCallback(async g=>{d(null);try{await gt(s,g),await x()}catch(j){throw d(j instanceof Error?j.message:"Failed to revoke share"),j}},[s,x]);return{shares:t,isLoading:n,error:c,createShare:p,revokeShare:m,refresh:x}}function As({open:s,onClose:t,sessionId:r,sessionTitle:n}){Oe();const{shares:l,isLoading:c,error:d,createShare:x,revokeShare:p}=Rs(r),[m,g]=u.useState("user"),[j,w]=u.useState(""),[_,a]=u.useState(""),[o,f]=u.useState("read"),[y,b]=u.useState(""),[N,M]=u.useState(!1),[R,E]=u.useState(null),[D,H]=u.useState(""),[W,I]=u.useState(!1),[oe,F]=u.useState(!1);u.useEffect(()=>{s&&(g("user"),w(""),a(""),f("read"),b(""),M(!1),E(null),H(""),I(!1),F(!1))},[s]);const X=async()=>{M(!0),H(""),E(null);try{const S={grantedTo:m==="user"?{userId:j.trim()}:{teamId:_.trim()},permission:o};y.trim()&&(S.expiresAt=y.trim());const G=await x(S);E(`${window.location.origin}/code/s/${G.shareToken}`)}catch(S){H(S instanceof Error?S.message:"Failed to create share")}finally{M(!1)}},B=async S=>{try{await p(S)}catch{}},Q=async()=>{if(!R)return;F(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(R),I(!0),setTimeout(()=>I(!1),2e3);return}}catch{}const S=document.createElement("textarea");S.value=R,S.style.position="fixed",S.style.opacity="0",document.body.appendChild(S),S.select();try{document.execCommand("copy"),I(!0),setTimeout(()=>I(!1),2e3)}catch{F(!0)}document.body.removeChild(S)};return e.jsx(We,{open:s,onOpenChange:S=>{S||t()},children:e.jsxs(Qe,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Ge,{children:e.jsxs(Ke,{className:"font-display text-lg font-semibold text-text-primary",children:[k("share.title"),n?`: ${n}`:""]})}),e.jsxs("div",{className:"space-y-4 min-w-0",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:k("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>g("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${m==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:k("share.user")}),e.jsx("button",{onClick:()=>g("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${m==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:k("share.team")})]}),m==="user"?e.jsx(Ft,{onSelect:w,placeholder:k("share.userIdPlaceholder"),actionLabel:k("share.selectUser")}):e.jsx("input",{type:"text",value:_,onChange:S=>a(S.target.value),placeholder:k("share.teamIdPlaceholder"),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"}),m==="user"&&j&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[k("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:j})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:k("share.permission")}),e.jsxs("select",{value:o,onChange:S=>f(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"read",children:k("share.permissionRead")}),e.jsx("option",{value:"write",children:k("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:k("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:y,onChange:S=>b(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none"})]}),(D||d)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:D||d}),R&&e.jsxs("div",{className:"rounded-md bg-surface-2 px-3 py-2",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-1",children:k("share.linkCreated")}),e.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs text-text-primary",children:R}),e.jsx("button",{onClick:Q,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:W?k("share.copied"):k("share.copy")})]}),oe&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:k("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:k("share.existingShares")}),c?e.jsx("p",{className:"text-sm text-text-muted",children:k("share.loading")}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:k("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:l.map(S=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md bg-surface-2 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:S.granted_to_user||S.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[S.permission==="write"?k("share.permissionWrite"):k("share.permissionRead"),S.expires_at?` · expires ${S.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>B(S.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:k("share.revoke")})]},S.id))})]})]}),e.jsxs(Dt,{children:[e.jsx("button",{onClick:t,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:k("common.close")}),e.jsx("button",{onClick:X,disabled:N||(m==="user"?!j.trim():!_.trim()),className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:N?k("common.creating"):k("share.createShare")})]})]})})}function $s(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Is(s){const t=$s(s),r=jt(),n=r?{proxyUrl:t,token:r}:{proxyUrl:t};return new bt(n)}const V=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"}],ae="rcs_permission_mode";function Ie(s){return s<1e3?String(s):s<1e6?`${(s/1e3).toFixed(1)}k`:`${(s/1e6).toFixed(1)}M`}function Ps(s){const t=V.findIndex(r=>r.value===s);return V[(t+1+V.length)%V.length].value}function qs({models:s,currentModelId:t,onSelect:r,disabled:n}){const[l,c]=u.useState(!1),d=s.find(m=>m.modelId===t)??null,x=s.length>0,p=async m=>{r(m.modelId),c(!1)};return e.jsxs(Le,{open:l,onOpenChange:x?c:void 0,children:[e.jsx(He,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:n||!x,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:"选择模型",children:[e.jsx(Ye,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(d==null?void 0:d.name)??t??"选择模型"}),l?e.jsx(ze,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(Ve,{className:"w-72 p-0",align:"start",children:e.jsx(Pt,{models:s,currentModelId:t,onSelect:p,showSearch:s.length>5})})]})}function Ds({mode:s,onModeChange:t,disabled:r}){const[n,l]=u.useState(!1),c=V.find(d=>d.value===s);return e.jsxs(Le,{open:n,onOpenChange:l,children:[e.jsx(He,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:r,className:"flex items-center gap-1.5 rounded-lg px-2 h-7 text-xs text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed font-display",title:"权限模式(Shift+Tab 循环)",children:[e.jsx(It,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:(c==null?void 0:c.label)??s}),n?e.jsx(ze,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(Ve,{className:"w-64 p-1",align:"start",children:V.map(d=>e.jsxs("button",{type:"button",onClick:()=>{t(d.value),l(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:s===d.value&&e.jsx(Ue,{className:"h-3.5 w-3.5 text-brand"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:d.label}),e.jsx("div",{className:"text-xs text-text-muted",children:d.description})]})]},d.value))})]})}function Xs({sessionId:s,onSessionLoaded:t}){Oe();const[r,n]=u.useState(null),[l,c]=u.useState(null),[d,x]=u.useState(""),[p,m]=u.useState(!1),[g,j]=u.useState(!1),[w,_]=u.useState(!1),[a,o]=u.useState(!1),[f,y]=u.useState([]),[b,N]=u.useState(!1),[M,R]=u.useState([]),[E,D]=u.useState(null),[H,W]=u.useState(()=>Je()),[I,oe]=u.useState(null),[F,X]=u.useState(null),[B,Q]=u.useState([]),[S,G]=u.useState(!1),[ie,ye]=u.useState(""),le=u.useRef(null),[ce,Z]=u.useState(()=>localStorage.getItem(ae)||"default"),[ge,be]=u.useState(null),K=u.useRef(null),U=u.useRef(ce);U.current=ce;const ee=u.useRef(null),je=u.useRef(null),we=u.useRef(f);we.current=f;const te=u.useRef(t);te.current=t;const se=u.useCallback(i=>{be(i),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>be(null),5e3)},[]),de=u.useCallback(i=>{var C;if(i===U.current)return;const h=U.current;U.current=i,Z(i);try{localStorage.setItem(ae,i)}catch{}(C=je.current)==null||C.setPermissionMode(i).then(v=>{ee.current={requestId:v,previous:h}}).catch(v=>{console.error("[SessionDetail] set permission mode failed:",v),se(`模式切换请求发送失败: ${v instanceof Error?v.message:String(v)}`),U.current=h,Z(h)})},[se]),A=u.useMemo(()=>new xs(s,y,{onStatusChange:i=>{c(i),N(i==="running"||i==="requires_action")},onError:i=>{console.error("[RCSChatAdapter] error:",i)},onPermissionRequest:i=>{R(h=>h.some(C=>C.requestId===i.requestId)?h:[...h,i])},onModelsStateChange:i=>{D(i)},onSubagentUpdate:i=>{W(i)},onControlResponse:i=>{const h=ee.current;if(!(!h||h.requestId!==i.requestId)&&(ee.current=null,i.subtype==="error")){U.current=h.previous,Z(h.previous);try{localStorage.setItem(ae,h.previous)}catch{}se(i.error||"模式切换失败")}},onPermissionModeChange:i=>{if(i!==U.current){U.current=i,Z(i);try{localStorage.setItem(ae,i)}catch{}ee.current=null}},onUsageChange:i=>{oe(h=>({inputTokens:Math.max((h==null?void 0:h.inputTokens)??0,i.inputTokens),outputTokens:Math.max((h==null?void 0:h.outputTokens)??0,i.outputTokens),totalCostUsd:i.totalCostUsd??(h==null?void 0:h.totalCostUsd)??null}))},onElicitationRequest:i=>{X(i)}}),[s,se]);u.useEffect(()=>(je.current=A,()=>{A.disconnect()}),[A]),u.useEffect(()=>{let i=!1;async function h(){var C;x("");try{const v=await Tt(s);if(i)return;n(v),c(v.status),N(v.status==="running"||v.status==="requires_action"),(C=te.current)==null||C.call(te,v)}catch(v){if(i)return;x(v instanceof Error?v.message:k("session.loadFailed"));return}try{await A.init()}catch(v){console.warn("Failed to init adapter:",v)}}return h(),()=>{i=!0}},[s,A]);const z=Rt(l),L=(r==null?void 0:r.access_level)==="read",ue=u.useCallback(()=>{y([]),wt(s).catch(i=>{console.warn("[SessionDetail] Failed to clear session history:",i)})},[s]),ne=u.useCallback(async i=>{const h=i.text.trim(),C=i.images&&i.images.length>0||i.attachments&&i.attachments.length>0;if(!h&&!C||z)return;const v=await kt(h,{sessionId:s,availableCommands:Se,availableModels:(E==null?void 0:E.availableModels)??[],currentModel:E?{modelId:E.currentModelId,name:E.currentModelId}:null,supportsImages:!0,entries:we.current,setModel:async q=>{await O(s,{type:"control_request",request:{subtype:"set_model",model:q}}),D(xe=>xe&&{...xe,currentModelId:q})},onNewSession:()=>{y([])}}).catch(()=>null);if(v){if(Nt("[SessionDetail] local command result",v),"clearEntries"in v&&v.clearEntries){ue();return}if("newSession"in v&&v.newSession){ue();return}if("userEntry"in v){y(q=>[...q,v.userEntry,v.cmdEntry]);return}}N(!0);try{await A.sendMessage(h,i.images,i.attachments)}catch(q){console.error("Send failed:",q)}},[A,z,s,E,ue]),Xe=u.useCallback(i=>{if(b){Q(h=>[...h,i]);return}ne(i)},[b,ne]),me=u.useRef(!1);u.useEffect(()=>{if(b||B.length===0||me.current)return;const i=B[0];i&&(me.current=!0,Q(h=>h.slice(1)),ne(i).finally(()=>{me.current=!1}))},[b,B,ne]);const ke=u.useCallback(async()=>{try{await A.interrupt()}catch(i){console.error("Interrupt failed:",i)}finally{N(!1)}},[A]),Ze=u.useCallback(()=>{de(Ps(U.current))},[de]);u.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]);const et=u.useCallback(async()=>{if(r&&window.confirm(k("dashboard.confirmDelete").replace("{id}",r.title||r.id)))try{await vt(r.id),window.location.href="/code/"}catch(i){alert(i instanceof Error?i.message:k("dashboard.deleteFailed"))}},[r]),tt=u.useCallback(async i=>{try{await A.respondPermission(i,!0)}catch(h){console.error("Failed to approve:",h)}R(h=>h.filter(C=>C.requestId!==i))},[A]),st=u.useCallback(async(i,h)=>{try{await A.respondPermission(i,!0,{updated_permissions:h})}catch(C){console.error("Failed to approve with rules:",C)}R(C=>C.filter(v=>v.requestId!==i))},[A]),nt=u.useCallback(async(i,h)=>{const C=F;if(X(null),!!C)try{await A.respondElicitation(C.requestId,i,h)}catch(v){console.error("Failed to submit elicitation:",v)}},[F,A]),rt=u.useCallback(()=>{!r||L||(ye(r.title||""),G(!0),setTimeout(()=>{var i,h;(i=le.current)==null||i.focus(),(h=le.current)==null||h.select()},0))},[r,L]),Ne=u.useCallback(async()=>{const i=ie.trim();if(G(!1),!(!r||!i||i===r.title))try{const h=await _t(r.id,i);n(C=>C&&{...C,title:h.title??i})}catch(h){console.error("Rename failed:",h),alert(h instanceof Error?h.message:"重命名失败")}},[r,ie]),at=u.useCallback(async i=>{try{await A.respondPermission(i,!1)}catch(h){console.error("Failed to reject:",h)}R(h=>h.filter(C=>C.requestId!==i))},[A]),ot=u.useCallback(async(i,h,C)=>{try{await O(s,{type:"permission_response",approved:!0,request_id:i,updated_input:{questions:C,answers:h}})}catch(v){console.error("Failed to submit answers:",v)}R(v=>v.filter(q=>q.requestId!==i))},[s]),it=u.useCallback(async(i,h,C)=>{try{h==="no"?await O(s,{type:"permission_response",approved:!1,request_id:i,...C?{message:C}:{}}):await O(s,{type:"permission_response",approved:!0,request_id:i,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[h]||"default",destination:"session"}]})}catch(v){console.error("Failed to submit plan response:",v)}R(v=>v.filter(q=>q.requestId!==i))},[s]);return d?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-status-error",children:d}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:k("session.backToDashboard")})]})}):r?r.source==="acp"&&r.environment_id?e.jsx(Os,{sessionId:s,agentId:r.environment_id}):e.jsx(Fe,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:r.title||r.id}),e.jsx("div",{className:"border-b bg-surface-1 px-4 py-3",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[S?e.jsx("input",{ref:le,value:ie,onChange:i=>ye(i.target.value),onKeyDown:i=>{i.key==="Enter"&&!i.nativeEvent.isComposing?(i.preventDefault(),Ne()):i.key==="Escape"&&(i.preventDefault(),G(!1))},onBlur:()=>void Ne(),maxLength:200,className:"w-full max-w-md rounded-lg border border-brand/50 bg-surface-2 px-2.5 py-1 font-display text-lg font-semibold text-text-primary focus:outline-none focus:ring-2 focus:ring-brand/30"}):e.jsxs("h2",{className:"group/title flex min-w-0 items-center gap-1.5 font-display text-lg font-semibold text-text-primary",children:[e.jsx("span",{className:"truncate",children:r.title||r.id}),!L&&!z&&e.jsx("button",{type:"button",onClick:rt,className:"flex-shrink-0 rounded p-0.5 text-text-muted opacity-0 transition-opacity hover:text-text-primary group-hover/title:opacity-100",title:"重命名会话",children:e.jsx(St,{className:"h-3.5 w-3.5"})})]}),r.visibility&&!S&&e.jsx(Ot,{visibility:r.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var C;const i=r.source==="acp"?"acp":(C=r.environment)==null?void 0:C.worker_type,h=qt(i);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${h.colorClass}`,children:h.fullLabel})})(),l&&e.jsx(Pe,{status:l}),e.jsx("span",{className:"text-xs text-text-muted",children:qe(r.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(!a),className:`flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors ${a?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:k("artifacts.title"),children:e.jsx(Ct,{className:"h-3.5 w-3.5"})}),!L&&(r==null?void 0:r.access_level)!=="write"&&e.jsx("button",{onClick:()=>_(!0),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:k("session.share"),children:e.jsx(rs,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>j(!g),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:k("session.info"),children:e.jsx(Yt,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>m(!p),className:"flex items-center gap-1 rounded-md px-3 py-1.5 text-sm text-text-primary font-bold hover:bg-brand-light hover:text-white transition-colors",children:[k("session.tasks"),M.length>0&&e.jsx("span",{className:"ml-1 rounded-full bg-status-warning px-1.5 py-0.5 text-[10px] font-medium text-white",children:M.length})]})]})]}),g&&e.jsxs("div",{className:"mt-2 rounded-md bg-surface-2 px-3 py-2 text-xs text-text-muted space-y-1 font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:k("session.metaSession")})," ",r.id]}),r.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:k("session.metaEnvironment")})," ",r.environment_id]})]})]})}),a&&e.jsx("div",{className:"border-b bg-surface-1 px-4 py-4",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(Lt,{sessionId:s,embedded:!0})})}),e.jsx(Mt,{entries:f,isLoading:b,emptyTitle:k("session.emptyTitle"),emptyDescription:k("session.emptyDescription")}),e.jsx(ks,{state:H}),M.length>0&&e.jsx("div",{className:"border-t bg-surface-1 px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl space-y-3",children:M.map(i=>e.jsx(Us,{request:i,onApprove:()=>tt(i.requestId),onApproveAlways:i.suggestions&&i.suggestions.length>0?()=>st(i.requestId,i.suggestions??[]):void 0,onReject:()=>at(i.requestId),onSubmitAnswers:ot,onSubmitPlan:it},i.requestId))})}),F&&e.jsx("div",{className:"border-t bg-surface-1 px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsx(Ms,{request:F,onSubmit:nt})})}),ge&&e.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:e.jsx("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-1.5 text-xs text-red-700 dark:text-red-300",children:ge})}),e.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Ds,{mode:ce,onModeChange:de,disabled:z||L}),e.jsx(qs,{models:(E==null?void 0:E.availableModels)??[],currentModelId:(E==null?void 0:E.currentModelId)??null,onSelect:i=>{O(s,{type:"control_request",request:{subtype:"set_model",model:i}}),D(h=>h&&{...h,currentModelId:i})},disabled:z||L})]}),I&&e.jsxs("span",{className:"text-[11px] text-text-muted font-mono",title:"会话累计用量(input 含缓存读写)",children:[Ie(I.inputTokens)," in / ",Ie(I.outputTokens)," out",I.totalCostUsd!=null&&` · $${I.totalCostUsd.toFixed(2)}`]})]}),e.jsx(Et,{onSubmit:Xe,isLoading:b,onInterrupt:ke,onCycleMode:Ze,disabled:z||L,placeholder:z?k("session.closed"):L?k("session.readOnly"):k("session.inputPlaceholder"),supportsAttachments:!0,commands:Se,queueWhileLoading:!0,queuedCount:B.length,onDequeue:i=>Q(h=>h.filter((C,v)=>v!==i)),onSearchFiles:i=>A.searchFiles(i)}),p&&r&&e.jsx(ys,{onClose:()=>m(!1),session:r,liveStatus:l,pendingPermissions:M,onInterrupt:ke,onDelete:et}),e.jsx(As,{open:w,onClose:()=>_(!1),sessionId:r.id,sessionTitle:r.title||void 0})]})}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-text-muted",children:k("session.loading")})})}function Us({request:s,onApprove:t,onApproveAlways:r,onReject:n,onSubmitAnswers:l,onSubmitPlan:c}){const d=s.toolName,x=s.toolInput,p=s.description||"";if(d==="AskUserQuestion"){const m=x.questions||[];return e.jsx(vs,{requestId:s.requestId,questions:m,description:p,onSubmit:g=>l(s.requestId,g,m),onSkip:n})}if(d==="ExitPlanMode"){const m=x.plan||"";return e.jsx(Ss,{requestId:s.requestId,planContent:m,description:p,onSubmit:(g,j)=>c(s.requestId,g,j)})}return e.jsx(Ns,{requestId:s.requestId,toolName:d,toolInput:x,description:p,suggestions:s.suggestions,onApprove:t,onApproveAlways:r,onReject:n})}function Os({sessionId:s,agentId:t}){const[r,n]=u.useState(null),[l,c]=u.useState("disconnected"),[d,x]=u.useState(null),p=u.useRef(null);return u.useEffect(()=>{const m=Is(t);return m.setConnectionStateHandler((g,j)=>{c(g),x(j||null)}),p.current=m,n(m),m.connect().catch(g=>{g instanceof At||(x(g.message),c("error"))}),()=>{m.disconnect(),p.current=null,n(null),c("disconnected")}},[t]),e.jsx(Fe,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[d&&l==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:d}),l==="connecting"&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-text-muted text-sm",children:k("session.connectingAgent")})]})}),l==="error"&&!r&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-medium mb-1",children:k("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:d})]})}),r&&l==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx($t,{client:r,agentId:t})})]})})}export{Xs as SessionDetail};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-BaQbfV6b.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,a as s,c as t,C as e}from"./chunk-727SXJPM-DlSsa2cu.js";import{b as i}from"./mermaid.core-BaQbfV6b.js";import"./chunk-FMBD7UC4-DyKwyEWK.js";import"./chunk-ND2GUHAM-1AD_FvlP.js";import"./chunk-55IACEB6-B4zl1V4D.js";import"./chunk-2J33WTMH-D7uMaXAF.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-DWAG6oY9.js";import"./main-Cmt5Bx4n.js";import"./motion-BILbV7YQ.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,a as s,c as t,C as e}from"./chunk-727SXJPM-DlSsa2cu.js";import{b as i}from"./mermaid.core-BaQbfV6b.js";import"./chunk-FMBD7UC4-DyKwyEWK.js";import"./chunk-ND2GUHAM-1AD_FvlP.js";import"./chunk-55IACEB6-B4zl1V4D.js";import"./chunk-2J33WTMH-D7uMaXAF.js";import"./shiki-mEP5vQQu.js";import"./vendor-DE_-CLIE.js";import"./mermaid-VLURNSYL-DWAG6oY9.js";import"./main-Cmt5Bx4n.js";import"./motion-BILbV7YQ.js";var g={parser:t,get db(){return new e},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{g as diagram};
|