@saluzi/saluzi-edu 0.2.69 → 0.2.70
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 +48 -48
- 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 +1 @@
|
|
|
1
|
-
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ar as c,as as o,Q as m,am as s,ae as l,x as u}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){c();const[a,i]=d.useState([]),{myTeams:r,isLoading:x}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),x?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ab as y,
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ab as y,ar as b,V as j,am as s,K as N,aa as v,z as w}from"./main-2FF76CHO.js";import{C as g}from"./copy-BFkM6GS4.js";import{E as k}from"./external-link-Cb0Qh2uy.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const C=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_=y("refresh-cw",C);function A({artifactId:i,onBack:c}){b();const[t,x]=r.useState(null),[
|
|
6
|
+
*/const C=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_=y("refresh-cw",C);function A({artifactId:i,onBack:c}){b();const[t,x]=r.useState(null),[l,d]=r.useState(""),[m,o]=r.useState(!1),[p,u]=r.useState(0);r.useEffect(()=>{let a=!1;return j(i).then(n=>{a||x(n)}).catch(n=>{a||d(n instanceof Error?n.message:s("artifacts.viewNotFound"))}),()=>{a=!0}},[i]);const f=r.useCallback(async()=>{if(window.confirm(s("artifacts.delete")+" — "+i.slice(0,8)+"…?"))try{await N(i),c()}catch(a){alert(a instanceof Error?a.message:s("artifacts.deleteFailed"))}},[i,c]),h=r.useCallback(async()=>{if(!t)return;await v(`${window.location.origin}${t.url}`)&&(o(!0),setTimeout(()=>o(!1),1500))},[t]);return l?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:s("artifacts.viewNotFound")}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:l}),e.jsx("button",{type:"button",onClick:c,className:"mt-4 rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:s("artifacts.backToGallery")})]})}):t?e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-surface-1 px-4 py-2.5",children:[e.jsx("button",{type:"button",onClick:c,className:"text-sm text-text-muted hover:text-text-primary",children:s("artifacts.backToGallery")}),e.jsx("span",{className:"text-text-muted/40",children:"/"}),e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id.slice(0,12)}),e.jsxs("span",{className:"rounded-full bg-surface-3 px-2 py-0.5 text-[11px] text-text-muted",children:["v",t.version]}),t.session_id&&e.jsxs("a",{href:`/code/${t.session_id}`,className:"truncate font-mono text-[11px] text-text-muted hover:text-accent",title:t.session_id,children:[s("artifacts.session"),": ",t.session_id.slice(0,14),"…"]}),t.expires_at&&e.jsxs("span",{className:"text-[11px] text-text-muted",title:t.expires_at,children:[s("artifacts.expires"),": ",new Date(t.expires_at).toLocaleDateString()]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>u(a=>a+1),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:s("common.loading"),children:e.jsx(_,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{type:"button",onClick:h,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:s("artifacts.copyLink"),children:[e.jsx(g,{className:"h-3.5 w-3.5"}),m&&e.jsx("span",{className:"text-status-active",children:s("artifacts.copied")})]}),e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:s("artifacts.openInNewTab"),children:e.jsx(k,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:f,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:s("artifacts.delete"),children:e.jsx(w,{className:"h-3.5 w-3.5"})})]})]}),e.jsx("iframe",{src:`${t.url}${t.url.includes("?")?"&":"?"}_=${Date.now()}`,title:t.title||t.id,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"},p)]}):e.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:s("common.loading")})}export{A as ArtifactView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as i,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as i,j as e}from"./vendor-DE_-CLIE.js";import{ar as D,W as L,am as a,K as R,aa as B,F as M,g as K,z as A,p as S,H as P}from"./main-2FF76CHO.js";import{D as H,a as F,c as O,d as _,b as z}from"./dialog-aHICCHyK.js";import{E as $}from"./external-link-Cb0Qh2uy.js";import{C as q}from"./copy-BFkM6GS4.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";const v=`body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 860px; margin: 2rem auto; padding: 0 1rem; color: #1a1a1a; }
|
|
2
2
|
h1 { font-size: 22px; } h1, h2 { color: #1a1a1a; }
|
|
3
3
|
.badge { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 500; }
|
|
4
4
|
.badge.ok { background: #dcfce7; color: #166534; }
|
|
@@ -336,4 +336,4 @@ function render() {
|
|
|
336
336
|
render();
|
|
337
337
|
<\/script>
|
|
338
338
|
</body>
|
|
339
|
-
</html>`,N=[{id:"blank",titleKey:"artifacts.create.templateBlank",descKey:"",defaultTitle:"Untitled Artifact",html:G},{id:"pr-review",titleKey:"artifacts.create.templatePrReview",descKey:"artifacts.templateDesc.prReview",defaultTitle:"PR Review",html:V},{id:"incident",titleKey:"artifacts.create.templateIncident",descKey:"artifacts.templateDesc.incident",defaultTitle:"Incident Timeline",html:W},{id:"dashboard",titleKey:"artifacts.create.templateDashboard",descKey:"artifacts.templateDesc.dashboard",defaultTitle:"Data Dashboard",html:U},{id:"checklist",titleKey:"artifacts.create.templateChecklist",descKey:"artifacts.templateDesc.checklist",defaultTitle:"Release Checklist",html:Y}];function b(s){return N.find(o=>o.id===s)??N[0]}function I(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function J(s){if(!s)return"—";try{return new Date(s).toLocaleString()}catch{return s}}function Q(s){if(!s)return null;const o=new Date(s).getTime();return Number.isNaN(o)?null:Math.ceil((o-Date.now())/(1440*60*1e3))}function ie({sessionId:s,embedded:o=!1}){D();const[y,u]=i.useState([]),[
|
|
339
|
+
</html>`,N=[{id:"blank",titleKey:"artifacts.create.templateBlank",descKey:"",defaultTitle:"Untitled Artifact",html:G},{id:"pr-review",titleKey:"artifacts.create.templatePrReview",descKey:"artifacts.templateDesc.prReview",defaultTitle:"PR Review",html:V},{id:"incident",titleKey:"artifacts.create.templateIncident",descKey:"artifacts.templateDesc.incident",defaultTitle:"Incident Timeline",html:W},{id:"dashboard",titleKey:"artifacts.create.templateDashboard",descKey:"artifacts.templateDesc.dashboard",defaultTitle:"Data Dashboard",html:U},{id:"checklist",titleKey:"artifacts.create.templateChecklist",descKey:"artifacts.templateDesc.checklist",defaultTitle:"Release Checklist",html:Y}];function b(s){return N.find(o=>o.id===s)??N[0]}function I(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function J(s){if(!s)return"—";try{return new Date(s).toLocaleString()}catch{return s}}function Q(s){if(!s)return null;const o=new Date(s).getTime();return Number.isNaN(o)?null:Math.ceil((o-Date.now())/(1440*60*1e3))}function ie({sessionId:s,embedded:o=!1}){D();const[y,u]=i.useState([]),[m,w]=i.useState(!0),[x,f]=i.useState(""),[p,d]=i.useState(!1),[k,h]=i.useState(null),c=i.useCallback(async()=>{try{const t=await L(s?{session_id:s}:void 0);u(t||[]),f("")}catch(t){f(t instanceof Error?t.message:a("artifacts.loadFailed"))}finally{w(!1)}},[s]);i.useEffect(()=>{c();const t=setInterval(c,15e3);return window.addEventListener("focus",c),()=>{clearInterval(t),window.removeEventListener("focus",c)}},[c]);const g=i.useCallback(t=>{d(!1),u(n=>[t,...n.filter(C=>C.id!==t.id)])},[]),E=i.useCallback(async t=>{if(window.confirm(a("artifacts.delete")+" — "+t.slice(0,8)+"…?"))try{await R(t),u(n=>n.filter(C=>C.id!==t))}catch(n){alert(n instanceof Error?n.message:a("artifacts.deleteFailed"))}},[]),j=i.useCallback(async t=>{await B(`${window.location.origin}${t.url}`)&&(h(t.id),setTimeout(()=>h(null),1500))},[]),r=i.useMemo(()=>y,[y]),l=e.jsxs(e.Fragment,{children:[x&&e.jsx("p",{className:"text-status-error text-sm",children:x}),m?e.jsx("div",{className:"space-y-3",children:[0,1,2].map(t=>e.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-2"},t))}):r.length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[e.jsx(M,{className:"mx-auto h-8 w-8 text-text-muted/40"}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:a("artifacts.empty")})]}):e.jsx("ul",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",children:r.map(t=>{const n=Q(t.expires_at);return e.jsxs("li",{className:"group rounded-lg border border-border bg-surface-1 p-4 transition-colors hover:border-brand/50",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("a",{href:`/code/a/${t.id}`,className:"min-w-0 flex-1 no-underline",children:[e.jsx("h3",{className:"truncate font-medium text-text-primary group-hover:text-accent",children:t.title||t.id.slice(0,12)}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:[t.id.slice(0,10),"… · v",t.version," · ",I(t.size)]})]}),e.jsx("span",{className:`flex-shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${n!==null&&n<=0?"bg-status-error/15 text-status-error":n!==null&&n<=2?"bg-status-warning/15 text-status-warning":"bg-surface-3 text-text-muted"}`,children:n===null?"∞":`${n}d`})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-text-muted",children:[t.session_id&&e.jsxs("a",{href:`/code/${t.session_id}`,className:"truncate text-text-muted hover:text-accent",title:t.session_id,children:[a("artifacts.session"),": ",t.session_id.slice(0,14),"…"]}),e.jsxs("span",{className:"flex items-center gap-1",title:a("artifacts.updatedAt"),children:[e.jsx(K,{className:"h-3 w-3"}),J(t.updated_at)]})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[e.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:a("artifacts.openInNewTab"),children:e.jsx($,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{type:"button",onClick:()=>j(t),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:a("artifacts.copyLink"),children:[e.jsx(q,{className:"h-3.5 w-3.5"}),k===t.id&&e.jsx("span",{className:"text-status-active",children:a("artifacts.copied")})]}),e.jsx("button",{type:"button",onClick:()=>E(t.id),className:"ml-auto inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:a("artifacts.delete"),children:e.jsx(A,{className:"h-3.5 w-3.5"})})]})]},t.id)})})]});return o?e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:a("artifacts.title")}),e.jsxs("button",{type:"button",onClick:()=>d(!0),className:"inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:[e.jsx(S,{className:"h-4 w-4"}),a("artifacts.new")]})]}),l,e.jsx(T,{open:p,onClose:()=>d(!1),onCreated:g,sessionId:s})]}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary sm:text-4xl",children:a("artifacts.title")}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:a("artifacts.subtitle")})]}),e.jsxs("button",{type:"button",onClick:()=>d(!0),className:"inline-flex items-center gap-2 rounded-md bg-accent px-4 py-2 text-sm font-medium text-white transition-all hover:bg-accent/90 active:translate-y-px",children:[e.jsx(S,{className:"h-4 w-4"}),a("artifacts.new")]})]}),l,e.jsx(T,{open:p,onClose:()=>d(!1),onCreated:g,sessionId:s})]})}function T({open:s,onClose:o,onCreated:y,sessionId:u}){D();const[m,w]=i.useState("pr-review"),[x,f]=i.useState(""),[p,d]=i.useState(""),[k,h]=i.useState(!1),[c,g]=i.useState("");i.useEffect(()=>{s&&(w("pr-review"),f(""),d(""),h(!1),g(""))},[s]);const E=r=>{w(r);const l=b(r);d(l.html),x.trim()||f(l.defaultTitle)},j=async()=>{const r=p.trim()||b(m).html;if(r){h(!0),g("");try{const l={html:r,title:x.trim()||b(m).defaultTitle,ttl:30};u&&(l.session_id=u);const t=await P(l);y(t)}catch(l){g(l instanceof Error?l.message:a("artifacts.create.failed"))}finally{h(!1)}}};return e.jsx(H,{open:s,onOpenChange:r=>r?void 0:o(),children:e.jsxs(F,{className:"max-h-[85vh] overflow-y-auto sm:max-w-2xl",children:[e.jsx(O,{children:e.jsx(_,{children:a("artifacts.create.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:a("artifacts.create.template")}),e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:N.map(r=>e.jsxs("button",{type:"button",onClick:()=>E(r.id),className:`rounded-lg border p-3 text-left transition-colors ${m===r.id?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:a(r.titleKey)}),r.descKey&&e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:a(r.descKey)})]},r.id))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-title",children:a("artifacts.create.title.label")}),e.jsx("input",{id:"artifact-title",type:"text",value:x,onChange:r=>f(r.target.value),placeholder:b(m).defaultTitle,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-content",children:a("artifacts.create.content")}),e.jsx("textarea",{id:"artifact-content",value:p,onChange:r=>d(r.target.value),placeholder:b(m).html.slice(0,120)+"…",rows:10,spellCheck:!1,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-primary focus:border-accent focus:outline-none"}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:p.trim()?`${I(new Blob([p]).size)}`:a("artifacts.create.content")})]}),c&&e.jsx("p",{className:"text-sm text-status-error",children:c})]}),e.jsxs(z,{children:[e.jsx("button",{type:"button",onClick:o,className:"rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:a("common.cancel")}),e.jsx("button",{type:"button",onClick:j,disabled:k,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:k?a("common.creating"):a("artifacts.create.submit")})]})]})})}export{ie as ArtifactsGallery};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{E as u,Q as f}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{E as u,Q as f}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{ab as O,a9 as _,
|
|
1
|
+
import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{ab as O,a9 as _,as as E,aq as T,x as F,ar as L,am as a,ae as A,q as $,s as W,e as q,r as H,d as P,ah as V,I as Q,Q as R,Y as U,N as Y}from"./main-2FF76CHO.js";import{g as D}from"./workerType-Bd-zteMi.js";import{S as Z}from"./SessionVisibilityBadge-7ElYQ4hP.js";import{D as z,a as G,c as J,d as K,b as X}from"./dialog-aHICCHyK.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as v,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function E({onSuccess:b,onInvalidInvite:l}){const{join:h}=v(),[u,f]=r.useState(""),[d,j]=r.useState(""),[o,w]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):l()},[l]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await h(u,d,o),b()}catch(a){const i=a instanceof Error?a.message:"Join failed";if(i.includes("Invalid invitation")||i.includes("expired")||i.includes("already used")){l();return}n(i)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:d,onChange:s=>j(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",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&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{E as Join};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as f,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function N({onSuccess:d,onNavigateRegister:c}){const{login:m,registrationAllowed:x}=f(),[a,p]=r.useState(""),[o,b]=r.useState(""),[l,n]=r.useState(""),[i,u]=r.useState(!1),h=async s=>{s.preventDefault(),n(""),u(!0);try{await m(a,o),d()}catch{n(t("auth.login.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:a,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>b(s.target.value),required:!0,autoComplete:"current-password",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"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:i?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:c,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{N as Login};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as y,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S({onSuccess:m,onBack:x}){const{register:p}=y(),[n,b]=r.useState(""),[a,h]=r.useState(""),[l,f]=r.useState(""),[i,o]=r.useState(""),[u,d]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}d(!0);try{await p(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.failed"))}finally{d(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>b(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>h(s.target.value),required:!0,autoComplete:"new-password",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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",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"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:u?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{S as Register};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var pt=Object.defineProperty;var ht=(s,t,r)=>t in s?pt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var M=(s,t,r)=>ht(s,typeof t!="symbol"?t+"":t,r);import{e as m,j as e}from"./vendor-DE_-CLIE.js";import{ab as q,_ as ft,ai as Me,ak as yt,aj as be,a5 as gt,af as fe,a4 as F,$ as bt,x as Le,g as Te,ae as He,L as Be,z as jt,w as kt,ad as I,a9 as J,d as ze,an as Ae,a0 as wt,J as Nt,a3 as vt,ar as Ve,am as w,A as _t,ag as St,G as Ct,ao as Et,ac as Mt,b as Tt,N as At,a1 as Rt,y as We,P as $t,F as It,c as Pt,C as qt,R as Re,Z as Dt,D as Ut,a as Ft,q as Qe,s as Ge,v as Ot,f as Ke,e as Ye,r as Je,M as Lt}from"./main-2FF76CHO.js";import{g as Ht}from"./workerType-Bd-zteMi.js";import{D as Xe,a as Ze,c as et,d as tt,b as Bt}from"./dialog-aHICCHyK.js";import{E as zt}from"./external-link-Cb0Qh2uy.js";import{S as Vt}from"./SessionVisibilityBadge-7ElYQ4hP.js";import{U as Wt}from"./UserSearchInput-DM6V0r1B.js";import{ArtifactsGallery as Qt}from"./ArtifactsGallery-DQj98ptl.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";import"./copy-BFkM6GS4.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 Gt=[["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"}]],Kt=q("activity",Gt);/**
|
|
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 Yt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Jt=q("chevron-right",Yt);/**
|
|
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 Xt=[["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"}]],st=q("cpu",Xt);/**
|
|
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 Zt=[["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"}]],es=q("hash",Zt);/**
|
|
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 ts=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ss=q("info",ts);/**
|
|
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 ns=[["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"}]],rs=q("message-square-text",ns);/**
|
|
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 as=[["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"}]],os=q("play",as);/**
|
|
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 is=[["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"}]],ls=q("server-cog",is);/**
|
|
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 cs=[["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"}]],ds=q("share-2",cs);/**
|
|
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 us=[["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"}]],ms=q("shield-check",us);/**
|
|
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 xs=[["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"}]],ps=q("triangle-alert",xs);function nt(){return{tasks:{}}}const $e=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 hs(s,t){var d,p,f,x,b,j,N,i,a,u,y,k;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 g=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:re(g),description:g,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 g=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:re(g),description:g,toolUseId:t.tool_use_id,status:"running",startTime:l,tokenCount:(d=t.usage)==null?void 0:d.total_tokens,toolUseCount:(p=t.usage)==null?void 0:p.tool_uses,durationMs:(f=t.usage)==null?void 0:f.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...s.tasks,[n]:{...c,description:t.description??c.description,tokenCount:((x=t.usage)==null?void 0:x.total_tokens)??c.tokenCount,toolUseCount:((b=t.usage)==null?void 0:b.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:((u=t.usage)==null?void 0:u.total_tokens)??c.tokenCount,toolUseCount:((y=t.usage)==null?void 0:y.tool_uses)??c.toolUseCount,durationMs:((k=t.usage)==null?void 0:k.duration_ms)??c.durationMs,evictAfter:l+$e}}}:{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:(N=t.usage)==null?void 0:N.total_tokens,toolUseCount:(i=t.usage)==null?void 0:i.tool_uses,durationMs:(a=t.usage)==null?void 0:a.duration_ms,evictAfter:l+$e}}}}function fs(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 ys{constructor(){M(this,"listeners",new Set);M(this,"eventSource",null);M(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 ye=new ys;function Ie(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 Pe(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 ge="streaming-";function gs(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 qe(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 bs{constructor(t,r,n){M(this,"sessionId");M(this,"setEntries");M(this,"unsub",null);M(this,"onStatusChange");M(this,"onError");M(this,"onPermissionRequest");M(this,"onModelsStateChange");M(this,"onSubagentUpdate");M(this,"onControlResponse");M(this,"onPermissionModeChange");M(this,"onUsageChange");M(this,"onElicitationRequest");M(this,"subagentState",nt());M(this,"seenUuids",new Set);M(this,"seenToolCallIds",new Set);M(this,"pendingControlRequests",new Map);M(this,"turnEnded",!1);M(this,"userSinceTurnEnd",!1);M(this,"closed",!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}markClosed(){this.closed=!0}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var x,b,j;const{events:t}=await ft(this.sessionId);if(!t||t.length===0)return;const r=[];let n=null;const l=()=>{n&&(r.push(n),n=null)};for(const N of t){const i=N.payload||{},a=i.uuid;if(typeof a=="string"&&a&&this.seenUuids.add(a),N.type==="tool_use"){const u=i.tool_call_id;typeof u=="string"&&u&&this.seenToolCallIds.add(u)}if(N.type==="user"){if(N.direction==="inbound")continue;l();const u=Ie(i);u&&r.push({type:"user_message",id:N.id||`hist-user-${r.length}`,content:u})}else if(N.type==="assistant"){l();const u=Ie(i);if(Me(u))continue;const y=[],k=i.message;if(k&&typeof k=="object"&&Array.isArray(k.content)){for(const g of k.content)if(g.type==="tool_use"){const _=g.id;_&&this.seenToolCallIds.add(_),y.push({type:"tool_call",toolCall:{id:_||`hist-tool-${r.length}`,title:g.name||"tool",status:"complete",rawInput:g.input||{}}})}}if(u||y.length>0){n={type:"assistant_message",id:N.id||`hist-asst-${r.length}`,chunks:u?[{type:"message",text:u}]:[]},r.push(n);for(const g of y)r.push(g);n=null}}else if(N.type==="tool_use"){const u=i,y={type:"tool_call",toolCall:{id:u.tool_call_id||`hist-tool-${r.length}`,title:u.tool_name||"tool",status:"complete",rawInput:u.tool_input||{}}};r.push(y)}else if(N.type==="tool_result"){const u=i,y=Pe(r,u.tool_call_id||"");if(y>=0){const k=r[y];r[y]={type:"tool_call",toolCall:{...k.toolCall,rawOutput:{output:u.content||u.output||""}}}}}}l();let c=null;for(const N of t){if(N.type!=="task_state")continue;const i=N.payload||{};Array.isArray(i.tasks)&&(c=i.tasks)}if(c&&c.length>0){const N=qe(c);N.length>0&&r.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:N})}this.setEntries(r);let d=null,p=null,f=null;for(const N of t){const i=N.payload||{};if(N.type==="user"?f="user":(N.type==="result"||N.type==="result_success"||N.type==="interrupt")&&(f="turn_end"),N.type==="models_state"){const a=i.raw,u=a&&typeof a=="object"?a.models_state:i.models_state;u&&Array.isArray(u.availableModels)&&typeof u.currentModelId=="string"&&(d=u)}else if(N.type==="result"||N.type==="result_success"){const a=i.usage,u=typeof i.total_cost_usd=="number"?i.total_cost_usd:null;(a||u!==null)&&(p={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:u})}}d&&((x=this.onModelsStateChange)==null||x.call(this,d)),p&&((b=this.onUsageChange)==null||b.call(this,p)),this.turnEnded=f==="turn_end",this.userSinceTurnEnd=f==="user",this.turnEnded&&!this.closed&&((j=this.onStatusChange)==null||j.call(this,"idle"))}connectSSE(){ye.connect(this.sessionId),this.unsub=ye.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),ye.disconnect()}handleEvent(t){var l,c,d,p,f,x,b,j,N;const r=t.type,n=t.payload||{};switch(r){case"user":{this.userSinceTurnEnd=!0;break}case"assistant":{const i=n.uuid;if(typeof i=="string"&&i){if(this.seenUuids.has(i))break;this.seenUuids.add(i)}const a=typeof n.content=="string"?n.content:"";if(Me(a))break;const u=gs(n);this.setEntries(k=>{const g=k[k.length-1];if((g==null?void 0:g.type)==="assistant_message"&&g.id.startsWith(ge))return[...k.slice(0,-1),{...g,id:`assistant-${Date.now()}`,chunks:[...u?[{type:"thought",text:u}]:[],{type:"message",text:a}]}];if((g==null?void 0:g.type)==="assistant_message"){const _=g.chunks[g.chunks.length-1];return(_==null?void 0:_.type)==="message"?[...k.slice(0,-1),{...g,chunks:[...g.chunks.slice(0,-1),{type:"message",text:_.text+a}]}]:[...k.slice(0,-1),{...g,chunks:[...g.chunks,{type:"message",text:a}]}]}if(a&&a.trim()||u){const _={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...u?[{type:"thought",text:u}]:[],...a?[{type:"message",text:a}]:[]]};return[...k,_]}return k});const y=n.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){const k=y.content.filter(g=>g.type==="tool_use");for(const g of k){const _=g.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(_))continue;this.seenToolCallIds.add(_);const R={id:_,title:g.name||"tool",status:"running",rawInput:g.input||{}};this.setEntries(T=>[...T,{type:"tool_call",toolCall:R}])}}break}case"tool_use":{const i=n,a=i.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(a))break;this.seenToolCallIds.add(a);const u={id:a,title:i.tool_name||"tool",status:"running",rawInput:i.tool_input||{}};this.setEntries(y=>[...y,{type:"tool_call",toolCall:u}]);break}case"tool_result":{const i=n,a=i.tool_call_id||"";this.setEntries(u=>{const y=Pe(u,a);if(y<0)return u;const k=u[y];return u.map((g,_)=>_===y?{type:"tool_call",toolCall:{...k.toolCall,status:"complete",rawOutput:{output:i.content||i.output||""}}}:g)});break}case"control_request":case"permission_request":{const i=n.request;if(i&&i.subtype==="can_use_tool"){const a=n.request_id||"",u=i.tool_name||"unknown",y=i.input||i.tool_input||{},k=i.description||"",g=Array.isArray(i.permission_suggestions)?i.permission_suggestions:[];this.setEntries(_=>{const R=[..._].reverse().findIndex(T=>T.type==="tool_call");if(R>=0){const T=_.length-1-R,E=_[T];if(E.toolCall.status==="running")return _.map((O,B)=>B===T?{type:"tool_call",toolCall:{...E.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:a,options:[]}}}:O)}return _}),(l=this.onPermissionRequest)==null||l.call(this,{requestId:a,toolName:u,toolInput:y,description:k,suggestions:g})}else i&&i.subtype==="elicitation"&&((c=this.onElicitationRequest)==null||c.call(this,{requestId:n.request_id||"",serverName:i.mcp_server_name||"",message:i.message||"",mode:i.mode==="url"?"url":"form",url:typeof i.url=="string"?i.url:void 0,requestedSchema:i.requested_schema||void 0}));break}case"session_status":{if(yt(n)){this.setEntries([]);break}if(typeof n.status=="string"){if(be(n.status))this.closed=!0;else if(this.closed)break;if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(d=this.onStatusChange)==null||d.call(this,n.status)}break}case"error":{const i=String(n.message||n.content||"Unknown error");(p=this.onError)==null||p.call(this,i);break}case"models_state":{const i=n.raw,a=typeof i=="object"&&i!==null?i.models_state:n.models_state;a&&Array.isArray(a.availableModels)&&typeof a.currentModelId=="string"&&((f=this.onModelsStateChange)==null||f.call(this,a));break}case"system":{const i=n.raw,a=i&&typeof i=="object"?i:n,u=typeof a.subtype=="string"?a.subtype:void 0;if(u==="task_started"||u==="task_progress"||u==="task_notification"){const k={subtype:u,task_id:typeof a.task_id=="string"?a.task_id:void 0,tool_use_id:typeof a.tool_use_id=="string"?a.tool_use_id:void 0,description:typeof a.description=="string"?a.description:void 0,task_type:typeof a.task_type=="string"?a.task_type:void 0,workflow_name:typeof a.workflow_name=="string"?a.workflow_name:void 0,prompt:typeof a.prompt=="string"?a.prompt:void 0,usage:a.usage&&typeof a.usage=="object"?a.usage:void 0,last_tool_name:typeof a.last_tool_name=="string"?a.last_tool_name:void 0,summary:typeof a.summary=="string"?a.summary:void 0,status:a.status==="completed"||a.status==="failed"||a.status==="stopped"?a.status:void 0,output_file:typeof a.output_file=="string"?a.output_file:void 0};this.subagentState=hs(this.subagentState,k)}const y=typeof a.permissionMode=="string"?a.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;y&&((x=this.onPermissionModeChange)==null||x.call(this,y));break}case"control_response":{const i=n.response;if(i&&typeof i=="object"){const a=typeof i.request_id=="string"?i.request_id:"",u=typeof i.subtype=="string"?i.subtype:"";if(a){(b=this.onControlResponse)==null||b.call(this,{subtype:u,requestId:a,error:typeof i.error=="string"?i.error:void 0});const y=this.pendingControlRequests.get(a);y&&(this.pendingControlRequests.delete(a),y(u==="success"&&i.response&&typeof i.response=="object"?i.response:null))}}break}case"stream_event":{const i=n.event;if(!i||typeof i.type!="string")break;if(i.type==="content_block_delta"){const a=i.delta;if(!a||typeof a.type!="string")break;const u=a.type==="text_delta"?"message":a.type==="thinking_delta"?"thought":null;if(!u)break;const y=a.text??a.thinking;if(typeof y!="string"||!y)break;this.appendStreamingDelta(u,y)}break}case"partial_assistant":{const i=typeof n.content=="string"?n.content:"";i&&this.appendStreamingDelta("message",i);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,this.closed||(j=this.onStatusChange)==null||j.call(this,"idle");const i=n.usage,a=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(i||a!==null){const u=((i==null?void 0:i.input_tokens)??0)+((i==null?void 0:i.cache_read_input_tokens)??0)+((i==null?void 0:i.cache_creation_input_tokens)??0);(N=this.onUsageChange)==null||N.call(this,{inputTokens:u,outputTokens:(i==null?void 0:i.output_tokens)??0,totalCostUsd:a})}break}case"task_state":{const i=Array.isArray(n.tasks)?n.tasks:[];if(i.length===0)break;const a=qe(i);if(a.length===0)break;this.setEntries(u=>[...u.filter(k=>k.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:a}]);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(ge)){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:`${ge}${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(x=>[...x,d]);const p=[];if(t&&p.push({type:"text",text:t}),l)for(const x of r)p.push({type:"image",source:{type:"base64",media_type:x.mimeType,data:x.data}});if(c){for(const x of n)if(x.kind==="text"||x.kind==="table"){const b=`📎 ${x.name}${x.size!=null?` (${js(x.size)})`:""}`,j=x.textContent||"(空文件)";p.push({type:"text",text:`${b}
|
|
57
|
+
\`\`\`
|
|
58
|
+
${j}
|
|
59
|
+
\`\`\``})}else if(x.kind==="directory"){const b=`📁 目录: ${x.name}${x.files!=null?` (${x.files.length} 个文件)`:""}`,j=x.textContent||"(空目录)";p.push({type:"text",text:`${b}
|
|
60
|
+
${j}`})}}const f=p.length===1&&p[0].type==="text"?p[0].text||t:p.length>0?p:t;try{await gt(this.sessionId,{type:"user",uuid:fe(),content:t,message:{content:f}})}catch(x){throw this.setEntries(b=>b.filter(j=>!(j.type==="user_message"&&j.id===d.id))),x}}async respondPermission(t,r,n){await F(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 bt(this.sessionId)}async setPermissionMode(t){const r=fe();return await F(this.sessionId,{type:"control_request",request_id:r,request:{subtype:"set_permission_mode",mode:t}}),r}async searchFiles(t,r=20){const n=fe(),l=new Promise(d=>{this.pendingControlRequests.set(n,d)});await F(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 p=[];for(const f of d.suggestions)f&&typeof f=="object"&&typeof f.path=="string"&&p.push(f.path);return p}finally{clearTimeout(c)}}async respondElicitation(t,r,n){await F(this.sessionId,{type:"permission_response",approved:r==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:r,...n?{content:n}:{}}}})}}function js(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function ks(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 ws(s){return s?Date.now()-s<6e4:!1}function Ns({onClose:s,session:t,liveStatus:r,pendingPermissions:n,onInterrupt:l,onDelete:c}){const[d,p]=m.useState(!1),f=async()=>{await navigator.clipboard.writeText(t.id),p(!0),setTimeout(()=>p(!1),1500)},x=n.length,b=t.worker,j=t.work_item,N=t.environment;return e.jsx(Xe,{open:!0,onOpenChange:i=>{i||s()},children:e.jsxs(Ze,{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(et,{children:e.jsx(tt,{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(Kt,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Le,{status:r||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:b&&(ws(b.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[b&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Te,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:ks(b.last_heartbeat_at)})]}),N&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(st,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:N.machine_name||N.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Te,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:He(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(Be,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),x>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[x," permission request",x>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(ls,{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(jt,{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(es,{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:f,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})]}),N&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:N.worker_type})]})]})]})]})]})})}const De="rcs:subagent-panel:collapsed";function vs(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 _s(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 Ss({status:s}){return s==="running"?e.jsx(Be,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(os,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(kt,{className:"h-3 w-3 text-status-error"}):null}function Cs({task:s}){const t=s.status==="running",r=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,n=_s(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(Ss,{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:vs(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 Es({state:s}){const[t,r]=m.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(De)==="1"}catch{return!1}}),n=()=>{r(f=>{const x=!f;try{window.localStorage.setItem(De,x?"1":"0")}catch{}return x})},[,l]=m.useState(0);m.useEffect(()=>{const f=Object.values(s.tasks).some(j=>j.status==="running"),x=Object.values(s.tasks).some(j=>j.status!=="running"&&j.evictAfter!==void 0);if(!f&&!x)return;const b=setInterval(()=>{l(j=>j+1)},1e3);return()=>clearInterval(b)},[s]);const c=fs(s);if(c.length===0)return null;const d=c.filter(f=>f.status==="running").length,p=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(Jt,{className:`h-3 w-3 transition-transform ${t?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:p})]}),!t&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:c.map(f=>e.jsx(Cs,{task:f},f.taskId))})]})})}function Ue(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 Ms({requestId:s,toolName:t,toolInput:r,description:n,suggestions:l,onApprove:c,onApproveAlways:d,onReject:p}){const f=typeof r=="string"?r:JSON.stringify(r,null,2),x=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(ps,{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:I(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:I(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:Ae(f,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"}),x&&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:`允许并记住规则:${Ue(t,l)}`,children:[e.jsx(ms,{className:"h-3.5 w-3.5"}),"Always allow ",Ae(Ue(t,l),40)]}),e.jsx("button",{onClick:p,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 Ts({questions:s,description:t,onSubmit:r,onSkip:n}){const[l,c]=m.useState({}),[d,p]=m.useState({}),[f,x]=m.useState(0),b=(a,u,y)=>{if(y){const k=l[a]||[],g=k.includes(u)?k.filter(_=>_!==u):[...k,u];c({...l,[a]:g})}else c({...l,[a]:u})},j=a=>{var y;const u=(y=d[a])==null?void 0:y.trim();u&&(c({...l,[a]:u}),p({...d,[a]:""}))},N=()=>{var u,y;const a={};for(const[k,g]of Object.entries(l)){const _=s[parseInt(k,10)];_&&(typeof g=="number"?a[k]=((y=(u=_.options)==null?void 0:u[g])==null?void 0:y.label)||String(g):Array.isArray(g)?a[k]=g.map(R=>{var T,E;return((E=(T=_.options)==null?void 0:T[R])==null?void 0:E.label)||String(R)}):a[k]=g)}r(a)};if(s.length<=1){const a=s[0]||{question:t,options:[],multiSelect:!1},u=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:I(t||a.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(a.options||[]).map((y,k)=>{const g=u?(l[0]||[]).includes(k):l[0]===k;return e.jsxs("button",{onClick:()=>b(0,k,u),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:I(y.label)}),y.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:I(y.description)})]},k)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:d[0]||"",onChange:y=>p({...d,0:y.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:y=>y.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:N,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 i=s[f];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:I(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((a,u)=>e.jsx("button",{onClick:()=>x(u),className:J("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",f===u?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:a.header||`Q${u+1}`},u))}),i&&e.jsx(As,{question:i,qIdx:f,answers:l,otherTexts:d,onSelect:b,onOtherTextChange:(a,u)=>p({...d,[a]:u}),onOtherSubmit:j}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[f+1," / ",s.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:N,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 As({question:s,qIdx:t,answers:r,otherTexts:n,onSelect:l,onOtherTextChange:c,onOtherSubmit:d}){const p=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:I(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((f,x)=>{const b=p?(r[t]||[]).includes(x):r[t]===x;return e.jsxs("button",{onClick:()=>l(t,x,p),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:I(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:I(f.description)})]},x)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:f=>c(t,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"&&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 Rs({planContent:s,description:t,onSubmit:r}){const[n,l]=m.useState(null),[c,d]=m.useState(""),p=!s||!s.trim(),f=()=>{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(ze,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold text-text-primary",children:p?"Exit plan mode?":"Ready to code?"})]}),!p&&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:$s(s)}}),e.jsx("div",{className:"space-y-2",children:p?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:x=>d(x.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:f,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 $s(s){let t=I(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 Is({request:s,onSubmit:t}){const r=Ps(s.requestedSchema),n=qs(s.requestedSchema),[l,c]=m.useState({}),d=r.length===0||n.every(p=>(l[p]??"").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(Fe,{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(zt,{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(Fe,{serverName:s.serverName,message:s.message}),r.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:r.map(({name:p,prop:f})=>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:p}),n.includes(p)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:"必填"})]}),f.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:I(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:l[p]??"",onChange:x=>c(b=>({...b,[p]:x.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"})]},p))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const p={};for(const{name:f,prop:x}of r){const b=(l[f]??"").trim();b&&(p[f]=x.type==="number"?Number(b):b)}t("accept",p)},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 Fe({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(rs,{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:I(s)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:I(t)})]})}function Ps(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 qs(s){const t=s==null?void 0:s.required;return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function Ds(s){const[t,r]=m.useState([]),[n,l]=m.useState(!0),[c,d]=m.useState(null),p=m.useCallback(async()=>{l(!0),d(null);try{const b=await wt(s);r(b)}catch(b){d(b instanceof Error?b.message:"Failed to load shares")}finally{l(!1)}},[s]);m.useEffect(()=>{p()},[p]);const f=m.useCallback(async b=>{d(null);try{const j=await Nt(s,b);return await p(),j}catch(j){throw d(j instanceof Error?j.message:"Failed to create share"),j}},[s,p]),x=m.useCallback(async b=>{d(null);try{await vt(s,b),await p()}catch(j){throw d(j instanceof Error?j.message:"Failed to revoke share"),j}},[s,p]);return{shares:t,isLoading:n,error:c,createShare:f,revokeShare:x,refresh:p}}function Us({open:s,onClose:t,sessionId:r,sessionTitle:n}){Ve();const{shares:l,isLoading:c,error:d,createShare:p,revokeShare:f}=Ds(r),[x,b]=m.useState("user"),[j,N]=m.useState(""),[i,a]=m.useState(""),[u,y]=m.useState("read"),[k,g]=m.useState(""),[_,R]=m.useState(!1),[T,E]=m.useState(null),[O,B]=m.useState(""),[oe,P]=m.useState(!1),[ie,L]=m.useState(!1);m.useEffect(()=>{s&&(b("user"),N(""),a(""),y("read"),g(""),R(!1),E(null),B(""),P(!1),L(!1))},[s]);const X=async()=>{R(!0),B(""),E(null);try{const S={grantedTo:x==="user"?{userId:j.trim()}:{teamId:i.trim()},permission:u};k.trim()&&(S.expiresAt=k.trim());const Q=await p(S);E(`${window.location.origin}/code/s/${Q.shareToken}`)}catch(S){B(S instanceof Error?S.message:"Failed to create share")}finally{R(!1)}},z=async S=>{try{await f(S)}catch{}},V=async()=>{if(!T)return;L(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(T),P(!0),setTimeout(()=>P(!1),2e3);return}}catch{}const S=document.createElement("textarea");S.value=T,S.style.position="fixed",S.style.opacity="0",document.body.appendChild(S),S.select();try{document.execCommand("copy"),P(!0),setTimeout(()=>P(!1),2e3)}catch{L(!0)}document.body.removeChild(S)};return e.jsx(Xe,{open:s,onOpenChange:S=>{S||t()},children:e.jsxs(Ze,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(et,{children:e.jsxs(tt,{className:"font-display text-lg font-semibold text-text-primary",children:[w("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:w("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>b("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${x==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:w("share.user")}),e.jsx("button",{onClick:()=>b("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${x==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:w("share.team")})]}),x==="user"?e.jsx(Wt,{onSelect:N,placeholder:w("share.userIdPlaceholder"),actionLabel:w("share.selectUser")}):e.jsx("input",{type:"text",value:i,onChange:S=>a(S.target.value),placeholder:w("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"}),x==="user"&&j&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[w("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:w("share.permission")}),e.jsxs("select",{value:u,onChange:S=>y(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:w("share.permissionRead")}),e.jsx("option",{value:"write",children:w("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:w("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:k,onChange:S=>g(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"})]}),(O||d)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:O||d}),T&&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:w("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:T}),e.jsx("button",{onClick:V,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:oe?w("share.copied"):w("share.copy")})]}),ie&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:w("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:w("share.existingShares")}),c?e.jsx("p",{className:"text-sm text-text-muted",children:w("share.loading")}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:w("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"?w("share.permissionWrite"):w("share.permissionRead"),S.expires_at?` · expires ${S.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>z(S.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:w("share.revoke")})]},S.id))})]})]}),e.jsxs(Bt,{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:w("common.close")}),e.jsx("button",{onClick:X,disabled:_||(x==="user"?!j.trim():!i.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:_?w("common.creating"):w("share.createShare")})]})]})})}function Fs(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Os(s){const t=Fs(s),r=St(),n=r?{proxyUrl:t,token:r}:{proxyUrl:t};return new _t(n)}const W=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"}],ae="rcs_permission_mode";function Oe(s){return s<1e3?String(s):s<1e6?`${(s/1e3).toFixed(1)}k`:`${(s/1e6).toFixed(1)}M`}function Ls(s){const t=W.findIndex(r=>r.value===s);return W[(t+1+W.length)%W.length].value}function Hs({models:s,currentModelId:t,onSelect:r,disabled:n}){const[l,c]=m.useState(!1),d=s.find(x=>x.modelId===t)??null,p=s.length>0,f=async x=>{r(x.modelId),c(!1)};return e.jsxs(Qe,{open:l,onOpenChange:p?c:void 0,children:[e.jsx(Ge,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:n||!p,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(st,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(d==null?void 0:d.name)??t??"选择模型"}),l?e.jsx(Ke,{className:"h-3 w-3"}):e.jsx(Ye,{className:"h-3 w-3"})]})}),e.jsx(Je,{className:"w-72 p-0",align:"start",children:e.jsx(Lt,{models:s,currentModelId:t,onSelect:f,showSearch:s.length>5})})]})}function Bs({mode:s,onModeChange:t,disabled:r}){const[n,l]=m.useState(!1),c=W.find(d=>d.value===s);return e.jsxs(Qe,{open:n,onOpenChange:l,children:[e.jsx(Ge,{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(Ot,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:(c==null?void 0:c.label)??s}),n?e.jsx(Ke,{className:"h-3 w-3"}):e.jsx(Ye,{className:"h-3 w-3"})]})}),e.jsx(Je,{className:"w-64 p-1",align:"start",children:W.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(ze,{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 rn({sessionId:s,onSessionLoaded:t}){Ve();const[r,n]=m.useState(null),[l,c]=m.useState(null),[d,p]=m.useState(""),[f,x]=m.useState(!1),[b,j]=m.useState(!1),[N,i]=m.useState(!1),[a,u]=m.useState(!1),[y,k]=m.useState([]),[g,_]=m.useState(!1),[R,T]=m.useState([]),[E,O]=m.useState(null),[B,oe]=m.useState(()=>nt()),[P,ie]=m.useState(null),[L,X]=m.useState(null),[z,V]=m.useState([]),[S,Q]=m.useState(!1),[le,je]=m.useState(""),ce=m.useRef(null),[de,Z]=m.useState(()=>localStorage.getItem(ae)||"default"),[ke,we]=m.useState(null),G=m.useRef(null),[Ne,ve]=m.useState(null),K=m.useRef(null),D=m.useRef(de);D.current=de;const ee=m.useRef(null),_e=m.useRef(null),Se=m.useRef(y);Se.current=y;const te=m.useRef(t);te.current=t;const se=m.useCallback(o=>{we(o),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>we(null),5e3)},[]),ue=m.useCallback(o=>{ve(o),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>ve(null),5e3)},[]),me=m.useCallback(o=>{var C;if(o===D.current)return;const h=D.current;D.current=o,Z(o);try{localStorage.setItem(ae,o)}catch{}(C=_e.current)==null||C.setPermissionMode(o).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)}`),D.current=h,Z(h)})},[se]),A=m.useMemo(()=>new bs(s,k,{onStatusChange:o=>{c(o),_(o==="running"||o==="requires_action")},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{T(h=>h.some(C=>C.requestId===o.requestId)?h:[...h,o])},onModelsStateChange:o=>{O(o)},onSubagentUpdate:o=>{oe(o)},onControlResponse:o=>{const h=ee.current;if(!(!h||h.requestId!==o.requestId)&&(ee.current=null,o.subtype==="error")){D.current=h.previous,Z(h.previous);try{localStorage.setItem(ae,h.previous)}catch{}se(o.error||"模式切换失败")}},onPermissionModeChange:o=>{if(o!==D.current){D.current=o,Z(o);try{localStorage.setItem(ae,o)}catch{}ee.current=null}},onUsageChange:o=>{ie(h=>({inputTokens:Math.max((h==null?void 0:h.inputTokens)??0,o.inputTokens),outputTokens:Math.max((h==null?void 0:h.outputTokens)??0,o.outputTokens),totalCostUsd:o.totalCostUsd??(h==null?void 0:h.totalCostUsd)??null}))},onElicitationRequest:o=>{X(o)}}),[s,se]);m.useEffect(()=>(_e.current=A,()=>{A.disconnect()}),[A]),m.useEffect(()=>{let o=!1;async function h(){var C;p("");try{const v=await Dt(s);if(o)return;n(v),c(v.status),be(v.status)&&A.markClosed(),_(v.status==="running"||v.status==="requires_action"),(C=te.current)==null||C.call(te,v)}catch(v){if(o)return;p(v instanceof Error?v.message:w("session.loadFailed"));return}try{await A.init()}catch(v){console.warn("Failed to init adapter:",v)}}return h(),()=>{o=!0}},[s,A]);const U=be(l),H=(r==null?void 0:r.access_level)==="read",xe=m.useCallback(()=>{k([]),Ct(s).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[s]),ne=m.useCallback(async o=>{const h=o.text.trim(),C=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!h&&!C||U)return;const v=await Et(h,{sessionId:s,availableCommands:Re,availableModels:(E==null?void 0:E.availableModels)??[],currentModel:E?{modelId:E.currentModelId,name:E.currentModelId}:null,supportsImages:!0,entries:Se.current,setModel:async $=>{await F(s,{type:"control_request",request:{subtype:"set_model",model:$}}),O(he=>he&&{...he,currentModelId:$})},onNewSession:()=>{k([])}}).catch(()=>null);if(v){if(Mt("[SessionDetail] local command result",v),"clearEntries"in v&&v.clearEntries){xe();return}if("newSession"in v&&v.newSession){xe();return}if("userEntry"in v){k($=>[...$,v.userEntry,v.cmdEntry]);return}}_(!0);try{await A.sendMessage(h,o.images,o.attachments)}catch($){if(console.error("Send failed:",$),$ instanceof Tt&&$.type==="session_closed"){c("archived"),A.markClosed(),ue(w("session.closedSendBlocked"));return}ue(`${w("session.sendFailed")}${$ instanceof Error?`: ${$.message}`:""}`)}},[A,U,s,E,xe,ue]),rt=m.useCallback(o=>{if(g){V(h=>[...h,o]);return}ne(o)},[g,ne]),pe=m.useRef(!1);m.useEffect(()=>{if(U){V(h=>h.length>0?[]:h);return}if(g||z.length===0||pe.current)return;const o=z[0];o&&(pe.current=!0,V(h=>h.slice(1)),ne(o).finally(()=>{pe.current=!1}))},[g,z,ne,U]);const Ce=m.useCallback(async()=>{try{await A.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{_(!1)}},[A]),at=m.useCallback(()=>{me(Ls(D.current))},[me]);m.useEffect(()=>()=>{G.current&&clearTimeout(G.current),K.current&&clearTimeout(K.current)},[]);const ot=m.useCallback(async()=>{if(r&&window.confirm(w("dashboard.confirmDelete").replace("{id}",r.title||r.id)))try{await At(r.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:w("dashboard.deleteFailed"))}},[r]),it=m.useCallback(async o=>{try{await A.respondPermission(o,!0)}catch(h){console.error("Failed to approve:",h)}T(h=>h.filter(C=>C.requestId!==o))},[A]),lt=m.useCallback(async(o,h)=>{try{await A.respondPermission(o,!0,{updated_permissions:h})}catch(C){console.error("Failed to approve with rules:",C)}T(C=>C.filter(v=>v.requestId!==o))},[A]),ct=m.useCallback(async(o,h)=>{const C=L;if(X(null),!!C)try{await A.respondElicitation(C.requestId,o,h)}catch(v){console.error("Failed to submit elicitation:",v)}},[L,A]),dt=m.useCallback(()=>{!r||H||(je(r.title||""),Q(!0),setTimeout(()=>{var o,h;(o=ce.current)==null||o.focus(),(h=ce.current)==null||h.select()},0))},[r,H]),Ee=m.useCallback(async()=>{const o=le.trim();if(Q(!1),!(!r||!o||o===r.title))try{const h=await Rt(r.id,o);n(C=>C&&{...C,title:h.title??o})}catch(h){console.error("Rename failed:",h),alert(h instanceof Error?h.message:"重命名失败")}},[r,le]),ut=m.useCallback(async o=>{try{await A.respondPermission(o,!1)}catch(h){console.error("Failed to reject:",h)}T(h=>h.filter(C=>C.requestId!==o))},[A]),mt=m.useCallback(async(o,h,C)=>{try{await F(s,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:C,answers:h}})}catch(v){console.error("Failed to submit answers:",v)}T(v=>v.filter($=>$.requestId!==o))},[s]),xt=m.useCallback(async(o,h,C)=>{try{h==="no"?await F(s,{type:"permission_response",approved:!1,request_id:o,...C?{message:C}:{}}):await F(s,{type:"permission_response",approved:!0,request_id:o,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)}T(v=>v.filter($=>$.requestId!==o))},[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:w("session.backToDashboard")})]})}):r?r.source==="acp"&&r.environment_id?e.jsx(Vs,{sessionId:s,agentId:r.environment_id}):e.jsx(We,{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:ce,value:le,onChange:o=>je(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),Ee()):o.key==="Escape"&&(o.preventDefault(),Q(!1))},onBlur:()=>void Ee(),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}),!H&&!U&&e.jsx("button",{type:"button",onClick:dt,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($t,{className:"h-3.5 w-3.5"})})]}),r.visibility&&!S&&e.jsx(Vt,{visibility:r.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var C;const o=r.source==="acp"?"acp":(C=r.environment)==null?void 0:C.worker_type,h=Ht(o);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${h.colorClass}`,children:h.fullLabel})})(),l&&e.jsx(Le,{status:l}),e.jsx("span",{className:"text-xs text-text-muted",children:He(r.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>u(!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:w("artifacts.title"),children:e.jsx(It,{className:"h-3.5 w-3.5"})}),!H&&(r==null?void 0:r.access_level)!=="write"&&e.jsx("button",{onClick:()=>i(!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:w("session.share"),children:e.jsx(ds,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>j(!b),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:w("session.info"),children:e.jsx(ss,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>x(!f),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:[w("session.tasks"),R.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:R.length})]})]})]}),b&&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:w("session.metaSession")})," ",r.id]}),r.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:w("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(Qt,{sessionId:s,embedded:!0})})}),e.jsx(Pt,{entries:y,isLoading:g,emptyTitle:w("session.emptyTitle"),emptyDescription:w("session.emptyDescription")}),e.jsx(Es,{state:B}),R.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:R.map(o=>e.jsx(zs,{request:o,onApprove:()=>it(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>lt(o.requestId,o.suggestions??[]):void 0,onReject:()=>ut(o.requestId),onSubmitAnswers:mt,onSubmitPlan:xt},o.requestId))})}),L&&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(Is,{request:L,onSubmit:ct})})}),Ne&&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:Ne})}),ke&&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:ke})}),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(Bs,{mode:de,onModeChange:me,disabled:U||H}),e.jsx(Hs,{models:(E==null?void 0:E.availableModels)??[],currentModelId:(E==null?void 0:E.currentModelId)??null,onSelect:o=>{F(s,{type:"control_request",request:{subtype:"set_model",model:o}}),O(h=>h&&{...h,currentModelId:o})},disabled:U||H})]}),P&&e.jsxs("span",{className:"text-[11px] text-text-muted font-mono",title:"会话累计用量(input 含缓存读写)",children:[Oe(P.inputTokens)," in / ",Oe(P.outputTokens)," out",P.totalCostUsd!=null&&` · $${P.totalCostUsd.toFixed(2)}`]})]}),e.jsx(qt,{onSubmit:rt,isLoading:g,onInterrupt:Ce,onCycleMode:at,disabled:U||H,placeholder:U?w("session.closed"):H?w("session.readOnly"):w("session.inputPlaceholder"),supportsAttachments:!0,commands:Re,queueWhileLoading:!0,queuedCount:z.length,onDequeue:o=>V(h=>h.filter((C,v)=>v!==o)),onSearchFiles:o=>A.searchFiles(o)}),f&&r&&e.jsx(Ns,{onClose:()=>x(!1),session:r,liveStatus:l,pendingPermissions:R,onInterrupt:Ce,onDelete:ot}),e.jsx(Us,{open:N,onClose:()=>i(!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:w("session.loading")})})}function zs({request:s,onApprove:t,onApproveAlways:r,onReject:n,onSubmitAnswers:l,onSubmitPlan:c}){const d=s.toolName,p=s.toolInput,f=s.description||"";if(d==="AskUserQuestion"){const x=p.questions||[];return e.jsx(Ts,{requestId:s.requestId,questions:x,description:f,onSubmit:b=>l(s.requestId,b,x),onSkip:n})}if(d==="ExitPlanMode"){const x=p.plan||"";return e.jsx(Rs,{requestId:s.requestId,planContent:x,description:f,onSubmit:(b,j)=>c(s.requestId,b,j)})}return e.jsx(Ms,{requestId:s.requestId,toolName:d,toolInput:p,description:f,suggestions:s.suggestions,onApprove:t,onApproveAlways:r,onReject:n})}function Vs({sessionId:s,agentId:t}){const[r,n]=m.useState(null),[l,c]=m.useState("disconnected"),[d,p]=m.useState(null),f=m.useRef(null);return m.useEffect(()=>{const x=Os(t);return x.setConnectionStateHandler((b,j)=>{c(b),p(j||null)}),f.current=x,n(x),x.connect().catch(b=>{b instanceof Ut||(p(b.message),c("error"))}),()=>{x.disconnect(),f.current=null,n(null),c("disconnected")}},[t]),e.jsx(We,{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:w("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:w("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(Ft,{client:r,agentId:t})})]})})}export{rn as SessionDetail};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./vendor-DE_-CLIE.js";import{ab as c,U as n,a9 as i}from"./main-
|
|
1
|
+
import{j as e}from"./vendor-DE_-CLIE.js";import{ab as c,U as n,a9 as i}from"./main-2FF76CHO.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as v,am as t}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function k({onSuccess:p,onAlreadyDone:b}){const{setup:f}=v(),[n,h]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[d,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==d){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await f(n,l,a),p()}catch(x){const u=x instanceof Error?x.message:"Setup failed";if(u.includes("already")||u.includes("409")){b();return}o(u)}finally{m(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.apiKey")}),e.jsx("input",{type:"password",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"off",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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:d,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",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"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{k as Setup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a2 as m,b as h}from"./main-
|
|
1
|
+
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a2 as m,b as h}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){const[t,r]=d.useState("loading"),[i,a]=d.useState(""),l=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),o=l?l[1]:null;return d.useEffect(()=>{if(!o){r("invalid"),a("Share link is invalid — no token found.");return}if(!o.startsWith("shr_")){r("invalid"),a("Invalid share token format.");return}let n=!1;async function c(){try{const s=await m(o);if(n)return;window.location.href=`/code/${s.id}`}catch(s){if(n)return;s instanceof h?s.status===401&&s.message.toLowerCase().includes("expired")?(r("expired"),a("This share has expired.")):s.status===404?s.message.toLowerCase().includes("session")?(r("not_found"),a("Session not found.")):(r("invalid"),a("Share not found or has been revoked.")):s.status===403?(r("invalid"),a("You do not have permission to access this share.")):(r("error"),a(s.message||"Failed to resolve share.")):(r("error"),a(s instanceof Error?s.message:"Failed to resolve share."))}}return c(),()=>{n=!0}},[o]),d.useEffect(()=>{if(t!=="loading"&&t!=="error"){const n=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(n)}},[t]),t==="loading"?e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",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",{children:"Resolving share link..."})]})}):e.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-primary",children:e.jsxs("div",{className:"text-center max-w-md px-4",children:[t==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Share Expired"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share has expired."})]}),t==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Invalid Share"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"This share link is invalid or has been revoked."})]}),t==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Not Found"}),e.jsx("p",{className:"text-text-muted mb-4",children:i||"The session could not be found."})]}),t==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:"Error"}),e.jsx("p",{className:"text-status-error mb-4",children:i})]}),e.jsx("a",{href:"/code",className:"text-brand hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{ar as f,as as y,am as r}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S(){f();const{createTeam:u}=y(),[o,p]=a.useState(""),[s,c]=a.useState(""),[i,b]=a.useState(""),[m,l]=a.useState(null),[d,x]=a.useState(!1),h=t=>{p(t),s||c(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},g=async t=>{t.preventDefault(),l(null),x(!0);try{const n=await u({name:o,slug:s,description:i||void 0});window.location.href=`/teams/${n.slug}`}catch(n){l(n instanceof Error?n.message:"Failed to create team")}finally{x(!1)}};return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"mb-10 font-display text-2xl font-semibold tracking-tight text-text-primary",children:r("team.create.title")}),e.jsxs("form",{onSubmit:g,className:"max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.name")}),e.jsx("input",{id:"name",type:"text",required:!0,value:o,onChange:t=>h(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"Engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.nameHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"slug",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.slug")}),e.jsx("input",{id:"slug",type:"text",required:!0,value:s,onChange:t=>c(t.target.value),pattern:"^[a-z0-9-]{3,32}$",className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",placeholder:"engineering"}),e.jsx("p",{className:"mt-1.5 text-xs text-text-muted",children:r("team.create.slugHint")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:r("team.create.description")}),e.jsx("textarea",{id:"description",value:i,onChange:t=>b(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:r("common.cancel")}),e.jsx("button",{type:"submit",disabled:d||!o||!s,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:d?r("common.creating"):r("team.create.submit")})]})]})]})})}export{S as TeamCreate};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{ab as H,B as T,
|
|
1
|
+
import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{ab as H,B as T,ar as P,am as i,d as B,X as z,x as G,Y as I,a7 as q,a6 as W,aq as Y,S as X,a9 as J,j as K,o as Q,P as V,k as Z,m as ee,l as M,n as te,z as se}from"./main-2FF76CHO.js";import{U as ae}from"./UserSearchInput-DM6V0r1B.js";import{C as D}from"./copy-BFkM6GS4.js";import{g as ne}from"./workerType-Bd-zteMi.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{j as e}from"./vendor-DE_-CLIE.js";import{as as l,p as a}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function c(){const{myTeams:t,isLoading:i}=l();return i?e.jsx("div",{className:"px-6 py-20 sm:px-10",children:e.jsxs("div",{className:"max-w-4xl",children:[e.jsx("div",{className:"h-8 w-32 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"mt-12 space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]})}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-16",children:[e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary sm:text-4xl",children:"Teams"}),e.jsx("p",{className:"mt-3 text-sm text-text-muted",children:t.length===0?"Create your first team to start collaborating.":`${t.length} ${t.length===1?"team":"teams"}`})]}),t.length===0?e.jsx("div",{className:"py-8",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md bg-accent px-5 py-2.5 text-sm font-medium text-white transition-all hover:bg-accent/90 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"Create team"]})}):e.jsx("ul",{className:"space-y-10",children:t.map(s=>e.jsx("li",{children:e.jsxs("a",{href:`/teams/${s.slug}`,className:"group block",children:[e.jsxs("div",{className:"flex items-baseline gap-4",children:[e.jsx("h2",{className:"font-display text-xl font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:"No description"})]})},s.id))}),t.length>0&&e.jsx("div",{className:"mt-16",children:e.jsxs("a",{href:"/teams/new",className:"inline-flex items-center gap-2 rounded-md border border-border px-4 py-2 text-sm font-medium text-text-primary transition-all hover:bg-surface-2 active:translate-y-px",children:[e.jsx(a,{className:"h-4 w-4"}),"New team"]})})]})}export{c as TeamList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{B as c}from"./main-
|
|
1
|
+
import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{B as c}from"./main-2FF76CHO.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";async function j(s){try{const r=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await c("GET",r)}catch{return null}}async function w(s,r){await c("PATCH",`/web/teams/${s}`,r)}async function N(s){await c("DELETE",`/web/teams/${s}`)}function k(){const s=window.location.pathname.split("/"),r=s[s.length-2]||"",[a,h]=n.useState(null),[b,y]=n.useState(!0),[i,m]=n.useState(""),[l,d]=n.useState(""),[u,o]=n.useState(null),[x,p]=n.useState(!1);n.useEffect(()=>{r&&j(r).then(t=>{t&&(h(t),m(t.name),d(t.description||"")),y(!1)})},[r]);const g=async t=>{if(t.preventDefault(),!!a){o(null),p(!0);try{await w(a.id,{name:i,description:l}),window.location.href=`/teams/${a.slug}`}catch(f){o(f instanceof Error?f.message:"Failed to update")}finally{p(!1)}}},v=async()=>{if(a&&window.confirm("Delete this team? Environments must be transferred first."))try{await N(a.id),window.location.href="/teams"}catch(t){o(t instanceof Error?t.message:"Failed to delete")}};return b?e.jsx("div",{className:"flex items-center justify-center py-12 text-text-muted",children:"Loading..."}):a?e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-12",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:a.name}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:["/",a.slug]})]}),e.jsxs("form",{onSubmit:g,className:"mb-16 max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:"Team Name"}),e.jsx("input",{id:"name",type:"text",required:!0,value:i,onChange:t=>m(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:"Description"}),e.jsx("textarea",{id:"description",value:l,onChange:t=>d(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),u&&e.jsx("p",{className:"text-sm text-destructive",children:u}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:x||!i,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:x?"Saving...":"Save Changes"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-sm font-medium text-destructive",children:"Delete team"}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Deleting a team requires all environments to be transferred first."}),e.jsx("button",{type:"button",onClick:v,className:"rounded-md border border-destructive/60 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors",children:"Delete Team"})]})]})}):e.jsxs("div",{className:"mx-auto max-w-lg px-4 py-8",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})}export{k as TeamSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{ar as v,am as l,B as S}from"./main-2FF76CHO.js";function C({onSelect:o,excludeUserIds:x=[],placeholder:u,actionLabel:m,actionDisabled:h=!1,className:p}){v();const[n,c]=a.useState(""),[b,s]=a.useState([]),[i,d]=a.useState(!1),f=async e=>{if(c(e),e.trim().length<2){s([]);return}d(!0);try{const N=await S("GET",`/web/users/search?q=${encodeURIComponent(e.trim())}`);s(N)}catch{s([])}finally{d(!1)}},y=e=>{o(e),c(""),s([])},r=b.filter(e=>!x.includes(e.id)),g=m??l("invitation.add"),j=u??l("invitation.searchUser");return t.jsxs("div",{className:p,children:[t.jsx("input",{type:"text",value:n,onChange:e=>f(e.target.value),placeholder:j,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"}),i&&t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"Searching..."}),r.length>0&&t.jsx("ul",{className:"mt-2 divide-y divide-border rounded border border-border bg-surface-1",children:r.map(e=>t.jsxs("li",{className:"flex items-center justify-between px-3 py-2 text-sm",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-text-primary",children:e.username}),t.jsx("div",{className:"truncate font-mono text-xs text-text-muted",children:e.id})]}),t.jsx("button",{type:"button",onClick:()=>y(e.id),disabled:h,className:"rounded bg-accent px-2 py-1 text-xs text-white hover:bg-accent/90 disabled:opacity-50",children:g})]},e.id))}),n.trim().length>=2&&r.length===0&&!i&&t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"No users found."})]})}export{C as U};
|