texlite 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +155 -17
- package/NPM_TESTING.md +46 -2
- package/OPERATIONS.md +136 -6
- package/README.md +1 -2
- package/README.zh-CN.md +2 -2
- package/THIRD_PARTY_NOTICES.md +12 -0
- package/dist/client/assets/AdminUsers-D4ljqr_D.js +1 -0
- package/dist/client/assets/AdminUsers-D4ljqr_D.js.br +0 -0
- package/dist/client/assets/AdminUsers-D4ljqr_D.js.gz +0 -0
- package/dist/client/assets/{AgentIcon-DJGGRJnV.css → AgentIcon-_B7xXJpJ.css} +1 -1
- package/dist/client/assets/AgentIcon-_B7xXJpJ.css.br +0 -0
- package/dist/client/assets/AgentIcon-_B7xXJpJ.css.gz +0 -0
- package/dist/client/assets/AgentManagement-DwRMP_nD.js +1 -0
- package/dist/client/assets/AgentManagement-DwRMP_nD.js.br +0 -0
- package/dist/client/assets/AgentManagement-DwRMP_nD.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-CSsr21PC.js +2 -0
- package/dist/client/assets/AgentTerminal-CSsr21PC.js.br +0 -0
- package/dist/client/assets/AgentTerminal-CSsr21PC.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-BLroKMGe.js +16 -0
- package/dist/client/assets/AgentTerminalSurface-BLroKMGe.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-BLroKMGe.js.gz +0 -0
- package/dist/client/assets/{AvatarSettingsDialog-ChKrdDqp.js → AvatarSettingsDialog-BgVGfSzn.js} +1 -1
- package/dist/client/assets/AvatarSettingsDialog-BgVGfSzn.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-BgVGfSzn.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-DLPom-qx.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-Cn-kFi8E.js +3 -0
- package/dist/client/assets/CitationLibraryDialog-Cn-kFi8E.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-Cn-kFi8E.js.gz +0 -0
- package/dist/client/assets/Dashboard-7JrR0t6C.js +5 -0
- package/dist/client/assets/Dashboard-7JrR0t6C.js.br +0 -0
- package/dist/client/assets/Dashboard-7JrR0t6C.js.gz +0 -0
- package/dist/client/assets/DrawioEditor-CYQnzKDd.js +1 -0
- package/dist/client/assets/DrawioEditor-CYQnzKDd.js.br +0 -0
- package/dist/client/assets/DrawioEditor-CYQnzKDd.js.gz +0 -0
- package/dist/client/assets/GitDialog-DMCVR8QK.js +4 -0
- package/dist/client/assets/GitDialog-DMCVR8QK.js.br +0 -0
- package/dist/client/assets/GitDialog-DMCVR8QK.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-BbJpR9Vq.js +1 -0
- package/dist/client/assets/GitHubAccountDialog-BbJpR9Vq.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-BbJpR9Vq.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-CcPWpTLn.js +8 -0
- package/dist/client/assets/HistoryDialog-CcPWpTLn.js.br +0 -0
- package/dist/client/assets/HistoryDialog-CcPWpTLn.js.gz +0 -0
- package/dist/client/assets/LatexEditor-D7C9jpJO.js +25 -0
- package/dist/client/assets/LatexEditor-D7C9jpJO.js.br +0 -0
- package/dist/client/assets/LatexEditor-D7C9jpJO.js.gz +0 -0
- package/dist/client/assets/{MarkdownPreview-BJPqGTcw.js → MarkdownPreview-Txs5upCY.js} +1 -1
- package/dist/client/assets/MarkdownPreview-Txs5upCY.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-Txs5upCY.js.gz +0 -0
- package/dist/client/assets/{ProjectIconPickerDialog-ChiEUQ0g.js → ProjectIconPickerDialog-CUlPlfmL.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-CUlPlfmL.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-CUlPlfmL.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-Bt6NyHIJ.js +1 -0
- package/dist/client/assets/ProjectSearchDialog-Bt6NyHIJ.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-Bt6NyHIJ.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-B6e7EAxq.js +4 -0
- package/dist/client/assets/ProjectSettings-B6e7EAxq.js.br +0 -0
- package/dist/client/assets/ProjectSettings-B6e7EAxq.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-D0EMITec.js +25 -0
- package/dist/client/assets/ProjectWorkspace-D0EMITec.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-D0EMITec.js.gz +0 -0
- package/dist/client/assets/{QuickOpenDialog-B7NTqOpu.js → QuickOpenDialog-D6yjnquG.js} +1 -1
- package/dist/client/assets/QuickOpenDialog-D6yjnquG.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-D6yjnquG.js.gz +0 -0
- package/dist/client/assets/ReadOnlySource-BOAnB5L0.js +2 -0
- package/dist/client/assets/SelectionHistoryDialog-D6ql9E0j.js +3 -0
- package/dist/client/assets/SelectionHistoryDialog-D6ql9E0j.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-D6ql9E0j.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-DuscqDx5.js +2 -0
- package/dist/client/assets/SharedProjectPage-DuscqDx5.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-DuscqDx5.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-KiKZOF2N.js +1 -0
- package/dist/client/assets/SystemMetricsDialog-KiKZOF2N.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-KiKZOF2N.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-BHbqvu3K.js +1 -0
- package/dist/client/assets/TagManagementDialog-BHbqvu3K.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BHbqvu3K.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-5cgNbWiG.js +1 -0
- package/dist/client/assets/{TikzGalleryDialog-CLAmKmS6.js → TikzGalleryDialog-CFbLjNTt.js} +1 -1
- package/dist/client/assets/TikzGalleryDialog-CFbLjNTt.js.br +0 -0
- package/dist/client/assets/TikzGalleryDialog-CFbLjNTt.js.gz +0 -0
- package/dist/client/assets/{WordCountDialog-ByxE-RUs.js → WordCountDialog-hXC-cpPs.js} +1 -1
- package/dist/client/assets/WordCountDialog-hXC-cpPs.js.br +0 -0
- package/dist/client/assets/WordCountDialog-hXC-cpPs.js.gz +0 -0
- package/dist/client/assets/{chktex-22lKGvKa.js → chktex-CLzMD_9a.js} +1 -1
- package/dist/client/assets/{citationLibrary-DxGdbZEQ.js → citationLibrary-BJRzAgaV.js} +1 -1
- package/dist/client/assets/citationLibrary-BJRzAgaV.js.br +0 -0
- package/dist/client/assets/citationLibrary-BJRzAgaV.js.gz +0 -0
- package/dist/client/assets/editor-CSq7NymY.js +14 -0
- package/dist/client/assets/editor-CSq7NymY.js.br +0 -0
- package/dist/client/assets/editor-CSq7NymY.js.gz +0 -0
- package/dist/client/assets/editor-languages-CKP1xVf6.js +36 -0
- package/dist/client/assets/editor-languages-CKP1xVf6.js.br +0 -0
- package/dist/client/assets/editor-languages-CKP1xVf6.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-CjBD77yn.js +1 -0
- package/dist/client/assets/editorThemeExtension-CjBD77yn.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-CjBD77yn.js.gz +0 -0
- package/dist/client/assets/file-cog-D_mhAnBe.js +1 -0
- package/dist/client/assets/file-down-DA4jGFrF.js +1 -0
- package/dist/client/assets/{generatedParser-CZa2vsK6.js → generatedParser-2izSCuvk.js} +1 -1
- package/dist/client/assets/generatedParser-2izSCuvk.js.br +0 -0
- package/dist/client/assets/generatedParser-2izSCuvk.js.gz +0 -0
- package/dist/client/assets/i18n-B8sR-BXw.js +13 -0
- package/dist/client/assets/i18n-B8sR-BXw.js.br +0 -0
- package/dist/client/assets/i18n-B8sR-BXw.js.gz +0 -0
- package/dist/client/assets/index-D6faTuJe.css +1 -0
- package/dist/client/assets/index-D6faTuJe.css.br +0 -0
- package/dist/client/assets/index-D6faTuJe.css.gz +0 -0
- package/dist/client/assets/index-dScQ5LCu.js +2 -0
- package/dist/client/assets/index-dScQ5LCu.js.br +0 -0
- package/dist/client/assets/index-dScQ5LCu.js.gz +0 -0
- package/dist/client/assets/relativeTime-zIVNCN0k.js +1 -0
- package/dist/client/assets/relativeTime-zIVNCN0k.js.br +0 -0
- package/dist/client/assets/relativeTime-zIVNCN0k.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-DWCXVKvp.js +2 -0
- package/dist/client/assets/sourceCursorStore-DWCXVKvp.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-DWCXVKvp.js.gz +0 -0
- package/dist/client/assets/{spellCheck-kxvnxrvw.js → spellCheck-DpyzDbmq.js} +1 -1
- package/dist/client/assets/spellCheck-DpyzDbmq.js.br +0 -0
- package/dist/client/assets/spellCheck-DpyzDbmq.js.gz +0 -0
- package/dist/client/assets/textLanguageSupport-tGXUsMU9.js +1 -0
- package/dist/client/assets/textLanguages-BpqiXyQi.js +78 -0
- package/dist/client/assets/textLanguages-BpqiXyQi.js.br +0 -0
- package/dist/client/assets/textLanguages-BpqiXyQi.js.gz +0 -0
- package/dist/client/assets/useDeletionTransitions-Bm4I5qej.js +1 -0
- package/dist/client/assets/useDeletionTransitions-Bm4I5qej.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-Bm4I5qej.js.gz +0 -0
- package/dist/client/assets/{vimSupport-C-WiMLjc.js → vimSupport-DMVGjr9R.js} +6 -6
- package/dist/client/assets/vimSupport-DMVGjr9R.js.br +0 -0
- package/dist/client/assets/vimSupport-DMVGjr9R.js.gz +0 -0
- package/dist/client/index.html +3 -4
- package/dist/server/agentChanges.js +95 -7
- package/dist/server/agents/adapters/claude.js +5 -2
- package/dist/server/agents/adapters/common.js +18 -5
- package/dist/server/agents/execution.js +25 -4
- package/dist/server/agents/launcher.js +5 -2
- package/dist/server/agents/outputBuffer.js +105 -0
- package/dist/server/agents/processIdentity.js +1 -1
- package/dist/server/agents/sessions.js +33 -16
- package/dist/server/agents/terminal.js +5 -2
- package/dist/server/agents/windowsJob.js +141 -0
- package/dist/server/app.js +24 -6
- package/dist/server/auth.js +3 -2
- package/dist/server/browserOrigin.js +15 -0
- package/dist/server/chktex.js +23 -11
- package/dist/server/collaboration.js +11 -1
- package/dist/server/compileDiagnostics.js +13 -9
- package/dist/server/compiler.js +70 -25
- package/dist/server/config.js +5 -1
- package/dist/server/db.js +68 -0
- package/dist/server/drawioLocks.js +114 -0
- package/dist/server/drawioOwnedBrowser.js +122 -0
- package/dist/server/drawioPdf.js +182 -0
- package/dist/server/editHistory.js +68 -20
- package/dist/server/environment.js +17 -8
- package/dist/server/files.js +86 -20
- package/dist/server/git.js +29 -23
- package/dist/server/harper.js +29 -10
- package/dist/server/history.js +220 -82
- package/dist/server/i18n.js +17 -0
- package/dist/server/index.js +15 -8
- package/dist/server/locales/zh-Hant.js +10 -0
- package/dist/server/pdfFonts.js +78 -0
- package/dist/server/pm2.js +2 -1
- package/dist/server/processTree.js +128 -7
- package/dist/server/projectDeletionCleanup.js +62 -0
- package/dist/server/projectMutations.js +7 -0
- package/dist/server/projectReplace.js +2 -2
- package/dist/server/projectSearch.js +2 -1
- package/dist/server/projectTemplateCache.js +94 -0
- package/dist/server/projectTemplateDownload.js +75 -0
- package/dist/server/projectTextSave.js +56 -0
- package/dist/server/routes/agents.js +2 -15
- package/dist/server/routes/comments.js +7 -2
- package/dist/server/routes/compile.js +67 -9
- package/dist/server/routes/drawio.js +192 -0
- package/dist/server/routes/projectFiles.js +160 -20
- package/dist/server/routes/projectGit.js +1 -1
- package/dist/server/routes/projectHistory.js +19 -5
- package/dist/server/routes/projects.js +81 -20
- package/dist/server/routes/users.js +10 -14
- package/dist/server/synctex.js +20 -3
- package/dist/server/texcount.js +27 -23
- package/dist/server/zip.js +37 -11
- package/dist/shared/agentMessages.js +3 -0
- package/dist/shared/drawio.js +79 -0
- package/dist/shared/fileTypes.js +1 -1
- package/dist/shared/pdfFonts.js +14 -0
- package/dist/shared/projectImport.js +21 -0
- package/package.json +3 -1
- package/dist/client/assets/AdminUsers-xuVuiwoh.js +0 -1
- package/dist/client/assets/AdminUsers-xuVuiwoh.js.br +0 -0
- package/dist/client/assets/AdminUsers-xuVuiwoh.js.gz +0 -0
- package/dist/client/assets/AgentIcon-DJGGRJnV.css.br +0 -0
- package/dist/client/assets/AgentIcon-DJGGRJnV.css.gz +0 -0
- package/dist/client/assets/AgentManagement-D-0hrv6f.js +0 -1
- package/dist/client/assets/AgentManagement-D-0hrv6f.js.br +0 -0
- package/dist/client/assets/AgentManagement-D-0hrv6f.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-DZo-22RN.js +0 -2
- package/dist/client/assets/AgentTerminal-DZo-22RN.js.br +0 -0
- package/dist/client/assets/AgentTerminal-DZo-22RN.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-CcC17_CY.js +0 -16
- package/dist/client/assets/AgentTerminalSurface-CcC17_CY.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-CcC17_CY.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-ChKrdDqp.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-ChKrdDqp.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-BZIU4Lif.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js +0 -3
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js.gz +0 -0
- package/dist/client/assets/Dashboard-BYgqCgBM.js +0 -5
- package/dist/client/assets/Dashboard-BYgqCgBM.js.br +0 -0
- package/dist/client/assets/Dashboard-BYgqCgBM.js.gz +0 -0
- package/dist/client/assets/GitDialog-CA68baSd.js +0 -4
- package/dist/client/assets/GitDialog-CA68baSd.js.br +0 -0
- package/dist/client/assets/GitDialog-CA68baSd.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-CnxfR0JD.js +0 -1
- package/dist/client/assets/GitHubAccountDialog-CnxfR0JD.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-CnxfR0JD.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-c2EEaFsl.js +0 -8
- package/dist/client/assets/HistoryDialog-c2EEaFsl.js.br +0 -0
- package/dist/client/assets/HistoryDialog-c2EEaFsl.js.gz +0 -0
- package/dist/client/assets/InfoPopover-BJYnFn1P.js +0 -1
- package/dist/client/assets/LatexEditor-vNOVTIl7.js +0 -25
- package/dist/client/assets/LatexEditor-vNOVTIl7.js.br +0 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js.gz +0 -0
- package/dist/client/assets/MarkdownPreview-BJPqGTcw.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-BJPqGTcw.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-ChiEUQ0g.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-ChiEUQ0g.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-DxgjbnmY.js +0 -1
- package/dist/client/assets/ProjectSearchDialog-DxgjbnmY.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-DxgjbnmY.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-BwQTbXhh.js +0 -4
- package/dist/client/assets/ProjectSettings-BwQTbXhh.js.br +0 -0
- package/dist/client/assets/ProjectSettings-BwQTbXhh.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-C2QAb-Fc.js +0 -25
- package/dist/client/assets/ProjectWorkspace-C2QAb-Fc.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-C2QAb-Fc.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-B7NTqOpu.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-B7NTqOpu.js.gz +0 -0
- package/dist/client/assets/ReadOnlySource-DIalHHvP.js +0 -2
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js +0 -3
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-s-khOyvB.js +0 -2
- package/dist/client/assets/SharedProjectPage-s-khOyvB.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-s-khOyvB.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-Bycm88U1.js +0 -1
- package/dist/client/assets/SystemMetricsDialog-Bycm88U1.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-Bycm88U1.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-DwUAA8uC.js +0 -1
- package/dist/client/assets/TagManagementDialog-DwUAA8uC.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-DwUAA8uC.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-RSqZi7kx.js +0 -1
- package/dist/client/assets/TikzGalleryDialog-CLAmKmS6.js.br +0 -0
- package/dist/client/assets/TikzGalleryDialog-CLAmKmS6.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-ByxE-RUs.js.br +0 -0
- package/dist/client/assets/WordCountDialog-ByxE-RUs.js.gz +0 -0
- package/dist/client/assets/citationLibrary-DxGdbZEQ.js.br +0 -0
- package/dist/client/assets/citationLibrary-DxGdbZEQ.js.gz +0 -0
- package/dist/client/assets/dist-DdUqlCPw.js +0 -1
- package/dist/client/assets/dist-DdUqlCPw.js.br +0 -0
- package/dist/client/assets/dist-DdUqlCPw.js.gz +0 -0
- package/dist/client/assets/editor-CkUEg2La.js +0 -14
- package/dist/client/assets/editor-CkUEg2La.js.br +0 -0
- package/dist/client/assets/editor-CkUEg2La.js.gz +0 -0
- package/dist/client/assets/editor-languages-kcWr1Z3Q.js +0 -36
- package/dist/client/assets/editor-languages-kcWr1Z3Q.js.br +0 -0
- package/dist/client/assets/editor-languages-kcWr1Z3Q.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-BWtZV1Af.js +0 -1
- package/dist/client/assets/editorThemeExtension-BWtZV1Af.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-BWtZV1Af.js.gz +0 -0
- package/dist/client/assets/generatedParser-CZa2vsK6.js.br +0 -0
- package/dist/client/assets/generatedParser-CZa2vsK6.js.gz +0 -0
- package/dist/client/assets/i18n-Wn96VbWM.js +0 -13
- package/dist/client/assets/i18n-Wn96VbWM.js.br +0 -0
- package/dist/client/assets/i18n-Wn96VbWM.js.gz +0 -0
- package/dist/client/assets/index-CemLYDYL.js +0 -2
- package/dist/client/assets/index-CemLYDYL.js.br +0 -0
- package/dist/client/assets/index-CemLYDYL.js.gz +0 -0
- package/dist/client/assets/index-DSF5eT29.css +0 -1
- package/dist/client/assets/index-DSF5eT29.css.br +0 -0
- package/dist/client/assets/index-DSF5eT29.css.gz +0 -0
- package/dist/client/assets/relativeTime-C-GTw3lA.js +0 -1
- package/dist/client/assets/relativeTime-C-GTw3lA.js.br +0 -0
- package/dist/client/assets/relativeTime-C-GTw3lA.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-Dpoi7PAL.js +0 -1
- package/dist/client/assets/sourceCursorStore-Dpoi7PAL.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-Dpoi7PAL.js.gz +0 -0
- package/dist/client/assets/spellCheck-kxvnxrvw.js.br +0 -0
- package/dist/client/assets/spellCheck-kxvnxrvw.js.gz +0 -0
- package/dist/client/assets/textLanguageSupport-Ck8lMOWz.js +0 -1
- package/dist/client/assets/textLanguages-CwWstpJ5.js +0 -78
- package/dist/client/assets/textLanguages-CwWstpJ5.js.br +0 -0
- package/dist/client/assets/textLanguages-CwWstpJ5.js.gz +0 -0
- package/dist/client/assets/useDeletionTransitions-Xlq7HabP.js +0 -1
- package/dist/client/assets/useDeletionTransitions-Xlq7HabP.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-Xlq7HabP.js.gz +0 -0
- package/dist/client/assets/vimSupport-C-WiMLjc.js.br +0 -0
- package/dist/client/assets/vimSupport-C-WiMLjc.js.gz +0 -0
- /package/dist/client/assets/{AgentIcon-qmglBc3M.js → AgentIcon-CjaO3WzI.js} +0 -0
- /package/dist/client/assets/{AgentIcon-qmglBc3M.js.br → AgentIcon-CjaO3WzI.js.br} +0 -0
- /package/dist/client/assets/{AgentIcon-qmglBc3M.js.gz → AgentIcon-CjaO3WzI.js.gz} +0 -0
package/dist/server/history.js
CHANGED
|
@@ -5,6 +5,12 @@ import { assertNoSourceSymlinks, listProjectFiles, outputRoot, projectRoot, reso
|
|
|
5
5
|
import { httpError } from "./http.js";
|
|
6
6
|
import { MAX_TEXT_PREVIEW_BYTES } from "./limits.js";
|
|
7
7
|
import { defaultHistoryTracking, historyTextCandidate, historyTrackingOverride } from "../shared/historyTracking.js";
|
|
8
|
+
/**
|
|
9
|
+
* Versions shown in the timeline and used as "previous" comparisons. Older
|
|
10
|
+
* settings-only rows are hidden; a settings-only safety checkpoint is shown.
|
|
11
|
+
*/
|
|
12
|
+
const VISIBLE_VERSION_SQL = "(json_array_length(%.changed_paths_json) > 0 OR %.reason = 'checkpoint')";
|
|
13
|
+
const visibleVersion = (alias) => VISIBLE_VERSION_SQL.replaceAll("%", alias);
|
|
8
14
|
const HOUR_MS = 60 * 60_000;
|
|
9
15
|
const DAY_MS = 24 * HOUR_MS;
|
|
10
16
|
/** Server-local hour or day, matching the local days the timeline is grouped by. */
|
|
@@ -19,18 +25,23 @@ const HISTORY_KEEP_ALL_MS = DAY_MS;
|
|
|
19
25
|
const HISTORY_KEEP_HOURLY_MS = 7 * DAY_MS;
|
|
20
26
|
/** Fixed window, from a run's first save, in which autosaves (or one user's agent writes) share a snapshot. */
|
|
21
27
|
const AUTOSAVE_COALESCE_MS = 2 * 60_000;
|
|
22
|
-
// Logical stored payload
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
// Logical stored payload: the UTF-8 bytes of a version row's text columns.
|
|
29
|
+
// SQLite pages, indexes and WAL are shared database overhead. octet_length()
|
|
30
|
+
// reads only the stored value sizes, never the manifests themselves.
|
|
31
|
+
const METADATA_BYTES_SQL = `(octet_length(id) + octet_length(project_id) + COALESCE(octet_length(author_id), 0)
|
|
32
|
+
+ octet_length(reason) + COALESCE(octet_length(label), 0) + octet_length(manifest_json)
|
|
33
|
+
+ octet_length(changed_paths_json) + octet_length(created_at))`;
|
|
26
34
|
const DEFAULT_HISTORY_PAGE_SIZE = 100;
|
|
27
35
|
const MAX_HISTORY_PAGE_SIZE = 100;
|
|
36
|
+
const restoreCleanupPattern = /^\.history-cleanup-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
|
|
28
37
|
export class ProjectHistoryService {
|
|
29
38
|
config;
|
|
30
39
|
db;
|
|
31
|
-
|
|
40
|
+
onRestoreCleanupError;
|
|
41
|
+
constructor(config, db, onRestoreCleanupError = () => undefined) {
|
|
32
42
|
this.config = config;
|
|
33
43
|
this.db = db;
|
|
44
|
+
this.onRestoreCleanupError = onRestoreCleanupError;
|
|
34
45
|
}
|
|
35
46
|
record(projectId, authorId, reason, changedRoots, options = {}) {
|
|
36
47
|
const project = this.project(projectId);
|
|
@@ -46,6 +57,17 @@ export class ProjectHistoryService {
|
|
|
46
57
|
const manifest = comparable ? cloneManifest(comparable) : this.emptyManifest(project);
|
|
47
58
|
manifest.tracking = tracking;
|
|
48
59
|
manifest.settings = settings(project);
|
|
60
|
+
// The baseline assembles the new manifest, because files outside the
|
|
61
|
+
// changed roots are copied from it. Changes are reported against the
|
|
62
|
+
// newest stored version instead: the two differ after that version was
|
|
63
|
+
// deleted, and the timeline must show what changed since the snapshot a
|
|
64
|
+
// user can still see and restore.
|
|
65
|
+
const latestManifest = previous ? parseManifest(previous.manifest_json) : null;
|
|
66
|
+
const reference = latestManifest
|
|
67
|
+
? JSON.stringify(latestManifest.tracking) === JSON.stringify(tracking)
|
|
68
|
+
? latestManifest
|
|
69
|
+
: { ...latestManifest, files: this.filterTrackedObjects(projectId, latestManifest.files, tracking) }
|
|
70
|
+
: comparable;
|
|
49
71
|
if (!previousManifest || policyChanged || changedRoots === undefined) {
|
|
50
72
|
manifest.files = this.snapshotAllFiles(projectId, tracking);
|
|
51
73
|
}
|
|
@@ -60,10 +82,11 @@ export class ProjectHistoryService {
|
|
|
60
82
|
manifest.files[filePath] = file;
|
|
61
83
|
}
|
|
62
84
|
}
|
|
63
|
-
const changedPaths =
|
|
85
|
+
const changedPaths = reference ? changedManifestPaths(reference, manifest) : Object.keys(manifest.files).sort();
|
|
86
|
+
const keepSettings = Boolean(options.keepSettingsChange && reference && !sameSettings(reference.settings, manifest.settings));
|
|
64
87
|
// Settings alone do not create a file-history entry. Keep the baseline
|
|
65
88
|
// current so the next real file change captures the effective settings.
|
|
66
|
-
if (changedPaths.length === 0) {
|
|
89
|
+
if (changedPaths.length === 0 && !keepSettings) {
|
|
67
90
|
this.saveBaseline(projectId, manifest);
|
|
68
91
|
return null;
|
|
69
92
|
}
|
|
@@ -80,7 +103,22 @@ export class ProjectHistoryService {
|
|
|
80
103
|
if (!policyChanged && sameRun && previous && !previous.label
|
|
81
104
|
&& JSON.stringify(parseManifest(previous.manifest_json).tracking) === JSON.stringify(tracking)
|
|
82
105
|
&& Date.parse(createdAt) - Date.parse(previous.created_at) < AUTOSAVE_COALESCE_MS) {
|
|
83
|
-
|
|
106
|
+
// Report the run's net change against the version before it, so a file
|
|
107
|
+
// edited and then changed back is not listed as changed.
|
|
108
|
+
const beforeRun = this.previousVersion(projectId, previous.id);
|
|
109
|
+
const beforeRunFiles = beforeRun ? this.manifest(projectId, beforeRun.id)?.files ?? {} : {};
|
|
110
|
+
const merged = [...new Set([...parseStringArray(previous.changed_paths_json), ...changedPaths])]
|
|
111
|
+
.filter((filePath) => beforeRunFiles[filePath]?.digest !== manifest.files[filePath]?.digest).sort();
|
|
112
|
+
const runDigests = new Set(Object.values(parseManifest(previous.manifest_json).files).map((file) => file.digest));
|
|
113
|
+
if (merged.length === 0) {
|
|
114
|
+
// The run left every file as the previous version had it, so it is
|
|
115
|
+
// not a restore point of its own.
|
|
116
|
+
this.db.prepare("DELETE FROM project_history_versions WHERE id = ? AND project_id = ?").run(previous.id, projectId);
|
|
117
|
+
this.saveBaseline(projectId, manifest);
|
|
118
|
+
if (!options.deferRetention)
|
|
119
|
+
this.removeUnreferencedObjects(projectId, runDigests);
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
84
122
|
this.db.prepare(`UPDATE project_history_versions
|
|
85
123
|
SET manifest_json = ?, changed_paths_json = ?, author_id = ? WHERE id = ?`)
|
|
86
124
|
.run(JSON.stringify(manifest), JSON.stringify(merged), previous.author_id === authorId ? authorId : null, previous.id);
|
|
@@ -106,7 +144,7 @@ export class ProjectHistoryService {
|
|
|
106
144
|
list(projectId, limit = 100) {
|
|
107
145
|
const rows = this.db.prepare(`SELECT history.*, user.username AS author_username, user.display_name AS author_name
|
|
108
146
|
FROM project_history_versions history LEFT JOIN users user ON user.id = history.author_id
|
|
109
|
-
WHERE history.project_id = ? AND
|
|
147
|
+
WHERE history.project_id = ? AND ${visibleVersion("history")}
|
|
110
148
|
ORDER BY history.created_at DESC, history.rowid DESC LIMIT ?`)
|
|
111
149
|
.all(projectId, Math.min(200, Math.max(1, limit)));
|
|
112
150
|
return rows.map((row) => versionJson(row));
|
|
@@ -161,7 +199,7 @@ export class ProjectHistoryService {
|
|
|
161
199
|
const rows = this.db.prepare(`SELECT history.*, history.rowid AS history_rowid,
|
|
162
200
|
user.username AS author_username, user.display_name AS author_name
|
|
163
201
|
FROM project_history_versions history LEFT JOIN users user ON user.id = history.author_id
|
|
164
|
-
WHERE history.project_id = ? AND
|
|
202
|
+
WHERE history.project_id = ? AND ${visibleVersion("history")} ${cursorFilter}
|
|
165
203
|
ORDER BY history.created_at DESC, history.rowid DESC LIMIT ?`)
|
|
166
204
|
.all(...values);
|
|
167
205
|
const pageRows = rows.slice(0, limitValue);
|
|
@@ -171,29 +209,32 @@ export class ProjectHistoryService {
|
|
|
171
209
|
};
|
|
172
210
|
}
|
|
173
211
|
stats(projectId) {
|
|
174
|
-
const rows = this.db.prepare(`SELECT
|
|
175
|
-
WHERE project_id = ? ORDER BY created_at DESC, rowid DESC`)
|
|
176
|
-
|
|
177
|
-
const protectedObjects = new Map();
|
|
212
|
+
const rows = this.db.prepare(`SELECT id, reason, label, ${METADATA_BYTES_SQL} AS metadata_bytes
|
|
213
|
+
FROM project_history_versions WHERE project_id = ? ORDER BY created_at DESC, rowid DESC`)
|
|
214
|
+
.all(projectId);
|
|
178
215
|
let metadataBytes = 0;
|
|
179
216
|
let protectedMetadataBytes = 0;
|
|
180
217
|
let ordinaryVersionCount = 0;
|
|
181
218
|
let labeledVersionCount = 0;
|
|
219
|
+
const protectedIds = [];
|
|
182
220
|
for (const row of rows) {
|
|
183
221
|
const protectedVersion = row === rows[0] || row.reason === "initial" || Boolean(row.label);
|
|
184
|
-
metadataBytes +=
|
|
185
|
-
if (protectedVersion)
|
|
186
|
-
protectedMetadataBytes +=
|
|
222
|
+
metadataBytes += row.metadata_bytes;
|
|
223
|
+
if (protectedVersion) {
|
|
224
|
+
protectedMetadataBytes += row.metadata_bytes;
|
|
225
|
+
protectedIds.push(row.id);
|
|
226
|
+
}
|
|
187
227
|
if (row.label)
|
|
188
228
|
labeledVersionCount += 1;
|
|
189
229
|
else if (row.reason !== "initial")
|
|
190
230
|
ordinaryVersionCount += 1;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
231
|
+
}
|
|
232
|
+
const objects = this.objectSizes(projectId);
|
|
233
|
+
const protectedObjects = new Map();
|
|
234
|
+
const versionObjects = this.db.prepare("SELECT digest, size FROM project_history_version_objects WHERE version_id = ?");
|
|
235
|
+
for (const id of protectedIds) {
|
|
236
|
+
for (const object of versionObjects.all(id))
|
|
237
|
+
protectedObjects.set(object.digest, object.size);
|
|
197
238
|
}
|
|
198
239
|
const baseline = this.baseline(projectId);
|
|
199
240
|
if (baseline) {
|
|
@@ -221,6 +262,12 @@ export class ProjectHistoryService {
|
|
|
221
262
|
storageLimitExceeded: objectBytes + metadataBytes > this.config.historyMaxStorageBytes
|
|
222
263
|
};
|
|
223
264
|
}
|
|
265
|
+
/** Each stored content object any version refers to, with its size. */
|
|
266
|
+
objectSizes(projectId) {
|
|
267
|
+
const rows = this.db.prepare("SELECT digest, size FROM project_history_objects WHERE project_id = ?")
|
|
268
|
+
.all(projectId);
|
|
269
|
+
return new Map(rows.map((row) => [row.digest, row.size]));
|
|
270
|
+
}
|
|
224
271
|
enforceRetention(projectId) {
|
|
225
272
|
this.pruneVersions(projectId);
|
|
226
273
|
// Deferred autosave maintenance can leave an object from a coalesced
|
|
@@ -230,7 +277,8 @@ export class ProjectHistoryService {
|
|
|
230
277
|
this.removeUnreferencedObjects(projectId, this.storedObjectDigests(projectId));
|
|
231
278
|
}
|
|
232
279
|
deleteVersion(projectId, versionId) {
|
|
233
|
-
const row = this.db.prepare(
|
|
280
|
+
const row = this.db.prepare(`SELECT id, manifest_json, changed_paths_json, created_at, rowid AS history_rowid
|
|
281
|
+
FROM project_history_versions WHERE id = ? AND project_id = ?`)
|
|
234
282
|
.get(versionId, projectId);
|
|
235
283
|
if (!row)
|
|
236
284
|
return false;
|
|
@@ -295,7 +343,7 @@ export class ProjectHistoryService {
|
|
|
295
343
|
previousVersion(projectId, versionId) {
|
|
296
344
|
const row = this.db.prepare(`SELECT older.id FROM project_history_versions older
|
|
297
345
|
JOIN project_history_versions selected ON selected.id = ? AND selected.project_id = older.project_id
|
|
298
|
-
WHERE older.project_id = ? AND
|
|
346
|
+
WHERE older.project_id = ? AND ${visibleVersion("older")}
|
|
299
347
|
AND (older.created_at < selected.created_at
|
|
300
348
|
OR (older.created_at = selected.created_at AND older.rowid < selected.rowid))
|
|
301
349
|
ORDER BY older.created_at DESC, older.rowid DESC LIMIT 1`).get(versionId, projectId);
|
|
@@ -357,8 +405,6 @@ export class ProjectHistoryService {
|
|
|
357
405
|
return { restoredPaths: [filePath], manifest };
|
|
358
406
|
}
|
|
359
407
|
this.restoreProjectTree(projectId, manifest);
|
|
360
|
-
this.db.prepare("UPDATE projects SET main_file = ?, engine = ?, latexmkrc = ?, chktex_enabled = ? WHERE id = ?")
|
|
361
|
-
.run(manifest.settings.mainFile, manifest.settings.engine, manifest.settings.latexmkrc, manifest.settings.chktexEnabled ? 1 : 0, projectId);
|
|
362
408
|
return { restoredPaths: Object.keys(manifest.files).sort(), manifest };
|
|
363
409
|
}
|
|
364
410
|
checkpointForRestore(projectId, authorId, versionId, filePathInput) {
|
|
@@ -378,7 +424,7 @@ export class ProjectHistoryService {
|
|
|
378
424
|
}
|
|
379
425
|
// This policy belongs only to the safety checkpoint, not project settings.
|
|
380
426
|
// Even a legacy restore or a single excluded file must remain reversible.
|
|
381
|
-
return this.record(projectId, authorId, "checkpoint", undefined, { tracking });
|
|
427
|
+
return this.record(projectId, authorId, "checkpoint", undefined, { tracking, keepSettingsChange: selected === null });
|
|
382
428
|
}
|
|
383
429
|
assertRestoreTargetIsFile(projectId, filePath) {
|
|
384
430
|
const target = resolveSourcePath(this.config, projectId, filePath);
|
|
@@ -536,23 +582,21 @@ export class ProjectHistoryService {
|
|
|
536
582
|
return digests;
|
|
537
583
|
}
|
|
538
584
|
pruneVersions(projectId) {
|
|
539
|
-
const rows = this.db.prepare(`SELECT
|
|
585
|
+
const rows = this.db.prepare(`SELECT id, reason, label, created_at, changed_paths_json, rowid AS history_rowid,
|
|
586
|
+
${METADATA_BYTES_SQL} AS metadata_bytes
|
|
540
587
|
FROM project_history_versions WHERE project_id = ?
|
|
541
588
|
ORDER BY created_at DESC, rowid DESC`).all(projectId);
|
|
542
589
|
if (!rows.length)
|
|
543
590
|
return;
|
|
544
|
-
//
|
|
545
|
-
|
|
591
|
+
// Reference counts are kept by the database for each stored content, so
|
|
592
|
+
// retention never parses manifests; a version's objects are read only if
|
|
593
|
+
// that version is removed.
|
|
546
594
|
const refCounts = new Map();
|
|
547
595
|
const sizeMap = new Map();
|
|
548
|
-
for (const row of
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
refCounts.set(file.digest, (refCounts.get(file.digest) ?? 0) + 1);
|
|
553
|
-
if (!sizeMap.has(file.digest))
|
|
554
|
-
sizeMap.set(file.digest, file.size);
|
|
555
|
-
}
|
|
596
|
+
for (const row of this.db.prepare("SELECT digest, refs, size FROM project_history_objects WHERE project_id = ?")
|
|
597
|
+
.all(projectId)) {
|
|
598
|
+
refCounts.set(row.digest, row.refs);
|
|
599
|
+
sizeMap.set(row.digest, row.size);
|
|
556
600
|
}
|
|
557
601
|
const baseline = this.baseline(projectId);
|
|
558
602
|
if (baseline) {
|
|
@@ -562,7 +606,7 @@ export class ProjectHistoryService {
|
|
|
562
606
|
sizeMap.set(file.digest, file.size);
|
|
563
607
|
}
|
|
564
608
|
}
|
|
565
|
-
let retainedBytes = rows.reduce((sum, row) => sum +
|
|
609
|
+
let retainedBytes = rows.reduce((sum, row) => sum + row.metadata_bytes, 0)
|
|
566
610
|
+ (baseline ? Buffer.byteLength(JSON.stringify(baseline), "utf8") : 0);
|
|
567
611
|
for (const [digest, count] of refCounts.entries()) {
|
|
568
612
|
if (count > 0)
|
|
@@ -571,32 +615,31 @@ export class ProjectHistoryService {
|
|
|
571
615
|
const latestId = rows[0]?.id;
|
|
572
616
|
// Ordinary versions eligible for version count capping (ordered newest to oldest)
|
|
573
617
|
const ordinaryDesc = rows.filter((row) => row.label === null && row.reason !== "initial");
|
|
618
|
+
const overVersionLimit = this.config.historyMaxVersions > 0 && ordinaryDesc.length > this.config.historyMaxVersions;
|
|
619
|
+
if (!overVersionLimit && retainedBytes <= this.config.historyMaxStorageBytes)
|
|
620
|
+
return;
|
|
574
621
|
const toDeleteIds = new Set();
|
|
575
622
|
const rowsById = new Map(rows.map((row) => [row.id, row]));
|
|
623
|
+
const versionObjects = this.db.prepare("SELECT digest FROM project_history_version_objects WHERE version_id = ?");
|
|
576
624
|
const removeVersionRefs = (versionId) => {
|
|
577
625
|
if (toDeleteIds.has(versionId))
|
|
578
626
|
return;
|
|
579
627
|
toDeleteIds.add(versionId);
|
|
580
|
-
retainedBytes -=
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
retainedBytes -= sizeMap.get(file.digest) ?? 0;
|
|
590
|
-
}
|
|
591
|
-
else if (count > 1) {
|
|
592
|
-
refCounts.set(file.digest, count - 1);
|
|
593
|
-
}
|
|
628
|
+
retainedBytes -= rowsById.get(versionId).metadata_bytes;
|
|
629
|
+
for (const { digest } of versionObjects.all(versionId)) {
|
|
630
|
+
const count = refCounts.get(digest);
|
|
631
|
+
if (count === 1) {
|
|
632
|
+
refCounts.set(digest, 0);
|
|
633
|
+
retainedBytes -= sizeMap.get(digest) ?? 0;
|
|
634
|
+
}
|
|
635
|
+
else if (count !== undefined && count > 1) {
|
|
636
|
+
refCounts.set(digest, count - 1);
|
|
594
637
|
}
|
|
595
638
|
}
|
|
596
639
|
};
|
|
597
640
|
// 1. Cap by historyMaxVersions (prune excess ordinary versions when configured; 0 = unlimited)
|
|
598
641
|
const remainingOrdinary = () => ordinaryDesc.filter((row) => !toDeleteIds.has(row.id));
|
|
599
|
-
if (
|
|
642
|
+
if (overVersionLimit) {
|
|
600
643
|
const obsolete = ordinaryDesc.slice(this.config.historyMaxVersions);
|
|
601
644
|
for (const row of obsolete)
|
|
602
645
|
removeVersionRefs(row.id);
|
|
@@ -644,6 +687,7 @@ export class ProjectHistoryService {
|
|
|
644
687
|
this.db.transaction(() => {
|
|
645
688
|
for (const id of toDeleteIds)
|
|
646
689
|
remove.run(id, projectId);
|
|
690
|
+
this.carryChangedPaths(projectId, rows.filter((row) => toDeleteIds.has(row.id)));
|
|
647
691
|
})();
|
|
648
692
|
// 5. Remove unreferenced CAS objects on disk
|
|
649
693
|
for (const [digest, count] of refCounts.entries()) {
|
|
@@ -660,44 +704,118 @@ export class ProjectHistoryService {
|
|
|
660
704
|
candidates.add(file.digest);
|
|
661
705
|
}
|
|
662
706
|
const remove = this.db.prepare("DELETE FROM project_history_versions WHERE id = ? AND project_id = ?");
|
|
663
|
-
this.db.transaction(() => {
|
|
664
|
-
|
|
707
|
+
this.db.transaction(() => {
|
|
708
|
+
for (const row of rows)
|
|
709
|
+
remove.run(row.id, projectId);
|
|
710
|
+
this.carryChangedPaths(projectId, rows);
|
|
711
|
+
})();
|
|
665
712
|
this.removeUnreferencedObjects(projectId, candidates);
|
|
666
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* Each version lists the files changed since the version before it. When
|
|
716
|
+
* versions are removed, the next remaining version is now compared with an
|
|
717
|
+
* older one, so it takes over the removed versions' changes. Only files that
|
|
718
|
+
* still differ from the new predecessor are kept.
|
|
719
|
+
*/
|
|
720
|
+
carryChangedPaths(projectId, removed) {
|
|
721
|
+
if (!removed.length)
|
|
722
|
+
return;
|
|
723
|
+
const order = (left, right) => left.created_at < right.created_at ? -1 : left.created_at > right.created_at ? 1 : left.history_rowid - right.history_rowid;
|
|
724
|
+
const pending = [...removed].sort(order);
|
|
725
|
+
const survivors = this.db.prepare(`SELECT id, rowid AS history_rowid, created_at, changed_paths_json
|
|
726
|
+
FROM project_history_versions history WHERE project_id = ? AND ${visibleVersion("history")}
|
|
727
|
+
ORDER BY created_at ASC, rowid ASC`).all(projectId);
|
|
728
|
+
const update = this.db.prepare("UPDATE project_history_versions SET changed_paths_json = ? WHERE id = ? AND project_id = ?");
|
|
729
|
+
let next = 0;
|
|
730
|
+
let previousId = null;
|
|
731
|
+
for (const survivor of survivors) {
|
|
732
|
+
const carried = new Set();
|
|
733
|
+
while (next < pending.length && order(pending[next], survivor) < 0) {
|
|
734
|
+
for (const filePath of parseStringArray(pending[next].changed_paths_json))
|
|
735
|
+
carried.add(filePath);
|
|
736
|
+
next += 1;
|
|
737
|
+
}
|
|
738
|
+
if (carried.size) {
|
|
739
|
+
const own = parseStringArray(survivor.changed_paths_json);
|
|
740
|
+
const files = this.manifest(projectId, survivor.id).files;
|
|
741
|
+
const before = previousId ? this.manifest(projectId, previousId).files : {};
|
|
742
|
+
const differing = [...new Set([...own, ...carried])].filter((filePath) => before[filePath]?.digest !== files[filePath]?.digest).sort();
|
|
743
|
+
// An identical version keeps its old list rather than vanishing from
|
|
744
|
+
// the timeline, which hides versions without changed files.
|
|
745
|
+
const combined = differing.length ? differing : [...own].sort();
|
|
746
|
+
if (JSON.stringify(combined) !== survivor.changed_paths_json)
|
|
747
|
+
update.run(JSON.stringify(combined), survivor.id, projectId);
|
|
748
|
+
}
|
|
749
|
+
previousId = survivor.id;
|
|
750
|
+
if (next >= pending.length)
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
667
754
|
removeUnreferencedObjects(projectId, candidates) {
|
|
668
755
|
if (!candidates.size)
|
|
669
756
|
return;
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
for (const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
757
|
+
const referenced = this.db.prepare("SELECT 1 FROM project_history_objects WHERE project_id = ? AND digest = ?");
|
|
758
|
+
const baselineDigests = new Set(Object.values(this.baseline(projectId)?.files ?? {}).map((file) => file.digest));
|
|
759
|
+
for (const digest of candidates) {
|
|
760
|
+
if (baselineDigests.has(digest) || referenced.get(projectId, digest))
|
|
761
|
+
continue;
|
|
762
|
+
fs.rmSync(this.objectPath(projectId, digest), { force: true });
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
/** Called at startup, before any restore can run. Unmarked backups may
|
|
766
|
+
* belong to an interrupted restore and must never be deleted here. */
|
|
767
|
+
pruneRestoreBackups(projectId) {
|
|
768
|
+
const root = projectRoot(this.config, projectId);
|
|
769
|
+
let entries;
|
|
770
|
+
try {
|
|
771
|
+
if (!fs.lstatSync(root).isDirectory())
|
|
676
772
|
return;
|
|
773
|
+
entries = fs.readdirSync(root, { withFileTypes: true });
|
|
677
774
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
775
|
+
catch (error) {
|
|
776
|
+
if (error.code !== "ENOENT")
|
|
777
|
+
this.onRestoreCleanupError(error, root);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
for (const entry of entries) {
|
|
781
|
+
if (entry.isDirectory() && restoreCleanupPattern.test(entry.name)) {
|
|
782
|
+
this.removeRestoreDirectory(path.join(root, entry.name));
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
removeRestoreDirectory(directory) {
|
|
787
|
+
try {
|
|
788
|
+
fs.rmSync(directory, { recursive: true, force: true });
|
|
789
|
+
}
|
|
790
|
+
catch (error) {
|
|
791
|
+
this.onRestoreCleanupError(error, directory);
|
|
682
792
|
}
|
|
683
|
-
for (const digest of candidates)
|
|
684
|
-
fs.rmSync(this.objectPath(projectId, digest), { force: true });
|
|
685
793
|
}
|
|
686
794
|
restoreProjectTree(projectId, manifest) {
|
|
687
795
|
assertNoSourceSymlinks(this.config, projectId);
|
|
688
796
|
const root = projectRoot(this.config, projectId);
|
|
689
797
|
const live = sourceRoot(this.config, projectId);
|
|
690
|
-
const
|
|
691
|
-
const
|
|
798
|
+
const restoreId = randomUUID();
|
|
799
|
+
const temporary = path.join(root, `.history-restore-${restoreId}`);
|
|
800
|
+
const backup = path.join(root, `.history-backup-${restoreId}`);
|
|
692
801
|
fs.mkdirSync(temporary, { recursive: true, mode: 0o700 });
|
|
693
802
|
let liveMoved = false;
|
|
694
803
|
let replacementInstalled = false;
|
|
695
804
|
let gitMoved = false;
|
|
696
805
|
try {
|
|
697
806
|
if (manifest.tracking) {
|
|
807
|
+
const entries = listProjectFiles(this.config, projectId);
|
|
808
|
+
// An empty folder holds nothing a snapshot records, so like other
|
|
809
|
+
// content outside the snapshot's scope it survives the restore.
|
|
810
|
+
const files = entries.filter((entry) => entry.type === "file").map((entry) => entry.path);
|
|
811
|
+
for (const folder of entries) {
|
|
812
|
+
if (folder.type !== "directory" || files.some((filePath) => filePath.startsWith(`${folder.path}/`)))
|
|
813
|
+
continue;
|
|
814
|
+
fs.mkdirSync(path.join(temporary, safeRelativePath(folder.path)), { recursive: true, mode: 0o700 });
|
|
815
|
+
}
|
|
698
816
|
// Files outside this snapshot's scope survive a project restore. Stage
|
|
699
817
|
// them before swapping trees so a copy/conflict failure is harmless.
|
|
700
|
-
for (const file of
|
|
818
|
+
for (const file of entries) {
|
|
701
819
|
if (file.type !== "file" || manifest.files[file.path])
|
|
702
820
|
continue;
|
|
703
821
|
const source = resolveSourcePath(this.config, projectId, file.path);
|
|
@@ -723,27 +841,47 @@ export class ProjectHistoryService {
|
|
|
723
841
|
fs.renameSync(git, path.join(live, ".git"));
|
|
724
842
|
gitMoved = true;
|
|
725
843
|
}
|
|
726
|
-
|
|
844
|
+
this.db.prepare("UPDATE projects SET main_file = ?, engine = ?, latexmkrc = ?, chktex_enabled = ? WHERE id = ?")
|
|
845
|
+
.run(manifest.settings.mainFile, manifest.settings.engine, manifest.settings.latexmkrc, manifest.settings.chktexEnabled ? 1 : 0, projectId);
|
|
727
846
|
}
|
|
728
847
|
catch (error) {
|
|
729
|
-
//
|
|
730
|
-
//
|
|
731
|
-
|
|
732
|
-
if (
|
|
733
|
-
|
|
848
|
+
// The backup is still intact. Swap the replacement out before deleting
|
|
849
|
+
// anything, so another cleanup failure cannot strand the live tree.
|
|
850
|
+
try {
|
|
851
|
+
if (replacementInstalled) {
|
|
852
|
+
if (gitMoved)
|
|
853
|
+
fs.renameSync(path.join(live, ".git"), path.join(backup, ".git"));
|
|
854
|
+
fs.renameSync(live, temporary);
|
|
734
855
|
}
|
|
735
|
-
|
|
856
|
+
if (liveMoved)
|
|
857
|
+
fs.renameSync(backup, live);
|
|
736
858
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
859
|
+
catch (rollbackError) {
|
|
860
|
+
throw new AggregateError([error, rollbackError], "Could not roll back project snapshot restore");
|
|
861
|
+
}
|
|
862
|
+
this.removeRestoreDirectory(temporary);
|
|
740
863
|
throw error;
|
|
741
864
|
}
|
|
865
|
+
// Both the source swap and the settings update succeeded. Mark this
|
|
866
|
+
// backup as disposable before attempting any non-atomic deletion.
|
|
867
|
+
const cleanup = path.join(root, `.history-cleanup-${restoreId}`);
|
|
868
|
+
try {
|
|
869
|
+
fs.renameSync(backup, cleanup);
|
|
870
|
+
}
|
|
871
|
+
catch (error) {
|
|
872
|
+
this.onRestoreCleanupError(error, backup);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
this.removeRestoreDirectory(cleanup);
|
|
742
876
|
}
|
|
743
877
|
}
|
|
744
878
|
function settings(project) {
|
|
745
879
|
return { mainFile: project.main_file, engine: project.engine, latexmkrc: project.latexmkrc, chktexEnabled: Boolean(project.chktex_enabled) };
|
|
746
880
|
}
|
|
881
|
+
function sameSettings(left, right) {
|
|
882
|
+
return left.mainFile === right.mainFile && left.engine === right.engine && left.latexmkrc === right.latexmkrc
|
|
883
|
+
&& Boolean(left.chktexEnabled) === Boolean(right.chktexEnabled);
|
|
884
|
+
}
|
|
747
885
|
function cloneManifest(manifest) {
|
|
748
886
|
return { ...manifest, files: { ...manifest.files }, settings: { ...manifest.settings } };
|
|
749
887
|
}
|
package/dist/server/i18n.js
CHANGED
|
@@ -10,7 +10,13 @@ import { suggestionMessages } from "../shared/suggestionMessages.js";
|
|
|
10
10
|
import { viewLinkMessages } from "../shared/projectViewLinks.js";
|
|
11
11
|
import { citationCollectionMessages } from "../shared/citationCollections.js";
|
|
12
12
|
import { projectSearchMessages } from "../shared/projectSearch.js";
|
|
13
|
+
import { projectImportMessages } from "../shared/projectImport.js";
|
|
14
|
+
import { pdfFontMessages } from "../shared/pdfFonts.js";
|
|
15
|
+
import { drawioMessages } from "../shared/drawio.js";
|
|
13
16
|
const enMessages = {
|
|
17
|
+
...drawioMessages.en.errors,
|
|
18
|
+
...pdfFontMessages.en,
|
|
19
|
+
...projectImportMessages.en,
|
|
14
20
|
...projectSearchMessages.en,
|
|
15
21
|
...citationCollectionMessages.en,
|
|
16
22
|
...viewLinkMessages.en,
|
|
@@ -39,6 +45,7 @@ const enMessages = {
|
|
|
39
45
|
CLIENT_UPDATE_REQUIRED: "This page is out of date. Save your changes and reload it to continue writing checks.",
|
|
40
46
|
COMMENT_DELETE_FORBIDDEN: "You can only delete your own comments.",
|
|
41
47
|
COMMENT_EDIT_FORBIDDEN: "You can only edit your own comments.",
|
|
48
|
+
COMMENT_RESOLVE_FORBIDDEN: "Only members who can edit this project can resolve or reopen comments.",
|
|
42
49
|
COMMENT_FILE_NOT_FOUND: "The file for this comment does not exist.",
|
|
43
50
|
COMMENT_NOT_FOUND: "The comment does not exist.",
|
|
44
51
|
COMMENT_RANGE_INVALID: "The comment source range is invalid.",
|
|
@@ -48,6 +55,7 @@ const enMessages = {
|
|
|
48
55
|
COMPILE_ARTIFACTS_NOT_FOUND: "No compiled artifacts are available yet.",
|
|
49
56
|
COMPILE_CLEAN_BUSY: "This root document is compiling. Try recovery again after it finishes.",
|
|
50
57
|
COMPILE_FORBIDDEN: "You do not have permission to compile this project.",
|
|
58
|
+
LATEX_ENGINE_UNAVAILABLE: "{{engine}} is unavailable on this server. Select another engine in LaTeX settings or ask an administrator to enable it.",
|
|
51
59
|
TIKZ_GALLERY_DISABLED: "The TikZ gallery is not enabled on this server.",
|
|
52
60
|
TIKZ_GALLERY_UNAVAILABLE: "The TikZ gallery add-on was not found on this server. Ask an administrator to install it.",
|
|
53
61
|
TIKZ_GALLERY_INCOMPATIBLE: "The installed TikZ gallery is not compatible with this version of TexLite. Ask an administrator to update it.",
|
|
@@ -100,6 +108,7 @@ const enMessages = {
|
|
|
100
108
|
OWNER_MEMBER_FORBIDDEN: "The project owner cannot be added as a member.",
|
|
101
109
|
PASSWORD_TOO_SHORT: "The password must contain at least {{minLength}} characters.",
|
|
102
110
|
PATH_EXISTS: "The destination path is already used by a file or folder.",
|
|
111
|
+
PROJECT_PATH_BUSY: "The file or folder may be in use or access was denied. Close it and try again.",
|
|
103
112
|
PATH_NOT_FOUND: "The file or folder does not exist.",
|
|
104
113
|
PDF_NOT_FOUND: "No PDF has been generated yet.",
|
|
105
114
|
PROJECT_BUSY: "The project is performing a source-file operation. Try again shortly.",
|
|
@@ -141,6 +150,7 @@ const enMessages = {
|
|
|
141
150
|
WORD_COUNT_SOURCE_TOO_LARGE: "The selected source is too large to count.",
|
|
142
151
|
WORD_COUNT_UNAVAILABLE: "The TeX Live texcount package is not installed on this server. Install it and try again.",
|
|
143
152
|
ZIP_DUPLICATE_ENTRY: "The ZIP archive contains a duplicate filename: {{path}}.",
|
|
153
|
+
ZIP_PATH_CONFLICT: "The ZIP archive contains conflicting Windows paths: {{path}}.",
|
|
144
154
|
ZIP_ENTRY_READ_FAILED: "A ZIP archive entry could not be read.",
|
|
145
155
|
ZIP_ENTRY_TOO_LARGE: "The ZIP archive contains a file that exceeds the permitted size.",
|
|
146
156
|
ZIP_INVALID: "The ZIP archive could not be imported.",
|
|
@@ -164,6 +174,9 @@ const enMessages = {
|
|
|
164
174
|
GIT_OPERATION_FAILED: "The Git operation could not be completed."
|
|
165
175
|
};
|
|
166
176
|
const zhMessages = {
|
|
177
|
+
...drawioMessages.zh.errors,
|
|
178
|
+
...pdfFontMessages.zh,
|
|
179
|
+
...projectImportMessages.zh,
|
|
167
180
|
...viewLinkMessages.zh,
|
|
168
181
|
...projectSearchMessages.zh,
|
|
169
182
|
...citationCollectionMessages.zh,
|
|
@@ -192,6 +205,7 @@ const zhMessages = {
|
|
|
192
205
|
CLIENT_UPDATE_REQUIRED: "当前页面版本过旧。请先保存修改,再刷新页面以继续写作检查。",
|
|
193
206
|
COMMENT_DELETE_FORBIDDEN: "只能删除自己的批注。",
|
|
194
207
|
COMMENT_EDIT_FORBIDDEN: "只能编辑自己的批注。",
|
|
208
|
+
COMMENT_RESOLVE_FORBIDDEN: "只有可以编辑此项目的成员才能解决或重新打开批注。",
|
|
195
209
|
COMMENT_FILE_NOT_FOUND: "批注对应的文件不存在。",
|
|
196
210
|
COMMENT_NOT_FOUND: "批注不存在。",
|
|
197
211
|
COMMENT_RANGE_INVALID: "批注的源码区间无效。",
|
|
@@ -201,6 +215,7 @@ const zhMessages = {
|
|
|
201
215
|
COMPILE_ARTIFACTS_NOT_FOUND: "尚无可用的编译产物。",
|
|
202
216
|
COMPILE_CLEAN_BUSY: "当前主文档正在编译,请完成后再执行故障恢复。",
|
|
203
217
|
COMPILE_FORBIDDEN: "你没有编译此项目的权限。",
|
|
218
|
+
LATEX_ENGINE_UNAVAILABLE: "此服务器上的 {{engine}} 不可用。请在 LaTeX 设置中切换引擎,或联系管理员启用。",
|
|
204
219
|
TIKZ_GALLERY_DISABLED: "此服务器未启用 TikZ 图库。",
|
|
205
220
|
TIKZ_GALLERY_UNAVAILABLE: "此服务器上找不到 TikZ 图库插件,请联系管理员安装。",
|
|
206
221
|
TIKZ_GALLERY_INCOMPATIBLE: "已安装的 TikZ 图库与当前 TexLite 版本不兼容,请联系管理员更新。",
|
|
@@ -253,6 +268,7 @@ const zhMessages = {
|
|
|
253
268
|
OWNER_MEMBER_FORBIDDEN: "项目所有者不能作为成员添加。",
|
|
254
269
|
PASSWORD_TOO_SHORT: "密码至少需要 {{minLength}} 个字符。",
|
|
255
270
|
PATH_EXISTS: "目标路径已被文件或文件夹占用。",
|
|
271
|
+
PROJECT_PATH_BUSY: "文件或文件夹可能正在使用,或无法访问。请关闭后重试。",
|
|
256
272
|
PATH_NOT_FOUND: "文件或文件夹不存在。",
|
|
257
273
|
PDF_NOT_FOUND: "尚未生成 PDF。",
|
|
258
274
|
PROJECT_BUSY: "项目正在执行源文件操作,请稍后重试。",
|
|
@@ -294,6 +310,7 @@ const zhMessages = {
|
|
|
294
310
|
WORD_COUNT_SOURCE_TOO_LARGE: "所选源码过大,无法统计。",
|
|
295
311
|
WORD_COUNT_UNAVAILABLE: "服务器未安装 TeX Live 的 texcount 包,请安装后重试。",
|
|
296
312
|
ZIP_DUPLICATE_ENTRY: "ZIP 压缩包包含重复文件名:{{path}}。",
|
|
313
|
+
ZIP_PATH_CONFLICT: "ZIP 压缩包中的路径在 Windows 上发生冲突:{{path}}。",
|
|
297
314
|
ZIP_ENTRY_READ_FAILED: "无法读取 ZIP 压缩包中的文件。",
|
|
298
315
|
ZIP_ENTRY_TOO_LARGE: "ZIP 压缩包中存在超过限制的文件。",
|
|
299
316
|
ZIP_INVALID: "无法导入 ZIP 压缩包。",
|
package/dist/server/index.js
CHANGED
|
@@ -66,17 +66,24 @@ export async function startServer(configPath) {
|
|
|
66
66
|
}
|
|
67
67
|
export async function serve(configPath) {
|
|
68
68
|
const running = await startServer(configPath);
|
|
69
|
+
const windowsIpc = process.platform === "win32" && Boolean(process.send);
|
|
69
70
|
let closed = false;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
await new Promise((resolve, reject) => {
|
|
72
|
+
const complete = () => {
|
|
73
|
+
if (closed)
|
|
74
|
+
return;
|
|
75
|
+
closed = true;
|
|
76
|
+
if (windowsIpc)
|
|
77
|
+
process.off("message", onMessage);
|
|
78
|
+
void running.close().then(resolve, reject);
|
|
79
|
+
};
|
|
80
|
+
const onMessage = (message) => { if (message === "shutdown")
|
|
81
|
+
complete(); };
|
|
78
82
|
process.once("SIGINT", complete);
|
|
79
83
|
process.once("SIGTERM", complete);
|
|
84
|
+
// PM2 cannot deliver a graceful POSIX signal on native Windows.
|
|
85
|
+
if (windowsIpc)
|
|
86
|
+
process.on("message", onMessage);
|
|
80
87
|
});
|
|
81
88
|
}
|
|
82
89
|
export async function main() {
|