@saluzi/saluzi-edu 0.2.26 → 0.2.28
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 +105 -95
- package/dist/rcs-web/assets/{AdminPanel-Bsimdm5Q.js → AdminPanel-B8BuW6U3.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/Claim-D-6HcIPy.js → dist/rcs-web/assets/Claim-Bc5MvUyK.js} +1 -1
- package/dist/rcs-web/assets/Dashboard-D8JkTUyb.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/Join-HoIZ1jyc.js → dist/rcs-web/assets/Join-DZwoyeOG.js} +1 -1
- package/dist/rcs-web/assets/{Login-bLM4Zn4h.js → Login-BLCeIURz.js} +1 -1
- package/dist/rcs-web/assets/{Register-ByAIpM2v.js → Register-DlnIJyvt.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-Ok36DGag.js +55 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-p6speHFz.js → SessionVisibilityBadge-BTFvePCl.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/Setup-BfTiM2jB.js → dist/rcs-web/assets/Setup-BmaS0cmR.js} +1 -1
- package/dist/rcs-web/assets/{ShareLanding-DGo_cLNv.js → ShareLanding-hSlUOwmY.js} +1 -1
- package/dist/rcs-web/assets/{TeamCreate-DuC03Q55.js → TeamCreate-DSvsAFm1.js} +1 -1
- package/dist/rcs-web/assets/TeamDetail-BCpILjkt.js +6 -0
- package/dist/rcs-web/assets/{TeamList-gTscY5gq.js → TeamList-ad3mm3hY.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-Dvvn1zTh.js → TeamSettings-BWzNEVzI.js} +1 -1
- package/dist/rcs-web/assets/UserSearchInput-BMPx_a06.js +1 -0
- package/dist/rcs-web/assets/{UserSettings-TpFvBUH2.js → UserSettings-crJkXh-k.js} +1 -1
- package/dist/rcs-web/assets/{arc-cNQXzZJk.js → arc-D3D49Xtu.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-C97K07oU.js → architectureDiagram-3BPJPVTR-B2FZDdv-.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CCawpz6v.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-BSCtI5ja.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-BT2wuHdt.js → c4Diagram-AAUBKEIU-9Jwp9YE4.js} +1 -1
- package/dist/rcs-web/assets/channel-Ks7us70E.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-D7mXynqp.js → chunk-2J33WTMH-B7FEDH7A.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-Cr6Ax9dk.js → chunk-4BX2VUAB-Ckz1_Kja.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-D67JVqPZ.js → chunk-55IACEB6-QY67to6a.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CVttzQWT.js → dist/rcs-web/assets/chunk-727SXJPM-CScpVqb2.js} +1 -1
- package/dist/rcs-web/assets/{chunk-AQP2D5EJ-fH3XrepF.js → chunk-AQP2D5EJ-Evavw2Qw.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-CJQNdt2v.js → chunk-FMBD7UC4-CVuIoB79.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-CcxkLR8x.js → chunk-ND2GUHAM-Bedyq8-J.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN--e3-i6Ei.js → chunk-QZHKN3VN-CslOfkQg.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-D5Sj-C_X.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-D5Sj-C_X.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-D9lXU6hr.js → code-block-IT6T5CEO-bsC936tN.js} +1 -1
- package/dist/rcs-web/assets/{copy-DGJ36Idc.js → copy-DCC7RzR2.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-hOIwi1aZ.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-Bk5jqkQe.js} +1 -1
- package/dist/rcs-web/assets/{dagre-BM42HDAG-BPQQ96TG.js → dagre-BM42HDAG-B-x8fR4m.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-CLR_Phbu.js → diagram-2AECGRRQ-CsZv2Psb.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-CLWnRjBK.js → diagram-5GNKFQAL-BcYXy7MO.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-BL3D8pmI.js → diagram-KO2AKTUF-BjJST7Q-.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-OXbFOADC.js → diagram-LMA3HP47-BhzIJ5vj.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-2k9pa530.js → dist/rcs-web/assets/diagram-OG6HWLK6-BKN4TotX.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-DMx7MReU.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-CEEcJ3no.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-seK4rTjU.js → flowDiagram-I6XJVG4X-CGqPQbGE.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-B89rGHgc.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-Byt7vWZu.js} +1 -1
- package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-CZc1v0no.js → gitGraphDiagram-PVQCEYII-DL5rfdDX.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-CeGh4MXv.js → infoDiagram-5YYISTIA-_uDdZSq3.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-C0LJyHyd.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-oASsmQUS.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-Dleh_HZM.js → journeyDiagram-JHISSGLW-BXJWUGGs.js} +1 -1
- package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-Br8f2hg8.js → kanban-definition-UN3LZRKU-fvKiMkSD.js} +1 -1
- package/dist/rcs-web/assets/{linear-D7AT_2cB.js → linear-TM5xxJnF.js} +1 -1
- package/dist/rcs-web/assets/{main-DU4tqNTD.js → main-DrB3sbfk.js} +12 -12
- package/dist/rcs-web/assets/{mermaid-VLURNSYL-C1rDhYTC.js → mermaid-VLURNSYL-Dscj4u4i.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-B6lZnoad.js → mermaid.core-Bcqfc2ey.js} +5 -5
- package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-CLc9hYkr.js → mindmap-definition-RKZ34NQL-eXSVovf0.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-BDZzTeXG.js → dist/rcs-web/assets/pieDiagram-4H26LBE5-C50JrIh-.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-Crv3up_A.js → quadrantDiagram-W4KKPZXB-wXEhdATW.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-BXnQO4WS.js → requirementDiagram-4Y6WPE33-DWBtLk9F.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CjszWFSR.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CPsYFxLH.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-B1IqrmXj.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-C20Y3wg0.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-DpnuIetC.js → stateDiagram-AJRCARHV-CZe6o8l_.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-Doalz6kF.js → stateDiagram-v2-BHNVJYJU-Ztmndbls.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-B6fL9WVp.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-BA9OhQiY.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-NpYOQ9yd.js → vennDiagram-CIIHVFJN-CbkmNoMF.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-shB3lzpB.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-CaObqUdc.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-vdG6_jKc.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CoYZ5isQ.js} +1 -1
- package/dist/rcs-web/index.html +1 -1
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/session-visibility.test.ts +74 -0
- package/packages/remote-control-server/src/__tests__/shares.test.ts +73 -3
- package/packages/remote-control-server/src/db/rcs-schema.sql +121 -0
- package/packages/remote-control-server/src/db/sqlite.ts +39 -10
- package/packages/remote-control-server/src/routes/web/control.ts +1 -1
- package/packages/remote-control-server/src/routes/web/sessions.ts +21 -1
- package/packages/remote-control-server/src/routes/web/shares.ts +4 -2
- package/packages/remote-control-server/src/services/session.ts +60 -0
- package/packages/remote-control-server/src/types/api.ts +2 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-Bsimdm5Q.js → AdminPanel-B8BuW6U3.js} +1 -1
- package/{dist/rcs-web/assets/Claim-D-6HcIPy.js → packages/remote-control-server/web/dist/assets/Claim-Bc5MvUyK.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-D8JkTUyb.js +1 -0
- package/{dist/rcs-web/assets/Join-HoIZ1jyc.js → packages/remote-control-server/web/dist/assets/Join-DZwoyeOG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-bLM4Zn4h.js → Login-BLCeIURz.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-ByAIpM2v.js → Register-DlnIJyvt.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-Ok36DGag.js +55 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-p6speHFz.js → SessionVisibilityBadge-BTFvePCl.js} +1 -1
- package/{dist/rcs-web/assets/Setup-BfTiM2jB.js → packages/remote-control-server/web/dist/assets/Setup-BmaS0cmR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-DGo_cLNv.js → ShareLanding-hSlUOwmY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamCreate-DuC03Q55.js → TeamCreate-DSvsAFm1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/TeamDetail-BCpILjkt.js +6 -0
- package/packages/remote-control-server/web/dist/assets/{TeamList-gTscY5gq.js → TeamList-ad3mm3hY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-Dvvn1zTh.js → TeamSettings-BWzNEVzI.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/UserSearchInput-BMPx_a06.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{UserSettings-TpFvBUH2.js → UserSettings-crJkXh-k.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-cNQXzZJk.js → arc-D3D49Xtu.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-C97K07oU.js → architectureDiagram-3BPJPVTR-B2FZDdv-.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-CCawpz6v.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-BSCtI5ja.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-BT2wuHdt.js → c4Diagram-AAUBKEIU-9Jwp9YE4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-Ks7us70E.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-D7mXynqp.js → chunk-2J33WTMH-B7FEDH7A.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-Cr6Ax9dk.js → chunk-4BX2VUAB-Ckz1_Kja.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-D67JVqPZ.js → chunk-55IACEB6-QY67to6a.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-CVttzQWT.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CScpVqb2.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-fH3XrepF.js → chunk-AQP2D5EJ-Evavw2Qw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-CJQNdt2v.js → chunk-FMBD7UC4-CVuIoB79.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CcxkLR8x.js → chunk-ND2GUHAM-Bedyq8-J.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN--e3-i6Ei.js → chunk-QZHKN3VN-CslOfkQg.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-D5Sj-C_X.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-D5Sj-C_X.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-D9lXU6hr.js → code-block-IT6T5CEO-bsC936tN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-DGJ36Idc.js → copy-DCC7RzR2.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-hOIwi1aZ.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-Bk5jqkQe.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-BPQQ96TG.js → dagre-BM42HDAG-B-x8fR4m.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-CLR_Phbu.js → diagram-2AECGRRQ-CsZv2Psb.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-CLWnRjBK.js → diagram-5GNKFQAL-BcYXy7MO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-BL3D8pmI.js → diagram-KO2AKTUF-BjJST7Q-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-OXbFOADC.js → diagram-LMA3HP47-BhzIJ5vj.js} +1 -1
- package/{dist/rcs-web/assets/diagram-OG6HWLK6-2k9pa530.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-BKN4TotX.js} +1 -1
- package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-DMx7MReU.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-CEEcJ3no.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-seK4rTjU.js → flowDiagram-I6XJVG4X-CGqPQbGE.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-B89rGHgc.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-Byt7vWZu.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-CZc1v0no.js → gitGraphDiagram-PVQCEYII-DL5rfdDX.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-CeGh4MXv.js → infoDiagram-5YYISTIA-_uDdZSq3.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-C0LJyHyd.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-oASsmQUS.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-Dleh_HZM.js → journeyDiagram-JHISSGLW-BXJWUGGs.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-Br8f2hg8.js → kanban-definition-UN3LZRKU-fvKiMkSD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-D7AT_2cB.js → linear-TM5xxJnF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{main-DU4tqNTD.js → main-DrB3sbfk.js} +12 -12
- package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-C1rDhYTC.js → mermaid-VLURNSYL-Dscj4u4i.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-B6lZnoad.js → mermaid.core-Bcqfc2ey.js} +5 -5
- package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-CLc9hYkr.js → mindmap-definition-RKZ34NQL-eXSVovf0.js} +1 -1
- package/{dist/rcs-web/assets/pieDiagram-4H26LBE5-BDZzTeXG.js → packages/remote-control-server/web/dist/assets/pieDiagram-4H26LBE5-C50JrIh-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-Crv3up_A.js → quadrantDiagram-W4KKPZXB-wXEhdATW.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-BXnQO4WS.js → requirementDiagram-4Y6WPE33-DWBtLk9F.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CjszWFSR.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CPsYFxLH.js} +1 -1
- package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-B1IqrmXj.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-C20Y3wg0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-DpnuIetC.js → stateDiagram-AJRCARHV-CZe6o8l_.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-Doalz6kF.js → stateDiagram-v2-BHNVJYJU-Ztmndbls.js} +1 -1
- package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-B6fL9WVp.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-BA9OhQiY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-NpYOQ9yd.js → vennDiagram-CIIHVFJN-CbkmNoMF.js} +1 -1
- package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-shB3lzpB.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-CaObqUdc.js} +1 -1
- package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-vdG6_jKc.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CoYZ5isQ.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +1 -1
- package/dist/rcs-web/assets/Dashboard-C6G49-2O.js +0 -1
- package/dist/rcs-web/assets/SessionDetail-DbLnDhLO.js +0 -55
- package/dist/rcs-web/assets/TeamDetail-DQeJ56yT.js +0 -6
- package/dist/rcs-web/assets/channel-CElwc65q.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BYQJbP8Y.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BYQJbP8Y.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-C6G49-2O.js +0 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-DbLnDhLO.js +0 -55
- package/packages/remote-control-server/web/dist/assets/TeamDetail-DQeJ56yT.js +0 -6
- package/packages/remote-control-server/web/dist/assets/channel-CElwc65q.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BYQJbP8Y.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BYQJbP8Y.js +0 -1
- /package/{packages/remote-control-server/src/db/schema.sql → dist/rcs-schema.sql} +0 -0
|
@@ -42,9 +42,33 @@ const ResolvedDatabase: DatabaseCtor = (() => {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Tier 3: libsql (optionalDependency — covers Node 20/21)
|
|
45
|
+
// libsql 0.5.x exports the Database constructor directly (better-sqlite3
|
|
46
|
+
// compatible API): `require('libsql')` returns a function, not an object
|
|
47
|
+
// with a `.Database` property. Check `typeof === 'function'` and call
|
|
48
|
+
// `new libsql(path)` directly.
|
|
49
|
+
//
|
|
50
|
+
// Parameter format compatibility: bun:sqlite and node:sqlite both accept
|
|
51
|
+
// `$name` named params, but libsql (better-sqlite3 lineage) only accepts
|
|
52
|
+
// `:name` and `@name` — `$name` silently fails to bind, causing
|
|
53
|
+
// "NOT NULL constraint failed" errors. Convert `$name` → `:name` in SQL
|
|
54
|
+
// and `{$name: v}` → `{name: v}` in param objects so RCS queries work
|
|
55
|
+
// unchanged across all three backends.
|
|
45
56
|
try {
|
|
46
57
|
const libsql = require('libsql')
|
|
47
|
-
if (libsql
|
|
58
|
+
if (typeof libsql === 'function') {
|
|
59
|
+
const convertSql = (sql: string): string => sql.replace(/\$(\w+)/g, ':$1')
|
|
60
|
+
const convertParams = (params: unknown[]): unknown[] =>
|
|
61
|
+
params.map(p => {
|
|
62
|
+
if (p && typeof p === 'object' && !Array.isArray(p)) {
|
|
63
|
+
const obj = p as Record<string, unknown>
|
|
64
|
+
const out: Record<string, unknown> = {}
|
|
65
|
+
for (const k of Object.keys(obj)) {
|
|
66
|
+
out[k.startsWith('$') ? k.slice(1) : k] = obj[k]
|
|
67
|
+
}
|
|
68
|
+
return out
|
|
69
|
+
}
|
|
70
|
+
return p
|
|
71
|
+
})
|
|
48
72
|
return class LibsqlCompat {
|
|
49
73
|
private _db: {
|
|
50
74
|
prepare(sql: string): {
|
|
@@ -56,17 +80,17 @@ const ResolvedDatabase: DatabaseCtor = (() => {
|
|
|
56
80
|
close(): void
|
|
57
81
|
}
|
|
58
82
|
constructor(path: string) {
|
|
59
|
-
this._db = new libsql
|
|
83
|
+
this._db = new libsql(path)
|
|
60
84
|
}
|
|
61
85
|
exec(sql: string): void {
|
|
62
86
|
this._db.exec(sql)
|
|
63
87
|
}
|
|
64
88
|
query(sql: string) {
|
|
65
|
-
const stmt = this._db.prepare(sql)
|
|
89
|
+
const stmt = this._db.prepare(convertSql(sql))
|
|
66
90
|
return {
|
|
67
|
-
get: (...params: unknown[]) => stmt.get(...params),
|
|
68
|
-
all: (...params: unknown[]) => stmt.all(...params),
|
|
69
|
-
run: (...params: unknown[]) => stmt.run(...params),
|
|
91
|
+
get: (...params: unknown[]) => stmt.get(...convertParams(params)),
|
|
92
|
+
all: (...params: unknown[]) => stmt.all(...convertParams(params)),
|
|
93
|
+
run: (...params: unknown[]) => stmt.run(...convertParams(params)),
|
|
70
94
|
}
|
|
71
95
|
}
|
|
72
96
|
close(): void {
|
|
@@ -92,15 +116,20 @@ let _dbPath: string | null = null
|
|
|
92
116
|
* Idempotent — uses CREATE TABLE IF NOT EXISTS for new tables, plus
|
|
93
117
|
* ALTER TABLE ADD COLUMN for columns added to existing tables (gated by
|
|
94
118
|
* PRAGMA table_info so re-running on an already-migrated DB is a no-op).
|
|
95
|
-
* Reads schema.sql and executes as a single db.exec() call,
|
|
119
|
+
* Reads rcs-schema.sql and executes as a single db.exec() call,
|
|
96
120
|
* which correctly handles semicolons inside CHECK constraints.
|
|
121
|
+
*
|
|
122
|
+
* File is named rcs-schema.sql (not schema.sql) to avoid collision with
|
|
123
|
+
* CodeGraph's schema.sql at the same dist/ path — both modules resolve
|
|
124
|
+
* their schema via __dirname, and the bundler places them in the same
|
|
125
|
+
* chunk directory.
|
|
97
126
|
*/
|
|
98
127
|
export function migrateDatabase(db: Database): void {
|
|
99
|
-
const schemaPath = resolve(__dirname, 'schema.sql')
|
|
128
|
+
const schemaPath = resolve(__dirname, 'rcs-schema.sql')
|
|
100
129
|
const schema = readFileSync(schemaPath, 'utf8')
|
|
101
130
|
|
|
102
131
|
db.exec('PRAGMA foreign_keys = ON')
|
|
103
|
-
// Run ALTER TABLE migrations BEFORE db.exec(schema) — schema.sql's
|
|
132
|
+
// Run ALTER TABLE migrations BEFORE db.exec(schema) — rcs-schema.sql's
|
|
104
133
|
// CREATE INDEX statements reference the new columns, so the columns
|
|
105
134
|
// must exist before the indexes can be created. CREATE TABLE IF NOT
|
|
106
135
|
// EXISTS skips existing tables (so the ALTER adds the missing columns
|
|
@@ -116,7 +145,7 @@ export function migrateDatabase(db: Database): void {
|
|
|
116
145
|
* before owner_user_id / claim_token / claim_expires_at existed.
|
|
117
146
|
* CREATE TABLE IF NOT EXISTS skips existing tables entirely, so without
|
|
118
147
|
* this the new columns would never appear on upgraded DBs. Must run
|
|
119
|
-
* BEFORE db.exec(schema) because schema.sql's CREATE INDEX statements
|
|
148
|
+
* BEFORE db.exec(schema) because rcs-schema.sql's CREATE INDEX statements
|
|
120
149
|
* reference the new columns. On a fresh DB (table doesn't exist yet),
|
|
121
150
|
* skip entirely — db.exec(schema) will create the table with all columns.
|
|
122
151
|
*/
|
|
@@ -27,7 +27,7 @@ function checkOwnership(
|
|
|
27
27
|
sessionId: string,
|
|
28
28
|
): OwnershipCheckResult {
|
|
29
29
|
const uuid = c.get('userId')!
|
|
30
|
-
const resolvedSessionId = resolveOwnedWebSessionId(sessionId, uuid)
|
|
30
|
+
const resolvedSessionId = resolveOwnedWebSessionId(sessionId, uuid, true)
|
|
31
31
|
if (!resolvedSessionId) {
|
|
32
32
|
return { error: true }
|
|
33
33
|
}
|
|
@@ -5,9 +5,11 @@ import { SYSTEM_USER_ID } from '../../auth/constants'
|
|
|
5
5
|
import { getAutomationStateSnapshot } from '../../services/automationState'
|
|
6
6
|
import {
|
|
7
7
|
archiveSession,
|
|
8
|
+
canManageSession,
|
|
8
9
|
createSession,
|
|
9
10
|
getSession,
|
|
10
11
|
isSessionClosedStatus,
|
|
12
|
+
isSessionVisibleToUser,
|
|
11
13
|
listSessionSummaries,
|
|
12
14
|
listSessions,
|
|
13
15
|
listWebSessionSummariesByOwnerUuid,
|
|
@@ -15,6 +17,7 @@ import {
|
|
|
15
17
|
resolveOwnedWebSessionId,
|
|
16
18
|
toWebSessionResponse,
|
|
17
19
|
} from '../../services/session'
|
|
20
|
+
import { getDb } from '../../db/sqlite'
|
|
18
21
|
import {
|
|
19
22
|
storeBindSession,
|
|
20
23
|
storeGetEnvironment,
|
|
@@ -209,9 +212,11 @@ app.get('/sessions/:id', sessionAuth, async c => {
|
|
|
209
212
|
: null
|
|
210
213
|
const automationState = getAutomationStateSnapshot(worker?.externalMetadata)
|
|
211
214
|
const response = toWebSessionResponse(session)
|
|
215
|
+
const accessLevel = isSessionVisibleToUser(sessionId, uuid, getDb())
|
|
212
216
|
return c.json(
|
|
213
217
|
{
|
|
214
218
|
...response,
|
|
219
|
+
access_level: accessLevel,
|
|
215
220
|
...(automationState !== undefined
|
|
216
221
|
? { automation_state: automationState }
|
|
217
222
|
: {}),
|
|
@@ -305,13 +310,28 @@ app.get('/sessions/:id/events', sessionAuth, async c => {
|
|
|
305
310
|
* and kills the child process, releasing capacity. */
|
|
306
311
|
app.delete('/sessions/:id', sessionAuth, async c => {
|
|
307
312
|
const uuid = c.get('userId')!
|
|
308
|
-
const
|
|
313
|
+
const rawSessionId = c.req.param('id')!
|
|
314
|
+
// Resolve the session ID first (handles web/code prefix variants) using
|
|
315
|
+
// visibility check — read access is enough to discover the session, but
|
|
316
|
+
// deletion requires management permission (owner or team admin).
|
|
317
|
+
const sessionId = resolveOwnedWebSessionId(rawSessionId, uuid)
|
|
309
318
|
if (!sessionId) {
|
|
310
319
|
return c.json(
|
|
311
320
|
{ error: { type: 'forbidden', message: 'Not your session' } },
|
|
312
321
|
403,
|
|
313
322
|
)
|
|
314
323
|
}
|
|
324
|
+
if (!canManageSession(sessionId, uuid, getDb())) {
|
|
325
|
+
return c.json(
|
|
326
|
+
{
|
|
327
|
+
error: {
|
|
328
|
+
type: 'forbidden',
|
|
329
|
+
message: 'Only session owner or team admin can delete',
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
403,
|
|
333
|
+
)
|
|
334
|
+
}
|
|
315
335
|
const session = getSession(sessionId)
|
|
316
336
|
if (!session) {
|
|
317
337
|
return c.json(
|
|
@@ -79,14 +79,16 @@ function checkSessionOwnership(
|
|
|
79
79
|
return { userId }
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
// Check ownership: user's team owns the session
|
|
82
|
+
// Check ownership: user's team owns the session AND user is team owner/admin.
|
|
83
|
+
// 普通 team member 不能管理 share(与 session delete 权限一致)。
|
|
83
84
|
const teamOwner = db
|
|
84
85
|
.query(
|
|
85
86
|
`SELECT so.owner_id FROM session_owners so
|
|
86
87
|
JOIN team_members tm ON tm.team_id = so.owner_id
|
|
87
88
|
WHERE so.session_id = $sid
|
|
88
89
|
AND so.owner_type = 'team'
|
|
89
|
-
AND tm.user_id = $uid
|
|
90
|
+
AND tm.user_id = $uid
|
|
91
|
+
AND tm.role IN ('owner', 'admin')`,
|
|
90
92
|
)
|
|
91
93
|
.get({ $sid: sessionId, $uid: userId })
|
|
92
94
|
|
|
@@ -227,6 +227,56 @@ export function isSessionVisibleToUser(
|
|
|
227
227
|
return null
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Check if a user can perform management operations on a session (delete,
|
|
232
|
+
* create/revoke share, etc.).
|
|
233
|
+
*
|
|
234
|
+
* Management is granted to:
|
|
235
|
+
* - the direct user owner (session_owners owner_type='user')
|
|
236
|
+
* - a team owner's admin/owner (team_members.role ∈ {owner, admin})
|
|
237
|
+
* - a system admin (users.role='admin')
|
|
238
|
+
*
|
|
239
|
+
* Unlike isSessionVisibleToUser,普通 team member 不被视为 manager —
|
|
240
|
+
* 管理操作需要 owner/admin 级别权限。
|
|
241
|
+
*/
|
|
242
|
+
export function canManageSession(
|
|
243
|
+
sessionId: string,
|
|
244
|
+
userId: string,
|
|
245
|
+
db: Database,
|
|
246
|
+
): boolean {
|
|
247
|
+
// System admin bypass
|
|
248
|
+
const userRow = db
|
|
249
|
+
.query('SELECT role FROM users WHERE id = $userId')
|
|
250
|
+
.get({ $userId: userId }) as { role: string } | null
|
|
251
|
+
if (userRow?.role === 'admin') return true
|
|
252
|
+
|
|
253
|
+
// Direct user ownership
|
|
254
|
+
const directOwner = db
|
|
255
|
+
.query(
|
|
256
|
+
`SELECT 1 FROM session_owners
|
|
257
|
+
WHERE session_id = $sessionId AND owner_type = 'user' AND owner_id = $userId
|
|
258
|
+
LIMIT 1`,
|
|
259
|
+
)
|
|
260
|
+
.get({ $sessionId: sessionId, $userId: userId })
|
|
261
|
+
if (directOwner) return true
|
|
262
|
+
|
|
263
|
+
// Team ownership with manager role (owner/admin)
|
|
264
|
+
const teamManager = db
|
|
265
|
+
.query(
|
|
266
|
+
`SELECT 1 FROM session_owners so
|
|
267
|
+
JOIN team_members tm ON tm.team_id = so.owner_id
|
|
268
|
+
WHERE so.session_id = $sessionId
|
|
269
|
+
AND so.owner_type = 'team'
|
|
270
|
+
AND tm.user_id = $userId
|
|
271
|
+
AND tm.role IN ('owner', 'admin')
|
|
272
|
+
LIMIT 1`,
|
|
273
|
+
)
|
|
274
|
+
.get({ $sessionId: sessionId, $userId: userId })
|
|
275
|
+
if (teamManager) return true
|
|
276
|
+
|
|
277
|
+
return false
|
|
278
|
+
}
|
|
279
|
+
|
|
230
280
|
/**
|
|
231
281
|
* Resolve a session ID for a user, checking ownership, shares, and team access.
|
|
232
282
|
*
|
|
@@ -279,9 +329,14 @@ export function listWebSessionsByOwnerUuid(uuid: string): SessionResponse[] {
|
|
|
279
329
|
session => !isSessionClosedStatus(session.status),
|
|
280
330
|
)
|
|
281
331
|
const owners = storeGetSessionOwnersBulk(records.map(r => r.id))
|
|
332
|
+
const db = getDb()
|
|
282
333
|
return records
|
|
283
334
|
.map(r => toResponse(r, owners.get(r.id)))
|
|
284
335
|
.map(toWebSessionResponse)
|
|
336
|
+
.map(s => ({
|
|
337
|
+
...s,
|
|
338
|
+
access_level: isSessionVisibleToUser(s.id, uuid, db),
|
|
339
|
+
}))
|
|
285
340
|
}
|
|
286
341
|
|
|
287
342
|
export function listWebSessionSummariesByOwnerUuid(
|
|
@@ -291,9 +346,14 @@ export function listWebSessionSummariesByOwnerUuid(
|
|
|
291
346
|
session => !isSessionClosedStatus(session.status),
|
|
292
347
|
)
|
|
293
348
|
const owners = storeGetSessionOwnersBulk(records.map(r => r.id))
|
|
349
|
+
const db = getDb()
|
|
294
350
|
return records
|
|
295
351
|
.map(r => toSummaryResponse(r, owners.get(r.id)))
|
|
296
352
|
.map(toWebSessionSummaryResponse)
|
|
353
|
+
.map(s => ({
|
|
354
|
+
...s,
|
|
355
|
+
access_level: isSessionVisibleToUser(s.id, uuid, db),
|
|
356
|
+
}))
|
|
297
357
|
}
|
|
298
358
|
|
|
299
359
|
export function updateSessionTitle(sessionId: string, title: string) {
|
|
@@ -78,6 +78,7 @@ export interface SessionResponse {
|
|
|
78
78
|
updated_at: number
|
|
79
79
|
owner_type: 'user' | 'team' | null
|
|
80
80
|
owner_id: string | null
|
|
81
|
+
access_level?: 'owner' | 'write' | 'read' | null
|
|
81
82
|
automation_state?: AutomationStateResponse
|
|
82
83
|
worker?: SessionWorkerInfo | null
|
|
83
84
|
work_item?: SessionWorkItemInfo | null
|
|
@@ -160,6 +161,7 @@ export interface SessionSummaryResponse {
|
|
|
160
161
|
environment_id: string | null
|
|
161
162
|
owner_type: 'user' | 'team' | null
|
|
162
163
|
owner_id: string | null
|
|
164
|
+
access_level?: 'owner' | 'write' | 'read' | null
|
|
163
165
|
environment: {
|
|
164
166
|
id: string
|
|
165
167
|
machine_name: string | null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a1 as x,a2 as o,q as m,Y as s,K as l,i as u}from"./main-
|
|
1
|
+
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{a1 as x,a2 as o,q as m,Y as s,K as l,i as u}from"./main-DrB3sbfk.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function j(){x();const[a,i]=d.useState([]),{myTeams:r,isLoading:c}=o(),n=d.useCallback(async()=>{try{const t=await m();i(t||[])}catch(t){console.error("Admin: failed to load sessions",t)}},[]);return d.useEffect(()=>{n()},[n]),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-8",children:[e.jsx("h1",{className:"mb-6 font-display text-2xl font-semibold text-text-primary",children:s("admin.title")}),e.jsxs("section",{className:"mb-10",children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.teams")," (",r.length,")"]}),c?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("common.loading")}):r.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noTeams")}):e.jsx("div",{className:"space-y-2",children:r.map(t=>e.jsxs("a",{href:`/teams/${t.slug}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-medium text-text-primary",children:t.name}),e.jsx("span",{className:"ml-2 text-xs text-text-muted",children:t.slug})]}),e.jsx("span",{className:"text-xs text-text-muted",children:l(new Date(t.created_at).getTime()/1e3)})]},t.id))})]}),e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-4 font-display text-lg font-semibold text-text-primary",children:[s("admin.sessions")," (",a.length,")"]}),a.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-4 text-center text-text-muted",children:s("admin.noSessions")}):e.jsx("div",{className:"space-y-2",children:a.map(t=>e.jsxs("a",{href:`/code/${t.id}`,className:"flex items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 no-underline transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),e.jsx("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 text-xs text-text-muted",children:t.source||"unknown"})]}),e.jsx("div",{className:"truncate text-xs text-text-muted",children:t.id})]}),e.jsxs("div",{className:"ml-4 flex items-center gap-3",children:[e.jsx(u,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:l(t.updated_at||t.created_at)})]})]},t.id))})]})]})})}export{j as AdminPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{m as d}from"./main-
|
|
1
|
+
import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{m as d}from"./main-DrB3sbfk.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function f(){const r=window.location.pathname.split("/"),t=r[r.length-1]||"",[i,s]=a.useState("idle"),[o,c]=a.useState(null),[m,l]=a.useState(null);return a.useEffect(()=>{if(!t||!t.startsWith("clm_")){c("Invalid claim token"),s("error");return}s("claiming"),d(t).then(n=>{l(n.environment_id),s("success")}).catch(n=>{c(n instanceof Error?n.message:"Claim failed"),s("error")})},[t]),i==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):i==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:o}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[m&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:m}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]})}export{f as Claim};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,e as i}from"./vendor-DE_-CLIE.js";import{G as T,a2 as _,a0 as k,i as D,a1 as S,Y as a,K as M,Q as E,n as L,q as B,r as I,p as F}from"./main-DrB3sbfk.js";import{g as C}from"./workerType-Bd-zteMi.js";import{S as A,D as O,a as P,c as W,d as $,b as q}from"./SessionVisibilityBadge-BTFvePCl.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function G({teamName:n,className:c}){return n?e.jsx("span",{className:T("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",c),children:n}):null}function H({environments:n,onSelectEnvironment:c}){const{activeTeam:u}=_(),{user:m}=k(),l=i.useMemo(()=>(m==null?void 0:m.role)==="admin"?n:u?n.filter(r=>r.team_id===u.id):n.filter(r=>!r.team_id),[n,u,m]);return!l||l.length===0?e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No active environments"}):e.jsx("div",{className:"space-y-2",children:l.map(r=>{const d=r.worker_type==="acp",p=C(r.worker_type),h=p.fullLabel,b=p.colorClass;return e.jsxs("button",{type:"button",onClick:()=>c==null?void 0:c(r),disabled:d,className:`flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors ${d?"cursor-default opacity-80":"hover:border-border-light cursor-pointer"}`,children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium text-text-primary",children:r.machine_name||r.id}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${b}`,children:h}),e.jsx(G,{teamName:r.team_name??null})]}),e.jsx("div",{className:"text-sm text-text-muted",children:r.directory||""})]})}),e.jsxs("div",{className:"text-right",children:[e.jsx(D,{status:r.status}),e.jsx("div",{className:"mt-1 text-xs text-text-muted",children:r.branch||""})]})]},r.id)})})}function K({sessions:n,environments:c,onSelect:u,onDelete:m}){S();const{activeTeam:l,myTeams:r}=_(),{user:d}=k(),p=i.useMemo(()=>{const t=new Map;for(const f of r)t.set(f.id,f.name);return t},[r]),h=i.useMemo(()=>(d==null?void 0:d.role)==="admin"||!l?n:n.filter(t=>t.owner_type==="team"&&t.owner_id===l.id),[n,l,d]),{mySessions:b,sharedSessions:v}=i.useMemo(()=>{const t=[],f=[];for(const s of h)l?t.push(s):s.access_level==="write"||s.access_level==="read"?f.push(s):t.push(s);return{mySessions:t,sharedSessions:f}},[h,l]),g=new Map;for(const t of c??[])t!=null&&t.id&&t.worker_type&&g.set(t.id,t.worker_type);const o=(t,f)=>(f.updated_at||0)-(t.updated_at||0);function x(t){const f=!!m&&t.access_level!=="write"&&t.access_level!=="read";return e.jsxs("div",{className:"group flex w-full items-center justify-between rounded-xl border border-border bg-surface-1 px-4 py-3 text-left transition-colors hover:border-border-light hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>u(t.id),className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:t.title||t.id}),t.visibility&&e.jsx(A,{visibility:t.visibility||"private"}),(()=>{var w;let s=t.source==="acp"?"acp":(w=t.environment)==null?void 0:w.worker_type;!s&&t.environment_id&&(s=g.get(t.environment_id));const y=C(s);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${y.colorClass}`,children:y.fullLabel})})()]}),e.jsxs("div",{className:"flex items-center gap-2 truncate text-xs text-text-muted",children:[e.jsx("span",{className:"truncate font-mono",children:t.id}),t.owner_type==="team"&&t.owner_id&&e.jsxs("span",{className:"inline-flex items-center gap-2 truncate",children:[e.jsx("span",{className:"text-text-muted/40",children:"|"}),e.jsx("span",{className:"truncate",children:p.get(t.owner_id)||t.owner_id})]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{status:t.status}),e.jsx("span",{className:"text-xs text-text-muted",children:M(t.created_at||t.updated_at)}),f&&e.jsx("button",{type:"button",onClick:s=>{s.stopPropagation(),m(t.id)},className:"rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100",title:"Delete session",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id)}if(h.length===0)return e.jsx("div",{className:"rounded-xl border border-border bg-surface-1 p-8 text-center text-text-muted",children:"No sessions"});const j=[...b].sort(o),N=[...v].sort(o);return e.jsxs("div",{className:"space-y-4",children:[j.length>0&&e.jsxs("section",{className:"space-y-2",children:[!l&&N.length>0&&e.jsx("h3",{className:"px-1 text-xs font-medium uppercase tracking-wide text-text-muted",children:a("session.mySessions")}),j.map(x)]}),N.length>0&&e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"px-1 text-xs font-medium uppercase tracking-wide text-text-muted",children:a("session.sharedWithMe")}),N.map(x)]})]})}function Q({open:n,environments:c,onClose:u,onCreated:m}){S();const{activeTeam:l}=_(),{user:r}=k(),[d,p]=i.useState(""),[h,b]=i.useState(""),[v,g]=i.useState("same-dir"),[o,x]=i.useState(""),[j,N]=i.useState(!1),t=i.useMemo(()=>(r==null?void 0:r.role)==="admin"?c:l?c.filter(s=>s.team_id===l.id):c.filter(s=>!s.team_id),[c,l,r]);i.useEffect(()=>{n&&(p(""),b(""),g("same-dir"),x(""))},[n]);const f=async()=>{N(!0),x("");try{const s={};d.trim()&&(s.title=d.trim()),h&&(s.environment_id=h),s.spawn_mode=v;const y=E();y&&(s.team_id=y);const w=await L(s);m(w)}catch(s){x(s instanceof Error?s.message:a("dialog.createFailed"))}finally{N(!1)}};return e.jsx(O,{open:n,onOpenChange:s=>{s||u()},children:e.jsxs(P,{className:"max-w-md rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(W,{children:e.jsx($,{className:"font-display text-lg font-semibold text-text-primary",children:a("dialog.newSession")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.titleOptional")}),e.jsx("input",{type:"text",value:d,onChange:s=>p(s.target.value),placeholder:a("dialog.titlePlaceholder"),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 text-text-secondary",children:a("dialog.environment")}),e.jsxs("select",{value:h,onChange:s=>b(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"",children:a("dialog.none")}),t.map(s=>{const y=C(s.worker_type).shortLabel;return e.jsxs("option",{value:s.id,children:[s.machine_name||s.id," (",s.branch||a("dialog.noBranch"),") · ",y]},s.id)})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:a("dialog.workspaceMode")}),e.jsxs("select",{value:v,onChange:s=>g(s.target.value),className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary focus:border-brand focus:outline-none",children:[e.jsx("option",{value:"same-dir",children:a("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:a("dialog.worktree")})]})]}),o&&e.jsx("div",{className:"text-sm text-status-error",children:o})]}),e.jsxs(q,{children:[e.jsx("button",{onClick:u,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:a("common.cancel")}),e.jsx("button",{onClick:f,disabled:j,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:j?a("common.creating"):a("common.create")})]})]})})}function X({onNavigateSession:n}){S();const[c,u]=i.useState([]),[m,l]=i.useState([]),[r,d]=i.useState(!1),p=i.useCallback(async()=>{try{const[o,x]=await Promise.all([B(),I()]);u(o||[]),l(x||[])}catch(o){console.error("Dashboard render error:",o)}},[]);i.useEffect(()=>{p();const o=setInterval(p,1e4);return()=>clearInterval(o)},[p]);const h=o=>{d(!1),n(o.id)},b=i.useCallback(o=>{},[]),v=i.useCallback(o=>{n(o)},[n]),g=i.useCallback(async o=>{if(window.confirm(a("dashboard.confirmDelete").replace("{id}",o)))try{await F(o),u(x=>x.filter(j=>j.id!==o))}catch(x){alert(x instanceof Error?x.message:a("dashboard.deleteFailed"))}},[]);return e.jsx("div",{className:"px-6 py-12 sm:px-10 sm:py-16",children:e.jsxs("div",{children:[e.jsx("h1",{className:"sr-only",children:a("dashboard.title")}),e.jsxs("section",{className:"mb-16",children:[e.jsx("h2",{className:"mb-6 text-sm font-medium text-text-primary",children:a("dashboard.environments")}),e.jsx(H,{environments:m,onSelectEnvironment:b})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-medium text-text-primary",children:a("dashboard.sessions")}),e.jsx("button",{onClick:()=>d(!0),className:"rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:a("dashboard.newSession")})]}),e.jsx(K,{sessions:c,environments:m,onSelect:v,onDelete:g})]}),e.jsx(Q,{open:r,environments:m,onClose:()=>d(!1),onCreated:h})]})})}export{X as Dashboard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as v,Y as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as v,Y as t}from"./main-DrB3sbfk.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function E({onSuccess:b,onInvalidInvite:l}){const{join:h}=v(),[u,f]=r.useState(""),[d,j]=r.useState(""),[o,w]=r.useState(""),[c,g]=r.useState(""),[m,n]=r.useState(""),[x,p]=r.useState(!1);r.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("invite");a?f(a):l()},[l]);const y=async s=>{if(s.preventDefault(),n(""),o.length<8){n(t("auth.setup.passwordTooShort"));return}if(o!==c){n(t("auth.setup.passwordMismatch"));return}p(!0);try{await h(u,d,o),b()}catch(a){const i=a instanceof Error?a.message:"Join failed";if(i.includes("Invalid invitation")||i.includes("expired")||i.includes("already used")){l();return}n(i)}finally{p(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.join.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.join.welcome")}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:t("auth.join.description")})]}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.username")}),e.jsx("input",{type:"text",value:d,onChange:s=>j(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:c,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),m&&e.jsx("p",{className:"text-sm text-status-error",children:m}),e.jsx("button",{type:"submit",disabled:x||!u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{E as Join};
|
package/packages/remote-control-server/web/dist/assets/{Login-bLM4Zn4h.js → Login-BLCeIURz.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as f,Y as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as f,Y as t}from"./main-DrB3sbfk.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function N({onSuccess:d,onNavigateRegister:c}){const{login:m,registrationAllowed:x}=f(),[a,p]=r.useState(""),[o,b]=r.useState(""),[l,n]=r.useState(""),[i,u]=r.useState(!1),h=async s=>{s.preventDefault(),n(""),u(!0);try{await m(a,o),d()}catch{n(t("auth.login.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.login.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:h,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:a,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:o,onChange:s=>b(s.target.value),required:!0,autoComplete:"current-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),l&&e.jsx("p",{className:"text-sm text-status-error",children:l}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:i?t("common.loading"):t("auth.login.submit")})]}),x&&e.jsx("button",{type:"button",onClick:c,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.login.register")})]})})}export{N as Login};
|
package/packages/remote-control-server/web/dist/assets/{Register-ByAIpM2v.js → Register-DlnIJyvt.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as y,Y as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as y,Y as t}from"./main-DrB3sbfk.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function S({onSuccess:m,onBack:x}){const{register:p}=y(),[n,b]=r.useState(""),[a,h]=r.useState(""),[l,f]=r.useState(""),[i,o]=r.useState(""),[u,d]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}d(!0);try{await p(n,a),m()}catch(c){o(c instanceof Error?c.message:t("auth.register.failed"))}finally{d(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>b(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>h(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:u,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:u?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{S as Register};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var pe=Object.defineProperty;var he=(s,t,n)=>t in s?pe(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var $=(s,t,n)=>he(s,typeof t!="symbol"?t+"":t,n);import{e as x,j as e}from"./vendor-DE_-CLIE.js";import{H as P,t as fe,z as ye,M as ge,y as O,u as be,i as se,K as ne,L as re,k as je,h as we,J as I,G as L,d as Ne,Z as ke,v as ve,o as _e,x as Se,a1 as ae,Y as g,A as Ce,N as Me,_ as Ee,I as $e,p as Te,j as oe,c as Ae,C as Ie,s as Pe,V as Re,D as De,a as qe}from"./main-DrB3sbfk.js";import{g as Ue}from"./workerType-Bd-zteMi.js";import{D as ie,a as le,c as ce,d as de,b as Fe,S as Oe}from"./SessionVisibilityBadge-BTFvePCl.js";import{U as Le}from"./UserSearchInput-BMPx_a06.js";import"./shiki-mEP5vQQu.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 He=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],ze=P("activity",He);/**
|
|
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 Be=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ve=P("chevron-right",Be);/**
|
|
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 Qe=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],G=P("clock",Qe);/**
|
|
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 We=[["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"}]],Ke=P("cpu",We);/**
|
|
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 Ye=[["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"}]],Je=P("hash",Ye);/**
|
|
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 Ge=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ze=P("info",Ge);/**
|
|
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 Xe=[["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"}]],et=P("play",Xe);/**
|
|
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 tt=[["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"}]],st=P("server-cog",tt);/**
|
|
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 nt=[["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"}]],rt=P("share-2",nt);/**
|
|
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 at=[["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"}]],ot=P("triangle-alert",at);function ue(){return{tasks:{}}}const Z=3e4;function V(s){const t=s.trim();if(!t)return"agent";const n=t.split(/\s+/).slice(0,2).join(" ");return n.length>40?n.slice(0,40)+"…":n}function it(s,t){var p,d,u,l,o,a,h,b,f,y,w,N;const n=t.subtype;if(n!=="task_started"&&n!=="task_progress"&&n!=="task_notification")return s;const r=t.task_id;if(!r)return s;const c=Date.now(),i=s.tasks[r];if(n==="task_started"){if(i)return{tasks:{...s.tasks,[r]:{...i,description:t.description??i.description,name:V(t.description??i.description),taskType:t.task_type??i.taskType,workflowName:t.workflow_name??i.workflowName,prompt:t.prompt??i.prompt,toolUseId:t.tool_use_id??i.toolUseId,status:"running",startTime:c,evictAfter:void 0}}};const k=t.description??"";return{tasks:{...s.tasks,[r]:{taskId:r,name:V(k),description:k,taskType:t.task_type,workflowName:t.workflow_name,prompt:t.prompt,toolUseId:t.tool_use_id,status:"running",startTime:c}}}}if(n==="task_progress"){if(!i){const k=t.description??"";return{tasks:{...s.tasks,[r]:{taskId:r,name:V(k),description:k,toolUseId:t.tool_use_id,status:"running",startTime:c,tokenCount:(p=t.usage)==null?void 0:p.total_tokens,toolUseCount:(d=t.usage)==null?void 0:d.tool_uses,durationMs:(u=t.usage)==null?void 0:u.duration_ms,lastToolName:t.last_tool_name,summary:t.summary}}}}return{tasks:{...s.tasks,[r]:{...i,description:t.description??i.description,tokenCount:((l=t.usage)==null?void 0:l.total_tokens)??i.tokenCount,toolUseCount:((o=t.usage)==null?void 0:o.tool_uses)??i.toolUseCount,durationMs:((a=t.usage)==null?void 0:a.duration_ms)??i.durationMs,lastToolName:t.last_tool_name??i.lastToolName,summary:t.summary??i.summary}}}}return i?{tasks:{...s.tasks,[r]:{...i,status:t.status??"completed",endTime:c,finalSummary:t.summary??i.finalSummary,outputFile:t.output_file??i.outputFile,tokenCount:((y=t.usage)==null?void 0:y.total_tokens)??i.tokenCount,toolUseCount:((w=t.usage)==null?void 0:w.tool_uses)??i.toolUseCount,durationMs:((N=t.usage)==null?void 0:N.duration_ms)??i.durationMs,evictAfter:c+Z}}}:{tasks:{...s.tasks,[r]:{taskId:r,name:V(t.summary??""),description:t.summary??"",status:t.status??"completed",startTime:c,endTime:c,finalSummary:t.summary,outputFile:t.output_file,tokenCount:(h=t.usage)==null?void 0:h.total_tokens,toolUseCount:(b=t.usage)==null?void 0:b.tool_uses,durationMs:(f=t.usage)==null?void 0:f.duration_ms,evictAfter:c+Z}}}}function lt(s,t=Date.now()){return Object.values(s.tasks).filter(n=>n.evictAfter===void 0||n.evictAfter>t).sort((n,r)=>n.startTime-r.startTime)}class ct{constructor(){$(this,"listeners",new Set);$(this,"eventSource",null);$(this,"_lastSeqNum",0)}onEvent(t){return this.listeners.add(t),()=>this.listeners.delete(t)}connect(t){this.disconnect();const n=`/web/sessions/${t}/events`,r=new EventSource(n,{withCredentials:!0});this.eventSource=r,r.addEventListener("message",c=>{try{const i=JSON.parse(c.data);if(i.seqNum!==void 0&&i.seqNum<=this._lastSeqNum)return;i.seqNum!==void 0&&(this._lastSeqNum=i.seqNum);for(const p of this.listeners)p(i)}catch{}})}disconnect(){this.eventSource&&(this.eventSource.close(),this.eventSource=null),this._lastSeqNum=0}}const J=new ct;function X(s){if(typeof s.content=="string")return s.content;if(s.message&&typeof s.message=="object"){const t=s.message;if(typeof t.content=="string")return t.content;if(Array.isArray(t.content))return t.content.filter(n=>n.type==="text"&&typeof n.text=="string").map(n=>n.text).join("")}return""}function ee(s,t){for(let n=s.length-1;n>=0;n--){const r=s[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}class dt{constructor(t,n,r){$(this,"sessionId");$(this,"setEntries");$(this,"unsub",null);$(this,"onStatusChange");$(this,"onError");$(this,"onPermissionRequest");$(this,"onModelsStateChange");$(this,"onSubagentUpdate");$(this,"subagentState",ue());this.sessionId=t,this.setEntries=n,this.onStatusChange=r==null?void 0:r.onStatusChange,this.onError=r==null?void 0:r.onError,this.onPermissionRequest=r==null?void 0:r.onPermissionRequest,this.onModelsStateChange=r==null?void 0:r.onModelsStateChange,this.onSubagentUpdate=r==null?void 0:r.onSubagentUpdate}async init(){await this.loadHistory(),this.connectSSE()}async loadHistory(){var p;const{events:t}=await fe(this.sessionId);if(!t||t.length===0)return;const n=[];let r=null;const c=()=>{r&&(n.push(r),r=null)};for(const d of t){const u=d.payload||{};if(d.type==="user"){if(d.direction==="inbound")continue;c();const l=X(u);l&&n.push({type:"user_message",id:d.id||`hist-user-${n.length}`,content:l})}else if(d.type==="assistant"){c();const l=X(u),o=[],a=u.message;if(a&&typeof a=="object"&&Array.isArray(a.content))for(const h of a.content)h.type==="tool_use"&&o.push({type:"tool_call",toolCall:{id:h.id||`hist-tool-${n.length}`,title:h.name||"tool",status:"complete",rawInput:h.input||{}}});if(l||o.length>0){r={type:"assistant_message",id:d.id||`hist-asst-${n.length}`,chunks:l?[{type:"message",text:l}]:[]},n.push(r);for(const h of o)n.push(h);r=null}}else if(d.type==="tool_use"){const l=u,o={type:"tool_call",toolCall:{id:l.tool_call_id||`hist-tool-${n.length}`,title:l.tool_name||"tool",status:"complete",rawInput:l.tool_input||{}}};n.push(o)}else if(d.type==="tool_result"){const l=u,o=ee(n,l.tool_call_id||"");if(o>=0){const a=n[o];n[o]={type:"tool_call",toolCall:{...a.toolCall,rawOutput:{output:l.content||l.output||""}}}}}}c(),this.setEntries(n);let i=null;for(const d of t){if(d.type!=="models_state")continue;const u=d.payload||{},l=u.raw,o=l&&typeof l=="object"?l.models_state:u.models_state;o&&Array.isArray(o.availableModels)&&typeof o.currentModelId=="string"&&(i=o)}i&&((p=this.onModelsStateChange)==null||p.call(this,i))}connectSSE(){J.connect(this.sessionId),this.unsub=J.onEvent(t=>this.handleEvent(t))}disconnect(){this.unsub&&(this.unsub(),this.unsub=null),J.disconnect()}handleEvent(t){var i,p,d,u,l;const n=t.type,r=t.payload||{},c=JSON.stringify(t);if(!/Remote Control connecting/i.test(c))switch(n){case"assistant":{const o=typeof r.content=="string"?r.content:"";this.setEntries(h=>{const b=h[h.length-1];if((b==null?void 0:b.type)==="assistant_message"){const f=b.chunks[b.chunks.length-1];return(f==null?void 0:f.type)==="message"?[...h.slice(0,-1),{...b,chunks:[...b.chunks.slice(0,-1),{type:"message",text:f.text+o}]}]:[...h.slice(0,-1),{...b,chunks:[...b.chunks,{type:"message",text:o}]}]}if(o&&o.trim()){const f={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:o}]};return[...h,f]}return h});const a=r.message;if(a&&typeof a=="object"&&Array.isArray(a.content)){const h=a.content.filter(b=>b.type==="tool_use");for(const b of h){const y={id:b.id||`call-${Date.now()}-${Math.random().toString(16).slice(2,8)}`,title:b.name||"tool",status:"running",rawInput:b.input||{}};this.setEntries(w=>[...w,{type:"tool_call",toolCall:y}])}}break}case"tool_use":{const o=r,h={id:o.tool_call_id||`call-${Date.now()}`,title:o.tool_name||"tool",status:"running",rawInput:o.tool_input||{}};this.setEntries(b=>[...b,{type:"tool_call",toolCall:h}]);break}case"tool_result":{const o=r,a=o.tool_call_id||"";this.setEntries(h=>{const b=ee(h,a);if(b<0)return h;const f=h[b];return h.map((y,w)=>w===b?{type:"tool_call",toolCall:{...f.toolCall,status:"complete",rawOutput:{output:o.content||o.output||""}}}:y)});break}case"control_request":case"permission_request":{const o=r.request;if(o&&o.subtype==="can_use_tool"){const a=r.request_id||"",h=o.tool_name||"unknown",b=o.input||o.tool_input||{},f=o.description||"";this.setEntries(y=>{const w=[...y].reverse().findIndex(N=>N.type==="tool_call");if(w>=0){const N=y.length-1-w,k=y[N];if(k.toolCall.status==="running")return y.map((M,E)=>E===N?{type:"tool_call",toolCall:{...k.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:a,options:[]}}}:M)}return y}),(i=this.onPermissionRequest)==null||i.call(this,{requestId:a,toolName:h,toolInput:b,description:f})}break}case"session_status":{typeof r.status=="string"&&((p=this.onStatusChange)==null||p.call(this,r.status));break}case"error":{const o=String(r.message||r.content||"Unknown error");(d=this.onError)==null||d.call(this,o);break}case"models_state":{const o=r.raw,a=typeof o=="object"&&o!==null?o.models_state:r.models_state;a&&Array.isArray(a.availableModels)&&typeof a.currentModelId=="string"&&((u=this.onModelsStateChange)==null||u.call(this,a));break}case"system":{const o=r.raw,a=o&&typeof o=="object"?o:r,h=typeof a.subtype=="string"?a.subtype:void 0;if(h==="task_started"||h==="task_progress"||h==="task_notification"){const b={subtype:h,task_id:typeof a.task_id=="string"?a.task_id:void 0,tool_use_id:typeof a.tool_use_id=="string"?a.tool_use_id:void 0,description:typeof a.description=="string"?a.description:void 0,task_type:typeof a.task_type=="string"?a.task_type:void 0,workflow_name:typeof a.workflow_name=="string"?a.workflow_name:void 0,prompt:typeof a.prompt=="string"?a.prompt:void 0,usage:a.usage&&typeof a.usage=="object"?a.usage:void 0,last_tool_name:typeof a.last_tool_name=="string"?a.last_tool_name:void 0,summary:typeof a.summary=="string"?a.summary:void 0,status:a.status==="completed"||a.status==="failed"||a.status==="stopped"?a.status:void 0,output_file:typeof a.output_file=="string"?a.output_file:void 0};this.subagentState=it(this.subagentState,b),(l=this.onSubagentUpdate)==null||l.call(this,this.subagentState)}break}}}async sendMessage(t,n,r){const c=n&&n.length>0,i=r&&r.length>0;if(!t.trim()&&!c&&!i)return;const p={type:"user_message",id:`user-${Date.now()}`,content:t,images:c?n:void 0,attachments:i?r:void 0};this.setEntries(l=>[...l,p]);const d=[];if(t&&d.push({type:"text",text:t}),c)for(const l of n)d.push({type:"image",source:{type:"base64",media_type:l.mimeType,data:l.data}});if(i){for(const l of r)if(l.kind==="text"||l.kind==="table"){const o=`📎 ${l.name}${l.size!=null?` (${ut(l.size)})`:""}`,a=l.textContent||"(空文件)";d.push({type:"text",text:`${o}
|
|
52
|
+
\`\`\`
|
|
53
|
+
${a}
|
|
54
|
+
\`\`\``})}else if(l.kind==="directory"){const o=`📁 目录: ${l.name}${l.files!=null?` (${l.files.length} 个文件)`:""}`,a=l.textContent||"(空目录)";d.push({type:"text",text:`${o}
|
|
55
|
+
${a}`})}}const u=d.length===1&&d[0].type==="text"?d[0].text||t:d.length>0?d:t;await ye(this.sessionId,{type:"user",uuid:ge(),content:t,message:{content:u}})}async respondPermission(t,n,r){await O(this.sessionId,{type:"permission_response",approved:n,request_id:t,...r}),this.setEntries(c=>c.map(i=>{var p;return i.type!=="tool_call"||((p=i.toolCall.permissionRequest)==null?void 0:p.requestId)!==t?i:{type:"tool_call",toolCall:{...i.toolCall,status:n?"running":"rejected",permissionRequest:void 0}}}))}async interrupt(){this.setEntries(t=>t.map(n=>n.type!=="tool_call"||n.toolCall.status!=="running"&&n.toolCall.status!=="waiting_for_confirmation"?n:{type:"tool_call",toolCall:{...n.toolCall,status:"canceled",permissionRequest:void 0}})),await be(this.sessionId)}}function ut(s){return s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function mt(s){if(!s)return"never";const t=Math.max(0,Date.now()-s);return t<5e3?"just now":t<6e4?`${Math.floor(t/1e3)}s ago`:t<36e5?`${Math.floor(t/6e4)}m ago`:`${Math.floor(t/36e5)}h ago`}function xt(s){return s?Date.now()-s<6e4:!1}function pt({onClose:s,session:t,liveStatus:n,pendingPermissions:r,onInterrupt:c,onDelete:i}){const[p,d]=x.useState(!1),u=async()=>{await navigator.clipboard.writeText(t.id),d(!0),setTimeout(()=>d(!1),1500)},l=r.length,o=t.worker,a=t.work_item,h=t.environment;return e.jsx(ie,{open:!0,onOpenChange:b=>{b||s()},children:e.jsxs(le,{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(ce,{children:e.jsx(de,{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(ze,{className:"h-3.5 w-3.5"}),"Status"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{status:n||t.status||"unknown"}),e.jsx("span",{className:"text-xs text-text-muted",children:o&&(xt(o.last_heartbeat_at)?"· worker online":"· worker offline")})]}),e.jsxs("dl",{className:"space-y-1 text-xs text-text-muted",children:[o&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(G,{className:"h-3 w-3"}),"Heartbeat"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:mt(o.last_heartbeat_at)})]}),h&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(Ke,{className:"h-3 w-3"}),"Environment"]}),e.jsx("dd",{className:"truncate text-text-secondary",children:h.machine_name||h.id})]}),t.created_at&&e.jsxs("div",{className:"flex justify-between",children:[e.jsxs("dt",{className:"flex items-center gap-1",children:[e.jsx(G,{className:"h-3 w-3"}),"Created"]}),e.jsx("dd",{className:"font-mono text-text-secondary",children:ne(t.created_at)})]})]})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Pending Actions"]}),l>0?e.jsxs("div",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning",children:[l," permission request",l>1?"s":""," awaiting your approval"]}):e.jsx("p",{className:"text-xs text-text-muted",children:"No pending actions"})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-wide text-text-muted",children:[e.jsx(st,{className:"h-3.5 w-3.5"}),"Quick Actions"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"flex-1 rounded-md border border-border px-3 py-1.5 text-xs text-text-secondary hover:bg-surface-2 transition-colors",children:"Interrupt"}),e.jsxs("button",{onClick:i,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(je,{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(Je,{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:u,className:"text-text-muted hover:text-text-primary transition-colors flex-shrink-0",title:"Copy session id",children:p?"✓":"⧉"})]})]}),a&&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:a.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:a.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})]}),h&&e.jsxs("div",{className:"flex justify-between",children:[e.jsx("dt",{children:"Worker type"}),e.jsx("dd",{className:"font-mono text-text-secondary",children:h.worker_type})]})]})]})]})]})})}const te="rcs:subagent-panel:collapsed";function ht(s){if(s<1e3)return"0s";const t=Math.floor(s/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),r=t%60;if(n<60)return r?`${n}m${r}s`:`${n}m`;const c=Math.floor(n/60),i=n%60;return i?`${c}h${i}m`:`${c}h`}function ft(s){return s===void 0||s<=0?"":s<1e3?`${s}`:s<1e6?`${(s/1e3).toFixed(s<1e4?1:0)}k`:`${(s/1e6).toFixed(1)}M`}function yt({status:s}){return s==="running"?e.jsx(re,{className:"h-3 w-3 animate-spin text-brand"}):s==="completed"?e.jsx(et,{className:"h-3 w-3 text-status-success"}):s==="failed"||s==="stopped"?e.jsx(we,{className:"h-3 w-3 text-status-error"}):null}function gt({task:s}){const t=s.status==="running",n=t?s.durationMs??Date.now()-s.startTime:(s.endTime??Date.now())-s.startTime,r=ft(s.tokenCount),c=s.toolUseCount!==void 0&&s.toolUseCount>0?`${s.toolUseCount} tool${s.toolUseCount>1?"s":""}`:"",i=s.summary||s.description||"(no description)";return e.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-surface-2 px-2.5 py-1.5 text-xs",children:[e.jsx("div",{className:"mt-0.5 flex-shrink-0",children:e.jsx(yt,{status:s.status})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate font-medium text-text-primary",children:s.name}),e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:ht(n)})]}),e.jsx("div",{className:"mt-0.5 truncate text-text-secondary",children:i}),(r||c||s.lastToolName)&&e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-text-muted",children:[r&&e.jsxs("span",{children:["↕ ",r," tok"]}),c&&e.jsxs("span",{children:["· ",c]}),s.lastToolName&&e.jsxs("span",{className:"truncate",children:["· last: ",s.lastToolName]})]}),!t&&s.finalSummary&&e.jsx("div",{className:"mt-1 rounded bg-status-success/10 px-1.5 py-0.5 text-[10px] text-status-success",children:s.finalSummary})]})]})}function bt({state:s}){const[t,n]=x.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(te)==="1"}catch{return!1}}),r=()=>{n(u=>{const l=!u;try{window.localStorage.setItem(te,l?"1":"0")}catch{}return l})},[,c]=x.useState(0);x.useEffect(()=>{const u=Object.values(s.tasks).some(a=>a.status==="running"),l=Object.values(s.tasks).some(a=>a.status!=="running"&&a.evictAfter!==void 0);if(!u&&!l)return;const o=setInterval(()=>{c(a=>a+1)},1e3);return()=>clearInterval(o)},[s]);const i=lt(s);if(i.length===0)return null;const p=i.filter(u=>u.status==="running").length,d=p>0?`${p} running`:`${i.length} recent`;return e.jsx("section",{"aria-label":"Subagents",className:"border-t border-border bg-surface-1 px-4 py-2",children:e.jsxs("div",{className:"mx-auto max-w-3xl space-y-1.5",children:[e.jsxs("button",{type:"button",onClick:r,"aria-expanded":!t,"aria-controls":"subagent-list",className:"flex w-full items-center justify-between text-[10px] font-medium uppercase tracking-wide text-text-muted hover:text-text-secondary transition-colors",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ve,{className:`h-3 w-3 transition-transform ${t?"":"rotate-90"}`}),e.jsx("span",{children:"Subagents"})]}),e.jsx("span",{children:d})]}),!t&&e.jsx("div",{id:"subagent-list",className:"space-y-1.5",children:i.map(u=>e.jsx(gt,{task:u},u.taskId))})]})})}function jt({requestId:s,toolName:t,toolInput:n,description:r,onApprove:c,onReject:i}){const p=typeof n=="string"?n:JSON.stringify(n,null,2);return e.jsxs("div",{className:"rounded-xl border border-warning-border/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-warning-border/15 text-warning-text",children:e.jsx(ot,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-semibold text-warning-text",children:"Permission Request"})]}),r&&e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:I(r)}),e.jsx("div",{className:"mb-2 font-mono text-xs font-bold text-text-primary",children:I(t)}),t!=="AskUserQuestion"&&e.jsx("pre",{className:"mb-3 max-h-40 overflow-auto rounded-lg bg-surface-1 p-2 text-xs text-text-secondary font-mono",children:ke(p,500)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:c,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Approve"}),e.jsx("button",{onClick:i,className:"rounded-lg bg-status-error/20 px-4 py-2 text-sm font-medium text-status-error hover:bg-status-error/30 transition-colors",children:"Reject"})]})]})}function wt({questions:s,description:t,onSubmit:n,onSkip:r}){const[c,i]=x.useState({}),[p,d]=x.useState({}),[u,l]=x.useState(0),o=(f,y,w)=>{if(w){const N=c[f]||[],k=N.includes(y)?N.filter(M=>M!==y):[...N,y];i({...c,[f]:k})}else i({...c,[f]:y})},a=f=>{var w;const y=(w=p[f])==null?void 0:w.trim();y&&(i({...c,[f]:y}),d({...p,[f]:""}))},h=()=>{var y,w;const f={};for(const[N,k]of Object.entries(c)){const M=s[parseInt(N,10)];M&&(typeof k=="number"?f[N]=((w=(y=M.options)==null?void 0:y[k])==null?void 0:w.label)||String(k):Array.isArray(k)?f[N]=k.map(E=>{var T,R;return((R=(T=M.options)==null?void 0:T[E])==null?void 0:R.label)||String(E)}):f[N]=k)}n(f)};if(s.length<=1){const f=s[0]||{question:t,options:[],multiSelect:!1},y=f.multiSelect||!1;return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:I(t||f.question||"Question")}),e.jsxs("div",{className:"space-y-2",children:[(f.options||[]).map((w,N)=>{const k=y?(c[0]||[]).includes(N):c[0]===N;return e.jsxs("button",{onClick:()=>o(0,N,y),className:L("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",k?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:I(w.label)}),w.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:I(w.description)})]},N)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:p[0]||"",onChange:w=>d({...p,0:w.target.value}),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:w=>w.key==="Enter"&&a(0)}),e.jsx("button",{onClick:()=>a(0),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx("button",{onClick:h,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit"}),e.jsx("button",{onClick:r,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})}const b=s[u];return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsx("div",{className:"mb-3 text-sm font-semibold text-text-primary",children:I(t||"Questions")}),e.jsx("div",{className:"mb-3 flex gap-1 overflow-x-auto",children:s.map((f,y)=>e.jsx("button",{onClick:()=>l(y),className:L("rounded-md px-3 py-1.5 text-xs whitespace-nowrap transition-colors",u===y?"bg-brand/20 text-brand":"text-text-muted hover:bg-surface-2"),children:f.header||`Q${y+1}`},y))}),b&&e.jsx(Nt,{question:b,qIdx:u,answers:c,otherTexts:p,onSelect:o,onOtherTextChange:(f,y)=>d({...p,[f]:y}),onOtherSubmit:a}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-text-muted",children:[u+1," / ",s.length]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:h,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Submit All"}),e.jsx("button",{onClick:r,className:"rounded-lg border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Skip"})]})]})]})}function Nt({question:s,qIdx:t,answers:n,otherTexts:r,onSelect:c,onOtherTextChange:i,onOtherSubmit:p}){const d=s.multiSelect||!1;return e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-sm text-text-secondary",children:I(s.question)}),e.jsxs("div",{className:"space-y-2",children:[(s.options||[]).map((u,l)=>{const o=d?(n[t]||[]).includes(l):n[t]===l;return e.jsxs("button",{onClick:()=>c(t,l,d),className:L("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",o?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsx("div",{className:"font-medium",children:I(u.label)}),u.description&&e.jsx("div",{className:"mt-0.5 text-xs text-text-muted",children:I(u.description)})]},l)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:r[t]||"",onChange:u=>i(t,u.target.value),placeholder:"Other...",className:"flex-1 rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",onKeyDown:u=>u.key==="Enter"&&p(t)}),e.jsx("button",{onClick:()=>p(t),className:"rounded-lg border border-border px-3 py-2 text-sm text-text-secondary hover:bg-surface-2 transition-colors",children:"Send"})]})]})]})}function kt({planContent:s,description:t,onSubmit:n}){const[r,c]=x.useState(null),[i,p]=x.useState(""),d=!s||!s.trim(),u=()=>{r&&n(r,r==="no"?i:void 0)};return e.jsxs("div",{className:"rounded-xl border border-brand/30 bg-surface-1 p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-brand/15 text-brand",children:e.jsx(Ne,{className:"h-3 w-3",strokeWidth:2.5})}),e.jsx("span",{className:"text-sm font-semibold text-text-primary",children:d?"Exit plan mode?":"Ready to code?"})]}),!d&&e.jsx("div",{className:"mb-4 max-h-64 overflow-auto rounded-lg bg-tool-card p-4 text-sm text-text-secondary",dangerouslySetInnerHTML:{__html:vt(s)}}),e.jsx("div",{className:"space-y-2",children:d?e.jsxs(e.Fragment,{children:[e.jsx(F,{selected:r==="yes-default",onClick:()=>c("yes-default"),label:"Yes"}),e.jsx(F,{selected:r==="no",onClick:()=>c("no"),label:"No"})]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{selected:r==="yes-accept-edits",onClick:()=>c("yes-accept-edits"),label:"Yes, auto-accept edits",desc:"Approve plan and auto-accept file edits"}),e.jsx(F,{selected:r==="yes-default",onClick:()=>c("yes-default"),label:"Yes, manually approve edits",desc:"Approve plan but confirm each edit"}),e.jsx(F,{selected:r==="no",onClick:()=>c("no"),label:"No, keep planning",desc:"Provide feedback to refine the plan"})]})}),r==="no"&&e.jsx("textarea",{value:i,onChange:l=>p(l.target.value),placeholder:"Tell Saluzi what to change...",className:"mt-3 w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none",rows:3}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{onClick:u,disabled:!r,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light disabled:opacity-50 transition-colors",children:"Submit"})})]})}function F({selected:s,onClick:t,label:n,desc:r}){return e.jsxs("button",{onClick:t,className:L("w-full rounded-lg border px-4 py-2.5 text-left text-sm transition-colors",s?"border-brand bg-brand/10 text-text-primary":"border-border bg-surface-2 text-text-secondary hover:border-border-light"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:L("flex h-4 w-4 items-center justify-center rounded-full border text-[10px] transition-colors",s?"border-brand bg-brand text-white":"border-border"),children:s&&"✓"}),e.jsx("span",{className:"font-medium",children:n})]}),r&&e.jsx("div",{className:"mt-0.5 pl-6 text-xs text-text-muted",children:r})]})}function vt(s){let t=I(s);return t=t.replace(/```(\w*)\n?([\s\S]*?)```/g,(n,r,c)=>`<pre class="my-2 overflow-x-auto rounded-lg bg-tool-card p-3 font-mono text-xs">${c.trim()}</pre>`),t=t.replace(/`([^`]+)`/g,'<code class="rounded bg-tool-card px-1.5 py-0.5 font-mono text-xs">$1</code>'),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t}function _t(s){const[t,n]=x.useState([]),[r,c]=x.useState(!0),[i,p]=x.useState(null),d=x.useCallback(async()=>{c(!0),p(null);try{const o=await ve(s);n(o)}catch(o){p(o instanceof Error?o.message:"Failed to load shares")}finally{c(!1)}},[s]);x.useEffect(()=>{d()},[d]);const u=x.useCallback(async o=>{p(null);try{const a=await _e(s,o);return await d(),a}catch(a){throw p(a instanceof Error?a.message:"Failed to create share"),a}},[s,d]),l=x.useCallback(async o=>{p(null);try{await Se(s,o),await d()}catch(a){throw p(a instanceof Error?a.message:"Failed to revoke share"),a}},[s,d]);return{shares:t,isLoading:r,error:i,createShare:u,revokeShare:l,refresh:d}}function St({open:s,onClose:t,sessionId:n,sessionTitle:r}){ae();const{shares:c,isLoading:i,error:p,createShare:d,revokeShare:u}=_t(n),[l,o]=x.useState("user"),[a,h]=x.useState(""),[b,f]=x.useState(""),[y,w]=x.useState("read"),[N,k]=x.useState(""),[M,E]=x.useState(!1),[T,R]=x.useState(null),[H,U]=x.useState(""),[z,S]=x.useState(!1),[q,D]=x.useState(!1);x.useEffect(()=>{s&&(o("user"),h(""),f(""),w("read"),k(""),E(!1),R(null),U(""),S(!1),D(!1))},[s]);const Q=async()=>{E(!0),U(""),R(null);try{const j={grantedTo:l==="user"?{userId:a.trim()}:{teamId:b.trim()},permission:y};N.trim()&&(j.expiresAt=N.trim());const K=await d(j);R(`${window.location.origin}/code/s/${K.shareToken}`)}catch(j){U(j instanceof Error?j.message:"Failed to create share")}finally{E(!1)}},B=async j=>{try{await u(j)}catch{}},W=async()=>{if(!T)return;D(!1);try{if(navigator.clipboard&&window.isSecureContext){await navigator.clipboard.writeText(T),S(!0),setTimeout(()=>S(!1),2e3);return}}catch{}const j=document.createElement("textarea");j.value=T,j.style.position="fixed",j.style.opacity="0",document.body.appendChild(j),j.select();try{document.execCommand("copy"),S(!0),setTimeout(()=>S(!1),2e3)}catch{D(!0)}document.body.removeChild(j)};return e.jsx(ie,{open:s,onOpenChange:j=>{j||t()},children:e.jsxs(le,{className:"max-w-lg rounded-2xl border-border bg-surface-1 p-6 shadow-2xl",children:[e.jsx(ce,{children:e.jsxs(de,{className:"font-display text-lg font-semibold text-text-primary",children:[g("share.title"),r?`: ${r}`:""]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:g("share.grantTo")}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx("button",{onClick:()=>o("user"),className:`rounded-md px-3 py-1 text-sm transition-colors ${l==="user"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:g("share.user")}),e.jsx("button",{onClick:()=>o("team"),className:`rounded-md px-3 py-1 text-sm transition-colors ${l==="team"?"bg-brand text-white":"bg-surface-2 text-text-secondary hover:bg-surface-3"}`,children:g("share.team")})]}),l==="user"?e.jsx(Le,{onSelect:h,placeholder:g("share.userIdPlaceholder"),actionLabel:g("share.selectUser")}):e.jsx("input",{type:"text",value:b,onChange:j=>f(j.target.value),placeholder:g("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"}),l==="user"&&a&&e.jsxs("p",{className:"mt-1 text-xs text-text-muted",children:[g("share.selectedUser"),": ",e.jsx("span",{className:"font-mono",children:a})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:g("share.permission")}),e.jsxs("select",{value:y,onChange:j=>w(j.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:g("share.permissionRead")}),e.jsx("option",{value:"write",children:g("share.permissionWrite")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm text-text-secondary",children:g("share.expiresAt")}),e.jsx("input",{type:"datetime-local",value:N,onChange:j=>k(j.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"})]}),(H||p)&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-status-error",children:H||p}),T&&e.jsxs("div",{className:"rounded-md bg-surface-2 px-3 py-2",children:[e.jsx("p",{className:"text-sm text-text-secondary mb-1",children:g("share.linkCreated")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 truncate text-xs text-text-primary",children:T}),e.jsx("button",{onClick:W,className:"rounded-md bg-brand px-2 py-1 text-xs text-white hover:bg-brand-light transition-colors",children:z?g("share.copied"):g("share.copy")})]}),q&&e.jsx("p",{className:"mt-1 text-xs text-status-error",children:g("share.copyFailed")})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"mb-2 text-sm font-medium text-text-secondary",children:g("share.existingShares")}),i?e.jsx("p",{className:"text-sm text-text-muted",children:g("share.loading")}):c.length===0?e.jsx("p",{className:"text-sm text-text-muted",children:g("share.none")}):e.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto",children:c.map(j=>e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-surface-2 px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm text-text-primary",children:j.granted_to_user||j.granted_to_team||"Unknown"}),e.jsxs("p",{className:"text-xs text-text-muted",children:[j.permission==="write"?g("share.permissionWrite"):g("share.permissionRead"),j.expires_at?` · expires ${j.expires_at}`:""]})]}),e.jsx("button",{onClick:()=>B(j.id),className:"ml-2 shrink-0 rounded-md px-2 py-1 text-xs text-status-error hover:bg-surface-3 transition-colors",children:g("share.revoke")})]},j.id))})]})]}),e.jsxs(Fe,{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:g("common.close")}),e.jsx("button",{onClick:Q,disabled:M||(l==="user"?!a.trim():!b.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:M?g("common.creating"):g("share.createShare")})]})]})})}function Ct(s){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/acp/relay/${s}`}function Mt(s){const t=Ct(s),n=Me(),r=n?{proxyUrl:t,token:n}:{proxyUrl:t};return new Ce(r)}function Ft({sessionId:s,onSessionLoaded:t}){ae();const[n,r]=x.useState(null),[c,i]=x.useState(null),[p,d]=x.useState(""),[u,l]=x.useState(!1),[o,a]=x.useState(!1),[h,b]=x.useState(!1),[f,y]=x.useState([]),[w,N]=x.useState(!1),[k,M]=x.useState([]),[E,T]=x.useState(null),[R,H]=x.useState(()=>ue()),U=x.useRef(null),z=x.useRef(f);z.current=f;const S=x.useMemo(()=>new dt(s,y,{onStatusChange:m=>{i(m)},onError:m=>{console.error("[RCSChatAdapter] error:",m)},onPermissionRequest:m=>{M(v=>v.some(_=>_.requestId===m.requestId)?v:[...v,m])},onModelsStateChange:m=>{T(m)},onSubagentUpdate:m=>{H(m)}}),[s]);x.useEffect(()=>(U.current=S,()=>{S.disconnect()}),[S]),x.useEffect(()=>{let m=!1;async function v(){d("");try{const _=await Pe(s);if(m)return;r(_),i(_.status),t==null||t(_)}catch(_){if(m)return;d(_ instanceof Error?_.message:g("session.loadFailed"));return}try{await S.init()}catch(_){console.warn("Failed to init adapter:",_)}}return v(),()=>{m=!0}},[s,S,t]);const q=Re(c),D=(n==null?void 0:n.access_level)==="read",Q=x.useCallback(async m=>{const v=m.text.trim(),_=m.images&&m.images.length>0||m.attachments&&m.attachments.length>0;if(!v&&!_||q)return;const C=await Ee(v,{sessionId:s,availableCommands:[],availableModels:(E==null?void 0:E.availableModels)??[],currentModel:E?{modelId:E.currentModelId,name:E.currentModelId}:null,supportsImages:!0,entries:z.current,setModel:async A=>{await O(s,{type:"control_request",request:{subtype:"set_model",model:A}}),T(Y=>Y&&{...Y,currentModelId:A})},onNewSession:()=>{y([])}}).catch(()=>null);if(C){if($e("[SessionDetail] local command result",C),"clearEntries"in C&&C.clearEntries){y([]);return}if("newSession"in C&&C.newSession){y([]);return}if("userEntry"in C){y(A=>[...A,C.userEntry,C.cmdEntry]);return}}N(!0);try{await S.sendMessage(v,m.images,m.attachments)}catch(A){console.error("Send failed:",A)}},[S,q,s,E]),B=x.useCallback(async()=>{try{await S.interrupt()}catch(m){console.error("Interrupt failed:",m)}finally{N(!1)}},[S]),W=x.useCallback(async()=>{if(n&&window.confirm(g("dashboard.confirmDelete").replace("{id}",n.title||n.id)))try{await Te(n.id),window.location.href="/code/"}catch(m){alert(m instanceof Error?m.message:g("dashboard.deleteFailed"))}},[n]);x.useEffect(()=>{if(f.length===0)return;const m=f[f.length-1];if((m==null?void 0:m.type)==="assistant_message"||(m==null?void 0:m.type)==="tool_call"){if(m.type==="tool_call"&&m.toolCall.status==="running")return;N(!1)}},[f]);const j=x.useCallback(async m=>{try{await S.respondPermission(m,!0)}catch(v){console.error("Failed to approve:",v)}M(v=>v.filter(_=>_.requestId!==m))},[S]),K=x.useCallback(async m=>{try{await S.respondPermission(m,!1)}catch(v){console.error("Failed to reject:",v)}M(v=>v.filter(_=>_.requestId!==m))},[S]),me=x.useCallback(async(m,v,_)=>{try{await O(s,{type:"permission_response",approved:!0,request_id:m,updated_input:{questions:_,answers:v}})}catch(C){console.error("Failed to submit answers:",C)}M(C=>C.filter(A=>A.requestId!==m))},[s]),xe=x.useCallback(async(m,v,_)=>{try{v==="no"?await O(s,{type:"permission_response",approved:!1,request_id:m,..._?{message:_}:{}}):await O(s,{type:"permission_response",approved:!0,request_id:m,updated_permissions:[{type:"setMode",mode:{"yes-accept-edits":"acceptEdits","yes-default":"default"}[v]||"default",destination:"session"}]})}catch(C){console.error("Failed to submit plan response:",C)}M(C=>C.filter(A=>A.requestId!==m))},[s]);return p?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:p}),e.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:g("session.backToDashboard")})]})}):n?n.source==="acp"&&n.environment_id?e.jsx($t,{sessionId:s,agentId:n.environment_id}):e.jsx(oe,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsx("h1",{className:"sr-only",children:n.title||n.id}),e.jsx("div",{className:"border-b bg-surface-1 px-4 py-3",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:e.jsx("span",{className:"truncate",children:n.title||n.id})}),n.visibility&&e.jsx(Oe,{visibility:n.visibility||"private"})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[(()=>{var _;const m=n.source==="acp"?"acp":(_=n.environment)==null?void 0:_.worker_type,v=Ue(m);return e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${v.colorClass}`,children:v.fullLabel})})(),c&&e.jsx(se,{status:c}),e.jsx("span",{className:"text-xs text-text-muted",children:ne(n.created_at)})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!D&&(n==null?void 0:n.access_level)!=="write"&&e.jsx("button",{onClick:()=>b(!0),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:g("session.share"),children:e.jsx(rt,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>a(!o),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-muted hover:bg-surface-2 hover:text-text-secondary transition-colors",title:g("session.info"),children:e.jsx(Ze,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>l(!u),className:"flex items-center gap-1 rounded-md px-3 py-1.5 text-sm text-text-primary font-bold hover:bg-brand-light hover:text-white transition-colors",children:[g("session.tasks"),k.length>0&&e.jsx("span",{className:"ml-1 rounded-full bg-status-warning px-1.5 py-0.5 text-[10px] font-medium text-white",children:k.length})]})]})]}),o&&e.jsxs("div",{className:"mt-2 rounded-md bg-surface-2 px-3 py-2 text-xs text-text-muted space-y-1 font-mono",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:g("session.metaSession")})," ",n.id]}),n.environment_id&&e.jsxs("div",{children:[e.jsx("span",{className:"text-text-primary font-bold font-sans",children:g("session.metaEnvironment")})," ",n.environment_id]})]})]})}),e.jsx(Ae,{entries:f,isLoading:w,emptyTitle:g("session.emptyTitle"),emptyDescription:g("session.emptyDescription")}),e.jsx(bt,{state:R}),k.length>0&&e.jsx("div",{className:"border-t bg-surface-1 px-4 py-3",children:e.jsx("div",{className:"mx-auto max-w-3xl space-y-3",children:k.map(m=>e.jsx(Et,{request:m,onApprove:()=>j(m.requestId),onReject:()=>K(m.requestId),onSubmitAnswers:me,onSubmitPlan:xe},m.requestId))})}),e.jsx(Ie,{onSubmit:Q,isLoading:w,onInterrupt:B,disabled:q||D,placeholder:q?g("session.closed"):D?g("session.readOnly"):g("session.inputPlaceholder"),supportsAttachments:!0}),u&&n&&e.jsx(pt,{onClose:()=>l(!1),session:n,liveStatus:c,pendingPermissions:k,onInterrupt:B,onDelete:W}),e.jsx(St,{open:h,onClose:()=>b(!1),sessionId:n.id,sessionTitle:n.title||void 0})]})}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-text-muted",children:g("session.loading")})})}function Et({request:s,onApprove:t,onReject:n,onSubmitAnswers:r,onSubmitPlan:c}){const i=s.toolName,p=s.toolInput,d=s.description||"";if(i==="AskUserQuestion"){const u=p.questions||[];return e.jsx(wt,{requestId:s.requestId,questions:u,description:d,onSubmit:l=>r(s.requestId,l,u),onSkip:n})}if(i==="ExitPlanMode"){const u=p.plan||"";return e.jsx(kt,{requestId:s.requestId,planContent:u,description:d,onSubmit:(l,o)=>c(s.requestId,l,o)})}return e.jsx(jt,{requestId:s.requestId,toolName:i,toolInput:p,description:d,onApprove:t,onReject:n})}function $t({sessionId:s,agentId:t}){const[n,r]=x.useState(null),[c,i]=x.useState("disconnected"),[p,d]=x.useState(null),u=x.useRef(null);return x.useEffect(()=>{const l=Mt(t);return l.setConnectionStateHandler((o,a)=>{i(o),d(a||null)}),u.current=l,r(l),l.connect().catch(o=>{o instanceof De||(d(o.message),i("error"))}),()=>{l.disconnect(),u.current=null,r(null),i("disconnected")}},[t]),e.jsx(oe,{children:e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[p&&c==="error"&&e.jsx("div",{className:"px-4 py-2 bg-destructive/10 text-destructive text-sm border-b",children:p}),c==="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:g("session.connectingAgent")})]})}),c==="error"&&!n&&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:g("session.connectionFailed")}),e.jsx("p",{className:"text-text-muted text-sm",children:p})]})}),n&&c==="connected"&&e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(qe,{client:n,agentId:t})})]})})}export{Ft as SessionDetail};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t}from"./vendor-DE_-CLIE.js";import{H as l,R as c,f as d,e as g,X as u,G as o,T as x,g as f,O as m,U as p}from"./main-
|
|
1
|
+
import{j as t}from"./vendor-DE_-CLIE.js";import{H as l,R as c,f as d,e as g,X as u,G as o,T as x,g as f,O as m,U as p}from"./main-DrB3sbfk.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as v,Y as t}from"./main-
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a0 as v,Y as t}from"./main-DrB3sbfk.js";import"./shiki-mEP5vQQu.js";import"./motion-BILbV7YQ.js";function q({onSuccess:p,onAlreadyDone:b}){const{setup:f}=v(),[n,h]=r.useState(""),[l,y]=r.useState(""),[a,g]=r.useState(""),[d,w]=r.useState(""),[i,o]=r.useState(""),[c,m]=r.useState(!1),j=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==d){o(t("auth.setup.passwordMismatch"));return}m(!0);try{await f(n,l,a),p()}catch(x){const u=x instanceof Error?x.message:"Setup failed";if(u.includes("already")||u.includes("409")){b();return}o(u)}finally{m(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold text-text-primary",children:t("auth.setup.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.setup.description")})]}),e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.apiKey")}),e.jsx("input",{type:"password",value:n,onChange:s=>h(s.target.value),required:!0,autoComplete:"off",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.username")}),e.jsx("input",{type:"text",value:l,onChange:s=>y(s.target.value),required:!0,autoComplete:"username",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>g(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.setup.confirmPassword")}),e.jsx("input",{type:"password",value:d,onChange:s=>w(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),i&&e.jsx("p",{className:"text-sm text-status-error",children:i}),e.jsx("button",{type:"submit",disabled:c,className:"w-full rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-brand-light disabled:cursor-not-allowed disabled:opacity-50",children:c?t("common.loading"):t("auth.setup.submit")})]})]})})}export{q as Setup};
|