@saluzi/saluzi-edu 0.5.21 → 0.6.0
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 +444 -327
- package/dist/guide/guide-data.json +174 -174
- package/dist/rcs-web/assets/AdminPanel-D0fVkpU2.js +1 -0
- package/dist/rcs-web/assets/ArtifactView-DG0-kZ2G.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-B63LTThv.js → dist/rcs-web/assets/ArtifactsGallery-CcobkOm1.js} +31 -31
- package/dist/rcs-web/assets/Claim-CltNvmRS.js +1 -0
- package/dist/rcs-web/assets/Dashboard-CEzuQ0N4.js +6 -0
- package/dist/rcs-web/assets/Join-DX0LzcPE.js +1 -0
- package/dist/rcs-web/assets/Login-BVKB4X_Z.js +1 -0
- package/dist/rcs-web/assets/Register-D-BrLVl3.js +1 -0
- package/dist/rcs-web/assets/RegisterEmpty-DdDXaiEn.js +26 -0
- package/dist/rcs-web/assets/SessionDetail-BkKSNMD8.js +78 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-DA_Sg1dx.js → SessionVisibilityBadge-Ch3s2iFY.js} +2 -2
- package/dist/rcs-web/assets/Setup-CyGhRI5L.js +1 -0
- package/dist/rcs-web/assets/{ShareLanding-DaLDc5iV.js → ShareLanding-xKcBqmJb.js} +1 -1
- package/dist/rcs-web/assets/TeamDetail-C3Ne25hE.js +11 -0
- package/dist/rcs-web/assets/TeamList-C5Zyrj2-.js +1 -0
- package/dist/rcs-web/assets/TeamSettings-BsT93PQO.js +1 -0
- package/dist/rcs-web/assets/UserSearchInput-BFpwaVmp.js +6 -0
- package/dist/rcs-web/assets/UserSettings-cIzS243Z.js +1 -0
- package/dist/rcs-web/assets/{arc-CPhgreP8.js → arc-CiWQl09E.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-CpAi-qzk.js → architectureDiagram-3BPJPVTR-DL5Id6fa.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DcsxgO1K.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-DF-nk9Fe.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-BQ5cjzbZ.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-l_Pl6m2J.js} +1 -1
- package/dist/rcs-web/assets/channel-CBq46cRr.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-wa-oCiR6.js → chunk-2J33WTMH-Dr5xQSXu.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-D2ybEyPG.js → chunk-4BX2VUAB-DAPTU1FG.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-CQGtwyGQ.js → chunk-55IACEB6-BgaGrvZR.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D0ITaMeP.js → dist/rcs-web/assets/chunk-727SXJPM-D6dnSxU3.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BWRrcP1d.js → dist/rcs-web/assets/chunk-AQP2D5EJ-BVCad_JN.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-C-CaLwfI.js → chunk-FMBD7UC4-BNLx608W.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-OPpmIsi8.js → chunk-ND2GUHAM-BAHk1eiL.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-Bq6R2yM7.js → chunk-QZHKN3VN-CX_4LT0M.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-CYdZp3iH.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-CYdZp3iH.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/code-block-IT6T5CEO-BQf-xjVa.js → dist/rcs-web/assets/code-block-IT6T5CEO-BoFB9z5v.js} +1 -1
- package/dist/rcs-web/assets/{copy-lzYYFmlH.js → copy-EPASKX-X.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CuUSRgoZ.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-CMpuIlrx.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-BP4ZP_3D.js → dist/rcs-web/assets/dagre-BM42HDAG-Dg4Q9j21.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-XQnH0b9k.js → diagram-2AECGRRQ-YGGSegJh.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-BnuYmMPD.js → diagram-5GNKFQAL-Rg7tQ7zl.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-LymV4oAW.js → dist/rcs-web/assets/diagram-KO2AKTUF-FwQUsRJf.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-NSg5NWFp.js → diagram-LMA3HP47-DDzZwu_E.js} +1 -1
- package/dist/rcs-web/assets/{diagram-OG6HWLK6-kVTMFgtZ.js → diagram-OG6HWLK6-D6Pxp9XO.js} +1 -1
- package/dist/rcs-web/assets/dialog-Ort95zkZ.js +1 -0
- package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-BJBTtX2s.js → erDiagram-TEJ5UH35-BSDAq23h.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-CcQXZNID.js → flowDiagram-I6XJVG4X-CzWT0vwA.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DW8iKyq_.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DPNJQ_Co.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BTBYx3LF.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-vHpFxzAD.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-BRZAYc6t.js → infoDiagram-5YYISTIA-Bk_F8hwq.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-BYMQtEeD.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-CBYfpD17.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-aqx7w1db.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-BxoYxLNN.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-BxEHfP4O.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-B5pCpO1z.js} +1 -1
- package/dist/rcs-web/assets/{linear-Chjw8hPE.js → linear-BpcrEfNA.js} +1 -1
- package/dist/rcs-web/assets/main-BC4mcO_f.js +393 -0
- package/dist/rcs-web/assets/main-C0n90aVY.css +1 -0
- package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-CrqI4db6.js → dist/rcs-web/assets/mermaid-VLURNSYL-DWwqH0oB.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-EjsI3GC3.js → mermaid.core-CPGFiRhL.js} +5 -5
- package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-D2rO_fGA.js → mindmap-definition-RKZ34NQL-DBF7JLl0.js} +1 -1
- package/dist/rcs-web/assets/{notifications-WMIbgYDP.js → notifications-C7DetfWu.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-DDwJZfoh.js → pieDiagram-4H26LBE5-CbUgqUZY.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-DDtqMwKx.js → quadrantDiagram-W4KKPZXB-BUF-YWIU.js} +1 -1
- package/dist/rcs-web/assets/{refresh-cw-l0u8pxJi.js → refresh-cw-DBXI7gD3.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-BtSk2-5u.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-B8fyHxTP.js} +1 -1
- package/dist/rcs-web/assets/{sankeyDiagram-5OEKKPKP-SDLDMxUT.js → sankeyDiagram-5OEKKPKP-DAZKpwBw.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-D7iAclg1.js → sequenceDiagram-3UESZ5HK-DamEgVx-.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-Bxx23fZH.js → stateDiagram-AJRCARHV-DU-QvteV.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-z1g82auz.js → stateDiagram-v2-BHNVJYJU-C5QVbdY9.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-C8kBbm_V.js → timeline-definition-PNZ67QCA-Df0hGAH6.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CPldb1-R.js → vennDiagram-CIIHVFJN-DbX36wdR.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-MCHB2fG7.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-rjVkCTKo.js} +1 -1
- package/dist/rcs-web/assets/workerType-gCLCeJDi.js +6 -0
- package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-CHj-KmL6.js → xychartDiagram-2RQKCTM6-CHjulBZn.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +2 -1
- package/packages/remote-control-server/src/__tests__/backgroundTaskPipeline.test.ts +216 -0
- package/packages/remote-control-server/src/__tests__/client-ip.test.ts +67 -0
- package/packages/remote-control-server/src/__tests__/teams.test.ts +44 -0
- package/packages/remote-control-server/src/client-ip.ts +57 -0
- package/packages/remote-control-server/src/db/sqlite.ts +22 -0
- package/packages/remote-control-server/src/routes/v1/environments.ts +4 -0
- package/packages/remote-control-server/src/routes/web/teams.ts +12 -1
- package/packages/remote-control-server/src/services/environment.ts +12 -0
- package/packages/remote-control-server/src/store.ts +37 -8
- package/packages/remote-control-server/src/types/api.ts +7 -0
- package/packages/remote-control-server/web/dist/assets/AdminPanel-D0fVkpU2.js +1 -0
- package/packages/remote-control-server/web/dist/assets/ArtifactView-DG0-kZ2G.js +1 -0
- package/{dist/rcs-web/assets/ArtifactsGallery-B63LTThv.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CcobkOm1.js} +31 -31
- package/packages/remote-control-server/web/dist/assets/Claim-CltNvmRS.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Dashboard-CEzuQ0N4.js +6 -0
- package/packages/remote-control-server/web/dist/assets/Join-DX0LzcPE.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Login-BVKB4X_Z.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Register-D-BrLVl3.js +1 -0
- package/packages/remote-control-server/web/dist/assets/RegisterEmpty-DdDXaiEn.js +26 -0
- package/packages/remote-control-server/web/dist/assets/SessionDetail-BkKSNMD8.js +78 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-DA_Sg1dx.js → SessionVisibilityBadge-Ch3s2iFY.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/Setup-CyGhRI5L.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-DaLDc5iV.js → ShareLanding-xKcBqmJb.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/TeamDetail-C3Ne25hE.js +11 -0
- package/packages/remote-control-server/web/dist/assets/TeamList-C5Zyrj2-.js +1 -0
- package/packages/remote-control-server/web/dist/assets/TeamSettings-BsT93PQO.js +1 -0
- package/packages/remote-control-server/web/dist/assets/UserSearchInput-BFpwaVmp.js +6 -0
- package/packages/remote-control-server/web/dist/assets/UserSettings-cIzS243Z.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{arc-CPhgreP8.js → arc-CiWQl09E.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-CpAi-qzk.js → architectureDiagram-3BPJPVTR-DL5Id6fa.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-DcsxgO1K.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DF-nk9Fe.js} +1 -1
- package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-BQ5cjzbZ.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-l_Pl6m2J.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-CBq46cRr.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-wa-oCiR6.js → chunk-2J33WTMH-Dr5xQSXu.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-D2ybEyPG.js → chunk-4BX2VUAB-DAPTU1FG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-CQGtwyGQ.js → chunk-55IACEB6-BgaGrvZR.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-D0ITaMeP.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D6dnSxU3.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-BWRrcP1d.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BVCad_JN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-C-CaLwfI.js → chunk-FMBD7UC4-BNLx608W.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-OPpmIsi8.js → chunk-ND2GUHAM-BAHk1eiL.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-Bq6R2yM7.js → chunk-QZHKN3VN-CX_4LT0M.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-CYdZp3iH.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-CYdZp3iH.js +1 -0
- package/{dist/rcs-web/assets/code-block-IT6T5CEO-BQf-xjVa.js → packages/remote-control-server/web/dist/assets/code-block-IT6T5CEO-BoFB9z5v.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-lzYYFmlH.js → copy-EPASKX-X.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-CuUSRgoZ.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CMpuIlrx.js} +1 -1
- package/{dist/rcs-web/assets/dagre-BM42HDAG-BP4ZP_3D.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-Dg4Q9j21.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-XQnH0b9k.js → diagram-2AECGRRQ-YGGSegJh.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BnuYmMPD.js → diagram-5GNKFQAL-Rg7tQ7zl.js} +1 -1
- package/{dist/rcs-web/assets/diagram-KO2AKTUF-LymV4oAW.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-FwQUsRJf.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-NSg5NWFp.js → diagram-LMA3HP47-DDzZwu_E.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-kVTMFgtZ.js → diagram-OG6HWLK6-D6Pxp9XO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/dialog-Ort95zkZ.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-BJBTtX2s.js → erDiagram-TEJ5UH35-BSDAq23h.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-CcQXZNID.js → flowDiagram-I6XJVG4X-CzWT0vwA.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DW8iKyq_.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DPNJQ_Co.js} +1 -1
- package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BTBYx3LF.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-vHpFxzAD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-BRZAYc6t.js → infoDiagram-5YYISTIA-Bk_F8hwq.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-BYMQtEeD.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-CBYfpD17.js} +1 -1
- package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-aqx7w1db.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-BxoYxLNN.js} +1 -1
- package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-BxEHfP4O.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-B5pCpO1z.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-Chjw8hPE.js → linear-BpcrEfNA.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-BC4mcO_f.js +393 -0
- package/packages/remote-control-server/web/dist/assets/main-C0n90aVY.css +1 -0
- package/{dist/rcs-web/assets/mermaid-VLURNSYL-CrqI4db6.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-DWwqH0oB.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-EjsI3GC3.js → mermaid.core-CPGFiRhL.js} +5 -5
- package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-D2rO_fGA.js → mindmap-definition-RKZ34NQL-DBF7JLl0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{notifications-WMIbgYDP.js → notifications-C7DetfWu.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-DDwJZfoh.js → pieDiagram-4H26LBE5-CbUgqUZY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-DDtqMwKx.js → quadrantDiagram-W4KKPZXB-BUF-YWIU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{refresh-cw-l0u8pxJi.js → refresh-cw-DBXI7gD3.js} +1 -1
- package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-BtSk2-5u.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-B8fyHxTP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sankeyDiagram-5OEKKPKP-SDLDMxUT.js → sankeyDiagram-5OEKKPKP-DAZKpwBw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-D7iAclg1.js → sequenceDiagram-3UESZ5HK-DamEgVx-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-Bxx23fZH.js → stateDiagram-AJRCARHV-DU-QvteV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-z1g82auz.js → stateDiagram-v2-BHNVJYJU-C5QVbdY9.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-C8kBbm_V.js → timeline-definition-PNZ67QCA-Df0hGAH6.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CPldb1-R.js → vennDiagram-CIIHVFJN-DbX36wdR.js} +1 -1
- package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-MCHB2fG7.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-rjVkCTKo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/workerType-gCLCeJDi.js +6 -0
- package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-CHj-KmL6.js → xychartDiagram-2RQKCTM6-CHjulBZn.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/AdminPanel-fsacwgfK.js +0 -1
- package/dist/rcs-web/assets/ArtifactView-DmMwrTRk.js +0 -1
- package/dist/rcs-web/assets/Claim-hOGNTz-n.js +0 -1
- package/dist/rcs-web/assets/Dashboard-BBIlAMpr.js +0 -6
- package/dist/rcs-web/assets/Join-zelwrNDz.js +0 -1
- package/dist/rcs-web/assets/Login-BmYeCfbw.js +0 -1
- package/dist/rcs-web/assets/Register-Dfw4S_A0.js +0 -1
- package/dist/rcs-web/assets/SessionDetail-zXHv84SV.js +0 -83
- package/dist/rcs-web/assets/Setup-BTTET7Rk.js +0 -1
- package/dist/rcs-web/assets/TeamCreate-BWtaB-_Z.js +0 -1
- package/dist/rcs-web/assets/TeamDetail-Crmn6PaC.js +0 -6
- package/dist/rcs-web/assets/TeamList-B8Rob6VK.js +0 -1
- package/dist/rcs-web/assets/TeamSettings-CfRHolhe.js +0 -1
- package/dist/rcs-web/assets/UserSearchInput-DkaGgR76.js +0 -1
- package/dist/rcs-web/assets/UserSettings-D1oW7oVv.js +0 -1
- package/dist/rcs-web/assets/channel-DHj-rIRW.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DsAw9J1B.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DsAw9J1B.js +0 -1
- package/dist/rcs-web/assets/dialog-DrDf89nL.js +0 -1
- package/dist/rcs-web/assets/main-CJvwpIVn.css +0 -1
- package/dist/rcs-web/assets/main-Dh-rPGBg.js +0 -275
- package/dist/rcs-web/assets/workerType-BOi1t0TG.js +0 -1
- package/packages/remote-control-server/web/dist/assets/AdminPanel-fsacwgfK.js +0 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-DmMwrTRk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Claim-hOGNTz-n.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-BBIlAMpr.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Join-zelwrNDz.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Login-BmYeCfbw.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Register-Dfw4S_A0.js +0 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-zXHv84SV.js +0 -83
- package/packages/remote-control-server/web/dist/assets/Setup-BTTET7Rk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamCreate-BWtaB-_Z.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamDetail-Crmn6PaC.js +0 -6
- package/packages/remote-control-server/web/dist/assets/TeamList-B8Rob6VK.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamSettings-CfRHolhe.js +0 -1
- package/packages/remote-control-server/web/dist/assets/UserSearchInput-DkaGgR76.js +0 -1
- package/packages/remote-control-server/web/dist/assets/UserSettings-D1oW7oVv.js +0 -1
- package/packages/remote-control-server/web/dist/assets/channel-DHj-rIRW.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DsAw9J1B.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DsAw9J1B.js +0 -1
- package/packages/remote-control-server/web/dist/assets/dialog-DrDf89nL.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-CJvwpIVn.css +0 -1
- package/packages/remote-control-server/web/dist/assets/main-Dh-rPGBg.js +0 -275
- package/packages/remote-control-server/web/dist/assets/workerType-BOi1t0TG.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aK as w,c as y,aD as t}from"./main-BC4mcO_f.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function C({onSuccess:m,onBack:x}){const{register:h}=w(),[n,p]=r.useState(""),[a,b]=r.useState(""),[l,f]=r.useState(""),[d,o]=r.useState(""),[i,u]=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}u(!0);try{await h(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.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:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight 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=>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:a,onChange:s=>b(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"})]}),d&&e.jsx("p",{className:"text-sm text-status-error",children:d}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:i?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{C as Register};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{j as e}from"./vendor-DE_-CLIE.js";import{ap as a,i as d,h as l,an as p,aD as h}from"./main-BC4mcO_f.js";import{A as y}from"./workerType-gCLCeJDi.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 m=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],s=a("archive",m);/**
|
|
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 k=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],x=a("circle-alert",k);/**
|
|
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 f=[["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"}]],u=a("triangle-alert",f);/**
|
|
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 b=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],i=a("wifi-off",b);/**
|
|
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 g=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],j=a("wifi",g),v={running:{label:"running",Icon:y},active:{label:"active",Icon:j},idle:{label:"idle",Icon:d},disconnected:{label:"disconnected",Icon:i},offline:{label:"offline",Icon:i},inactive:{label:"inactive",Icon:s},archived:{label:"archived",Icon:s},error:{label:"error",Icon:x,tone:"text-status-error border-status-error/40"},requires_action:{label:"requires_action",Icon:u,tone:"text-status-warning border-status-warning/40"}};function w({status:t,className:n}){const{label:r,Icon:c,tone:o}=v[t]??{label:t,Icon:l,tone:void 0};return e.jsxs("span",{className:p("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs",o??"text-text-muted border-border/60",n),title:r,children:[e.jsx(c,{className:"h-3 w-3","aria-hidden":"true"}),r]})}function I({title:t,hint:n}){return e.jsx("div",{className:"ds-reg",children:e.jsxs("div",{className:"ds-reg-row ds-reg-empty",children:[e.jsxs("span",{className:"ds-reg-main",children:[e.jsx("span",{className:"ds-empty-title",children:t}),e.jsx("span",{className:"ds-reg-meta ds-empty-hint",children:n})]}),e.jsx("span",{className:"ds-reg-aside",children:e.jsx("span",{className:"ds-empty-marker",children:h("dashboard.emptyMarker")})})]})})}export{w as E,I as R};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var zs=Object.defineProperty;var Vs=(r,t,s)=>t in r?zs(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var A=(r,t,s)=>Vs(r,typeof t!="symbol"?t+"":t,s);import{j as e,e as l}from"./vendor-DE_-CLIE.js";import{ap as H,a8 as Gs,ax as At,aw as It,aD as c,az as Ys,ay as Oe,aE as U,au as oe,aj as Js,ai as G,ab as Xs,ag as Zs,aI as en,aL as X,T as tn,Q as sn,X as nn,L as _e,H as rn,I as an,i as $t,at as ls,N as on,aq as Ue,e as Se,S as it,M as ln,y as cn,ar as z,an as te,as as dn,aF as un,G as mn,D as xn,aG as Dt,ac as fn,a0 as pn,af as hn,A as gn,av as yn,aA as bn,aB as jn,Z as qt,$ as wn,aH as kn,b as vn,a2 as Pt,ad as Nn,K as cs,F as _n,d as Sn,C as Cn,a7 as Ot,l as Tn,a as En,u as Fe,w as Ke,E as Mn,g as Le,f as Be,v as He,s as Rn,B as An}from"./main-BC4mcO_f.js";import{A as In,g as Ut}from"./workerType-gCLCeJDi.js";import{D as de,a as ue,c as me,d as xe,b as $n}from"./dialog-Ort95zkZ.js";import{R as Dn}from"./refresh-cw-DBXI7gD3.js";import{A as qn,U as Pn}from"./UserSearchInput-BFpwaVmp.js";import{C as On}from"./copy-EPASKX-X.js";import{E as Un,A as Fn}from"./ArtifactsGallery-CcobkOm1.js";import{S as Kn}from"./SessionVisibilityBadge-Ch3s2iFY.js";import{S as Ln,b as Bn}from"./notifications-C7DetfWu.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.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 Hn=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ds=H("chevron-right",Hn);/**
|
|
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 Wn=[["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"}]],us=H("cpu",Wn);/**
|
|
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 Qn=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],zn=H("gauge",Qn);/**
|
|
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 Vn=[["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"}]],Gn=H("hash",Vn);/**
|
|
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 Yn=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jn=H("info",Yn);/**
|
|
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 Xn=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Zn=H("layers",Xn);/**
|
|
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 er=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ms=H("message-circle-question-mark",er);/**
|
|
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 tr=[["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"}]],sr=H("message-square-text",tr);/**
|
|
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 nr=[["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"}]],rr=H("play",nr);/**
|
|
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 ar=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]],xs=H("plug",ar);/**
|
|
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 or=[["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"}]],ir=H("server-cog",or);/**
|
|
57
|
+
* @license lucide-react v0.555.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const lr=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],fs=H("settings-2",lr);/**
|
|
62
|
+
* @license lucide-react v0.555.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const cr=[["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"}]],dr=H("share-2",cr);/**
|
|
67
|
+
* @license lucide-react v0.555.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const ur=[["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"}]],mr=H("shield-check",ur);function lt(){return{tasks:{}}}const Ft=3e4;function qe(r){const t=r.trim();if(!t)return"agent";const s=t.split(/\s+/).slice(0,2).join(" ");return s.length>40?s.slice(0,40)+"…":s}function Kt(r,t){var i,u,f,p,g,y,v,E,C,b,m,h;const s=t.subtype;if(s!=="task_started"&&s!=="task_progress"&&s!=="task_notification")return r;const n=t.task_id;if(!n)return r;const a=Date.now(),d=r.tasks[n];if(s==="task_started"){if(d)return{tasks:{...r.tasks,[n]:{...d,description:t.description??d.description,name:qe(t.description??d.description),taskType:t.task_type??d.taskType,workflowName:t.workflow_name??d.workflowName,prompt:t.prompt??d.prompt,toolUseId:t.tool_use_id??d.toolUseId,status:"running",startTime:a,evictAfter:void 0}}};const w=t.description??"";return{tasks:{...r.tasks,[n]:{taskId:n,name:qe(w),description:w,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:a}}}}if(s==="task_progress"){if(!d){const w=t.description??"";return{tasks:{...r.tasks,[n]:{taskId:n,name:qe(w),description:w,toolUseId:t.tool_use_id,status:"running",startTime:a,tokenCount:(i=t.usage)==null?void 0:i.total_tokens,toolUseCount:(u=t.usage)==null?void 0:u.tool_uses,durationMs:(f=t.usage)==null?void 0:f.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...r.tasks,[n]:{...d,description:t.description??d.description,tokenCount:((p=t.usage)==null?void 0:p.total_tokens)??d.tokenCount,toolUseCount:((g=t.usage)==null?void 0:g.tool_uses)??d.toolUseCount,durationMs:((y=t.usage)==null?void 0:y.duration_ms)??d.durationMs,lastToolName:t.last_tool_name??d.lastToolName,summary:t.summary??d.summary}}}}return d?{tasks:{...r.tasks,[n]:{...d,status:t.status??"completed",endTime:a,finalSummary:t.summary??d.finalSummary,outputFile:t.output_file??d.outputFile,tokenCount:((b=t.usage)==null?void 0:b.total_tokens)??d.tokenCount,toolUseCount:((m=t.usage)==null?void 0:m.tool_uses)??d.toolUseCount,durationMs:((h=t.usage)==null?void 0:h.duration_ms)??d.durationMs,evictAfter:a+Ft}}}:{tasks:{...r.tasks,[n]:{taskId:n,name:qe(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:a,endTime:a,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(v=t.usage)==null?void 0:v.total_tokens,toolUseCount:(E=t.usage)==null?void 0:E.tool_uses,durationMs:(C=t.usage)==null?void 0:C.duration_ms,evictAfter:a+Ft}}}}function ps(r,t=Date.now()){return Object.values(r.tasks).filter(s=>s.evictAfter===void 0||s.evictAfter>t).sort((s,n)=>s.startTime-n.startTime)}const Lt={in_process_teammate:0,local_bash:1,monitor_mcp:2,remote_agent:3,local_agent:4,dream:5},Bt=100;function xr(r){const t=new Map;for(const s of r){const n=s.taskType??"",a=t.get(n);a?a.push(s):t.set(n,[s])}return[...t.entries()].sort(([s],[n])=>{const a=Lt[s]??Bt,d=Lt[n]??Bt;return a===d?s.localeCompare(n):a-d}).map(([s,n])=>({taskType:s,tasks:[...n].sort((a,d)=>a.startTime-d.startTime)}))}function Ht(r){const t=r.raw,s=t&&typeof t=="object"?t:r,n=typeof s.subtype=="string"?s.subtype:void 0;return n!=="task_started"&&n!=="task_progress"&&n!=="task_notification"?null:{subtype:n,task_id:typeof s.task_id=="string"?s.task_id:void 0,tool_use_id:typeof s.tool_use_id=="string"?s.tool_use_id:void 0,description:typeof s.description=="string"?s.description:void 0,task_type:typeof s.task_type=="string"?s.task_type:void 0,workflow_name:typeof s.workflow_name=="string"?s.workflow_name:void 0,prompt:typeof s.prompt=="string"?s.prompt:void 0,usage:s.usage&&typeof s.usage=="object"?s.usage:void 0,last_tool_name:typeof s.last_tool_name=="string"?s.last_tool_name:void 0,summary:typeof s.summary=="string"?s.summary:void 0,status:s.status==="completed"||s.status==="failed"||s.status==="stopped"?s.status:void 0,output_file:typeof s.output_file=="string"?s.output_file:void 0}}function fr(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const t=r,s={file_search:t.file_search===!0,clear:t.clear===!0,set_max_thinking_tokens:t.set_max_thinking_tokens===!0,get_context_usage:t.get_context_usage===!0,stop_task:t.stop_task===!0,set_model:t.set_model===!0,set_permission_mode:t.set_permission_mode===!0,interrupt:t.interrupt===!0,end_session:t.end_session===!0,mcp_management:t.mcp_management===!0,remote_settings:t.remote_settings===!0,rewind:t.rewind===!0,resume:t.resume===!0,set_effort:t.set_effort===!0,side_question:t.side_question===!0};return Object.values(s).some(Boolean)?s:null}function Wt(r,t){const s=[];if(Array.isArray(r)){for(const n of r){if(!n||typeof n!="object")continue;const a=n;if(typeof a.name!="string"||!a.name)continue;const d=a.type==="prompt"||a.type==="local"||a.type==="local-jsx"?a.type:void 0;s.push({name:a.name,...typeof a.description=="string"&&a.description?{description:a.description}:{},...typeof a.argumentHint=="string"&&a.argumentHint?{argumentHint:a.argumentHint}:{},...d?{type:d}:{}})}if(s.length>0)return s}if(Array.isArray(t))for(const n of t)typeof n=="string"&&n&&s.push({name:n});return s}function Qt(r){const t=r.raw&&typeof r.raw=="object"&&!Array.isArray(r.raw)?r.raw:r,s=Wt(t.slash_command_details??r.slash_command_details,t.slash_commands??r.slash_commands),n=Wt(t.skill_details??r.skill_details,t.skills??r.skills),a=fr(t.remote_capabilities??r.remote_capabilities);return s.length===0&&n.length===0&&!a?null:{commands:s,skills:n,capabilities:a}}class pr{constructor(t){A(this,"listeners",new Set);A(this,"stateListeners",new Set);A(this,"eventSource",null);A(this,"sessionId",null);A(this,"_lastSeqNum",0);A(this,"lastFrameAt",0);A(this,"firstEventAfterOpen",!1);A(this,"watchdogTimer",null);A(this,"visibilityHandler",null);A(this,"reconnectTimer",null);A(this,"reconnectAttempts",0);A(this,"_state","idle");A(this,"opts");this.opts={stallThresholdMs:45e3,watchdogTickMs:5e3,reconnectBaseDelayMs:1e3,reconnectMaxDelayMs:15e3,maxReconnectAttempts:6,...t}}get state(){return this._state}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}onStateChange(t){return this.stateListeners.add(t),()=>this.stateListeners.delete(t)}connect(t){this.stopReconnectTimer(),this.reconnectAttempts=0,this.sessionId=t,this.openStream()}openStream(){if(this.closeStream(),!this.sessionId)return;this.setState("connecting");const t=this._lastSeqNum>0?`/web/sessions/${this.sessionId}/events?fromSeqNum=${this._lastSeqNum}`:`/web/sessions/${this.sessionId}/events`,s=new EventSource(t,{withCredentials:!0});this.eventSource=s,this.lastFrameAt=Date.now(),this.firstEventAfterOpen=!0,s.addEventListener("open",()=>{this.lastFrameAt=Date.now(),this.reconnectAttempts=0,this.firstEventAfterOpen=!0,this.setState("open")}),s.addEventListener("ping",()=>{this.lastFrameAt=Date.now()}),s.addEventListener("message",n=>{this.lastFrameAt=Date.now();try{const a=JSON.parse(n.data);if(this.firstEventAfterOpen&&(this.firstEventAfterOpen=!1,typeof a.seqNum=="number"&&a.seqNum<this._lastSeqNum&&(this._lastSeqNum=a.seqNum-1,this.notifyResync())),a.seqNum!==void 0&&a.seqNum<=this._lastSeqNum)return;a.seqNum!==void 0&&(this._lastSeqNum=a.seqNum);for(const d of this.listeners)d(a)}catch{}}),s.addEventListener("error",()=>{s.readyState===EventSource.CLOSED&&this.scheduleReconnect()}),this.startWatchdog()}disconnect(){this.sessionId=null,this.stopReconnectTimer(),this.closeStream(),this._lastSeqNum=0,this.reconnectAttempts=0,this.setState("idle")}closeStream(){this.stopWatchdog(),this.eventSource&&(this.eventSource.close(),this.eventSource=null)}startWatchdog(){this.stopWatchdog(),this.watchdogTimer=setInterval(()=>{this.probeStall()},this.opts.watchdogTickMs),typeof document<"u"&&(this.visibilityHandler=()=>{document.visibilityState==="visible"&&this.probeStall()},document.addEventListener("visibilitychange",this.visibilityHandler))}probeStall(){const t=this.eventSource;!t||t.readyState!==EventSource.OPEN||Date.now()-this.lastFrameAt<=this.opts.stallThresholdMs||this.scheduleReconnect()}stopWatchdog(){this.watchdogTimer&&(clearInterval(this.watchdogTimer),this.watchdogTimer=null),this.visibilityHandler&&(typeof document<"u"&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null)}stopReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}scheduleReconnect(){if(this.reconnectTimer||!this.sessionId)return;if(this.closeStream(),this.reconnectAttempts++,this.reconnectAttempts>this.opts.maxReconnectAttempts){this.setState("failed");return}this.setState("reconnecting");const t=Math.min(this.opts.reconnectBaseDelayMs*2**(this.reconnectAttempts-1),this.opts.reconnectMaxDelayMs),s=Math.max(0,t+t*.25*(2*Math.random()-1));this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.reconnect()},s)}async reconnect(){this.sessionId&&(await en(),this.sessionId&&this.openStream())}setState(t){if(this._state!==t){this._state=t;for(const s of this.stateListeners)s(t,{})}}notifyResync(){for(const t of this.stateListeners)t(this._state,{resync:!0})}}const ie=new pr;function nt(r){if(typeof r.content=="string")return r.content;if(r.message&&typeof r.message=="object"){const t=r.message;if(typeof t.content=="string")return t.content;if(Array.isArray(t.content))return t.content.filter(s=>s.type==="text"&&typeof s.text=="string").map(s=>s.text).join("")}return""}function zt(r,t){for(let s=r.length-1;s>=0;s--){const n=r[s];if(n&&n.type==="tool_call"&&n.toolCall.id===t)return s}return-1}const rt="streaming-";function hr(r){const t=r.message;if(!t||typeof t!="object"||!Array.isArray(t.content))return"";const s=[];for(const n of t.content)if((n==null?void 0:n.type)==="thinking"){const a=typeof n.thinking=="string"&&n.thinking||typeof n.text=="string"&&n.text||"";a&&s.push(a)}return s.join("")}function Vt(r){return r.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"}))}function Gt(r){if(!r||typeof r!="object")return"";const t=r;if(typeof t.target_event_id=="string"&&t.target_event_id)return t.target_event_id;const s=t.raw;if(s&&typeof s=="object"&&!Array.isArray(s)){const n=s.target_event_id;if(typeof n=="string"&&n)return n}return""}class gr{constructor(t,s,n){A(this,"sessionId");A(this,"setEntries");A(this,"unsub",null);A(this,"unsubState",null);A(this,"onStatusChange");A(this,"onError");A(this,"onPermissionRequest");A(this,"onModelsStateChange");A(this,"onSubagentUpdate");A(this,"onControlResponse");A(this,"onPermissionModeChange");A(this,"onUsageChange");A(this,"onElicitationRequest");A(this,"onWorkerInfoChange");A(this,"subagentState",lt());A(this,"seenUuids",new Set);A(this,"seenToolCallIds",new Set);A(this,"pendingToolCallIds",new Set);A(this,"pendingPermissionToolIds",new Map);A(this,"postedUserUuids",new Set);A(this,"pendingControlRequests",new Map);A(this,"turnEnded",!1);A(this,"userSinceTurnEnd",!1);A(this,"closed",!1);this.sessionId=t,this.setEntries=s,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,this.onWorkerInfoChange=n==null?void 0:n.onWorkerInfoChange}markClosed(){this.closed=!0}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var E,C,b,m,h,w,T;const{events:t}=await Gs(this.sessionId);if(!t||t.length===0)return;const s=new Set;for(const k of t){if(k.type!=="user"||k.direction==="inbound")continue;const j=(E=k.payload)==null?void 0:E.uuid;typeof j=="string"&&j&&s.add(j)}const n=[];let a=null;const d=()=>{a&&(n.push(a),a=null)};for(const k of t){const j=k.payload||{},N=j.uuid;if(typeof N=="string"&&N&&this.seenUuids.add(N),k.type==="tool_use"){const M=j.tool_call_id;typeof M=="string"&&M&&this.seenToolCallIds.add(M)}if(k.type==="user"){if(k.direction==="inbound"){const $=j.uuid;if(typeof $!="string"||!$||s.has($))continue}d();const M=nt(j);M&&n.push({type:"user_message",id:k.id||`hist-user-${n.length}`,content:M})}else if(k.type==="assistant"){d();const M=nt(j);if(At(M))continue;const $=[],K=j.message;if(K&&typeof K=="object"&&Array.isArray(K.content)){for(const S of K.content)if(S.type==="tool_use"){const P=S.id;P&&this.seenToolCallIds.add(P),$.push({type:"tool_call",toolCall:{id:P||`hist-tool-${n.length}`,title:S.name||"tool",status:"complete",rawInput:S.input||{}}})}}if(M||$.length>0){a={type:"assistant_message",id:k.id||`hist-asst-${n.length}`,chunks:M?[{type:"message",text:M}]:[]},n.push(a);for(const S of $)n.push(S);a=null}}else if(k.type==="conversation_rewound"){const M=Gt(j);if(M){const $=n.findIndex(K=>It(K)===M);$>=0&&(n.length=$)}}else if(k.type==="tool_use"){const M=j,$={type:"tool_call",toolCall:{id:M.tool_call_id||`hist-tool-${n.length}`,title:M.tool_name||"tool",status:"complete",rawInput:M.tool_input||{}}};n.push($)}else if(k.type==="tool_result"){const M=j,$=zt(n,M.tool_call_id||"");if($>=0){const K=n[$];n[$]={type:"tool_call",toolCall:{...K.toolCall,rawOutput:{output:M.content||M.output||""}}}}}}d();let i=null;for(const k of t){if(k.type!=="task_state")continue;const j=k.payload||{};Array.isArray(j.tasks)&&(i=j.tasks)}if(i&&i.length>0){const k=Vt(i);k.length>0&&n.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:k})}this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries(n);let u=null,f=null,p=null,g=null;for(const k of t){const j=k.payload||{};if(k.type==="user"?g="user":(k.type==="result"||k.type==="result_success"||k.type==="interrupt")&&(g="turn_end"),k.type==="system"&&(j.subtype==="init"||((C=j.raw)==null?void 0:C.subtype)==="init")&&(f=Qt(j)),k.type==="models_state"){const N=j.raw,M=N&&typeof N=="object"?N.models_state:j.models_state;M&&Array.isArray(M.availableModels)&&typeof M.currentModelId=="string"&&(u=M)}else if(k.type==="result"||k.type==="result_success"){const N=j.usage,M=typeof j.total_cost_usd=="number"?j.total_cost_usd:null;(N||M!==null)&&(p={inputTokens:((N==null?void 0:N.input_tokens)??0)+((N==null?void 0:N.cache_read_input_tokens)??0)+((N==null?void 0:N.cache_creation_input_tokens)??0),outputTokens:(N==null?void 0:N.output_tokens)??0,totalCostUsd:M})}}let y=!1,v=lt();for(const k of t){if(k.type!=="system")continue;const j=Ht(k.payload||{});j&&(v=Kt(v,j),y=!0)}y&&(this.subagentState=v,(b=this.onSubagentUpdate)==null||b.call(this,this.subagentState)),u&&((m=this.onModelsStateChange)==null||m.call(this,u)),f&&((h=this.onWorkerInfoChange)==null||h.call(this,f)),p&&((w=this.onUsageChange)==null||w.call(this,p)),this.turnEnded=g==="turn_end",this.userSinceTurnEnd=g==="user",this.turnEnded&&!this.closed&&((T=this.onStatusChange)==null||T.call(this,"idle"))}connectSSE(){ie.connect(this.sessionId),this.unsub=ie.onEvent(t=>this.handleEvent(t)),this.unsubState=ie.onStateChange((t,s)=>{s.resync&&!this.closed&&this.loadHistory().catch(()=>{})})}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),this.unsubState&&(this.unsubState(),this.unsubState=null),ie.disconnect()}handleEvent(t){var a,d,i,u,f,p,g,y,v,E,C,b;const s=t.type,n=t.payload||{};switch(s){case"user":{if(this.applyEmbeddedToolResults(n),this.userSinceTurnEnd=!0,t.direction==="inbound"){const m=n.uuid;if(typeof m!="string"||!m||this.postedUserUuids.has(m)||this.seenUuids.has(m))break;this.seenUuids.add(m);const h=nt(n);h&&this.setEntries(w=>[...w,{type:"user_message",id:t.id||`user-${Date.now()}`,content:h}])}break}case"assistant":{const m=n.uuid;if(typeof m=="string"&&m){if(this.seenUuids.has(m))break;this.seenUuids.add(m)}const h=typeof n.content=="string"?n.content:"";if(At(h))break;const w=hr(n);this.setEntries(k=>{const j=k[k.length-1];if((j==null?void 0:j.type)==="assistant_message"&&j.id.startsWith(rt))return[...k.slice(0,-1),{...j,id:`assistant-${Date.now()}`,chunks:[...w?[{type:"thought",text:w}]:[],{type:"message",text:h}]}];if((j==null?void 0:j.type)==="assistant_message"){const N=j.chunks[j.chunks.length-1];return(N==null?void 0:N.type)==="message"?[...k.slice(0,-1),{...j,chunks:[...j.chunks.slice(0,-1),{type:"message",text:N.text+h}]}]:[...k.slice(0,-1),{...j,chunks:[...j.chunks,{type:"message",text:h}]}]}if(h&&h.trim()||w){const N={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...w?[{type:"thought",text:w}]:[],...h?[{type:"message",text:h}]:[]]};return[...k,N]}return k});const T=n.message;if(T&&typeof T=="object"&&Array.isArray(T.content)){const k=T.content.filter(j=>j.type==="tool_use");for(const j of k){const N=j.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(N))continue;this.seenToolCallIds.add(N),this.pendingToolCallIds.add(N);const M={id:N,title:j.name||"tool",status:"running",rawInput:j.input||{}};this.setEntries($=>[...$,{type:"tool_call",toolCall:M}])}}break}case"tool_use":{const m=n,h=m.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(h))break;this.seenToolCallIds.add(h),this.pendingToolCallIds.add(h);const w={id:h,title:m.tool_name||"tool",status:"running",rawInput:m.tool_input||{}};this.setEntries(T=>[...T,{type:"tool_call",toolCall:w}]);break}case"tool_result":{const m=n;this.applyToolResult(m.tool_call_id||"",m.content??m.output);break}case"interrupt":{this.finalizePendingToolCalls("canceled"),this.turnEnded=!0,this.userSinceTurnEnd=!1,this.closed||(a=this.onStatusChange)==null||a.call(this,"idle");break}case"control_request":case"permission_request":{const m=n.request;if(m&&m.subtype==="can_use_tool"){const h=n.request_id||"",w=m.tool_name||"unknown",T=m.input||m.tool_input||{},k=m.description||"",j=Array.isArray(m.permission_suggestions)?m.permission_suggestions:[];this.setEntries(N=>{const M=[...N].reverse().findIndex($=>$.type==="tool_call");if(M>=0){const $=N.length-1-M,K=N[$];if(K.toolCall.status==="running")return this.pendingPermissionToolIds.set(h,K.toolCall.id),N.map((S,P)=>P===$?{type:"tool_call",toolCall:{...K.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:h,options:[]}}}:S)}return N}),(d=this.onPermissionRequest)==null||d.call(this,{requestId:h,toolName:w,toolInput:T,description:k,suggestions:j})}else m&&m.subtype==="elicitation"&&((i=this.onElicitationRequest)==null||i.call(this,{requestId:n.request_id||"",serverName:m.mcp_server_name||"",message:m.message||"",mode:m.mode==="url"?"url":"form",url:typeof m.url=="string"?m.url:void 0,requestedSchema:m.requested_schema||void 0}));break}case"conversation_rewound":{const m=Gt(n);m&&(this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries(h=>{const w=h.findIndex(T=>It(T)===m);return w===-1?h:h.slice(0,w)}));break}case"session_status":{if(Ys(n)){this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.setEntries([]);break}if(typeof n.status=="string"){if(Oe(n.status))this.closed=!0,this.finalizePendingToolCalls("canceled");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 m=String(n.message||n.content||"Unknown error");(f=this.onError)==null||f.call(this,m);break}case"models_state":{const m=n.raw,h=typeof m=="object"&&m!==null?m.models_state:n.models_state;h&&Array.isArray(h.availableModels)&&typeof h.currentModelId=="string"&&((p=this.onModelsStateChange)==null||p.call(this,h));break}case"system":{const m=n.raw,h=m&&typeof m=="object"?m:n,w=typeof h.subtype=="string"?h.subtype:void 0,T=Ht(n);T&&(this.subagentState=Kt(this.subagentState,T),(g=this.onSubagentUpdate)==null||g.call(this,this.subagentState));const k=typeof h.permissionMode=="string"?h.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;if(k&&((y=this.onPermissionModeChange)==null||y.call(this,k)),w==="init"){const j=Qt(n);j&&((v=this.onWorkerInfoChange)==null||v.call(this,j))}break}case"control_response":{const m=n.response;if(m&&typeof m=="object"){const h=typeof m.request_id=="string"?m.request_id:"",w=typeof m.subtype=="string"?m.subtype:"";if(h){(E=this.onControlResponse)==null||E.call(this,{subtype:w,requestId:h,error:typeof m.error=="string"?m.error:void 0});const T=this.pendingControlRequests.get(h);T&&(this.pendingControlRequests.delete(h),T({data:w==="success"&&m.response&&typeof m.response=="object"?m.response:null,...w==="error"&&typeof m.error=="string"?{error:m.error}:{}}))}}break}case"stream_event":{const m=n.event;if(!m||typeof m.type!="string")break;if(m.type==="content_block_delta"){const h=m.delta;if(!h||typeof h.type!="string")break;const w=h.type==="text_delta"?"message":h.type==="thinking_delta"?"thought":null;if(!w)break;const T=h.text??h.thinking;if(typeof T!="string"||!T)break;this.appendStreamingDelta(w,T)}break}case"partial_assistant":{const m=typeof n.content=="string"?n.content:"";m&&this.appendStreamingDelta("message",m);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,this.finalizePendingToolCalls(n.is_error?"canceled":"complete"),this.closed||(C=this.onStatusChange)==null||C.call(this,"idle");const m=n.usage,h=typeof n.total_cost_usd=="number"?n.total_cost_usd:null;if(m||h!==null){const N=((m==null?void 0:m.input_tokens)??0)+((m==null?void 0:m.cache_read_input_tokens)??0)+((m==null?void 0:m.cache_creation_input_tokens)??0);(b=this.onUsageChange)==null||b.call(this,{inputTokens:N,outputTokens:(m==null?void 0:m.output_tokens)??0,totalCostUsd:h})}const w=typeof n.subtype=="string"?n.subtype:"",T=n.raw&&typeof n.raw=="object"?n.raw:void 0,j=(typeof n.result=="string"?n.result:typeof(T==null?void 0:T.result)=="string"?T.result:"").trim();w.startsWith("error_")&&j&&this.setEntries(N=>[...N,{type:"command_output",id:`exit-error-${typeof n.uuid=="string"?n.uuid:Date.now()}`,commandName:"worker",inputText:"",title:c("adapter.workerCrashed"),outputText:j,variant:"error"}]);break}case"task_state":{const m=Array.isArray(n.tasks)?n.tasks:[];if(m.length===0)break;const h=Vt(m);if(h.length===0)break;this.setEntries(w=>[...w.filter(k=>k.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:h}]);break}}}applyEmbeddedToolResults(t){const s=t.message;if(!(!s||typeof s!="object"||!Array.isArray(s.content)))for(const n of s.content)!n||n.type!=="tool_result"||this.applyToolResult(n.tool_use_id||"",n.content??n.output)}applyToolResult(t,s){t&&(this.pendingToolCallIds.delete(t),this.setEntries(n=>{const a=zt(n,t);if(a<0)return n;const d=n[a];return d.toolCall.status!=="running"&&d.toolCall.status!=="waiting_for_confirmation"?n:n.map((i,u)=>u===a?{type:"tool_call",toolCall:{...d.toolCall,status:"complete",permissionRequest:void 0,rawOutput:{output:s||""}}}:i)}))}finalizePendingToolCalls(t){if(this.pendingToolCallIds.size===0)return;const s=this.pendingToolCallIds;this.pendingToolCallIds=new Set,this.setEntries(n=>n.map(a=>a.type!=="tool_call"||!s.has(a.toolCall.id)?a:{type:"tool_call",toolCall:{...a.toolCall,status:t,permissionRequest:void 0}}))}appendStreamingDelta(t,s){this.setEntries(n=>{const a=n[n.length-1];if((a==null?void 0:a.type)==="assistant_message"&&a.id.startsWith(rt)){const i=a.chunks[a.chunks.length-1];return(i==null?void 0:i.type)===t?[...n.slice(0,-1),{...a,chunks:[...a.chunks.slice(0,-1),{type:t,text:i.text+s}]}]:[...n.slice(0,-1),{...a,chunks:[...a.chunks,{type:t,text:s}]}]}const d={type:"assistant_message",id:`${rt}${Date.now()}`,chunks:[{type:t,text:s}]};return[...n,d]})}async sendMessage(t,s,n){var p;const a=s&&s.length>0,d=n&&n.length>0;if(!t.trim()&&!a&&!d)return;const i={type:"user_message",id:`user-${Date.now()}`,content:t,images:a?s:void 0,attachments:d?n:void 0};this.setEntries(g=>[...g,i]);const u=[];if(t&&u.push({type:"text",text:t}),a)for(const g of s)u.push({type:"image",source:{type:"base64",media_type:g.mimeType,data:g.data}});if(d){for(const g of n)if(g.kind==="text"||g.kind==="table"){const y=`📎 ${g.name}${g.size!=null?` (${yr(g.size)})`:""}`,v=g.textContent||c("attach.emptyFile");u.push({type:"text",text:`${y}
|
|
72
|
+
\`\`\`
|
|
73
|
+
${v}
|
|
74
|
+
\`\`\``})}else if(g.kind==="directory"){const y=g.files!=null?`${U("attach.directoryHeader",{name:g.name})} ${U("attach.fileCount",{n:g.files.length})}`:U("attach.directoryHeader",{name:g.name}),v=g.textContent||c("attach.emptyDirectory");u.push({type:"text",text:`${y}
|
|
75
|
+
${v}`})}}const f=u.length===1&&u[0].type==="text"?u[0].text||t:u.length>0?u:t;try{const g=oe();this.postedUserUuids.add(g);const y=await Js(this.sessionId,{type:"user",uuid:g,content:t,message:{content:f}}),v=(p=y==null?void 0:y.event)==null?void 0:p.id;v&&this.setEntries(E=>E.map(C=>C.type==="user_message"&&C.id===i.id?{...C,id:v}:C))}catch(g){throw this.setEntries(y=>y.filter(v=>!(v.type==="user_message"&&v.id===i.id))),g}}async respondPermission(t,s,n){await G(this.sessionId,{type:"permission_response",approved:s,request_id:t,...n});const a=this.pendingPermissionToolIds.get(t);this.pendingPermissionToolIds.delete(t),a&&!s&&this.pendingToolCallIds.delete(a),this.setEntries(d=>d.map(i=>{var u;return i.type!=="tool_call"||((u=i.toolCall.permissionRequest)==null?void 0:u.requestId)!==t?i:{type:"tool_call",toolCall:{...i.toolCall,status:s?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.finalizePendingToolCalls("canceled"),await Xs(this.sessionId)}async setPermissionMode(t){const s=oe();return await G(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_permission_mode",mode:t}}),s}async controlRoundTrip(t,s=8e3){const n=oe(),a=new Promise(i=>{this.pendingControlRequests.set(n,i)}),d=setTimeout(()=>{const i=this.pendingControlRequests.get(n);i&&(this.pendingControlRequests.delete(n),i({data:null,error:"timeout"}))},s);try{return await G(this.sessionId,{type:"control_request",request_id:n,request:t}),await a}catch(i){throw this.pendingControlRequests.delete(n),i}finally{clearTimeout(d)}}async searchFiles(t,s=20){const n=await this.controlRoundTrip({subtype:"file_search",query:t,limit:s});try{if(!n.data||!Array.isArray(n.data.suggestions))return[];const a=[];for(const d of n.data.suggestions)d&&typeof d=="object"&&typeof d.path=="string"&&a.push(d.path);return a}catch{return[]}}async respondElicitation(t,s,n){await G(this.sessionId,{type:"permission_response",approved:s==="accept",request_id:t,response:{subtype:"success",request_id:t,response:{action:s,...n?{content:n}:{}}}})}async askSideQuestion(t){const s=await this.controlRoundTrip({subtype:"side_question",question:t},12e4);if(s.error||!s.data)return null;const n=s.data.response;return typeof n=="string"?n:null}async listResumableSessions(){const t=await this.controlRoundTrip({subtype:"list_sessions"});if(!t.data||!Array.isArray(t.data.sessions))throw new Error(t.error??"list_sessions failed");const s=[];for(const n of t.data.sessions){if(!n||typeof n!="object")continue;const a=n;typeof a.session_id!="string"||!a.session_id||s.push({sessionId:a.session_id,title:typeof a.title=="string"&&a.title?a.title:a.session_id.slice(0,8),modified:typeof a.modified=="number"?a.modified:0,...typeof a.created_at=="number"?{createdAt:a.created_at}:{},...typeof a.git_branch=="string"&&a.git_branch?{gitBranch:a.git_branch}:{}})}return s}async resumeSession(t){const s=await this.controlRoundTrip({subtype:"resume_session",session_id:t},3e4);if(!s.data)throw new Error(s.error??"resume_session failed");return{title:typeof s.data.title=="string"?s.data.title:null,messageCount:typeof s.data.message_count=="number"?s.data.message_count:0}}async setEffort(t){const s=oe();return await G(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_effort",...t?{effort:t}:{effort:null}}}),s}async setThinkingBudget(t){const s=oe();return await G(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_max_thinking_tokens",max_thinking_tokens:t}}),s}async getContextUsage(){const t=await this.controlRoundTrip({subtype:"get_context_usage"});try{if(!t.data)return null;const s=t.data.totalTokens,n=t.data.rawMaxTokens,a=t.data.percentage;if(typeof s!="number"||typeof n!="number")return null;const d=t.data.categories,i=Array.isArray(d)?d.filter(u=>!!u&&typeof u=="object"&&typeof u.name=="string").map(u=>({name:u.name,tokens:typeof u.tokens=="number"?u.tokens:0,...u.isDeferred===!0?{isDeferred:!0}:{}})):void 0;return{totalTokens:s,rawMaxTokens:n,percentage:typeof a=="number"?a:0,...typeof t.data.model=="string"&&t.data.model?{model:t.data.model}:{},...i&&i.length>0?{categories:i}:{}}}catch{return null}}async stopSubagent(t){const s=await this.controlRoundTrip({subtype:"stop_task",task_id:t});try{return s.error?{ok:!1,error:s.error==="timeout"?c("adapter.stopTimeout"):s.error}:{ok:!0}}catch{return{ok:!1,error:c("adapter.stopFailed")}}}async getMcpServers(){var a;const s=(a=(await this.controlRoundTrip({subtype:"mcp_status"})).data)==null?void 0:a.mcpServers;if(!Array.isArray(s))return[];const n=[];for(const d of s){if(!d||typeof d!="object")continue;const i=d;if(typeof i.name!="string"||!i.name)continue;const u=i.status;if(u!=="connected"&&u!=="failed"&&u!=="needs-auth"&&u!=="pending"&&u!=="disabled")continue;const f=i.serverInfo,p=i.config;n.push({name:i.name,status:u,...f&&typeof f.name=="string"&&typeof f.version=="string"?{serverInfo:{name:f.name,version:f.version}}:{},...typeof i.error=="string"&&i.error?{error:i.error}:{},...typeof(p==null?void 0:p.url)=="string"&&p.url?{url:p.url}:{},...Array.isArray(i.tools)?{toolCount:i.tools.length}:{}})}return n}async toggleMcpServer(t,s){const n=await this.controlRoundTrip({subtype:"mcp_toggle",serverName:t,enabled:s},15e3);return n.error?{ok:!1,error:n.error==="timeout"?c("adapter.requestTimeout"):n.error}:{ok:!0}}async reconnectMcpServer(t){const s=await this.controlRoundTrip({subtype:"mcp_reconnect",serverName:t},2e4);return s.error?{ok:!1,error:s.error==="timeout"?c("adapter.requestTimeout"):s.error}:{ok:!0}}async getRemoteSettings(){const s=(await this.controlRoundTrip({subtype:"get_settings"})).data;if(!s)return null;const n=s.applied,a=s.effective&&typeof s.effective=="object"&&!Array.isArray(s.effective)?s.effective:{},d=s.sources,i=[];if(Array.isArray(d))for(const u of d){if(!u||typeof u!="object")continue;const f=u;typeof f.source=="string"&&i.push({source:f.source,settings:f.settings&&typeof f.settings=="object"&&!Array.isArray(f.settings)?f.settings:{}})}return{applied:{model:typeof(n==null?void 0:n.model)=="string"?n.model:null,effort:typeof(n==null?void 0:n.effort)=="string"?n.effort:null},effective:a,sources:i}}async applyFlagSettings(t){const s=await this.controlRoundTrip({subtype:"apply_flag_settings",settings:t},15e3);return s.error?{ok:!1,error:s.error==="timeout"?c("adapter.requestTimeout"):s.error}:{ok:!0}}async rewindToMessage(t){await Zs(this.sessionId,t)}async endSession(t){await G(this.sessionId,{type:"control_request",request_id:oe(),request:{subtype:"end_session",...t?{reason:t}:{}}})}}function yr(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function Pe({onBack:r,title:t,meta:s,actions:n}){return X(),e.jsx("div",{className:"flex-shrink-0 border-b border-nav-rule bg-surface-1/80 backdrop-blur-md",children:e.jsxs("div",{className:"mx-auto flex h-12 w-full page-measure items-center gap-2 px-4 sm:px-8",children:[e.jsx("button",{type:"button",onClick:r,"aria-label":c("nav.dashboard"),title:c("nav.dashboard"),className:"-mx-2 flex-shrink-0 rounded-md px-2 py-1 text-xs text-text-muted transition hover:-translate-x-0.5 hover:bg-surface-2 hover:text-text-primary",children:c("nav.dashboard")}),e.jsx("span",{className:"mx-1 h-4 w-px flex-shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[t,s&&e.jsx("div",{className:"flex flex-shrink-0 items-center gap-2",children:s})]}),n&&e.jsx("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:n}),e.jsx("span",{className:"mx-1 h-4 w-px flex-shrink-0 bg-border","aria-hidden":"true"}),e.jsx(tn,{}),e.jsx(sn,{onSettingsClick:()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))}})]})})}const Yt="rcs:subagent-panel:collapsed";function br(r){if(r<1e3)return"0s";const t=Math.floor(r/1e3);if(t<60)return`${t}s`;const s=Math.floor(t/60),n=t%60;if(s<60)return n?`${s}m${n}s`:`${s}m`;const a=Math.floor(s/60),d=s%60;return d?`${a}h${d}m`:`${a}h`}function jr(r){return r===void 0||r<=0?"":r<1e3?`${r}`:r<1e6?`${(r/1e3).toFixed(r<1e4?1:0)}k`:`${(r/1e6).toFixed(1)}M`}function wr({status:r}){return r==="running"?e.jsx(_e,{className:"h-3 w-3 animate-spin text-brand-text"}):r==="completed"?e.jsx(rr,{className:"h-3 w-3 text-status-success"}):r==="failed"||r==="stopped"?e.jsx(rn,{className:"h-3 w-3 text-status-error"}):null}function hs({task:r,onStopTask:t,fullText:s}){const n=r.status==="running",a=n?r.durationMs??Date.now()-r.startTime:(r.endTime??Date.now())-r.startTime,d=jr(r.tokenCount),i=r.toolUseCount!==void 0&&r.toolUseCount>0?`${r.toolUseCount} tool${r.toolUseCount>1?"s":""}`:"",u=r.summary||r.description||"(no description)";return e.jsxs("div",{className:"group/task 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(wr,{status:r.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:r.name}),e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:br(a)})]}),e.jsx("div",{className:`mt-0.5 text-text-secondary ${s?"line-clamp-2 break-words":"truncate"}`,children:u}),(d||i||r.lastToolName)&&e.jsxs("div",{className:"mt-0.5 flex items-center gap-x-2 overflow-hidden whitespace-nowrap font-mono text-[10px] text-text-muted",children:[d&&e.jsxs("span",{className:"flex-shrink-0",children:["↕ ",d," tok"]}),i&&e.jsxs("span",{className:"flex-shrink-0",children:["· ",i]}),r.lastToolName&&e.jsxs("span",{className:"min-w-0 truncate",children:["· last: ",r.lastToolName]})]}),!n&&r.finalSummary&&e.jsx("div",{className:"mt-1 line-clamp-2 rounded bg-status-success/10 px-1.5 py-0.5 text-[10px] text-status-success",children:r.finalSummary})]}),n&&t&&e.jsx("button",{type:"button",onClick:()=>t(r.taskId),title:c("subagent.stop"),className:"mt-0.5 flex-shrink-0 rounded p-0.5 text-text-muted opacity-0 transition-opacity hover:bg-status-error/10 hover:text-status-error focus:opacity-100 group-hover/task:opacity-100",children:e.jsx(nn,{className:"h-3.5 w-3.5"})})]})}function kr({state:r,onStopTask:t}){const[s,n]=l.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Yt)==="1"}catch{return!1}}),a=()=>{n(y=>{const v=!y;try{window.localStorage.setItem(Yt,v?"1":"0")}catch{}return v})},d=Object.values(r.tasks).some(y=>y.status==="running"),i=Object.values(r.tasks).some(y=>y.status!=="running"&&y.evictAfter!==void 0),[,u]=l.useState(0);l.useEffect(()=>{if(!d&&!i)return;const y=setInterval(()=>{u(v=>v+1)},1e3);return()=>clearInterval(y)},[d,i]);const f=ps(r);if(f.length===0)return null;const p=f.filter(y=>y.status==="running").length,g=p>0?`${p} running`:`${f.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:a,"aria-expanded":!s,"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(ds,{className:`h-3 w-3 transition-transform ${s?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:g})]}),!s&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:f.map(y=>e.jsx(hs,{task:y,onStopTask:t},y.taskId))})]})})}function vr(r){if(!r)return"never";const t=Math.max(0,Date.now()-r);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 Nr(r){return r?Date.now()-r<6e4:!1}function _r({onClose:r,session:t,liveStatus:s,pendingPermissions:n,onInterrupt:a,onDelete:d,subagentState:i,onStopTask:u,onEndSession:f}){const[p,g]=l.useState(!1),y=async()=>{await navigator.clipboard.writeText(t.id),g(!0),setTimeout(()=>g(!1),1500)},[v,E]=l.useState(!1),C=async()=>{if(!(!f||v)&&window.confirm(c("task.endConfirm"))){E(!0);try{await f(),r()}catch{E(!1)}}},b=n.length,m=t.worker,h=t.work_item,w=t.environment;return e.jsx(de,{open:!0,onOpenChange:T=>{T||r()},children:e.jsxs(ue,{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(me,{children:e.jsx(xe,{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(In,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(an,{status:s||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:m&&(Nr(m.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[m&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx($t,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:vr(m.last_heartbeat_at)})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(us,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:w.machine_name||w.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx($t,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:ls(t.created_at)})]})]})]}),e.jsx(Tr,{state:i,onStopTask:u}),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(_e,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),b>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[b," permission request",b>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(ir,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:a,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"}),f&&e.jsx("button",{onClick:C,disabled:v,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 disabled:opacity-50 disabled:cursor-not-allowed",title:c("task.endHint"),children:v?"Ending…":"End session"}),e.jsxs("button",{onClick:d,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(on,{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(Gn,{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:y,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:p?"✓":"⧉"})]})]}),h&&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:h.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:h.state})]})]}),t.source&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Source"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:t.source})]}),w&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:w.worker_type})]})]})]})]})]})})}const Sr={in_process_teammate:"task.type.teammates",local_bash:"task.type.shells",monitor_mcp:"task.type.monitors",remote_agent:"task.type.remoteAgents",local_agent:"task.type.localAgents"},Cr=new Set(["dream"]);function Tr({state:r,onStopTask:t}){const s=Object.values(r.tasks).some(f=>f.status==="running"),n=Object.values(r.tasks).some(f=>f.status!=="running"&&f.evictAfter!==void 0),[,a]=l.useState(0);l.useEffect(()=>{if(!s&&!n)return;const f=setInterval(()=>{a(p=>p+1)},1e3);return()=>clearInterval(f)},[s,n]);const d=ps(r),i=d.filter(f=>f.status==="running").length,u=d.length-i;return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(Zn,{className:"h-3.5 w-3.5"}),c("task.backgroundTasks")]}),d.length>0&&e.jsx("span",{className:"font-mono text-[10px] text-text-muted",children:i>0&&u>0?U("task.mixedCount",{running:i,recent:u}):i>0?U("task.runningCount",{count:i}):U("task.recentCount",{count:d.length})})]}),d.length===0?e.jsx("p",{className:"text-xs text-text-muted",children:c("task.noBackgroundTasks")}):e.jsx("div",{className:"max-h-[38vh] space-y-2 overflow-y-auto overscroll-contain pr-1",children:xr(d).map(f=>{const p=!Cr.has(f.taskType),g=Sr[f.taskType]??"task.type.tasks";return e.jsxs("div",{className:"space-y-1",children:[p&&e.jsxs("div",{className:"pl-1 text-[10px] font-medium uppercase tracking-wide text-text-muted/80",children:[c(g)," (",f.tasks.length,")"]}),f.tasks.map(y=>e.jsx(hs,{task:y,onStopTask:t,fullText:!0},y.taskId))]},f.taskType)})})]})}const Er={connected:"bg-status-success/15 text-status-success",failed:"bg-status-error/15 text-status-error","needs-auth":"bg-status-warning/15 text-status-warning",pending:"bg-status-active/15 text-status-active",disabled:"bg-surface-3 text-text-muted"},Mr={connected:"mcp.status.connected",failed:"mcp.status.failed","needs-auth":"mcp.status.needsAuth",pending:"mcp.status.pending",disabled:"mcp.status.disabled"};function Rr({onClose:r,fetchServers:t,onToggle:s,onReconnect:n}){X();const[a,d]=l.useState(null),[i,u]=l.useState(null),[f,p]=l.useState(null),[g,y]=l.useState(null),v=l.useCallback(async()=>{p(null),y(null);try{const b=await t();d(b),u(null)}catch(b){Ue("[McpPanel] fetch failed",b),u(c("mcp.loadFailed"))}},[t]);l.useEffect(()=>{v()},[v]);const E=async b=>{const m=b.status==="disabled";p(`toggle:${b.name}`),y(null);try{const h=await s(b.name,m);h.ok||y(h.error||c("mcp.toggleFailed"))}finally{await v()}},C=async b=>{p(`reconnect:${b.name}`),y(null);try{const m=await n(b.name);m.ok||y(m.error||c("mcp.reconnectFailed"))}finally{await v()}};return e.jsx(de,{open:!0,onOpenChange:b=>{b||r()},children:e.jsxs(ue,{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(me,{children:e.jsxs(xe,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(xs,{className:"h-4 w-4"}),c("session.mcp.title")]})}),e.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[g&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:g}),a===null&&!i&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(_e,{className:"h-3.5 w-3.5 animate-spin"}),c("mcp.loading")]}),i&&e.jsx("p",{className:"text-xs text-status-error",children:i}),a!==null&&a.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:c("mcp.empty")}),a==null?void 0:a.map(b=>{const m=f===`toggle:${b.name}`,h=f===`reconnect:${b.name}`,w=b.status==="disabled";return e.jsx("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-text-primary",children:b.name}),e.jsx("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${Er[b.status]}`,children:c(Mr[b.status])})]}),e.jsxs("div",{className:"mt-0.5 truncate text-xs text-text-muted",children:[b.serverInfo?`${b.serverInfo.name} v${b.serverInfo.version}`:b.url||"stdio",b.toolCount!==void 0&&` · ${U("mcp.toolCount",{n:b.toolCount})}`]}),b.error&&e.jsx("div",{className:"mt-1 truncate text-xs text-status-error",title:b.error,children:b.error})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void C(b),disabled:h||w,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-3 hover:text-text-primary transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:c("mcp.reconnect"),children:e.jsx(Dn,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`})}),e.jsx("button",{type:"button",role:"switch","aria-checked":!w,onClick:()=>void E(b),disabled:m,className:`relative h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${w?"bg-surface-3":"bg-brand"}`,title:w?c("mcp.enable"):c("mcp.disable"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${w?"left-0.5":"left-4.5"}`})})]})]})},b.name)})]})]})})}function Ar(r){if(r==null)return c("settings.unset");if(typeof r=="string")return r;try{return JSON.stringify(r)}catch{return String(r)}}function Jt(r){if(r==null)return c("settings.unset");if(typeof r=="object")try{return JSON.stringify(r,null,2)}catch{return String(r)}return String(r)}function Ir({onClose:r,fetchSettings:t,onApply:s}){X();const[n,a]=l.useState(null),[d,i]=l.useState(null),[u,f]=l.useState(""),[p,g]=l.useState(null),[y,v]=l.useState(null),[E,C]=l.useState(null),[b,m]=l.useState(!1),h=l.useCallback(async()=>{g(null),v(null),C(null),m(!1);try{const S=await t();a(S),i(S?null:c("settings.loadFailed"))}catch(S){Ue("[SettingsDrawer] fetch failed",S),i(c("settings.loadFailed"))}},[t]);l.useEffect(()=>{h()},[h]);const w=l.useMemo(()=>n?Object.entries(n.effective).filter(([,S])=>S!==void 0).sort(([S],[P])=>S.localeCompare(P)):[],[n]),T=l.useMemo(()=>{const S=u.trim().toLowerCase();return S?w.filter(([P,V])=>`${P} ${Ar(V)}`.toLowerCase().includes(S)):w},[w,u]),k=S=>typeof S[1]=="boolean",j=l.useMemo(()=>T.filter(k),[T]),N=l.useMemo(()=>T.filter(S=>!k(S)),[T]),M=l.useMemo(()=>E===null?null:w.find(([S])=>S===E)??null,[w,E]),$=async()=>{if(M)try{await navigator.clipboard.writeText(Jt(M[1])),m(!0),window.setTimeout(()=>m(!1),1500)}catch(S){Ue("[SettingsDrawer] copy failed",S)}},K=async(S,P)=>{g(S),v(null);try{const V=await s({[S]:!P});V.ok||v(V.error||c("settings.writeFailed"))}finally{await h()}};return e.jsx(de,{open:!0,onOpenChange:S=>{S||r()},children:e.jsxs(ue,{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(me,{children:e.jsxs(xe,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(fs,{className:"h-4 w-4"}),c("session.settings.title")]})}),e.jsxs("div",{className:"mt-3 space-y-4 text-sm",children:[y&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:y}),n===null&&!d&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(_e,{className:"h-3.5 w-3.5 animate-spin"}),c("settings.loading")]}),d&&e.jsx("p",{className:"text-xs text-status-error",children:d}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-text-muted",children:c("settings.model")}),e.jsx("code",{className:"font-mono text-text-secondary",children:n.applied.model||c("settings.defaultModel")})]}),n.applied.effort&&e.jsxs("div",{className:"mt-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-text-muted",children:"Effort"}),e.jsx("code",{className:"font-mono text-text-secondary",children:n.applied.effort})]}),e.jsx("p",{className:"mt-2 text-[10px] leading-relaxed text-text-muted",children:c("settings.hint")})]}),M?e.jsxs("section",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>{C(null),m(!1)},className:"flex items-center gap-1.5 text-xs text-text-muted transition-colors hover:text-text-primary",children:[e.jsx(qn,{className:"h-3.5 w-3.5"}),c("settings.back")]}),e.jsx("div",{className:"break-all font-mono text-xs font-medium text-text-primary",children:M[0]}),e.jsx("pre",{className:"max-h-[60vh] overflow-y-auto whitespace-pre-wrap break-all rounded-md border border-border bg-surface-2 p-3 font-mono text-[10px] leading-relaxed text-text-secondary",children:Jt(M[1])}),e.jsxs("button",{type:"button",onClick:()=>void $(),className:"flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary",children:[b?e.jsx(Se,{className:"h-3.5 w-3.5 text-status-success"}):e.jsx(On,{className:"h-3.5 w-3.5"}),b?c("settings.copied"):c("settings.copyValue")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-2 px-2.5 py-1.5",children:[e.jsx(it,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:u,onChange:S=>f(S.target.value),placeholder:c("settings.searchPlaceholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"})]}),T.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:c("settings.noMatch")}),j.length>0&&e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[10px] font-medium uppercase tracking-wide text-text-muted",children:U("settings.togglable",{n:j.length})}),j.map(([S,P])=>{const V=p===S;return e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border bg-surface-2 px-3 py-2",children:[e.jsx("div",{className:"truncate font-mono text-xs text-text-primary",children:S}),e.jsx("button",{type:"button",role:"switch","aria-checked":P,disabled:V,onClick:()=>void K(S,P),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${P?"bg-brand":"bg-surface-3"}`,title:P?c("settings.turnOff"):c("settings.turnOn"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${P?"left-4.5":"left-0.5"}`})})]},S)})]}),N.length>0&&e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[10px] font-medium uppercase tracking-wide text-text-muted",children:U("settings.readOnly",{n:N.length})}),N.map(([S])=>e.jsxs("button",{type:"button",onClick:()=>C(S),className:"flex w-full items-center justify-between gap-3 rounded-md border border-border bg-surface-2 px-3 py-2 text-left transition-colors hover:bg-surface-3",title:c("settings.viewDetail"),children:[e.jsx("span",{className:"truncate font-mono text-xs text-text-primary",children:S}),e.jsx(ds,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"})]},S))]})]})]})]})]})})}function $r({onClose:r,onAsk:t}){X();const[s,n]=l.useState([]),[a,d]=l.useState(""),[i,u]=l.useState(!1),f=async()=>{const p=a.trim();if(!p||i)return;const g=Date.now();n(y=>[...y,{id:g,question:p,answer:null}]),d(""),u(!0);try{const y=await t(p);n(v=>v.map(E=>E.id===g?{...E,answer:y??c("sideQuestion.noAnswer"),error:y===null}:E))}finally{u(!1)}};return e.jsx(de,{open:!0,onOpenChange:p=>{p||r()},children:e.jsxs(ue,{showCloseButton:!1,className:"fixed inset-y-0 right-0 top-auto left-auto translate-x-0 translate-y-0 w-full sm:w-[26rem] h-full max-w-none max-h-none rounded-none border-l border-border bg-surface-1 p-4 sm:max-w-md flex flex-col",children:[e.jsx(me,{children:e.jsxs(xe,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(ms,{className:"h-4 w-4"}),c("sideQuestion.title")]})}),e.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-text-muted",children:c("sideQuestion.desc")}),e.jsxs("div",{className:"mt-3 flex-1 space-y-4 overflow-y-auto",children:[s.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:c("sideQuestion.empty")}),s.map(p=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx("div",{className:"max-w-[85%] rounded-2xl rounded-br-md border border-user-bubble-border bg-user-bubble px-4 py-2 text-sm text-text-primary",children:p.question})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:e.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:24,height:24,className:"object-contain",draggable:!1})}),e.jsx("div",{className:"min-w-0 flex-1 pt-1 text-sm text-text-primary",children:p.answer===null?e.jsxs("span",{className:"chat-typing-indicator inline-flex items-center gap-1","aria-hidden":"true",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}):e.jsx("div",{className:p.error?"text-status-error":"",children:e.jsx(ln,{children:p.answer})})})]})]},p.id))]}),e.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[e.jsx("textarea",{value:a,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"&&!p.shiftKey&&!p.nativeEvent.isComposing&&(p.preventDefault(),f())},rows:Math.min(4,Math.max(1,a.split(`
|
|
76
|
+
`).length)),placeholder:c("sideQuestion.placeholder"),disabled:i,className:"flex-1 resize-none rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-accent focus:outline-none disabled:opacity-50"}),e.jsx("button",{type:"button",onClick:()=>void f(),disabled:i||!a.trim(),className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg bg-brand text-white transition-colors hover:bg-brand-light disabled:opacity-40 disabled:cursor-not-allowed",title:c("sideQuestion.send"),children:i?e.jsx(_e,{className:"h-4 w-4 animate-spin"}):e.jsx(cn,{className:"h-4 w-4"})})]})]})})}const at="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1";function Xt(r,t){var a;const s=(a=t==null?void 0:t.find(d=>d.type==="addRules"||d.type==="replaceRules"))==null?void 0:a.rules,n=s==null?void 0:s[0];return n!=null&&n.ruleContent?`${n.toolName}(${n.ruleContent})`:n!=null&&n.toolName?n.toolName:r}function Dr({requestId:r,toolName:t,toolInput:s,description:n,suggestions:a,onApprove:d,onApproveAlways:i,onReject:u}){X();const f=s&&typeof s=="object"&&!Array.isArray(s)?s:{},p=dn(un(t),f,{writeUnknownLabel:c("permission.writeUnknown")}),g=typeof s=="string"?s:JSON.stringify(s,null,2),y=Array.isArray(a)&&a.length>0;return e.jsxs("div",{role:"group","aria-label":U("permission.requestAria",{tool:t}),className:"rounded-xl border border-approve/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-approve/15 text-approve-text",children:e.jsx(mn,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold font-display text-approve-text",children:c("permission.title")})]}),n&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:z(n)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:z(t)}),t!=="AskUserQuestion"&&(p?e.jsx("div",{className:"mb-3 space-y-2",children:p.map((v,E)=>e.jsx(xn,{filePath:v.filePath,oldString:v.oldString,newString:v.newString,label:v.label},E))}):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:Dt(g,500)})),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{onClick:d,className:te("rounded-lg bg-approve px-4 py-2 text-sm font-medium font-display text-white hover:bg-approve-hover transition-colors",at),children:c("permission.approve")}),y&&i&&e.jsxs("button",{onClick:i,className:te("flex items-center gap-1.5 rounded-lg border border-approve/40 bg-approve/10 px-4 py-2 text-sm font-medium font-display text-approve-text hover:bg-approve/20 transition-colors",at),title:c("permission.alwaysAllowHint").replace("{rule}",Xt(t,a)),children:[e.jsx(mr,{className:"h-3.5 w-3.5"}),c("permission.alwaysAllow")," ",Dt(Xt(t,a),40)]}),e.jsx("button",{onClick:u,className:te("rounded-lg border border-status-error/40 px-4 py-2 text-sm font-medium font-display text-status-error hover:bg-status-error/10 transition-colors",at),children:c("permission.reject")})]})]})}function qr({questions:r,description:t,onSubmit:s,onSkip:n}){const[a,d]=l.useState({}),[i,u]=l.useState({}),[f,p]=l.useState(0),g=(C,b,m)=>{if(m){const h=a[C]||[],w=h.includes(b)?h.filter(T=>T!==b):[...h,b];d({...a,[C]:w})}else d({...a,[C]:b})},y=C=>{var m;const b=(m=i[C])==null?void 0:m.trim();b&&(d({...a,[C]:b}),u({...i,[C]:""}))},v=()=>{var b,m;const C={};for(const[h,w]of Object.entries(a)){const T=r[parseInt(h,10)];T&&(typeof w=="number"?C[h]=((m=(b=T.options)==null?void 0:b[w])==null?void 0:m.label)||String(w):Array.isArray(w)?C[h]=w.map(k=>{var j,N;return((N=(j=T.options)==null?void 0:j[k])==null?void 0:N.label)||String(k)}):C[h]=w)}s(C)};if(r.length<=1){const C=r[0]||{question:t,options:[],multiSelect:!1},b=C.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 font-display text-text-primary",children:z(t||C.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(C.options||[]).map((m,h)=>{const w=b?(a[0]||[]).includes(h):a[0]===h;return e.jsxs("button",{onClick:()=>g(0,h,b),className:te("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",w?"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 font-display",children:z(m.label)}),m.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:z(m.description)})]},h)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:i[0]||"",onChange:m=>u({...i,0:m.target.value}),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:m=>m.key==="Enter"&&y(0)}),e.jsx("button",{onClick:()=>y(0),className:"rounded-lg border border-border px-3 py-2 text-sm font-display 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:v,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display 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 font-display text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})}const E=r[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 font-display text-text-primary",children:z(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:r.map((C,b)=>e.jsx("button",{onClick:()=>p(b),className:te("rounded-md px-3 py-1.5 text-xs font-display whitespace-nowrap transition-colors",f===b?"bg-brand/20 text-brand-text":"text-text-muted hover:bg-surface-2"),children:C.header||`Q${b+1}`},b))}),E&&e.jsx(Pr,{question:E,qIdx:f,answers:a,otherTexts:i,onSelect:g,onOtherTextChange:(C,b)=>u({...i,[C]:b}),onOtherSubmit:y}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-display text-text-muted",children:[f+1," / ",r.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:v,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium font-display 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 font-display text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})]})}function Pr({question:r,qIdx:t,answers:s,otherTexts:n,onSelect:a,onOtherTextChange:d,onOtherSubmit:i}){const u=r.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:z(r.question)}),e.jsxs("div",{className:"space-y-2",children:[(r.options||[]).map((f,p)=>{const g=u?(s[t]||[]).includes(p):s[t]===p;return e.jsxs("button",{onClick:()=>a(t,p,u),className:te("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display 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 font-display",children:z(f.label)}),f.description&&e.jsx("div",{className:"mt-0.5 text-xs font-sans text-text-muted",children:z(f.description)})]},p)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:n[t]||"",onChange:f=>d(t,f.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm font-display text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:f=>f.key==="Enter"&&i(t)}),e.jsx("button",{onClick:()=>i(t),className:"rounded-lg border border-border px-3 py-2 text-sm font-display text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]})]})}function Or({planContent:r,description:t,onSubmit:s}){const[n,a]=l.useState(null),[d,i]=l.useState(""),u=!r||!r.trim(),f=()=>{n&&s(n,n==="no"?d: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-text",children:e.jsx(Se,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold font-display text-text-primary",children:u?"Exit plan mode?":"Ready to code?"})]}),!u&&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:Ur(r)}}),e.jsx("div",{className:"space-y-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes"}),e.jsx(Ne,{selected:n==="no",onClick:()=>a("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{selected:n==="yes-accept-edits",onClick:()=>a("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(Ne,{selected:n==="yes-default",onClick:()=>a("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(Ne,{selected:n==="no",onClick:()=>a("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),n==="no"&&e.jsx("textarea",{value:d,onChange:p=>i(p.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 font-display 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 font-display text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function Ne({selected:r,onClick:t,label:s,desc:n}){return e.jsxs("button",{onClick:t,className:te("w-full rounded-lg border px-4 py-2.5 text-left text-sm font-display transition-colors",r?"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:te("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",r?"border-brand bg-brand text-white":"border-border"),children:r&&"✓"}),e.jsx("span",{className:"font-medium font-display",children:s})]}),n&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs font-sans text-text-muted",children:n})]})}function Ur(r){let t=z(r);return t=t.replace(/```(\w*)\n?([\s\S]*?)```/g,(s,n,a)=>`<pre class="my-2 overflow-x-auto rounded-lg bg-tool-card p-3 font-mono text-xs">${a.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 Fr({request:r,onSubmit:t}){X();const s=Kr(r.requestedSchema),n=Lr(r.requestedSchema),[a,d]=l.useState({}),i=s.length===0||n.every(u=>(a[u]??"").trim()!=="");return r.mode==="url"&&r.url?e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(Zt,{serverName:r.serverName,message:r.message}),e.jsxs("a",{href:r.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-text hover:bg-brand/10 transition-colors",children:[e.jsx("span",{className:"truncate font-mono text-xs",children:r.url}),e.jsx(Un,{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:c("elicitation.done")}),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:c("common.cancel")})]})]}):e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx(Zt,{serverName:r.serverName,message:r.message}),s.length>0&&e.jsx("div",{className:"mb-3 space-y-3",children:s.map(({name:u,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:u}),n.includes(u)&&e.jsx("span",{className:"text-[10px] font-medium text-warning-text",children:c("elicitation.required")})]}),f.description&&e.jsx("div",{className:"mb-1 text-xs text-text-muted",children:z(f.description)}),e.jsx("input",{type:f.type==="number"?"number":"text",value:a[u]??"",onChange:p=>d(g=>({...g,[u]:p.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"})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{const u={};for(const{name:f,prop:p}of s){const g=(a[f]??"").trim();g&&(u[f]=p.type==="number"?Number(g):g)}t("accept",u)},disabled:!i,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("elicitation.submit")}),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:c("elicitation.decline")})]})]})}function Zt({serverName:r,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-text",children:e.jsx(sr,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-sm font-semibold text-text-primary",children:[c("elicitation.title")," ",e.jsx("span",{className:"font-mono text-xs text-text-muted",children:z(r)})]})]}),t&&e.jsx("div",{className:"text-sm text-text-secondary",children:z(t)})]})}function Kr(r){const t=r==null?void 0:r.properties;return!t||typeof t!="object"?[]:Object.entries(t).filter(([,s])=>s&&typeof s=="object").map(([s,n])=>({name:s,prop:n}))}function Lr(r){const t=r==null?void 0:r.required;return Array.isArray(t)?t.filter(s=>typeof s=="string"):[]}function Br(r){const[t,s]=l.useState([]),[n,a]=l.useState(!0),[d,i]=l.useState(null),u=l.useCallback(async()=>{a(!0),i(null);try{const g=await fn(r);s(g)}catch(g){i(g instanceof Error?g.message:"Failed to load shares")}finally{a(!1)}},[r]);l.useEffect(()=>{u()},[u]);const f=l.useCallback(async g=>{i(null);try{const y=await pn(r,g);return await u(),y}catch(y){throw i(y instanceof Error?y.message:"Failed to create share"),y}},[r,u]),p=l.useCallback(async g=>{i(null);try{await hn(r,g),await u()}catch(y){throw i(y instanceof Error?y.message:"Failed to revoke share"),y}},[r,u]);return{shares:t,isLoading:n,error:d,createShare:f,revokeShare:p,refresh:u}}function Hr({open:r,onClose:t,sessionId:s,sessionTitle:n}){X();const{shares:a,isLoading:d,error:i,createShare:u,revokeShare:f}=Br(s),[p,g]=l.useState("user"),[y,v]=l.useState(""),[E,C]=l.useState(""),[b,m]=l.useState("read"),[h,w]=l.useState(""),[T,k]=l.useState(!1),[j,N]=l.useState(null),[M,$]=l.useState(""),[K,S]=l.useState(!1),[P,V]=l.useState(!1);l.useEffect(()=>{r&&(g("user"),v(""),C(""),m("read"),w(""),k(!1),N(null),$(""),S(!1),V(!1))},[r]);const Ce=async()=>{k(!0),$(""),N(null);try{const D={grantedTo:p==="user"?{userId:y.trim()}:{teamId:E.trim()},permission:b};h.trim()&&(D.expiresAt=h.trim());const fe=await u(D);N(`${window.location.origin}/code/s/${fe.shareToken}`)}catch(D){$(D instanceof Error?D.message:"Failed to create share")}finally{k(!1)}},Te=async D=>{try{await f(D)}catch{}},J=async()=>{if(!j)return;V(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(j),S(!0),setTimeout(()=>S(!1),2e3);return}}catch{}const D=document.createElement("textarea");D.value=j,D.style.position="fixed",D.style.opacity="0",document.body.appendChild(D),D.select();try{document.execCommand("copy"),S(!0),setTimeout(()=>S(!1),2e3)}catch{V(!0)}document.body.removeChild(D)};return e.jsx(de,{open:r,onOpenChange:D=>{D||t()},children:e.jsxs(ue,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(me,{children:e.jsxs(xe,{className:"font-display text-lg font-semibold text-text-primary",children:[c("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:c("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 ${p==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:c("share.user")}),e.jsx("button",{onClick:()=>g("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${p==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:c("share.team")})]}),p==="user"?e.jsx(Pn,{onSelect:v,placeholder:c("share.userIdPlaceholder"),actionLabel:c("share.selectUser")}):e.jsx("input",{type:"text",value:E,onChange:D=>C(D.target.value),placeholder:c("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"}),p==="user"&&y&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[c("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:y})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:c("share.permission")}),e.jsxs("select",{value:b,onChange:D=>m(D.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:c("share.permissionRead")}),e.jsx("option",{value:"write",children:c("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:c("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:h,onChange:D=>w(D.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"})]}),(M||i)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:M||i}),j&&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:c("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:j}),e.jsx("button",{onClick:J,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:K?c("share.copied"):c("share.copy")})]}),P&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:c("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:c("share.existingShares")}),d?e.jsx("p",{className:"text-sm text-text-muted",children:c("share.loading")}):a.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:c("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:a.map(D=>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:D.granted_to_user||D.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[D.permission==="write"?c("share.permissionWrite"):c("share.permissionRead"),D.expires_at?` · expires ${D.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>Te(D.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:c("share.revoke")})]},D.id))})]})]}),e.jsxs($n,{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:c("common.close")}),e.jsx("button",{onClick:Ce,disabled:T||(p==="user"?!y.trim():!E.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:T?c("common.creating"):c("share.createShare")})]})]})})}function Wr(r){const t=new Date,s=new Date(t.getTime()-1440*60*1e3),n=(i,u)=>i.getFullYear()===u.getFullYear()&&i.getMonth()===u.getMonth()&&i.getDate()===u.getDate(),a={today:[],yesterday:[],earlier:[]};for(const i of r){const u=new Date(i.modified||0);n(u,t)?a.today.push(i):n(u,s)?a.yesterday.push(i):a.earlier.push(i)}return[["today",c("resume.today")],["yesterday",c("resume.yesterday")],["earlier",c("resume.earlier")]].map(([i,u])=>({label:u,items:a[i]})).filter(i=>i.items.length>0)}function Qr(r){return r?new Date(r).toLocaleString():""}function zr({open:r,onClose:t,adapter:s,onResume:n}){const a=X(),[d,i]=l.useState([]),[u,f]=l.useState(!1),[p,g]=l.useState("");l.useEffect(()=>{if(!r)return;let v=!1;return f(!0),g(""),i([]),s.listResumableSessions().then(E=>{v||i(E)}).catch(E=>{v||g(E instanceof Error?E.message:String(E))}).finally(()=>{v||f(!1)}),()=>{v=!0}},[r,s]);const y=l.useMemo(()=>Wr(d),[d,a]);return e.jsx(de,{open:r,onOpenChange:v=>{v||t()},children:e.jsxs(ue,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(me,{children:e.jsx(xe,{className:"font-display text-lg font-semibold text-text-primary",children:c("session.resume.title")})}),e.jsxs("div",{className:"max-h-96 min-w-0 space-y-4 overflow-y-auto",children:[u&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:c("resume.loading")}),!u&&p&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:p}),!u&&!p&&d.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:c("resume.empty")}),!u&&!p&&y.map(v=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-text-muted",children:v.label}),e.jsx("div",{className:"space-y-1",children:v.items.map(E=>e.jsxs("button",{type:"button",onClick:()=>n(E),className:"w-full rounded-md px-3 py-2 text-left transition-colors hover:bg-surface-3",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:E.title}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[Qr(E.modified),E.gitBranch?` · ${E.gitBranch}`:""]})]},E.sessionId))})]},v.label))]}),e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx("button",{type:"button",onClick:t,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary transition-colors hover:bg-surface-2",children:c("common.cancel")})})]})})}class Vr{constructor(t,s,n,a){A(this,"pending",null);this.current=t,this.apply=s,this.send=n,this.onError=a}set(t){if(t===this.current)return;const s=this.current;this.current=t,this.pending={requestId:null,previous:s},this.apply(t);try{Promise.resolve(this.send(t)).then(n=>{this.pending&&(this.pending.requestId=n)}).catch(n=>{this.rollback(s,es(n),"send")})}catch(n){this.rollback(s,es(n),"send")}}handleControlResponse(t){const s=this.pending;if(!s||s.requestId!==t.requestId)return!1;const{previous:n}=s;return this.pending=null,t.subtype==="error"&&this.rollback(n,t.error??"","response"),!0}sync(t){t!==this.current&&(this.current=t,this.apply(t),this.pending=null)}adoptExternal(t){this.pending||t!==this.current&&(this.current=t)}getCurrent(){return this.current}rollback(t,s,n){var a;this.pending=null,this.current=t,this.apply(t),s&&((a=this.onError)==null||a.call(this,s,n))}}function es(r){return r instanceof Error?r.message:String(r)}function ot(r){const t=l.useRef(r);t.current=r;const s=l.useRef(null);s.current||(s.current=new Vr(r.value,a=>t.current.apply(a),a=>t.current.send(a),(a,d)=>{var i,u;return(u=(i=t.current).onError)==null?void 0:u.call(i,a,d)}));const n=s.current;return l.useEffect(()=>{n.adoptExternal(r.value)}),l.useMemo(()=>({set:a=>n.set(a),handleControlResponse:a=>n.handleControlResponse(a),sync:a=>n.sync(a)}),[n])}const gs="rcs_context_usage_";function ys(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function ts(){return{totalTokens:0,rawMaxTokens:0,percentage:0}}function Gr(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const t=r,{totalTokens:s,rawMaxTokens:n,percentage:a}=t;if(typeof s!="number"||typeof n!="number"||typeof a!="number")return null;const d=t.categories,i=Array.isArray(d)?d.filter(u=>!!u&&typeof u=="object"&&typeof u.name=="string").map(u=>({name:u.name,tokens:typeof u.tokens=="number"?u.tokens:0,...u.isDeferred===!0?{isDeferred:!0}:{}})):void 0;return{totalTokens:s,rawMaxTokens:n,percentage:a,...typeof t.model=="string"&&t.model?{model:t.model}:{},...i&&i.length>0?{categories:i}:{}}}function Yr(r,t=ys()){if(!t||!r)return null;try{const s=t.getItem(gs+r);return s?Gr(JSON.parse(s)):null}catch{return null}}function Jr(r,t,s=ys()){if(!(!s||!r))try{s.setItem(gs+r,JSON.stringify(t))}catch{}}function Xr(r){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${r}`}function Zr(r){const t=Xr(r),s=yn(),n=s?{proxyUrl:t,token:s}:{proxyUrl:t};return new gn(n)}const le=[{value:"default",labelKey:"session.mode.default",descKey:"session.mode.defaultDesc"},{value:"acceptEdits",labelKey:"session.mode.acceptEdits",descKey:"session.mode.acceptEditsDesc"},{value:"plan",labelKey:"session.mode.plan",descKey:"session.mode.planDesc"},{value:"bypassPermissions",labelKey:"session.mode.bypass",descKey:"session.mode.bypassDesc"}],ss="rcs_permission_mode";function ce(r){return r<1e3?String(r):r<1e6?`${(r/1e3).toFixed(1)}k`:`${(r/1e6).toFixed(1)}M`}function ea(r){const t=le.findIndex(s=>s.value===r);return le[(t+1+le.length)%le.length].value}const ct=[{value:"off",labelKey:"session.thinking.off",descKey:"session.thinking.offDesc",label:void 0,description:void 0,tokens:0},{value:"on",labelKey:"session.thinking.on",descKey:"session.thinking.onDesc",label:void 0,description:void 0,tokens:null},{value:"8192",labelKey:void 0,descKey:void 0,label:"8k",description:"8192 tokens",tokens:8192},{value:"16384",labelKey:void 0,descKey:void 0,label:"16k",description:"16384 tokens",tokens:16384},{value:"32768",labelKey:void 0,descKey:void 0,label:"32k",description:"32768 tokens",tokens:32768}],ns="rcs_thinking_budget",dt=[{value:"auto",effort:void 0,labelKey:"session.effort.auto",descKey:"session.effort.autoDesc",label:void 0},{value:"low",effort:"low",labelKey:void 0,descKey:"session.effort.lowDesc",label:"low"},{value:"medium",effort:"medium",labelKey:void 0,descKey:"session.effort.mediumDesc",label:"medium"},{value:"high",effort:"high",labelKey:void 0,descKey:"session.effort.highDesc",label:"high"},{value:"xhigh",effort:"xhigh",labelKey:void 0,descKey:"session.effort.xhighDesc",label:"xhigh"},{value:"max",effort:"max",labelKey:void 0,descKey:"session.effort.maxDesc",label:"max"}],rs=r=>r.labelKey?c(r.labelKey):r.label,as=r=>r.labelKey?c(r.labelKey):r.label,os="rcs_effort";function ta(r){return r!=null&&r.capabilities?r.capabilities:r?{file_search:!0,clear:!0,set_max_thinking_tokens:!0,get_context_usage:!0,stop_task:!0,set_model:!0,set_permission_mode:!0,interrupt:!0,end_session:!0,mcp_management:!0,remote_settings:!0,rewind:!0,resume:!0,set_effort:!0,side_question:!0}:{file_search:!1,clear:!0,set_max_thinking_tokens:!0,get_context_usage:!1,stop_task:!1,set_model:!0,set_permission_mode:!0,interrupt:!0,end_session:!1,mcp_management:!1,remote_settings:!1,rewind:!1,resume:!1,set_effort:!1,side_question:!1}}function sa({budget:r,onBudgetChange:t,disabled:s}){const[n,a]=l.useState(!1),d=ct.find(i=>i.value===r);return e.jsxs(Fe,{open:n,onOpenChange:a,children:[e.jsx(Ke,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:s,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:c("session.thinking.title"),children:[e.jsx(An,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?as(d):c("session.thinking.fallback")}),n?e.jsx(Le,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(He,{className:"w-64 p-1",align:"start",children:ct.map(i=>e.jsxs("button",{type:"button",onClick:()=>{t(i.value,i.tokens),a(!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:r===i.value&&e.jsx(Se,{className:"h-3.5 w-3.5 text-brand-text"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:as(i)}),e.jsx("div",{className:"text-xs text-text-muted",children:i.descKey?c(i.descKey):i.description})]})]},i.value))})]})}function na({effort:r,onEffortChange:t,disabled:s}){const[n,a]=l.useState(!1),d=dt.find(i=>i.value===r);return e.jsxs(Fe,{open:n,onOpenChange:a,children:[e.jsx(Ke,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:s,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:c("session.effort.title"),children:[e.jsx(zn,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?rs(d):c("session.effort.fallback")}),n?e.jsx(Le,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(He,{className:"w-64 p-1",align:"start",children:dt.map(i=>e.jsxs("button",{type:"button",onClick:()=>{t(i.value),a(!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:r===i.value&&e.jsx(Se,{className:"h-3.5 w-3.5 text-brand-text"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:rs(i)}),e.jsx("div",{className:"text-xs text-text-muted",children:c(i.descKey)})]})]},i.value))})]})}const ra=new Set(["Free space","Autocompact buffer","Compact buffer"]),is=["bg-brand","bg-status-active","bg-status-success","bg-violet-500","bg-amber-500","bg-pink-500","bg-teal-500"];function aa({usage:r}){const t=Math.min(100,Math.max(0,r.percentage)),s=t>=80,n=(r.categories??[]).filter(u=>!u.isDeferred&&!ra.has(u.name)),a=(r.categories??[]).filter(u=>u.isDeferred),d=n.reduce((u,f)=>u+f.tokens,0),i=[`${U("session.context.tooltip",{used:ce(r.totalTokens),max:ce(r.rawMaxTokens)})}${r.model?` · ${r.model}`:""}`,...n.slice(0,8).map(u=>`${u.name}: ${ce(u.tokens)}`),...a.slice(0,3).map(u=>`${u.name}${c("session.context.deferredSuffix")}: ${ce(u.tokens)}`)];return e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-text-muted font-mono",title:i.join(`
|
|
77
|
+
`),children:[e.jsx("span",{className:"relative flex h-1.5 w-16 overflow-hidden rounded-full bg-surface-3",children:n.length>0?n.map((u,f)=>e.jsx("span",{className:s&&f===0?"bg-status-warning":is[f%is.length],style:{width:`${Math.min(100,Math.max(0,d>0?u.tokens/d*t:0))}%`}},u.name)):e.jsx("span",{className:`absolute inset-y-0 left-0 rounded-full transition-all ${s?"bg-status-warning":"bg-brand/70"}`,style:{width:`${t}%`}})}),e.jsxs("span",{children:[t,"%"]})]})}function oa({models:r,currentModelId:t,onSelect:s,disabled:n}){const[a,d]=l.useState(!1),i=r.find(p=>p.modelId===t)??null,u=r.length>0,f=async p=>{s(p.modelId),d(!1)};return e.jsxs(Fe,{open:a,onOpenChange:u?d:void 0,children:[e.jsx(Ke,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:n||!u,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:c("session.model.title"),children:[e.jsx(us,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-32 truncate",children:(i==null?void 0:i.name)??t??c("session.model.title")}),a?e.jsx(Le,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(He,{className:"w-72 p-0",align:"start",children:e.jsx(Rn,{models:r,currentModelId:t,onSelect:f,showSearch:r.length>5})})]})}function ia({mode:r,onModeChange:t,disabled:s}){const[n,a]=l.useState(!1),d=le.find(i=>i.value===r);return e.jsxs(Fe,{open:n,onOpenChange:a,children:[e.jsx(Ke,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:s,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:c("session.mode.title"),children:[e.jsx(Mn,{className:"h-3 w-3"}),e.jsx("span",{className:"max-w-24 truncate",children:d?c(d.labelKey):r}),n?e.jsx(Le,{className:"h-3 w-3"}):e.jsx(Be,{className:"h-3 w-3"})]})}),e.jsx(He,{className:"w-64 p-1",align:"start",children:le.map(i=>e.jsxs("button",{type:"button",onClick:()=>{t(i.value),a(!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:r===i.value&&e.jsx(Se,{className:"h-3.5 w-3.5 text-brand-text"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-text-primary",children:c(i.labelKey)}),e.jsx("div",{className:"text-xs text-text-muted",children:c(i.descKey)})]})]},i.value))})]})}function va({sessionId:r,onBack:t}){var Rt;X();const[s,n]=l.useState(null),[a,d]=l.useState(null),[i,u]=l.useState(""),[f,p]=l.useState(!1),[g,y]=l.useState(!1),[v,E]=l.useState(!1),[C,b]=l.useState(!1),[m,h]=l.useState(!1),[w,T]=l.useState(!1),[k,j]=l.useState(""),[N,M]=l.useState(0),$=l.useRef(null),[K,S]=l.useState({text:"",nonce:0}),[P,V]=l.useState(!1),[Ce,Te]=l.useState(!1),[J,D]=l.useState(!1),[fe,ut]=l.useState(0),[bs,js]=l.useState(0),[pe,Z]=l.useState([]),[Y,he]=l.useState(!1),[ge,re]=l.useState([]),[W,We]=l.useState(null),[mt,ws]=l.useState(()=>lt()),[Q,ks]=l.useState(null),[xt,vs]=l.useState(()=>localStorage.getItem(ns)||"off"),[Ns,ft]=l.useState(()=>Yr(r)),[Qe,ze]=l.useState(!0),[ye,_s]=l.useState(null),[Ee,pt]=l.useState(null),[Me,Re]=l.useState([]),[Ss,Ve]=l.useState(!1),[Ge,ht]=l.useState(""),Ye=l.useRef(null),[Ae,Cs]=l.useState(()=>localStorage.getItem(ss)||"default"),[gt,yt]=l.useState(null),be=l.useRef(null),[bt,jt]=l.useState(null),je=l.useRef(null),ae=l.useRef(null),wt=l.useRef(pe);wt.current=pe;const Ie=l.useRef(null);Ie.current||(Ie.current=new Ln(Bn()));const kt=l.useRef(r);kt.current=(s==null?void 0:s.title)||r,l.useEffect(()=>{var o;(o=Ie.current)==null||o.reset()},[r]);const se=l.useCallback(o=>{yt(o),be.current&&clearTimeout(be.current),be.current=setTimeout(()=>yt(null),5e3)},[]),ee=l.useCallback(o=>{jt(o),je.current&&clearTimeout(je.current),je.current=setTimeout(()=>jt(null),5e3)},[]),$e=ot({value:Ae,apply:o=>{Cs(o);try{localStorage.setItem(ss,o)}catch{}},send:o=>{const x=ae.current;return x?x.setPermissionMode(o):Promise.reject(new Error("adapter not ready"))},onError:(o,x)=>{console.error("[SessionDetail] set permission mode failed:",o),se(x==="send"?U("session.mode.switchFailedRequest",{message:o}):o||c("session.mode.switchFailed"))}}),Je=l.useCallback(o=>$e.set(o),[$e]),Xe=ot({value:xt,apply:o=>{vs(o);try{localStorage.setItem(ns,o)}catch{}},send:o=>{var R;const x=ae.current;if(!x)return Promise.reject(new Error("adapter not ready"));const _=((R=ct.find(I=>I.value===o))==null?void 0:R.tokens)??null;return x.setThinkingBudget(_)},onError:(o,x)=>{console.error("[SessionDetail] set thinking budget failed:",o),se(x==="send"?U("session.thinking.failedRequest",{message:o}):o||c("session.thinking.failed"))}}),q=l.useMemo(()=>new gr(r,Z,{onStatusChange:o=>{var x;d(o),he(o==="running"||o==="requires_action"),(x=Ie.current)==null||x.onStatus(o,kt.current)},onError:o=>{console.error("[RCSChatAdapter] error:",o)},onPermissionRequest:o=>{re(x=>x.some(_=>_.requestId===o.requestId)?x:[...x,o])},onModelsStateChange:o=>{We(o)},onSubagentUpdate:o=>{ws(o)},onControlResponse:o=>{Xe.handleControlResponse(o)||$e.handleControlResponse(o)},onPermissionModeChange:o=>{$e.sync(o)},onUsageChange:o=>{_s(x=>({inputTokens:Math.max((x==null?void 0:x.inputTokens)??0,o.inputTokens),outputTokens:Math.max((x==null?void 0:x.outputTokens)??0,o.outputTokens),totalCostUsd:o.totalCostUsd??(x==null?void 0:x.totalCostUsd)??null}))},onWorkerInfoChange:o=>{ks(x=>JSON.stringify(x)===JSON.stringify(o)?x:o)},onElicitationRequest:o=>{pt(o)}}),[r,se]);l.useEffect(()=>(ae.current=q,()=>{q.disconnect()}),[q]);const F=l.useMemo(()=>ta(Q),[Q]),vt=F.stop_task?o=>{q.stopSubagent(o).then(x=>{x.ok||ee(x.error||c("session.stopTask.failed"))})}:void 0,Ts=X(),Ze=l.useMemo(()=>bn((Q==null?void 0:Q.commands)??[],(Q==null?void 0:Q.skills)??[]),[Q,Ts]),we=l.useMemo(()=>jn(pe,k),[pe,k]),Es=l.useCallback(o=>Xe.set(o),[Xe]),[Nt,Ms]=l.useState(()=>localStorage.getItem(os)||"auto"),Rs=ot({value:Nt,apply:o=>{Ms(o);try{localStorage.setItem(os,o)}catch{}},send:o=>{var R;const x=ae.current;if(!x)return Promise.reject(new Error("adapter not ready"));const _=(R=dt.find(I=>I.value===o))==null?void 0:R.effort;return x.setEffort(_)},onError:(o,x)=>{console.error("[SessionDetail] set effort failed:",o),se(x==="send"?U("session.effort.failedRequest",{message:o}):o||c("session.effort.failed"))}}),et=l.useCallback(()=>{var o;F.get_context_usage&&((o=ae.current)==null||o.getContextUsage().then(x=>{x&&(ft(x),Jr(r,x))}).catch(()=>{}).finally(()=>ze(!1)))},[F,r]);l.useEffect(()=>{if(!F.get_context_usage)return;Y||et();const o=setInterval(et,6e4);return()=>clearInterval(o)},[F,Y,et]),l.useEffect(()=>{Q&&!F.get_context_usage&&ze(!1)},[Q,F]),l.useEffect(()=>{if(!Qe)return;const o=setTimeout(()=>ze(!1),1e4);return()=>clearTimeout(o)},[Qe]);const _t=l.useRef(J);_t.current=J,l.useEffect(()=>ie.onEvent(x=>{x.type!=="artifact_created"&&x.type!=="artifact_updated"||(_t.current&&js(_=>_+1),ut(_=>_+1))}),[]);const[ke,As]=l.useState("idle");l.useEffect(()=>ie.onStateChange(x=>As(x)),[]),l.useEffect(()=>{J&&ut(0)},[J]),l.useEffect(()=>{let o=!1;async function x(){u("");try{const _=await Ot(r);if(o)return;n(_),d(_.status),Oe(_.status)&&q.markClosed(),he(_.status==="running"||_.status==="requires_action")}catch(_){if(o)return;u(_ instanceof Error?_.message:c("session.loadFailed"));return}try{await q.init()}catch(_){console.warn("Failed to init adapter:",_)}}return x(),()=>{o=!0}},[r,q]);const O=Oe(a),St=l.useRef(a);St.current=a,l.useEffect(()=>{if(O)return;let o=!1;const _=setInterval(async()=>{try{const R=await Ot(r);if(o||R.status===St.current)return;Oe(R.status)&&q.markClosed(),d(R.status),he(R.status==="running"||R.status==="requires_action")}catch{}},6e4);return()=>{o=!0,clearInterval(_)}},[r,O,q]);const L=(s==null?void 0:s.access_level)==="read",Ct=Ns??(Qe&&!O&&!L?ts():null),tt=l.useCallback(()=>{Z([]),ft(ts()),qt(r).catch(o=>{console.warn("[SessionDetail] Failed to clear session history:",o)})},[r]),ve=l.useCallback(async(o,x)=>{const _=ae.current;if(!_||O)return;if(o.sessionId===r){Z(I=>[...I,{type:"command_output",id:`cmd-resume-${Date.now()}`,commandName:"resume",inputText:x??"/resume",title:"Resume",subtitle:c("session.resume.title"),outputText:c("session.resume.currentBlocked"),variant:"error"}]);return}const R=(I,B="default")=>Z(ne=>[...ne,{type:"command_output",id:`cmd-resume-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,commandName:"resume",inputText:x??`/resume ${o.sessionId.slice(0,8)}`,title:"Resume",subtitle:c("session.resume.title"),outputText:I,variant:B}]);R(U("session.resume.restoring",{title:o.title??""}));try{await qt(r),Z([]);const I=await _.resumeSession(o.sessionId);R(I.title?U("session.resume.restoredWithTitle",{count:I.messageCount,title:I.title}):U("session.resume.restored",{count:I.messageCount}))}catch(I){R(U("session.resume.failed",{message:I instanceof Error?I.message:String(I)}),"error")}},[O,r]),Is=l.useCallback(async()=>{if(s!=null&&s.environment_id)try{const o=await wn({environment_id:s.environment_id});window.location.href=`/code/${o.id}?resumeFrom=${r}`}catch(o){ee(U("session.createFailedWithReason",{message:o instanceof Error?o.message:String(o)}))}},[s,r,ee]),$s=l.useRef(new URLSearchParams(window.location.search).get("resumeFrom")),Tt=l.useRef(!1);l.useEffect(()=>{const o=$s.current;!o||Tt.current||!Q||!F.resume||(Tt.current=!0,window.history.replaceState({},"",window.location.pathname),ve({sessionId:o,title:o.slice(0,8),modified:0},null))},[Q,F.resume,ve]);const De=l.useCallback(async o=>{const x=o.text.trim(),_=o.images&&o.images.length>0||o.attachments&&o.attachments.length>0;if(!x&&!_||O)return;const R=/^\/resume(?:\s+(.*))?$/.exec(x);if(R){const B=(R[1]??"").trim();if(!F.resume){Z(ne=>[...ne,{type:"user_message",id:`user-${Date.now()}`,content:x},{type:"command_output",id:`cmd-${Date.now()}`,commandName:"resume",inputText:x,title:"Resume",subtitle:c("session.resume.title"),outputText:c("session.resume.unsupported"),variant:"error"}]);return}B?await ve({sessionId:B,title:B,modified:0},x):h(!0);return}const I=await kn(x,{sessionId:r,availableCommands:Ze,availableModels:(W==null?void 0:W.availableModels)??[],currentModel:W?{modelId:W.currentModelId,name:W.currentModelId}:null,supportsImages:!0,entries:wt.current,setModel:async B=>{await G(r,{type:"control_request",request:{subtype:"set_model",model:B}}),We(ne=>ne&&{...ne,currentModelId:B})},onNewSession:()=>{Z([])}}).catch(()=>null);if(I){if(Ue("[SessionDetail] local command result",I),"clearEntries"in I&&I.clearEntries){tt();return}if("newSession"in I&&I.newSession){tt();return}if("userEntry"in I){Z(B=>[...B,I.userEntry,I.cmdEntry]);return}}he(!0);try{await q.sendMessage(x,o.images,o.attachments)}catch(B){if(console.error("Send failed:",B),B instanceof vn&&B.type==="session_closed"){d("archived"),q.markClosed(),ee(c("session.closedSendBlocked"));return}ee(`${c("session.sendFailed")}${B instanceof Error?`: ${B.message}`:""}`)}},[q,O,r,W,Ze,tt,ee,ve,F]),Ds=l.useCallback(o=>{if(Y){Re(x=>[...x,o]);return}De(o)},[Y,De]),st=l.useRef(!1);l.useEffect(()=>{if(O){Re(x=>x.length>0?[]:x);return}if(Y||Me.length===0||st.current)return;const o=Me[0];o&&(st.current=!0,Re(x=>x.slice(1)),De(o).finally(()=>{st.current=!1}))},[Y,Me,De,O]);const qs=l.useCallback((o,x)=>{if(Y)return;const _=x==="edit"?c("session.rewind.confirmEdit"):c("session.rewind.confirm");window.confirm(`${_}
|
|
78
|
+
${c("session.rewind.confirmBody")}`)&&q.rewindToMessage(o.id).then(()=>{x==="edit"&&o.content&&S(R=>({text:o.content,nonce:R.nonce+1}))}).catch(R=>{console.error("[SessionDetail] rewind failed:",R),ee(U("session.rewind.failed",{message:R instanceof Error?R.message:String(R)}))})},[Y,ee]),Ps=l.useCallback(o=>{const x=we.orderedMatchIds;if(x.length===0)return;const _=(o%x.length+x.length)%x.length;M(_);const R=x[_],I=document.querySelector(`[data-entry-id="${CSS.escape(R)}"]`);I==null||I.scrollIntoView({block:"center",behavior:"smooth"})},[we]),Et=l.useCallback(async()=>{try{await q.interrupt()}catch(o){console.error("Interrupt failed:",o)}finally{he(!1)}},[q]),Os=l.useCallback(()=>{Je(ea(Ae))},[Je,Ae]);l.useEffect(()=>()=>{be.current&&clearTimeout(be.current),je.current&&clearTimeout(je.current)},[]);const Us=l.useCallback(async()=>{if(s&&window.confirm(c("dashboard.confirmDelete").replace("{id}",s.title||s.id)))try{await Pt(s.id),window.location.href="/code/"}catch(o){alert(o instanceof Error?o.message:c("dashboard.deleteFailed"))}},[s]),Fs=l.useCallback(async o=>{try{await q.respondPermission(o,!0)}catch(x){console.error("Failed to approve:",x)}re(x=>x.filter(_=>_.requestId!==o))},[q]),Ks=l.useCallback(async(o,x)=>{try{await q.respondPermission(o,!0,{updated_permissions:x})}catch(_){console.error("Failed to approve with rules:",_)}re(_=>_.filter(R=>R.requestId!==o))},[q]),Ls=l.useCallback(async(o,x)=>{const _=Ee;if(pt(null),!!_)try{await q.respondElicitation(_.requestId,o,x)}catch(R){console.error("Failed to submit elicitation:",R)}},[Ee,q]),Bs=l.useCallback(()=>{!s||L||(ht(s.title||""),Ve(!0),setTimeout(()=>{var o,x;(o=Ye.current)==null||o.focus(),(x=Ye.current)==null||x.select()},0))},[s,L]),Mt=l.useCallback(async()=>{const o=Ge.trim();if(Ve(!1),!(!s||!o||o===s.title))try{const x=await Nn(s.id,o);n(_=>_&&{..._,title:x.title??o})}catch(x){console.error("Rename failed:",x),alert(x instanceof Error?x.message:c("session.rename.failed"))}},[s,Ge]),Hs=l.useCallback(async o=>{try{await q.respondPermission(o,!1)}catch(x){console.error("Failed to reject:",x)}re(x=>x.filter(_=>_.requestId!==o))},[q]),Ws=l.useCallback(async(o,x,_)=>{try{await G(r,{type:"permission_response",approved:!0,request_id:o,updated_input:{questions:_,answers:x}})}catch(R){console.error("Failed to submit answers:",R)}re(R=>R.filter(I=>I.requestId!==o))},[r]),Qs=l.useCallback(async(o,x,_)=>{try{x==="no"?await G(r,{type:"permission_response",approved:!1,request_id:o,..._?{message:_}:{}}):await G(r,{type:"permission_response",approved:!0,request_id:o,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[x]||"default",destination:"session"}]})}catch(R){console.error("Failed to submit plan response:",R)}re(R=>R.filter(I=>I.requestId!==o))},[r]);return i?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(Pe,{onBack:t,title:e.jsx("span",{className:"text-xs font-medium text-text-muted",children:c("session.loadFailed")})}),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:i}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:c("session.backToDashboard")})]})})]}):s?s.source==="acp"&&s.environment_id?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:s.title||s.id}),e.jsx(Pe,{onBack:t,title:e.jsx("span",{className:"truncate text-xs font-semibold text-text-primary",children:s.title||s.id}),meta:e.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand-text",children:"ACP"})}),e.jsx(ca,{sessionId:r,agentId:s.environment_id})]}):e.jsx(cs,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:s.title||s.id}),e.jsx(Pe,{onBack:t,title:Ss?e.jsx("input",{ref:Ye,value:Ge,onChange:o=>ht(o.target.value),onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),Mt()):o.key==="Escape"&&(o.preventDefault(),Ve(!1))},onBlur:()=>void Mt(),maxLength:200,className:"w-full max-w-xs rounded-md border border-brand/50 bg-surface-2 px-2 py-0.5 text-xs font-semibold text-text-primary focus:outline-none focus:ring-2 focus:ring-brand/30"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex min-w-0 items-center gap-2 text-xs font-semibold text-text-primary",children:!L&&!O?e.jsx("button",{type:"button",onClick:Bs,title:c("session.rename.title"),className:"truncate text-left transition-colors hover:text-text-secondary",children:s.title||s.id}):e.jsx("span",{className:"truncate",children:s.title||s.id})}),s.visibility&&e.jsx(Kn,{visibility:s.visibility||"private",className:"hidden flex-shrink-0 text-[10px] sm:inline-flex"})]}),meta:e.jsx(e.Fragment,{children:(()=>{var _;const o=s.source==="acp"?"acp":(_=s.environment)==null?void 0:_.worker_type,x=Ut(o);return e.jsx("span",{className:`hidden items-center rounded-full px-2 py-0.5 text-[10px] font-medium sm:inline-flex ${x.colorClass}`,children:x.fullLabel})})()}),actions:e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsxs("button",{onClick:()=>D(!J),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${J?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("artifacts.title"),children:[e.jsx(_n,{className:"h-3.5 w-3.5"}),fe>0&&!J&&e.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-brand px-0.5 text-[10px] font-bold text-white",children:fe>9?"9+":fe})]}),F.side_question&&!O&&!L&&e.jsx("button",{onClick:()=>b(!C),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${C?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.sideQuestion.title"),children:e.jsx(ms,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>{const o=!w;T(o),o?setTimeout(()=>{var x;return(x=$.current)==null?void 0:x.focus()},0):(j(""),M(0))},className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors ${w?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.search.title"),children:e.jsx(it,{className:"h-3.5 w-3.5"})}),F.mcp_management&&!O&&!L&&e.jsx("button",{onClick:()=>y(!g),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${g?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.mcp.title"),children:e.jsx(xs,{className:"h-3.5 w-3.5"})}),F.remote_settings&&!O&&!L&&e.jsx("button",{onClick:()=>E(!v),className:`hidden h-7 w-7 items-center justify-center rounded-md transition-colors sm:flex ${v?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:c("session.settings.title"),children:e.jsx(fs,{className:"h-3.5 w-3.5"})}),!L&&(s==null?void 0:s.access_level)!=="write"&&e.jsx("button",{onClick:()=>Te(!0),className:"flex h-7 w-7 items-center justify-center rounded-md text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:c("session.share"),children:e.jsx(dr,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>V(!P),className:"hidden h-7 w-7 items-center justify-center rounded-md text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors sm:flex",title:c("session.info"),children:e.jsx(Jn,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>p(!f),className:"ml-0.5 flex items-center gap-1 rounded-md px-2 py-1 text-xs font-semibold text-text-primary hover:bg-brand-light hover:text-white transition-colors",children:[c("session.tasks"),ge.length>0&&e.jsx("span",{className:"rounded-full bg-status-warning/15 px-1.5 py-0.5 text-[10px] font-medium text-status-warning",children:ge.length})]})]})})}),P&&e.jsx("div",{className:"flex-shrink-0 border-b bg-surface-1 py-2",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8",children:e.jsxs("div",{className:"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:c("session.metaSession")})," ",s.id]}),s.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaEnvironment")})," ",s.environment_id]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaStatus")})," ",a]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaWorker")})," ",Ut(s.source==="acp"?"acp":(Rt=s.environment)==null?void 0:Rt.worker_type).fullLabel]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:c("session.metaCreated")})," ",ls(s.created_at)]})]})})}),(ke==="reconnecting"||ke==="failed")&&e.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium ${ke==="failed"?"bg-status-error/10 text-status-error":"bg-status-warning/10 text-status-warning"}`,children:[e.jsx("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${ke==="failed"?"bg-status-error":"animate-pulse bg-status-warning"}`}),ke==="failed"?c("session.sseFailed"):c("session.sseReconnecting")]}),J&&e.jsx("div",{className:"border-b bg-surface-1 py-4",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8",children:e.jsx(Fn,{sessionId:r,embedded:!0,refreshTick:bs})})}),w&&e.jsx("div",{className:"border-b bg-surface-1 py-2",children:e.jsxs("div",{className:"mx-auto flex page-measure px-4 sm:px-8 items-center gap-2",children:[e.jsx(it,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{ref:$,value:k,onChange:o=>{j(o.target.value),M(0)},onKeyDown:o=>{o.key==="Enter"&&!o.nativeEvent.isComposing?(o.preventDefault(),Ps(k&&o.shiftKey?N-1:N+1)):o.key==="Escape"&&(o.preventDefault(),T(!1),j(""))},placeholder:c("session.search.placeholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"}),k.trim()&&e.jsx("span",{className:"flex-shrink-0 font-mono text-[10px] text-text-muted",children:we.orderedMatchIds.length===0?c("session.search.noResults"):`${N+1}/${we.orderedMatchIds.length}`})]})}),e.jsx(Sn,{entries:pe,isLoading:Y,emptyTitle:c("session.emptyTitle"),emptyDescription:c("session.emptyDescription"),searchMatchIds:k.trim()?we.matchIds:void 0,onRewindEntry:F.rewind&&!O&&!L&&!Y?(o,x)=>qs(o,x):void 0}),e.jsx(kr,{state:mt,onStopTask:vt}),ge.length>0&&e.jsx("div",{className:"border-t bg-surface-1 py-3",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8 space-y-3",children:ge.map(o=>e.jsx(la,{request:o,onApprove:()=>Fs(o.requestId),onApproveAlways:o.suggestions&&o.suggestions.length>0?()=>Ks(o.requestId,o.suggestions??[]):void 0,onReject:()=>Hs(o.requestId),onSubmitAnswers:Ws,onSubmitPlan:Qs},o.requestId))})}),Ee&&e.jsx("div",{className:"border-t bg-surface-1 py-3",children:e.jsx("div",{className:"mx-auto page-measure px-4 sm:px-8",children:e.jsx(Fr,{request:Ee,onSubmit:Ls})})}),bt&&e.jsx("div",{className:"mx-auto page-measure 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:bt})}),gt&&e.jsx("div",{className:"mx-auto page-measure 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:gt})}),e.jsxs("div",{className:"page-measure 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(ia,{mode:Ae,onModeChange:Je,disabled:O||L}),e.jsx(oa,{models:(W==null?void 0:W.availableModels)??[],currentModelId:(W==null?void 0:W.currentModelId)??null,onSelect:o=>{G(r,{type:"control_request",request:{subtype:"set_model",model:o}}),We(x=>x&&{...x,currentModelId:o})},disabled:O||L}),F.set_max_thinking_tokens&&e.jsx(sa,{budget:xt,onBudgetChange:Es,disabled:O||L}),F.set_effort&&e.jsx(na,{effort:Nt,onEffortChange:o=>Rs.set(o),disabled:O||L})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[Ct&&e.jsx(aa,{usage:Ct}),ye&&e.jsxs("span",{className:"text-[10px] text-text-muted font-mono",title:c("session.usage.total"),children:[ce(ye.inputTokens)," in / ",ce(ye.outputTokens)," out",ye.totalCostUsd!=null&&` · $${ye.totalCostUsd.toFixed(2)}`]})]})]}),O&&(s==null?void 0:s.environment_id)&&e.jsx("div",{className:"mx-auto w-full page-measure px-4 pb-2 sm:px-8",children:e.jsx("button",{type:"button",onClick:()=>void Is(),className:"w-full rounded-lg border border-border bg-surface-1 px-4 py-2.5 text-sm text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary",children:c("session.resumeInNew")})}),e.jsx(Cn,{onSubmit:Ds,isLoading:Y,onInterrupt:Et,onCycleMode:Os,disabled:O||L,placeholder:O?c("session.closed"):L?c("session.readOnly"):c("session.inputPlaceholder"),supportsAttachments:!0,commands:Ze,queueWhileLoading:!0,queuedCount:Me.length,onDequeue:o=>Re(x=>x.filter((_,R)=>R!==o)),onSearchFiles:F.file_search?o=>q.searchFiles(o):void 0,historyKey:r,draftOverride:K}),g&&e.jsx(Rr,{onClose:()=>y(!1),fetchServers:()=>q.getMcpServers(),onToggle:(o,x)=>q.toggleMcpServer(o,x),onReconnect:o=>q.reconnectMcpServer(o)}),v&&e.jsx(Ir,{onClose:()=>E(!1),fetchSettings:()=>q.getRemoteSettings(),onApply:o=>q.applyFlagSettings(o)}),C&&e.jsx($r,{onClose:()=>b(!1),onAsk:o=>q.askSideQuestion(o)}),f&&s&&e.jsx(_r,{onClose:()=>p(!1),session:s,liveStatus:a,pendingPermissions:ge,subagentState:mt,onStopTask:vt,onInterrupt:Et,onDelete:Us,onEndSession:F.end_session&&!O&&!L?async()=>{await q.endSession("ended from web"),await Pt(s.id),window.location.href="/code/"}:void 0}),e.jsx(Hr,{open:Ce,onClose:()=>Te(!1),sessionId:s.id,sessionTitle:s.title||void 0}),e.jsx(zr,{open:m,onClose:()=>h(!1),adapter:q,onResume:o=>{h(!1),ve(o,null)}})]})}):e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(Pe,{onBack:t,title:e.jsx("span",{className:"h-3.5 w-40 animate-pulse rounded bg-surface-2"})}),e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-text-muted",children:c("session.loading")})})]})}function la({request:r,onApprove:t,onApproveAlways:s,onReject:n,onSubmitAnswers:a,onSubmitPlan:d}){const i=r.toolName,u=r.toolInput,f=r.description||"";if(i==="AskUserQuestion"){const p=u.questions||[];return e.jsx(qr,{requestId:r.requestId,questions:p,description:f,onSubmit:g=>a(r.requestId,g,p),onSkip:n})}if(i==="ExitPlanMode"){const p=u.plan||"";return e.jsx(Or,{requestId:r.requestId,planContent:p,description:f,onSubmit:(g,y)=>d(r.requestId,g,y)})}return e.jsx(Dr,{requestId:r.requestId,toolName:i,toolInput:u,description:f,suggestions:r.suggestions,onApprove:t,onApproveAlways:s,onReject:n})}function ca({sessionId:r,agentId:t}){const[s,n]=l.useState(null),[a,d]=l.useState("disconnected"),[i,u]=l.useState(null),f=l.useRef(null);return l.useEffect(()=>{const p=Zr(t);return p.setConnectionStateHandler((g,y)=>{d(g),u(y||null)}),f.current=p,n(p),p.connect().catch(g=>{g instanceof Tn||(u(g.message),d("error"))}),()=>{p.disconnect(),f.current=null,n(null),d("disconnected")}},[t]),e.jsx(cs,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&a==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:i}),a==="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:c("session.connectingAgent")})]})}),a==="error"&&!s&&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:c("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:i})]})}),s&&a==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(En,{client:s,agentId:t})})]})})}export{va as SessionDetail};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{j as e}from"./vendor-DE_-CLIE.js";import{ap as c,V as n,an as i}from"./main-BC4mcO_f.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{j as e}from"./vendor-DE_-CLIE.js";import{al as c,U as n,aj as i}from"./ma
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const p=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],b=c("lock",p);function u({visibility:o,className:t}){const a={private:{label:"Private",Icon:b,colorClass:"text-text-muted border-border/60"},team:{label:"Team",Icon:n,colorClass:"text-accent border-accent/40"},public:{label:"Public",Icon:x,colorClass:"text-accent border-accent/40"}},{label:s,Icon:r,colorClass:l}=a[o];return e.jsxs("span",{className:i("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs",l,t),children:[e.jsx(r,{className:"h-3 w-3"}),s]})}export{u as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{aK as v,c as N,aD as t}from"./main-BC4mcO_f.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function E({onSuccess:p,onAlreadyDone:b}){const{setup:h}=v(),[d,f]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[u,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!==u){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await h(d,l,a),p()}catch(x){const n=x instanceof Error?x.message:"Setup failed";if(n.includes("already")||n.includes("409")){b();return}o(n)}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:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"mx-auto mb-5 h-10 w-10"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight 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:d,onChange:s=>f(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:u,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.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{E as Setup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{ae as m,b as h}from"./main-BC4mcO_f.js";import"./preload-helper-BiaRt2Oj.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-text hover:underline",children:"← Back to Dashboard"})]})})}export{j as ShareLanding};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{ap as q,W as T,aL as D,aD as t,e as B,X as F,aE as G,an as I,U as K,at as X,a6 as Y,al as J,ak as Q,aK as V,z as Z,m as ee,r as te,P as se,n as ae,p as ne,o as H,q as re,N as ie}from"./main-BC4mcO_f.js";import{R as M,E as oe}from"./RegisterEmpty-DdDXaiEn.js";import{U as le,A as O}from"./UserSearchInput-BFpwaVmp.js";import{C as U}from"./copy-EPASKX-X.js";import{g as ce}from"./workerType-gCLCeJDi.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.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 de=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],me=q("unlink",de);/**
|
|
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 xe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ue=q("user-plus",xe);function W(n){const[x,i]=r.useState([]),[k,v]=r.useState(!1),l=r.useCallback(async()=>{if(n){v(!0);try{const p=await T("GET",`/web/teams/${n}/members`);i(p)}catch{i([])}finally{v(!1)}}},[n]);r.useEffect(()=>{l()},[l]);const b=r.useCallback(async(p,y)=>{await T("POST",`/web/teams/${n}/members`,{userId:p,role:y}),await l()},[n,l]),u=r.useCallback(async p=>{await T("DELETE",`/web/teams/${n}/members/${p}`),await l()},[n,l]),d=r.useCallback(async(p,y)=>{await T("PATCH",`/web/teams/${n}/members/${p}`,{role:y}),await l()},[n,l]);return{members:x,isLoading:k,addMember:b,removeMember:u,updateRole:d,refetch:l}}function pe(n){const[x,i]=r.useState([]),k=r.useCallback(async l=>{if(!n)return null;const b=await T("POST",`/web/teams/${n}/invitations`,l);return i(u=>[...u,b]),b},[n]),v=r.useCallback(async l=>{n&&(await T("DELETE",`/web/teams/${n}/invitations/${l}`),i(b=>b.filter(u=>u.token!==l)))},[n]);return{invitations:x,createInvitation:k,revokeInvitation:v}}function he({teamId:n,canManage:x}){D();const{invitations:i,createInvitation:k,revokeInvitation:v}=pe(n),{addMember:l}=W(n),[b,u]=r.useState(!1),[d,p]=r.useState(null),[y,C]=r.useState("member"),[m,w]=r.useState(!1),[g,f]=r.useState("member"),[j,_]=r.useState(null),[A,L]=r.useState(!1),[a,s]=r.useState(!1),[c,h]=r.useState(!1),N=async()=>{u(!0);try{const o=await k({role:y,expiresIn:86400,maxUses:5});o&&p(o.token||o.inviteToken||null)}catch{}finally{u(!1)}},$=async()=>{if(!d)return;const o=`${window.location.origin}/join?invite=${d}`;let S=!1;try{navigator.clipboard&&window.isSecureContext&&(await navigator.clipboard.writeText(o),S=!0)}catch{}if(!S){const E=document.createElement("textarea");E.value=o,E.style.position="fixed",E.style.top="0",E.style.opacity="0",document.body.appendChild(E),E.focus(),E.select(),E.setSelectionRange(0,o.length);try{S=document.execCommand("copy")}catch{S=!1}document.body.removeChild(E)}S?(h(!1),s(!0),setTimeout(()=>s(!1),2e3)):(s(!1),h(!0),setTimeout(()=>h(!1),4e3))},R=async o=>{L(!0),_(null);try{await l(o,g),w(!1)}catch(S){_(S instanceof Error?S.message:t("invitation.addFailed"))}finally{L(!1)}};return e.jsxs("section",{className:"ds-page-row",children:[e.jsx("h2",{children:t("team.detail.invitations")}),x&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",value:y,onChange:o=>C(o.target.value),"aria-label":t("team.member.role"),children:[e.jsx("option",{value:"member",children:t("invitation.member")}),e.jsx("option",{value:"admin",children:t("invitation.admin")})]}),e.jsx("button",{type:"button",onClick:N,disabled:b,className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2 disabled:opacity-40",children:b?t("invitation.creating"):t("invitation.create")}),e.jsxs("button",{type:"button",onClick:()=>w(o=>!o),"aria-pressed":m,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2",title:t("invitation.addExistingHint"),children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),t("invitation.addExisting")]})]}),d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-surface-1 px-3 py-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-text-primary",children:`${window.location.origin}/join?invite=${d}`}),e.jsx("button",{type:"button",onClick:$,className:a?"text-status-active":"text-text-muted hover:text-text-primary",title:a?t("share.copied"):t("share.copy"),children:a?e.jsx(B,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>p(null),className:"text-text-muted hover:text-text-primary","aria-label":t("common.cancel"),children:e.jsx(F,{className:"h-4 w-4"})})]}),c&&e.jsx("p",{className:"text-xs text-status-error",children:t("share.copyFailed")}),m&&x&&e.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-surface-1 p-3",children:[e.jsx("p",{className:"text-xs text-text-muted",children:t("invitation.addExistingHint")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("select",{className:"rounded-md border border-border bg-surface-2 px-2 py-1.5 text-sm text-text-primary focus:border-accent focus:outline-none",value:g,onChange:o=>f(o.target.value),"aria-label":t("team.member.role"),children:[e.jsx("option",{value:"member",children:t("invitation.member")}),e.jsx("option",{value:"admin",children:t("invitation.admin")})]})}),j&&e.jsx("p",{className:"text-xs text-destructive",children:j}),e.jsx(le,{onSelect:R,actionDisabled:A,placeholder:t("invitation.searchUser")})]}),i.length===0?e.jsx(M,{title:t("invitation.emptyTitle"),hint:t("invitation.emptyHint")}):e.jsx("div",{className:"ds-reg",children:i.map(o=>e.jsxs("div",{className:"ds-reg-row group",children:[e.jsxs("div",{className:"ds-reg-main",children:[e.jsx("span",{className:"ds-reg-tag shrink-0 rounded-full border border-border/60 bg-surface-2 text-text-muted",children:o.role==="admin"?t("invitation.admin"):t("invitation.member")}),e.jsx("span",{className:"ds-reg-meta truncate font-mono text-xs text-text-muted",children:G("invitation.expires",{date:new Date(o.expiresAt).toLocaleDateString()})})]}),x&&e.jsx("div",{className:"ds-reg-aside",children:e.jsx("button",{type:"button",onClick:()=>v(o.token),className:"ds-reg-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:t("invitation.revoke"),"aria-label":t("invitation.revoke"),children:e.jsx(F,{className:"h-4 w-4"})})})]},o.token))})]})}function be({teamId:n,canManage:x}){D();const[i,k]=r.useState([]),[v,l]=r.useState(!0),[b,u]=r.useState(null),[d,p]=r.useState(""),[y,C]=r.useState(null),[m,w]=r.useState(!1),g=async()=>{try{const a=await Y();k(a||[])}catch(a){u(a instanceof Error?a.message:t("team.detail.loadEnvsFailed"))}finally{l(!1)}};r.useEffect(()=>{g()},[]);const f=r.useMemo(()=>i.filter(a=>a.team_id===n),[i,n]),j=r.useMemo(()=>i.filter(a=>!a.team_id),[i]),_=async()=>{if(d){C(null);try{await Q(d,n),p(""),await g()}catch(a){C(a instanceof Error?a.message:t("team.detail.linkFailed"))}}},A=async a=>{if(window.confirm(t("team.detail.unlinkConfirm"))){C(null);try{await J(n,a),await g()}catch(s){C(s instanceof Error?s.message:t("team.detail.unlinkFailed"))}}},L=async()=>{const a=`slz rc --team-id ${n}`;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(a),w(!0),setTimeout(()=>w(!1),2e3);return}}catch{}const s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy"),w(!0),setTimeout(()=>w(!1),2e3)}catch{}document.body.removeChild(s)};return e.jsxs("section",{className:"ds-page-row",children:[e.jsx("h2",{children:t("team.detail.environments")}),v?e.jsx("p",{className:"text-sm text-text-muted",children:t("common.loading")}):b?e.jsx("p",{className:"text-sm text-status-error",children:b}):e.jsxs(e.Fragment,{children:[f.length===0?e.jsx(M,{title:t("team.detail.envsEmptyTitle"),hint:t("team.detail.envsEmptyHint")}):e.jsx("div",{className:"ds-reg",children:f.map(a=>{var N,$;const s=ce(a.worker_type),c=((N=a.directory)==null?void 0:N.trim())||null,h=(($=a.owner_username)==null?void 0:$.trim())||null;return e.jsxs("div",{className:"ds-reg-row group",children:[e.jsxs("div",{className:"ds-reg-main",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:a.machine_name||a.id}),e.jsx("span",{className:I("ds-reg-tag rounded-full",s.colorClass),children:s.fullLabel}),e.jsx(oe,{status:a.status,className:"ds-reg-tag"})]}),(c||h)&&e.jsxs("span",{className:"ds-reg-meta flex min-w-0 items-center gap-1.5 text-xs text-text-muted",children:[c&&e.jsx("span",{className:"min-w-0 truncate font-mono",children:c}),c&&h&&e.jsx("span",{className:"ds-reg-fact-sep","aria-hidden":"true",children:"·"}),h&&e.jsxs("span",{className:"ds-reg-owner",title:`${t("dashboard.envOwner")}: ${h}`,children:[e.jsx(K,{className:"h-3 w-3","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:h})]})]})]}),e.jsxs("div",{className:"ds-reg-aside",children:[e.jsx("span",{className:"col-start-2 whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:X(a.created_at)}),x&&e.jsx("button",{type:"button",onClick:()=>A(a.id),className:"ds-reg-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:t("team.detail.unlink"),"aria-label":t("team.detail.unlink"),children:e.jsx(me,{className:"h-4 w-4"})})]})]},a.id)})}),x&&e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-xs text-text-muted",children:t("team.detail.registerHint")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"rounded-md border border-border bg-surface-2 px-3 py-1.5 font-mono text-xs text-text-primary",children:["slz rc --team-id ",n]}),e.jsx("button",{type:"button",onClick:L,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":t("team.detail.copyCommand"),title:t("team.detail.copyCommand"),children:e.jsx(U,{className:"h-3.5 w-3.5"})}),m&&e.jsx("span",{className:"text-xs text-status-active",children:t("share.copied")})]})]}),j.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"team-link-env",className:"text-xs text-text-muted",children:t("team.detail.linkHint")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("select",{id:"team-link-env",value:d,onChange:a=>p(a.target.value),className:"max-w-md rounded-md border border-border bg-surface-2 px-2.5 py-1.5 text-xs text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:t("team.detail.linkSelect")}),j.map(a=>e.jsx("option",{value:a.id,children:a.machine_name||a.id},a.id))]}),e.jsx("button",{type:"button",onClick:_,disabled:!d,className:"inline-flex items-center rounded-md border border-border px-3 py-1.5 text-xs font-medium text-text-primary transition-colors hover:bg-surface-2 disabled:opacity-40",children:t("team.detail.link")})]})]})]}),y&&e.jsx("p",{className:"text-sm text-status-error",children:y})]})]})}async function fe(n){try{const x=n.startsWith("team_")?`/web/teams/${n}`:`/web/teams/by-slug/${n}`;return await T("GET",x)}catch{return null}}const ye={owner:"team.member.roleOwner",admin:"team.member.roleAdmin",member:"team.member.roleMember"},P={owner:"border-brand/30 bg-brand/10 text-brand-text",admin:"border-accent/30 bg-accent/10 text-accent",member:"border-border/60 bg-surface-2 text-text-muted"};function z(n){return t(ye[n]||"team.member.roleMember")}function Se(){D();const n=window.location.pathname.split("/"),x=n[n.length-1]||"",[i,k]=r.useState(null),[v,l]=r.useState(!0),[b,u]=r.useState(!1),{members:d,isLoading:p,updateRole:y,removeMember:C}=W((i==null?void 0:i.id)||null),{user:m}=V(),[w,g]=r.useState("");if(r.useEffect(()=>{x&&(l(!0),fe(x).then(s=>{k(s),l(!1)}))},[x]),v)return e.jsx("div",{className:"ds-page text-sm text-text-muted",children:t("common.loading")});if(!i)return e.jsxs("div",{className:"ds-page",children:[e.jsx("div",{className:"ds-page-head",children:e.jsxs("a",{href:"/teams",className:"ds-page-back",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),t("team.detail.back")]})}),e.jsx("p",{className:"text-sm text-text-muted",children:t("team.detail.notFound")})]});const f=d.find(s=>s.user_id===(m==null?void 0:m.userId)),j=(m==null?void 0:m.role)==="admin"||(f==null?void 0:f.role)==="owner"||(f==null?void 0:f.role)==="admin",_=(m==null?void 0:m.role)==="admin"||(f==null?void 0:f.role)==="owner",A=async()=>{const s=i.id;try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(s),u(!0),setTimeout(()=>u(!1),2e3);return}}catch{}const c=document.createElement("textarea");c.value=s,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select();try{document.execCommand("copy"),u(!0),setTimeout(()=>u(!1),2e3)}catch{}document.body.removeChild(c)},L=async(s,c)=>{if(s.role!==c){g("");try{await y(s.user_id,c)}catch(h){g(h instanceof Error?h.message:t("team.member.updateFailed"))}}},a=async s=>{const c=s.username||s.user_id;if(window.confirm(t("team.member.removeConfirm").replace("{name}",c))){g("");try{await C(s.user_id)}catch(N){g(N instanceof Error?N.message:t("team.member.updateFailed"))}}};return e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("span",{className:"ds-page-runhead-label",children:t("team.list.kicker")})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:i.name}),e.jsx("span",{className:"ds-page-count",children:G("team.detail.memberCount",{n:d.length})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",i.slug]}),e.jsx("span",{className:"font-mono text-xs text-text-muted","aria-hidden":"true",children:"·"}),e.jsx("code",{className:"font-mono text-xs text-text-muted",children:i.id}),e.jsx("button",{type:"button",onClick:A,className:"text-text-muted transition-colors hover:text-text-primary","aria-label":t("team.detail.copyId"),title:t("team.detail.copyId"),children:e.jsx(U,{className:"h-3.5 w-3.5"})}),b&&e.jsx("span",{className:"text-xs text-status-active",children:t("share.copied")}),j&&e.jsx("a",{href:`/teams/${i.slug}/settings`,className:"ml-1 text-text-muted transition-colors hover:text-text-primary","aria-label":t("team.settings.title"),title:t("team.settings.title"),children:e.jsx(Z,{className:"h-4 w-4"})}),e.jsx("a",{href:"/teams",className:"text-text-muted transition-colors hover:text-text-primary","aria-label":t("team.detail.back"),title:t("team.detail.back"),children:e.jsx(O,{className:"h-4 w-4"})})]}),i.description&&e.jsx("p",{className:"ds-page-lede",children:i.description})]}),e.jsxs("section",{className:"ds-page-row",children:[e.jsx("h2",{children:t("team.detail.members")}),w&&e.jsx("p",{className:"text-sm text-status-error",children:w}),p?e.jsx("p",{className:"text-sm text-text-muted",children:t("common.loading")}):d.length===0?e.jsx(M,{title:t("team.detail.membersEmptyTitle"),hint:t("team.detail.membersEmptyHint")}):e.jsx("div",{className:"ds-reg",children:d.map(s=>{const c=s.user_id===(m==null?void 0:m.userId),h=s.role==="owner"||s.role==="admin",N=j&&(!h||_),$=N&&!(s.role==="owner"&&d.filter(o=>o.role==="owner").length<=1),R=["owner","admin","member"];return e.jsxs("div",{className:"ds-reg-row",children:[e.jsxs("div",{className:"ds-reg-main",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:s.username||s.user_id}),c&&e.jsx("span",{className:"shrink-0 text-xs text-text-muted",children:t("team.member.you")}),e.jsx("span",{className:I("ds-reg-tag shrink-0 rounded-full border",P[s.role]||P.member),children:z(s.role)})]}),e.jsx("span",{className:"ds-reg-meta min-w-0 truncate font-mono text-xs text-text-muted",children:s.user_id})]}),j&&e.jsx("div",{className:"ds-reg-aside",children:e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsx("button",{type:"button",disabled:!N,className:"rounded p-1 text-text-muted transition-colors hover:bg-surface-1 hover:text-text-primary disabled:opacity-40 disabled:hover:bg-transparent","aria-label":t("team.member.changeRole"),title:t("team.member.changeRole"),children:e.jsx(se,{className:"h-4 w-4"})})}),e.jsxs(ae,{align:"end",className:"w-48",children:[e.jsx(ne,{className:"text-xs text-text-muted",children:t("team.member.changeRole")}),R.map(o=>e.jsxs(H,{onSelect:()=>L(s,o),className:"flex items-center justify-between",children:[e.jsx("span",{children:z(o)}),s.role===o&&e.jsx(B,{className:"h-3.5 w-3.5 text-brand-text"})]},o)),e.jsx(re,{}),e.jsxs(H,{variant:"destructive",disabled:!$,onSelect:()=>a(s),className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t("team.member.remove")})]})]})]})})]},s.user_id)})})]}),e.jsx(be,{teamId:i.id,canManage:j}),e.jsx(he,{teamId:i.id,canManage:j})]})}export{Se as TeamDetail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{aL as b,aM as v,aD as a,aK as C,aE as f,N as D,W as S}from"./main-BC4mcO_f.js";import{D as E,a as T,d as k}from"./dialog-Ort95zkZ.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function L({open:c,onClose:n,onCreated:m}){b();const{createTeam:N}=v(),[l,h]=d.useState(""),[i,o]=d.useState(""),[x,p]=d.useState(""),[s,r]=d.useState(""),[u,j]=d.useState(!1);d.useEffect(()=>{c&&(h(""),o(""),p(""),r(""),j(!1))},[c]);const w=t=>{h(t),i||o(t.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-"))},y=async t=>{t.preventDefault(),r(""),j(!0);try{const g=await N({name:l,slug:i,description:x||void 0});m(g)}catch(g){r(g instanceof Error?g.message:a("team.create.failed"))}finally{j(!1)}};return e.jsx(E,{open:c,onOpenChange:t=>{t||n()},children:e.jsx(T,{className:"nsd-shell max-w-md",children:e.jsxs("form",{className:"nsd-box nsd-box--single",onSubmit:y,children:[e.jsx(k,{className:"nsd-h",children:a("team.create.title")}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.name")}),e.jsx("input",{type:"text",required:!0,value:l,onChange:t=>w(t.target.value),placeholder:"Engineering",className:"nsd-title"}),e.jsx("span",{className:"text-xs text-text-muted",children:a("team.create.nameHint")})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.slug")}),e.jsx("input",{type:"text",required:!0,value:i,onChange:t=>o(t.target.value),pattern:"^[a-z0-9-]{3,32}$",placeholder:"engineering",className:"nsd-title"}),e.jsx("span",{className:"text-xs text-text-muted",children:a("team.create.slugHint")})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:a("team.create.description")}),e.jsx("textarea",{value:x,onChange:t=>p(t.target.value),rows:3,className:"nsd-title nsd-area"})]}),s&&e.jsx("p",{className:"nsd-error",children:s}),e.jsxs("div",{className:"nsd-foot",children:[e.jsx("button",{type:"button",onClick:n,className:"nsd-cancel",children:a("common.cancel")}),e.jsx("button",{type:"submit",disabled:u||!l||!i,className:"btn-ticket nsd-create",children:u?a("common.creating"):a("team.create.submit")})]})]})})})}function z(c,n){const m=new Date(c);return Number.isNaN(m.getTime())?"":new Intl.DateTimeFormat(n==="zh"?"zh-CN":"en-US",{year:"numeric",month:"short"}).format(m)}function I(){const c=b(),{myTeams:n,isLoading:m,refetch:N}=v(),{user:l}=C(),[h,i]=d.useState(!1),o=s=>{i(!1),window.history.pushState(null,"",`/teams/${s.slug}`),window.dispatchEvent(new PopStateEvent("popstate"))},x=s=>(l==null?void 0:l.role)==="admin"||s.created_by===(l==null?void 0:l.userId),p=async s=>{if(window.confirm(f("team.list.deleteConfirm",{name:s.name})))try{await S("DELETE",`/web/teams/${s.id}`),await N()}catch(r){alert(r instanceof Error?r.message:a("team.list.deleteFailed"))}};return m?e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("div",{className:"h-2.5 w-20 animate-pulse rounded bg-surface-2"})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("div",{className:"h-12 w-44 animate-pulse rounded bg-surface-2"}),e.jsxs("div",{className:"ds-page-titlerow-end",children:[e.jsx("div",{className:"h-2.5 w-14 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-7 w-24 animate-pulse rounded-sm bg-surface-2"})]})]}),e.jsx("div",{className:"h-4 w-72 animate-pulse rounded bg-surface-2"})]}),e.jsx("div",{className:"space-y-10",children:[0,1,2].map(s=>e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-6 w-48 animate-pulse rounded bg-surface-2"}),e.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-surface-2"})]},s))})]}):e.jsxs("div",{className:"ds-page",children:[e.jsxs("header",{className:"ds-page-head",children:[e.jsx("div",{className:"ds-page-runhead",children:e.jsx("span",{className:"ds-page-runhead-label",children:a("team.list.kicker")})}),e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:a("team.list.title")}),e.jsxs("div",{className:"ds-page-titlerow-end",children:[n.length>0&&e.jsx("span",{className:"ds-page-count",children:f("team.list.count",{n:n.length})}),e.jsx("button",{type:"button",onClick:()=>i(!0),className:"btn-ticket",children:a("team.list.create")})]})]}),e.jsx("p",{className:"ds-page-lede",children:n.length===0?a("team.list.empty"):a("team.list.lede")})]}),n.length>0&&e.jsx("ul",{className:"space-y-10",children:n.map((s,r)=>{const u=z(s.created_at,c);return e.jsxs("li",{className:"ds-team-item group",children:[e.jsxs("a",{href:`/teams/${s.slug}`,className:"ds-team-link",children:[e.jsxs("div",{className:"ds-team-name",children:[e.jsx("span",{className:"ds-team-idx","aria-hidden":"true",children:String(r+1).padStart(2,"0")}),e.jsx("h2",{className:"font-display text-lg font-medium tracking-tight text-text-primary transition-colors group-hover:text-accent",children:s.name}),e.jsxs("span",{className:"font-mono text-xs text-text-muted",children:["/",s.slug]})]}),s.description?e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-text-muted",children:s.description}):e.jsx("p",{className:"mt-2 text-sm italic text-text-muted/60",children:a("team.list.noDescription")})]}),e.jsxs("div",{className:"ds-team-aside",children:[u&&e.jsxs("span",{className:"ds-team-date",children:[a("team.list.founded")," ",u]}),x(s)&&e.jsx("button",{type:"button",onClick:()=>p(s),className:"ds-team-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:a("team.list.delete"),"aria-label":a("team.list.delete"),children:e.jsx(D,{className:"h-4 w-4"})})]})]},s.id)})}),e.jsx(L,{open:h,onClose:()=>i(!1),onCreated:o})]})}export{I as TeamList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as n,j as e}from"./vendor-DE_-CLIE.js";import{W as c}from"./main-BC4mcO_f.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";async function j(s){try{const r=s.startsWith("team_")?`/web/teams/${s}`:`/web/teams/by-slug/${s}`;return await c("GET",r)}catch{return null}}async function w(s,r){await c("PATCH",`/web/teams/${s}`,r)}async function N(s){await c("DELETE",`/web/teams/${s}`)}function k(){const s=window.location.pathname.split("/"),r=s[s.length-2]||"",[a,f]=n.useState(null),[b,g]=n.useState(!0),[i,m]=n.useState(""),[d,l]=n.useState(""),[u,o]=n.useState(null),[x,h]=n.useState(!1);n.useEffect(()=>{r&&j(r).then(t=>{t&&(f(t),m(t.name),l(t.description||"")),g(!1)})},[r]);const v=async t=>{if(t.preventDefault(),!!a){o(null),h(!0);try{await w(a.id,{name:i,description:d}),window.location.href=`/teams/${a.slug}`}catch(p){o(p instanceof Error?p.message:"Failed to update")}finally{h(!1)}}},y=async()=>{if(a&&window.confirm("Delete this team? Environments must be transferred first."))try{await N(a.id),window.location.href="/teams"}catch(t){o(t instanceof Error?t.message:"Failed to delete")}};return b?e.jsx("div",{className:"ds-page text-text-muted",children:"Loading..."}):a?e.jsx("div",{className:"ds-page",children:e.jsxs("div",{children:[e.jsxs("header",{className:"mb-12",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:a.name}),e.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:["/",a.slug]})]}),e.jsxs("form",{onSubmit:v,className:"mb-16 max-w-md space-y-8",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-text-primary mb-2",children:"Team Name"}),e.jsx("input",{id:"name",type:"text",required:!0,value:i,onChange:t=>m(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-text-primary mb-2",children:"Description"}),e.jsx("textarea",{id:"description",value:d,onChange:t=>l(t.target.value),className:"w-full rounded-md border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",rows:3})]}),u&&e.jsx("p",{className:"text-sm text-destructive",children:u}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>window.history.back(),className:"rounded-md border border-border px-4 py-2 text-sm text-text-primary hover:bg-surface-2 transition-colors",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:x||!i,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50 transition-colors",children:x?"Saving...":"Save Changes"})]})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"mb-3 text-sm font-medium text-destructive",children:"Delete team"}),e.jsx("p",{className:"mb-4 text-sm text-text-muted",children:"Deleting a team requires all environments to be transferred first."}),e.jsx("button",{type:"button",onClick:y,className:"rounded-md border border-destructive/60 px-4 py-2 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors",children:"Delete Team"})]})]})}):e.jsx("div",{className:"ds-page",children:e.jsxs("div",{className:"max-w-lg",children:[e.jsx("p",{className:"text-text-muted",children:"Team not found."}),e.jsx("a",{href:"/teams",className:"text-accent hover:underline",children:"Back to teams"})]})})}export{k as TeamSettings};
|