@saluzi/saluzi-edu 0.2.71 → 0.2.73
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 +52 -52
- package/dist/guide/guide-data.json +4 -0
- package/dist/rcs-web/assets/{AdminPanel-8HNxSZw0.js → AdminPanel-DMClbUbi.js} +1 -1
- package/dist/rcs-web/assets/ArtifactView-CUDKNi6z.js +6 -0
- package/dist/rcs-web/assets/{ArtifactsGallery-DQj98ptl.js → ArtifactsGallery-B3OCFJ7T.js} +17 -12
- package/{packages/remote-control-server/web/dist/assets/Claim-Dfdhnggp.js → dist/rcs-web/assets/Claim-BOkou3Kj.js} +1 -1
- package/dist/rcs-web/assets/{Dashboard-DnLE2gtW.js → Dashboard-DxcBkyhD.js} +1 -1
- package/dist/rcs-web/assets/{Join-Cgq7v-Sb.js → Join-DZ_EUsnw.js} +1 -1
- package/dist/rcs-web/assets/{Login-CpRVSamw.js → Login-Ct6Z1ih0.js} +1 -1
- package/dist/rcs-web/assets/{Register-CvCuP-ww.js → Register-D3Sub3V4.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-CC1Y-JXz.js +60 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-7ElYQ4hP.js → SessionVisibilityBadge-B33i8RLj.js} +1 -1
- package/dist/rcs-web/assets/{Setup-DH5NCalW.js → Setup-COecVpRC.js} +1 -1
- package/dist/rcs-web/assets/{ShareLanding-B48Z1tak.js → ShareLanding-B7ZdGScC.js} +1 -1
- package/dist/rcs-web/assets/{TeamCreate-tXM5yKmq.js → TeamCreate-BKeJj9CV.js} +1 -1
- package/dist/rcs-web/assets/{TeamDetail-3jPhrX5z.js → TeamDetail-BAG50yxf.js} +1 -1
- package/dist/rcs-web/assets/{TeamList-DylGNt59.js → TeamList-B2kk8eh4.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-CoBx_q55.js → TeamSettings-h8JWw1pp.js} +1 -1
- package/dist/rcs-web/assets/{UserSearchInput-DM6V0r1B.js → UserSearchInput-DSeymf7O.js} +1 -1
- package/dist/rcs-web/assets/{UserSettings-CxuLje2z.js → UserSettings-9wOVTete.js} +1 -1
- package/dist/rcs-web/assets/{arc-BrQup1CU.js → arc-DBopY3EY.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-l1NuwJAC.js → architectureDiagram-3BPJPVTR-BTnFS82c.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-B8Sve1cP.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-C8IgW5pQ.js → c4Diagram-AAUBKEIU-BIOzYRjo.js} +1 -1
- package/dist/rcs-web/assets/channel-CbznqW4C.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-Cz-fnX8Q.js → chunk-2J33WTMH-Bs-8U7DE.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-s0k1FsPS.js → chunk-4BX2VUAB-BnQJ0pbh.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-k7MztSxj.js → chunk-55IACEB6-Cxuu3aYy.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-DCD6b_gA.js → dist/rcs-web/assets/chunk-727SXJPM-CcLR90xa.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-ByLnKNaa.js → dist/rcs-web/assets/chunk-AQP2D5EJ-BwA_vlbi.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-DnoA9fQr.js → chunk-FMBD7UC4-Clf6X7Ml.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-BsbvPHC6.js → chunk-ND2GUHAM-DUVg4YJL.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-DnHGOmkn.js → chunk-QZHKN3VN-mPQkR0NB.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-rJ7tuSw-.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-rJ7tuSw-.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-Br6udBTB.js → code-block-IT6T5CEO-BAgpDt13.js} +1 -1
- package/dist/rcs-web/assets/{copy-BFkM6GS4.js → copy-BdcZVl_u.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-ChN-rm-T.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-B6DjpMte.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-Dy0qgRIV.js → dist/rcs-web/assets/dagre-BM42HDAG-D_NsO2qH.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-ByiBm-x4.js → diagram-2AECGRRQ-B0NVIr-5.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-rGbxhf-H.js → diagram-5GNKFQAL-C21xttLi.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-COdwodvi.js → diagram-KO2AKTUF-D6TKZ2qP.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-EjqjzeZY.js → diagram-LMA3HP47-DJQYNR0l.js} +1 -1
- package/dist/rcs-web/assets/{diagram-OG6HWLK6-DSPVSdmJ.js → diagram-OG6HWLK6-DBgsUCQK.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dialog-aHICCHyK.js → dist/rcs-web/assets/dialog-niHgO9y4.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-DZBAaLMb.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-B3MCOL04.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-DJHAIGo5.js → flowDiagram-I6XJVG4X-Ct5UrMg4.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CETj1zUQ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-CTYvU4m1.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-n-NVaNrp.js → infoDiagram-5YYISTIA-iVIf58oN.js} +1 -1
- package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-D7nU29iu.js → ishikawaDiagram-YF4QCWOH-C8rLSSN0.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-De0htrHG.js → journeyDiagram-JHISSGLW-CCCe44Y_.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-C5rnfLlw.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-D-2jpn6m.js} +1 -1
- package/dist/rcs-web/assets/{linear-BkfmaOFV.js → linear-jT5e6iMk.js} +1 -1
- package/dist/rcs-web/assets/{main-2FF76CHO.js → main-49JlcYCi.js} +4 -4
- package/dist/rcs-web/assets/main-C1pGF5LM.css +1 -0
- package/dist/rcs-web/assets/{mermaid-VLURNSYL-CAb8MsJr.js → mermaid-VLURNSYL-DLOgnkPH.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-dT6jK4cB.js → mermaid.core-DfoO5KWy.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-KBR776rc.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-COp3rAIF.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-aGUqFGVT.js → pieDiagram-4H26LBE5-CzxhXChG.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-DbWbBGjW.js → quadrantDiagram-W4KKPZXB-BSF1quon.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-CRIIsSnh.js → requirementDiagram-4Y6WPE33-GGLkdBIg.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-ClAqJ5Dt.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-DpwCRJwm.js → sequenceDiagram-3UESZ5HK-CTMkKLqv.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-Dx-tpSSo.js → stateDiagram-AJRCARHV-CsKOZlpT.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js → stateDiagram-v2-BHNVJYJU-DDEvqYzH.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-CUVrbUF6.js → timeline-definition-PNZ67QCA-Ce-IRZf_.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-Bjoy1hva.js → vennDiagram-CIIHVFJN-BumbI6qO.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Xv7_ml_a.js → wardleyDiagram-YWT4CUSO-B5A3bkUP.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CMv6nVsy.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CNudFFGs.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +3 -2
- package/packages/remote-control-server/src/__tests__/artifacts.test.ts +211 -0
- package/packages/remote-control-server/src/routes/web/artifacts.ts +57 -5
- package/packages/remote-control-server/src/services/artifacts.ts +51 -4
- package/packages/remote-control-server/src/services/event-persistence.ts +13 -4
- package/packages/remote-control-server/src/services/transport.ts +10 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-8HNxSZw0.js → AdminPanel-DMClbUbi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-CUDKNi6z.js +6 -0
- package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-DQj98ptl.js → ArtifactsGallery-B3OCFJ7T.js} +17 -12
- package/{dist/rcs-web/assets/Claim-Dfdhnggp.js → packages/remote-control-server/web/dist/assets/Claim-BOkou3Kj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Dashboard-DnLE2gtW.js → Dashboard-DxcBkyhD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Join-Cgq7v-Sb.js → Join-DZ_EUsnw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-CpRVSamw.js → Login-Ct6Z1ih0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-CvCuP-ww.js → Register-D3Sub3V4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-CC1Y-JXz.js +60 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-7ElYQ4hP.js → SessionVisibilityBadge-B33i8RLj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Setup-DH5NCalW.js → Setup-COecVpRC.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-B48Z1tak.js → ShareLanding-B7ZdGScC.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamCreate-tXM5yKmq.js → TeamCreate-BKeJj9CV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamDetail-3jPhrX5z.js → TeamDetail-BAG50yxf.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamList-DylGNt59.js → TeamList-B2kk8eh4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-CoBx_q55.js → TeamSettings-h8JWw1pp.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-DM6V0r1B.js → UserSearchInput-DSeymf7O.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSettings-CxuLje2z.js → UserSettings-9wOVTete.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-BrQup1CU.js → arc-DBopY3EY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-l1NuwJAC.js → architectureDiagram-3BPJPVTR-BTnFS82c.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-B8Sve1cP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-C8IgW5pQ.js → c4Diagram-AAUBKEIU-BIOzYRjo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-CbznqW4C.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Cz-fnX8Q.js → chunk-2J33WTMH-Bs-8U7DE.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-s0k1FsPS.js → chunk-4BX2VUAB-BnQJ0pbh.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-k7MztSxj.js → chunk-55IACEB6-Cxuu3aYy.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-DCD6b_gA.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CcLR90xa.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-ByLnKNaa.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BwA_vlbi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DnoA9fQr.js → chunk-FMBD7UC4-Clf6X7Ml.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-BsbvPHC6.js → chunk-ND2GUHAM-DUVg4YJL.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-DnHGOmkn.js → chunk-QZHKN3VN-mPQkR0NB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-rJ7tuSw-.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-rJ7tuSw-.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-Br6udBTB.js → code-block-IT6T5CEO-BAgpDt13.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-BFkM6GS4.js → copy-BdcZVl_u.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-ChN-rm-T.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-B6DjpMte.js} +1 -1
- package/{dist/rcs-web/assets/dagre-BM42HDAG-Dy0qgRIV.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-D_NsO2qH.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-ByiBm-x4.js → diagram-2AECGRRQ-B0NVIr-5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-rGbxhf-H.js → diagram-5GNKFQAL-C21xttLi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-COdwodvi.js → diagram-KO2AKTUF-D6TKZ2qP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-EjqjzeZY.js → diagram-LMA3HP47-DJQYNR0l.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DSPVSdmJ.js → diagram-OG6HWLK6-DBgsUCQK.js} +1 -1
- package/{dist/rcs-web/assets/dialog-aHICCHyK.js → packages/remote-control-server/web/dist/assets/dialog-niHgO9y4.js} +1 -1
- package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-DZBAaLMb.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-B3MCOL04.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-DJHAIGo5.js → flowDiagram-I6XJVG4X-Ct5UrMg4.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CETj1zUQ.js} +1 -1
- package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-CTYvU4m1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-n-NVaNrp.js → infoDiagram-5YYISTIA-iVIf58oN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-D7nU29iu.js → ishikawaDiagram-YF4QCWOH-C8rLSSN0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-De0htrHG.js → journeyDiagram-JHISSGLW-CCCe44Y_.js} +1 -1
- package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-C5rnfLlw.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-D-2jpn6m.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-BkfmaOFV.js → linear-jT5e6iMk.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{main-2FF76CHO.js → main-49JlcYCi.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/main-C1pGF5LM.css +1 -0
- package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-CAb8MsJr.js → mermaid-VLURNSYL-DLOgnkPH.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-dT6jK4cB.js → mermaid.core-DfoO5KWy.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-KBR776rc.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-COp3rAIF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-aGUqFGVT.js → pieDiagram-4H26LBE5-CzxhXChG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-DbWbBGjW.js → quadrantDiagram-W4KKPZXB-BSF1quon.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-CRIIsSnh.js → requirementDiagram-4Y6WPE33-GGLkdBIg.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-ClAqJ5Dt.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-DpwCRJwm.js → sequenceDiagram-3UESZ5HK-CTMkKLqv.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-Dx-tpSSo.js → stateDiagram-AJRCARHV-CsKOZlpT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js → stateDiagram-v2-BHNVJYJU-DDEvqYzH.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-CUVrbUF6.js → timeline-definition-PNZ67QCA-Ce-IRZf_.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-Bjoy1hva.js → vennDiagram-CIIHVFJN-BumbI6qO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Xv7_ml_a.js → wardleyDiagram-YWT4CUSO-B5A3bkUP.js} +1 -1
- package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CMv6nVsy.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CNudFFGs.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/ArtifactView-2di4r0Cr.js +0 -6
- package/dist/rcs-web/assets/SessionDetail-CTa4JN6V.js +0 -60
- package/dist/rcs-web/assets/channel-DqfyWDcz.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +0 -1
- package/dist/rcs-web/assets/external-link-Cb0Qh2uy.js +0 -6
- package/dist/rcs-web/assets/main-C2O-g177.css +0 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-2di4r0Cr.js +0 -6
- package/packages/remote-control-server/web/dist/assets/SessionDetail-CTa4JN6V.js +0 -60
- package/packages/remote-control-server/web/dist/assets/channel-DqfyWDcz.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +0 -1
- package/packages/remote-control-server/web/dist/assets/external-link-Cb0Qh2uy.js +0 -6
- package/packages/remote-control-server/web/dist/assets/main-C2O-g177.css +0 -1
|
@@ -1 +1 @@
|
|
|
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-
|
|
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-49JlcYCi.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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{e as i,j as e}from"./vendor-DE_-CLIE.js";import{ab as N,ar as v,V as g,am as s,K as w,aa as C,P as k,z as _}from"./main-49JlcYCi.js";import{E,C as $}from"./ArtifactsGallery-B3OCFJ7T.js";import{C as L}from"./copy-BdcZVl_u.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";import"./dialog-niHgO9y4.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 T=[["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"}]],A=N("refresh-cw",T);function P({artifactId:c,onBack:n}){v();const[t,o]=i.useState(null),[x,p]=i.useState(""),[f,d]=i.useState(!1),[u,m]=i.useState(0),[h,l]=i.useState(!1);i.useEffect(()=>{let a=!1;return g(c).then(r=>{a||o(r)}).catch(r=>{a||p(r instanceof Error?r.message:s("artifacts.viewNotFound"))}),()=>{a=!0}},[c]);const y=i.useCallback(a=>{l(!1),o(r=>r?{...r,...a}:a),m(r=>r+1)},[]),b=i.useCallback(async()=>{if(window.confirm(s("artifacts.delete")+" — "+c.slice(0,8)+"…?"))try{await w(c),n()}catch(a){alert(a instanceof Error?a.message:s("artifacts.deleteFailed"))}},[c,n]),j=i.useCallback(async()=>{if(!t)return;await C(`${window.location.origin}${t.url}`)&&(d(!0),setTimeout(()=>d(!1),1500))},[t]);return x?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:x}),e.jsx("button",{type:"button",onClick:n,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:n,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:()=>m(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(A,{className:"h-3.5 w-3.5"})}),t.can_manage&&e.jsx("button",{type:"button",onClick:()=>l(!0),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.edit"),children:e.jsx(k,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{type:"button",onClick:j,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")} · ${s("artifacts.linkNotice")}`,children:[e.jsx(L,{className:"h-3.5 w-3.5"}),f&&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(E,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:b,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(_,{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"},u),e.jsx($,{open:h,onClose:()=>l(!1),onCreated:y,editArtifact:t})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:s("common.loading")})}export{P as ArtifactView};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import{e as
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ab as _,ar as K,W as O,am as a,K as $,aa as q,F as z,g as G,P as V,z as W,p as P,V as U,H as Y,b as J}from"./main-49JlcYCi.js";import{D as Q,a as X,c as Z,d as ee,b as te}from"./dialog-niHgO9y4.js";import{C as ae}from"./copy-BdcZVl_u.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 se=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],re=_("external-link",se),T=`body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 860px; margin: 2rem auto; padding: 0 1rem; color: #1a1a1a; }
|
|
2
7
|
h1 { font-size: 22px; } h1, h2 { color: #1a1a1a; }
|
|
3
8
|
.badge { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 500; }
|
|
4
9
|
.badge.ok { background: #dcfce7; color: #166534; }
|
|
@@ -6,14 +11,14 @@ h1 { font-size: 22px; } h1, h2 { color: #1a1a1a; }
|
|
|
6
11
|
.badge.err { background: #fee2e2; color: #991b1b; }
|
|
7
12
|
.badge.info { background: #e0e7ff; color: #3730a3; }
|
|
8
13
|
.muted { color: #6b7280; font-size: 12px; }
|
|
9
|
-
.meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 8px 0 20px; }`,
|
|
14
|
+
.meta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 8px 0 20px; }`,ne=`<!DOCTYPE html>
|
|
10
15
|
<html lang="en">
|
|
11
16
|
<head>
|
|
12
17
|
<meta charset="utf-8">
|
|
13
18
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
14
19
|
<title>Untitled Artifact</title>
|
|
15
20
|
<style>
|
|
16
|
-
${
|
|
21
|
+
${T}
|
|
17
22
|
</style>
|
|
18
23
|
</head>
|
|
19
24
|
<body>
|
|
@@ -21,14 +26,14 @@ ${v}
|
|
|
21
26
|
<div class="meta"><span class="muted">Created from the RCS artifacts gallery</span></div>
|
|
22
27
|
<!-- content here -->
|
|
23
28
|
</body>
|
|
24
|
-
</html>`,
|
|
29
|
+
</html>`,ie=`<!DOCTYPE html>
|
|
25
30
|
<html lang="en">
|
|
26
31
|
<head>
|
|
27
32
|
<meta charset="utf-8">
|
|
28
33
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
29
34
|
<title>PR Review</title>
|
|
30
35
|
<style>
|
|
31
|
-
${
|
|
36
|
+
${T}
|
|
32
37
|
.file { border: 1px solid #e5e7eb; border-radius: 8px; margin: 12px 0; overflow: hidden; }
|
|
33
38
|
.file-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #f9fafb; cursor: pointer; }
|
|
34
39
|
.file-head .name { font-family: ui-monospace, Menlo, monospace; font-size: 13px; flex: 1; }
|
|
@@ -103,14 +108,14 @@ function render() {
|
|
|
103
108
|
render();
|
|
104
109
|
<\/script>
|
|
105
110
|
</body>
|
|
106
|
-
</html>`,
|
|
111
|
+
</html>`,le=`<!DOCTYPE html>
|
|
107
112
|
<html lang="en">
|
|
108
113
|
<head>
|
|
109
114
|
<meta charset="utf-8">
|
|
110
115
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
111
116
|
<title>Incident Timeline</title>
|
|
112
117
|
<style>
|
|
113
|
-
${
|
|
118
|
+
${T}
|
|
114
119
|
#status-banner { border-radius: 8px; padding: 12px 16px; margin: 12px 0; font-weight: 500; }
|
|
115
120
|
#status-banner.investigating { background: #fef3c7; color: #92400e; }
|
|
116
121
|
#status-banner.mitigated { background: #dcfce7; color: #166534; }
|
|
@@ -169,14 +174,14 @@ document.getElementById('toggle').addEventListener('click', function () {
|
|
|
169
174
|
render();
|
|
170
175
|
<\/script>
|
|
171
176
|
</body>
|
|
172
|
-
</html>`,
|
|
177
|
+
</html>`,oe=`<!DOCTYPE html>
|
|
173
178
|
<html lang="en">
|
|
174
179
|
<head>
|
|
175
180
|
<meta charset="utf-8">
|
|
176
181
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
177
182
|
<title>Data Dashboard</title>
|
|
178
183
|
<style>
|
|
179
|
-
${
|
|
184
|
+
${T}
|
|
180
185
|
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
|
|
181
186
|
.kpi { border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; }
|
|
182
187
|
.kpi .label { font-size: 12px; color: #6b7280; }
|
|
@@ -259,14 +264,14 @@ function renderTable() {
|
|
|
259
264
|
renderKpis(); renderChart(); renderTable();
|
|
260
265
|
<\/script>
|
|
261
266
|
</body>
|
|
262
|
-
</html>`,
|
|
267
|
+
</html>`,de=`<!DOCTYPE html>
|
|
263
268
|
<html lang="en">
|
|
264
269
|
<head>
|
|
265
270
|
<meta charset="utf-8">
|
|
266
271
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
267
272
|
<title>Release Checklist</title>
|
|
268
273
|
<style>
|
|
269
|
-
${
|
|
274
|
+
${T}
|
|
270
275
|
.progress { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin: 14px 0 22px; }
|
|
271
276
|
.progress > div { height: 100%; background: #D77757; width: 0; transition: width .3s; }
|
|
272
277
|
.stage { margin: 18px 0; }
|
|
@@ -336,4 +341,4 @@ function render() {
|
|
|
336
341
|
render();
|
|
337
342
|
<\/script>
|
|
338
343
|
</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([]),[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};
|
|
344
|
+
</html>`,M=[{id:"blank",titleKey:"artifacts.create.templateBlank",descKey:"",defaultTitle:"Untitled Artifact",html:ne},{id:"pr-review",titleKey:"artifacts.create.templatePrReview",descKey:"artifacts.templateDesc.prReview",defaultTitle:"PR Review",html:ie},{id:"incident",titleKey:"artifacts.create.templateIncident",descKey:"artifacts.templateDesc.incident",defaultTitle:"Incident Timeline",html:le},{id:"dashboard",titleKey:"artifacts.create.templateDashboard",descKey:"artifacts.templateDesc.dashboard",defaultTitle:"Data Dashboard",html:oe},{id:"checklist",titleKey:"artifacts.create.templateChecklist",descKey:"artifacts.templateDesc.checklist",defaultTitle:"Release Checklist",html:de}];function S(n){return M.find(p=>p.id===n)??M[0]}function A(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function ce(n){if(!n)return"—";try{return new Date(n).toLocaleString()}catch{return n}}function me(n){if(!n)return null;const p=new Date(n).getTime();return Number.isNaN(p)?null:Math.ceil((p-Date.now())/(1440*60*1e3))}function pe({sessionId:n,embedded:p=!1,refreshTick:L}){K();const[y,l]=r.useState([]),[d,g]=r.useState(!0),[w,b]=r.useState(""),[u,o]=r.useState(!1),[x,f]=r.useState(null),[D,k]=r.useState(null),c=r.useCallback(async()=>{try{const t=await O(n?{session_id:n}:void 0);l(t||[]),b("")}catch(t){b(t instanceof Error?t.message:a("artifacts.loadFailed"))}finally{g(!1)}},[n]);r.useEffect(()=>{c();const t=setInterval(c,15e3);return window.addEventListener("focus",c),()=>{clearInterval(t),window.removeEventListener("focus",c)}},[c]);const E=r.useRef(!1);r.useEffect(()=>{if(!E.current){E.current=!0;return}c()},[L,c]);const h=r.useCallback(t=>{o(!1),f(null),l(i=>[t,...i.filter(C=>C.id!==t.id)])},[]),I=r.useCallback(async t=>{if(window.confirm(a("artifacts.delete")+" — "+t.slice(0,8)+"…?"))try{await $(t),l(i=>i.filter(C=>C.id!==t))}catch(i){alert(i instanceof Error?i.message:a("artifacts.deleteFailed"))}},[]),j=r.useCallback(async t=>{await q(`${window.location.origin}${t.url}`)&&(k(t.id),setTimeout(()=>k(null),1500))},[]),N=r.useMemo(()=>y,[y]),v=e.jsxs(e.Fragment,{children:[w&&e.jsx("p",{className:"text-status-error text-sm",children:w}),d?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))}):N.length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[e.jsx(z,{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:N.map(t=>{const i=me(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," · ",A(t.size)]})]}),e.jsx("span",{className:`flex-shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${i!==null&&i<=0?"bg-status-error/15 text-status-error":i!==null&&i<=2?"bg-status-warning/15 text-status-warning":"bg-surface-3 text-text-muted"}`,children:i===null?"∞":`${i}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(G,{className:"h-3 w-3"}),ce(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(re,{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")} · ${a("artifacts.linkNotice")}`,children:[e.jsx(ae,{className:"h-3.5 w-3.5"}),D===t.id&&e.jsx("span",{className:"text-status-active",children:a("artifacts.copied")})]}),t.can_manage&&e.jsx("button",{type:"button",onClick:()=>f(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.edit"),children:e.jsx(V,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>I(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(W,{className:"h-3.5 w-3.5"})})]})]},t.id)})})]});return p?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:()=>{f(null),o(!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(P,{className:"h-4 w-4"}),a("artifacts.new")]})]}),v,e.jsx(B,{open:u,onClose:()=>o(!1),onCreated:h,sessionId:n,editArtifact:x})]}):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:()=>{f(null),o(!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(P,{className:"h-4 w-4"}),a("artifacts.new")]})]}),v,e.jsx(B,{open:u,onClose:()=>o(!1),onCreated:h,sessionId:n,editArtifact:x})]})}function B({open:n,onClose:p,onCreated:L,sessionId:y,editArtifact:l}){K();const d=!!l,[g,w]=r.useState("pr-review"),[b,u]=r.useState(""),[o,x]=r.useState(""),[f,D]=r.useState(30),[k,c]=r.useState(!1),[E,h]=r.useState(""),[I,j]=r.useState(!1),[N,v]=r.useState(!1);r.useEffect(()=>{n&&(w("pr-review"),D(30),c(!1),h(""),v(!1),l?(j(!0),u(l.title??""),x(""),U(l.id).then(s=>{u(s.title??""),x(s.content??""),s.can_manage===!1&&v(!0)}).catch(()=>v(!0)).finally(()=>j(!1))):(j(!1),u(""),x(S("pr-review").html)))},[n,l]);const t=s=>{w(s);const m=S(s);x(m.html),b.trim()||u(m.defaultTitle)},[i,C]=r.useState("");r.useEffect(()=>{const s=setTimeout(()=>C(o),300);return()=>clearTimeout(s)},[o]);const F=o.trim().length>0&&!k&&!I&&!N,H=async()=>{const s=o.trim();if(s){c(!0),h("");try{const m={html:s,ttl:f,title:b.trim()||(d?void 0:S(g).defaultTitle)};d?l&&(m.hash=l.id):y&&(m.session_id=y);const R=await Y(m);L(R)}catch(m){const R=m instanceof Error?m.message:"";m instanceof J&&m.status===404?h(a("artifacts.viewNotFound")):h(R||a(d?"artifacts.updateFailed":"artifacts.create.failed"))}finally{c(!1)}}};return e.jsx(Q,{open:n,onOpenChange:s=>s?void 0:p(),children:e.jsxs(X,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:[e.jsx(Z,{children:e.jsx(ee,{children:d?a("artifacts.editArtifact"):a("artifacts.create.title")})}),e.jsxs("div",{className:"space-y-4",children:[!d&&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:M.map(s=>e.jsxs("button",{type:"button",onClick:()=>t(s.id),className:`rounded-lg border p-3 text-left transition-colors ${g===s.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(s.titleKey)}),s.descKey&&e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:a(s.descKey)})]},s.id))})]}),d&&l&&e.jsxs("p",{className:"text-xs text-text-muted",children:[e.jsxs("span",{className:"font-mono",children:[l.id.slice(0,10),"…"]})," · v",l.version]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto] sm:items-end",children:[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:b,onChange:s=>u(s.target.value),placeholder:d?"":S(g).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-ttl",children:a("artifacts.create.ttl")}),e.jsx("div",{className:"flex items-center gap-2",children:[7,30].map(s=>e.jsxs("button",{type:"button",onClick:()=>D(s),className:`rounded-md border px-3 py-2 text-sm transition-colors ${f===s?"border-accent bg-accent/10 font-medium text-text-primary":"border-border text-text-secondary hover:border-accent/50"}`,children:[s,"d"]},s))})]})]}),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:o,onChange:s=>x(s.target.value),placeholder:d?"":S(g).html.slice(0,120)+"…",rows:12,spellCheck:!1,disabled:I,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 disabled:opacity-50"}),e.jsxs("div",{className:"mt-1 flex items-center justify-between text-xs text-text-muted",children:[e.jsx("span",{children:o.trim()?A(new Blob([o]).size):a("artifacts.create.contentRequired")}),e.jsx("span",{children:a("artifacts.create.ttlResetNote")})]})]}),i.trim()&&e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:a("artifacts.create.preview")}),e.jsx("iframe",{srcDoc:i,title:"preview",className:"h-56 w-full rounded-md border border-border bg-white",sandbox:"allow-scripts allow-popups allow-forms"})]}),N&&e.jsx("p",{className:"text-sm text-status-error",children:a("artifacts.viewNotFound")}),E&&e.jsx("p",{className:"text-sm text-status-error",children:E})]}),e.jsxs(te,{children:[e.jsx("button",{type:"button",onClick:p,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:H,disabled:!F,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"):d?a("artifacts.update"):a("artifacts.create.submit")})]})]})})}const ge=Object.freeze(Object.defineProperty({__proto__:null,ArtifactsGallery:pe,CreateArtifactDialog:B},Symbol.toStringTag,{value:"Module"}));export{pe as A,B as C,re as E,ge as a};
|
|
@@ -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-49JlcYCi.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 _,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-
|
|
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-49JlcYCi.js";import{g as D}from"./workerType-Bd-zteMi.js";import{S as Z}from"./SessionVisibilityBadge-B33i8RLj.js";import{D as z,a as G,c as J,d as K,b as X}from"./dialog-niHgO9y4.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{aq as v,am as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as v,am as t}from"./main-49JlcYCi.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{aq as f,am as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as f,am as t}from"./main-49JlcYCi.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{aq as y,am as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as y,am as t}from"./main-49JlcYCi.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 bt=Object.defineProperty;var jt=(s,t,r)=>t in s?bt(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;var E=(s,t,r)=>jt(s,typeof t!="symbol"?t+"":t,r);import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ab as D,_ as kt,ai as Ie,ak as wt,aj as we,a5 as Nt,af as je,a4 as L,$ as vt,x as We,g as Pe,ae as Qe,L as Ge,z as _t,w as St,ad as P,a9 as J,d as Ke,an as qe,a0 as Ct,J as Et,a3 as Mt,ar as Ye,am as w,A as Tt,ag as Rt,G as At,ao as $t,ac as It,b as Pt,N as qt,a1 as Dt,y as Je,P as Ut,F as Ft,c as Ot,C as Lt,R as De,Z as Bt,D as Ht,a as zt,q as Xe,s as Ze,v as Vt,f as et,e as tt,r as st,M as Wt}from"./main-49JlcYCi.js";import{g as Qt}from"./workerType-Bd-zteMi.js";import{D as nt,a as rt,c as at,d as ot,b as Gt}from"./dialog-niHgO9y4.js";import{E as Kt,A as Yt}from"./ArtifactsGallery-B3OCFJ7T.js";import{S as Jt}from"./SessionVisibilityBadge-B33i8RLj.js";import{U as Xt}from"./UserSearchInput-DSeymf7O.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";import"./copy-BdcZVl_u.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 Zt=[["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"}]],es=D("activity",Zt);/**
|
|
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 ts=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ss=D("chevron-right",ts);/**
|
|
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 ns=[["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"}]],it=D("cpu",ns);/**
|
|
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 rs=[["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"}]],as=D("hash",rs);/**
|
|
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 os=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],is=D("info",os);/**
|
|
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 ls=[["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"}]],cs=D("message-square-text",ls);/**
|
|
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 ds=[["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"}]],us=D("play",ds);/**
|
|
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 ms=[["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"}]],xs=D("server-cog",ms);/**
|
|
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 ps=[["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"}]],hs=D("share-2",ps);/**
|
|
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 fs=[["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"}]],ys=D("shield-check",fs);/**
|
|
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 gs=[["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"}]],bs=D("triangle-alert",gs);function lt(){return{tasks:{}}}const Ue=3e4;function oe(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 js(s,t){var u,p,f,x,g,j,N,i,a,m,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:oe(t.description??c.description),taskType:t.task_type??c.taskType,workflowName:t.workflow_name??c.workflowName,prompt:t.prompt??c.prompt,toolUseId:t.tool_use_id??c.toolUseId,status:"running",startTime:l,evictAfter:void 0}}};const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:oe(b),description:b,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:l}}}}if(r==="task_progress"){if(!c){const b=t.description??"";return{tasks:{...s.tasks,[n]:{taskId:n,name:oe(b),description:b,toolUseId:t.tool_use_id,status:"running",startTime:l,tokenCount:(u=t.usage)==null?void 0:u.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:((g=t.usage)==null?void 0:g.tool_uses)??c.toolUseCount,durationMs:((j=t.usage)==null?void 0:j.duration_ms)??c.durationMs,lastToolName:t.last_tool_name??c.lastToolName,summary:t.summary??c.summary}}}}return c?{tasks:{...s.tasks,[n]:{...c,status:t.status??"completed",endTime:l,finalSummary:t.summary??c.finalSummary,outputFile:t.output_file??c.outputFile,tokenCount:((m=t.usage)==null?void 0:m.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+Ue}}}:{tasks:{...s.tasks,[n]:{taskId:n,name:oe(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+Ue}}}}function ks(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 ws{constructor(){E(this,"listeners",new Set);E(this,"eventSource",null);E(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 u of this.listeners)u(c)}catch{}})}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._lastSeqNum=0}}const le=new ws;function Fe(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 Oe(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 ke="streaming-";function Ns(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 Le(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 vs{constructor(t,r,n){E(this,"sessionId");E(this,"setEntries");E(this,"unsub",null);E(this,"onStatusChange");E(this,"onError");E(this,"onPermissionRequest");E(this,"onModelsStateChange");E(this,"onSubagentUpdate");E(this,"onControlResponse");E(this,"onPermissionModeChange");E(this,"onUsageChange");E(this,"onElicitationRequest");E(this,"subagentState",lt());E(this,"seenUuids",new Set);E(this,"seenToolCallIds",new Set);E(this,"pendingControlRequests",new Map);E(this,"turnEnded",!1);E(this,"userSinceTurnEnd",!1);E(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,g,j;const{events:t}=await kt(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 m=i.tool_call_id;typeof m=="string"&&m&&this.seenToolCallIds.add(m)}if(N.type==="user"){if(N.direction==="inbound")continue;l();const m=Fe(i);m&&r.push({type:"user_message",id:N.id||`hist-user-${r.length}`,content:m})}else if(N.type==="assistant"){l();const m=Fe(i);if(Ie(m))continue;const y=[],k=i.message;if(k&&typeof k=="object"&&Array.isArray(k.content)){for(const b of k.content)if(b.type==="tool_use"){const C=b.id;C&&this.seenToolCallIds.add(C),y.push({type:"tool_call",toolCall:{id:C||`hist-tool-${r.length}`,title:b.name||"tool",status:"complete",rawInput:b.input||{}}})}}if(m||y.length>0){n={type:"assistant_message",id:N.id||`hist-asst-${r.length}`,chunks:m?[{type:"message",text:m}]:[]},r.push(n);for(const b of y)r.push(b);n=null}}else if(N.type==="tool_use"){const m=i,y={type:"tool_call",toolCall:{id:m.tool_call_id||`hist-tool-${r.length}`,title:m.tool_name||"tool",status:"complete",rawInput:m.tool_input||{}}};r.push(y)}else if(N.type==="tool_result"){const m=i,y=Oe(r,m.tool_call_id||"");if(y>=0){const k=r[y];r[y]={type:"tool_call",toolCall:{...k.toolCall,rawOutput:{output:m.content||m.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=Le(c);N.length>0&&r.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:N})}this.setEntries(r);let u=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,m=a&&typeof a=="object"?a.models_state:i.models_state;m&&Array.isArray(m.availableModels)&&typeof m.currentModelId=="string"&&(u=m)}else if(N.type==="result"||N.type==="result_success"){const a=i.usage,m=typeof i.total_cost_usd=="number"?i.total_cost_usd:null;(a||m!==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:m})}}u&&((x=this.onModelsStateChange)==null||x.call(this,u)),p&&((g=this.onUsageChange)==null||g.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(){le.connect(this.sessionId),this.unsub=le.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),le.disconnect()}handleEvent(t){var l,c,u,p,f,x,g,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(Ie(a))break;const m=Ns(n);this.setEntries(k=>{const b=k[k.length-1];if((b==null?void 0:b.type)==="assistant_message"&&b.id.startsWith(ke))return[...k.slice(0,-1),{...b,id:`assistant-${Date.now()}`,chunks:[...m?[{type:"thought",text:m}]:[],{type:"message",text:a}]}];if((b==null?void 0:b.type)==="assistant_message"){const C=b.chunks[b.chunks.length-1];return(C==null?void 0:C.type)==="message"?[...k.slice(0,-1),{...b,chunks:[...b.chunks.slice(0,-1),{type:"message",text:C.text+a}]}]:[...k.slice(0,-1),{...b,chunks:[...b.chunks,{type:"message",text:a}]}]}if(a&&a.trim()||m){const C={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...m?[{type:"thought",text:m}]:[],...a?[{type:"message",text:a}]:[]]};return[...k,C]}return k});const y=n.message;if(y&&typeof y=="object"&&Array.isArray(y.content)){const k=y.content.filter(b=>b.type==="tool_use");for(const b of k){const C=b.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(C))continue;this.seenToolCallIds.add(C);const $={id:C,title:b.name||"tool",status:"running",rawInput:b.input||{}};this.setEntries(M=>[...M,{type:"tool_call",toolCall:$}])}}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 m={id:a,title:i.tool_name||"tool",status:"running",rawInput:i.tool_input||{}};this.setEntries(y=>[...y,{type:"tool_call",toolCall:m}]);break}case"tool_result":{const i=n,a=i.tool_call_id||"";this.setEntries(m=>{const y=Oe(m,a);if(y<0)return m;const k=m[y];return m.map((b,C)=>C===y?{type:"tool_call",toolCall:{...k.toolCall,status:"complete",rawOutput:{output:i.content||i.output||""}}}:b)});break}case"control_request":case"permission_request":{const i=n.request;if(i&&i.subtype==="can_use_tool"){const a=n.request_id||"",m=i.tool_name||"unknown",y=i.input||i.tool_input||{},k=i.description||"",b=Array.isArray(i.permission_suggestions)?i.permission_suggestions:[];this.setEntries(C=>{const $=[...C].reverse().findIndex(M=>M.type==="tool_call");if($>=0){const M=C.length-1-$,A=C[M];if(A.toolCall.status==="running")return C.map((U,q)=>q===M?{type:"tool_call",toolCall:{...A.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:a,options:[]}}}:U)}return C}),(l=this.onPermissionRequest)==null||l.call(this,{requestId:a,toolName:m,toolInput:y,description:k,suggestions:b})}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(wt(n)){this.setEntries([]);break}if(typeof n.status=="string"){if(we(n.status))this.closed=!0;else if(this.closed)break;if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(u=this.onStatusChange)==null||u.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,m=typeof a.subtype=="string"?a.subtype:void 0;if(m==="task_started"||m==="task_progress"||m==="task_notification"){const k={subtype:m,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=js(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:"",m=typeof i.subtype=="string"?i.subtype:"";if(a){(g=this.onControlResponse)==null||g.call(this,{subtype:m,requestId:a,error:typeof i.error=="string"?i.error:void 0});const y=this.pendingControlRequests.get(a);y&&(this.pendingControlRequests.delete(a),y(m==="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 m=a.type==="text_delta"?"message":a.type==="thinking_delta"?"thought":null;if(!m)break;const y=a.text??a.thinking;if(typeof y!="string"||!y)break;this.appendStreamingDelta(m,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 m=((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:m,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=Le(i);if(a.length===0)break;this.setEntries(m=>[...m.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(ke)){const u=l.chunks[l.chunks.length-1];return(u==null?void 0:u.type)===t?[...n.slice(0,-1),{...l,chunks:[...l.chunks.slice(0,-1),{type:t,text:u.text+r}]}]:[...n.slice(0,-1),{...l,chunks:[...l.chunks,{type:t,text:r}]}]}const c={type:"assistant_message",id:`${ke}${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 u={type:"user_message",id:`user-${Date.now()}`,content:t,images:l?r:void 0,attachments:c?n:void 0};this.setEntries(x=>[...x,u]);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 g=`📎 ${x.name}${x.size!=null?` (${_s(x.size)})`:""}`,j=x.textContent||"(空文件)";p.push({type:"text",text:`${g}
|
|
57
|
+
\`\`\`
|
|
58
|
+
${j}
|
|
59
|
+
\`\`\``})}else if(x.kind==="directory"){const g=`📁 目录: ${x.name}${x.files!=null?` (${x.files.length} 个文件)`:""}`,j=x.textContent||"(空目录)";p.push({type:"text",text:`${g}
|
|
60
|
+
${j}`})}}const f=p.length===1&&p[0].type==="text"?p[0].text||t:p.length>0?p:t;try{await Nt(this.sessionId,{type:"user",uuid:je(),content:t,message:{content:f}})}catch(x){throw this.setEntries(g=>g.filter(j=>!(j.type==="user_message"&&j.id===u.id))),x}}async respondPermission(t,r,n){await L(this.sessionId,{type:"permission_response",approved:r,request_id:t,...n}),this.setEntries(l=>l.map(c=>{var u;return c.type!=="tool_call"||((u=c.toolCall.permissionRequest)==null?void 0:u.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 vt(this.sessionId)}async setPermissionMode(t){const r=je();return await L(this.sessionId,{type:"control_request",request_id:r,request:{subtype:"set_permission_mode",mode:t}}),r}async searchFiles(t,r=20){const n=je(),l=new Promise(u=>{this.pendingControlRequests.set(n,u)});await L(this.sessionId,{type:"control_request",request_id:n,request:{subtype:"file_search",query:t,limit:r}});const c=setTimeout(()=>{const u=this.pendingControlRequests.get(n);u&&(this.pendingControlRequests.delete(n),u(null))},8e3);try{const u=await l;if(!u||!Array.isArray(u.suggestions))return[];const p=[];for(const f of u.suggestions)f&&typeof f=="object"&&typeof f.path=="string"&&p.push(f.path);return p}finally{clearTimeout(c)}}async respondElicitation(t,r,n){await L(this.sessionId,{type:"permission_response",approved:r==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:r,...n?{content:n}:{}}}})}}function _s(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function Ss(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 Cs(s){return s?Date.now()-s<6e4:!1}function Es({onClose:s,session:t,liveStatus:r,pendingPermissions:n,onInterrupt:l,onDelete:c}){const[u,p]=d.useState(!1),f=async()=>{await navigator.clipboard.writeText(t.id),p(!0),setTimeout(()=>p(!1),1500)},x=n.length,g=t.worker,j=t.work_item,N=t.environment;return e.jsx(nt,{open:!0,onOpenChange:i=>{i||s()},children:e.jsxs(rt,{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(at,{children:e.jsx(ot,{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(es,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(We,{status:r||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:g&&(Cs(g.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[g&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Pe,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Ss(g.last_heartbeat_at)})]}),N&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(it,{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(Pe,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Qe(t.created_at)})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(Ge,{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(xs,{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(_t,{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(as,{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:u?"✓":"⧉"})]})]}),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 Be="rcs:subagent-panel:collapsed";function Ms(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 Ts(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 Rs({status:s}){return s==="running"?e.jsx(Ge,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(us,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(St,{className:"h-3 w-3 text-status-error"}):null}function As({task:s}){const t=s.status==="running",r=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,n=Ts(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(Rs,{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:Ms(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 $s({state:s}){const[t,r]=d.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Be)==="1"}catch{return!1}}),n=()=>{r(f=>{const x=!f;try{window.localStorage.setItem(Be,x?"1":"0")}catch{}return x})},[,l]=d.useState(0);d.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 g=setInterval(()=>{l(j=>j+1)},1e3);return()=>clearInterval(g)},[s]);const c=ks(s);if(c.length===0)return null;const u=c.filter(f=>f.status==="running").length,p=u>0?`${u} 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(ss,{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(As,{task:f},f.taskId))})]})})}function He(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 Is({requestId:s,toolName:t,toolInput:r,description:n,suggestions:l,onApprove:c,onApproveAlways:u,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(bs,{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:P(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:P(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:qe(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&&u&&e.jsxs("button",{onClick:u,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:`允许并记住规则:${He(t,l)}`,children:[e.jsx(ys,{className:"h-3.5 w-3.5"}),"Always allow ",qe(He(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 Ps({questions:s,description:t,onSubmit:r,onSkip:n}){const[l,c]=d.useState({}),[u,p]=d.useState({}),[f,x]=d.useState(0),g=(a,m,y)=>{if(y){const k=l[a]||[],b=k.includes(m)?k.filter(C=>C!==m):[...k,m];c({...l,[a]:b})}else c({...l,[a]:m})},j=a=>{var y;const m=(y=u[a])==null?void 0:y.trim();m&&(c({...l,[a]:m}),p({...u,[a]:""}))},N=()=>{var m,y;const a={};for(const[k,b]of Object.entries(l)){const C=s[parseInt(k,10)];C&&(typeof b=="number"?a[k]=((y=(m=C.options)==null?void 0:m[b])==null?void 0:y.label)||String(b):Array.isArray(b)?a[k]=b.map($=>{var M,A;return((A=(M=C.options)==null?void 0:M[$])==null?void 0:A.label)||String($)}):a[k]=b)}r(a)};if(s.length<=1){const a=s[0]||{question:t,options:[],multiSelect:!1},m=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:P(t||a.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(a.options||[]).map((y,k)=>{const b=m?(l[0]||[]).includes(k):l[0]===k;return e.jsxs("button",{onClick:()=>g(0,k,m),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:P(y.label)}),y.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:P(y.description)})]},k)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:u[0]||"",onChange:y=>p({...u,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:P(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((a,m)=>e.jsx("button",{onClick:()=>x(m),className:J("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",f===m?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:a.header||`Q${m+1}`},m))}),i&&e.jsx(qs,{question:i,qIdx:f,answers:l,otherTexts:u,onSelect:g,onOtherTextChange:(a,m)=>p({...u,[a]:m}),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 qs({question:s,qIdx:t,answers:r,otherTexts:n,onSelect:l,onOtherTextChange:c,onOtherSubmit:u}){const p=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:P(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((f,x)=>{const g=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",g?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:P(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:P(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"&&u(t)}),e.jsx("button",{onClick:()=>u(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 Ds({planContent:s,description:t,onSubmit:r}){const[n,l]=d.useState(null),[c,u]=d.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(Ke,{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:Us(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=>u(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 Us(s){let t=P(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 Fs({request:s,onSubmit:t}){const r=Os(s.requestedSchema),n=Ls(s.requestedSchema),[l,c]=d.useState({}),u=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(ze,{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(Kt,{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(ze,{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:P(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:l[p]??"",onChange:x=>c(g=>({...g,[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 g=(l[f]??"").trim();g&&(p[f]=x.type==="number"?Number(g):g)}t("accept",p)},disabled:!u,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 ze({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(cs,{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:P(s)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:P(t)})]})}function Os(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 Ls(s){const t=s==null?void 0:s.required;return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function Bs(s){const[t,r]=d.useState([]),[n,l]=d.useState(!0),[c,u]=d.useState(null),p=d.useCallback(async()=>{l(!0),u(null);try{const g=await Ct(s);r(g)}catch(g){u(g instanceof Error?g.message:"Failed to load shares")}finally{l(!1)}},[s]);d.useEffect(()=>{p()},[p]);const f=d.useCallback(async g=>{u(null);try{const j=await Et(s,g);return await p(),j}catch(j){throw u(j instanceof Error?j.message:"Failed to create share"),j}},[s,p]),x=d.useCallback(async g=>{u(null);try{await Mt(s,g),await p()}catch(j){throw u(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 Hs({open:s,onClose:t,sessionId:r,sessionTitle:n}){Ye();const{shares:l,isLoading:c,error:u,createShare:p,revokeShare:f}=Bs(r),[x,g]=d.useState("user"),[j,N]=d.useState(""),[i,a]=d.useState(""),[m,y]=d.useState("read"),[k,b]=d.useState(""),[C,$]=d.useState(!1),[M,A]=d.useState(null),[U,q]=d.useState(""),[B,R]=d.useState(!1),[W,Q]=d.useState(!1);d.useEffect(()=>{s&&(g("user"),N(""),a(""),y("read"),b(""),$(!1),A(null),q(""),R(!1),Q(!1))},[s]);const ce=async()=>{$(!0),q(""),A(null);try{const S={grantedTo:x==="user"?{userId:j.trim()}:{teamId:i.trim()},permission:m};k.trim()&&(S.expiresAt=k.trim());const X=await p(S);A(`${window.location.origin}/code/s/${X.shareToken}`)}catch(S){q(S instanceof Error?S.message:"Failed to create share")}finally{$(!1)}},z=async S=>{try{await f(S)}catch{}},de=async()=>{if(!M)return;Q(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(M),R(!0),setTimeout(()=>R(!1),2e3);return}}catch{}const S=document.createElement("textarea");S.value=M,S.style.position="fixed",S.style.opacity="0",document.body.appendChild(S),S.select();try{document.execCommand("copy"),R(!0),setTimeout(()=>R(!1),2e3)}catch{Q(!0)}document.body.removeChild(S)};return e.jsx(nt,{open:s,onOpenChange:S=>{S||t()},children:e.jsxs(rt,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(at,{children:e.jsxs(ot,{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:()=>g("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:()=>g("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(Xt,{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:m,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=>b(S.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none"})]}),(U||u)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:U||u}),M&&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:M}),e.jsx("button",{onClick:de,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:B?w("share.copied"):w("share.copy")})]}),W&&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(Gt,{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:ce,disabled:C||(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:C?w("common.creating"):w("share.createShare")})]})]})})}function zs(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Vs(s){const t=zs(s),r=Rt(),n=r?{proxyUrl:t,token:r}:{proxyUrl:t};return new Tt(n)}const V=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"}],ie="rcs_permission_mode";function Ve(s){return s<1e3?String(s):s<1e6?`${(s/1e3).toFixed(1)}k`:`${(s/1e6).toFixed(1)}M`}function Ws(s){const t=V.findIndex(r=>r.value===s);return V[(t+1+V.length)%V.length].value}function Qs({models:s,currentModelId:t,onSelect:r,disabled:n}){const[l,c]=d.useState(!1),u=s.find(x=>x.modelId===t)??null,p=s.length>0,f=async x=>{r(x.modelId),c(!1)};return e.jsxs(Xe,{open:l,onOpenChange:p?c:void 0,children:[e.jsx(Ze,{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(it,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(u==null?void 0:u.name)??t??"选择模型"}),l?e.jsx(et,{className:"h-3 w-3"}):e.jsx(tt,{className:"h-3 w-3"})]})}),e.jsx(st,{className:"w-72 p-0",align:"start",children:e.jsx(Wt,{models:s,currentModelId:t,onSelect:f,showSearch:s.length>5})})]})}function Gs({mode:s,onModeChange:t,disabled:r}){const[n,l]=d.useState(!1),c=V.find(u=>u.value===s);return e.jsxs(Xe,{open:n,onOpenChange:l,children:[e.jsx(Ze,{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(Vt,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:(c==null?void 0:c.label)??s}),n?e.jsx(et,{className:"h-3 w-3"}):e.jsx(tt,{className:"h-3 w-3"})]})}),e.jsx(st,{className:"w-64 p-1",align:"start",children:V.map(u=>e.jsxs("button",{type:"button",onClick:()=>{t(u.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===u.value&&e.jsx(Ke,{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:u.label}),e.jsx("div",{className:"text-xs text-text-muted",children:u.description})]})]},u.value))})]})}function cn({sessionId:s,onSessionLoaded:t}){Ye();const[r,n]=d.useState(null),[l,c]=d.useState(null),[u,p]=d.useState(""),[f,x]=d.useState(!1),[g,j]=d.useState(!1),[N,i]=d.useState(!1),[a,m]=d.useState(!1),[y,k]=d.useState(0),[b,C]=d.useState(0),[$,M]=d.useState([]),[A,U]=d.useState(!1),[q,B]=d.useState([]),[R,W]=d.useState(null),[Q,ce]=d.useState(()=>lt()),[z,de]=d.useState(null),[S,X]=d.useState(null),[Z,ee]=d.useState([]),[Ne,ue]=d.useState(!1),[me,ve]=d.useState(""),xe=d.useRef(null),[pe,te]=d.useState(()=>localStorage.getItem(ie)||"default"),[_e,Se]=d.useState(null),G=d.useRef(null),[Ce,Ee]=d.useState(null),K=d.useRef(null),F=d.useRef(pe);F.current=pe;const se=d.useRef(null),Me=d.useRef(null),Te=d.useRef($);Te.current=$;const ne=d.useRef(t);ne.current=t;const re=d.useCallback(o=>{Se(o),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>Se(null),5e3)},[]),he=d.useCallback(o=>{Ee(o),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>Ee(null),5e3)},[]),fe=d.useCallback(o=>{var _;if(o===F.current)return;const h=F.current;F.current=o,te(o);try{localStorage.setItem(ie,o)}catch{}(_=Me.current)==null||_.setPermissionMode(o).then(v=>{se.current={requestId:v,previous:h}}).catch(v=>{console.error("[SessionDetail] set permission mode failed:",v),re(`模式切换请求发送失败: ${v instanceof Error?v.message:String(v)}`),F.current=h,te(h)})},[re]),T=d.useMemo(()=>new vs(s,M,{onStatusChange:o=>{c(o),U(o==="running"||o==="requires_action")},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{B(h=>h.some(_=>_.requestId===o.requestId)?h:[...h,o])},onModelsStateChange:o=>{W(o)},onSubagentUpdate:o=>{ce(o)},onControlResponse:o=>{const h=se.current;if(!(!h||h.requestId!==o.requestId)&&(se.current=null,o.subtype==="error")){F.current=h.previous,te(h.previous);try{localStorage.setItem(ie,h.previous)}catch{}re(o.error||"模式切换失败")}},onPermissionModeChange:o=>{if(o!==F.current){F.current=o,te(o);try{localStorage.setItem(ie,o)}catch{}se.current=null}},onUsageChange:o=>{de(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,re]);d.useEffect(()=>(Me.current=T,()=>{T.disconnect()}),[T]);const Re=d.useRef(a);Re.current=a,d.useEffect(()=>le.onEvent(h=>{h.type!=="artifact_created"&&h.type!=="artifact_updated"||(Re.current&&C(_=>_+1),k(_=>_+1))}),[]),d.useEffect(()=>{a&&k(0)},[a]),d.useEffect(()=>{let o=!1;async function h(){var _;p("");try{const v=await Bt(s);if(o)return;n(v),c(v.status),we(v.status)&&T.markClosed(),U(v.status==="running"||v.status==="requires_action"),(_=ne.current)==null||_.call(ne,v)}catch(v){if(o)return;p(v instanceof Error?v.message:w("session.loadFailed"));return}try{await T.init()}catch(v){console.warn("Failed to init adapter:",v)}}return h(),()=>{o=!0}},[s,T]);const O=we(l),H=(r==null?void 0:r.access_level)==="read",ye=d.useCallback(()=>{M([]),At(s).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[s]),ae=d.useCallback(async o=>{const h=o.text.trim(),_=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!h&&!_||O)return;const v=await $t(h,{sessionId:s,availableCommands:De,availableModels:(R==null?void 0:R.availableModels)??[],currentModel:R?{modelId:R.currentModelId,name:R.currentModelId}:null,supportsImages:!0,entries:Te.current,setModel:async I=>{await L(s,{type:"control_request",request:{subtype:"set_model",model:I}}),W(be=>be&&{...be,currentModelId:I})},onNewSession:()=>{M([])}}).catch(()=>null);if(v){if(It("[SessionDetail] local command result",v),"clearEntries"in v&&v.clearEntries){ye();return}if("newSession"in v&&v.newSession){ye();return}if("userEntry"in v){M(I=>[...I,v.userEntry,v.cmdEntry]);return}}U(!0);try{await T.sendMessage(h,o.images,o.attachments)}catch(I){if(console.error("Send failed:",I),I instanceof Pt&&I.type==="session_closed"){c("archived"),T.markClosed(),he(w("session.closedSendBlocked"));return}he(`${w("session.sendFailed")}${I instanceof Error?`: ${I.message}`:""}`)}},[T,O,s,R,ye,he]),ct=d.useCallback(o=>{if(A){ee(h=>[...h,o]);return}ae(o)},[A,ae]),ge=d.useRef(!1);d.useEffect(()=>{if(O){ee(h=>h.length>0?[]:h);return}if(A||Z.length===0||ge.current)return;const o=Z[0];o&&(ge.current=!0,ee(h=>h.slice(1)),ae(o).finally(()=>{ge.current=!1}))},[A,Z,ae,O]);const Ae=d.useCallback(async()=>{try{await T.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{U(!1)}},[T]),dt=d.useCallback(()=>{fe(Ws(F.current))},[fe]);d.useEffect(()=>()=>{G.current&&clearTimeout(G.current),K.current&&clearTimeout(K.current)},[]);const ut=d.useCallback(async()=>{if(r&&window.confirm(w("dashboard.confirmDelete").replace("{id}",r.title||r.id)))try{await qt(r.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:w("dashboard.deleteFailed"))}},[r]),mt=d.useCallback(async o=>{try{await T.respondPermission(o,!0)}catch(h){console.error("Failed to approve:",h)}B(h=>h.filter(_=>_.requestId!==o))},[T]),xt=d.useCallback(async(o,h)=>{try{await T.respondPermission(o,!0,{updated_permissions:h})}catch(_){console.error("Failed to approve with rules:",_)}B(_=>_.filter(v=>v.requestId!==o))},[T]),pt=d.useCallback(async(o,h)=>{const _=S;if(X(null),!!_)try{await T.respondElicitation(_.requestId,o,h)}catch(v){console.error("Failed to submit elicitation:",v)}},[S,T]),ht=d.useCallback(()=>{!r||H||(ve(r.title||""),ue(!0),setTimeout(()=>{var o,h;(o=xe.current)==null||o.focus(),(h=xe.current)==null||h.select()},0))},[r,H]),$e=d.useCallback(async()=>{const o=me.trim();if(ue(!1),!(!r||!o||o===r.title))try{const h=await Dt(r.id,o);n(_=>_&&{..._,title:h.title??o})}catch(h){console.error("Rename failed:",h),alert(h instanceof Error?h.message:"重命名失败")}},[r,me]),ft=d.useCallback(async o=>{try{await T.respondPermission(o,!1)}catch(h){console.error("Failed to reject:",h)}B(h=>h.filter(_=>_.requestId!==o))},[T]),yt=d.useCallback(async(o,h,_)=>{try{await L(s,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:_,answers:h}})}catch(v){console.error("Failed to submit answers:",v)}B(v=>v.filter(I=>I.requestId!==o))},[s]),gt=d.useCallback(async(o,h,_)=>{try{h==="no"?await L(s,{type:"permission_response",approved:!1,request_id:o,..._?{message:_}:{}}):await L(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)}B(v=>v.filter(I=>I.requestId!==o))},[s]);return u?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:u}),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(Ys,{sessionId:s,agentId:r.environment_id}):e.jsx(Je,{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:[Ne?e.jsx("input",{ref:xe,value:me,onChange:o=>ve(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),$e()):o.key==="Escape"&&(o.preventDefault(),ue(!1))},onBlur:()=>void $e(),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&&!O&&e.jsx("button",{type:"button",onClick:ht,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(Ut,{className:"h-3.5 w-3.5"})})]}),r.visibility&&!Ne&&e.jsx(Jt,{visibility:r.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var _;const o=r.source==="acp"?"acp":(_=r.environment)==null?void 0:_.worker_type,h=Qt(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(We,{status:l}),e.jsx("span",{className:"text-xs text-text-muted",children:Qe(r.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>m(!a),className:`relative 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(Ft,{className:"h-3.5 w-3.5"}),y>0&&!a&&e.jsx("span",{className:"absolute -right-1.5 -top-1.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-status-active px-1 text-[10px] font-bold text-white",children:y>9?"9+":y})]}),!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(hs,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>j(!g),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:w("session.info"),children:e.jsx(is,{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"),q.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:q.length})]})]})]}),g&&e.jsxs("div",{className:"mt-2 rounded-md bg-surface-2 px-3 py-2 text-xs text-text-muted space-y-1 font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children: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(Yt,{sessionId:s,embedded:!0,refreshTick:b})})}),e.jsx(Ot,{entries:$,isLoading:A,emptyTitle:w("session.emptyTitle"),emptyDescription:w("session.emptyDescription")}),e.jsx($s,{state:Q}),q.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:q.map(o=>e.jsx(Ks,{request:o,onApprove:()=>mt(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>xt(o.requestId,o.suggestions??[]):void 0,onReject:()=>ft(o.requestId),onSubmitAnswers:yt,onSubmitPlan:gt},o.requestId))})}),S&&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(Fs,{request:S,onSubmit:pt})})}),Ce&&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:Ce})}),_e&&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:_e})}),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(Gs,{mode:pe,onModeChange:fe,disabled:O||H}),e.jsx(Qs,{models:(R==null?void 0:R.availableModels)??[],currentModelId:(R==null?void 0:R.currentModelId)??null,onSelect:o=>{L(s,{type:"control_request",request:{subtype:"set_model",model:o}}),W(h=>h&&{...h,currentModelId:o})},disabled:O||H})]}),z&&e.jsxs("span",{className:"text-[11px] text-text-muted font-mono",title:"会话累计用量(input 含缓存读写)",children:[Ve(z.inputTokens)," in / ",Ve(z.outputTokens)," out",z.totalCostUsd!=null&&` · $${z.totalCostUsd.toFixed(2)}`]})]}),e.jsx(Lt,{onSubmit:ct,isLoading:A,onInterrupt:Ae,onCycleMode:dt,disabled:O||H,placeholder:O?w("session.closed"):H?w("session.readOnly"):w("session.inputPlaceholder"),supportsAttachments:!0,commands:De,queueWhileLoading:!0,queuedCount:Z.length,onDequeue:o=>ee(h=>h.filter((_,v)=>v!==o)),onSearchFiles:o=>T.searchFiles(o)}),f&&r&&e.jsx(Es,{onClose:()=>x(!1),session:r,liveStatus:l,pendingPermissions:q,onInterrupt:Ae,onDelete:ut}),e.jsx(Hs,{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 Ks({request:s,onApprove:t,onApproveAlways:r,onReject:n,onSubmitAnswers:l,onSubmitPlan:c}){const u=s.toolName,p=s.toolInput,f=s.description||"";if(u==="AskUserQuestion"){const x=p.questions||[];return e.jsx(Ps,{requestId:s.requestId,questions:x,description:f,onSubmit:g=>l(s.requestId,g,x),onSkip:n})}if(u==="ExitPlanMode"){const x=p.plan||"";return e.jsx(Ds,{requestId:s.requestId,planContent:x,description:f,onSubmit:(g,j)=>c(s.requestId,g,j)})}return e.jsx(Is,{requestId:s.requestId,toolName:u,toolInput:p,description:f,suggestions:s.suggestions,onApprove:t,onApproveAlways:r,onReject:n})}function Ys({sessionId:s,agentId:t}){const[r,n]=d.useState(null),[l,c]=d.useState("disconnected"),[u,p]=d.useState(null),f=d.useRef(null);return d.useEffect(()=>{const x=Vs(t);return x.setConnectionStateHandler((g,j)=>{c(g),p(j||null)}),f.current=x,n(x),x.connect().catch(g=>{g instanceof Ht||(p(g.message),c("error"))}),()=>{x.disconnect(),f.current=null,n(null),c("disconnected")}},[t]),e.jsx(Je,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[u&&l==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:u}),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:u})]})}),r&&l==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(zt,{client:r,agentId:t})})]})})}export{cn 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-49JlcYCi.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{aq as v,am as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aq as v,am as t}from"./main-49JlcYCi.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-49JlcYCi.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};
|