@saluzi/saluzi-edu 0.7.34 → 0.7.35
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 +53 -53
- package/dist/rcs-web/assets/{AdminPanel-gJWYsoQr.js → AdminPanel-BHFN9LNJ.js} +1 -1
- package/dist/rcs-web/assets/{ArtifactView-Dcn-Ytyf.js → ArtifactView-D597eE0B.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-DTDBumAW.js → dist/rcs-web/assets/ArtifactsGallery-CLQlrMUD.js} +7 -7
- package/dist/rcs-web/assets/Claim-OHl3vi3x.js +1 -0
- package/dist/rcs-web/assets/Dashboard-C11LLxyp.js +6 -0
- package/dist/rcs-web/assets/Join-r5JcPEJU.js +1 -0
- package/dist/rcs-web/assets/Login-BV-VFXc8.js +1 -0
- package/dist/rcs-web/assets/MemoriesPage-CnvVE7y9.js +1 -0
- package/dist/rcs-web/assets/MemoryTypeChips-BkrR3x2j.js +6 -0
- package/dist/rcs-web/assets/Register-BKegRZln.js +1 -0
- package/dist/rcs-web/assets/{RegisterEmpty-Bp4ijU6c.js → RegisterEmpty-CQLw7nxd.js} +5 -10
- package/dist/rcs-web/assets/SessionDetail-qQ_yYMXP.js +83 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-hjXhLkpx.js → SessionVisibilityBadge-CHpMKXvY.js} +1 -1
- package/dist/rcs-web/assets/Setup-4TRbUKxr.js +1 -0
- package/dist/rcs-web/assets/ShareLanding-DgCCzzY3.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/TeamDetail-Dk_93Z0k.js → dist/rcs-web/assets/TeamDetail-TuVJeCR1.js} +2 -2
- package/dist/rcs-web/assets/TeamList-DhoruPq3.js +1 -0
- package/dist/rcs-web/assets/TeamSettings-CHEQR0jb.js +1 -0
- package/dist/rcs-web/assets/{UserSearchInput-BHQO5MGU.js → UserSearchInput-C4wv1O_6.js} +2 -2
- package/dist/rcs-web/assets/{UserSettings-DumkRY-s.js → UserSettings-BCg9Hx1x.js} +1 -1
- package/dist/rcs-web/assets/{arc-B_Bgarfu.js → arc-C-_TIerE.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-DfVLTz_r.js → architectureDiagram-3BPJPVTR-beAA8z-g.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DDZ7y1j3.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-BNR3gwO7.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-CRCn_dZ4.js → c4Diagram-AAUBKEIU-B4JhY8vU.js} +1 -1
- package/dist/rcs-web/assets/channel-BO-JIGHa.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-CB7J33fu.js → chunk-2J33WTMH-C-PijTjw.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-CsGAZA3y.js → chunk-4BX2VUAB-Cf9gkdhc.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-BMq3yddb.js → chunk-55IACEB6-CU8wR03K.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-BkZTIlHS.js → dist/rcs-web/assets/chunk-727SXJPM-zxNGjQ_A.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CsiM2lma.js → dist/rcs-web/assets/chunk-AQP2D5EJ-GzIqC820.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-CMzmGgg8.js → chunk-FMBD7UC4-C0Gozh4X.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-CvXQ2BBP.js → chunk-ND2GUHAM-Vd4uKkwn.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-De77sr34.js → chunk-QZHKN3VN-CcmoHM31.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-CQNKs2Q1.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-CQNKs2Q1.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-BbUag7xL.js → code-block-IT6T5CEO-CeTiJ_5U.js} +1 -1
- package/dist/rcs-web/assets/{copy-D0pf7ohg.js → copy-CZDxZlFG.js} +1 -1
- package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-cCqCJZ0k.js → cose-bilkent-S5V4N54A-Drz-N1FU.js} +1 -1
- package/dist/rcs-web/assets/{dagre-BM42HDAG-3e2AVH4q.js → dagre-BM42HDAG-Bii1VCPk.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-t5XWI3y7.js → diagram-2AECGRRQ-BXzs0Inz.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-Bomno2dS.js → diagram-5GNKFQAL-CytXTMI4.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-C2hVUfj2.js → dist/rcs-web/assets/diagram-KO2AKTUF-R6DT6E64.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-COY_061g.js → diagram-LMA3HP47-B6S2xHIS.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-Bau_gRm1.js → dist/rcs-web/assets/diagram-OG6HWLK6-AHaTYJVB.js} +1 -1
- package/dist/rcs-web/assets/dialog-Bts_qkki.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-B6o-4kpo.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-D5JbEkq8.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-DAraOQo5.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-CY0aHTCu.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DYJx4lRc.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CSyAl3z-.js} +1 -1
- package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-o4bVF72x.js → gitGraphDiagram-PVQCEYII-e5YIgxoR.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-D2udf4lA.js → infoDiagram-5YYISTIA-DVDPyLBc.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-B3mNkN5l.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-0gxGyjL6.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-Ry1Fr21k.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-CM83fuK_.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-DvxHDfWf.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-id_FkJ5L.js} +1 -1
- package/dist/rcs-web/assets/{linear-s8jVu6QY.js → linear-4qBKmb1P.js} +1 -1
- package/dist/rcs-web/assets/main-BAO6US1o.js +393 -0
- package/dist/rcs-web/assets/main-DNorjD-j.css +1 -0
- package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-z8qNKcJT.js → dist/rcs-web/assets/mermaid-VLURNSYL-BUDhzZZx.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-B98fAraT.js → mermaid.core-n5f_df_C.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-Cs7AOVl2.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-Cn5ESsTL.js} +1 -1
- package/dist/rcs-web/assets/{notifications-C2qTba5c.js → notifications-D0Ro2M4C.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-BOSw3AKh.js → pieDiagram-4H26LBE5-CfNaOQwR.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-Be8mhczt.js → quadrantDiagram-W4KKPZXB-9EH7YWIg.js} +1 -1
- package/dist/rcs-web/assets/{refresh-cw-Bo4t-P1R.js → refresh-cw-Cj9UC6vN.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-CgI_5y27.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-Cw-qvChc.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-2361M3Hs.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-grgk3897.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-liblY9ZR.js → sequenceDiagram-3UESZ5HK-DEiAVVrz.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-ChgrbHxu.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-vYQ7RnEF.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CVitJD-x.js → stateDiagram-v2-BHNVJYJU-BQI838MX.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-Cnh3IdcT.js → timeline-definition-PNZ67QCA-Bd21eOrF.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-0W2x0guu.js → vennDiagram-CIIHVFJN-g8Wh80Ut.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-BJkcCRAQ.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-CW-frP4D.js} +1 -1
- package/dist/rcs-web/assets/workerType-QC9nrox4.js +11 -0
- package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-BeVIeL0V.js → xychartDiagram-2RQKCTM6-DsyfoONu.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/pending-permissions.test.ts +119 -0
- package/packages/remote-control-server/src/__tests__/routes.test.ts +152 -0
- package/packages/remote-control-server/src/routes/v2/worker-events.ts +54 -0
- package/packages/remote-control-server/src/routes/v2/worker.ts +4 -0
- package/packages/remote-control-server/src/routes/web/control.ts +51 -0
- package/packages/remote-control-server/src/services/pending-permissions.ts +110 -0
- package/packages/remote-control-server/src/services/session.ts +16 -0
- package/packages/remote-control-server/src/transport/ws-handler.ts +65 -0
- package/packages/remote-control-server/src/types/api.ts +14 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-gJWYsoQr.js → AdminPanel-BHFN9LNJ.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ArtifactView-Dcn-Ytyf.js → ArtifactView-D597eE0B.js} +1 -1
- package/{dist/rcs-web/assets/ArtifactsGallery-DTDBumAW.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CLQlrMUD.js} +7 -7
- package/packages/remote-control-server/web/dist/assets/Claim-OHl3vi3x.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Dashboard-C11LLxyp.js +6 -0
- package/packages/remote-control-server/web/dist/assets/Join-r5JcPEJU.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Login-BV-VFXc8.js +1 -0
- package/packages/remote-control-server/web/dist/assets/MemoriesPage-CnvVE7y9.js +1 -0
- package/packages/remote-control-server/web/dist/assets/MemoryTypeChips-BkrR3x2j.js +6 -0
- package/packages/remote-control-server/web/dist/assets/Register-BKegRZln.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{RegisterEmpty-Bp4ijU6c.js → RegisterEmpty-CQLw7nxd.js} +5 -10
- package/packages/remote-control-server/web/dist/assets/SessionDetail-qQ_yYMXP.js +83 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-hjXhLkpx.js → SessionVisibilityBadge-CHpMKXvY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/Setup-4TRbUKxr.js +1 -0
- package/packages/remote-control-server/web/dist/assets/ShareLanding-DgCCzzY3.js +1 -0
- package/{dist/rcs-web/assets/TeamDetail-Dk_93Z0k.js → packages/remote-control-server/web/dist/assets/TeamDetail-TuVJeCR1.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/TeamList-DhoruPq3.js +1 -0
- package/packages/remote-control-server/web/dist/assets/TeamSettings-CHEQR0jb.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-BHQO5MGU.js → UserSearchInput-C4wv1O_6.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/{UserSettings-DumkRY-s.js → UserSettings-BCg9Hx1x.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-B_Bgarfu.js → arc-C-_TIerE.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-DfVLTz_r.js → architectureDiagram-3BPJPVTR-beAA8z-g.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-DDZ7y1j3.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BNR3gwO7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-CRCn_dZ4.js → c4Diagram-AAUBKEIU-B4JhY8vU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-BO-JIGHa.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-CB7J33fu.js → chunk-2J33WTMH-C-PijTjw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CsGAZA3y.js → chunk-4BX2VUAB-Cf9gkdhc.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-BMq3yddb.js → chunk-55IACEB6-CU8wR03K.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-BkZTIlHS.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-zxNGjQ_A.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-CsiM2lma.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-GzIqC820.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-CMzmGgg8.js → chunk-FMBD7UC4-C0Gozh4X.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CvXQ2BBP.js → chunk-ND2GUHAM-Vd4uKkwn.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-De77sr34.js → chunk-QZHKN3VN-CcmoHM31.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-CQNKs2Q1.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-CQNKs2Q1.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-BbUag7xL.js → code-block-IT6T5CEO-CeTiJ_5U.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-D0pf7ohg.js → copy-CZDxZlFG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-cCqCJZ0k.js → cose-bilkent-S5V4N54A-Drz-N1FU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-3e2AVH4q.js → dagre-BM42HDAG-Bii1VCPk.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-t5XWI3y7.js → diagram-2AECGRRQ-BXzs0Inz.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-Bomno2dS.js → diagram-5GNKFQAL-CytXTMI4.js} +1 -1
- package/{dist/rcs-web/assets/diagram-KO2AKTUF-C2hVUfj2.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-R6DT6E64.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-COY_061g.js → diagram-LMA3HP47-B6S2xHIS.js} +1 -1
- package/{dist/rcs-web/assets/diagram-OG6HWLK6-Bau_gRm1.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-AHaTYJVB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/dialog-Bts_qkki.js +1 -0
- package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-B6o-4kpo.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-D5JbEkq8.js} +1 -1
- package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-DAraOQo5.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-CY0aHTCu.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DYJx4lRc.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CSyAl3z-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-o4bVF72x.js → gitGraphDiagram-PVQCEYII-e5YIgxoR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-D2udf4lA.js → infoDiagram-5YYISTIA-DVDPyLBc.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-B3mNkN5l.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-0gxGyjL6.js} +1 -1
- package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-Ry1Fr21k.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-CM83fuK_.js} +1 -1
- package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-DvxHDfWf.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-id_FkJ5L.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-s8jVu6QY.js → linear-4qBKmb1P.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-BAO6US1o.js +393 -0
- package/packages/remote-control-server/web/dist/assets/main-DNorjD-j.css +1 -0
- package/{dist/rcs-web/assets/mermaid-VLURNSYL-z8qNKcJT.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-BUDhzZZx.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-B98fAraT.js → mermaid.core-n5f_df_C.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-Cs7AOVl2.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-Cn5ESsTL.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{notifications-C2qTba5c.js → notifications-D0Ro2M4C.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-BOSw3AKh.js → pieDiagram-4H26LBE5-CfNaOQwR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-Be8mhczt.js → quadrantDiagram-W4KKPZXB-9EH7YWIg.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{refresh-cw-Bo4t-P1R.js → refresh-cw-Cj9UC6vN.js} +1 -1
- package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-CgI_5y27.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-Cw-qvChc.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-2361M3Hs.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-grgk3897.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-liblY9ZR.js → sequenceDiagram-3UESZ5HK-DEiAVVrz.js} +1 -1
- package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-ChgrbHxu.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-vYQ7RnEF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CVitJD-x.js → stateDiagram-v2-BHNVJYJU-BQI838MX.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-Cnh3IdcT.js → timeline-definition-PNZ67QCA-Bd21eOrF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-0W2x0guu.js → vennDiagram-CIIHVFJN-g8Wh80Ut.js} +1 -1
- package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-BJkcCRAQ.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-CW-frP4D.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/workerType-QC9nrox4.js +11 -0
- package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-BeVIeL0V.js → xychartDiagram-2RQKCTM6-DsyfoONu.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/Claim-B8s9SPXu.js +0 -1
- package/dist/rcs-web/assets/Dashboard-aB82EvLp.js +0 -6
- package/dist/rcs-web/assets/Join-Sn3AKhd-.js +0 -1
- package/dist/rcs-web/assets/Login-CezyYoqD.js +0 -1
- package/dist/rcs-web/assets/MemoriesPage-Wz2xm_Sx.js +0 -1
- package/dist/rcs-web/assets/MemoryTypeChips-DuOHvrLG.js +0 -6
- package/dist/rcs-web/assets/Register-DgD1eDUW.js +0 -1
- package/dist/rcs-web/assets/SessionDetail-D580xm-q.js +0 -88
- package/dist/rcs-web/assets/Setup-PlsB2xkS.js +0 -1
- package/dist/rcs-web/assets/ShareLanding-CZcA2cNQ.js +0 -1
- package/dist/rcs-web/assets/TeamList-CijY_W_f.js +0 -1
- package/dist/rcs-web/assets/TeamSettings-C3M-aGm0.js +0 -1
- package/dist/rcs-web/assets/channel-Cl-DZrA-.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BiAxDlqk.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BiAxDlqk.js +0 -1
- package/dist/rcs-web/assets/dialog-1duL__fs.js +0 -1
- package/dist/rcs-web/assets/main-Mn7R0A18.js +0 -393
- package/dist/rcs-web/assets/main-oFvzHCs3.css +0 -1
- package/dist/rcs-web/assets/workerType-BYUJv8QQ.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Claim-B8s9SPXu.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-aB82EvLp.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Join-Sn3AKhd-.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Login-CezyYoqD.js +0 -1
- package/packages/remote-control-server/web/dist/assets/MemoriesPage-Wz2xm_Sx.js +0 -1
- package/packages/remote-control-server/web/dist/assets/MemoryTypeChips-DuOHvrLG.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Register-DgD1eDUW.js +0 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-D580xm-q.js +0 -88
- package/packages/remote-control-server/web/dist/assets/Setup-PlsB2xkS.js +0 -1
- package/packages/remote-control-server/web/dist/assets/ShareLanding-CZcA2cNQ.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamList-CijY_W_f.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamSettings-C3M-aGm0.js +0 -1
- package/packages/remote-control-server/web/dist/assets/channel-Cl-DZrA-.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BiAxDlqk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BiAxDlqk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/dialog-1duL__fs.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-Mn7R0A18.js +0 -393
- package/packages/remote-control-server/web/dist/assets/main-oFvzHCs3.css +0 -1
- package/packages/remote-control-server/web/dist/assets/workerType-BYUJv8QQ.js +0 -6
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import{j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{j as e}from"./vendor-DE_-CLIE.js";import{aG as t,i as d,h as l,aE as p,aW as h}from"./main-BAO6US1o.js";import{C as m,A as y}from"./workerType-QC9nrox4.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const f=[["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"}]],r=t("archive",f);/**
|
|
7
7
|
* @license lucide-react v0.555.0 - ISC
|
|
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 k=[["
|
|
11
|
+
*/const k=[["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"}]],x=t("triangle-alert",k);/**
|
|
12
12
|
* @license lucide-react v0.555.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/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=t("wifi-off",b);/**
|
|
17
17
|
* @license lucide-react v0.555.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
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};
|
|
21
|
+
*/const u=[["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"}]],g=t("wifi",u),j={running:{label:"running",Icon:y},active:{label:"active",Icon:g},idle:{label:"idle",Icon:d},disconnected:{label:"disconnected",Icon:i},offline:{label:"offline",Icon:i},inactive:{label:"inactive",Icon:r},archived:{label:"archived",Icon:r},error:{label:"error",Icon:m,tone:"text-status-error border-status-error/40"},requires_action:{label:"requires_action",Icon:x,tone:"text-status-warning border-status-warning/40"}};function w({status:a,className:n}){const{label:s,Icon:c,tone:o}=j[a]??{label:a,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:s,children:[e.jsx(c,{className:"h-3 w-3","aria-hidden":"true"}),s]})}function I({title:a,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:a}),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,83 @@
|
|
|
1
|
+
var tr=Object.defineProperty;var sr=(r,t,s)=>t in r?tr(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var D=(r,t,s)=>sr(r,typeof t!="symbol"?t+"":t,s);import{j as e,e as o}from"./vendor-DE_-CLIE.js";import{aG as ae,al as nr,aO as _s,aN as Cs,aW as i,aQ as rr,aP as kt,aI as xn,aJ as ar,aX as K,aL as Me,az as ir,ay as le,ao as or,av as lr,aZ as cr,b0 as me,T as dr,Y as ur,$ as Ze,L as st,N as mr,Q as xr,i as Es,aK as pr,J as pn,W as hr,aH as St,e as Wt,S as et,M as fr,G as yr,aE as hn,aR as fn,u as gr,c as br,v as jr,t as wr,ap as vr,a6 as kr,au as Nr,b1 as Sr,ai as yn,ag as _r,ae as Cr,aw as Er,ar as Tr,P as Mr,w as Rr,B as Lt,a4 as Ir,A as Ar,aM as Pr,aS as Dr,aU as qr,aj as $r,a2 as Ts,a5 as Or,aY as Fr,b as Ur,a9 as Ms,aT as Lr,as as Kr,V as gn,F as Rs,m as Is,r as As,n as Ps,o as ue,d as Br,K as Hr,C as Qr,ak as Ds,l as Wr,a as Gr,x as Gt,z as zt,I as zr,g as Yt,f as Vt,y as Jt,s as Yr}from"./main-BAO6US1o.js";import{A as Vr,g as bn,C as $t}from"./workerType-QC9nrox4.js";import{D as ke,a as Ne,d as Re,e as Se,b as qs,c as Jr}from"./dialog-Bts_qkki.js";import{R as Xr}from"./refresh-cw-Cj9UC6vN.js";import{A as Zr,U as ea}from"./UserSearchInput-C4wv1O_6.js";import{C as ta}from"./copy-CZDxZlFG.js";import{S as sa}from"./SessionVisibilityBadge-CHpMKXvY.js";import{S as na,A as ra}from"./ArtifactsGallery-CLQlrMUD.js";import{D as Ot,u as aa,d as ia,e as oa,i as la,F as $s,c as ca,b as da,T as ua,h as Os,a as ma,M as xa}from"./MemoryTypeChips-BkrR3x2j.js";import{S as pa,b as ha}from"./notifications-D0Ro2M4C.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 fa=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ya=ae("chevron-right",fa);/**
|
|
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 ga=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],ba=ae("coins",ga);/**
|
|
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 ja=[["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"}]],jn=ae("cpu",ja);/**
|
|
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 wa=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Fs=ae("ellipsis",wa);/**
|
|
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 va=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Us=ae("gauge",va);/**
|
|
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 ka=[["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"}]],Na=ae("hash",ka);/**
|
|
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 Sa=[["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"}]],_a=ae("layers",Sa);/**
|
|
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 Ca=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Ls=ae("lightbulb",Ca);/**
|
|
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 Ea=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],Ks=ae("list-todo",Ea);/**
|
|
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 Ta=[["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"}]],Kt=ae("message-circle-question-mark",Ta);/**
|
|
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 Ma=[["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"}]],Ra=ae("play",Ma);/**
|
|
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 Ia=[["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"}]],Bt=ae("plug",Ia);/**
|
|
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 Aa=[["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"}]],Pa=ae("server-cog",Aa);/**
|
|
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 Da=[["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"}]],Ht=ae("settings-2",Da);/**
|
|
72
|
+
* @license lucide-react v0.555.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const qa=[["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"}]],Bs=ae("share-2",qa);function Qt(){return{tasks:{}}}const Hs=3e4;function bt(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 Qs(r,t){var d,u,b,f,w,N,_,M,C,S,P,I;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 l=Date.now(),c=r.tasks[n];if(s==="task_started"){if(c)return{tasks:{...r.tasks,[n]:{...c,description:t.description??c.description,name:bt(t.description??c.description),taskType:t.task_type??c.taskType,workflowName:t.workflow_name??c.workflowName,prompt:t.prompt??c.prompt,toolUseId:t.tool_use_id??c.toolUseId,status:"running",startTime:l,evictAfter:void 0}}};const $=t.description??"";return{tasks:{...r.tasks,[n]:{taskId:n,name:bt($),description:$,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:l}}}}if(s==="task_progress"){if(!c){const $=t.description??"";return{tasks:{...r.tasks,[n]:{taskId:n,name:bt($),description:$,toolUseId:t.tool_use_id,status:"running",startTime:l,tokenCount:(d=t.usage)==null?void 0:d.total_tokens,toolUseCount:(u=t.usage)==null?void 0:u.tool_uses,durationMs:(b=t.usage)==null?void 0:b.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...r.tasks,[n]:{...c,description:t.description??c.description,tokenCount:((f=t.usage)==null?void 0:f.total_tokens)??c.tokenCount,toolUseCount:((w=t.usage)==null?void 0:w.tool_uses)??c.toolUseCount,durationMs:((N=t.usage)==null?void 0:N.duration_ms)??c.durationMs,lastToolName:t.last_tool_name??c.lastToolName,summary:t.summary??c.summary}}}}return c?{tasks:{...r.tasks,[n]:{...c,status:t.status??"completed",endTime:l,finalSummary:t.summary??c.finalSummary,outputFile:t.output_file??c.outputFile,tokenCount:((S=t.usage)==null?void 0:S.total_tokens)??c.tokenCount,toolUseCount:((P=t.usage)==null?void 0:P.tool_uses)??c.toolUseCount,durationMs:((I=t.usage)==null?void 0:I.duration_ms)??c.durationMs,evictAfter:l+Hs}}}:{tasks:{...r.tasks,[n]:{taskId:n,name:bt(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:l,endTime:l,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(_=t.usage)==null?void 0:_.total_tokens,toolUseCount:(M=t.usage)==null?void 0:M.tool_uses,durationMs:(C=t.usage)==null?void 0:C.duration_ms,evictAfter:l+Hs}}}}function $a(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 Ws={in_process_teammate:0,local_bash:1,monitor_mcp:2,remote_agent:3,local_agent:4,dream:5},Gs=100;function Oa(r){const t=new Map;for(const s of r){const n=s.taskType??"",l=t.get(n);l?l.push(s):t.set(n,[s])}return[...t.entries()].sort(([s],[n])=>{const l=Ws[s]??Gs,c=Ws[n]??Gs;return l===c?s.localeCompare(n):l-c}).map(([s,n])=>({taskType:s,tasks:[...n].sort((l,c)=>l.startTime-c.startTime)}))}function zs(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 Fa(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,set_token_mode:t.set_token_mode===!0,side_question:t.side_question===!0};return Object.values(s).some(Boolean)?s:null}function Ys(r,t){const s=[];if(Array.isArray(r)){for(const n of r){if(!n||typeof n!="object")continue;const l=n;if(typeof l.name!="string"||!l.name)continue;const c=l.type==="prompt"||l.type==="local"||l.type==="local-jsx"?l.type:void 0;s.push({name:l.name,...typeof l.description=="string"&&l.description?{description:l.description}:{},...typeof l.argumentHint=="string"&&l.argumentHint?{argumentHint:l.argumentHint}:{},...c?{type:c}:{}})}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 Vs(r){const t=r.raw&&typeof r.raw=="object"&&!Array.isArray(r.raw)?r.raw:r,s=Ys(t.slash_command_details??r.slash_command_details,t.slash_commands??r.slash_commands),n=Ys(t.skill_details??r.skill_details,t.skills??r.skills),l=Fa(t.remote_capabilities??r.remote_capabilities);return s.length===0&&n.length===0&&!l?null:{commands:s,skills:n,capabilities:l}}class Ua{constructor(t){D(this,"listeners",new Set);D(this,"stateListeners",new Set);D(this,"eventSource",null);D(this,"sessionId",null);D(this,"_lastSeqNum",0);D(this,"lastFrameAt",0);D(this,"firstEventAfterOpen",!1);D(this,"watchdogTimer",null);D(this,"visibilityHandler",null);D(this,"reconnectTimer",null);D(this,"reconnectAttempts",0);D(this,"_state","idle");D(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 l=JSON.parse(n.data);if(this.firstEventAfterOpen&&(this.firstEventAfterOpen=!1,typeof l.seqNum=="number"&&l.seqNum<this._lastSeqNum&&(this._lastSeqNum=l.seqNum-1,this.notifyResync())),l.seqNum!==void 0&&l.seqNum<=this._lastSeqNum)return;l.seqNum!==void 0&&(this._lastSeqNum=l.seqNum);for(const c of this.listeners)c(l)}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 cr(),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 xe=new Ua;function Ft(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 Js(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 Ut="streaming-";function Xs(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 l=typeof n.thinking=="string"&&n.thinking||typeof n.text=="string"&&n.text||"";l&&s.push(l)}return s.join("")}function Zs(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 en(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 La{constructor(t,s,n){D(this,"sessionId");D(this,"setEntries");D(this,"unsub",null);D(this,"unsubState",null);D(this,"onStatusChange");D(this,"onError");D(this,"onPermissionRequest");D(this,"onPermissionSettled");D(this,"onModelsStateChange");D(this,"onSubagentUpdate");D(this,"onControlResponse");D(this,"onPermissionModeChange");D(this,"onElicitationRequest");D(this,"onWorkerInfoChange");D(this,"onTurnStart");D(this,"subagentState",Qt());D(this,"seenUuids",new Set);D(this,"seenToolCallIds",new Set);D(this,"pendingToolCallIds",new Set);D(this,"pendingPermissionToolIds",new Map);D(this,"pendingPermissionDecisions",new Map);D(this,"settledPermissionIds",new Set);D(this,"postedUserUuids",new Set);D(this,"pendingControlRequests",new Map);D(this,"turnEnded",!1);D(this,"userSinceTurnEnd",!1);D(this,"turnStartedAt",null);D(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.onPermissionSettled=n==null?void 0:n.onPermissionSettled,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.onElicitationRequest=n==null?void 0:n.onElicitationRequest,this.onWorkerInfoChange=n==null?void 0:n.onWorkerInfoChange,this.onTurnStart=n==null?void 0:n.onTurnStart}markClosed(){this.closed=!0}setTurnStartedAt(t){var s;this.turnStartedAt!==t&&(this.turnStartedAt=t,(s=this.onTurnStart)==null||s.call(this,t))}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var S,P,I,$,q,h,g;const{events:t}=await nr(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 x=(S=k.payload)==null?void 0:S.uuid;typeof x=="string"&&x&&s.add(x)}const n=[];let l=null;const c=()=>{l&&(n.push(l),l=null)};for(const k of t){const x=k.payload||{},T=x.uuid;if(typeof T=="string"&&T&&this.seenUuids.add(T),k.type==="tool_use"){const y=x.tool_call_id;typeof y=="string"&&y&&this.seenToolCallIds.add(y)}if(k.type==="user"){if(k.direction==="inbound"){const p=x.uuid;if(typeof p!="string"||!p||s.has(p))continue}c();const y=Ft(x);y&&n.push({type:"user_message",id:k.id||`hist-user-${n.length}`,content:y})}else if(k.type==="assistant"){c();const y=Ft(x);if(_s(y))continue;const p=Xs(x),O=[],U=x.message;if(U&&typeof U=="object"&&Array.isArray(U.content)){for(const X of U.content)if(X.type==="tool_use"){const se=X.id;se&&this.seenToolCallIds.add(se),O.push({type:"tool_call",toolCall:{id:se||`hist-tool-${n.length}`,title:X.name||"tool",status:"complete",rawInput:X.input||{}}})}}if(y||p||O.length>0){l={type:"assistant_message",id:k.id||`hist-asst-${n.length}`,chunks:[...p?[{type:"thought",text:p}]:[],...y?[{type:"message",text:y}]:[]]},n.push(l);for(const X of O)n.push(X);l=null}}else if(k.type==="conversation_rewound"){const y=en(x);if(y){const p=n.findIndex(O=>Cs(O)===y);p>=0&&(n.length=p)}}else if(k.type==="tool_use"){const y=x,p={type:"tool_call",toolCall:{id:y.tool_call_id||`hist-tool-${n.length}`,title:y.tool_name||"tool",status:"complete",rawInput:y.tool_input||{}}};n.push(p)}else if(k.type==="tool_result"){const y=x,p=Js(n,y.tool_call_id||"");if(p>=0){const O=n[p];n[p]={type:"tool_call",toolCall:{...O.toolCall,rawOutput:{output:y.content||y.output||""}}}}}}c();let d=null;for(const k of t){if(k.type!=="task_state")continue;const x=k.payload||{};Array.isArray(x.tasks)&&(d=x.tasks)}if(d&&d.length>0){const k=Zs(d);k.length>0&&n.push({type:"plan",id:`plan-hist-${Date.now()}`,entries:k})}this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.pendingPermissionDecisions.clear(),this.setEntries(n);let u=null,b=null,f=null,w=null,N=0,_=0;for(const k of t){const x=k.payload||{};if(typeof k.createdAt=="number"&&(k.createdAt>_&&(_=k.createdAt),k.type==="user"&&w!=="user"&&k.createdAt>0&&(N=k.createdAt)),k.type==="user"?w="user":(k.type==="result"||k.type==="result_success"||k.type==="interrupt")&&(w="turn_end"),k.type==="system"&&(x.subtype==="init"||((P=x.raw)==null?void 0:P.subtype)==="init")&&(b=Vs(x)),k.type==="models_state"){const T=x.raw,y=T&&typeof T=="object"?T.models_state:x.models_state;y&&Array.isArray(y.availableModels)&&typeof y.currentModelId=="string"&&(u=y)}if(k.type==="system"){const T=x.raw,y=typeof x.permissionMode=="string"?x.permissionMode:typeof(T==null?void 0:T.permissionMode)=="string"?T.permissionMode:null;y&&(f=y)}}let M=!1,C=Qt();for(const k of t){if(k.type!=="system")continue;const x=zs(k.payload||{});x&&(C=Qs(C,x),M=!0)}M&&(this.subagentState=C,(I=this.onSubagentUpdate)==null||I.call(this,this.subagentState)),u&&(($=this.onModelsStateChange)==null||$.call(this,u)),b&&((q=this.onWorkerInfoChange)==null||q.call(this,b)),f&&((h=this.onPermissionModeChange)==null||h.call(this,f)),this.turnEnded=w==="turn_end",this.userSinceTurnEnd=w==="user",this.setTurnStartedAt(!this.closed&&w==="user"&&N>0&&_>=N?Date.now()-(_-N):null),this.turnEnded&&!this.closed&&((g=this.onStatusChange)==null||g.call(this,"idle"))}connectSSE(){xe.connect(this.sessionId),this.unsub=xe.onEvent(t=>this.handleEvent(t)),this.unsubState=xe.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),xe.disconnect()}handleEvent(t){var l,c,d,u,b,f,w,N,_,M,C,S,P,I,$,q;const s=t.type,n=t.payload||{};switch(s){case"user":{if(this.applyEmbeddedToolResults(n),this.userSinceTurnEnd=!0,!this.closed&&this.turnStartedAt===null&&this.setTurnStartedAt(Date.now()),t.direction==="inbound"){const h=n.uuid;if(typeof h!="string"||!h||this.postedUserUuids.has(h)||this.seenUuids.has(h))break;this.seenUuids.add(h);const g=Ft(n);g&&this.setEntries(k=>[...k,{type:"user_message",id:t.id||`user-${Date.now()}`,content:g}])}break}case"assistant":{const h=n.uuid;if(typeof h=="string"&&h){if(this.seenUuids.has(h))break;this.seenUuids.add(h)}const g=typeof n.content=="string"?n.content:"";if(_s(g))break;const k=Xs(n);this.setEntries(T=>{const y=T[T.length-1];if((y==null?void 0:y.type)==="assistant_message"&&y.id.startsWith(Ut))return[...T.slice(0,-1),{...y,id:`assistant-${Date.now()}`,chunks:[...k?[{type:"thought",text:k}]:[],{type:"message",text:g}]}];if((y==null?void 0:y.type)==="assistant_message"){const p=y.chunks[y.chunks.length-1];return(p==null?void 0:p.type)==="message"?[...T.slice(0,-1),{...y,chunks:[...y.chunks.slice(0,-1),{type:"message",text:p.text+g}]}]:[...T.slice(0,-1),{...y,chunks:[...y.chunks,{type:"message",text:g}]}]}if(g&&g.trim()||k){const p={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[...k?[{type:"thought",text:k}]:[],...g?[{type:"message",text:g}]:[]]};return[...T,p]}return T});const x=n.message;if(x&&typeof x=="object"&&Array.isArray(x.content)){const T=x.content.filter(y=>y.type==="tool_use");for(const y of T){const p=y.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`;if(this.seenToolCallIds.has(p))continue;this.seenToolCallIds.add(p),this.pendingToolCallIds.add(p);const O={id:p,title:y.name||"tool",status:"running",rawInput:y.input||{}};this.setEntries(U=>[...U,{type:"tool_call",toolCall:O}])}}break}case"tool_use":{const h=n,g=h.tool_call_id||`call-${Date.now()}`;if(this.seenToolCallIds.has(g))break;this.seenToolCallIds.add(g),this.pendingToolCallIds.add(g);const k={id:g,title:h.tool_name||"tool",status:"running",rawInput:h.tool_input||{}};this.setEntries(x=>[...x,{type:"tool_call",toolCall:k}]);break}case"tool_result":{const h=n;this.applyToolResult(h.tool_call_id||"",h.content??h.output);break}case"interrupt":{this.finalizePendingToolCalls("canceled"),this.turnEnded=!0,this.userSinceTurnEnd=!1,this.setTurnStartedAt(null),(l=this.onPermissionSettled)==null||l.call(this,null),this.closed||(c=this.onStatusChange)==null||c.call(this,"idle");break}case"control_request":case"permission_request":{const h=n.request;if(h&&h.subtype==="can_use_tool"){const g=n.request_id||"";if(!g||this.settledPermissionIds.has(g)||this.pendingPermissionDecisions.has(g))break;const k=h.tool_name||"unknown",x=h.input||h.tool_input||{},T=h.description||"",y=Array.isArray(h.permission_suggestions)?h.permission_suggestions:[],p=typeof h.tool_use_id=="string"?h.tool_use_id:void 0,O=k==="AskUserQuestion"||k==="ExitPlanMode",U=xn(y,k)[0],X=U?ar(U):void 0,se=O?[]:[{optionId:"allow_once",name:"",kind:"allow_once"},...y.length>0?[{optionId:"allow_always",name:"",kind:"allow_always",description:X}]:[],{optionId:"reject_once",name:"",kind:"reject_once"}];this.setEntries(Q=>{let A=-1;if(p&&(A=Q.findIndex(Z=>Z.type==="tool_call"&&Z.toolCall.id===p)),A<0){const Z=[...Q].reverse().findIndex(ce=>ce.type==="tool_call");Z>=0&&(A=Q.length-1-Z)}if(A<0)return Q;const ne=Q[A];return ne.toolCall.status!=="running"?Q:(this.pendingPermissionToolIds.set(g,ne.toolCall.id),Q.map((Z,ce)=>ce===A?{type:"tool_call",toolCall:{...ne.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:g,options:se,...p?{toolUseId:p}:{}}}}:Z))}),(d=this.onPermissionRequest)==null||d.call(this,{requestId:g,toolName:k,toolInput:x,description:T,suggestions:y,...p?{toolUseId:p}:{}})}else h&&h.subtype==="elicitation"&&((u=this.onElicitationRequest)==null||u.call(this,{requestId:n.request_id||"",serverName:h.mcp_server_name||"",message:h.message||"",mode:h.mode==="url"?"url":"form",url:typeof h.url=="string"?h.url:void 0,requestedSchema:h.requested_schema||void 0}));break}case"conversation_rewound":{const h=en(n);h&&(this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.pendingPermissionDecisions.clear(),this.setEntries(g=>{const k=g.findIndex(x=>Cs(x)===h);return k===-1?g:g.slice(0,k)}));break}case"session_status":{if(rr(n)){this.pendingToolCallIds.clear(),this.pendingPermissionToolIds.clear(),this.pendingPermissionDecisions.clear(),this.setEntries([]);break}if(typeof n.status=="string"){if(kt(n.status))this.closed=!0,this.finalizePendingToolCalls("canceled");else if(this.closed)break;if(n.status==="running"&&this.turnEnded&&!this.userSinceTurnEnd)break;(b=this.onStatusChange)==null||b.call(this,n.status)}break}case"error":{const h=String(n.message||n.content||"Unknown error");(f=this.onError)==null||f.call(this,h);break}case"models_state":{const h=n.raw,g=typeof h=="object"&&h!==null?h.models_state:n.models_state;g&&Array.isArray(g.availableModels)&&typeof g.currentModelId=="string"&&((w=this.onModelsStateChange)==null||w.call(this,g));break}case"system":{const h=n.raw,g=h&&typeof h=="object"?h:n,k=typeof g.subtype=="string"?g.subtype:void 0,x=zs(n);x&&(this.subagentState=Qs(this.subagentState,x),(N=this.onSubagentUpdate)==null||N.call(this,this.subagentState));const T=typeof g.permissionMode=="string"?g.permissionMode:typeof n.permissionMode=="string"?n.permissionMode:null;if(T&&((_=this.onPermissionModeChange)==null||_.call(this,T)),k==="init"){const y=Vs(n);y&&((M=this.onWorkerInfoChange)==null||M.call(this,y))}break}case"control_response":{const h=n.response;if(h&&typeof h=="object"){const g=typeof h.request_id=="string"?h.request_id:"",k=typeof h.subtype=="string"?h.subtype:"";if(g){const x=(C=h.response)==null?void 0:C.behavior,T=this.settlePermission(g,x==="allow"?"allow":x==="deny"?"deny":void 0);T&&((S=this.onPermissionSettled)==null||S.call(this,g,T)),(P=this.onControlResponse)==null||P.call(this,{subtype:k,requestId:g,error:typeof h.error=="string"?h.error:void 0});const y=this.pendingControlRequests.get(g);y&&(this.pendingControlRequests.delete(g),y({data:k==="success"&&h.response&&typeof h.response=="object"?h.response:null,...k==="error"&&typeof h.error=="string"?{error:h.error}:{}}))}}break}case"control_cancel_request":{const h=typeof n.request_id=="string"?n.request_id:"";if(h){const g=this.settlePermission(h,"cancel");g&&((I=this.onPermissionSettled)==null||I.call(this,h,g))}break}case"stream_event":{const h=n.event;if(!h||typeof h.type!="string")break;if(h.type==="content_block_delta"){const g=h.delta;if(!g||typeof g.type!="string")break;const k=g.type==="text_delta"?"message":g.type==="thinking_delta"?"thought":null;if(!k)break;const x=g.text??g.thinking;if(typeof x!="string"||!x)break;this.appendStreamingDelta(k,x)}break}case"partial_assistant":{const h=typeof n.content=="string"?n.content:"";h&&this.appendStreamingDelta("message",h);break}case"result":case"result_success":{this.turnEnded=!0,this.userSinceTurnEnd=!1,this.setTurnStartedAt(null),($=this.onPermissionSettled)==null||$.call(this,null),this.finalizePendingToolCalls(n.is_error?"canceled":"complete"),this.closed||(q=this.onStatusChange)==null||q.call(this,"idle");const h=typeof n.subtype=="string"?n.subtype:"",g=n.raw&&typeof n.raw=="object"?n.raw:void 0,x=(typeof n.result=="string"?n.result:typeof(g==null?void 0:g.result)=="string"?g.result:"").trim();h.startsWith("error_")&&x&&this.setEntries(T=>[...T,{type:"command_output",id:`exit-error-${typeof n.uuid=="string"?n.uuid:Date.now()}`,commandName:"worker",inputText:"",title:i("adapter.workerCrashed"),outputText:x,variant:"error"}]);break}case"task_state":{const h=Array.isArray(n.tasks)?n.tasks:[];if(h.length===0)break;const g=Zs(h);if(g.length===0)break;this.setEntries(k=>[...k.filter(T=>T.type!=="plan"),{type:"plan",id:`plan-${n.task_list_id||Date.now()}`,entries:g}]);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){var l;if(!t)return;let n;for(const[c,d]of this.pendingPermissionToolIds)if(d===t){n=c;break}if(n){const c=this.settlePermission(n,"allow");c&&((l=this.onPermissionSettled)==null||l.call(this,n,c))}this.pendingToolCallIds.delete(t),this.setEntries(c=>{const d=Js(c,t);if(d<0)return c;const u=c[d];return u.toolCall.status!=="running"&&u.toolCall.status!=="waiting_for_confirmation"?c:c.map((b,f)=>f===d?{type:"tool_call",toolCall:{...u.toolCall,status:"complete",permissionRequest:void 0,rawOutput:{output:s||""}}}:b)})}finalizePendingToolCalls(t){if(this.pendingPermissionToolIds.clear(),this.pendingPermissionDecisions.clear(),this.pendingToolCallIds.size===0)return;const s=this.pendingToolCallIds;this.pendingToolCallIds=new Set,this.setEntries(n=>n.map(l=>l.type!=="tool_call"||!s.has(l.toolCall.id)?l:{type:"tool_call",toolCall:{...l.toolCall,status:t,permissionRequest:void 0}}))}appendStreamingDelta(t,s){this.setEntries(n=>{const l=n[n.length-1];if((l==null?void 0:l.type)==="assistant_message"&&l.id.startsWith(Ut)){const d=l.chunks[l.chunks.length-1];return(d==null?void 0:d.type)===t?[...n.slice(0,-1),{...l,chunks:[...l.chunks.slice(0,-1),{type:t,text:d.text+s}]}]:[...n.slice(0,-1),{...l,chunks:[...l.chunks,{type:t,text:s}]}]}const c={type:"assistant_message",id:`${Ut}${Date.now()}`,chunks:[{type:t,text:s}]};return[...n,c]})}async sendMessage(t,s,n){var f;const l=s&&s.length>0,c=n&&n.length>0;if(!t.trim()&&!l&&!c)return;const d={type:"user_message",id:`user-${Date.now()}`,content:t,images:l?s:void 0,attachments:c?n:void 0};this.setEntries(w=>[...w,d]);const u=[];if(t&&u.push({type:"text",text:t}),l)for(const w of s)u.push({type:"image",source:{type:"base64",media_type:w.mimeType,data:w.data}});if(c){for(const w of n)if(w.kind==="text"||w.kind==="table"){const N=`📎 ${w.name}${w.size!=null?` (${Ka(w.size)})`:""}`,_=w.textContent||i("attach.emptyFile");u.push({type:"text",text:`${N}
|
|
77
|
+
\`\`\`
|
|
78
|
+
${_}
|
|
79
|
+
\`\`\``})}else if(w.kind==="directory"){const N=w.files!=null?`${K("attach.directoryHeader",{name:w.name})} ${K("attach.fileCount",{n:w.files.length})}`:K("attach.directoryHeader",{name:w.name}),_=w.textContent||i("attach.emptyDirectory");u.push({type:"text",text:`${N}
|
|
80
|
+
${_}`})}}const b=u.length===1&&u[0].type==="text"?u[0].text||t:u.length>0?u:t;try{const w=Me();this.postedUserUuids.add(w);const N=await ir(this.sessionId,{type:"user",uuid:w,content:t,message:{content:b}}),_=(f=N==null?void 0:N.event)==null?void 0:f.id;_&&this.setEntries(M=>M.map(C=>C.type==="user_message"&&C.id===d.id?{...C,id:_}:C))}catch(w){throw this.setEntries(N=>N.filter(_=>!(_.type==="user_message"&&_.id===d.id))),w}}async respondPermission(t,s,n){this.pendingPermissionDecisions.set(t,s);const l=Date.now();this.markPermissionSent(t,s?"allow":"deny",l);try{await le(this.sessionId,{type:"permission_response",approved:s,request_id:t,...n})}catch(c){throw this.pendingPermissionDecisions.delete(t),this.markPermissionSent(t,void 0,void 0),c}}markPermissionSent(t,s,n){this.setEntries(l=>l.map(c=>{if(c.type!=="tool_call")return c;const d=c.toolCall.permissionRequest;if((d==null?void 0:d.requestId)!==t)return c;const u={...d};return s?u.decision=s:delete u.decision,n!==void 0?u.sentAt=n:delete u.sentAt,{type:"tool_call",toolCall:{...c.toolCall,permissionRequest:u}}}))}isPermissionSettled(t){return this.settledPermissionIds.has(t)}rememberSettledPermission(t){if(this.settledPermissionIds.add(t),this.settledPermissionIds.size<=200)return;const s=this.settledPermissionIds.values().next().value;s!==void 0&&this.settledPermissionIds.delete(s)}settlePermission(t,s){if(!t||this.settledPermissionIds.has(t))return null;const n=this.pendingPermissionDecisions.get(t);let l;s==="allow"||s==="deny"?l=s:n!==void 0?l=n?"allow":"deny":s==="cancel"?l="cancel":l="allow",this.rememberSettledPermission(t);const c=this.pendingPermissionToolIds.get(t);this.pendingPermissionToolIds.delete(t),this.pendingPermissionDecisions.delete(t),c&&l!=="allow"&&this.pendingToolCallIds.delete(c);const d=l==="allow"?"running":l==="deny"?"rejected":"canceled";return this.setEntries(u=>u.map(b=>{var f;return b.type!=="tool_call"||((f=b.toolCall.permissionRequest)==null?void 0:f.requestId)!==t?b:{type:"tool_call",toolCall:{...b.toolCall,status:d,permissionRequest:void 0}}})),l}async interrupt(){this.finalizePendingToolCalls("canceled"),await or(this.sessionId)}async setPermissionMode(t){const s=Me();return await le(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_permission_mode",mode:t}}),s}async controlRoundTrip(t,s=8e3){const n=Me(),l=new Promise(d=>{this.pendingControlRequests.set(n,d)}),c=setTimeout(()=>{const d=this.pendingControlRequests.get(n);d&&(this.pendingControlRequests.delete(n),d({data:null,error:"timeout"}))},s);try{return await le(this.sessionId,{type:"control_request",request_id:n,request:t}),await l}catch(d){throw this.pendingControlRequests.delete(n),d}finally{clearTimeout(c)}}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 l=[];for(const c of n.data.suggestions)c&&typeof c=="object"&&typeof c.path=="string"&&l.push(c.path);return l}catch{return[]}}async respondElicitation(t,s,n){await le(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 l=n;typeof l.session_id!="string"||!l.session_id||s.push({sessionId:l.session_id,title:typeof l.title=="string"&&l.title?l.title:l.session_id.slice(0,8),modified:typeof l.modified=="number"?l.modified:0,...typeof l.created_at=="number"?{createdAt:l.created_at}:{},...typeof l.git_branch=="string"&&l.git_branch?{gitBranch:l.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=Me();return await le(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_effort",...t?{effort:t}:{effort:null}}}),s}async setTokenMode(t){const s=Me();return await le(this.sessionId,{type:"control_request",request_id:s,request:{subtype:"set_token_mode",mode:t}}),s}async setThinkingBudget(t){const s=Me();return await le(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,l=t.data.percentage;if(typeof s!="number"||typeof n!="number")return null;const c=t.data.categories,d=Array.isArray(c)?c.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 l=="number"?l:0,...typeof t.data.model=="string"&&t.data.model?{model:t.data.model}:{},...d&&d.length>0?{categories:d}:{}}}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"?i("adapter.stopTimeout"):s.error}:{ok:!0}}catch{return{ok:!1,error:i("adapter.stopFailed")}}}async getMcpServers(){var l;const s=(l=(await this.controlRoundTrip({subtype:"mcp_status"})).data)==null?void 0:l.mcpServers;if(!Array.isArray(s))return[];const n=[];for(const c of s){if(!c||typeof c!="object")continue;const d=c;if(typeof d.name!="string"||!d.name)continue;const u=d.status;if(u!=="connected"&&u!=="failed"&&u!=="needs-auth"&&u!=="pending"&&u!=="disabled")continue;const b=d.serverInfo,f=d.config;n.push({name:d.name,status:u,...b&&typeof b.name=="string"&&typeof b.version=="string"?{serverInfo:{name:b.name,version:b.version}}:{},...typeof d.error=="string"&&d.error?{error:d.error}:{},...typeof(f==null?void 0:f.url)=="string"&&f.url?{url:f.url}:{},...Array.isArray(d.tools)?{toolCount:d.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"?i("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"?i("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,l=s.effective&&typeof s.effective=="object"&&!Array.isArray(s.effective)?s.effective:{},c=s.sources,d=[];if(Array.isArray(c))for(const u of c){if(!u||typeof u!="object")continue;const b=u;typeof b.source=="string"&&d.push({source:b.source,settings:b.settings&&typeof b.settings=="object"&&!Array.isArray(b.settings)?b.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,tokenMode:typeof(n==null?void 0:n.tokenMode)=="string"?n.tokenMode:null},effective:l,sources:d}}async applyFlagSettings(t){const s=await this.controlRoundTrip({subtype:"apply_flag_settings",settings:t},15e3);return s.error?{ok:!1,error:s.error==="timeout"?i("adapter.requestTimeout"):s.error}:{ok:!0}}async rewindToMessage(t){await lr(this.sessionId,t)}async endSession(t){await le(this.sessionId,{type:"control_request",request_id:Me(),request:{subtype:"end_session",...t?{reason:t}:{}}})}}function Ka(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`}function jt({onBack:r,title:t,meta:s,actions:n}){return me(),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-16 w-full page-measure items-center gap-2 px-4 sm:h-12 sm:px-8",children:[e.jsx("button",{type:"button",onClick:r,"aria-label":i("nav.dashboard"),title:i("nav.dashboard"),className:"-mx-2 flex min-h-11 flex-shrink-0 items-center 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 sm:min-h-0",children:i("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-1 sm:gap-0.5",children:n}),e.jsx("span",{className:"mx-0.5 h-4 w-px flex-shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[e.jsx(dr,{className:"h-11 w-11 sm:h-7 sm:w-7"}),e.jsx(ur,{compact:!0,onSettingsClick:()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))}})]})]})})}function Ba(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 l=Math.floor(s/60),c=s%60;return c?`${l}h${c}m`:`${l}h`}function Ha(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 Qa({status:r}){return r==="running"?e.jsx(st,{className:"h-3 w-3 animate-spin text-brand-text"}):r==="completed"?e.jsx(Ra,{className:"h-3 w-3 text-status-success"}):r==="failed"||r==="stopped"?e.jsx(mr,{className:"h-3 w-3 text-status-error"}):null}function Wa({task:r,onStopTask:t,fullText:s}){const n=r.status==="running",l=n?r.durationMs??Date.now()-r.startTime:(r.endTime??Date.now())-r.startTime,c=Ha(r.tokenCount),d=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(Qa,{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:Ba(l)})]}),e.jsx("div",{className:`mt-0.5 text-text-secondary ${s?"line-clamp-2 break-words":"truncate"}`,children:u}),(c||d||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:[c&&e.jsxs("span",{className:"flex-shrink-0",children:["↕ ",c," tok"]}),d&&e.jsxs("span",{className:"flex-shrink-0",children:["· ",d]}),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:i("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(Ze,{className:"h-3.5 w-3.5"})})]})}function Ga(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 za(r){return r?Date.now()-r<6e4:!1}function Ya({onClose:r,session:t,liveStatus:s,pendingPermissions:n,onInterrupt:l,onDelete:c,onOpenQueue:d,subagentState:u,onStopTask:b,onEndSession:f}){const[w,N]=o.useState(!1),_=async()=>{await navigator.clipboard.writeText(t.id),N(!0),setTimeout(()=>N(!1),1500)},[M,C]=o.useState(!1),S=async()=>{if(!(!f||M)&&window.confirm(i("task.endConfirm"))){C(!0);try{await f(),r()}catch{C(!1)}}},P=n.length,I=t.worker,$=t.work_item,q=t.environment;return e.jsx(ke,{open:!0,onOpenChange:h=>{h||r()},children:e.jsxs(Ne,{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(Re,{children:e.jsx(Se,{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(Vr,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xr,{status:s||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:I&&(za(I.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[I&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Es,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:Ga(I.last_heartbeat_at)})]}),(t.environment_id||q)&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(jn,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:(q==null?void 0:q.machine_name)||t.environment_id||(q==null?void 0:q.id)})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Es,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:pr(t.created_at)})]})]})]}),e.jsx(Xa,{state:u,onStopTask:b}),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(pn,{className:"h-3.5 w-3.5"}),i("task.pendingActions")]}),P>0?e.jsxs("button",{type:"button",onClick:d,disabled:!d,className:"permit-mini",title:d?i("permission.reviewShort"):void 0,"aria-label":K("permission.pendingAria",{n:P}),children:[e.jsx("span",{className:"permit-mini__count",children:P}),e.jsxs("span",{className:"permit-mini__body",children:[e.jsx("span",{className:"permit-mini__lead",children:i("task.pendingLead")}),e.jsxs("span",{className:"permit-mini__meta",children:[n.slice(0,2).map(h=>h.toolName).join(" · "),P>2?` +${P-2}`:""]})]}),d&&e.jsxs("span",{className:"permit-mini__action",children:[i("permission.reviewShort")," →"]})]}):e.jsx("p",{className:"text-xs text-text-muted",children:i("task.noPendingActions")})]}),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(Pa,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:l,className:"flex-1 rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-2 transition-colors",children:"Interrupt"}),f&&e.jsx("button",{onClick:S,disabled:M,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:i("task.endHint"),children:M?"Ending…":"End session"}),e.jsxs("button",{onClick:c,className:"flex-1 rounded-md border border-status-error/30 px-3 py-1.5 text-xs text-status-error hover:bg-status-error/10 transition-colors",children:[e.jsx(hr,{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(Na,{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:_,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:w?"✓":"⧉"})]})]}),$&&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:$.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:$.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})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:bn(t.source==="acp"?"acp":q==null?void 0:q.worker_type).fullLabel})]})]})]})]})]})})}const Va={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"},Ja=new Set(["dream"]);function Xa({state:r,onStopTask:t}){const s=Object.values(r.tasks).some(b=>b.status==="running"),n=Object.values(r.tasks).some(b=>b.status!=="running"&&b.evictAfter!==void 0),[,l]=o.useState(0);o.useEffect(()=>{if(!s&&!n)return;const b=setInterval(()=>{l(f=>f+1)},1e3);return()=>clearInterval(b)},[s,n]);const c=$a(r),d=c.filter(b=>b.status==="running").length,u=c.length-d;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(_a,{className:"h-3.5 w-3.5"}),i("task.backgroundTasks")]}),c.length>0&&e.jsx("span",{className:"font-mono text-[10px] text-text-muted",children:d>0&&u>0?K("task.mixedCount",{running:d,recent:u}):d>0?K("task.runningCount",{count:d}):K("task.recentCount",{count:c.length})})]}),c.length===0?e.jsx("p",{className:"text-xs text-text-muted",children:i("task.noBackgroundTasks")}):e.jsx("div",{className:"max-h-[38vh] space-y-2 overflow-y-auto overscroll-contain pr-1",children:Oa(c).map(b=>{const f=!Ja.has(b.taskType),w=Va[b.taskType]??"task.type.tasks";return e.jsxs("div",{className:"space-y-1",children:[f&&e.jsxs("div",{className:"pl-1 text-[10px] font-medium uppercase tracking-wide text-text-muted/80",children:[i(w)," (",b.tasks.length,")"]}),b.tasks.map(N=>e.jsx(Wa,{task:N,onStopTask:t,fullText:!0},N.taskId))]},b.taskType)})})]})}const Za={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"},ei={connected:"mcp.status.connected",failed:"mcp.status.failed","needs-auth":"mcp.status.needsAuth",pending:"mcp.status.pending",disabled:"mcp.status.disabled"};function ti({onClose:r,fetchServers:t,onToggle:s,onReconnect:n}){me();const[l,c]=o.useState(null),[d,u]=o.useState(null),[b,f]=o.useState(null),[w,N]=o.useState(null),_=o.useCallback(async()=>{f(null),N(null);try{const S=await t();c(S),u(null)}catch(S){St("[McpPanel] fetch failed",S),u(i("mcp.loadFailed"))}},[t]);o.useEffect(()=>{_()},[_]);const M=async S=>{const P=S.status==="disabled";f(`toggle:${S.name}`),N(null);try{const I=await s(S.name,P);I.ok||N(I.error||i("mcp.toggleFailed"))}finally{await _()}},C=async S=>{f(`reconnect:${S.name}`),N(null);try{const P=await n(S.name);P.ok||N(P.error||i("mcp.reconnectFailed"))}finally{await _()}};return e.jsx(ke,{open:!0,onOpenChange:S=>{S||r()},children:e.jsxs(Ne,{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(Re,{children:e.jsxs(Se,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Bt,{className:"h-4 w-4"}),i("session.mcp.title")]})}),e.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[w&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:w}),l===null&&!d&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(st,{className:"h-3.5 w-3.5 animate-spin"}),i("mcp.loading")]}),d&&e.jsx("p",{className:"text-xs text-status-error",children:d}),l!==null&&l.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:i("mcp.empty")}),l==null?void 0:l.map(S=>{const P=b===`toggle:${S.name}`,I=b===`reconnect:${S.name}`,$=S.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:S.name}),e.jsx("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${Za[S.status]}`,children:i(ei[S.status])})]}),e.jsxs("div",{className:"mt-0.5 truncate text-xs text-text-muted",children:[S.serverInfo?`${S.serverInfo.name} v${S.serverInfo.version}`:S.url||"stdio",S.toolCount!==void 0&&` · ${K("mcp.toolCount",{n:S.toolCount})}`]}),S.error&&e.jsx("div",{className:"mt-1 truncate text-xs text-status-error",title:S.error,children:S.error})]}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void C(S),disabled:I||$,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:i("mcp.reconnect"),children:e.jsx(Xr,{className:`h-3.5 w-3.5 ${I?"animate-spin":""}`})}),e.jsx("button",{type:"button",role:"switch","aria-checked":!$,onClick:()=>void M(S),disabled:P,className:`relative h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${$?"bg-surface-3":"bg-brand"}`,title:$?i("mcp.enable"):i("mcp.disable"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${$?"left-0.5":"left-4.5"}`})})]})]})},S.name)})]})]})})}const wn=[{key:"autoMemoryEnabled",labelKey:"settings.autoMemory",defaultValue:!0},{key:"teamMemoryEnabled",labelKey:"settings.teamMemory",defaultValue:!1}],si=new Set(wn.map(r=>r.key));function ni(r){if(r==null)return i("settings.unset");if(typeof r=="string")return r;try{return JSON.stringify(r)}catch{return String(r)}}function tn(r){if(r==null)return i("settings.unset");if(typeof r=="object")try{return JSON.stringify(r,null,2)}catch{return String(r)}return String(r)}function ri({onClose:r,fetchSettings:t,onApply:s}){me();const[n,l]=o.useState(null),[c,d]=o.useState(null),[u,b]=o.useState(""),[f,w]=o.useState(null),[N,_]=o.useState(null),[M,C]=o.useState(null),[S,P]=o.useState(!1),I=o.useCallback(async()=>{w(null),_(null),C(null),P(!1);try{const p=await t();l(p),d(p?null:i("settings.loadFailed"))}catch(p){St("[SettingsDrawer] fetch failed",p),d(i("settings.loadFailed"))}},[t]);o.useEffect(()=>{I()},[I]);const $=o.useMemo(()=>n?Object.entries(n.effective).filter(([,p])=>p!==void 0).filter(([p])=>!p.startsWith("memoryV2")).sort(([p],[O])=>p.localeCompare(O)):[],[n]),q=o.useMemo(()=>{const p=u.trim().toLowerCase();return p?$.filter(([O,U])=>`${O} ${ni(U)}`.toLowerCase().includes(p)):$},[$,u]),h=p=>typeof p[1]=="boolean",g=o.useMemo(()=>q.filter(h).filter(([p])=>!si.has(p)),[q]),k=o.useMemo(()=>q.filter(p=>!h(p)),[q]),x=o.useMemo(()=>M===null?null:$.find(([p])=>p===M)??null,[$,M]),T=async()=>{if(x)try{await navigator.clipboard.writeText(tn(x[1])),P(!0),window.setTimeout(()=>P(!1),1500)}catch(p){St("[SettingsDrawer] copy failed",p)}},y=async(p,O)=>{w(p),_(null);try{const U=await s({[p]:!O});U.ok||_(U.error||i("settings.writeFailed"))}finally{await I()}};return e.jsx(ke,{open:!0,onOpenChange:p=>{p||r()},children:e.jsxs(Ne,{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(Re,{children:e.jsxs(Se,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Ht,{className:"h-4 w-4"}),i("session.settings.title")]})}),e.jsxs("div",{className:"mt-3 space-y-4 text-sm",children:[N&&e.jsx("div",{className:"rounded-md bg-status-error/10 px-3 py-2 text-xs text-status-error",children:N}),n===null&&!c&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-text-muted",children:[e.jsx(st,{className:"h-3.5 w-3.5 animate-spin"}),i("settings.loading")]}),c&&e.jsx("p",{className:"text-xs text-status-error",children:c}),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:i("settings.model")}),e.jsx("code",{className:"font-mono text-text-secondary",children:n.applied.model||i("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:i("settings.hint")})]}),x?e.jsxs("section",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>{C(null),P(!1)},className:"flex items-center gap-1.5 text-xs text-text-muted transition-colors hover:text-text-primary",children:[e.jsx(Zr,{className:"h-3.5 w-3.5"}),i("settings.back")]}),e.jsx("div",{className:"break-all font-mono text-xs font-medium text-text-primary",children:x[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:tn(x[1])}),e.jsxs("button",{type:"button",onClick:()=>void T(),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:[S?e.jsx(Wt,{className:"h-3.5 w-3.5 text-status-success"}):e.jsx(ta,{className:"h-3.5 w-3.5"}),S?i("settings.copied"):i("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(et,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:u,onChange:p=>b(p.target.value),placeholder:i("settings.searchPlaceholder"),className:"w-full bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"})]}),q.length===0&&e.jsx("p",{className:"text-xs text-text-muted",children:i("settings.noMatch")}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[10px] font-medium uppercase tracking-wide text-text-muted",children:i("settings.memorySection")}),wn.map(p=>{const O=n.effective[p.key],U=typeof O=="boolean"?O:p.defaultValue,X=f===p.key;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 text-xs text-text-primary",children:i(p.labelKey)}),e.jsx("button",{type:"button",role:"switch","aria-checked":U,disabled:X,onClick:()=>void y(p.key,U),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${U?"bg-brand":"bg-surface-3"}`,title:U?i("settings.turnOff"):i("settings.turnOn"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${U?"left-4.5":"left-0.5"}`})})]},p.key)}),e.jsx("p",{className:"text-[10px] leading-relaxed text-text-muted",children:i("settings.memoryHint")})]}),g.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:K("settings.togglable",{n:g.length})}),g.map(([p,O])=>{const U=f===p;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:p}),e.jsx("button",{type:"button",role:"switch","aria-checked":O,disabled:U,onClick:()=>void y(p,O),className:`relative h-5 w-9 flex-shrink-0 rounded-full transition-colors disabled:opacity-50 ${O?"bg-brand":"bg-surface-3"}`,title:O?i("settings.turnOff"):i("settings.turnOn"),children:e.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all ${O?"left-4.5":"left-0.5"}`})})]},p)})]}),k.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:K("settings.readOnly",{n:k.length})}),k.map(([p])=>e.jsxs("button",{type:"button",onClick:()=>C(p),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:i("settings.viewDetail"),children:[e.jsx("span",{className:"truncate font-mono text-xs text-text-primary",children:p}),e.jsx(ya,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"})]},p))]})]})]})]})]})})}function ai({onClose:r,onAsk:t}){me();const[s,n]=o.useState([]),[l,c]=o.useState(""),[d,u]=o.useState(!1),b=async()=>{const f=l.trim();if(!f||d)return;const w=Date.now();n(N=>[...N,{id:w,question:f,answer:null}]),c(""),u(!0);try{const N=await t(f);n(_=>_.map(M=>M.id===w?{...M,answer:N??i("sideQuestion.noAnswer"),error:N===null}:M))}finally{u(!1)}};return e.jsx(ke,{open:!0,onOpenChange:f=>{f||r()},children:e.jsxs(Ne,{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(Re,{children:e.jsxs(Se,{className:"flex items-center gap-2 font-display font-semibold text-text-primary",children:[e.jsx(Kt,{className:"h-4 w-4"}),i("sideQuestion.title")]})}),e.jsx("p",{className:"mt-1 text-[10px] leading-relaxed text-text-muted",children:i("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:i("sideQuestion.empty")}),s.map(f=>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:f.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:f.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:f.error?"text-status-error":"",children:e.jsx(fr,{children:f.answer})})})]})]},f.id))]}),e.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[e.jsx("textarea",{value:l,onChange:f=>c(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.shiftKey&&!f.nativeEvent.isComposing&&(f.preventDefault(),b())},rows:Math.min(4,Math.max(1,l.split(`
|
|
81
|
+
`).length)),placeholder:i("sideQuestion.placeholder"),disabled:d,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 b(),disabled:d||!l.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:i("sideQuestion.send"),children:d?e.jsx(st,{className:"h-4 w-4 animate-spin"}):e.jsx(yr,{className:"h-4 w-4"})})]})]})})}function ii({request:r,handlers:t,now:s,onRetry:n,variant:l}){const c=r.toolName,d=r.toolInput,u=r.description||"";if(r.sentAt!==void 0){const b=c!=="AskUserQuestion"&&c!=="ExitPlanMode";return e.jsx(gr,{decision:r.decision??"allow",stale:fn(r.sentAt,s),onRetry:b&&n?()=>n(r.requestId):void 0})}if(c==="AskUserQuestion"){const b=d.questions||[];return e.jsx(br,{requestId:r.requestId,questions:b,description:u,onSubmit:f=>t.onSubmitAnswers(r.requestId,f,b),onSkip:()=>t.onReject(r.requestId)})}if(c==="ExitPlanMode"){const b=d.plan||"";return e.jsx(jr,{requestId:r.requestId,planContent:b,description:u,onSubmit:(f,w)=>t.onSubmitPlan(r.requestId,f,w)})}return e.jsx(wr,{requestId:r.requestId,toolName:c,toolInput:d,description:u,suggestions:r.suggestions,onApprove:()=>t.onApprove(r.requestId),onApproveAlways:r.suggestions&&r.suggestions.length>0?()=>t.onApproveAlways(r.requestId,r.suggestions):void 0,onReject:()=>t.onReject(r.requestId),variant:l})}function vn(r){return r==="AskUserQuestion"?i("permission.waitingAnswer"):r==="ExitPlanMode"?i("permission.waitingPlan"):i("permission.waitingApprove")}function oi(r){return r==="AskUserQuestion"?i("permission.answerShort"):r==="ExitPlanMode"?i("permission.reviewShort"):i("permission.allowShort")}function li({requests:r,onView:t,onOpenQueue:s,onApprove:n}){if(me(),r.length===0)return null;const l=r.filter(b=>b.sentAt===void 0);if(l.length===0)return e.jsx("div",{className:"mx-auto w-full page-measure px-4 pb-1 sm:px-8",children:e.jsxs("button",{type:"button",onClick:s,className:"flex w-full items-center gap-2 border-l-2 border-border bg-surface-1/60 px-3 py-2 text-text-muted transition-colors hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",children:[e.jsx(st,{className:"h-3.5 w-3.5 flex-shrink-0 animate-spin text-approve-text","aria-hidden":"true"}),e.jsx("span",{role:"status","aria-live":"polite",className:"min-w-0 flex-1 text-left text-xs",children:i("permission.syncing")}),e.jsx("span",{className:"permit-mini__action flex-shrink-0",children:i("permission.view")})]})});const c=l[0],d=vn(c.toolName),u=c.toolName==="AskUserQuestion"||c.toolName==="ExitPlanMode";return e.jsx("div",{className:"mx-auto w-full page-measure px-4 pb-1 sm:px-8",children:e.jsxs("div",{className:"permit-bar",children:[e.jsxs("div",{className:"permit-bar__main",children:[e.jsx(pn,{className:"h-4 w-4 flex-shrink-0 text-approve-text","aria-hidden":"true"}),e.jsx("span",{className:"permit-bar__label",children:d}),e.jsxs("span",{className:"permit-bar__detail",children:[c.toolName,c.description?` · ${c.description}`:""]})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"sr-only",children:K("permission.pendingAnnounce",{n:l.length,label:d,tool:c.toolName})}),e.jsx("button",{type:"button",onClick:()=>u?t(c):n(c.requestId),className:hn("permit-btn",u?"permit-btn--brand":"permit-btn--primary"),children:oi(c.toolName)}),e.jsx("button",{type:"button",onClick:()=>t(c),title:i("permission.evidenceHint"),"aria-label":K("permission.revealAria",{tool:c.toolName}),className:"permit-btn permit-btn--secondary",children:i("permission.view")}),l.length>1&&e.jsx("button",{type:"button",onClick:s,className:"permit-btn permit-btn--quiet",children:K("permission.viewAll",{n:l.length})})]})})}function ci({open:r,onClose:t,requests:s,initialRequestId:n,now:l,errorMessage:c,errorRequestId:d,onRetry:u,...b}){me();const[f,w]=o.useState(null),N=o.useRef(!1),_=o.useRef(new Map),M=s.filter(x=>x.sentAt===void 0),C=s.find(x=>x.requestId===f)??M[0]??s[0];if(o.useEffect(()=>{var x,T;if(r&&!N.current){const y=n&&s.some(p=>p.requestId===n)?n:((x=M[0])==null?void 0:x.requestId)??((T=s[0])==null?void 0:T.requestId)??null;w(y),requestAnimationFrame(()=>{var p;y&&((p=_.current.get(y))==null||p.focus())})}N.current=r},[r,n,s,M]),o.useEffect(()=>{r&&s.length===0&&t()},[r,s.length,t]),o.useEffect(()=>{var T,y;if(!r||!f||s.some(p=>p.requestId===f))return;const x=((T=M[0])==null?void 0:T.requestId)??((y=s[0])==null?void 0:y.requestId)??null;w(x),requestAnimationFrame(()=>{var p;x&&((p=_.current.get(x))==null||p.focus())})},[r,f,s,M]),s.length===0)return null;const S=C&&d===C.requestId?c:void 0,P=x=>{if(!C)return;const T=s.findIndex(p=>p.requestId===C.requestId);if(T<0)return;const y=s[Math.min(Math.max(T+x,0),s.length-1)];w(y.requestId),requestAnimationFrame(()=>{var p;return(p=_.current.get(y.requestId))==null?void 0:p.focus()})};if(!C)return null;const I=x=>x.sentAt===void 0?vn(x.toolName):fn(x.sentAt,l)?i("permission.ackStale"):i("permission.syncing"),$=C.toolName!=="AskUserQuestion"&&C.toolName!=="ExitPlanMode",q=s.findIndex(x=>x.requestId===C.requestId),h=String(Math.max(q,0)+1).padStart(2,"0"),g=xn(C.suggestions,C.toolName)[0],k=I(C);return e.jsx(ke,{open:r,onOpenChange:x=>{x||t()},children:e.jsxs(Ne,{showCloseButton:!1,onKeyDown:x=>{const T=x.target;T.tagName==="INPUT"||T.tagName==="TEXTAREA"||T.tagName==="SELECT"||T.isContentEditable||(x.key==="ArrowUp"?(x.preventDefault(),P(-1)):x.key==="ArrowDown"&&(x.preventDefault(),P(1)))},className:"permit-sheet permit-docket translate-x-0 translate-y-0",children:[e.jsxs(Re,{className:"permit-masthead permit-docket__masthead",children:[e.jsxs("div",{className:"permit-docket__top",children:[e.jsxs("span",{className:"permit-docket__runhead",children:[i("permission.docketRunhead")," · ",h]}),e.jsx("button",{type:"button",onClick:t,"aria-label":i("common.close"),title:i("common.close"),className:"permit-close",children:e.jsx(Ze,{className:"h-4 w-4","aria-hidden":"true"})})]}),e.jsx(Se,{className:"permit-docket__question",children:$&&C.sentAt===void 0?K("permission.allowQuestion",{tool:C.toolName}):i("permission.queueHeading")}),$?C.description?e.jsx(qs,{className:"permit-docket__lede",children:C.description}):null:e.jsx(qs,{className:"permit-docket__lede",children:i("permission.queueListHint")}),e.jsxs("dl",{className:"permit-docket__meta",children:[e.jsx("dt",{children:i("permission.docketTool")}),e.jsx("dd",{children:C.toolName}),e.jsx("dt",{children:i("permission.docketState")}),e.jsx("dd",{children:k}),e.jsx("dt",{children:i("permission.docketScope")}),e.jsx("dd",{children:(g==null?void 0:g.scope)??i("permission.scope.localSettings")})]})]}),s.length>1&&e.jsx("ul",{className:"permit-docket__list",children:s.map((x,T)=>{const y=x.requestId===C.requestId;return e.jsx("li",{children:e.jsxs("button",{ref:p=>{p?_.current.set(x.requestId,p):_.current.delete(x.requestId)},type:"button",onClick:()=>w(x.requestId),"aria-expanded":y,className:hn("permit-docket__row",y&&"permit-docket__row--active"),children:[e.jsx("span",{className:"permit-docket__row-index","aria-hidden":"true",children:String(T+1).padStart(2,"0")}),e.jsx("span",{className:"permit-docket__row-name",children:x.toolName}),e.jsx("span",{className:"permit-docket__row-desc",children:x.description}),e.jsx("span",{className:"permit-docket__row-state",children:I(x)})]})},x.requestId)})}),e.jsxs("div",{className:"permit-docket__body",children:[S&&e.jsxs("div",{role:"alert",className:"permit-error",children:[e.jsx("span",{className:"permit-error__text",children:S}),u&&e.jsx("button",{type:"button",onClick:()=>u(C.requestId),className:"permit-btn permit-btn--secondary permit-btn--tiny",children:i("common.retry")})]}),e.jsx(ii,{request:C,handlers:b,now:l,onRetry:u,variant:"docket"})]})]})})}function di(r){const[t,s]=o.useState([]),[n,l]=o.useState(!0),[c,d]=o.useState(null),u=o.useCallback(async()=>{l(!0),d(null);try{const w=await vr(r);s(w)}catch(w){d(w instanceof Error?w.message:"Failed to load shares")}finally{l(!1)}},[r]);o.useEffect(()=>{u()},[u]);const b=o.useCallback(async w=>{d(null);try{const N=await kr(r,w);return await u(),N}catch(N){throw d(N instanceof Error?N.message:"Failed to create share"),N}},[r,u]),f=o.useCallback(async w=>{d(null);try{await Nr(r,w),await u()}catch(N){throw d(N instanceof Error?N.message:"Failed to revoke share"),N}},[r,u]);return{shares:t,isLoading:n,error:c,createShare:b,revokeShare:f,refresh:u}}function ui({open:r,onClose:t,sessionId:s,sessionTitle:n}){me();const{shares:l,isLoading:c,error:d,createShare:u,revokeShare:b}=di(s),[f,w]=o.useState("user"),[N,_]=o.useState(""),[M,C]=o.useState(""),[S,P]=o.useState("read"),[I,$]=o.useState(""),[q,h]=o.useState(!1),[g,k]=o.useState(null),[x,T]=o.useState(""),[y,p]=o.useState(!1),[O,U]=o.useState(!1);o.useEffect(()=>{r&&(w("user"),_(""),C(""),P("read"),$(""),h(!1),k(null),T(""),p(!1),U(!1))},[r]);const X=async()=>{h(!0),T(""),k(null);try{const A={grantedTo:f==="user"?{userId:N.trim()}:{teamId:M.trim()},permission:S};I.trim()&&(A.expiresAt=I.trim());const ne=await u(A);k(`${window.location.origin}/code/s/${ne.shareToken}`)}catch(A){T(A instanceof Error?A.message:"Failed to create share")}finally{h(!1)}},se=async A=>{try{await b(A)}catch{}},Q=async()=>{if(!g)return;U(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(g),p(!0),setTimeout(()=>p(!1),2e3);return}}catch{}const A=document.createElement("textarea");A.value=g,A.style.position="fixed",A.style.opacity="0",document.body.appendChild(A),A.select();try{document.execCommand("copy"),p(!0),setTimeout(()=>p(!1),2e3)}catch{U(!0)}document.body.removeChild(A)};return e.jsx(ke,{open:r,onOpenChange:A=>{A||t()},children:e.jsxs(Ne,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Re,{children:e.jsxs(Se,{className:"font-display text-lg font-semibold text-text-primary",children:[i("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:i("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>w("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${f==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:i("share.user")}),e.jsx("button",{onClick:()=>w("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${f==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:i("share.team")})]}),f==="user"?e.jsx(ea,{onSelect:_,placeholder:i("share.userIdPlaceholder"),actionLabel:i("share.selectUser")}):e.jsx("input",{type:"text",value:M,onChange:A=>C(A.target.value),placeholder:i("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"}),f==="user"&&N&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[i("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:N})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:i("share.permission")}),e.jsxs("select",{value:S,onChange:A=>P(A.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:i("share.permissionRead")}),e.jsx("option",{value:"write",children:i("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:i("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:I,onChange:A=>$(A.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"})]}),(x||d)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:x||d}),g&&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:i("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:g}),e.jsx("button",{onClick:Q,className:"shrink-0 rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:y?i("share.copied"):i("share.copy")})]}),O&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:i("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:i("share.existingShares")}),c?e.jsx("p",{className:"text-sm text-text-muted",children:i("share.loading")}):l.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:i("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:l.map(A=>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:A.granted_to_user||A.granted_to_team||"Unknown"}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[A.permission==="write"?i("share.permissionWrite"):i("share.permissionRead"),A.expires_at?` · expires ${A.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>se(A.id),className:"shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:i("share.revoke")})]},A.id))})]})]}),e.jsxs(Jr,{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:i("common.close")}),e.jsx("button",{onClick:X,disabled:q||(f==="user"?!N.trim():!M.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:q?i("common.creating"):i("share.createShare")})]})]})})}function mi(r){const t=new Date,s=new Date(t.getTime()-1440*60*1e3),n=(d,u)=>d.getFullYear()===u.getFullYear()&&d.getMonth()===u.getMonth()&&d.getDate()===u.getDate(),l={today:[],yesterday:[],earlier:[]};for(const d of r){const u=new Date(d.modified||0);n(u,t)?l.today.push(d):n(u,s)?l.yesterday.push(d):l.earlier.push(d)}return[["today",i("resume.today")],["yesterday",i("resume.yesterday")],["earlier",i("resume.earlier")]].map(([d,u])=>({label:u,items:l[d]})).filter(d=>d.items.length>0)}function xi(r){return r?new Date(r).toLocaleString():""}function pi({open:r,onClose:t,adapter:s,onResume:n}){const l=me(),[c,d]=o.useState([]),[u,b]=o.useState(!1),[f,w]=o.useState("");o.useEffect(()=>{if(!r)return;let _=!1;return b(!0),w(""),d([]),s.listResumableSessions().then(M=>{_||d(M)}).catch(M=>{_||w(M instanceof Error?M.message:String(M))}).finally(()=>{_||b(!1)}),()=>{_=!0}},[r,s]);const N=o.useMemo(()=>mi(c),[c,l]);return e.jsx(ke,{open:r,onOpenChange:_=>{_||t()},children:e.jsxs(Ne,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(Re,{children:e.jsx(Se,{className:"font-display text-lg font-semibold text-text-primary",children:i("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:i("resume.loading")}),!u&&f&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:f}),!u&&!f&&c.length===0&&e.jsx("p",{className:"py-6 text-center text-sm text-text-muted",children:i("resume.empty")}),!u&&!f&&N.map(_=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-medium text-text-muted",children:_.label}),e.jsx("div",{className:"space-y-1",children:_.items.map(M=>e.jsxs("button",{type:"button",onClick:()=>n(M),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:M.title}),e.jsxs("p",{className:"truncate text-xs text-text-muted",children:[xi(M.modified),M.gitBranch?` · ${M.gitBranch}`:""]})]},M.sessionId))})]},_.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:i("common.cancel")})})]})})}const sn=["working","episodic","semantic","procedural"],hi=["user","feedback","project","reference"];function fi({refreshTick:r,recall:t,dreaming:s,onDreamTrigger:n}){me();const{myTeams:l}=Sr(),[c,d]=o.useState(null),[u,b]=o.useState("memories"),[f,w]=o.useState("personal"),[N,_]=o.useState([]),[M,C]=o.useState(!1),[S,P]=o.useState(""),[I,$]=o.useState(""),[q,h]=o.useState(null),[g,k]=o.useState(null),[x,T]=o.useState(!1),[y,p]=o.useState(Ot),O=aa(),[U,X]=o.useState(""),[se,Q]=o.useState(null),[A,ne]=o.useState(!1),Z=o.useRef(null);o.useEffect(()=>{yn().then(d).catch(()=>d(null))},[]);const ce=o.useCallback(async()=>{C(!0),P("");try{_(await _r(f))}catch{P(i("memorySidebar.loadFailed"))}finally{C(!1)}},[f]);o.useEffect(()=>{ce()},[ce,r]),o.useEffect(()=>{const j=()=>void ce();return window.addEventListener("focus",j),()=>window.removeEventListener("focus",j)},[ce]),o.useEffect(()=>{u==="governance"&&Cr().then(k).catch(()=>k(null))},[u,r]),o.useEffect(()=>{Z.current&&clearTimeout(Z.current);const j=I.trim();if(!j){h(null);return}return Z.current=setTimeout(()=>{Er(j).then(h).catch(()=>h([]))},300),()=>{Z.current&&clearTimeout(Z.current)}},[I]);const Ue=j=>O.expandedKey===j?e.jsx("pre",{className:"mt-1 max-h-48 overflow-y-auto whitespace-pre-wrap rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-secondary",children:O.fileContent[j]??"…"}):null,be=(c==null?void 0:c.mode)==="sqlite",[oe,G]=o.useState(!1),[pe,z]=o.useState(""),[je,we]=o.useState(""),[ie,Ie]=o.useState("project"),[Le,nt]=o.useState(""),[Ke,Ae]=o.useState(""),[re,_e]=o.useState(!1),V=()=>{var j;G(!0),z(""),we(""),Ie("project"),nt(""),Ae(((j=l[0])==null?void 0:j.id)??"")},Ce=be&&f==="team",rt=pe.trim().length>0&&Le.trim().length>0&&!re&&(!Ce||!!Ke),_t=async()=>{if(rt){_e(!0),P("");try{await Ir({scope:f,name:pe.trim(),description:je.trim()||void 0,type:ie,content:Le,...Ce?{teamId:Ke}:{}}),G(!1),await ce()}catch(j){P(j instanceof Error?j.message:i("memorySidebar.createFailed"))}finally{_e(!1)}}},ee=()=>{n==null||n()},at=o.useCallback(async()=>{const j=U.trim();if(!(!j||A)){ne(!0),Q(null);try{Q(await Tr(j,5))}catch{Q([])}finally{ne(!1)}}},[U,A]),he=(c==null?void 0:c.teamEnabled)===!0,Be=c==null?void 0:c.automation,Ct=he&&u==="memories"&&!I,Pe=o.useMemo(()=>ia(N,y),[N,y]),He=o.useMemo(()=>oa(N),[N]),Ee=(y.types.size>0?1:0)+(la(y.layers)?0:1)+(y.days!==null?1:0)+(y.minConfidence>0?1:0)+(y.minAccessCount>0?1:0);return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center gap-4 px-3 pt-2 pb-1",children:[["memories","governance"].map(j=>e.jsxs("button",{type:"button",onClick:()=>b(j),"aria-pressed":u===j,className:`relative pb-1 text-xs tracking-wide transition-colors ${u===j?"font-semibold text-text-primary":"text-text-muted hover:text-text-secondary"}`,children:[i(j==="memories"?"memorySidebar.memoriesTab":"memorySidebar.governanceTab"),e.jsx("span",{"aria-hidden":"true",className:`absolute inset-x-0 -bottom-2 h-px bg-brand transition-opacity duration-200 ${u===j?"opacity-100":"opacity-0"}`})]},j)),e.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[u==="memories"&&!I&&e.jsx("button",{type:"button",onClick:oe?()=>G(!1):V,disabled:f==="team"&&!he,className:"rounded p-1 text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50",title:i("memorySidebar.new"),children:oe?e.jsx(Mr,{className:"h-3 w-3"}):e.jsx(Rr,{className:"h-3 w-3"})}),u==="memories"&&!I&&e.jsxs("button",{type:"button",onClick:()=>T(j=>!j),"data-testid":"memory-filter-toggle",className:`relative rounded p-1 transition-colors ${x||Ee>0?"text-brand-text":"text-text-secondary hover:bg-surface-2 hover:text-text-primary"}`,title:i("memorySidebar.filters"),children:[e.jsx($s,{className:"h-3 w-3"}),Ee>0&&!x&&e.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-3 min-w-3 items-center justify-center rounded-full bg-brand px-0.5 text-[10px] font-bold text-white",children:Ee})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[e.jsx(et,{className:"h-3 w-3 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:I,onChange:j=>$(j.target.value),placeholder:i("memorySidebar.searchPlaceholder"),title:i("memorySidebar.searchHint"),className:"w-full min-w-0 bg-transparent text-xs text-text-primary placeholder:text-text-muted focus:outline-none"}),e.jsx("span",{className:"flex-shrink-0 font-mono text-[10px] tabular-nums text-text-muted",children:q!==null?q.length:Pe.length})]}),S&&e.jsx("p",{className:"px-3 py-1 text-xs text-status-error",children:S}),x&&u==="memories"&&!I&&e.jsxs("div",{className:"space-y-2.5 px-3 pb-3","data-testid":"memory-filter-panel",children:[e.jsx(ca,{filters:y,onChange:p}),e.jsx(da,{filters:y,onChange:p,counts:He}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-text-muted",children:i("memories.filter.time")}),e.jsx("div",{className:"flex rounded-md bg-surface-2 p-0.5 text-[10px]",children:ua.map(j=>e.jsx("button",{type:"button",onClick:()=>p(te=>({...te,days:j.value})),className:`rounded px-1.5 py-0.5 ${y.days===j.value?"bg-brand-light text-white":"text-text-muted hover:text-text-secondary"}`,children:i(j.labelKey)},String(j.value)))})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:i("memories.filter.confidence"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:i("memories.filter.confidence")}),e.jsx("input",{type:"range",min:0,max:100,step:10,value:y.minConfidence*100,onChange:j=>p(te=>({...te,minConfidence:Number(j.target.value)/100})),style:{"--mem-pct":`${y.minConfidence*100}%`},className:"mem-slider min-w-16 flex-1"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${y.minConfidence>0?"text-brand-text":"text-text-muted"}`,children:K("memories.filter.minConfidence",{pct:y.minConfidence*100})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",title:i("memories.filter.access"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:i("memories.filter.access")}),e.jsx("input",{type:"range",min:0,max:10,step:1,value:y.minAccessCount,onChange:j=>p(te=>({...te,minAccessCount:Number(j.target.value)})),style:{"--mem-pct":`${y.minAccessCount*10}%`},className:"mem-slider min-w-12 flex-1"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${y.minAccessCount>0?"text-brand-text":"text-text-muted"}`,children:K("memories.filter.minAccess",{n:y.minAccessCount})}),e.jsx("button",{type:"button",onClick:()=>p(Ot),disabled:!Os(y),className:"flex-shrink-0 rounded px-1 py-0.5 text-[10px] text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-muted",children:i("memories.filter.clear")})]})]}),Be&&Be.mode!=="normal"&&e.jsx("div",{className:"border-b border-status-warning/30 bg-status-warning/10 px-3 py-1.5 text-xs text-status-warning",children:Be.mode==="sa"?i("memorySidebar.saModeBanner"):i("memorySidebar.poorModeBanner")}),q!==null&&e.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-1.5",children:q.length===0?e.jsx("p",{className:"py-8 text-center text-xs text-text-muted",children:i("memorySidebar.noResults")}):e.jsx("ul",{className:"space-y-1",children:q.map(j=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void O.toggleExpand({path:j.path}),className:"w-full rounded-md px-2 py-1.5 text-left hover:bg-surface-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-xs font-medium text-text-primary",children:j.name}),e.jsx(ma,{layer:j.layer})]}),e.jsx("ul",{className:"mt-0.5 space-y-0.5",children:j.matches.map((te,De)=>e.jsxs("li",{className:"flex gap-1.5 text-[10px] leading-relaxed",children:[e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:te.line===0?"file":`L${te.line}`}),e.jsx("span",{className:"truncate text-text-secondary",children:te.text})]},De))})]}),Ue(j.path)]},j.path))})}),q===null&&u==="memories"&&e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-1.5",children:[t&&t.hits.length>0&&e.jsxs("div",{className:"mb-3 border-l-2 border-brand/30 pl-2.5",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-brand-text",children:i("memorySidebar.recallTitle")}),e.jsxs("p",{className:"mb-1 truncate text-[10px] text-text-muted",title:t.query,children:[i("memorySidebar.recallQuery"),": ",t.query]}),e.jsx("ul",{className:"space-y-0.5",children:t.hits.slice(0,5).map(j=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void O.toggleExpand({path:j.path}),className:"flex w-full items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-xs hover:bg-surface-2",title:j.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:j.path.replace(/^team\//,"").replace(/\.md$/,"")}),j.score!==void 0&&e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(j.score*100).toFixed(0),"%"]})]}),Ue(j.path)]},j.path))})]}),Ct&&e.jsx("div",{className:"mb-2 flex items-center gap-4 px-1 text-xs",children:["personal","team"].map(j=>e.jsx("button",{type:"button",onClick:()=>w(j),className:`pb-1 transition-colors ${f===j?"font-semibold text-text-primary":"text-text-muted hover:text-text-secondary"}`,children:j==="personal"?i("memorySidebar.personal"):i("memorySidebar.team")},j))}),f==="team"&&he&&!oe&&e.jsx("p",{className:"mb-2 px-1 text-[10px] leading-relaxed text-text-muted",children:i("memorySidebar.teamHint")}),oe&&e.jsxs("div",{className:"mb-2 space-y-1.5 rounded-md bg-surface-2 p-2",children:[e.jsx("input",{value:pe,onChange:j=>z(j.target.value),placeholder:i("memorySidebar.create.namePlaceholder"),className:"w-full rounded bg-surface-3 px-2 py-1 text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsx("input",{value:je,onChange:j=>we(j.target.value),placeholder:i("memorySidebar.create.descriptionPlaceholder"),className:"w-full rounded bg-surface-3 px-2 py-1 text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("select",{value:ie,onChange:j=>Ie(j.target.value),className:"flex-shrink-0 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:hi.map(j=>e.jsx("option",{value:j,children:j},j))}),Ce?e.jsxs("select",{value:Ke,onChange:j=>Ae(j.target.value),"aria-label":i("memories.scope.team"),className:"min-w-0 flex-1 rounded bg-surface-3 px-1.5 py-1 text-xs text-text-primary focus:outline-none",children:[l.length===0&&e.jsx("option",{value:"",children:"—"}),l.map(j=>e.jsx("option",{value:j.id,children:j.name},j.id))]}):e.jsx("span",{className:"truncate text-[10px] text-text-muted",children:f==="team"?i("memorySidebar.team"):i("memorySidebar.personal")})]}),e.jsx("textarea",{value:Le,onChange:j=>nt(j.target.value),placeholder:i("memorySidebar.create.contentPlaceholder"),rows:6,className:"w-full rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void _t(),disabled:!rt,className:"rounded bg-accent px-2 py-0.5 text-[10px] font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:re?"…":i("memorySidebar.new")}),e.jsx("button",{type:"button",onClick:()=>G(!1),className:"rounded px-2 py-0.5 text-[10px] text-text-muted hover:bg-surface-3",children:i("memorySidebar.cancel")})]})]}),M?e.jsx("div",{className:"space-y-2",children:[0,1,2].map(j=>e.jsx("div",{className:"h-12 animate-pulse rounded-md bg-surface-2"},j))}):N.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(Lt,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:i("memorySidebar.empty")})]}):Pe.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx($s,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:i("memories.filter.empty")}),Os(y)?e.jsx("button",{type:"button",onClick:()=>p(Ot),className:"mt-2 rounded-md px-2.5 py-1 text-xs text-text-secondary transition-colors hover:bg-surface-2 hover:text-text-primary",children:i("memories.filter.clear")}):e.jsx("p",{className:"mt-1 px-4 text-[10px] leading-relaxed text-text-muted",children:i("memories.filter.layersHidden")})]}):e.jsx(xa,{files:Pe,teamEnabled:he,teams:be?l:void 0,onChanged:ce,expandedKey:O.expandedKey,fileContent:O.fileContent,onToggleExpand:O.toggleExpand})]}),q===null&&u==="governance"&&e.jsx("div",{className:"flex-1 overflow-y-auto p-3 text-xs",children:g?e.jsxs("div",{className:"space-y-4",children:[n&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",disabled:s||!g.automation.autoDream,onClick:ee,className:"inline-flex w-full items-center justify-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(na,{className:"h-3.5 w-3.5"}),s?i("memorySidebar.dreaming"):i("memorySidebar.dream")]}),!g.automation.autoDream&&e.jsx("p",{className:"mt-1 text-center text-[10px] text-text-muted",children:i("memorySidebar.dreamDisabled")})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:i("memorySidebar.recallTest.title")}),e.jsx("p",{className:"mb-1.5 text-[10px] leading-relaxed text-text-muted",children:i("memorySidebar.recallTest.hint")}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{value:U,onChange:j=>X(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.nativeEvent.isComposing&&at()},placeholder:i("memorySidebar.recallTest.placeholder"),className:"min-w-0 flex-1 rounded-md bg-surface-2 px-2 py-1 text-xs text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsx("button",{type:"button",onClick:()=>void at(),disabled:A||!U.trim(),className:"flex-shrink-0 rounded-md bg-accent px-2.5 py-1 text-xs font-medium text-white hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50",children:A?i("memorySidebar.recallTest.running"):i("memorySidebar.recallTest.run")})]}),se!==null&&e.jsx("ul",{className:"mt-1.5 space-y-0.5 rounded-md bg-surface-2 p-2",children:se.length===0?e.jsx("li",{className:"text-[10px] text-text-muted",children:i("memorySidebar.recallTest.noResults")}):se.map(j=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void O.toggleExpand({path:j.path}),className:"flex w-full items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-xs hover:bg-surface-3",title:j.path,children:[e.jsx("span",{className:"truncate text-text-secondary",children:j.path.replace(/^team\//,"").replace(/\.md$/,"")}),e.jsxs("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:[(j.score*100).toFixed(0),"%",j.confidence!==void 0?` · conf ${j.confidence.toFixed(2)}`:""]})]}),Ue(j.path)]},j.path))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:i("memorySidebar.layers")}),e.jsx("ul",{className:"space-y-1",children:sn.map(j=>{const te=g.layers[j],De=Math.max(...sn.map(it=>g.layers[it]),1);return e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-16 flex-shrink-0 text-text-secondary",children:j}),e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-surface-2",children:e.jsx("div",{className:"h-full rounded-full bg-brand",style:{width:`${te/De*100}%`}})}),e.jsx("span",{className:"w-6 text-right text-text-muted",children:te})]},j)})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:i("memorySidebar.health")}),e.jsxs("div",{className:"rounded-md bg-surface-2 p-2 text-[10px] text-text-secondary",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.total")}),e.jsx("span",{children:g.health.totalMemories})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.capacity")}),e.jsxs("span",{className:g.health.capacity.tier==="critical"?"text-status-error":g.health.capacity.tier==="warning"?"text-status-warning":"text-status-active",children:[g.health.capacity.utilizationPct.toFixed(0),"% · ",g.health.capacity.tier]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:i("memorySidebar.avgConfidence")}),e.jsx("span",{children:g.health.avgConfidence.toFixed(2)})]})]})]}),g.alerts.length>0&&e.jsxs("div",{children:[e.jsxs("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:[i("memorySidebar.alerts")," (",g.alerts.length,")"]}),e.jsx("ul",{className:"space-y-1 rounded-md bg-status-warning/5 p-2",children:g.alerts.slice(-8).reverse().map((j,te)=>e.jsx("li",{className:"text-[10px] leading-relaxed text-text-secondary",children:j},te))})]}),g.conflicts&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-wide text-status-warning",children:i("memorySidebar.conflicts")}),e.jsx("pre",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap rounded-md bg-surface-2 p-2 text-[10px] leading-relaxed text-text-secondary",children:g.conflicts})]})]}):e.jsx("p",{className:"py-10 text-center text-text-muted",children:i("memorySidebar.loadFailed")})})]})}class yi{constructor(t,s,n,l){D(this,"pending",null);this.current=t,this.apply=s,this.send=n,this.onError=l}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,nn(n),"send")})}catch(n){this.rollback(s,nn(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 l;this.pending=null,this.current=t,this.apply(t),s&&((l=this.onError)==null||l.call(this,s,n))}}function nn(r){return r instanceof Error?r.message:String(r)}function wt(r){const t=o.useRef(r);t.current=r;const s=o.useRef(null);s.current||(s.current=new yi(r.value,l=>t.current.apply(l),l=>t.current.send(l),(l,c)=>{var d,u;return(u=(d=t.current).onError)==null?void 0:u.call(d,l,c)}));const n=s.current;return o.useEffect(()=>{n.adoptExternal(r.value)}),o.useMemo(()=>({set:l=>n.set(l),handleControlResponse:l=>n.handleControlResponse(l),sync:l=>n.sync(l)}),[n])}const kn="rcs_context_usage_";function Nn(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function rn(){return{totalTokens:0,rawMaxTokens:0,percentage:0}}function gi(r){if(!r||typeof r!="object"||Array.isArray(r))return null;const t=r,{totalTokens:s,rawMaxTokens:n,percentage:l}=t;if(typeof s!="number"||typeof n!="number"||typeof l!="number")return null;const c=t.categories,d=Array.isArray(c)?c.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:l,...typeof t.model=="string"&&t.model?{model:t.model}:{},...d&&d.length>0?{categories:d}:{}}}function bi(r,t=Nn()){if(!t||!r)return null;try{const s=t.getItem(kn+r);return s?gi(JSON.parse(s)):null}catch{return null}}function ji(r,t,s=Nn()){if(!(!s||!r))try{s.setItem(kn+r,JSON.stringify(t))}catch{}}const wi=[{key:"nav",entries:["artifacts","memories","side","search","mcp","settings","share","tasks"]},{key:"bar",entries:["mode","model","token","context"]}];function vi(){return me(),e.jsx("div",{className:"w-full",children:wi.map((r,t)=>e.jsxs("section",{className:t>0?"mt-8 min-w-0":"min-w-0",children:[e.jsx("h4",{className:"sr-only",children:i(`session.emptyGuide.${r.key}`)}),e.jsx("dl",{className:"grid grid-cols-1 gap-y-[0.95rem]",children:r.entries.map(s=>e.jsxs("div",{className:"grid min-w-0 grid-cols-1 gap-y-[0.15rem] sm:grid-cols-[minmax(0,9.5rem)_minmax(0,1fr)] sm:items-baseline sm:gap-x-5 sm:gap-y-0",children:[e.jsx("dt",{className:"font-sans text-[0.8125rem] font-medium leading-[1.45] text-text-primary",children:i(`session.emptyGuide.${r.key}.${s}`)}),e.jsx("dd",{className:"font-sans text-xs leading-[1.5] text-text-muted",children:i(`session.emptyGuide.${r.key}.${s}Desc`)})]},s))})]},r.key))})}function ki(r){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${r}`}function Ni(r){const t=ki(r),s=Pr(),n=s?{proxyUrl:t,token:s}:{proxyUrl:t};return new Ar(n)}const Fe=[{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"}],an="rcs_permission_mode";function vt(r){return r<1e3?String(r):r<1e6?`${(r/1e3).toFixed(1)}k`:`${(r/1e6).toFixed(1)}M`}function Si(r){const t=Fe.findIndex(s=>s.value===r);return Fe[(t+1+Fe.length)%Fe.length].value}const tt=[{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}],on="rcs_thinking_budget",Nt=[{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"}],_i=r=>r.labelKey?i(r.labelKey):r.label,Ci=r=>r.labelKey?i(r.labelKey):r.label,ln="rcs_effort",cn=[{value:"normal",descKey:"session.tokenMode.normalDesc"},{value:"poor",descKey:"session.tokenMode.poorDesc"},{value:"sa",descKey:"session.tokenMode.saDesc"}],dn="rcs_token_mode";function Ei(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,set_token_mode:!1,side_question:!0}:{file_search:!1,clear:!0,set_max_thinking_tokens:!0,get_context_usage:!1,stop_task:!0,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,set_token_mode:!1,side_question:!1}}function un({icon:r,label:t,levels:s,index:n,onChange:l,disabled:c}){const d=Math.max(s.length-1,0),u=Math.min(Math.max(n,0),d),[b,f]=o.useState(null),w=b??u,N=s[w],_=d>0?w/d*100:0,M=()=>{b!==null&&(b!==u&&l(b),f(null))};return e.jsxs("div",{className:c?"opacity-55":void 0,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-brand/10 text-brand-text",children:e.jsx(r,{className:"h-3 w-3",strokeWidth:2})}),e.jsx("span",{className:"truncate font-display text-xs font-semibold text-text-primary",children:t})]}),e.jsx("span",{className:"shrink-0 rounded-full border border-brand/20 bg-brand/10 px-1.5 py-0.5 font-mono text-[10px] font-medium tabular-nums text-brand-text",children:N.label})]}),e.jsxs("div",{className:"relative mt-2 h-6",children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-[7px] top-1/2 h-[3px] -translate-y-1/2 overflow-hidden rounded-full bg-surface-3",children:e.jsx("div",{className:"h-full rounded-full bg-brand transition-[width] duration-200 ease-out",style:{width:`${_}%`}})}),e.jsx("div",{className:"pointer-events-none absolute inset-x-[7px] top-1/2 h-[7px] -translate-y-1/2",children:s.map((C,S)=>e.jsx("span",{className:`absolute top-0 h-full w-[1.5px] -translate-x-1/2 rounded-full ${S<=w?"bg-primary-foreground/55":"bg-text-muted/25"}`,style:{left:d>0?`${S/d*100}%`:"50%"}},C.value))}),e.jsx("input",{type:"range",min:0,max:d,step:1,value:w,disabled:c,"aria-label":t,"aria-valuetext":N.label,onChange:C=>f(Number(C.target.value)),onPointerUp:M,onKeyUp:M,onBlur:M,className:"rcs-range relative z-10"})]}),e.jsx("div",{className:"mt-1 flex items-start justify-between gap-1",children:s.map((C,S)=>e.jsx("button",{type:"button",disabled:c,onClick:()=>{f(null),l(S)},className:`min-w-0 truncate font-mono text-[10px] leading-4 tabular-nums transition-colors disabled:cursor-not-allowed ${S===w?"font-semibold text-brand-text":"text-text-muted/70 hover:text-text-primary"}`,children:C.label},C.value))}),e.jsx("p",{className:"mt-0.5 min-h-4 text-xs leading-4 text-text-muted",children:N.description})]})}function Ti({mode:r,onModeChange:t,disabled:s}){const[n,l]=o.useState(!1),c=cn.find(d=>d.value===r);return e.jsxs(Gt,{open:n,onOpenChange:l,children:[e.jsx(zt,{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:i("session.tokenMode.title"),children:[e.jsx(ba,{className:"h-3 w-3"}),e.jsx("span",{className:`min-w-0 truncate ${r!=="normal"?"font-medium text-brand-text":""}`,children:c?i(`session.tokenMode.${c.value}`):i("session.tokenMode.fallback")}),n?e.jsx(Yt,{className:"h-3 w-3"}):e.jsx(Vt,{className:"h-3 w-3"})]})}),e.jsx(Jt,{className:"w-64 p-1",align:"start",children:cn.map(d=>e.jsxs("button",{type:"button",onClick:()=>{t(d.value),l(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:r===d.value&&e.jsx(Wt,{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:i(`session.tokenMode.${d.value}`)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(d.descKey)})]})]},d.value))})]})}const Mi=new Set(["Free space","Autocompact buffer","Compact buffer"]),mn=["bg-brand","bg-status-active","bg-status-success","bg-violet-500","bg-amber-500","bg-pink-500","bg-teal-500"];function Ri({usage:r}){const t=Math.min(100,Math.max(0,r.percentage)),s=t>=80,n=(r.categories??[]).filter(u=>!u.isDeferred&&!Mi.has(u.name)),l=(r.categories??[]).filter(u=>u.isDeferred),c=n.reduce((u,b)=>u+b.tokens,0),d=[`${K("session.context.tooltip",{used:vt(r.totalTokens),max:vt(r.rawMaxTokens)})}${r.model?` · ${r.model}`:""}`,...n.slice(0,8).map(u=>`${u.name}: ${vt(u.tokens)}`),...l.slice(0,3).map(u=>`${u.name.replace(/\s*\(deferred\)$/i,"")}${i("session.context.deferredSuffix")}: ${vt(u.tokens)}`)];return e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-text-muted font-mono",title:d.join(`
|
|
82
|
+
`),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,b)=>e.jsx("span",{className:s&&b===0?"bg-status-warning":mn[b%mn.length],style:{width:`${Math.min(100,Math.max(0,c>0?u.tokens/c*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 Ii({models:r,currentModelId:t,onSelect:s,showThinking:n,thinkingBudget:l,onThinkingChange:c,showEffort:d,effort:u,onEffortChange:b,disabled:f}){const[w,N]=o.useState(!1),_=r.find(x=>x.modelId===t)??null,M=r.length>0,C=n||d,S=M||C,P=tt.findIndex(x=>x.value===l),I=P>=0?P:1,$=Nt.findIndex(x=>x.value===u),q=$>=0?$:0,h=tt.map(x=>({value:x.value,label:Ci(x),description:x.descKey?i(x.descKey):x.description??""})),g=Nt.map(x=>({value:x.value,label:_i(x),description:i(x.descKey)})),k=[i("session.model.title"),n?h[I].label:null,d?g[q].label:null].filter(Boolean).join(" · ");return e.jsxs(Gt,{open:w,onOpenChange:S?N:void 0,children:[e.jsx(zt,{asChild:!0,children:e.jsxs("button",{type:"button",disabled:f||!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:k,children:[e.jsx(jn,{className:"h-3 w-3"}),e.jsx("span",{className:"min-w-0 truncate",children:(_==null?void 0:_.name)??t??i("session.model.title")}),C&&e.jsxs("span",{className:"ml-0.5 flex items-center gap-1 border-l border-border/70 pl-1.5",children:[n&&e.jsx(Ls,{className:"h-3 w-3"}),d&&e.jsx(Us,{className:"h-3 w-3"})]}),w?e.jsx(Yt,{className:"h-3 w-3"}):e.jsx(Vt,{className:"h-3 w-3"})]})}),e.jsxs(Jt,{className:"w-[21rem] max-w-[calc(100vw-2rem)] max-h-[calc(100dvh-2rem)] overflow-y-auto overflow-x-hidden p-0",align:"start",children:[e.jsxs("div",{className:"px-3 pt-3 pb-1.5",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between px-1",children:[e.jsx("span",{className:"font-display text-[10px] font-semibold uppercase tracking-[0.16em] text-text-muted",children:i("session.model.section")}),M&&e.jsx("span",{className:"font-mono text-[10px] tabular-nums text-text-muted",children:r.length})]}),M?e.jsx("div",{className:"[&_[data-slot=command-list]]:max-h-[min(15rem,38vh)]",children:e.jsx(Yr,{models:r,currentModelId:t,onSelect:x=>{s(x.modelId),N(!1)},showSearch:r.length>5})}):e.jsx("p",{className:"px-1 py-2 text-xs text-text-muted",children:i("session.model.unavailable")})]}),C&&e.jsxs("div",{className:"border-t border-border/60 bg-surface-2/35 px-3 pt-2.5 pb-3",children:[e.jsx("div",{className:"mb-2.5 px-1",children:e.jsx("span",{className:"font-display text-[10px] font-semibold uppercase tracking-[0.16em] text-text-muted",children:i("session.model.tuning")})}),e.jsxs("div",{className:"space-y-3.5",children:[n&&e.jsx(un,{icon:Ls,label:i("session.thinking.title"),levels:h,index:I,onChange:x=>c(tt[x].value),disabled:f}),d&&e.jsx(un,{icon:Us,label:i("session.effort.title"),levels:g,index:q,onChange:x=>b(Nt[x].value),disabled:f})]})]})]})]})}function Ai({mode:r,onModeChange:t,disabled:s}){const[n,l]=o.useState(!1),c=Fe.find(d=>d.value===r);return e.jsxs(Gt,{open:n,onOpenChange:l,children:[e.jsx(zt,{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:i("session.mode.title"),children:[e.jsx(zr,{className:"h-3 w-3"}),e.jsx("span",{className:"min-w-0 truncate",children:c?i(c.labelKey):r}),n?e.jsx(Yt,{className:"h-3 w-3"}):e.jsx(Vt,{className:"h-3 w-3"})]})}),e.jsx(Jt,{className:"w-64 p-1",align:"start",children:Fe.map(d=>e.jsxs("button",{type:"button",onClick:()=>{t(d.value),l(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[e.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:r===d.value&&e.jsx(Wt,{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:i(d.labelKey)}),e.jsx("div",{className:"text-xs text-text-muted",children:i(d.descKey)})]})]},d.value))})]})}function Yi({sessionId:r,onBack:t}){me();const[s,n]=o.useState(null),[l,c]=o.useState(null),[d,u]=o.useState(""),[b,f]=o.useState(!1),[w,N]=o.useState(!1),[_,M]=o.useState(!1),[C,S]=o.useState(!1),[P,I]=o.useState(!1),[$,q]=o.useState(!1),[h,g]=o.useState(!1),[k,x]=o.useState(""),[T,y]=o.useState(0),p=o.useRef(null),[O,U]=o.useState({text:"",nonce:0}),[X,se]=o.useState(!1),[Q,A]=o.useState(!1),[ne,Z]=o.useState(0),[ce,Ue]=o.useState(0),[be,oe]=o.useState([]),[G,pe]=o.useState(!1),[z,je]=o.useState([]),we=o.useRef(z);we.current=z;const ie=o.useMemo(()=>z.filter(a=>a.sentAt===void 0),[z]),Ie=o.useRef(!1),[Le,nt]=o.useState(null),[Ke,Ae]=o.useState(()=>Date.now()),[re,_e]=o.useState(null),[V,Ce]=o.useState(null),[rt,_t]=o.useState(()=>Qt()),[ee,at]=o.useState(null),[he,Be]=o.useState(()=>localStorage.getItem(on)||"off"),[Ct,Pe]=o.useState(()=>bi(r)),[He,Ee]=o.useState(!0),[j,te]=o.useState(null),[De,it]=o.useState(null),[ot,lt]=o.useState([]),[Sn,Et]=o.useState(!1),[Tt,Xt]=o.useState(""),Mt=o.useRef(null),[ct,_n]=o.useState(()=>localStorage.getItem(an)||"default"),[Zt,es]=o.useState(null),Qe=o.useRef(null),[ts,ss]=o.useState(null),We=o.useRef(null),fe=o.useRef(null),dt=o.useRef(new Set),ns=o.useRef(0),[rs,Cn]=o.useState(0),[de,as]=o.useState(null),Ge=o.useRef(null),ze=o.useRef(new Map),ut=o.useRef(new Map),is=o.useRef(null);is.current=re;const os=o.useRef(null),ls=o.useRef(be);ls.current=be;const mt=o.useRef(null);mt.current||(mt.current=new pa(ha()));const cs=o.useRef(r);cs.current=(s==null?void 0:s.title)||r,o.useEffect(()=>{var a;(a=mt.current)==null||a.reset()},[r]),o.useEffect(()=>{re&&!w&&requestAnimationFrame(()=>{var a;return(a=os.current)==null?void 0:a.focus()})},[re,w]),o.useEffect(()=>{ns.current>0&&z.length===0&&(Cn(a=>a+1),w&&(N(!1),requestAnimationFrame(()=>{var a;return(a=document.getElementById("chat-input"))==null?void 0:a.focus()}))),ns.current=z.length},[z.length,w]),o.useEffect(()=>{if(!z.some(v=>v.sentAt!==void 0))return;const m=setInterval(()=>Ae(Date.now()),1e3);return()=>clearInterval(m)},[z]);const ye=o.useCallback(a=>{es(a),Qe.current&&clearTimeout(Qe.current),Qe.current=setTimeout(()=>es(null),5e3)},[]),ve=o.useCallback(a=>{ss(a),We.current&&clearTimeout(We.current),We.current=setTimeout(()=>ss(null),5e3)},[]),xt=wt({value:ct,apply:a=>{_n(a);try{localStorage.setItem(an,a)}catch{}},send:a=>{const m=fe.current;return m?m.setPermissionMode(a):Promise.reject(new Error("adapter not ready"))},onError:(a,m)=>{console.error("[SessionDetail] set permission mode failed:",a),ye(m==="send"?K("session.mode.switchFailedRequest",{message:a}):a||i("session.mode.switchFailed"))}}),Rt=o.useCallback(a=>xt.set(a),[xt]),[ds,En]=o.useState(()=>localStorage.getItem(dn)||"normal"),pt=wt({value:ds,apply:a=>{En(a);try{localStorage.setItem(dn,a)}catch{}},send:a=>{const m=fe.current;return m?m.setTokenMode(a):Promise.reject(new Error("adapter not ready"))},onError:(a,m)=>{console.error("[SessionDetail] set token mode failed:",a),ye(m==="send"?K("session.tokenMode.failedRequest",{message:a}):a||i("session.tokenMode.failed"))}}),It=wt({value:he,apply:a=>{Be(a);try{localStorage.setItem(on,a)}catch{}},send:a=>{var E;const m=fe.current;if(!m)return Promise.reject(new Error("adapter not ready"));const v=((E=tt.find(R=>R.value===a))==null?void 0:E.tokens)??null;return m.setThinkingBudget(v)},onError:(a,m)=>{console.error("[SessionDetail] set thinking budget failed:",a),ye(m==="send"?K("session.thinking.failedRequest",{message:a}):a||i("session.thinking.failed"))}}),Tn=o.useCallback((a,m,v)=>{as({tool:a,decision:m,remembered:v,nonce:Date.now()}),Ge.current&&clearTimeout(Ge.current),Ge.current=setTimeout(()=>as(null),2200)},[]);o.useEffect(()=>()=>{Ge.current&&clearTimeout(Ge.current)},[]);const L=o.useMemo(()=>new La(r,oe,{onStatusChange:a=>{var m;c(a),pe(a==="running"||a==="requires_action"),(m=mt.current)==null||m.onStatus(a,cs.current)},onError:a=>{console.error("[RCSChatAdapter] error:",a)},onPermissionRequest:a=>{je(m=>m.some(v=>v.requestId===a.requestId)?m:[...m,a])},onPermissionSettled:(a,m)=>{var R;if(a===null){je([]),ze.current.clear(),ut.current.clear();return}const v=we.current.find(F=>F.requestId===a),E=ze.current.get(a);v&&m&&Tn(v.toolName,m,E),ze.current.delete(a),ut.current.delete(a),((R=is.current)==null?void 0:R.requestId)===a&&_e(null),je(F=>F.filter(W=>W.requestId!==a))},onModelsStateChange:a=>{Ce(a)},onSubagentUpdate:a=>{_t(a)},onControlResponse:a=>{It.handleControlResponse(a)||pt.handleControlResponse(a)||ps.handleControlResponse(a)||xt.handleControlResponse(a)},onPermissionModeChange:a=>{xt.sync(a)},onWorkerInfoChange:a=>{at(m=>JSON.stringify(m)===JSON.stringify(a)?m:a)},onTurnStart:a=>{te(a)},onElicitationRequest:a=>{it(a)}}),[r,ye]);o.useEffect(()=>(fe.current=L,()=>{L.disconnect()}),[L]);const B=o.useMemo(()=>Ei(ee),[ee]),us=o.useRef(!1);o.useEffect(()=>{var v;if(!B.set_max_thinking_tokens||us.current)return;const a=fe.current;if(!a)return;const m=((v=tt.find(E=>E.value===he))==null?void 0:v.tokens)??null;a.setThinkingBudget(m).then(()=>{us.current=!0}).catch(E=>console.error("[SessionDetail] reconcile thinking budget failed:",E))},[B.set_max_thinking_tokens,he,ee]);const Mn=B.stop_task?a=>{L.stopSubagent(a).then(m=>{m.ok||ve(m.error||i("session.stopTask.failed"))})}:void 0,ms=o.useRef(!1);o.useEffect(()=>{if(!B.set_token_mode||ms.current)return;const a=fe.current;a&&(ms.current=!0,a.getRemoteSettings().then(m=>{const v=m==null?void 0:m.applied.tokenMode;(v==="normal"||v==="poor"||v==="sa")&&pt.sync(v)}).catch(m=>console.error("[SessionDetail] reconcile token mode failed:",m)))},[B.set_token_mode,pt]);const Rn=me(),At=o.useMemo(()=>Dr((ee==null?void 0:ee.commands)??[],(ee==null?void 0:ee.skills)??[]),[ee,Rn]),Ye=o.useMemo(()=>qr(be,k),[be,k]),In=o.useCallback(a=>It.set(a),[It]),[xs,An]=o.useState(()=>localStorage.getItem(ln)||"auto"),ps=wt({value:xs,apply:a=>{An(a);try{localStorage.setItem(ln,a)}catch{}},send:a=>{var E;const m=fe.current;if(!m)return Promise.reject(new Error("adapter not ready"));const v=(E=Nt.find(R=>R.value===a))==null?void 0:E.effort;return m.setEffort(v)},onError:(a,m)=>{console.error("[SessionDetail] set effort failed:",a),ye(m==="send"?K("session.effort.failedRequest",{message:a}):a||i("session.effort.failed"))}}),Ve=o.useCallback(()=>{var a;B.get_context_usage&&((a=fe.current)==null||a.getContextUsage().then(m=>{m&&(Pe(m),ji(r,m))}).catch(()=>{}).finally(()=>Ee(!1)))},[B,r]);o.useEffect(()=>{if(!B.get_context_usage)return;Ve();const a=setInterval(Ve,6e4);return()=>clearInterval(a)},[B,G,Ve]);const hs=(V==null?void 0:V.currentModelId)??null;o.useEffect(()=>{hs&&Ve()},[hs,Ve]),o.useEffect(()=>{ee&&!B.get_context_usage&&Ee(!1)},[ee,B]),o.useEffect(()=>{if(!He)return;const a=setTimeout(()=>Ee(!1),1e4);return()=>clearTimeout(a)},[He]);const fs=o.useRef(Q);fs.current=Q,o.useEffect(()=>xe.onEvent(m=>{m.type!=="artifact_created"&&m.type!=="artifact_updated"||(fs.current&&Ue(v=>v+1),Z(v=>v+1))}),[]);const[Pn,ht]=o.useState(0),[ft,ys]=o.useState(null),[ge,yt]=o.useState(!1),[qe,gs]=o.useState(0),[Dn,qn]=o.useState(void 0),gt=o.useRef(ge);gt.current=ge,o.useEffect(()=>xe.onEvent(m=>{m.type==="memory_synced"&>.current&&ht(v=>v+1)}),[]),o.useEffect(()=>{yn().then(a=>ys(a.mode)).catch(()=>ys("sqlite"))},[]),o.useEffect(()=>xe.onEvent(m=>{var v,E;if(m.type==="memory_changed")gt.current?ht(R=>R+1):gs(R=>R+1);else if(m.type==="memory_recall"){const R=Array.isArray((v=m.payload)==null?void 0:v.hits)?m.payload.hits:void 0;R&&qn({query:typeof((E=m.payload)==null?void 0:E.query)=="string"?m.payload.query:"",hits:R}),gt.current&&ht(F=>F+1)}}),[]),o.useEffect(()=>{ge&&gs(0)},[ge]);const[Je,$n]=o.useState("idle");o.useEffect(()=>xe.onStateChange(m=>$n(m)),[]),o.useEffect(()=>{Q&&Z(0)},[Q]);const $e=o.useCallback(async()=>{if(Ie.current)return;Ie.current=!0;const a=new Set(we.current.map(m=>m.requestId));try{const v=(await $r(r)).permissions.filter(E=>!L.isPermissionSettled(E.requestId));v.some(E=>E.sentAt!==void 0)&&Ae(Date.now()),je(E=>{const R=new Set(v.map(W=>W.requestId)),F=E.filter(W=>!a.has(W.requestId)&&!R.has(W.requestId)&&!L.isPermissionSettled(W.requestId));return[...v,...F]})}catch{}finally{Ie.current=!1}},[r,L]);o.useEffect(()=>{let a=xe.state;return xe.onStateChange((v,E)=>{const R=v==="open"&&(a==="reconnecting"||a==="failed");(E!=null&&E.resync||R)&&$e(),a=v})},[$e]),o.useEffect(()=>{const a=()=>{document.visibilityState==="visible"&&$e()};return document.addEventListener("visibilitychange",a),()=>document.removeEventListener("visibilitychange",a)},[$e]),o.useEffect(()=>{let a=!1;async function m(){u("");try{const v=await Ds(r);if(a)return;n(v),c(v.status),kt(v.status)&&L.markClosed(),pe(v.status==="running"||v.status==="requires_action")}catch(v){if(a)return;u(v instanceof Error?v.message:i("session.loadFailed"));return}try{await L.init()}catch(v){console.warn("Failed to init adapter:",v)}a||await $e()}return m(),()=>{a=!0}},[r,L,$e]);const H=kt(l),bs=o.useRef(l);bs.current=l,o.useEffect(()=>{if(H)return;let a=!1;const v=setInterval(async()=>{try{const E=await Ds(r);if(a||E.status===bs.current)return;kt(E.status)&&L.markClosed(),c(E.status),pe(E.status==="running"||E.status==="requires_action")}catch{}},6e4);return()=>{a=!0,clearInterval(v)}},[r,H,L]);const Y=(s==null?void 0:s.access_level)==="read",js=Ct??(He&&!H&&!Y?rn():null),Pt=o.useCallback(()=>{oe([]),Pe(rn()),Ts(r).catch(a=>{console.warn("[SessionDetail] Failed to clear session history:",a)})},[r]),Xe=o.useCallback(async(a,m)=>{const v=fe.current;if(!v||H)return;if(a.sessionId===r){oe(R=>[...R,{type:"command_output",id:`cmd-resume-${Date.now()}`,commandName:"resume",inputText:m??"/resume",title:"Resume",subtitle:i("session.resume.title"),outputText:i("session.resume.currentBlocked"),variant:"error"}]);return}const E=(R,F="default")=>oe(W=>[...W,{type:"command_output",id:`cmd-resume-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,commandName:"resume",inputText:m??`/resume ${a.sessionId.slice(0,8)}`,title:"Resume",subtitle:i("session.resume.title"),outputText:R,variant:F}]);E(K("session.resume.restoring",{title:a.title??""}));try{await Ts(r),oe([]);const R=await v.resumeSession(a.sessionId);E(R.title?K("session.resume.restoredWithTitle",{count:R.messageCount,title:R.title}):K("session.resume.restored",{count:R.messageCount}))}catch(R){E(K("session.resume.failed",{message:R instanceof Error?R.message:String(R)}),"error")}},[H,r]),On=o.useCallback(async()=>{if(s!=null&&s.environment_id)try{const a=await Or({environment_id:s.environment_id});window.location.href=`/code/${a.id}?resumeFrom=${r}`}catch(a){ve(K("session.createFailedWithReason",{message:a instanceof Error?a.message:String(a)}))}},[s,r,ve]),Fn=o.useRef(new URLSearchParams(window.location.search).get("resumeFrom")),ws=o.useRef(!1);o.useEffect(()=>{const a=Fn.current;!a||ws.current||!ee||!B.resume||(ws.current=!0,window.history.replaceState({},"",window.location.pathname),Xe({sessionId:a,title:a.slice(0,8),modified:0},null))},[ee,B.resume,Xe]);const Oe=o.useCallback(async a=>{const m=a.text.trim(),v=a.images&&a.images.length>0||a.attachments&&a.attachments.length>0;if(!m&&!v||H)return;const E=/^\/resume(?:\s+(.*))?$/.exec(m);if(E){const F=(E[1]??"").trim();if(!B.resume){oe(W=>[...W,{type:"user_message",id:`user-${Date.now()}`,content:m},{type:"command_output",id:`cmd-${Date.now()}`,commandName:"resume",inputText:m,title:"Resume",subtitle:i("session.resume.title"),outputText:i("session.resume.unsupported"),variant:"error"}]);return}F?await Xe({sessionId:F,title:F,modified:0},m):q(!0);return}const R=await Fr(m,{sessionId:r,availableCommands:At,availableModels:(V==null?void 0:V.availableModels)??[],currentModel:V?{modelId:V.currentModelId,name:V.currentModelId}:null,supportsImages:!0,entries:ls.current,setModel:async F=>{await le(r,{type:"control_request",request:{subtype:"set_model",model:F}}),Ce(W=>W&&{...W,currentModelId:F})},onNewSession:()=>{oe([])}}).catch(()=>null);if(R){if(St("[SessionDetail] local command result",R),"clearEntries"in R&&R.clearEntries){Pt();return}if("newSession"in R&&R.newSession){Pt();return}if("userEntry"in R){oe(F=>[...F,R.userEntry,R.cmdEntry]);return}}pe(!0);try{await L.sendMessage(m,a.images,a.attachments)}catch(F){if(console.error("Send failed:",F),F instanceof Ur&&F.type==="session_closed"){c("archived"),L.markClosed(),ve(i("session.closedSendBlocked"));return}ve(`${i("session.sendFailed")}${F instanceof Error?`: ${F.message}`:""}`)}},[L,H,r,V,At,Pt,ve,Xe,B]),Un=o.useCallback(a=>{if(G){lt(m=>[...m,a]);return}Oe(a)},[G,Oe]),[Dt,vs]=o.useState(!1),Ln=o.useCallback(()=>{G||(vs(!0),Oe({text:"/dream"}))},[G,Oe]);o.useEffect(()=>{!G&&Dt&&(vs(!1),ht(a=>a+1))},[G,Dt]);const qt=o.useRef(!1);o.useEffect(()=>{if(H){lt(m=>m.length>0?[]:m);return}if(G||ot.length===0||qt.current)return;const a=ot[0];a&&(qt.current=!0,lt(m=>m.slice(1)),Oe(a).finally(()=>{qt.current=!1}))},[G,ot,Oe,H]);const Kn=o.useCallback((a,m)=>{if(G)return;const v=m==="edit"?i("session.rewind.confirmEdit"):i("session.rewind.confirm");window.confirm(`${v}
|
|
83
|
+
${i("session.rewind.confirmBody")}`)&&L.rewindToMessage(a.id).then(()=>{m==="edit"&&a.content&&U(E=>({text:a.content,nonce:E.nonce+1}))}).catch(E=>{console.error("[SessionDetail] rewind failed:",E),ve(K("session.rewind.failed",{message:E instanceof Error?E.message:String(E)}))})},[G,ve]),Bn=o.useCallback(a=>{const m=Ye.orderedMatchIds;if(m.length===0)return;const v=(a%m.length+m.length)%m.length;y(v);const E=m[v],R=document.querySelector(`[data-entry-id="${CSS.escape(E)}"]`);R==null||R.scrollIntoView({block:"center",behavior:"smooth"})},[Ye]),ks=o.useCallback(async()=>{try{await L.interrupt()}catch(a){console.error("Interrupt failed:",a)}finally{pe(!1)}},[L]),Hn=o.useCallback(()=>{Rt(Si(ct))},[Rt,ct]);o.useEffect(()=>()=>{Qe.current&&clearTimeout(Qe.current),We.current&&clearTimeout(We.current)},[]);const Qn=o.useCallback(async()=>{if(s&&window.confirm(i("dashboard.confirmDelete").replace("{id}",s.title||s.id)))try{await Ms(s.id),window.location.href="/code/"}catch(a){alert(a instanceof Error?a.message:i("dashboard.deleteFailed"))}},[s]),J=o.useCallback(async a=>{var m,v;if(!dt.current.has(a.requestId)){dt.current.add(a.requestId),ut.current.set(a.requestId,a),ze.current.delete(a.requestId);try{switch(a.kind){case"approve":await L.respondPermission(a.requestId,!0);break;case"approveAlways":{const F=((m=we.current.find(er=>er.requestId===a.requestId))==null?void 0:m.toolName)??"tool",W=Lr(a.suggestions,F);W&&ze.current.set(a.requestId,W),await L.respondPermission(a.requestId,!0,{updated_permissions:a.suggestions});break}case"reject":await L.respondPermission(a.requestId,!1);break;case"answers":await le(r,{type:"permission_response",approved:!0,request_id:a.requestId,updated_input:{questions:a.questions,answers:a.answers}});break;case"plan":if(a.value==="no")await le(r,{type:"permission_response",approved:!1,request_id:a.requestId,...a.feedback?{message:a.feedback}:{}});else{const F={"yes-accept-edits":"acceptEdits","yes-default":"default"};await le(r,{type:"permission_response",approved:!0,request_id:a.requestId,updated_permissions:[{type:"setMode",mode:F[a.value]||"default",destination:"session"}]})}break}const E=Date.now(),R=a.kind==="reject"||a.kind==="plan"&&a.value==="no"?"deny":"allow";Ae(E),je(F=>F.map(W=>W.requestId===a.requestId?{...W,sentAt:E,decision:R}:W)),_e(null)}catch(E){console.error(`[SessionDetail] permission ${a.kind} failed:`,E);const R=(v=z.find(F=>F.requestId===a.requestId))==null?void 0:v.toolName;_e({requestId:a.requestId,message:R?K("permission.respondFailedFor",{tool:R}):i("permission.respondFailed"),action:a})}finally{dt.current.delete(a.requestId)}}},[L,r,z]),Ns=o.useCallback(a=>void J({kind:"approve",requestId:a}),[J]),Wn=o.useCallback((a,m)=>void J({kind:"approveAlways",requestId:a,suggestions:m}),[J]);o.useCallback(async(a,m)=>{const v=De;if(it(null),!!v)try{await L.respondElicitation(v.requestId,a,m)}catch(E){console.error("Failed to submit elicitation:",E)}},[De,L]);const Gn=o.useCallback(()=>{!s||Y||(Xt(s.title||""),Et(!0),setTimeout(()=>{var a,m;(a=Mt.current)==null||a.focus(),(m=Mt.current)==null||m.select()},0))},[s,Y]),Ss=o.useCallback(async()=>{const a=Tt.trim();if(Et(!1),!(!s||!a||a===s.title))try{const m=await Kr(s.id,a);n(v=>v&&{...v,title:m.title??a})}catch(m){console.error("Rename failed:",m),alert(m instanceof Error?m.message:i("session.rename.failed"))}},[s,Tt]),Te=o.useCallback((a=null)=>{nt(a),N(!0)},[]),zn=o.useCallback(a=>{if(typeof window<"u"&&window.matchMedia("(max-width: 639px)").matches||a.toolName==="AskUserQuestion"||a.toolName==="ExitPlanMode"){Te(a.requestId);return}const v=Array.from(document.querySelectorAll("[data-permission-request-id]")).find(E=>E.dataset.permissionRequestId===a.requestId);if(!v){Te(a.requestId);return}v.scrollIntoView({behavior:"smooth",block:"center"}),v.focus({preventScroll:!0})},[Te]),Yn=o.useCallback(a=>void J({kind:"reject",requestId:a}),[J]),Vn=o.useCallback((a,m,v)=>void J({kind:"answers",requestId:a,answers:m,questions:v}),[J]),Jn=o.useCallback((a,m,v)=>void J({kind:"plan",requestId:a,value:m,feedback:v}),[J]),Xn=o.useCallback(a=>{dt.current.delete(a);const m=ut.current.get(a);if(m){J(m);return}const v=we.current.find(E=>E.requestId===a);v&&(v.toolName==="AskUserQuestion"||v.toolName==="ExitPlanMode"||J({kind:v.decision==="deny"?"reject":"approve",requestId:a}))},[J]),Zn=o.useCallback((a,m,v)=>{var R;if(!v)return;const E=z.find(F=>F.requestId===a);v==="allow_always"&&((R=E==null?void 0:E.suggestions)!=null&&R.length)?J({kind:"approveAlways",requestId:a,suggestions:E.suggestions}):v.startsWith("allow")?J({kind:"approve",requestId:a}):v.startsWith("reject")&&J({kind:"reject",requestId:a})},[z,J]);return d?e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(jt,{onBack:t,title:e.jsx("span",{className:"text-xs font-medium text-text-muted",children:i("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:d}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:i("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(jt,{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(Pi,{sessionId:r,agentId:s.environment_id})]}):e.jsx(gn,{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(jt,{onBack:t,title:Sn?e.jsx("input",{ref:Mt,value:Tt,onChange:a=>Xt(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.nativeEvent.isComposing?(a.preventDefault(),Ss()):a.key==="Escape"&&(a.preventDefault(),Et(!1))},onBlur:()=>void Ss(),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:!Y&&!H?e.jsx("button",{type:"button",onClick:Gn,title:i("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(sa,{visibility:s.visibility||"private",className:"hidden flex-shrink-0 text-[10px] sm:inline-flex"})]}),meta:e.jsx(e.Fragment,{children:(()=>{var v;const a=s.source==="acp"?"acp":(v=s.environment)==null?void 0:v.worker_type,m=bn(a);return e.jsx("span",{className:`hidden items-center rounded-full px-2 py-0.5 text-[10px] font-medium sm:inline-flex ${m.colorClass}`,children:m.fullLabel})})()}),actions:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden items-center gap-0.5 sm:flex",children:[e.jsxs("button",{onClick:()=>A(!Q),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${Q?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("artifacts.title"),children:[e.jsx(Rs,{className:"h-3.5 w-3.5"}),ne>0&&!Q&&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:ne>9?"9+":ne})]}),e.jsxs("button",{onClick:()=>yt(!ge),className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${ge?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("memories.title"),children:[e.jsx(Lt,{className:"h-3.5 w-3.5"}),qe>0&&!ge&&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:qe>9?"9+":qe})]}),e.jsx("button",{onClick:()=>{const a=!h;g(a),a?setTimeout(()=>{var m;return(m=p.current)==null?void 0:m.focus()},0):(x(""),y(0))},className:`flex h-7 w-7 items-center justify-center rounded-md transition-colors ${h?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.search.title"),children:e.jsx(et,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>{ie.length>0?Te():f(!b)},className:`relative flex h-7 w-7 items-center justify-center rounded-md transition-colors ${b||w?"bg-brand-light text-white":"text-text-muted hover:bg-surface-2 hover:text-text-secondary"}`,title:i("session.tasks"),"aria-label":i("session.tasks"),"aria-expanded":b||w,children:[e.jsx(Ks,{className:"h-3.5 w-3.5"}),ie.length>0&&!b&&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-status-warning px-0.5 text-[10px] font-bold text-surface-0",children:ie.length>9?"9+":ie.length})]}),e.jsxs(Is,{children:[e.jsx(As,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":i("session.actions"),title:i("session.actions"),className:"flex h-7 w-7 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-secondary",children:e.jsx(Fs,{className:"h-3.5 w-3.5"})})}),e.jsxs(Ps,{align:"end",className:"w-52",children:[B.side_question&&!H&&!Y&&e.jsxs(ue,{className:"gap-2",onSelect:()=>I(!P),children:[e.jsx(Kt,{className:"h-4 w-4 text-text-muted"}),i("session.sideQuestion.title")]}),B.mcp_management&&!H&&!Y&&e.jsxs(ue,{className:"gap-2",onSelect:()=>M(!_),children:[e.jsx(Bt,{className:"h-4 w-4 text-text-muted"}),i("session.mcp.title")]}),B.remote_settings&&!H&&!Y&&e.jsxs(ue,{className:"gap-2",onSelect:()=>S(!C),children:[e.jsx(Ht,{className:"h-4 w-4 text-text-muted"}),i("session.settings.title")]}),!Y&&(s==null?void 0:s.access_level)!=="write"&&e.jsxs(ue,{className:"gap-2",onSelect:()=>se(!0),children:[e.jsx(Bs,{className:"h-4 w-4 text-text-muted"}),i("session.share")]})]})]})]}),e.jsxs(Is,{children:[e.jsx(As,{asChild:!0,children:e.jsxs("button",{type:"button","aria-label":i("session.actions"),title:i("session.actions"),className:"relative flex h-11 w-11 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-secondary sm:hidden",children:[e.jsx(Fs,{className:"h-5 w-5"}),ie.length>0&&e.jsx("span",{className:"absolute right-1 top-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-status-warning px-0.5 text-[10px] font-bold text-surface-0",children:ie.length>9?"9+":ie.length})]})}),e.jsxs(Ps,{align:"end",className:"w-56",children:[e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>A(!Q),children:[e.jsx(Rs,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"flex-1",children:i("artifacts.title")}),ne>0&&e.jsx("span",{className:"font-mono text-[10px] text-brand-text",children:ne>9?"9+":ne})]}),e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>yt(!ge),children:[e.jsx(Lt,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"flex-1",children:i("memories.title")}),qe>0&&e.jsx("span",{className:"font-mono text-[10px] text-brand-text",children:qe>9?"9+":qe})]}),B.side_question&&!H&&!Y&&e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>I(!P),children:[e.jsx(Kt,{className:"h-4 w-4 text-text-muted"}),i("session.sideQuestion.title")]}),e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>{const a=!h;g(a),a?setTimeout(()=>{var m;return(m=p.current)==null?void 0:m.focus()},0):(x(""),y(0))},children:[e.jsx(et,{className:"h-4 w-4 text-text-muted"}),i("session.search.title")]}),B.mcp_management&&!H&&!Y&&e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>M(!_),children:[e.jsx(Bt,{className:"h-4 w-4 text-text-muted"}),i("session.mcp.title")]}),B.remote_settings&&!H&&!Y&&e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>S(!C),children:[e.jsx(Ht,{className:"h-4 w-4 text-text-muted"}),i("session.settings.title")]}),!Y&&(s==null?void 0:s.access_level)!=="write"&&e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>se(!0),children:[e.jsx(Bs,{className:"h-4 w-4 text-text-muted"}),i("session.share")]}),e.jsxs(ue,{className:"min-h-11 gap-2",onSelect:()=>{ie.length>0?Te():f(!b)},children:[e.jsx(Ks,{className:"h-4 w-4 text-text-muted"}),e.jsx("span",{className:"flex-1",children:i("session.tasks")}),ie.length>0&&e.jsx("span",{className:"rounded-full bg-status-warning px-1.5 py-0.5 font-mono text-[10px] font-bold text-surface-0",children:ie.length>9?"9+":ie.length})]})]})]})]})}),(Je==="reconnecting"||Je==="failed")&&e.jsxs("div",{className:`flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium ${Je==="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 ${Je==="failed"?"bg-status-error":"animate-pulse bg-status-warning"}`}),Je==="failed"?i("session.sseFailed"):i("session.sseReconnecting")]}),Q&&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(ra,{sessionId:r,embedded:!0,refreshTick:ce})})}),h&&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(et,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),e.jsx("input",{ref:p,value:k,onChange:a=>{x(a.target.value),y(0)},onKeyDown:a=>{a.key==="Enter"&&!a.nativeEvent.isComposing?(a.preventDefault(),Bn(k&&a.shiftKey?T-1:T+1)):a.key==="Escape"&&(a.preventDefault(),g(!1),x(""))},placeholder:i("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:Ye.orderedMatchIds.length===0?i("session.search.noResults"):`${T+1}/${Ye.orderedMatchIds.length}`})]})}),e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(Br,{entries:be,isLoading:G,turnStartedAt:j,emptyTitle:i("session.emptyTitle"),emptyDescription:i("session.emptyDescription"),emptyExtra:e.jsx(vi,{}),searchMatchIds:k.trim()?Ye.matchIds:void 0,onPermissionRespond:Zn,onRewindEntry:B.rewind&&!H&&!Y&&!G?(a,m)=>Kn(a,m):void 0})}),ft!==null&&e.jsx(ke,{open:ge,onOpenChange:yt,children:e.jsxs(Ne,{showCloseButton:!1,"data-testid":"memory-sidebar",className:"mem-drawer mem-drawer--v1 translate-x-0 translate-y-0",children:[e.jsxs("div",{className:"mem-drawer__masthead",children:[e.jsx(Se,{className:"mem-drawer__title",children:i("memorySidebar.title")}),e.jsx("button",{type:"button",onClick:()=>yt(!1),className:"mem-drawer__close","aria-label":i("common.close"),title:i("common.close"),children:e.jsx(Ze,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"mem-drawer__body",children:e.jsx(fi,{refreshTick:Pn,recall:ft==="memdir"?Dn:void 0,dreaming:ft==="memdir"?G&&Dt:void 0,onDreamTrigger:ft==="memdir"?Ln:void 0})})]})}),ts&&e.jsx("div",{className:"mx-auto page-measure w-full px-4 sm:px-8 pb-1",children:e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-status-error/40 bg-status-error/10 px-3 py-1.5 text-xs text-status-error",children:[e.jsx($t,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1",children:ts})]})}),Zt&&e.jsx("div",{className:"mx-auto page-measure w-full px-4 sm:px-8 pb-1",children:e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-status-error/40 bg-status-error/10 px-3 py-1.5 text-xs text-status-error",children:[e.jsx($t,{className:"mt-0.5 h-3.5 w-3.5 flex-shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1",children:Zt})]})}),e.jsxs("div",{className:"page-measure mx-auto w-full px-4 sm:px-8 pb-1 session-controls",children:[e.jsxs("div",{className:"session-controls__cluster",children:[e.jsx(Ai,{mode:ct,onModeChange:Rt,disabled:H||Y}),e.jsx(Ii,{models:(V==null?void 0:V.availableModels)??[],currentModelId:(V==null?void 0:V.currentModelId)??null,onSelect:a=>{le(r,{type:"control_request",request:{subtype:"set_model",model:a}}),Ce(m=>m&&{...m,currentModelId:a})},showThinking:B.set_max_thinking_tokens,thinkingBudget:he,onThinkingChange:In,showEffort:B.set_effort,effort:xs,onEffortChange:a=>ps.set(a),disabled:H||Y}),B.set_token_mode&&e.jsx(Ti,{mode:ds,onModeChange:a=>pt.set(a),disabled:H||Y})]}),e.jsx("div",{className:"session-controls__usage",children:js&&e.jsx(Ri,{usage:js})})]}),H&&(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 On(),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:i("session.resumeInNew")})}),e.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:rs>0?i("permission.queueEmpty"):""},rs),de&&e.jsx("div",{className:"mx-auto w-full page-measure px-4 pb-1 sm:px-8",children:e.jsxs("div",{role:"status","aria-live":"polite",className:`flex items-center gap-2 rounded-lg border bg-surface-1 px-3 py-2 text-xs font-medium ${de.decision==="allow"?"border-approve/25 text-approve-text":"border-status-error/30 text-status-error"}`,children:[de.decision==="allow"?e.jsx(Hr,{className:"h-4 w-4 flex-shrink-0","aria-hidden":"true"}):e.jsx(Ze,{className:"h-4 w-4 flex-shrink-0 text-status-error","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:de.decision==="allow"?de.remembered?K("permission.appliedRemembered",{tool:de.tool,rule:de.remembered}):K("permission.applied",{tool:de.tool}):de.decision==="deny"?K("permission.appliedDenied",{tool:de.tool}):K("permission.appliedCanceled",{tool:de.tool})})]},de.nonce)}),re&&!w&&e.jsx("div",{className:"mx-auto w-full page-measure px-4 pb-1 sm:px-8",children:e.jsxs("div",{role:"alert",className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-status-error/40 bg-status-error/10 px-3 py-2",children:[e.jsx($t,{className:"h-4 w-4 flex-shrink-0 text-status-error","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-status-error",children:re.message}),e.jsx("button",{ref:os,type:"button",onClick:()=>void J(re.action),className:"min-h-11 rounded-md border border-status-error/40 px-3 py-1.5 text-xs font-medium text-status-error transition-colors hover:bg-status-error/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:min-h-9",children:i("common.retry")}),e.jsx("button",{type:"button",onClick:()=>_e(null),"aria-label":i("common.close"),className:"flex h-11 w-11 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:h-8 sm:w-8",children:e.jsx(Ze,{className:"h-4 w-4"})})]})}),e.jsx("div",{className:w?"invisible":void 0,"aria-hidden":w||void 0,children:e.jsx(li,{requests:z,onApprove:Ns,onView:zn,onOpenQueue:()=>Te()})}),e.jsx(Qr,{onSubmit:Un,isLoading:G,onInterrupt:ks,onCycleMode:Hn,disabled:H||Y,placeholder:H?i("session.closed"):Y?i("session.readOnly"):i("session.inputPlaceholder"),supportsAttachments:!0,commands:At,queueWhileLoading:!0,queuedCount:ot.length,onDequeue:a=>lt(m=>m.filter((v,E)=>E!==a)),onSearchFiles:B.file_search?a=>L.searchFiles(a):void 0,historyKey:r,draftOverride:O}),_&&e.jsx(ti,{onClose:()=>M(!1),fetchServers:()=>L.getMcpServers(),onToggle:(a,m)=>L.toggleMcpServer(a,m),onReconnect:a=>L.reconnectMcpServer(a)}),C&&e.jsx(ri,{onClose:()=>S(!1),fetchSettings:()=>L.getRemoteSettings(),onApply:a=>L.applyFlagSettings(a)}),P&&e.jsx(ai,{onClose:()=>I(!1),onAsk:a=>L.askSideQuestion(a)}),b&&s&&e.jsx(Ya,{onClose:()=>f(!1),session:s,liveStatus:l,pendingPermissions:z,onOpenQueue:()=>Te(),subagentState:rt,onStopTask:Mn,onInterrupt:ks,onDelete:Qn,onEndSession:B.end_session&&!H&&!Y?async()=>{await L.endSession("ended from web"),await Ms(s.id),window.location.href="/code/"}:void 0}),e.jsx(ui,{open:X,onClose:()=>se(!1),sessionId:s.id,sessionTitle:s.title||void 0}),e.jsx(ci,{open:w,onClose:()=>N(!1),requests:z,initialRequestId:Le,now:Ke,errorMessage:re==null?void 0:re.message,errorRequestId:re==null?void 0:re.requestId,onRetry:Xn,onApprove:Ns,onApproveAlways:Wn,onReject:Yn,onSubmitAnswers:Vn,onSubmitPlan:Jn}),e.jsx(pi,{open:$,onClose:()=>q(!1),adapter:L,onResume:a=>{q(!1),Xe(a,null)}})]})}):e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx(jt,{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:i("session.loading")})})]})}function Pi({sessionId:r,agentId:t}){const[s,n]=o.useState(null),[l,c]=o.useState("disconnected"),[d,u]=o.useState(null),b=o.useRef(null);return o.useEffect(()=>{const f=Ni(t);return f.setConnectionStateHandler((w,N)=>{c(w),u(N||null)}),b.current=f,n(f),f.connect().catch(w=>{w instanceof Wr||(u(w.message),c("error"))}),()=>{f.disconnect(),b.current=null,n(null),c("disconnected")}},[t]),e.jsx(gn,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[d&&l==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:d}),l==="connecting"&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),e.jsx("p",{className:"text-text-muted text-sm",children:i("session.connectingAgent")})]})}),l==="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:i("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:d})]})}),s&&l==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Gr,{client:s,agentId:t})})]})})}export{Yi 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{aG as c,Z as n,aE as i}from"./main-BAO6US1o.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a$ as v,_ as N,aW as t}from"./main-BAO6US1o.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(""),[m,c]=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}c(!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{c(!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:"brand-wordmark--auth mb-5"}),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:m,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:m?t("common.loading"):t("auth.setup.submit")})]})]})})}export{E as Setup};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as o,j as e}from"./vendor-DE_-CLIE.js";import{b0 as u,aW as t,at as f,b as p}from"./main-BAO6US1o.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function N(){u();const[r,a]=o.useState("loading"),[l,n]=o.useState(""),[x,c]=o.useState(""),m=(typeof window<"u"?window.location.pathname:"").match(/\/code\/s\/([^/?]+)/),d=m?m[1]:null;return o.useEffect(()=>{if(!d){a("invalid"),n("share.noToken");return}if(!d.startsWith("shr_")){a("invalid"),n("share.badToken");return}let i=!1;async function h(){try{const s=await f(d);if(i)return;window.location.href=`/code/${s.id}`}catch(s){if(i)return;s instanceof p?s.status===401&&s.message.toLowerCase().includes("expired")?(a("expired"),n("share.expiredBody")):s.status===404?s.message.toLowerCase().includes("session")?(a("not_found"),n("share.sessionMissing")):(a("invalid"),n("share.revoked")):s.status===403?(a("invalid"),n("share.forbidden")):(a("error"),c(s.message)):(a("error"),c(s instanceof Error?s.message:""))}}return h(),()=>{i=!0}},[d]),o.useEffect(()=>{if(r!=="loading"&&r!=="error"){const i=setTimeout(()=>{window.location.href="/code"},3e3);return()=>clearTimeout(i)}},[r]),r==="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:t("share.loading")})]})}):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:[r==="expired"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:t("share.expiredTitle")}),e.jsx("p",{className:"text-text-muted mb-4",children:t(l||"share.expiredBody")})]}),r==="invalid"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:t("share.invalidTitle")}),e.jsx("p",{className:"text-text-muted mb-4",children:t(l||"share.invalidBody")})]}),r==="not_found"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:t("share.notFoundTitle")}),e.jsx("p",{className:"text-text-muted mb-4",children:t(l||"share.notFoundBody")})]}),r==="error"&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-display text-xl font-semibold mb-2",children:t("share.errorTitle")}),e.jsx("p",{className:"text-status-error mb-4",children:x||t("share.errorBody")})]}),e.jsx("a",{href:"/code",className:"text-brand-text hover:underline",children:t("share.back")})]})})}export{N as ShareLanding};
|