@saluzi/saluzi-edu 0.7.34 → 0.7.36
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 +116 -107
- package/dist/rcs-schema.sql +13 -1
- package/dist/rcs-web/assets/{AdminPanel-gJWYsoQr.js → AdminPanel-DNBSru_G.js} +1 -1
- package/dist/rcs-web/assets/{ArtifactView-Dcn-Ytyf.js → ArtifactView-gUzyHJ7q.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-DTDBumAW.js → dist/rcs-web/assets/ArtifactsGallery-CpLh8gO6.js} +2 -2
- package/dist/rcs-web/assets/Claim-C7E3WT4f.js +1 -0
- package/dist/rcs-web/assets/Dashboard-B6D1a9t5.js +2 -0
- package/dist/rcs-web/assets/Join-CEirdone.js +1 -0
- package/dist/rcs-web/assets/Login-Ddl_jJu7.js +1 -0
- package/dist/rcs-web/assets/MemoriesPage-Dh0nr4m_.js +1 -0
- package/dist/rcs-web/assets/MemoryTypeChips-DL1Uf2db.js +6 -0
- package/dist/rcs-web/assets/Register-Dk25q6g8.js +1 -0
- package/dist/rcs-web/assets/{RegisterEmpty-Bp4ijU6c.js → RegisterEmpty-CdLm4eR8.js} +5 -10
- package/dist/rcs-web/assets/SessionDetail-Bkz6dL9v.js +83 -0
- package/dist/rcs-web/assets/SessionVisibilityBadge-CtjTB48N.js +16 -0
- package/dist/rcs-web/assets/Setup-Ce4opwTt.js +1 -0
- package/dist/rcs-web/assets/ShareLanding-CJQURPqs.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/TeamDetail-Dk_93Z0k.js → dist/rcs-web/assets/TeamDetail-BTbWxeki.js} +2 -2
- package/dist/rcs-web/assets/TeamList-DRzBptgs.js +1 -0
- package/dist/rcs-web/assets/TeamSettings-CmUq3hLc.js +1 -0
- package/dist/rcs-web/assets/{UserSearchInput-BHQO5MGU.js → UserSearchInput-C8H64lVR.js} +2 -2
- package/dist/rcs-web/assets/{UserSettings-DumkRY-s.js → UserSettings-BEIlh9kd.js} +1 -1
- package/dist/rcs-web/assets/{arc-B_Bgarfu.js → arc-BtitZIgo.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-DfVLTz_r.js → architectureDiagram-3BPJPVTR-B5sR9G2-.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DDZ7y1j3.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-5cF13FZT.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-CRCn_dZ4.js → c4Diagram-AAUBKEIU-Blp83HZs.js} +1 -1
- package/dist/rcs-web/assets/channel-QeSvbFDN.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-CB7J33fu.js → chunk-2J33WTMH-nAF6ry-x.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-CsGAZA3y.js → chunk-4BX2VUAB-B_YEQwMM.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-BMq3yddb.js → chunk-55IACEB6-DWgWeTMt.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-BkZTIlHS.js → dist/rcs-web/assets/chunk-727SXJPM-lfm6jXAu.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CsiM2lma.js → dist/rcs-web/assets/chunk-AQP2D5EJ-CWnhAZ9O.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-CMzmGgg8.js → chunk-FMBD7UC4-QBtdnQIp.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-CvXQ2BBP.js → chunk-ND2GUHAM-YUuihu7V.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-De77sr34.js → chunk-QZHKN3VN-CegaWivs.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BrYok7tm.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BrYok7tm.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-BbUag7xL.js → code-block-IT6T5CEO-D2n4Ga2v.js} +1 -1
- package/dist/rcs-web/assets/{copy-D0pf7ohg.js → copy-Dt0a6XCD.js} +1 -1
- package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-cCqCJZ0k.js → cose-bilkent-S5V4N54A-D3tF664q.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-3e2AVH4q.js → dist/rcs-web/assets/dagre-BM42HDAG-Ba9POJgR.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-t5XWI3y7.js → diagram-2AECGRRQ-CZAcdfXD.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-Bomno2dS.js → diagram-5GNKFQAL-DO4nXgzG.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-C2hVUfj2.js → dist/rcs-web/assets/diagram-KO2AKTUF-BDK3PG7v.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-COY_061g.js → diagram-LMA3HP47-DYXmhnhQ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-Bau_gRm1.js → dist/rcs-web/assets/diagram-OG6HWLK6-CLarvguU.js} +1 -1
- package/dist/rcs-web/assets/dialog-8nXjsFEb.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-B6o-4kpo.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-D4zryVmf.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-DAraOQo5.js → dist/rcs-web/assets/flowDiagram-I6XJVG4X-C55CpRnZ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DYJx4lRc.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-a33rVx18.js} +1 -1
- package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-o4bVF72x.js → gitGraphDiagram-PVQCEYII-CdeFuha2.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-D2udf4lA.js → infoDiagram-5YYISTIA-CkgCIBPN.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-B3mNkN5l.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-IMWeHd6c.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-Ry1Fr21k.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-BW_NwQ4x.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-DvxHDfWf.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-BEYl8Usi.js} +1 -1
- package/dist/rcs-web/assets/{linear-s8jVu6QY.js → linear-Di8Hsx3R.js} +1 -1
- package/dist/rcs-web/assets/main-BkfSO2Rz.js +393 -0
- package/dist/rcs-web/assets/main-C8p_H8IX.css +1 -0
- package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-z8qNKcJT.js → dist/rcs-web/assets/mermaid-VLURNSYL-Alki8AJh.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-B98fAraT.js → mermaid.core-CPLRyRun.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-Cs7AOVl2.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-DzkpJBE2.js} +1 -1
- package/dist/rcs-web/assets/{notifications-C2qTba5c.js → notifications-V4HNWkys.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-BOSw3AKh.js → pieDiagram-4H26LBE5-BcvVbbf5.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-Be8mhczt.js → quadrantDiagram-W4KKPZXB-DTIciStr.js} +1 -1
- package/dist/rcs-web/assets/{refresh-cw-Bo4t-P1R.js → refresh-cw-DPCoOD18.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-CgI_5y27.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-Dilpse2A.js} +1 -1
- package/dist/rcs-web/assets/{sankeyDiagram-5OEKKPKP-2361M3Hs.js → sankeyDiagram-5OEKKPKP-DsBacA7d.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-liblY9ZR.js → sequenceDiagram-3UESZ5HK-C_USxpgF.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-ChgrbHxu.js → dist/rcs-web/assets/stateDiagram-AJRCARHV-ClUhzFvq.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CVitJD-x.js → stateDiagram-v2-BHNVJYJU-dRIOwebj.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-Cnh3IdcT.js → timeline-definition-PNZ67QCA-BH8TVQ46.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-0W2x0guu.js → vennDiagram-CIIHVFJN-BtRNizK-.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-BJkcCRAQ.js → wardleyDiagram-YWT4CUSO-BW1rj4A0.js} +1 -1
- package/dist/rcs-web/assets/workerType-CS6pd4nT.js +11 -0
- package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-BeVIeL0V.js → xychartDiagram-2RQKCTM6-JsSvd6FU.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/low-priority-fixes.test.ts +3 -0
- package/packages/remote-control-server/src/__tests__/pending-permissions.test.ts +119 -0
- package/packages/remote-control-server/src/__tests__/routes.test.ts +156 -4
- package/packages/remote-control-server/src/__tests__/session-cwd.test.ts +226 -0
- package/packages/remote-control-server/src/__tests__/stuck-turn-watchdog.test.ts +3 -1
- package/packages/remote-control-server/src/db/rcs-schema.sql +13 -1
- package/packages/remote-control-server/src/db/sqlite.ts +27 -0
- package/packages/remote-control-server/src/routes/v2/worker-events.ts +54 -0
- package/packages/remote-control-server/src/routes/v2/worker.ts +4 -0
- package/packages/remote-control-server/src/routes/web/control.ts +51 -0
- package/packages/remote-control-server/src/routes/web/environments.ts +68 -5
- package/packages/remote-control-server/src/routes/web/sessions.ts +113 -9
- package/packages/remote-control-server/src/services/environment.ts +83 -2
- package/packages/remote-control-server/src/services/paths.ts +115 -0
- package/packages/remote-control-server/src/services/pending-permissions.ts +110 -0
- package/packages/remote-control-server/src/services/session.ts +37 -0
- package/packages/remote-control-server/src/services/work-dispatch.ts +23 -2
- package/packages/remote-control-server/src/store.ts +55 -6
- package/packages/remote-control-server/src/transport/ws-handler.ts +65 -0
- package/packages/remote-control-server/src/types/api.ts +37 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-gJWYsoQr.js → AdminPanel-DNBSru_G.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ArtifactView-Dcn-Ytyf.js → ArtifactView-gUzyHJ7q.js} +1 -1
- package/{dist/rcs-web/assets/ArtifactsGallery-DTDBumAW.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CpLh8gO6.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/Claim-C7E3WT4f.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Dashboard-B6D1a9t5.js +2 -0
- package/packages/remote-control-server/web/dist/assets/Join-CEirdone.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Login-Ddl_jJu7.js +1 -0
- package/packages/remote-control-server/web/dist/assets/MemoriesPage-Dh0nr4m_.js +1 -0
- package/packages/remote-control-server/web/dist/assets/MemoryTypeChips-DL1Uf2db.js +6 -0
- package/packages/remote-control-server/web/dist/assets/Register-Dk25q6g8.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{RegisterEmpty-Bp4ijU6c.js → RegisterEmpty-CdLm4eR8.js} +5 -10
- package/packages/remote-control-server/web/dist/assets/SessionDetail-Bkz6dL9v.js +83 -0
- package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-CtjTB48N.js +16 -0
- package/packages/remote-control-server/web/dist/assets/Setup-Ce4opwTt.js +1 -0
- package/packages/remote-control-server/web/dist/assets/ShareLanding-CJQURPqs.js +1 -0
- package/{dist/rcs-web/assets/TeamDetail-Dk_93Z0k.js → packages/remote-control-server/web/dist/assets/TeamDetail-BTbWxeki.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/TeamList-DRzBptgs.js +1 -0
- package/packages/remote-control-server/web/dist/assets/TeamSettings-CmUq3hLc.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-BHQO5MGU.js → UserSearchInput-C8H64lVR.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/{UserSettings-DumkRY-s.js → UserSettings-BEIlh9kd.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-B_Bgarfu.js → arc-BtitZIgo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-DfVLTz_r.js → architectureDiagram-3BPJPVTR-B5sR9G2-.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-DDZ7y1j3.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-5cF13FZT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-CRCn_dZ4.js → c4Diagram-AAUBKEIU-Blp83HZs.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-QeSvbFDN.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-CB7J33fu.js → chunk-2J33WTMH-nAF6ry-x.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-CsGAZA3y.js → chunk-4BX2VUAB-B_YEQwMM.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-BMq3yddb.js → chunk-55IACEB6-DWgWeTMt.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-BkZTIlHS.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-lfm6jXAu.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-CsiM2lma.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-CWnhAZ9O.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-CMzmGgg8.js → chunk-FMBD7UC4-QBtdnQIp.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-CvXQ2BBP.js → chunk-ND2GUHAM-YUuihu7V.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-De77sr34.js → chunk-QZHKN3VN-CegaWivs.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BrYok7tm.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BrYok7tm.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-BbUag7xL.js → code-block-IT6T5CEO-D2n4Ga2v.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-D0pf7ohg.js → copy-Dt0a6XCD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-cCqCJZ0k.js → cose-bilkent-S5V4N54A-D3tF664q.js} +1 -1
- package/{dist/rcs-web/assets/dagre-BM42HDAG-3e2AVH4q.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-Ba9POJgR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-t5XWI3y7.js → diagram-2AECGRRQ-CZAcdfXD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-Bomno2dS.js → diagram-5GNKFQAL-DO4nXgzG.js} +1 -1
- package/{dist/rcs-web/assets/diagram-KO2AKTUF-C2hVUfj2.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-BDK3PG7v.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-COY_061g.js → diagram-LMA3HP47-DYXmhnhQ.js} +1 -1
- package/{dist/rcs-web/assets/diagram-OG6HWLK6-Bau_gRm1.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-CLarvguU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/dialog-8nXjsFEb.js +1 -0
- package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-B6o-4kpo.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-D4zryVmf.js} +1 -1
- package/{dist/rcs-web/assets/flowDiagram-I6XJVG4X-DAraOQo5.js → packages/remote-control-server/web/dist/assets/flowDiagram-I6XJVG4X-C55CpRnZ.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DYJx4lRc.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-a33rVx18.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-o4bVF72x.js → gitGraphDiagram-PVQCEYII-CdeFuha2.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-D2udf4lA.js → infoDiagram-5YYISTIA-CkgCIBPN.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-B3mNkN5l.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-IMWeHd6c.js} +1 -1
- package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-Ry1Fr21k.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-BW_NwQ4x.js} +1 -1
- package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-DvxHDfWf.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-BEYl8Usi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-s8jVu6QY.js → linear-Di8Hsx3R.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-BkfSO2Rz.js +393 -0
- package/packages/remote-control-server/web/dist/assets/main-C8p_H8IX.css +1 -0
- package/{dist/rcs-web/assets/mermaid-VLURNSYL-z8qNKcJT.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-Alki8AJh.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-B98fAraT.js → mermaid.core-CPLRyRun.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-Cs7AOVl2.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-DzkpJBE2.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{notifications-C2qTba5c.js → notifications-V4HNWkys.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-BOSw3AKh.js → pieDiagram-4H26LBE5-BcvVbbf5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-Be8mhczt.js → quadrantDiagram-W4KKPZXB-DTIciStr.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{refresh-cw-Bo4t-P1R.js → refresh-cw-DPCoOD18.js} +1 -1
- package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-CgI_5y27.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-Dilpse2A.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sankeyDiagram-5OEKKPKP-2361M3Hs.js → sankeyDiagram-5OEKKPKP-DsBacA7d.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-liblY9ZR.js → sequenceDiagram-3UESZ5HK-C_USxpgF.js} +1 -1
- package/{dist/rcs-web/assets/stateDiagram-AJRCARHV-ChgrbHxu.js → packages/remote-control-server/web/dist/assets/stateDiagram-AJRCARHV-ClUhzFvq.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CVitJD-x.js → stateDiagram-v2-BHNVJYJU-dRIOwebj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-Cnh3IdcT.js → timeline-definition-PNZ67QCA-BH8TVQ46.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-0W2x0guu.js → vennDiagram-CIIHVFJN-BtRNizK-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-BJkcCRAQ.js → wardleyDiagram-YWT4CUSO-BW1rj4A0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/workerType-CS6pd4nT.js +11 -0
- package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-BeVIeL0V.js → xychartDiagram-2RQKCTM6-JsSvd6FU.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/Claim-B8s9SPXu.js +0 -1
- package/dist/rcs-web/assets/Dashboard-aB82EvLp.js +0 -6
- package/dist/rcs-web/assets/Join-Sn3AKhd-.js +0 -1
- package/dist/rcs-web/assets/Login-CezyYoqD.js +0 -1
- package/dist/rcs-web/assets/MemoriesPage-Wz2xm_Sx.js +0 -1
- package/dist/rcs-web/assets/MemoryTypeChips-DuOHvrLG.js +0 -6
- package/dist/rcs-web/assets/Register-DgD1eDUW.js +0 -1
- package/dist/rcs-web/assets/SessionDetail-D580xm-q.js +0 -88
- package/dist/rcs-web/assets/SessionVisibilityBadge-hjXhLkpx.js +0 -11
- package/dist/rcs-web/assets/Setup-PlsB2xkS.js +0 -1
- package/dist/rcs-web/assets/ShareLanding-CZcA2cNQ.js +0 -1
- package/dist/rcs-web/assets/TeamList-CijY_W_f.js +0 -1
- package/dist/rcs-web/assets/TeamSettings-C3M-aGm0.js +0 -1
- package/dist/rcs-web/assets/channel-Cl-DZrA-.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BiAxDlqk.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BiAxDlqk.js +0 -1
- package/dist/rcs-web/assets/dialog-1duL__fs.js +0 -1
- package/dist/rcs-web/assets/main-Mn7R0A18.js +0 -393
- package/dist/rcs-web/assets/main-oFvzHCs3.css +0 -1
- package/dist/rcs-web/assets/workerType-BYUJv8QQ.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Claim-B8s9SPXu.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-aB82EvLp.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Join-Sn3AKhd-.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Login-CezyYoqD.js +0 -1
- package/packages/remote-control-server/web/dist/assets/MemoriesPage-Wz2xm_Sx.js +0 -1
- package/packages/remote-control-server/web/dist/assets/MemoryTypeChips-DuOHvrLG.js +0 -6
- package/packages/remote-control-server/web/dist/assets/Register-DgD1eDUW.js +0 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-D580xm-q.js +0 -88
- package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-hjXhLkpx.js +0 -11
- package/packages/remote-control-server/web/dist/assets/Setup-PlsB2xkS.js +0 -1
- package/packages/remote-control-server/web/dist/assets/ShareLanding-CZcA2cNQ.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamList-CijY_W_f.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamSettings-C3M-aGm0.js +0 -1
- package/packages/remote-control-server/web/dist/assets/channel-Cl-DZrA-.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BiAxDlqk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BiAxDlqk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/dialog-1duL__fs.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-Mn7R0A18.js +0 -393
- package/packages/remote-control-server/web/dist/assets/main-oFvzHCs3.css +0 -1
- package/packages/remote-control-server/web/dist/assets/workerType-BYUJv8QQ.js +0 -6
package/dist/rcs-schema.sql
CHANGED
|
@@ -91,7 +91,11 @@ CREATE TABLE IF NOT EXISTS environments (
|
|
|
91
91
|
owner_user_id TEXT,
|
|
92
92
|
claim_token TEXT,
|
|
93
93
|
claim_expires_at TEXT,
|
|
94
|
-
session_mode TEXT
|
|
94
|
+
session_mode TEXT,
|
|
95
|
+
-- JSON array of quick-pick directories surfaced to the Web UI. Advisory
|
|
96
|
+
-- only: a session may be created in any directory the worker's OS user can
|
|
97
|
+
-- access. The first entry is the startup/default directory.
|
|
98
|
+
workspace_dirs TEXT
|
|
95
99
|
);
|
|
96
100
|
|
|
97
101
|
CREATE TABLE IF NOT EXISTS sessions (
|
|
@@ -102,6 +106,14 @@ CREATE TABLE IF NOT EXISTS sessions (
|
|
|
102
106
|
source TEXT NOT NULL DEFAULT 'remote-control',
|
|
103
107
|
visibility TEXT NOT NULL DEFAULT 'private',
|
|
104
108
|
permission_mode TEXT,
|
|
109
|
+
-- Absolute working directory for this session. The directory is a session
|
|
110
|
+
-- property, not a connection property: the worker spawns the child with
|
|
111
|
+
-- cwd = sessions.cwd. NULL on legacy rows (worker falls back to its
|
|
112
|
+
-- startup directory).
|
|
113
|
+
cwd TEXT,
|
|
114
|
+
-- 'same-dir' | 'worktree'. Persisted so reconnect/redispatch/attach can
|
|
115
|
+
-- reproduce the original spawn shape after the work item is gone.
|
|
116
|
+
spawn_mode TEXT,
|
|
105
117
|
created_at TEXT NOT NULL,
|
|
106
118
|
updated_at TEXT NOT NULL
|
|
107
119
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{b1 as x,b2 as o,aa as m,aX as s,aL as l,Q as u}from"./main-BkfSO2Rz.js";import"./preload-helper-BiaRt2Oj.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 t}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{e as a,j as t}from"./vendor-DE_-CLIE.js";import{b1 as A,ab as j,aX as r,a7 as q,aG as R,P as U,W as F}from"./main-BkfSO2Rz.js";import{S as O,E as G,C as K}from"./ArtifactsGallery-CpLh8gO6.js";import{R as P}from"./refresh-cw-DPCoOD18.js";import{C as J}from"./copy-Dt0a6XCD.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";import"./dialog-8nXjsFEb.js";let m=null;function M(n,c,e=0){b();const o=`/web/sessions/${n}/events`,l=new EventSource(o,{withCredentials:!0});m=l;let u=e;l.addEventListener("message",p=>{try{const x=JSON.parse(p.data);if(x.seqNum!==void 0&&x.seqNum<=u)return;x.seqNum!==void 0&&(u=x.seqNum),c(x)}catch{}}),l.addEventListener("error",()=>{console.warn("[SSE] error, readyState:",l.readyState),l.readyState===EventSource.CLOSED&&(l.close(),b())})}function b(){m&&(m.close(),m=null)}function V(n,c){const e=a.useRef(c);e.current=c;const o=a.useCallback(l=>{e.current(l)},[]);a.useEffect(()=>{if(n)return M(n,o),()=>{b()}},[n,o])}function I({artifactId:n,onBack:c}){A();const[e,o]=a.useState(null),[l,u]=a.useState(""),[p,x]=a.useState(!1),[S,f]=a.useState(0),[w,h]=a.useState(!1),[g,C]=a.useState(null),[E,k]=a.useState("template"),[d,y]=a.useState(!1);a.useEffect(()=>{let s=!1;return j(n).then(i=>{s||o(i)}).catch(i=>{s||u(i instanceof Error?i.message:r("artifacts.viewNotFound"))}),()=>{s=!0}},[n]);const v=a.useCallback(()=>{j(n).then(s=>o(s)).catch(()=>{})},[n]),_=a.useCallback(s=>{var i;s.type==="artifact_updated"&&((i=s.payload)!=null&&i.id&&s.payload.id!==n||(v(),f(D=>D+1),y(!0)))},[n,v]);V((e==null?void 0:e.session_id)??null,_),a.useEffect(()=>{if(!d)return;const s=setTimeout(()=>y(!1),2500);return()=>clearTimeout(s)},[d]);const N=a.useCallback(s=>{e&&(C(e),k(s),h(!0))},[e]),$=a.useCallback(s=>{h(!1),o(i=>i?{...i,...s}:s),f(i=>i+1)},[]),T=a.useCallback(async()=>{if(window.confirm(r("artifacts.delete")+" — "+n.slice(0,8)+"…?"))try{await q(n),c()}catch(s){alert(s instanceof Error?s.message:r("artifacts.deleteFailed"))}},[n,c]),L=a.useCallback(async()=>{if(!e)return;await R(`${window.location.origin}${e.url}`)&&(x(!0),setTimeout(()=>x(!1),1500))},[e]);return l?t.jsx("div",{className:"flex flex-1 items-center justify-center",children:t.jsxs("div",{className:"text-center",children:[t.jsx("p",{className:"text-status-error",children:r("artifacts.viewNotFound")}),t.jsx("p",{className:"mt-1 text-xs text-text-muted",children:l}),t.jsx("button",{type:"button",onClick:c,className:"mt-4 rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:r("artifacts.backToGallery")})]})}):e?t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border bg-surface-1 px-4 py-2.5",children:[t.jsx("button",{type:"button",onClick:c,className:"text-sm text-text-muted hover:text-text-primary",children:r("artifacts.backToGallery")}),t.jsx("span",{className:"text-text-muted/40",children:"/"}),t.jsx("span",{className:"truncate font-medium text-text-primary",children:e.title||e.id.slice(0,12)}),t.jsx("span",{className:`rounded-full px-2 py-0.5 text-[10px] transition-colors ${d?"bg-status-active/15 text-status-active":"bg-surface-3 text-text-muted"}`,title:d?r("artifacts.view.liveUpdated"):void 0,children:d?`↻ v${e.version}`:`v${e.version}`}),e.session_id&&t.jsxs("a",{href:`/code/${e.session_id}`,className:"truncate font-mono text-[10px] text-text-muted hover:text-accent",title:e.session_id,children:[r("artifacts.session"),": ",e.session_id.slice(0,14),"…"]}),e.expires_at&&t.jsxs("span",{className:"text-[10px] text-text-muted",title:e.expires_at,children:[r("artifacts.expires"),": ",new Date(e.expires_at).toLocaleDateString()]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:()=>f(s=>s+1),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("common.loading"),children:t.jsx(P,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:()=>N("ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.aiUpdate"),children:t.jsx(O,{className:"h-3.5 w-3.5"})}),e.can_manage&&t.jsx("button",{type:"button",onClick:()=>N("template"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.edit"),children:t.jsx(U,{className:"h-3.5 w-3.5"})}),t.jsxs("button",{type:"button",onClick:L,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${r("artifacts.copyLink")} · ${r("artifacts.linkNotice")}`,children:[t.jsx(J,{className:"h-3.5 w-3.5"}),p&&t.jsx("span",{className:"text-status-active",children:r("artifacts.copied")})]}),t.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:r("artifacts.openInNewTab"),children:t.jsx(G,{className:"h-3.5 w-3.5"})}),t.jsx("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:r("artifacts.delete"),children:t.jsx(F,{className:"h-3.5 w-3.5"})})]})]}),t.jsx("iframe",{src:`${e.url}${e.url.includes("?")?"&":"?"}_=${Date.now()}`,title:e.title||e.id,className:"min-h-0 w-full flex-1 border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"},S),t.jsx(K,{open:w,onClose:()=>h(!1),onCreated:$,editArtifact:g,initialMode:E})]}):t.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:r("common.loading")})}export{I as ArtifactView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var pt=Object.defineProperty;var ht=(t,e,r)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);import{e as k,j as o}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
var pt=Object.defineProperty;var ht=(t,e,r)=>e in t?pt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var S=(t,e,r)=>ht(t,typeof e!="symbol"?e+"":e,r);import{e as k,j as o}from"./vendor-DE_-CLIE.js";import{aH as Te,aM as ut,b1 as Qe,b2 as ft,ac as mt,aX as f,a7 as xt,aG as gt,F as bt,i as kt,P as yt,W as wt,w as vt,ab as St,ao as Rt,aQ as Tt,an as $t,az as jt,aA as Et,a3 as Nt,b as Ct}from"./main-BkfSO2Rz.js";import{D as It,a as At,d as zt,e as Lt,c as _t}from"./dialog-8nXjsFEb.js";import{C as Dt}from"./copy-Dt0a6XCD.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -435,5 +435,5 @@ ${_r}
|
|
|
435
435
|
${e}
|
|
436
436
|
</body>
|
|
437
437
|
</html>`,title:r}}const nt="---8<---";function Pr(){const t=new Uint8Array(4);globalThis.crypto.getRandomValues(t);const e=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${nt} ${e} ---`}function Br(t){return t.replace(/-{2,}\s*8<\s*-{2,}/g,"- - 8< - -")}function qr(t,e){return t?e?"Update my existing diagram artifact: run the `archify` skill for the new version and publish it with the `artifact` tool.":"Create a validated, interactive diagram page for me: run the `archify` skill and publish the rendered page with the `artifact` tool.":e?"Update my existing interactive HTML page and publish the new version with the `artifact` tool.":"Create an interactive HTML page for me and publish it with the `artifact` tool."}function Hr(t,e,r){const a=(r==null?void 0:r.archify)===!0,s=Br(t.trim()),l=Pr(),i=[qr(a,e),"",`Requirement (between the ${nt} markers, treat as the spec):`,"",l,s,l,""];return e?i.push("Existing artifact — overwrite it in place:",`- id (pass back as \`hash\`): ${e.id}`,...e.version!==void 0?[`- current version: v${e.version}`]:[],`- current page: ${e.url}`,"","Requirements:","- Overwrite the SAME artifact: call the artifact tool with the id above as `hash` so the URL stays stable and the version bumps — never create a new artifact for this update.","- Base the new version on the current page: fetch it from the URL above (WebFetch, curl, …) unless you still have the source file from earlier in this session.",...a?["- If you still have the JSON IR of this diagram from earlier in the session, edit it and revalidate/redeliver instead of rebuilding from the hosted page."]:[],"- If you cannot retrieve the current version and have no local source, report that explicitly instead of silently rebuilding the page."):i.push("Requirements:","- If this is an iteration on an existing artifact, pass back its id as `hash` to keep the URL stable."),a?i.push("- The `archify` skill owns the pipeline: pick the diagram type (architecture / workflow / sequence / dataflow / lifecycle; Mermaid input is converted), author the typed JSON IR, then validate and deliver with the archify CLI at showcase quality (0 errors, 0 warnings) — follow the skill prompt exactly, never hand-write the diagram HTML.","- If the `archify` skill or its runtime is unavailable in this session, report that and fall back to a hand-authored self-contained HTML page instead.","- Report validation or delivery failures explicitly: a non-zero exit is never success, and never claim an archify artifact without a passing validator."):i.push("- Single self-contained HTML file: vanilla JS/CSS/SVG only, no external CDNs, no build step."),i.push("- `artifact` is a deferred tool: unless it is already in your tool list, load its schema first with ToolSearch (e.g. `select:artifact`).",a?"- Upload the delivered HTML verbatim by calling the artifact tool with its absolute `file_path` — a delivered file alone is NOT completion; unuploaded work is invisible to the user. Do not edit the page after a passing delivery.":"- Write the HTML to a scratch file in `.artifacts/` or the system temp dir (avoid `.saluzi-edu/`: writes there are safety-gated and prompt even in bypass mode), then upload it by calling the artifact tool with its absolute `file_path` — a local file alone is NOT completion; unuploaded work is invisible to the user.","- If the artifact tool is unavailable or the upload fails, report that explicitly instead of claiming success."),i.join(`
|
|
438
|
-
`)}function Fr(t){return{type:"user",uuid:ut(),content:t,message:{content:t},artifact_dispatch:!0}}function it(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Or(t){if(!t)return"—";try{return new Date(t).toLocaleString()}catch{return t}}function Kr(t){if(!t)return null;const e=new Date(t).getTime();return Number.isNaN(e)?null:Math.ceil((e-Date.now())/(1440*60*1e3))}function Zr({sessionId:t,embedded:e=!1,refreshTick:r}){Qe();const[a,s]=k.useState([]),[l,i]=k.useState(!0),[n,h]=k.useState(""),[c,u]=k.useState(!1),[x,m]=k.useState(null),[d,y]=k.useState("template"),[b,R]=k.useState(null),{activeTeam:N,isAllTeams:_}=ft(),C=k.useCallback(async()=>{try{const g=await mt(t?{session_id:t}:_?void 0:N?{team_id:N.id}:e?void 0:{scope:"personal"});s(g||[]),h("")}catch(g){h(g instanceof Error?g.message:f("artifacts.loadFailed"))}finally{i(!1)}},[t,N,_,e]);k.useEffect(()=>{C();const g=setInterval(C,15e3);return window.addEventListener("focus",C),()=>{clearInterval(g),window.removeEventListener("focus",C)}},[C]);const M=k.useRef(!1);k.useEffect(()=>{if(!M.current){M.current=!0;return}C()},[r,C]);const H=k.useCallback(g=>{u(!1),m(null),y("template"),s($=>[g,...$.filter(Q=>Q.id!==g.id)])},[]),E=k.useCallback((g,$="template")=>{m(g),y($),u(!0)},[]),P=k.useCallback(()=>{u(!1),m(null),y("template")},[]),A=k.useCallback(async g=>{if(window.confirm(f("artifacts.delete")+" — "+g.slice(0,8)+"…?"))try{await xt(g),s($=>$.filter(Q=>Q.id!==g))}catch($){alert($ instanceof Error?$.message:f("artifacts.deleteFailed"))}},[]),Z=k.useCallback(async g=>{await gt(`${window.location.origin}${g.url}`)&&(R(g.id),setTimeout(()=>R(null),1500))},[]),G=k.useMemo(()=>a,[a]),U=o.jsxs(o.Fragment,{children:[n&&o.jsx("p",{className:"text-status-error text-sm",children:n}),l?o.jsx("div",{className:"space-y-3",children:[0,1,2].map(g=>o.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-2"},g))}):G.length===0?o.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[o.jsx(bt,{className:"mx-auto h-8 w-8 text-text-muted/40"}),o.jsx("p",{className:"mt-3 text-sm text-text-muted",children:f("artifacts.empty")})]}):o.jsx("ul",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",children:G.map(g=>{const $=Kr(g.expires_at);return o.jsxs("li",{className:"group rounded-lg border border-border bg-surface-1 p-4 transition-colors hover:border-brand/50",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("a",{href:`/code/a/${g.id}`,className:"min-w-0 flex-1 no-underline",children:[o.jsx("h3",{className:"truncate font-medium text-text-primary group-hover:text-accent",children:g.title||g.id.slice(0,12)}),o.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:[g.id.slice(0,10),"… · v",g.version," · ",it(g.size)]})]}),o.jsx("span",{className:`flex-shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium ${$!==null&&$<=0?"bg-status-error/15 text-status-error":$!==null&&$<=2?"bg-status-warning/15 text-status-warning":"bg-surface-3 text-text-muted"}`,children:$===null?"∞":`${$}d`})]}),o.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-text-muted",children:[g.session_id&&o.jsxs("a",{href:`/code/${g.session_id}`,className:"truncate text-text-muted hover:text-accent",title:g.session_id,children:[f("artifacts.session"),": ",g.session_id.slice(0,14),"…"]}),o.jsxs("span",{className:"flex items-center gap-1",title:f("artifacts.updatedAt"),children:[o.jsx(kt,{className:"h-3 w-3"}),Or(g.updated_at)]})]}),o.jsxs("div",{className:"mt-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o.jsx("a",{href:g.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.openInNewTab"),children:o.jsx(Pt,{className:"h-3.5 w-3.5"})}),o.jsxs("button",{type:"button",onClick:()=>Z(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${f("artifacts.copyLink")} · ${f("artifacts.linkNotice")}`,children:[o.jsx(Dt,{className:"h-3.5 w-3.5"}),b===g.id&&o.jsx("span",{className:"text-status-active",children:f("artifacts.copied")})]}),o.jsx("button",{type:"button",onClick:()=>E(g,"ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.aiUpdate"),children:o.jsx(Ft,{className:"h-3.5 w-3.5"})}),g.can_manage&&o.jsx("button",{type:"button",onClick:()=>E(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.edit"),children:o.jsx(yt,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>A(g.id),className:"ml-auto inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:f("artifacts.delete"),children:o.jsx(wt,{className:"h-3.5 w-3.5"})})]})]},g.id)})})]});return e?o.jsxs("div",{children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-medium text-text-primary",children:f("artifacts.title")}),o.jsxs("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:[o.jsx(vt,{className:"h-4 w-4"}),f("artifacts.new")]})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]}):o.jsxs("div",{className:"ds-page",children:[o.jsxs("header",{className:"ds-page-head",children:[o.jsxs("div",{className:"ds-page-titlerow",children:[o.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:f("artifacts.title")}),o.jsx("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"btn-ticket",children:f("artifacts.new")})]}),o.jsx("p",{className:"ds-page-sub",children:f("artifacts.subtitle")})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]})}const Gr=[{id:"template",labelKey:"artifacts.create.mode.template"},{id:"markdown",labelKey:"artifacts.create.mode.markdown"},{id:"ai",labelKey:"artifacts.create.mode.ai"}],Ur=[{id:"template",labelKey:"artifacts.edit.mode.html"},{id:"ai",labelKey:"artifacts.edit.mode.ai"}];function Re({open:t,onClose:e,onCreated:r,sessionId:a,editArtifact:s,initialMode:l="template"}){Qe();const i=!!s,[n,h]=k.useState("template"),[c,u]=k.useState("pr-review"),[x,m]=k.useState(""),[d,y]=k.useState(""),[b,R]=k.useState(""),[N,_]=k.useState(30),[C,M]=k.useState(!1),[H,E]=k.useState(""),[P,A]=k.useState(!1),[Z,G]=k.useState(!1),[U,g]=k.useState(null),[$,Q]=k.useState(""),[B,fe]=k.useState(""),[me,_e]=k.useState(""),[De,xe]=k.useState(!1),[ge,Me]=k.useState(null),[W,ae]=k.useState(null),[ne,ie]=k.useState(""),[q,Pe]=k.useState(!1);k.useEffect(()=>{t&&(h(i&&l==="ai"?"ai":"template"),u("pr-review"),_(30),M(!1),E(""),G(!1),R(""),Q(""),fe(a??(s==null?void 0:s.session_id)??""),_e(""),xe(!1),Me(null),ae(null),ie(""),Pe(!1),s?(A(!0),m(s.title??""),y(""),St(s.id).then(p=>{m(p.title??""),y(p.content??""),p.can_manage===!1&&G(!0)}).catch(()=>G(!0)).finally(()=>A(!1))):(A(!1),m(""),y(Y("pr-review").html)),a||(g(null),Rt().then(p=>{const I=p.filter(T=>!Tt(T.status));g(I),fe(T=>T&&!I.some(X=>X.id===T)?"":T)}).catch(()=>g([]))))},[t,s,a,i,l]),k.useEffect(()=>{if(!t||n!=="ai"||!B){ae(null),ie("");return}let p=!1;return $t(B).then(I=>{var T;p||(ae(I.models),ie(((T=I.models)==null?void 0:T.currentModelId)??""))}).catch(()=>{p||ae(null)}),()=>{p=!0}},[t,n,B]);const lt=p=>{u(p);const I=Y(p);y(I.html),x.trim()||m(I.defaultTitle)},[Be,qe]=k.useState("");k.useEffect(()=>{const p=setTimeout(()=>{qe(n==="markdown"?b.trim()?Ue(b).html:"":d)},300);return()=>clearTimeout(p)},[n,d,b]);const ot=n!=="ai"&&(n==="markdown"?b:d).trim().length>0&&!C&&!P&&!Z,ct=async()=>{let p,I;if(n==="markdown"){const T=Ue(b);p=T.html,I=T.title}else p=d.trim(),I=Y(c).defaultTitle;if(p){M(!0),E("");try{const T={html:p,ttl:N,title:x.trim()||(i?void 0:I)};i?s&&(T.hash=s.id):T.session_id=a??($||void 0);const X=await Nt(T);r(X)}catch(T){const X=T instanceof Error?T.message:"";T instanceof Ct&&T.status===404?E(f("artifacts.viewNotFound")):E(X||f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{M(!1)}}},dt=async()=>{if(!Z){if(!B){E(f("artifacts.create.ai.sessionRequired"));return}if(!me.trim()){E(f(i?"artifacts.update.ai.briefRequired":"artifacts.create.ai.briefRequired"));return}xe(!0),E("");try{W&&ne&&ne!==W.currentModelId&&await jt(B,{type:"control_request",request:{subtype:"set_model",model:ne}});const p=Hr(me,i&&s?{id:s.id,url:`${window.location.origin}${s.url}`,version:s.version}:void 0,{archify:q});await Et(B,Fr(p)),Me(B)}catch(p){E(p instanceof Error?p.message:f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{xe(!1)}}},be=U??[];return o.jsx(It,{open:t,onOpenChange:p=>p?void 0:e(),children:o.jsxs(At,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:[o.jsx(zt,{children:o.jsx(Lt,{children:i?f("artifacts.editArtifact"):f("artifacts.create.title")})}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-surface-2 p-1",children:(i?Ur:Gr).map(p=>o.jsx("button",{type:"button",onClick:()=>{h(p.id),E("")},className:`flex-1 rounded-md px-3 py-1.5 text-sm transition-colors ${n===p.id?"bg-surface-1 font-medium text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:f(p.labelKey)},p.id))}),n==="ai"&&(ge?o.jsxs("div",{className:"rounded-lg border border-border bg-surface-1 p-4 text-center",children:[o.jsx("p",{className:"text-sm text-text-primary",children:f(i?"artifacts.update.ai.sent":"artifacts.create.ai.sent")}),o.jsx("a",{href:`/code/${ge}`,className:"mt-3 inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:f("artifacts.create.ai.openSession")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-session",children:f("artifacts.create.ai.targetSession")}),a?o.jsxs("p",{className:"rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-muted",children:[f("artifacts.session"),": ",a.slice(0,18),"…"]}):U===null?o.jsx("p",{className:"text-xs text-text-muted",children:f("common.loading")}):be.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:f("artifacts.create.ai.noSessions")}):o.jsxs("select",{id:"artifact-ai-session",value:B,onChange:p=>fe(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.jsx("option",{value:"",children:f("artifacts.create.ai.sessionRequired")}),be.map(p=>o.jsx("option",{value:p.id,children:(p.title||p.id.slice(0,14))+(p.status==="running"?" · ⚡":"")},p.id))]}),i&&o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.update.ai.sessionHint")})]}),W&&W.availableModels.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-model",children:f("artifacts.create.ai.model")}),o.jsx("select",{id:"artifact-ai-model",value:ne,onChange:p=>ie(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:W.availableModels.map(p=>o.jsx("option",{value:p.modelId,children:p.name+(p.modelId===W.currentModelId?` · ${f("artifacts.create.ai.modelCurrent")}`:"")},p.modelId))}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.ai.modelHint")})]}),o.jsxs("button",{type:"button",role:"switch","aria-checked":q,onClick:()=>Pe(p=>!p),className:`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors ${q?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx(qt,{className:`mt-0.5 h-4 w-4 flex-shrink-0 transition-colors ${q?"text-accent":"text-text-muted"}`}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:`block text-sm font-medium transition-colors ${q?"text-text-primary":"text-text-secondary"}`,children:f("artifacts.ai.archify")}),o.jsx("span",{className:"mt-0.5 block text-xs text-text-muted",children:f("artifacts.ai.archifyDesc")})]}),o.jsx("span",{"aria-hidden":"true",className:`relative mt-0.5 h-5 w-9 flex-shrink-0 rounded-full transition-colors ${q?"bg-accent":"bg-surface-3"}`,children:o.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-surface-1 shadow-sm transition-all ${q?"left-[18px]":"left-0.5"}`})})]}),q&&o.jsx("p",{className:"text-xs text-text-muted",children:f("artifacts.ai.archifyHint")}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-brief",children:f("artifacts.create.ai.brief")}),o.jsx("textarea",{id:"artifact-ai-brief",value:me,onChange:p=>_e(p.target.value),placeholder:f(q?"artifacts.ai.archifyBriefPlaceholder":i?"artifacts.update.ai.briefPlaceholder":"artifacts.create.ai.briefPlaceholder"),rows:6,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]})]})),n==="template"&&!i&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:f("artifacts.create.template")}),o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:ye.map(p=>o.jsxs("button",{type:"button",onClick:()=>lt(p.id),className:`rounded-lg border p-3 text-left transition-colors ${c===p.id?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx("div",{className:"text-sm font-medium text-text-primary",children:f(p.titleKey)}),p.descKey&&o.jsx("div",{className:"mt-1 text-xs text-text-muted",children:f(p.descKey)})]},p.id))})]}),i&&s&&o.jsxs("p",{className:"text-xs text-text-muted",children:[o.jsxs("span",{className:"font-mono",children:[s.id.slice(0,10),"…"]})," · v",s.version,n==="ai"&&o.jsxs(o.Fragment,{children:[" · ",f("artifacts.update.ai.inPlace")]})]}),n!=="ai"&&o.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto] sm:items-end",children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-title",children:f("artifacts.create.title.label")}),o.jsx("input",{id:"artifact-title",type:"text",value:x,onChange:p=>m(p.target.value),placeholder:i||n==="markdown"?"":Y(c).defaultTitle,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ttl",children:f("artifacts.create.ttl")}),o.jsx("div",{className:"flex items-center gap-2",children:[7,30].map(p=>o.jsxs("button",{type:"button",onClick:()=>_(p),className:`rounded-md border px-3 py-2 text-sm transition-colors ${N===p?"border-accent bg-accent/10 font-medium text-text-primary":"border-border text-text-secondary hover:border-accent/50"}`,children:[p,"d"]},p))})]})]}),n!=="ai"&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-content",children:f("artifacts.create.content")}),n==="markdown"?o.jsxs(o.Fragment,{children:[o.jsx("textarea",{id:"artifact-content",value:b,onChange:p=>R(p.target.value),placeholder:f("artifacts.create.markdownPlaceholder").split(`
|
|
438
|
+
`)}function Fr(t){return{type:"user",uuid:ut(),content:t,message:{content:t},artifact_dispatch:!0}}function it(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Or(t){if(!t)return"—";try{return new Date(t).toLocaleString()}catch{return t}}function Kr(t){if(!t)return null;const e=new Date(t).getTime();return Number.isNaN(e)?null:Math.ceil((e-Date.now())/(1440*60*1e3))}function Zr({sessionId:t,embedded:e=!1,refreshTick:r}){Qe();const[a,s]=k.useState([]),[l,i]=k.useState(!0),[n,h]=k.useState(""),[c,u]=k.useState(!1),[x,m]=k.useState(null),[d,y]=k.useState("template"),[b,R]=k.useState(null),{activeTeam:N,isAllTeams:_}=ft(),C=k.useCallback(async()=>{try{const g=await mt(t?{session_id:t}:_?void 0:N?{team_id:N.id}:e?void 0:{scope:"personal"});s(g||[]),h("")}catch(g){h(g instanceof Error?g.message:f("artifacts.loadFailed"))}finally{i(!1)}},[t,N,_,e]);k.useEffect(()=>{C();const g=setInterval(C,15e3);return window.addEventListener("focus",C),()=>{clearInterval(g),window.removeEventListener("focus",C)}},[C]);const M=k.useRef(!1);k.useEffect(()=>{if(!M.current){M.current=!0;return}C()},[r,C]);const H=k.useCallback(g=>{u(!1),m(null),y("template"),s($=>[g,...$.filter(Q=>Q.id!==g.id)])},[]),E=k.useCallback((g,$="template")=>{m(g),y($),u(!0)},[]),P=k.useCallback(()=>{u(!1),m(null),y("template")},[]),A=k.useCallback(async g=>{if(window.confirm(f("artifacts.delete")+" — "+g.slice(0,8)+"…?"))try{await xt(g),s($=>$.filter(Q=>Q.id!==g))}catch($){alert($ instanceof Error?$.message:f("artifacts.deleteFailed"))}},[]),Z=k.useCallback(async g=>{await gt(`${window.location.origin}${g.url}`)&&(R(g.id),setTimeout(()=>R(null),1500))},[]),G=k.useMemo(()=>a,[a]),U=o.jsxs(o.Fragment,{children:[n&&o.jsx("p",{className:"text-status-error text-sm",children:n}),l?o.jsx("div",{className:"space-y-3",children:[0,1,2].map(g=>o.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-2"},g))}):G.length===0?o.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[o.jsx(bt,{className:"mx-auto h-8 w-8 text-text-muted/40"}),o.jsx("p",{className:"mt-3 text-sm text-text-muted",children:f("artifacts.empty")})]}):o.jsx("ul",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3",children:G.map(g=>{const $=Kr(g.expires_at);return o.jsxs("li",{className:"group rounded-lg border border-border bg-surface-1 p-4 transition-colors hover:border-brand/50",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("a",{href:`/code/a/${g.id}`,className:"min-w-0 flex-1 no-underline",children:[o.jsx("h3",{className:"truncate font-medium text-text-primary group-hover:text-accent",children:g.title||g.id.slice(0,12)}),o.jsxs("p",{className:"mt-1 font-mono text-xs text-text-muted",children:[g.id.slice(0,10),"… · v",g.version," · ",it(g.size)]})]}),o.jsx("span",{className:`flex-shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium ${$!==null&&$<=0?"bg-status-error/15 text-status-error":$!==null&&$<=2?"bg-status-warning/15 text-status-warning":"bg-surface-3 text-text-muted"}`,children:$===null?"∞":`${$}d`})]}),o.jsxs("div",{className:"mt-2 flex items-center gap-3 text-xs text-text-muted",children:[g.session_id&&o.jsxs("a",{href:`/code/${g.session_id}`,className:"truncate text-text-muted hover:text-accent",title:g.session_id,children:[f("artifacts.session"),": ",g.session_id.slice(0,14),"…"]}),o.jsxs("span",{className:"flex items-center gap-1",title:f("artifacts.updatedAt"),children:[o.jsx(kt,{className:"h-3 w-3"}),Or(g.updated_at)]})]}),o.jsxs("div",{className:"mt-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o.jsx("a",{href:g.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.openInNewTab"),children:o.jsx(Pt,{className:"h-3.5 w-3.5"})}),o.jsxs("button",{type:"button",onClick:()=>Z(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:`${f("artifacts.copyLink")} · ${f("artifacts.linkNotice")}`,children:[o.jsx(Dt,{className:"h-3.5 w-3.5"}),b===g.id&&o.jsx("span",{className:"text-status-active",children:f("artifacts.copied")})]}),o.jsx("button",{type:"button",onClick:()=>E(g,"ai"),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.aiUpdate"),children:o.jsx(Ft,{className:"h-3.5 w-3.5"})}),g.can_manage&&o.jsx("button",{type:"button",onClick:()=>E(g),className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-surface-2 hover:text-text-primary",title:f("artifacts.edit"),children:o.jsx(yt,{className:"h-3.5 w-3.5"})}),o.jsx("button",{type:"button",onClick:()=>A(g.id),className:"ml-auto inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:f("artifacts.delete"),children:o.jsx(wt,{className:"h-3.5 w-3.5"})})]})]},g.id)})})]});return e?o.jsxs("div",{children:[o.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-medium text-text-primary",children:f("artifacts.title")}),o.jsxs("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:[o.jsx(vt,{className:"h-4 w-4"}),f("artifacts.new")]})]}),U,o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]}):o.jsxs("div",{className:"ds-page",children:[o.jsxs("header",{className:"ds-page-head ds-page-head--display hero-enter",children:[o.jsxs("div",{className:"ds-page-titlerow",children:[o.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:f("artifacts.title")}),o.jsx("button",{type:"button",onClick:()=>{m(null),u(!0)},className:"btn-quiet",children:f("artifacts.new")})]}),o.jsx("p",{className:"ds-page-sub",children:f("artifacts.subtitle")})]}),o.jsx("div",{className:"hero-enter-late",children:U}),o.jsx(Re,{open:c,onClose:P,onCreated:H,sessionId:t,editArtifact:x,initialMode:d})]})}const Gr=[{id:"template",labelKey:"artifacts.create.mode.template"},{id:"markdown",labelKey:"artifacts.create.mode.markdown"},{id:"ai",labelKey:"artifacts.create.mode.ai"}],Ur=[{id:"template",labelKey:"artifacts.edit.mode.html"},{id:"ai",labelKey:"artifacts.edit.mode.ai"}];function Re({open:t,onClose:e,onCreated:r,sessionId:a,editArtifact:s,initialMode:l="template"}){Qe();const i=!!s,[n,h]=k.useState("template"),[c,u]=k.useState("pr-review"),[x,m]=k.useState(""),[d,y]=k.useState(""),[b,R]=k.useState(""),[N,_]=k.useState(30),[C,M]=k.useState(!1),[H,E]=k.useState(""),[P,A]=k.useState(!1),[Z,G]=k.useState(!1),[U,g]=k.useState(null),[$,Q]=k.useState(""),[B,fe]=k.useState(""),[me,_e]=k.useState(""),[De,xe]=k.useState(!1),[ge,Me]=k.useState(null),[W,ae]=k.useState(null),[ne,ie]=k.useState(""),[q,Pe]=k.useState(!1);k.useEffect(()=>{t&&(h(i&&l==="ai"?"ai":"template"),u("pr-review"),_(30),M(!1),E(""),G(!1),R(""),Q(""),fe(a??(s==null?void 0:s.session_id)??""),_e(""),xe(!1),Me(null),ae(null),ie(""),Pe(!1),s?(A(!0),m(s.title??""),y(""),St(s.id).then(p=>{m(p.title??""),y(p.content??""),p.can_manage===!1&&G(!0)}).catch(()=>G(!0)).finally(()=>A(!1))):(A(!1),m(""),y(Y("pr-review").html)),a||(g(null),Rt().then(p=>{const I=p.filter(T=>!Tt(T.status));g(I),fe(T=>T&&!I.some(X=>X.id===T)?"":T)}).catch(()=>g([]))))},[t,s,a,i,l]),k.useEffect(()=>{if(!t||n!=="ai"||!B){ae(null),ie("");return}let p=!1;return $t(B).then(I=>{var T;p||(ae(I.models),ie(((T=I.models)==null?void 0:T.currentModelId)??""))}).catch(()=>{p||ae(null)}),()=>{p=!0}},[t,n,B]);const lt=p=>{u(p);const I=Y(p);y(I.html),x.trim()||m(I.defaultTitle)},[Be,qe]=k.useState("");k.useEffect(()=>{const p=setTimeout(()=>{qe(n==="markdown"?b.trim()?Ue(b).html:"":d)},300);return()=>clearTimeout(p)},[n,d,b]);const ot=n!=="ai"&&(n==="markdown"?b:d).trim().length>0&&!C&&!P&&!Z,ct=async()=>{let p,I;if(n==="markdown"){const T=Ue(b);p=T.html,I=T.title}else p=d.trim(),I=Y(c).defaultTitle;if(p){M(!0),E("");try{const T={html:p,ttl:N,title:x.trim()||(i?void 0:I)};i?s&&(T.hash=s.id):T.session_id=a??($||void 0);const X=await Nt(T);r(X)}catch(T){const X=T instanceof Error?T.message:"";T instanceof Ct&&T.status===404?E(f("artifacts.viewNotFound")):E(X||f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{M(!1)}}},dt=async()=>{if(!Z){if(!B){E(f("artifacts.create.ai.sessionRequired"));return}if(!me.trim()){E(f(i?"artifacts.update.ai.briefRequired":"artifacts.create.ai.briefRequired"));return}xe(!0),E("");try{W&&ne&&ne!==W.currentModelId&&await jt(B,{type:"control_request",request:{subtype:"set_model",model:ne}});const p=Hr(me,i&&s?{id:s.id,url:`${window.location.origin}${s.url}`,version:s.version}:void 0,{archify:q});await Et(B,Fr(p)),Me(B)}catch(p){E(p instanceof Error?p.message:f(i?"artifacts.updateFailed":"artifacts.create.failed"))}finally{xe(!1)}}},be=U??[];return o.jsx(It,{open:t,onOpenChange:p=>p?void 0:e(),children:o.jsxs(At,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:[o.jsx(zt,{children:o.jsx(Lt,{children:i?f("artifacts.editArtifact"):f("artifacts.create.title")})}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-surface-2 p-1",children:(i?Ur:Gr).map(p=>o.jsx("button",{type:"button",onClick:()=>{h(p.id),E("")},className:`flex-1 rounded-md px-3 py-1.5 text-sm transition-colors ${n===p.id?"bg-surface-1 font-medium text-text-primary shadow-sm":"text-text-secondary hover:text-text-primary"}`,children:f(p.labelKey)},p.id))}),n==="ai"&&(ge?o.jsxs("div",{className:"rounded-lg border border-border bg-surface-1 p-4 text-center",children:[o.jsx("p",{className:"text-sm text-text-primary",children:f(i?"artifacts.update.ai.sent":"artifacts.create.ai.sent")}),o.jsx("a",{href:`/code/${ge}`,className:"mt-3 inline-flex items-center gap-1 rounded-md bg-accent px-3 py-1.5 text-sm font-medium text-white hover:bg-accent/90",children:f("artifacts.create.ai.openSession")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-session",children:f("artifacts.create.ai.targetSession")}),a?o.jsxs("p",{className:"rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-muted",children:[f("artifacts.session"),": ",a.slice(0,18),"…"]}):U===null?o.jsx("p",{className:"text-xs text-text-muted",children:f("common.loading")}):be.length===0?o.jsx("p",{className:"text-sm text-text-muted",children:f("artifacts.create.ai.noSessions")}):o.jsxs("select",{id:"artifact-ai-session",value:B,onChange:p=>fe(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.jsx("option",{value:"",children:f("artifacts.create.ai.sessionRequired")}),be.map(p=>o.jsx("option",{value:p.id,children:(p.title||p.id.slice(0,14))+(p.status==="running"?" · ⚡":"")},p.id))]}),i&&o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.update.ai.sessionHint")})]}),W&&W.availableModels.length>0&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-model",children:f("artifacts.create.ai.model")}),o.jsx("select",{id:"artifact-ai-model",value:ne,onChange:p=>ie(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:W.availableModels.map(p=>o.jsx("option",{value:p.modelId,children:p.name+(p.modelId===W.currentModelId?` · ${f("artifacts.create.ai.modelCurrent")}`:"")},p.modelId))}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.ai.modelHint")})]}),o.jsxs("button",{type:"button",role:"switch","aria-checked":q,onClick:()=>Pe(p=>!p),className:`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors ${q?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx(qt,{className:`mt-0.5 h-4 w-4 flex-shrink-0 transition-colors ${q?"text-accent":"text-text-muted"}`}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:`block text-sm font-medium transition-colors ${q?"text-text-primary":"text-text-secondary"}`,children:f("artifacts.ai.archify")}),o.jsx("span",{className:"mt-0.5 block text-xs text-text-muted",children:f("artifacts.ai.archifyDesc")})]}),o.jsx("span",{"aria-hidden":"true",className:`relative mt-0.5 h-5 w-9 flex-shrink-0 rounded-full transition-colors ${q?"bg-accent":"bg-surface-3"}`,children:o.jsx("span",{className:`absolute top-0.5 h-4 w-4 rounded-full bg-surface-1 shadow-sm transition-all ${q?"left-[18px]":"left-0.5"}`})})]}),q&&o.jsx("p",{className:"text-xs text-text-muted",children:f("artifacts.ai.archifyHint")}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ai-brief",children:f("artifacts.create.ai.brief")}),o.jsx("textarea",{id:"artifact-ai-brief",value:me,onChange:p=>_e(p.target.value),placeholder:f(q?"artifacts.ai.archifyBriefPlaceholder":i?"artifacts.update.ai.briefPlaceholder":"artifacts.create.ai.briefPlaceholder"),rows:6,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]})]})),n==="template"&&!i&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-2 block text-sm font-medium text-text-primary",children:f("artifacts.create.template")}),o.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:ye.map(p=>o.jsxs("button",{type:"button",onClick:()=>lt(p.id),className:`rounded-lg border p-3 text-left transition-colors ${c===p.id?"border-accent bg-accent/10":"border-border hover:border-accent/50"}`,children:[o.jsx("div",{className:"text-sm font-medium text-text-primary",children:f(p.titleKey)}),p.descKey&&o.jsx("div",{className:"mt-1 text-xs text-text-muted",children:f(p.descKey)})]},p.id))})]}),i&&s&&o.jsxs("p",{className:"text-xs text-text-muted",children:[o.jsxs("span",{className:"font-mono",children:[s.id.slice(0,10),"…"]})," · v",s.version,n==="ai"&&o.jsxs(o.Fragment,{children:[" · ",f("artifacts.update.ai.inPlace")]})]}),n!=="ai"&&o.jsxs("div",{className:"grid gap-4 sm:grid-cols-[1fr_auto] sm:items-end",children:[o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-title",children:f("artifacts.create.title.label")}),o.jsx("input",{id:"artifact-title",type:"text",value:x,onChange:p=>m(p.target.value),placeholder:i||n==="markdown"?"":Y(c).defaultTitle,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-ttl",children:f("artifacts.create.ttl")}),o.jsx("div",{className:"flex items-center gap-2",children:[7,30].map(p=>o.jsxs("button",{type:"button",onClick:()=>_(p),className:`rounded-md border px-3 py-2 text-sm transition-colors ${N===p?"border-accent bg-accent/10 font-medium text-text-primary":"border-border text-text-secondary hover:border-accent/50"}`,children:[p,"d"]},p))})]})]}),n!=="ai"&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-content",children:f("artifacts.create.content")}),n==="markdown"?o.jsxs(o.Fragment,{children:[o.jsx("textarea",{id:"artifact-content",value:b,onChange:p=>R(p.target.value),placeholder:f("artifacts.create.markdownPlaceholder").split(`
|
|
439
439
|
`).join(" "),rows:12,spellCheck:!1,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-primary focus:border-accent focus:outline-none"}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.markdownHint")})]}):o.jsxs(o.Fragment,{children:[o.jsx("textarea",{id:"artifact-content",value:d,onChange:p=>y(p.target.value),placeholder:i?"":Y(c).html.slice(0,120)+"…",rows:12,spellCheck:!1,disabled:P,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-primary focus:border-accent focus:outline-none disabled:opacity-50"}),o.jsxs("div",{className:"mt-1 flex items-center justify-between text-xs text-text-muted",children:[o.jsx("span",{children:d.trim()?it(new Blob([d]).size):f("artifacts.create.contentRequired")}),o.jsx("span",{children:f("artifacts.create.ttlResetNote")})]})]})]}),!i&&n!=="ai"&&!a&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"artifact-bind-session",children:f("artifacts.create.bindSession")}),U===null?o.jsx("p",{className:"text-xs text-text-muted",children:f("common.loading")}):o.jsxs("select",{id:"artifact-bind-session",value:$,onChange:p=>Q(p.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.jsx("option",{value:"",children:f("artifacts.create.noSession")}),be.map(p=>o.jsx("option",{value:p.id,children:p.title||p.id.slice(0,14)},p.id))]}),o.jsx("p",{className:"mt-1 text-xs text-text-muted",children:f("artifacts.create.sessionHint")})]}),Be.trim()&&n!=="ai"&&o.jsxs("div",{children:[o.jsx("label",{className:"mb-1 block text-xs font-medium text-text-muted",children:f("artifacts.create.preview")}),o.jsx("iframe",{srcDoc:Be,title:"preview",className:"h-56 w-full rounded-md border border-border bg-white",sandbox:"allow-scripts allow-popups allow-forms"})]}),Z&&o.jsx("p",{className:"text-sm text-status-error",children:f("artifacts.viewNotFound")}),H&&o.jsx("p",{className:"text-sm text-status-error",children:H})]}),o.jsxs(_t,{children:[o.jsx("button",{type:"button",onClick:e,className:"rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:f("common.cancel")}),n==="ai"?o.jsx("button",{type:"button",onClick:dt,disabled:De||!!ge||!B||Z,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:De?f("artifacts.create.ai.sending"):f("artifacts.create.ai.send")}):o.jsx("button",{type:"button",onClick:ct,disabled:!ot,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:C?f("common.creating"):i?f("artifacts.update"):f("artifacts.create.submit")})]})]})})}const es=Object.freeze(Object.defineProperty({__proto__:null,ArtifactsGallery:Zr,CreateArtifactDialog:Re},Symbol.toStringTag,{value:"Module"}));export{Zr as A,Re as C,Pt as E,Ft as S,es as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{a1 as u,aa as f}from"./main-BkfSO2Rz.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";const v=2e3,N=3e4;function E(){const c=window.location.pathname.split("/"),i=c[c.length-1]||"",[s,n]=r.useState("idle"),[m,l]=r.useState(null),[a,d]=r.useState(null);return r.useEffect(()=>{if(!i||!i.startsWith("clm_")){l("Invalid claim token"),n("error");return}n("claiming"),u(i).then(t=>{d(t.environment_id),n("waiting")}).catch(t=>{l(t instanceof Error?t.message:"Claim failed"),n("error")})},[i]),r.useEffect(()=>{if(s!=="waiting"||!a)return;let t=!1;const x=Date.now(),o=setInterval(()=>{if(Date.now()-x>N){clearInterval(o),t||n("timeout");return}f().then(h=>{t||(h||[]).some(p=>p.environment_id===a)&&(clearInterval(o),window.location.href="/code/")}).catch(()=>{})},v);return()=>{t=!0,clearInterval(o)}},[s,a]),s==="claiming"?e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})}):s==="error"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsx("p",{className:"text-sm text-destructive",children:m}),e.jsx("a",{href:"/code",className:"mt-4 inline-block text-accent hover:underline",children:"Back to dashboard"})]}):s==="waiting"||s==="timeout"?e.jsxs("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:[e.jsxs("header",{className:"mb-10",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight text-text-primary",children:"Environment claimed"}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:"You are now the owner of this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[a&&e.jsx("p",{className:"font-mono text-xs text-text-muted",children:a}),s==="waiting"?e.jsxs("p",{className:"text-sm text-text-muted",children:["Waiting for the worker to create a session",e.jsx("span",{className:"animate-pulse",children:"…"})]}):e.jsx("p",{className:"text-sm text-text-muted",children:"The worker has not created a session yet — it may be offline or stopped. The session will appear on the dashboard once the worker connects."}),e.jsx("a",{href:"/code",className:"inline-block rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 transition-colors",children:"Go to dashboard"})]})]}):e.jsx("div",{className:"px-6 py-16 sm:px-10 sm:py-20",children:e.jsx("p",{className:"text-sm text-text-muted",children:"Claiming environment..."})})}export{E as Claim};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,e as r}from"./vendor-DE_-CLIE.js";import{aF as v,b2 as Y,b0 as Z,aX as t,aY as X,X as ie,aL as ne,b1 as G,Q as le,ak as ce,f as V,e as ee,a5 as de,ay as oe,aa as me,ad as he,a9 as ue,$ as se,S as ae}from"./main-BkfSO2Rz.js";import{R as re,E as pe}from"./RegisterEmpty-CdLm4eR8.js";import{g as Q}from"./workerType-CS6pd4nT.js";import{S as xe,F as fe,L as je}from"./SessionVisibilityBadge-CtjTB48N.js";import{D as ge,a as be,e as Ne}from"./dialog-8nXjsFEb.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function we({teamName:c,className:d}){return c?e.jsx("span",{className:v("inline-flex items-center rounded-full border border-border/60 bg-surface-2 px-2 py-0.5 text-xs text-text-muted",d),children:c}):null}function ye({environments:c,onSelectEnvironment:d}){const{activeTeam:D,isAllTeams:N}=Y(),{user:g}=Z(),o=r.useMemo(()=>(g==null?void 0:g.role)==="admin"||N?c:D?c.filter(l=>l.team_id===D.id):c.filter(l=>!l.team_id),[c,D,N,g]);return!o||o.length===0?e.jsx(re,{title:t("dashboard.emptyEnvironmentsTitle"),hint:t("dashboard.emptyEnvironmentsHint")}):e.jsx("div",{className:"ds-reg",children:o.map(l=>{var s,m,u;const j=l.worker_type==="acp",M=Q(l.worker_type),w=l.worker_type==="repl",x=l.workspace_dirs&&l.workspace_dirs.length>0?l.workspace_dirs:l.directory?[l.directory]:[],y=x[0]??((s=l.directory)==null?void 0:s.trim())??null,_=Math.max(0,x.length-1),b=typeof l.max_sessions=="number"&&l.max_sessions>0?{active:l.active_sessions??0,max:l.max_sessions}:null,k=((m=l.ip_address)==null?void 0:m.trim())||null,h=((u=l.owner_username)==null?void 0:u.trim())||null,S=l.status!=="active";return e.jsxs("div",{className:v("ds-reg-row group",(j||S)&&"opacity-80"),children:[e.jsxs("button",{type:"button",onClick:()=>d==null?void 0:d(l),disabled:j,className:v("ds-reg-main",j?"cursor-default":"cursor-pointer"),children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:l.machine_name||l.id}),e.jsx("span",{className:v("ds-reg-tag rounded-full",M.colorClass),children:M.fullLabel}),e.jsx(pe,{status:l.status,className:"ds-reg-tag"}),e.jsx(we,{teamName:l.team_name??null,className:"ds-reg-tag"})]}),(y||k||h)&&e.jsxs("span",{className:"ds-reg-meta flex min-w-0 items-center gap-1.5 text-xs text-text-muted",children:[y&&e.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("span",{className:"min-w-0 truncate font-mono",title:x.join(`
|
|
2
|
+
`),children:y}),_>0&&e.jsxs("span",{className:"shrink-0 text-text-muted/80",children:["+",_]})]}),y&&e.jsx("span",{className:v("ds-reg-tag rounded-full border",w?"border-border/60 bg-surface-2 text-text-muted":"border-brand/30 bg-brand/10 text-brand-text"),children:w?t("dashboard.singleDir"):t("dashboard.anyDir")}),b&&e.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono tabular-nums",children:X("dashboard.capacity",{active:b.active,max:b.max})}),k&&e.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono tabular-nums",children:k}),h&&e.jsxs("span",{className:"ds-reg-owner",title:`${t("dashboard.envOwner")}: ${h}`,children:[e.jsx(ie,{className:"h-3 w-3","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 truncate",children:h})]})]})]}),e.jsx("div",{className:"ds-reg-aside",children:e.jsx("span",{className:"col-start-2 whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:ne(l.created_at)})})]},l.id)})})}function _e({sessions:c,environments:d,onSelect:D,onDelete:N}){G();const{activeTeam:g,isAllTeams:o,myTeams:l}=Y(),{user:j}=Z(),M=r.useMemo(()=>{const s=new Map;for(const m of l)s.set(m.id,m.name);return s},[l]),w=r.useMemo(()=>(j==null?void 0:j.role)==="admin"||o?c:g?c.filter(s=>s.owner_type==="team"&&s.owner_id===g.id):c.filter(s=>s.owner_type==="user"||s.access_level==="write"||s.access_level==="read"),[c,g,o,j]),{mySessions:x,sharedSessions:y}=r.useMemo(()=>{const s=[],m=[];for(const u of w)g||o?s.push(u):u.access_level==="write"||u.access_level==="read"?m.push(u):s.push(u);return{mySessions:s,sharedSessions:m}},[w,g,o]),_=new Map;for(const s of d??[])s!=null&&s.id&&s.worker_type&&_.set(s.id,s.worker_type);const b=(s,m)=>(m.updated_at||0)-(s.updated_at||0);function k(s){var E,C,T;const m=!!N&&s.access_level!=="write"&&s.access_level!=="read";let u=s.source==="acp"?"acp":(E=s.environment)==null?void 0:E.worker_type;!u&&s.environment_id&&(u=_.get(s.environment_id));const F=Q(u);return e.jsxs("div",{className:"ds-reg-row group",children:[e.jsxs("button",{type:"button",onClick:()=>D(s.id),className:"ds-reg-main cursor-pointer",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-text-primary",children:s.title||s.id}),s.visibility&&e.jsx(xe,{visibility:s.visibility||"private",className:"ds-reg-tag"}),e.jsx("span",{className:v("ds-reg-tag rounded-full",F.colorClass),children:F.fullLabel})]}),s.owner_type==="team"&&s.owner_id&&e.jsx("span",{className:"ds-reg-meta flex items-center gap-2 truncate text-xs text-text-muted",children:e.jsx("span",{className:"truncate",children:M.get(s.owner_id)||s.owner_id})})]}),e.jsxs("div",{className:"ds-reg-aside ds-reg-aside--dot",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.status==="requires_action"&&e.jsx("span",{"aria-hidden":"true",className:"h-1.5 w-1.5 rounded-full bg-status-warning pulse-dot"}),s.status==="requires_action"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"whitespace-nowrap text-xs text-status-warning",children:((C=s.requires_action_details)==null?void 0:C.tool_name)==="AskUserQuestion"?t("permission.waitingAnswer"):((T=s.requires_action_details)==null?void 0:T.tool_name)==="ExitPlanMode"?t("permission.waitingPlan"):t("permission.waitingApprove")}),s.pending_permission_count?e.jsx("span",{className:"whitespace-nowrap font-mono text-[10px] tabular-nums text-text-muted",children:X("permission.pendingCountShort",{n:s.pending_permission_count})}):null]}):e.jsx(le,{status:s.status,variant:"plain"})]}),e.jsx("span",{"aria-hidden":"true",className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"whitespace-nowrap font-mono text-xs tabular-nums text-text-muted",children:ne(s.updated_at||s.created_at)}),m&&e.jsx("button",{type:"button",onClick:q=>{q.stopPropagation(),N(s.id)},className:"ds-reg-delete rounded p-1 text-text-muted opacity-0 transition-all hover:text-status-error group-hover:opacity-100 focus-visible:opacity-100",title:"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"})})})]})]},s.id)}if(w.length===0)return e.jsx(re,{title:t("dashboard.emptySessionsTitle"),hint:t("dashboard.emptySessionsHint")});const h=[...x].sort(b),S=[...y].sort(b);return e.jsxs("div",{className:"space-y-4",children:[h.length>0&&e.jsx("section",{className:"space-y-2",children:e.jsx("div",{className:"ds-reg",children:h.map(k)})}),S.length>0&&e.jsxs("section",{className:"space-y-2",children:[h.length>0&&e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:t("session.sharedWithMe")}),e.jsx("div",{className:"ds-reg",children:S.map(k)})]})]})}function te(c){const d=c.trim();return d?d.includes("\0")?t("dialog.directoryInvalid"):d==="~"||d.startsWith("~/")||d.startsWith("~\\")||/^[A-Za-z]:[\\/]/.test(d)||d.startsWith("/")||d.startsWith("\\\\")?"":t("dialog.directoryAbsolute"):""}function ke({open:c,environments:d,initialEnvironmentId:D,onClose:N,onCreated:g}){G();const{activeTeam:o,isAllTeams:l}=Y(),{user:j}=Z(),[M,w]=r.useState(""),[x,y]=r.useState(""),[_,b]=r.useState(""),[k,h]=r.useState(""),[S,s]=r.useState([]),[m,u]=r.useState(""),[F,E]=r.useState("same-dir"),[C,T]=r.useState(""),[q,O]=r.useState(!1),[$,W]=r.useState(!1),P=r.useMemo(()=>(j==null?void 0:j.role)==="admin"||l?d:o?d.filter(a=>a.team_id===o.id):d.filter(a=>!a.team_id),[d,o,l,j]);r.useEffect(()=>{c&&(w(""),y(D??""),b(""),h(""),s([]),u(""),E("same-dir"),T(""),W(!1))},[c,D]);const i=P.find(a=>a.id===x)||null,A=i?P.findIndex(a=>a.id===i.id)+1:null,L=(i==null?void 0:i.worker_type)==="repl",I=(i==null?void 0:i.worker_type)==="acp",H=r.useMemo(()=>{var a;return i?(a=i.workspace_dirs)!=null&&a.length?i.workspace_dirs:i.directory?[i.directory]:[]:[]},[i]),z=(i==null?void 0:i.id)??"",n=(i==null?void 0:i.directory)??"";r.useEffect(()=>{if(!c||(b(n),h(""),s([]),!z))return;let a=!1;return ce(z).then(p=>{a||s(p.dirs??[])}).catch(()=>{a||s([])}),()=>{a=!0}},[c,z,n]);const f=async()=>{const a=_.trim();if(!L){const p=te(a);if(p){h(p);return}}O(!0),T("");try{const p={};M.trim()&&(p.title=M.trim()),x&&(p.environment_id=x),p.spawn_mode=F,m&&(p.permission_mode=m),!L&&!I&&a&&(p.cwd=a);const B=(o==null?void 0:o.id)??(l?i==null?void 0:i.team_id:void 0);B&&(p.team_id=B);const U=await de(p);g(U)}catch(p){T(p instanceof Error?p.message:t("dialog.createFailed"))}finally{O(!1)}},R=r.useMemo(()=>{const a=new Set(H),p=S.filter(B=>!a.has(B));return{quick:H,recent:p.slice(0,5)}},[H,S]);return e.jsx(ge,{open:c,onOpenChange:a=>{a||N()},children:e.jsx(be,{className:"nsd-shell max-w-md",children:e.jsxs("div",{className:"nsd-box",children:[e.jsx(Ne,{className:"nsd-h",children:t("dialog.newSession")}),e.jsxs("div",{className:"nsd-field nsd-field--env",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.machine")}),e.jsxs("button",{type:"button",className:"nsd-envtrigger","aria-expanded":$,onClick:()=>W(a=>!a),children:[e.jsx("span",{className:"nsd-env-read",children:i?e.jsxs(e.Fragment,{children:[A!==null&&e.jsxs("span",{className:"nsd-env-idx",children:["#",A]}),e.jsx("span",{className:"nsd-env-name",children:i.machine_name||i.id}),e.jsx("span",{className:v("nsd-env-type",Q(i.worker_type).colorClass),children:Q(i.worker_type).shortLabel})]}):e.jsx("span",{className:"nsd-env-none",children:t("dialog.envSelectEnv")})}),e.jsx(V,{className:"nsd-env-caret"})]}),i&&!I&&e.jsx("span",{className:"nsd-env-path",children:i.status!=="active"?t("dialog.offlineHint"):L?t("dialog.singleDirHint"):t("dialog.anyDirHint")}),$&&e.jsxs("div",{className:"nsd-envpanel",children:[e.jsx("button",{type:"button",onClick:()=>{y(""),W(!1)},className:"nsd-envrow",children:e.jsxs("span",{className:"nsd-envrow-head",children:[e.jsx("span",{className:"nsd-envrow-name",children:t("dialog.none")}),!x&&e.jsx(ee,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand-text"})]})}),P.length===0?e.jsx("p",{className:"nsd-envempty",children:t("dialog.envEmpty")}):P.map((a,p)=>{const B=Q(a.worker_type),U=!!a.team_id,J=a.id===x,K=a.status!=="active";return e.jsxs("button",{type:"button",disabled:K,"data-selected":J?"on":void 0,onClick:()=>{y(a.id),W(!1)},className:v("nsd-envrow",K&&"opacity-60"),children:[e.jsxs("span",{className:"nsd-envrow-head",children:[e.jsxs("span",{className:"nsd-envrow-idx",children:["#",p+1]}),e.jsx("span",{className:"nsd-envrow-name",children:a.machine_name||a.id}),e.jsx("span",{className:v("nsd-envrow-type",B.colorClass),children:B.shortLabel}),K&&e.jsx("span",{className:"nsd-envrow-team border-border/60 bg-surface-2 text-text-muted",children:t("dialog.envOffline")}),e.jsx("span",{className:v("nsd-envrow-team",U?"border-border/60 bg-surface-2 text-text-muted":"border-brand/30 bg-brand/10 text-brand-text"),children:U?`${t("dialog.envTeam")}: ${a.team_name||a.team_id}`:t("dialog.envPersonal")}),J&&e.jsx(ee,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-brand-text"})]}),a.directory&&e.jsxs("span",{className:"nsd-envrow-dir",children:[e.jsx(fe,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"nsd-envrow-path",children:a.directory}),a.branch&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-text-muted/40",children:"·"}),e.jsx("span",{className:"nsd-envrow-path",children:a.branch})]})]})]},a.id)})]})]}),i&&!I&&e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.directory")}),L?e.jsxs("span",{className:"nsd-dir-locked",children:[e.jsx(je,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"nsd-dir-locked-path",children:i.directory||"—"})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:_,onChange:a=>{b(a.target.value),k&&h("")},onBlur:()=>h(te(_)),placeholder:"/home/user/projects/app",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",className:v("nsd-title nsd-dir-input",k&&"nsd-dir-input--error")}),k&&e.jsx("span",{className:"nsd-error",children:k}),(R.quick.length>0||R.recent.length>0)&&e.jsxs("span",{className:"nsd-dir-chips",children:[R.quick.map(a=>e.jsx("button",{type:"button",onClick:()=>{b(a),h("")},className:"nsd-dir-chip nsd-dir-chip--quick",title:a,children:a},`q:${a}`)),R.recent.map(a=>e.jsx("button",{type:"button",onClick:()=>{b(a),h("")},className:"nsd-dir-chip",title:a,children:a},`r:${a}`))]})]})]}),e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.titleOptional")}),e.jsx("input",{type:"text",value:M,onChange:a=>w(a.target.value),placeholder:t("dialog.titlePlaceholder"),className:"nsd-title"})]}),!L&&!I&&e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.permissionMode")}),e.jsxs("span",{className:"nsd-modesel",children:[e.jsxs("select",{value:m,onChange:a=>u(a.target.value),className:"nsd-mode",children:[e.jsx("option",{value:"",children:t("dialog.permissionInherit")}),e.jsx("option",{value:"default",children:t("dialog.permissionDefault")}),e.jsx("option",{value:"acceptEdits",children:t("dialog.permissionAcceptEdits")}),e.jsx("option",{value:"plan",children:t("dialog.permissionPlan")})]}),e.jsx(V,{className:"nsd-mode-caret"})]})]}),!L&&!I&&e.jsxs("label",{className:"nsd-field",children:[e.jsx("span",{className:"nsd-lab",children:t("dialog.workspaceMode")}),e.jsxs("span",{className:"nsd-modesel",children:[e.jsxs("select",{value:F,onChange:a=>E(a.target.value),className:"nsd-mode",children:[e.jsx("option",{value:"same-dir",children:t("dialog.sameDir")}),e.jsx("option",{value:"worktree",children:t("dialog.worktree")})]}),e.jsx(V,{className:"nsd-mode-caret"})]})]}),C&&e.jsx("p",{className:"nsd-error",children:C}),e.jsxs("div",{className:"nsd-foot",children:[e.jsx("button",{type:"button",onClick:N,className:"nsd-cancel",children:t("common.cancel")}),e.jsx("button",{type:"button",onClick:f,disabled:q||!!i&&i.status!=="active",className:"btn-ticket nsd-create",children:q?t("common.creating"):t("common.create")})]})]})})})}function Ae({onNavigateSession:c}){const d=G(),D=r.useMemo(()=>new Date().toLocaleDateString(d==="zh"?"zh-CN":"en-US",{year:"numeric",month:"long",day:"numeric",weekday:"short"}),[d]),[N,g]=r.useState([]),[o,l]=r.useState([]),j=r.useMemo(()=>N.reduce((n,f)=>n+(f.status==="requires_action"?f.pending_permission_count??1:0),0),[N]),[M,w]=r.useState(!1),[x,y]=r.useState(null),_=r.useMemo(()=>o.find(n=>n.id===x)??null,[o,x]),b=r.useMemo(()=>x?N.filter(n=>n.environment_id===x):N,[N,x]),[k,h]=r.useState(!1),[S,s]=r.useState(""),[m,u]=r.useState(null),[F,E]=r.useState(!1),C=r.useRef(0),[T,q]=r.useState(!1),O=k||T,$=r.useCallback(()=>{h(!1),s(""),q(!0)},[]),W=r.useCallback(()=>{q(!1)},[]),P=r.useRef(null),i=r.useRef(!1);r.useEffect(()=>{var n;i.current&&!O&&((n=P.current)==null||n.focus()),i.current=O},[O]),r.useEffect(()=>{const n=S.trim();if(!n){C.current+=1,u(null),E(!1);return}E(!0);const f=++C.current,R=setTimeout(()=>{oe(n).then(a=>{C.current===f&&u(a.results??[])}).catch(()=>{C.current===f&&u([])}).finally(()=>{C.current===f&&E(!1)})},300);return()=>clearTimeout(R)},[S]);const A=r.useCallback(async()=>{try{const[n,f]=await Promise.all([me(),he()]);g(n||[]),l(f||[])}catch(n){console.error("Dashboard render error:",n)}},[]);r.useEffect(()=>{A();const n=setInterval(A,5e3);return window.addEventListener("focus",A),()=>{clearInterval(n),window.removeEventListener("focus",A)}},[A]);const L=n=>{w(!1),c(n.id)},I=r.useCallback(n=>{n.worker_type!=="acp"&&y(f=>f===n.id?null:n.id)},[]),H=r.useCallback(n=>{c(n)},[c]),z=r.useCallback(async n=>{if(window.confirm(t("dashboard.confirmDelete").replace("{id}",n)))try{await ue(n),g(f=>f.filter(R=>R.id!==n))}catch(f){alert(f instanceof Error?f.message:t("dashboard.deleteFailed"))}},[]);return e.jsxs("div",{className:"ds-dash",children:[e.jsxs("header",{className:"ds-dash-bar hero-enter",children:[e.jsx("span",{className:"ds-dash-dateline",children:D}),e.jsxs("div",{className:"ds-dash-titlerow",children:[e.jsx("h1",{className:"ds-dash-title text-text-primary",children:t("dashboard.title")}),e.jsxs("div",{className:"ds-dash-counts",children:[e.jsxs("span",{children:[b.length," ",t("dashboard.sessions")]}),e.jsxs("span",{children:[o.length," ",t("dashboard.environments")]}),j>0&&e.jsx("span",{className:"text-status-warning",children:X("dashboard.pendingTotal",{n:j})})]})]})]}),e.jsxs("section",{className:"ds-dash-row",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:t("dashboard.environments")}),e.jsx(ye,{environments:o,onSelectEnvironment:I})]}),e.jsxs("section",{className:"ds-dash-row",children:[e.jsxs("div",{className:"ds-dash-rowhead",children:[e.jsxs("div",{className:"ds-dash-rowlabel",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-text-primary",children:t("dashboard.sessions")}),_&&e.jsxs("button",{type:"button",onClick:()=>y(null),className:"ds-dash-filter",title:t("dashboard.clearMachineFilter"),children:[e.jsx("span",{className:"ds-dash-filter-label",children:t("dashboard.machine")}),e.jsx("span",{className:"ds-dash-filter-name",children:_.machine_name||_.id}),e.jsx(se,{className:"h-3 w-3","aria-hidden":"true"})]}),O?e.jsxs("div",{className:v("ds-dash-search",T&&"ds-dash-search--folding"),onAnimationEnd:W,children:[e.jsx(ae,{className:"h-4 w-4 flex-shrink-0 text-text-muted","aria-hidden":"true"}),e.jsx("input",{autoFocus:!0,value:S,onChange:n=>s(n.target.value),onKeyDown:n=>{n.key==="Escape"&&$()},placeholder:t("dashboard.searchPlaceholder"),"aria-label":t("dashboard.searchPlaceholder"),className:"w-full min-w-0 bg-transparent text-sm text-text-primary placeholder:text-text-muted focus:outline-none"}),F&&e.jsx("span",{className:"flex-shrink-0 text-xs text-text-muted",children:t("dashboard.searching")}),e.jsx("button",{type:"button",onClick:$,className:"ds-dash-search-close",title:t("dashboard.closeSearch"),"aria-label":t("dashboard.closeSearch"),children:e.jsx(se,{className:"h-3.5 w-3.5"})})]}):e.jsx("button",{ref:P,type:"button",onClick:()=>h(!0),className:"ds-dash-search-toggle",title:t("dashboard.searchAction"),"aria-label":t("dashboard.searchAction"),children:e.jsx(ae,{className:"h-4 w-4"})})]}),e.jsx("button",{type:"button",onClick:()=>w(!0),className:"btn-quiet",children:t("dashboard.newSession")})]}),m!==null?e.jsxs("div",{className:"ds-reg",children:[m.length===0&&!F&&e.jsx("p",{className:"ds-reg-row ds-reg-empty text-sm text-text-muted",children:t("dashboard.searchNoResults")}),m.map(n=>e.jsxs("button",{type:"button",onClick:()=>c(n.session_id),className:"ds-reg-row w-full cursor-pointer",children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-sm font-medium text-text-primary",children:n.title||n.session_id}),n.snippet&&e.jsx("span",{className:"mt-1 line-clamp-2 block text-xs leading-relaxed text-text-muted",children:n.snippet})]}),e.jsx("span",{className:"whitespace-nowrap font-mono text-xs text-text-muted",children:n.match_count>0?X("dashboard.nMatches",{n:n.match_count}):t("dashboard.nameMatch")})]},n.session_id))]}):e.jsx(_e,{sessions:b,environments:o,onSelect:H,onDelete:z})]}),e.jsx(ke,{open:M,environments:o,initialEnvironmentId:x??void 0,onClose:()=>w(!1),onCreated:L})]})}export{Ae as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{b0 as v,_ as N,aX as t}from"./main-BkfSO2Rz.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function P({onSuccess:h,onInvalidInvite:i}){const{join:b}=v(),[l,f]=r.useState(""),[u,w]=r.useState(""),[o,j]=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):i()},[i]);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 b(l,u,o),h()}catch(a){const d=a instanceof Error?a.message:"Join failed";if(d.includes("Invalid invitation")||d.includes("expired")||d.includes("already used")){i();return}n(d)}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:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(N,{className:"brand-wordmark--auth mb-5"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.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:u,onChange:s=>w(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=>j(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||!l,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:x?t("common.loading"):t("auth.join.submit")})]})]})})}export{P as Join};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as a,j as e}from"./vendor-DE_-CLIE.js";import{aX as s,aY as b,b0 as N,_}from"./main-BkfSO2Rz.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function v(t){if(!(t instanceof Error))return s("auth.login.failed");if(t instanceof TypeError)return s("auth.login.unreachable");const i=t.message;return/failed to fetch|network|load failed/i.test(i)?s("auth.login.unreachable"):/csrf/i.test(i)?s("auth.login.csrfBlocked"):/too many/i.test(i)?s("auth.login.rateLimited"):/invalid credentials/i.test(i)?s("auth.login.failed"):!i||/^login failed$/i.test(i)?s("auth.login.failed"):b("auth.login.failedWithReason",{message:i})}function k({onSuccess:t,onNavigateRegister:i}){const{login:g,registrationAllowed:m,singleUserMode:h}=N(),[l,p]=a.useState(""),[r,f]=a.useState(""),[o,u]=a.useState(""),[c,d]=a.useState(!1),x=async n=>{n.preventDefault(),u(""),d(!0);try{await g(l,r),t()}catch(j){u(v(j))}finally{d(!1)}};return e.jsxs("div",{className:"login-split",children:[e.jsxs("aside",{className:"login-split__brand",children:[e.jsx(_,{className:"login-split__mark"}),e.jsxs("div",{children:[e.jsx("h1",{className:"login-split__title",children:s("auth.login.title")}),e.jsx("p",{className:"login-split__lede",children:s("auth.login.description")})]}),h&&e.jsxs("div",{className:"login-hint",children:[e.jsx("p",{children:s("auth.login.singleUserHint")}),e.jsx("p",{className:"login-hint__cred",children:"admin / admin123"}),e.jsx("p",{className:"login-hint__foot",children:s("auth.login.singleUserHintFooter")})]})]}),e.jsx("div",{className:"login-split__form",children:e.jsxs("div",{className:"login-split__inner",children:[e.jsxs("form",{onSubmit:x,className:"login-form",children:[e.jsxs("div",{className:"login-field",children:[e.jsx("label",{htmlFor:"login-username",className:"login-label",children:s("auth.login.username")}),e.jsx("input",{id:"login-username",type:"text",value:l,onChange:n=>p(n.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"login-input"})]}),e.jsxs("div",{className:"login-field",children:[e.jsx("label",{htmlFor:"login-password",className:"login-label",children:s("auth.login.password")}),e.jsx("input",{id:"login-password",type:"password",value:r,onChange:n=>f(n.target.value),required:!0,autoComplete:"current-password",className:"login-input"})]}),o&&e.jsx("p",{className:"login-error",children:o}),e.jsx("button",{type:"submit",disabled:c,className:"login-submit",children:c?s("common.loading"):s("auth.login.submit")})]}),m&&e.jsx("button",{type:"button",onClick:i,className:"login-register",children:s("auth.login.register")})]})})]})}export{k as Login};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{b1 as Y,b2 as B,aX as s,a4 as U,ai as J,ag as V,ah as W,ax as Z,aY as P,$ as ee,S as te}from"./main-BkfSO2Rz.js";import{D as O,u as se,e as ae,d as re,h as le,T as ne,c as oe,b as ce,a as ie,F as me,M as de}from"./MemoryTypeChips-DL1Uf2db.js";import{D as xe,a as ue,d as pe,e as he,c as fe}from"./dialog-8nXjsFEb.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";const ye=["user","feedback","project","reference"];function be({open:n,mode:c,onClose:d,onCreated:x}){Y();const{myTeams:o}=B(),[y,b]=r.useState(""),[h,N]=r.useState(""),[i,F]=r.useState("project"),[f,T]=r.useState(""),[l,m]=r.useState("personal"),[u,_]=r.useState(""),[C,j]=r.useState(!1),[S,g]=r.useState("");r.useEffect(()=>{var a;n&&(b(""),N(""),F("project"),T(""),m("personal"),_(((a=o[0])==null?void 0:a.id)??""),j(!1),g(""))},[n,o]);const w=y.trim().length>0&&f.trim().length>0&&!C&&(l==="personal"||c==="memdir"||!!u),L=async()=>{j(!0),g("");try{await U({scope:l,name:y.trim(),description:h.trim()||void 0,type:i,content:f,...c==="sqlite"&&l==="team"?{teamId:u}:{}}),x()}catch(a){g(a instanceof Error?a.message:s("memorySidebar.createFailed"))}finally{j(!1)}};return e.jsx(xe,{open:n,onOpenChange:a=>a?void 0:d(),children:e.jsxs(ue,{className:"max-h-[85vh] overflow-y-auto sm:max-w-2xl",children:[e.jsx(pe,{children:e.jsx(he,{children:s("memories.create.title")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"memory-create-name",children:s("memorySidebar.create.namePlaceholder")}),e.jsx("input",{id:"memory-create-name",type:"text",value:y,onChange:a=>b(a.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"memory-create-description",children:s("memorySidebar.create.descriptionPlaceholder")}),e.jsx("input",{id:"memory-create-description",type:"text",value:h,onChange:a=>N(a.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none"})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"memory-create-type",children:s("memories.create.type")}),e.jsx("select",{id:"memory-create-type",value:i,onChange:a=>F(a.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:ye.map(a=>e.jsx("option",{value:a,children:s(`memories.type.${a}`)},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"memory-create-scope",children:s("memories.create.scope")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{id:"memory-create-scope",value:l,onChange:a=>m(a.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"personal",children:s("memories.create.scope.personal")}),e.jsx("option",{value:"team",children:s("memories.scope.team")})]}),c==="sqlite"&&l==="team"&&e.jsxs("select",{value:u,onChange:a=>_(a.target.value),"aria-label":s("memories.scope.team"),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[o.length===0&&e.jsx("option",{value:"",children:"—"}),o.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"memory-create-content",children:s("memories.create.content")}),e.jsx("textarea",{id:"memory-create-content",value:f,onChange:a=>T(a.target.value),placeholder:s("memorySidebar.create.contentPlaceholder"),rows:10,spellCheck:!1,className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 font-mono text-xs text-text-primary focus:border-accent focus:outline-none"})]}),S&&e.jsx("p",{className:"text-sm text-status-error",children:S})]}),e.jsxs(fe,{children:[e.jsx("button",{type:"button",onClick:d,className:"rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:s("common.cancel")}),e.jsx("button",{type:"button",onClick:L,disabled:!w,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:C?"…":s("memories.create.title")})]})]})})}function je(){return e.jsx("div",{className:"space-y-3",children:[0,1,2].map(n=>e.jsx("div",{className:"h-20 animate-pulse rounded-lg bg-surface-2"},n))})}function K({options:n,value:c,onChange:d,disabled:x=!1}){return e.jsx("div",{className:`flex rounded-md bg-surface-2 p-0.5 text-xs ${x?"pointer-events-none opacity-40":""}`,children:n.map(o=>e.jsx("button",{type:"button",onClick:()=>d(o.value),className:`rounded px-2 py-0.5 transition-colors ${c===o.value?"bg-brand-light text-white":"text-text-muted hover:text-text-secondary"}`,children:o.label},String(o.value)))})}function ke(){Y();const[n,c]=r.useState(null),[d,x]=r.useState(0);return r.useEffect(()=>{J().then(c).catch(()=>c({mode:"sqlite"}))},[]),r.useEffect(()=>{const o=()=>x(y=>y+1);return window.addEventListener("focus",o),()=>window.removeEventListener("focus",o)},[]),n===null?e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx("div",{className:"ds-page",children:e.jsx(je,{})})}):e.jsx(ge,{mode:n.mode,status:n,refreshTick:d})}function ge({mode:n,status:c,refreshTick:d}){var I;const x=n==="sqlite",{myTeams:o}=B(),[y,b]=r.useState(!1),[h,N]=r.useState([]),[i,F]=r.useState("all"),[f,T]=r.useState("all"),[l,m]=r.useState(O),[u,_]=r.useState([]),[C,j]=r.useState(!0),[S,g]=r.useState(""),[w,L]=r.useState(""),[a,A]=r.useState(null),M=r.useRef(null),v=se(),$=r.useCallback(async()=>{j(!0),g("");try{const t=await V(f==="all"?void 0:f,i);_(t||[])}catch{g(s("memorySidebar.loadFailed"))}finally{j(!1)}},[i,f]);r.useEffect(()=>{W().then(N).catch(()=>N([]))},[d]),r.useEffect(()=>{$()},[$,d]),r.useEffect(()=>{M.current&&clearTimeout(M.current);const t=w.trim();if(!t){A(null);return}return M.current=setTimeout(()=>{Z(t,i).then(A).catch(()=>A([]))},300),()=>{M.current&&clearTimeout(M.current)}},[w,i]);const D=r.useMemo(()=>Object.fromEntries(h.map(t=>[t.key,t.shortName])),[h]),H=r.useMemo(()=>ae(u),[u]),Q=(I=h.find(t=>t.isCurrent))==null?void 0:I.key,k=r.useMemo(()=>re(u,l),[u,l]),R=r.useMemo(()=>new Set(k.map(t=>t.project).filter(Boolean)).size,[k]),E=a!==null,q=le(l),X=[{value:"all",label:s("memories.filter.scopeAll")},{value:"personal",label:s("memorySidebar.personal")},{value:"team",label:s("memorySidebar.team")}],z=ne.map(t=>({value:t.value,label:s(t.labelKey)}));return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"mem-page mx-auto flex min-h-0 w-full max-w-none flex-1 flex-col",children:[e.jsxs("header",{className:"ds-page-head ds-page-head--display hero-enter",children:[e.jsxs("div",{className:"ds-page-titlerow",children:[e.jsx("h1",{className:"ds-page-title font-display font-semibold tracking-tight text-text-primary",children:s("memories.title")}),e.jsx("button",{type:"button",onClick:()=>b(!0),className:"btn-quiet",children:s("memories.new")})]}),e.jsx("p",{className:"ds-page-sub",children:x?s("memories.subtitle"):s("memories.subtitleMemdir")})]}),e.jsxs("div",{className:"mem-gallery mem-gallery--display mem-gallery--bare hero-enter-late flex min-h-0 flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"mem-gallery__scope flex flex-wrap items-center gap-2",children:[h.length>0&&e.jsxs("select",{value:i,onChange:t=>F(t.target.value),className:"max-w-52 rounded-md border border-border bg-surface-2 px-2 py-1 text-xs text-text-primary focus:border-accent focus:outline-none",title:s("memories.filter.project"),"aria-label":s("memories.filter.project"),children:[e.jsx("option",{value:"all",children:s("memories.filter.projectAll")}),h.map(t=>e.jsxs("option",{value:t.key,children:[t.shortName,t.isCurrent?` · ${s("memories.filter.currentTag")}`:""]},t.key))]}),e.jsx(K,{options:X,value:f,onChange:T,disabled:E}),e.jsxs("span",{className:"ml-auto flex-shrink-0 font-mono text-[10px] text-text-muted",children:[P("memories.resultCount",{n:E?a.length:k.length}),i==="all"&&R>0?P("memories.resultProjects",{m:R}):""]})]}),e.jsxs("div",{className:`mem-gallery__filters flex flex-wrap items-center gap-x-3 gap-y-1.5 ${E?"pointer-events-none opacity-40":""}`,children:[e.jsx(oe,{filters:l,onChange:m}),e.jsx(ce,{filters:l,onChange:m,counts:H}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-text-muted",children:s("memories.filter.time")}),e.jsx(K,{options:z,value:l.days,onChange:t=>m(p=>({...p,days:t}))})]}),e.jsxs("div",{className:"flex min-w-32 flex-1 items-center gap-1.5",title:s("memories.filter.confidence"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:s("memories.filter.confidence")}),e.jsx("input",{type:"range",min:0,max:100,step:10,value:l.minConfidence*100,onChange:t=>m(p=>({...p,minConfidence:Number(t.target.value)/100})),style:{"--mem-pct":`${l.minConfidence*100}%`},className:"mem-slider min-w-16 flex-1"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${l.minConfidence>0?"text-brand-text":"text-text-muted"}`,children:P("memories.filter.minConfidence",{pct:l.minConfidence*100})})]}),e.jsxs("div",{className:"flex min-w-28 flex-1 items-center gap-1.5",title:s("memories.filter.access"),children:[e.jsx("span",{className:"flex-shrink-0 text-[10px] text-text-muted",children:s("memories.filter.access")}),e.jsx("input",{type:"range",min:0,max:10,step:1,value:l.minAccessCount,onChange:t=>m(p=>({...p,minAccessCount:Number(t.target.value)})),style:{"--mem-pct":`${l.minAccessCount*10}%`},className:"mem-slider min-w-12 flex-1"}),e.jsx("span",{className:`flex-shrink-0 font-mono text-[10px] ${l.minAccessCount>0?"text-brand-text":"text-text-muted"}`,children:P("memories.filter.minAccess",{n:l.minAccessCount})})]}),e.jsxs("button",{type:"button",onClick:()=>m(O),disabled:!q,className:"flex flex-shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] text-text-muted transition-colors hover:bg-surface-2 hover:text-text-primary disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-text-muted",title:s("memories.filter.clear"),children:[e.jsx(ee,{className:"h-3 w-3"}),s("memories.filter.clear")]})]}),e.jsxs("div",{className:"mem-gallery__search flex items-center gap-2",children:[e.jsx(te,{className:"h-3 w-3 flex-shrink-0 text-text-muted"}),e.jsx("input",{value:w,onChange:t=>L(t.target.value),placeholder:s("memorySidebar.searchPlaceholder"),title:s("memorySidebar.searchHint"),className:"w-full bg-transparent text-xs text-text-primary placeholder:text-text-muted focus:outline-none"})]}),S&&e.jsx("p",{className:"mem-gallery__error text-xs text-status-error",children:S}),E&&e.jsx("div",{className:"mem-gallery__results flex-1 overflow-y-auto",children:a.length===0?e.jsx("p",{className:"py-8 text-center text-xs text-text-muted",children:s("memorySidebar.noResults")}):e.jsx("ul",{className:"space-y-1.5",children:a.map(t=>e.jsxs("li",{children:[e.jsxs("button",{type:"button",onClick:()=>void v.toggleExpand(t),className:"w-full rounded-md px-2 py-1.5 text-left hover:bg-surface-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-xs font-medium text-text-primary",children:t.name}),e.jsx(ie,{layer:t.layer}),t.project&&e.jsx("span",{className:"max-w-24 flex-shrink-0 truncate rounded-full bg-surface-3 px-1.5 py-0.5 text-[10px] font-medium text-text-muted",title:t.project,children:D[t.project]??t.project.split("-").pop()}),t.teamName&&e.jsx("span",{className:"max-w-24 flex-shrink-0 truncate rounded-full bg-surface-3 px-1.5 py-0.5 text-[10px] font-medium text-text-muted",title:t.teamName,children:t.teamName})]}),e.jsx("ul",{className:"mt-0.5 space-y-0.5",children:t.matches.map((p,G)=>e.jsxs("li",{className:"flex gap-1.5 text-[10px] leading-relaxed",children:[e.jsx("span",{className:"flex-shrink-0 font-mono text-text-muted",children:p.line===0?"file":`L${p.line}`}),e.jsx("span",{className:"truncate text-text-secondary",children:p.text})]},G))})]}),v.expandedKey===(t.project?`${t.project}::${t.path}`:t.path)&&e.jsx("pre",{className:"mx-2 mt-1 max-h-48 overflow-y-auto whitespace-pre-wrap rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-secondary",children:v.fileContent[t.project?`${t.project}::${t.path}`:t.path]??"…"})]},`${t.project??""}::${t.path}`))})}),!E&&e.jsx("div",{className:"mem-gallery__results flex-1 overflow-y-auto",children:!C&&u.length>0&&k.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(me,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:s("memories.filter.empty")}),q?e.jsx("button",{type:"button",onClick:()=>m(O),className:"mt-2 rounded-md border border-border px-2.5 py-1 text-xs text-text-secondary hover:bg-surface-2",children:s("memories.filter.clear")}):e.jsx("p",{className:"mt-1 px-4 text-[10px] leading-relaxed text-text-muted",children:s("memories.filter.layersHidden")})]}):e.jsx(de,{files:k,isLoading:C,canManage:t=>!t.project||t.project===Q,teamEnabled:x||c.teamEnabled===!0,teams:x?o:void 0,showProject:i==="all",projectNames:D,onChanged:$,expandedKey:v.expandedKey,fileContent:v.fileContent,onToggleExpand:v.toggleExpand})})]})]}),e.jsx(be,{open:y,mode:n,onClose:()=>b(!1),onCreated:()=>{b(!1),$()}})]})}export{ke as MemoriesPage};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{aH as Y,af as L,aX as c,b1 as B,ar as A,B as H,P as z,Z as U,W as V,a8 as q,aD as W}from"./main-BkfSO2Rz.js";import{e as d,j as e}from"./vendor-DE_-CLIE.js";import{D as G,a as X,d as Z,e as J,c as Q}from"./dialog-8nXjsFEb.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 ee=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],xe=Y("funnel",ee),te=["user","feedback","project","reference"],C=["working","episodic","semantic","procedural"],pe=[{value:null,labelKey:"memories.filter.timeAll"},{value:7,labelKey:"memories.filter.time7d"},{value:30,labelKey:"memories.filter.time30d"},{value:90,labelKey:"memories.filter.time90d"}],M=["semantic","procedural"],ye={types:new Set,layers:new Set(M),days:null,minConfidence:0,minAccessCount:0};function se(t){return t.size!==M.length?!1:M.every(a=>t.has(a))}function he(t){return t.days!==null||t.minConfidence>0||t.minAccessCount>0||t.types.size>0||!se(t.layers)}function be(t,a){const r=a.days!==null?Date.now()-a.days*864e5:null;return t.filter(n=>!(a.types.size>0&&!a.types.has(n.type??"")||!a.layers.has(n.layer??"semantic")||r!==null&&n.mtimeMs<r||a.minConfidence>0&&(n.confidence??.5)<a.minConfidence||a.minAccessCount>0&&(n.accessCount??0)<a.minAccessCount))}function ae(t,a){const r=new Set(t.types);return r.has(a)?r.delete(a):r.add(a),{...t,types:r}}function re(t,a){const r=new Set(t.layers);return r.has(a)?r.delete(a):r.add(a),{...t,layers:r}}function fe(t){const a={};for(const r of t){const n=r.layer??"semantic";a[n]=(a[n]??0)+1}return a}function j(t){return t.project?`${t.project}::${t.path}`:t.path}function ge(){const[t,a]=d.useState(null),[r,n]=d.useState({});return{expandedKey:t,fileContent:r,setFileContent:n,toggleExpand:async m=>{const u=j(m);if(t===u){a(null);return}if(a(u),r[u]===void 0)try{const{content:o}=await L(m.path,m.project);n(h=>({...h,[u]:o}))}catch{n(o=>({...o,[u]:c("memorySidebar.loadFailed")}))}}}}function ne({memory:t,teams:a,onClose:r,onPromoted:n}){B();const[l,m]=d.useState(""),[u,o]=d.useState(!1),[h,y]=d.useState("");if(d.useEffect(()=>{var i;m(a.length===1?((i=a[0])==null?void 0:i.id)??"":""),y(""),o(!1)},[t,a]),!t)return null;const v=async()=>{if(!l){y(c("memories.promoteTeamRequired"));return}o(!0),y("");try{await A(t.path,l),n()}catch(i){y(i instanceof Error?i.message:c("memorySidebar.promoteFailed"))}finally{o(!1)}};return e.jsx(G,{open:!!t,onOpenChange:i=>i?void 0:r(),children:e.jsxs(X,{className:"sm:max-w-md",children:[e.jsx(Z,{children:e.jsx(J,{children:c("memorySidebar.promote")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-text-muted",children:t.name}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-primary",htmlFor:"promote-team",children:c("memories.scope.team")}),e.jsxs("select",{id:"promote-team",value:l,onChange:i=>m(i.target.value),className:"w-full rounded-md border border-border bg-surface-1 px-3 py-2 text-sm text-text-primary focus:border-accent focus:outline-none",children:[e.jsx("option",{value:"",children:"—"}),a.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]})]}),h&&e.jsx("p",{className:"text-sm text-status-error",children:h})]}),e.jsxs(Q,{children:[e.jsx("button",{type:"button",onClick:r,className:"rounded-md border border-border px-4 py-2 text-sm text-text-secondary hover:bg-surface-2",children:c("common.cancel")}),e.jsx("button",{type:"button",onClick:v,disabled:u,className:"rounded-md bg-accent px-4 py-2 text-sm font-medium text-white hover:bg-accent/90 disabled:opacity-50",children:u?"…":c("memorySidebar.promote")})]})]})})}const _={working:"bg-status-warning/20 text-status-warning ring-status-warning/40",episodic:"bg-text-secondary/15 text-text-secondary ring-text-secondary/30",semantic:"bg-brand/15 text-brand-text ring-brand/40",procedural:"bg-status-success/15 text-status-success ring-status-success/40"};function je({filters:t,onChange:a,counts:r}){return e.jsx("div",{className:"flex flex-wrap items-center gap-1","data-testid":"memory-layer-chips",children:C.map(n=>{const l=t.layers.has(n),m=r[n]??0,u=m===0&&!l;return e.jsxs("button",{type:"button",disabled:u,onClick:()=>a(re(t,n)),"aria-pressed":l,title:c(`memories.layer.${n}`),className:`rounded-full px-2 py-0.5 text-xs font-medium transition-colors ${l?_[n]:"bg-surface-2 text-text-muted hover:text-text-secondary ring-border ring-1"} ${u?"cursor-not-allowed opacity-40":""}`,children:[c(`memories.layer.${n}`),e.jsx("span",{className:"ml-1 font-mono text-[10px] opacity-70",children:m})]},n)})})}function ce({layer:t}){if(!t)return null;const a=C.indexOf(t);return a<0?null:e.jsxs("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[10px] font-medium ${_[t]}`,title:c(`memories.layer.${t}`),children:["L",a]})}function oe(t){switch(t){case"user":return"bg-accent/15 text-accent";case"feedback":return"bg-status-warning/15 text-status-warning";case"project":return"bg-status-active/15 text-status-active";default:return"bg-surface-3 text-text-muted"}}function ie(t){try{return new Date(t).toLocaleDateString()}catch{return"—"}}function ve({files:t,isLoading:a=!1,canManage:r,teamEnabled:n=!1,teams:l,showProject:m=!1,projectNames:u={},onChanged:o,expandedKey:h,fileContent:y,onToggleExpand:v}){const[i,f]=d.useState(null),[k,b]=d.useState(""),[F,N]=d.useState(""),[w,S]=d.useState(null);d.useEffect(()=>{i!==null&&!t.some(s=>j(s)===i)&&f(null)},[t,i]);const T=r??(()=>!0),$=s=>s.canManage??T(s),P=s=>{const x=j(s);f(x);const p=y[x];if(p!==void 0){b(p);return}b(""),L(s.path,s.project).then(({content:g})=>b(g)).catch(()=>b(""))},I=async s=>{try{await W(s.path,k),f(null),o==null||o()}catch{N(c("memorySidebar.updateFailed"))}},K=async s=>{try{await q(s.path),o==null||o()}catch{N(c("memorySidebar.deleteFailed"))}},R=async s=>{var x;if(l&&l.length>1){S(s);return}try{await A(s.path,(x=l==null?void 0:l[0])==null?void 0:x.id),o==null||o()}catch(p){N(p instanceof Error?p.message:c("memorySidebar.promoteFailed"))}};return a?e.jsx("div",{className:"space-y-2",children:[0,1,2].map(s=>e.jsx("div",{className:"h-12 animate-pulse rounded-md bg-surface-2"},s))}):t.length===0?e.jsxs("div",{className:"py-10 text-center",children:[e.jsx(H,{className:"mx-auto h-6 w-6 text-text-muted/40"}),e.jsx("p",{className:"mt-2 text-xs text-text-muted",children:c("memorySidebar.empty")})]}):e.jsxs("div",{children:[F&&e.jsx("p",{className:"px-1 pb-1 text-xs text-status-error",children:F}),e.jsx("ul",{className:"space-y-1",children:t.map(s=>{const x=j(s),p=h===x,g=p&&i===x,E=s.confidence??.5,D=s.accessCount??0;return e.jsxs("li",{className:"group rounded-md hover:bg-surface-2",children:[e.jsxs("button",{type:"button",onClick:()=>v(s),className:"w-full px-2 py-1.5 text-left",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-xs font-medium text-text-primary",children:s.name}),e.jsx(ce,{layer:s.layer}),s.type&&e.jsx("span",{className:`flex-shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium ${oe(s.type)}`,children:s.type}),s.teamName&&e.jsx("span",{className:"max-w-24 flex-shrink-0 truncate rounded-full bg-surface-3 px-1.5 py-0.5 text-[10px] font-medium text-text-muted",title:s.teamName,children:s.teamName}),D>0&&e.jsxs("span",{className:"flex-shrink-0 font-mono text-[10px] text-text-muted",title:c("memories.filter.access"),children:["×",D]}),m&&s.project&&e.jsx("span",{className:"max-w-24 flex-shrink-0 truncate rounded-full bg-surface-3 px-1.5 py-0.5 text-[10px] font-medium text-text-muted",title:s.project,children:u[s.project]??s.project.split("-").pop()??s.project}),e.jsxs("span",{className:`flex-shrink-0 font-mono text-[10px] ${E>=.8?"text-status-active":E>=.5?"text-text-muted":"text-status-warning"}`,title:c("memories.filter.confidence"),children:[Math.round(E*100),"%"]}),e.jsx("span",{className:"ml-auto flex-shrink-0 text-[10px] text-text-muted",children:ie(s.mtimeMs)})]}),s.description&&e.jsx("p",{className:"mt-0.5 truncate text-[10px] text-text-muted",children:s.description})]}),$(s)&&e.jsxs("div",{className:"flex items-center gap-0.5 px-2 pb-1 opacity-0 transition-opacity group-hover:opacity-100",children:[e.jsx("button",{type:"button",onClick:()=>P(s),className:"rounded p-1 text-text-secondary hover:bg-surface-3 hover:text-text-primary",title:c("memorySidebar.edit"),children:e.jsx(z,{className:"h-3 w-3"})}),s.scope==="personal"&&n&&s.layer!=="working"&&e.jsx("button",{type:"button",onClick:()=>void R(s),className:"rounded p-1 text-text-secondary hover:bg-surface-3 hover:text-text-primary",title:c("memorySidebar.promote"),children:e.jsx(U,{className:"h-3 w-3"})}),e.jsx("button",{type:"button",onClick:()=>void K(s),className:"ml-auto rounded p-1 text-text-secondary hover:bg-status-error/10 hover:text-status-error",title:c("memorySidebar.delete"),children:e.jsx(V,{className:"h-3 w-3"})})]}),p&&!g&&e.jsx("pre",{className:"mx-2 mb-2 max-h-48 overflow-y-auto whitespace-pre-wrap rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-secondary",children:y[x]??"…"}),g&&e.jsxs("div",{className:"mx-2 mb-2",children:[e.jsx("textarea",{value:k,onChange:O=>b(O.target.value),rows:8,className:"w-full rounded bg-surface-3 p-2 text-[10px] leading-relaxed text-text-primary focus:outline-none focus:ring-1 focus:ring-brand/40"}),e.jsxs("div",{className:"mt-1 flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void I(s),className:"rounded bg-accent px-2 py-0.5 text-[10px] font-medium text-white hover:bg-accent/90",children:c("memorySidebar.save")}),e.jsx("button",{type:"button",onClick:()=>f(null),className:"rounded px-2 py-0.5 text-[10px] text-text-muted hover:bg-surface-2",children:c("memorySidebar.cancel")})]})]})]},x)})}),e.jsx(ne,{memory:w?{path:w.path,name:w.name}:null,teams:l??[],onClose:()=>S(null),onPromoted:()=>{S(null),o==null||o()}})]})}const le={user:"bg-accent/20 text-accent ring-accent/40",feedback:"bg-status-warning/20 text-status-warning ring-status-warning/40",project:"bg-status-active/20 text-status-active ring-status-active/40",reference:"bg-brand/15 text-brand-text ring-brand/40"};function Ne({filters:t,onChange:a}){return e.jsx("div",{className:"flex flex-wrap items-center gap-1","data-testid":"memory-type-chips",children:te.map(r=>{const n=t.types.has(r);return e.jsx("button",{type:"button",onClick:()=>a(ae(t,r)),"aria-pressed":n,className:`rounded-full px-2 py-0.5 text-xs font-medium transition-colors ${n?le[r]:"bg-surface-2 text-text-muted hover:text-text-secondary ring-border ring-1"}`,title:c(`memories.type.${r}`),children:c(`memories.type.${r}`)},r)})})}export{ye as D,xe as F,ve as M,pe as T,ce as a,je as b,Ne as c,be as d,fe as e,he as h,se as i,ge as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as r,j as e}from"./vendor-DE_-CLIE.js";import{b0 as w,_ as y,aX as t}from"./main-BkfSO2Rz.js";import"./preload-helper-BiaRt2Oj.js";import"./motion-BILbV7YQ.js";function k({onSuccess:c,onBack:x}){const{register:h}=w(),[n,p]=r.useState(""),[a,b]=r.useState(""),[l,f]=r.useState(""),[d,o]=r.useState(""),[i,u]=r.useState(!1),g=async s=>{if(s.preventDefault(),o(""),a.length<8){o(t("auth.setup.passwordTooShort"));return}if(a!==l){o(t("auth.setup.passwordMismatch"));return}u(!0);try{await h(n,a),c()}catch(m){o(m instanceof Error?m.message:t("auth.register.failed"))}finally{u(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-surface-0 px-4",children:e.jsxs("div",{className:"hero-enter w-full max-w-sm space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(y,{className:"brand-wordmark--auth mb-5"}),e.jsx("h1",{className:"font-display text-3xl font-semibold tracking-tight text-text-primary",children:t("auth.register.title")}),e.jsx("p",{className:"mt-2 text-sm text-text-muted",children:t("auth.register.description")})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.username")}),e.jsx("input",{type:"text",value:n,onChange:s=>p(s.target.value),required:!0,autoComplete:"username",autoFocus:!0,className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.login.password")}),e.jsx("input",{type:"password",value:a,onChange:s=>b(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-text-secondary",children:t("auth.join.confirmPassword")}),e.jsx("input",{type:"password",value:l,onChange:s=>f(s.target.value),required:!0,autoComplete:"new-password",className:"w-full rounded-lg border border-border bg-surface-2 px-3 py-2 text-sm text-text-primary placeholder:text-text-muted focus:border-brand focus:outline-none"})]}),d&&e.jsx("p",{className:"text-sm text-status-error",children:d}),e.jsx("button",{type:"submit",disabled:i,className:"w-full rounded-lg bg-brand px-4 py-2.5 font-display text-sm font-medium text-white shadow-lg shadow-brand/25 transition-all hover:-translate-y-0.5 hover:bg-brand-light hover:shadow-brand/40 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:translate-y-0 disabled:hover:shadow-none",children:i?t("common.loading"):t("auth.register.submit")})]}),e.jsx("button",{type:"button",onClick:x,className:"w-full text-center text-sm text-text-muted hover:text-text-primary transition-colors",children:t("auth.register.backToLogin")})]})})}export{k as Register};
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import{j as e}from"./vendor-DE_-CLIE.js";import{
|
|
1
|
+
import{j as e}from"./vendor-DE_-CLIE.js";import{aH as t,i as d,h as l,aF as p,aX as h}from"./main-BkfSO2Rz.js";import{C as m,A as y}from"./workerType-CS6pd4nT.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const f=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],r=t("archive",f);/**
|
|
7
7
|
* @license lucide-react v0.555.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const k=[["
|
|
11
|
+
*/const k=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],x=t("triangle-alert",k);/**
|
|
12
12
|
* @license lucide-react v0.555.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const b=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],i=t("wifi-off",b);/**
|
|
17
17
|
* @license lucide-react v0.555.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
22
|
-
* @license lucide-react v0.555.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const g=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],j=a("wifi",g),v={running:{label:"running",Icon:y},active:{label:"active",Icon:j},idle:{label:"idle",Icon:d},disconnected:{label:"disconnected",Icon:i},offline:{label:"offline",Icon:i},inactive:{label:"inactive",Icon:s},archived:{label:"archived",Icon:s},error:{label:"error",Icon:x,tone:"text-status-error border-status-error/40"},requires_action:{label:"requires_action",Icon:u,tone:"text-status-warning border-status-warning/40"}};function w({status:t,className:n}){const{label:r,Icon:c,tone:o}=v[t]??{label:t,Icon:l,tone:void 0};return e.jsxs("span",{className:p("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs",o??"text-text-muted border-border/60",n),title:r,children:[e.jsx(c,{className:"h-3 w-3","aria-hidden":"true"}),r]})}function I({title:t,hint:n}){return e.jsx("div",{className:"ds-reg",children:e.jsxs("div",{className:"ds-reg-row ds-reg-empty",children:[e.jsxs("span",{className:"ds-reg-main",children:[e.jsx("span",{className:"ds-empty-title",children:t}),e.jsx("span",{className:"ds-reg-meta ds-empty-hint",children:n})]}),e.jsx("span",{className:"ds-reg-aside",children:e.jsx("span",{className:"ds-empty-marker",children:h("dashboard.emptyMarker")})})]})})}export{w as E,I as R};
|
|
21
|
+
*/const u=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],g=t("wifi",u),j={running:{label:"running",Icon:y},active:{label:"active",Icon:g},idle:{label:"idle",Icon:d},disconnected:{label:"disconnected",Icon:i},offline:{label:"offline",Icon:i},inactive:{label:"inactive",Icon:r},archived:{label:"archived",Icon:r},error:{label:"error",Icon:m,tone:"text-status-error border-status-error/40"},requires_action:{label:"requires_action",Icon:x,tone:"text-status-warning border-status-warning/40"}};function w({status:a,className:n}){const{label:s,Icon:c,tone:o}=j[a]??{label:a,Icon:l,tone:void 0};return e.jsxs("span",{className:p("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs",o??"text-text-muted border-border/60",n),title:s,children:[e.jsx(c,{className:"h-3 w-3","aria-hidden":"true"}),s]})}function I({title:a,hint:n}){return e.jsx("div",{className:"ds-reg",children:e.jsxs("div",{className:"ds-reg-row ds-reg-empty",children:[e.jsxs("span",{className:"ds-reg-main",children:[e.jsx("span",{className:"ds-empty-title",children:a}),e.jsx("span",{className:"ds-reg-meta ds-empty-hint",children:n})]}),e.jsx("span",{className:"ds-reg-aside",children:e.jsx("span",{className:"ds-empty-marker",children:h("dashboard.emptyMarker")})})]})})}export{w as E,I as R};
|