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/chktex.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import { detachedProcessGroup,
|
|
3
|
+
import { afterProcessStop, detachedProcessGroup, stopProcessTree } from "./processTree.js";
|
|
4
4
|
const commandProbeTimeoutMs = 5_000;
|
|
5
5
|
const checkTimeoutMs = 5_000;
|
|
6
6
|
const maxOutputBytes = 2 * 1024 * 1024;
|
|
@@ -151,8 +151,12 @@ export class ChktexService {
|
|
|
151
151
|
}
|
|
152
152
|
this.waitingByLane.clear();
|
|
153
153
|
this.latestSequenceByLane.clear();
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
const children = [...this.activeChildren];
|
|
155
|
+
if (process.platform === "win32")
|
|
156
|
+
await Promise.allSettled(children.map((child) => stopProcessTree(child)));
|
|
157
|
+
else
|
|
158
|
+
for (const child of children)
|
|
159
|
+
void stopProcessTree(child, "SIGTERM");
|
|
156
160
|
await Promise.allSettled([...this.activeOperations]);
|
|
157
161
|
await this.probePromise?.catch(() => undefined);
|
|
158
162
|
this.inFlight.clear();
|
|
@@ -331,6 +335,7 @@ export class ChktexService {
|
|
|
331
335
|
let outputBytes = 0;
|
|
332
336
|
let settled = false;
|
|
333
337
|
let timedOut = false;
|
|
338
|
+
let terminationError;
|
|
334
339
|
const finish = (callback) => {
|
|
335
340
|
if (settled)
|
|
336
341
|
return;
|
|
@@ -340,12 +345,14 @@ export class ChktexService {
|
|
|
340
345
|
callback();
|
|
341
346
|
};
|
|
342
347
|
const terminate = (error) => {
|
|
343
|
-
|
|
344
|
-
|
|
348
|
+
if (terminationError || settled)
|
|
349
|
+
return;
|
|
350
|
+
terminationError = error;
|
|
351
|
+
void stopProcessTree(child).then(() => finish(() => reject(error)), (failure) => finish(() => reject(failure)));
|
|
345
352
|
};
|
|
346
353
|
const timer = setTimeout(() => {
|
|
347
354
|
timedOut = true;
|
|
348
|
-
|
|
355
|
+
void stopProcessTree(child).catch((error) => finish(() => reject(error)));
|
|
349
356
|
}, timeoutMs);
|
|
350
357
|
const collect = (target) => (chunk) => {
|
|
351
358
|
outputBytes += chunk.length;
|
|
@@ -365,11 +372,16 @@ export class ChktexService {
|
|
|
365
372
|
return reject(new ChktexUnavailableError(`The optional ${this.command} command is not available.`));
|
|
366
373
|
reject(error);
|
|
367
374
|
}));
|
|
368
|
-
child.once("close", (code) =>
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
375
|
+
child.once("close", (code) => {
|
|
376
|
+
clearTimeout(timer);
|
|
377
|
+
afterProcessStop(child, () => finish(() => {
|
|
378
|
+
if (terminationError)
|
|
379
|
+
return reject(terminationError);
|
|
380
|
+
if (timedOut)
|
|
381
|
+
return reject(new Error(`${this.command} timed out after ${Math.ceil(timeoutMs / 1000)} seconds.`));
|
|
382
|
+
resolve({ code, stdout: Buffer.concat(stdout).toString("utf8"), stderr: Buffer.concat(stderr).toString("utf8") });
|
|
383
|
+
}), (error) => finish(() => reject(error)));
|
|
384
|
+
});
|
|
373
385
|
child.stdin?.end(input);
|
|
374
386
|
});
|
|
375
387
|
}
|
|
@@ -16,6 +16,7 @@ import { finishSuggestionApplications, hasPendingSuggestionApplication, prepareS
|
|
|
16
16
|
import { httpError, SourceFlushError } from "./http.js";
|
|
17
17
|
import { createEditHistorySpan, hashText } from "./editHistory.js";
|
|
18
18
|
import { isEditableTextFile, isTextContent, MAX_TEXT_EDITOR_BYTES } from "../shared/fileTypes.js";
|
|
19
|
+
import { isDrawioFile } from "../shared/drawio.js";
|
|
19
20
|
import { COLLABORATION_PROTOCOL_VERSION, CollaborationMessageType, isCollaborationCleanMode, isCollaborationCompileStatus } from "../shared/collaborationProtocol.js";
|
|
20
21
|
export { COLLABORATION_PROTOCOL_VERSION } from "../shared/collaborationProtocol.js";
|
|
21
22
|
const { Sync: MESSAGE_SYNC, Awareness: MESSAGE_AWARENESS, QueryAwareness: MESSAGE_QUERY_AWARENESS, Flush: MESSAGE_FLUSH, Protocol: MESSAGE_PROTOCOL, Maintenance: MESSAGE_MAINTENANCE, Permission: MESSAGE_PERMISSION, CompileStates: MESSAGE_COMPILE_STATES, FormatLease: MESSAGE_FORMAT_LEASE } = CollaborationMessageType;
|
|
@@ -223,6 +224,10 @@ export class CollaborationService {
|
|
|
223
224
|
return () => { if (this.externalSources.get(projectId) === observer)
|
|
224
225
|
this.externalSources.delete(projectId); };
|
|
225
226
|
}
|
|
227
|
+
/** Pull an active external writer's newest disk edits for these files into the room now. */
|
|
228
|
+
reconcileExternalSources(projectId, paths) {
|
|
229
|
+
this.externalSources.get(projectId)?.beforeFlush(paths);
|
|
230
|
+
}
|
|
226
231
|
/** Apply disk edits as a real attributed Yjs delta, retaining pending human edits and anchors. */
|
|
227
232
|
/** `agent` marks text written by a coding agent on behalf of `userId`; it is recorded in edit history. */
|
|
228
233
|
importExternalText(projectId, filePath, content, userId, { agent = false } = {}) {
|
|
@@ -844,6 +849,7 @@ export class CollaborationService {
|
|
|
844
849
|
textObservers: new Map(),
|
|
845
850
|
saveTimer: null,
|
|
846
851
|
stateSaveTimer: null,
|
|
852
|
+
stateDirty: true,
|
|
847
853
|
cleanupTimer: null,
|
|
848
854
|
lastModifiedUserId: null,
|
|
849
855
|
epoch: bootstrap.epoch,
|
|
@@ -1515,6 +1521,7 @@ export class CollaborationService {
|
|
|
1515
1521
|
}, SAVE_DELAY_MS);
|
|
1516
1522
|
}
|
|
1517
1523
|
scheduleStateSave(room) {
|
|
1524
|
+
room.stateDirty = true;
|
|
1518
1525
|
if (room.stateSaveTimer)
|
|
1519
1526
|
clearTimeout(room.stateSaveTimer);
|
|
1520
1527
|
room.stateSaveTimer = setTimeout(() => {
|
|
@@ -1531,11 +1538,14 @@ export class CollaborationService {
|
|
|
1531
1538
|
clearTimeout(room.stateSaveTimer);
|
|
1532
1539
|
room.stateSaveTimer = null;
|
|
1533
1540
|
this.rejectOversizedTexts(room);
|
|
1541
|
+
if (!room.stateDirty)
|
|
1542
|
+
return;
|
|
1534
1543
|
const target = collaborationStatePath(this.config, room.projectId);
|
|
1535
1544
|
const temporary = `${target}.tmp`;
|
|
1536
1545
|
fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
|
|
1537
1546
|
fs.writeFileSync(temporary, Y.encodeStateAsUpdate(room.doc), { mode: 0o600 });
|
|
1538
1547
|
fs.renameSync(temporary, target);
|
|
1548
|
+
room.stateDirty = false;
|
|
1539
1549
|
}
|
|
1540
1550
|
flushRoom(room) {
|
|
1541
1551
|
if (room.snapshotBarrierDepth > 0 || (this.snapshotBarriers.get(room.projectId) ?? 0) > 0) {
|
|
@@ -1793,7 +1803,7 @@ export function maxCollaborativeFileBytes(config) {
|
|
|
1793
1803
|
return Math.min(config.maxUploadBytes, MAX_COLLABORATIVE_FILE_BYTES);
|
|
1794
1804
|
}
|
|
1795
1805
|
export function isCollaborativeTextFile(filePath) {
|
|
1796
|
-
return isEditableTextFile(filePath);
|
|
1806
|
+
return isEditableTextFile(filePath) && !isDrawioFile(filePath);
|
|
1797
1807
|
}
|
|
1798
1808
|
function collaborativeEntrySignature(entry) {
|
|
1799
1809
|
return `${entry.path}\0${entry.size ?? 0}\0${entry.mtimeMs ?? 0}`;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* still retained separately for users who need all details.
|
|
9
9
|
*/
|
|
10
10
|
const commandPattern = /\b(pdflatex|xelatex|lualatex|bibtex|biber)\b/i;
|
|
11
|
-
const locationPattern = /^(?<file>[^:\n]+):(?<line>\d+)(?::(?<column>\d+))?:\s*(?<rest>.*)$/;
|
|
11
|
+
const locationPattern = /^(?<file>(?:[A-Za-z]:[\\/])?[^:\r\n]+):(?<line>\d+)(?::(?<column>\d+))?:\s*(?<rest>.*)$/;
|
|
12
12
|
const inputLinePattern = /\bon input line (?<line>\d+)\b/i;
|
|
13
13
|
const latexLinePattern = /^l\.(?<line>\d+)\b/;
|
|
14
14
|
export function parseCompileDiagnostics(log, outcome = null) {
|
|
@@ -38,15 +38,18 @@ export function parseCompileDiagnostics(log, outcome = null) {
|
|
|
38
38
|
phase = "latexmk";
|
|
39
39
|
const located = parseLocatedLine(line);
|
|
40
40
|
if (located) {
|
|
41
|
-
currentFile = located.file
|
|
42
|
-
|
|
41
|
+
currentFile = located.file;
|
|
42
|
+
// With -file-line-error, TeX errors such as "Undefined control sequence."
|
|
43
|
+
// have a location but no Error: prefix. Infer severity only on a failed pass.
|
|
44
|
+
const severity = located.severity ?? (resolvedOutcome === "failed" && isLatexPhase(phase) && /\.[a-z0-9]+$/i.test(located.file) && located.message
|
|
45
|
+
? "error" : undefined);
|
|
43
46
|
if (severity) {
|
|
44
47
|
addDiagnostic(diagnostics, {
|
|
45
48
|
severity,
|
|
46
49
|
phase,
|
|
47
50
|
message: located.message,
|
|
48
51
|
raw: line,
|
|
49
|
-
file: located.file
|
|
52
|
+
file: located.file,
|
|
50
53
|
line: located.line,
|
|
51
54
|
column: located.column,
|
|
52
55
|
latexPass: isLatexPhase(phase) ? latexPass : undefined
|
|
@@ -149,15 +152,16 @@ function parseLocatedLine(line) {
|
|
|
149
152
|
if (!match?.groups)
|
|
150
153
|
return null;
|
|
151
154
|
const rest = match.groups.rest;
|
|
152
|
-
const marker = rest.match(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
const marker = rest.match(/^(?<severity>Error|Warning):\s*(?<message>.*)$/i)?.groups
|
|
156
|
+
?? rest.match(/\b(?:LaTeX(?:\s+[^:]+)?|Package|Class|pdfTeX|XeTeX|LuaTeX)\s+(?<severity>Error|Warning):\s*(?<message>.*)$/i)?.groups;
|
|
157
|
+
const diagnostic = marker
|
|
158
|
+
? { severity: marker.severity.toLowerCase(), message: marker.message.trim() }
|
|
159
|
+
: parseGenericWarning(rest) ?? { message: rest };
|
|
155
160
|
return {
|
|
156
161
|
file: match.groups.file.replaceAll("\\", "/"),
|
|
157
162
|
line: Number(match.groups.line),
|
|
158
163
|
column: match.groups.column ? Number(match.groups.column) : undefined,
|
|
159
|
-
|
|
160
|
-
message: marker.groups.message.trim()
|
|
164
|
+
...diagnostic
|
|
161
165
|
};
|
|
162
166
|
}
|
|
163
167
|
function parsePackageLine(line) {
|
package/dist/server/compiler.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { spawn } from "node:child_process";
|
|
5
4
|
import { performance } from "node:perf_hooks";
|
|
6
5
|
import { pipeline } from "node:stream/promises";
|
|
7
6
|
import { Transform } from "node:stream";
|
|
8
7
|
import { gunzipSync, gzipSync } from "node:zlib";
|
|
9
8
|
import { listProjectFilesAsync, outputRoot, resolveSourcePath, safeRelativePath, texFileStem } from "./files.js";
|
|
10
9
|
import { parseCompileDiagnostics } from "./compileDiagnostics.js";
|
|
11
|
-
import {
|
|
10
|
+
import { afterProcessStop, spawnOwnedCommand, stopProcessTree } from "./processTree.js";
|
|
11
|
+
import { relocateSyncTeXInputs } from "./synctex.js";
|
|
12
12
|
/** A controlled stop is a normal compile outcome, never a server error. */
|
|
13
13
|
export class CompileCancelledError extends Error {
|
|
14
14
|
constructor() {
|
|
@@ -84,10 +84,15 @@ export class CompileQueue {
|
|
|
84
84
|
export class ProjectCompileCoordinator {
|
|
85
85
|
queue;
|
|
86
86
|
targets = new Map();
|
|
87
|
+
closing = false;
|
|
87
88
|
constructor(queue) {
|
|
88
89
|
this.queue = queue;
|
|
89
90
|
}
|
|
90
91
|
request(input) {
|
|
92
|
+
if (this.closing) {
|
|
93
|
+
input.onDiscarded("cancelled");
|
|
94
|
+
return Promise.resolve(cancelledCompileResult(input));
|
|
95
|
+
}
|
|
91
96
|
const targetKey = `${input.projectId}\0${input.target ?? ""}`;
|
|
92
97
|
const state = this.targets.get(targetKey) ?? { active: null, pending: null };
|
|
93
98
|
this.targets.set(targetKey, state);
|
|
@@ -132,12 +137,25 @@ export class ProjectCompileCoordinator {
|
|
|
132
137
|
cancel(projectId, target) {
|
|
133
138
|
const targetKey = `${projectId}\0${target ?? ""}`;
|
|
134
139
|
const state = this.targets.get(targetKey);
|
|
135
|
-
|
|
140
|
+
return state ? this.cancelState(state) : null;
|
|
141
|
+
}
|
|
142
|
+
async close() {
|
|
143
|
+
this.closing = true;
|
|
144
|
+
const active = [];
|
|
145
|
+
for (const state of this.targets.values()) {
|
|
146
|
+
if (state.active)
|
|
147
|
+
active.push(state.active.promise);
|
|
148
|
+
this.cancelState(state);
|
|
149
|
+
}
|
|
150
|
+
await Promise.allSettled(active);
|
|
151
|
+
}
|
|
152
|
+
cancelState(state) {
|
|
153
|
+
const active = state.active;
|
|
136
154
|
if (!active)
|
|
137
155
|
return null;
|
|
138
156
|
const status = active.started ? "running" : "queued";
|
|
139
157
|
active.controller.abort();
|
|
140
|
-
if (state
|
|
158
|
+
if (state.pending) {
|
|
141
159
|
const pending = state.pending;
|
|
142
160
|
state.pending = null;
|
|
143
161
|
pending.controller.abort();
|
|
@@ -270,7 +288,26 @@ async function copyAndDigest(source, destination) {
|
|
|
270
288
|
return digest.digest("hex");
|
|
271
289
|
}
|
|
272
290
|
export function discardCompileSnapshot(snapshot) {
|
|
273
|
-
|
|
291
|
+
removeUnpublishedCompileRun(snapshot.root);
|
|
292
|
+
}
|
|
293
|
+
const removeCompileRunOptions = {
|
|
294
|
+
recursive: true, force: true,
|
|
295
|
+
...(process.platform === "win32" ? { maxRetries: 3, retryDelay: 100 } : {})
|
|
296
|
+
};
|
|
297
|
+
const warnCompileCleanup = (error, directory) => {
|
|
298
|
+
process.emitWarning(`Could not remove retired compile run ${directory}: ${String(error)}`, { code: "TEXLITE_COMPILE_CLEANUP" });
|
|
299
|
+
};
|
|
300
|
+
function removeUnpublishedCompileRun(directory, warn = warnCompileCleanup) {
|
|
301
|
+
try {
|
|
302
|
+
fs.rmSync(directory, removeCompileRunOptions);
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
if (process.platform !== "win32" || !["EPERM", "EBUSY", "EACCES", "ENOTEMPTY"].includes(error.code ?? ""))
|
|
306
|
+
throw error;
|
|
307
|
+
// An antivirus scanner or another reader can still have a handle open.
|
|
308
|
+
// Keep the stale bundle for the startup sweep instead of failing the run.
|
|
309
|
+
warn(error, directory);
|
|
310
|
+
}
|
|
274
311
|
}
|
|
275
312
|
/**
|
|
276
313
|
* Returns whether the incremental latexmk cache for a root document exists.
|
|
@@ -306,7 +343,7 @@ export function cleanCompileArtifacts(config, projectId, mainFile, runIds = [])
|
|
|
306
343
|
fs.rmSync(compileRunRoot(config, projectId, runId), { recursive: true, force: true });
|
|
307
344
|
}
|
|
308
345
|
}
|
|
309
|
-
export function publishCompileArtifacts(config, projectId, snapshot, result) {
|
|
346
|
+
export function publishCompileArtifacts(config, projectId, snapshot, result, warnCleanup = warnCompileCleanup) {
|
|
310
347
|
if (!result.ok || !result.pdfPath)
|
|
311
348
|
throw new Error("Cannot publish a failed compilation result");
|
|
312
349
|
const manifestDirectory = compileTargetRoot(config, projectId, snapshot.mainFile);
|
|
@@ -328,8 +365,10 @@ export function publishCompileArtifacts(config, projectId, snapshot, result) {
|
|
|
328
365
|
if (previous && previous.runId !== snapshot.runId) {
|
|
329
366
|
// Keep the previous immutable bundle briefly so an already-open PDF or SyncTeX
|
|
330
367
|
// request can finish after the manifest switches to the new bundle.
|
|
368
|
+
const directory = compileRunRoot(config, projectId, previous.runId);
|
|
331
369
|
const cleanup = setTimeout(() => {
|
|
332
|
-
|
|
370
|
+
// Never throw out of the timer if a previous PDF still has an open handle.
|
|
371
|
+
void fs.promises.rm(directory, removeCompileRunOptions).catch((error) => warnCleanup(error, directory));
|
|
333
372
|
}, 60_000);
|
|
334
373
|
cleanup.unref();
|
|
335
374
|
}
|
|
@@ -414,7 +453,7 @@ function readPublishedManifest(config, projectId, manifestPath, expectedMainFile
|
|
|
414
453
|
}
|
|
415
454
|
}
|
|
416
455
|
/** Remove run bundles left by an interrupted process, preserving the published PDF. */
|
|
417
|
-
export function pruneOrphanedCompileRuns(config, projectId) {
|
|
456
|
+
export function pruneOrphanedCompileRuns(config, projectId, warnCleanup = warnCompileCleanup) {
|
|
418
457
|
const runsRoot = path.join(compileDataRoot(config, projectId), "runs");
|
|
419
458
|
const publishedRunIds = new Set(listPublishedCompileArtifacts(config, projectId).map((artifact) => artifact.runId));
|
|
420
459
|
if (!fs.existsSync(runsRoot))
|
|
@@ -422,7 +461,7 @@ export function pruneOrphanedCompileRuns(config, projectId) {
|
|
|
422
461
|
for (const entry of fs.readdirSync(runsRoot, { withFileTypes: true })) {
|
|
423
462
|
if (!entry.isDirectory() || publishedRunIds.has(entry.name))
|
|
424
463
|
continue;
|
|
425
|
-
|
|
464
|
+
removeUnpublishedCompileRun(path.join(runsRoot, entry.name), warnCleanup);
|
|
426
465
|
}
|
|
427
466
|
}
|
|
428
467
|
function compileDataRoot(config, projectId) {
|
|
@@ -582,7 +621,7 @@ function copyCompileArtifacts(source, destination) {
|
|
|
582
621
|
}
|
|
583
622
|
function rewriteSynctexSource(synctexPath, cacheSource, snapshotSource) {
|
|
584
623
|
const original = gunzipSync(fs.readFileSync(synctexPath)).toString("utf8");
|
|
585
|
-
const rewritten = original
|
|
624
|
+
const rewritten = relocateSyncTeXInputs(original, cacheSource, snapshotSource);
|
|
586
625
|
if (rewritten !== original)
|
|
587
626
|
fs.writeFileSync(synctexPath, gzipSync(Buffer.from(rewritten)), { mode: 0o600 });
|
|
588
627
|
}
|
|
@@ -631,52 +670,58 @@ export async function compileProject(config, snapshot, mainFileInput, engine, la
|
|
|
631
670
|
args.push(...config.extraArgs, mainFile);
|
|
632
671
|
const latexmkStartedAt = performance.now();
|
|
633
672
|
const processResult = await new Promise((resolve, reject) => {
|
|
634
|
-
const child =
|
|
673
|
+
const child = spawnOwnedCommand(config.latexmk, args, {
|
|
635
674
|
cwd,
|
|
636
|
-
|
|
637
|
-
detached: detachedProcessGroup(),
|
|
638
|
-
env: { ...process.env, max_print_line: "1000" },
|
|
639
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
675
|
+
env: { ...process.env, max_print_line: "1000" }
|
|
640
676
|
});
|
|
641
677
|
let log = "";
|
|
642
678
|
let cancelled = false;
|
|
679
|
+
let timedOut = false;
|
|
643
680
|
const append = (chunk) => {
|
|
644
|
-
log += chunk
|
|
681
|
+
log += chunk;
|
|
645
682
|
if (log.length > 2_000_000)
|
|
646
683
|
log = log.slice(-2_000_000);
|
|
647
684
|
};
|
|
648
|
-
child.stdout.on("data", append);
|
|
649
|
-
child.stderr.on("data", append);
|
|
685
|
+
child.stdout.setEncoding("utf8").on("data", append);
|
|
686
|
+
child.stderr.setEncoding("utf8").on("data", append);
|
|
650
687
|
let timeout = null;
|
|
651
688
|
const cancel = () => {
|
|
652
689
|
if (cancelled)
|
|
653
690
|
return;
|
|
654
691
|
cancelled = true;
|
|
655
692
|
log += "\nCompilation was cancelled.\n";
|
|
656
|
-
|
|
693
|
+
void stopProcessTree(child).catch(fail);
|
|
657
694
|
};
|
|
658
695
|
const removeAbortListener = () => signal?.removeEventListener("abort", cancel);
|
|
659
|
-
|
|
696
|
+
function fail(error) {
|
|
660
697
|
if (timeout)
|
|
661
698
|
clearTimeout(timeout);
|
|
662
699
|
removeAbortListener();
|
|
663
700
|
reject(error);
|
|
664
|
-
}
|
|
701
|
+
}
|
|
702
|
+
child.once("error", fail);
|
|
665
703
|
timeout = setTimeout(() => {
|
|
666
704
|
if (cancelled)
|
|
667
705
|
return;
|
|
668
|
-
|
|
669
|
-
|
|
706
|
+
if (process.platform === "win32")
|
|
707
|
+
timedOut = true;
|
|
708
|
+
else
|
|
709
|
+
log += `\nCompilation exceeded ${config.compileTimeoutMs / 1000} seconds and was terminated.\n`;
|
|
710
|
+
void stopProcessTree(child).catch(fail);
|
|
670
711
|
}, config.compileTimeoutMs);
|
|
671
712
|
if (signal?.aborted)
|
|
672
713
|
cancel();
|
|
673
714
|
else
|
|
674
715
|
signal?.addEventListener("abort", cancel, { once: true });
|
|
675
|
-
child.
|
|
716
|
+
child.once("close", (code) => {
|
|
676
717
|
if (timeout)
|
|
677
718
|
clearTimeout(timeout);
|
|
678
719
|
removeAbortListener();
|
|
679
|
-
|
|
720
|
+
afterProcessStop(child, () => {
|
|
721
|
+
if (timedOut)
|
|
722
|
+
log += `\nCompilation exceeded ${config.compileTimeoutMs / 1000} seconds and was terminated.\n`;
|
|
723
|
+
resolve({ code: timedOut ? null : code, log, cancelled });
|
|
724
|
+
}, reject);
|
|
680
725
|
});
|
|
681
726
|
});
|
|
682
727
|
const latexmkMs = performance.now() - latexmkStartedAt;
|
package/dist/server/config.js
CHANGED
|
@@ -98,6 +98,8 @@ export function loadConfig(configPathOverride) {
|
|
|
98
98
|
clientDir,
|
|
99
99
|
tikzGalleryEnabled: fileConfig.tikzGallery?.enabled ?? CONFIG_DEFAULTS.tikzGalleryEnabled,
|
|
100
100
|
tikzGalleryDir: resolveConfiguredPath("tikzGallery.path", fileConfig.tikzGallery?.path ?? CONFIG_DEFAULTS.tikzGalleryPath, configDirectory),
|
|
101
|
+
drawioBrowserPath: fileConfig.drawio?.browserPath
|
|
102
|
+
? resolveConfiguredPath("drawio.browserPath", fileConfig.drawio.browserPath, configDirectory) : undefined,
|
|
101
103
|
sessionDays: integerSetting("sessionDays", process.env.TEXLITE_SESSION_DAYS, fileConfig.sessionDays, CONFIG_DEFAULTS.sessionDays, CONFIG_LIMITS.sessionDays),
|
|
102
104
|
compileTimeoutMs: compileTimeoutSeconds * 1000,
|
|
103
105
|
maxCompileJobs,
|
|
@@ -179,7 +181,7 @@ function resolveBasePath(fileConfig) {
|
|
|
179
181
|
}
|
|
180
182
|
return basePath;
|
|
181
183
|
}
|
|
182
|
-
function isEngine(value) {
|
|
184
|
+
export function isEngine(value) {
|
|
183
185
|
return typeof value === "string" && LATEX_ENGINES.includes(value);
|
|
184
186
|
}
|
|
185
187
|
function isPdfLoadingStrategy(value) {
|
|
@@ -216,6 +218,8 @@ function validateFileConfig(config) {
|
|
|
216
218
|
const storage = optionalSection(config.storage, "storage");
|
|
217
219
|
optionalString(storage?.dataDir, "storage.dataDir", { min: 1, max: 4_096 });
|
|
218
220
|
const tikzGallery = optionalSection(config.tikzGallery, "tikzGallery");
|
|
221
|
+
const drawio = optionalSection(config.drawio, "drawio");
|
|
222
|
+
optionalString(drawio?.browserPath, "drawio.browserPath", { min: 1, max: 4_096 });
|
|
219
223
|
if (tikzGallery && Object.prototype.hasOwnProperty.call(tikzGallery, "enabled") && typeof tikzGallery.enabled !== "boolean") {
|
|
220
224
|
throw configurationError("tikzGallery.enabled", "must be true or false");
|
|
221
225
|
}
|
package/dist/server/db.js
CHANGED
|
@@ -197,8 +197,76 @@ const databaseMigrations = [
|
|
|
197
197
|
if (missingColumn(db, "project_edit_segments", "has_agent")) {
|
|
198
198
|
db.exec("ALTER TABLE project_edit_segments ADD COLUMN has_agent INTEGER NOT NULL DEFAULT 0");
|
|
199
199
|
}
|
|
200
|
+
} },
|
|
201
|
+
// Which stored file contents each snapshot uses, and how many snapshots use
|
|
202
|
+
// each content. Retention and storage statistics read these instead of
|
|
203
|
+
// parsing every manifest. Triggers keep both in step with the manifests;
|
|
204
|
+
// deleting a snapshot cascades and releases its references.
|
|
205
|
+
{ version: 23, name: "add_history_version_objects", apply: createHistoryObjectIndex },
|
|
206
|
+
// Edit-history retention removes the oldest records first. This order lets
|
|
207
|
+
// it read just those rows instead of sorting the project's whole history.
|
|
208
|
+
{ version: 24, name: "add_edit_segment_age_index", apply: (db) => {
|
|
209
|
+
db.exec(`CREATE INDEX IF NOT EXISTS project_edit_segments_project_updated
|
|
210
|
+
ON project_edit_segments(project_id, updated_at)`);
|
|
211
|
+
} },
|
|
212
|
+
// Development databases may have applied an unreleased draft of migration
|
|
213
|
+
// 23 that had only the per-snapshot rows. Complete the index and rebuild the
|
|
214
|
+
// reference counts from those rows; on any other database this is a no-op
|
|
215
|
+
// apart from recounting.
|
|
216
|
+
{ version: 25, name: "complete_history_object_index", apply: (db) => {
|
|
217
|
+
createHistoryObjectIndex(db);
|
|
218
|
+
db.exec(`DROP INDEX IF EXISTS project_history_version_objects_digest;
|
|
219
|
+
DELETE FROM project_history_objects;
|
|
220
|
+
INSERT INTO project_history_objects (project_id, digest, size, refs)
|
|
221
|
+
SELECT project_id, digest, MAX(size), COUNT(*) FROM project_history_version_objects GROUP BY project_id, digest;`);
|
|
222
|
+
} },
|
|
223
|
+
{ version: 26, name: "add_pending_project_deletions", apply: (db) => {
|
|
224
|
+
// These records must outlive the projects they refer to.
|
|
225
|
+
db.exec("CREATE TABLE IF NOT EXISTS pending_project_deletions (project_id TEXT PRIMARY KEY NOT NULL) WITHOUT ROWID");
|
|
200
226
|
} }
|
|
201
227
|
];
|
|
228
|
+
/** Create the snapshot object index and its triggers, and index existing snapshots. */
|
|
229
|
+
function createHistoryObjectIndex(db) {
|
|
230
|
+
const insertObjects = (version) => `INSERT OR IGNORE INTO project_history_version_objects (version_id, project_id, digest, size)
|
|
231
|
+
SELECT ${version}.id, ${version}.project_id, json_extract(file.value, '$.digest'), json_extract(file.value, '$.size')
|
|
232
|
+
FROM json_each(${version}.manifest_json, '$.files') AS file`;
|
|
233
|
+
db.exec(`
|
|
234
|
+
CREATE TABLE IF NOT EXISTS project_history_version_objects (
|
|
235
|
+
version_id TEXT NOT NULL REFERENCES project_history_versions(id) ON DELETE CASCADE,
|
|
236
|
+
project_id TEXT NOT NULL,
|
|
237
|
+
digest TEXT NOT NULL,
|
|
238
|
+
size INTEGER NOT NULL,
|
|
239
|
+
PRIMARY KEY (version_id, digest)
|
|
240
|
+
) WITHOUT ROWID;
|
|
241
|
+
CREATE TABLE IF NOT EXISTS project_history_objects (
|
|
242
|
+
project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
243
|
+
digest TEXT NOT NULL,
|
|
244
|
+
size INTEGER NOT NULL,
|
|
245
|
+
refs INTEGER NOT NULL,
|
|
246
|
+
PRIMARY KEY (project_id, digest)
|
|
247
|
+
) WITHOUT ROWID;
|
|
248
|
+
CREATE TRIGGER IF NOT EXISTS project_history_version_objects_insert
|
|
249
|
+
AFTER INSERT ON project_history_version_objects BEGIN
|
|
250
|
+
INSERT INTO project_history_objects (project_id, digest, size, refs) VALUES (NEW.project_id, NEW.digest, NEW.size, 1)
|
|
251
|
+
ON CONFLICT(project_id, digest) DO UPDATE SET refs = refs + 1;
|
|
252
|
+
END;
|
|
253
|
+
CREATE TRIGGER IF NOT EXISTS project_history_version_objects_delete
|
|
254
|
+
AFTER DELETE ON project_history_version_objects BEGIN
|
|
255
|
+
UPDATE project_history_objects SET refs = refs - 1 WHERE project_id = OLD.project_id AND digest = OLD.digest;
|
|
256
|
+
DELETE FROM project_history_objects WHERE project_id = OLD.project_id AND digest = OLD.digest AND refs <= 0;
|
|
257
|
+
END;
|
|
258
|
+
CREATE TRIGGER IF NOT EXISTS project_history_versions_objects_insert
|
|
259
|
+
AFTER INSERT ON project_history_versions BEGIN
|
|
260
|
+
${insertObjects("NEW")};
|
|
261
|
+
END;
|
|
262
|
+
CREATE TRIGGER IF NOT EXISTS project_history_versions_objects_update
|
|
263
|
+
AFTER UPDATE OF manifest_json ON project_history_versions BEGIN
|
|
264
|
+
DELETE FROM project_history_version_objects WHERE version_id = OLD.id;
|
|
265
|
+
${insertObjects("NEW")};
|
|
266
|
+
END;
|
|
267
|
+
${insertObjects("history").replace("FROM json_each(history.manifest_json", "FROM project_history_versions AS history, json_each(history.manifest_json")};
|
|
268
|
+
`);
|
|
269
|
+
}
|
|
202
270
|
function migrateGitHubTokensToUsers(db) {
|
|
203
271
|
db.exec(`
|
|
204
272
|
CREATE TABLE IF NOT EXISTS user_github_settings (
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { httpError } from "./http.js";
|
|
3
|
+
import { drawioPdfPath } from "../shared/drawio.js";
|
|
4
|
+
export const DRAWIO_LOCK_TTL_MS = 60_000;
|
|
5
|
+
export const DRAWIO_LOCK_PING_MS = 20_000;
|
|
6
|
+
const containsPath = (root, file) => file === root || file.startsWith(`${root}/`);
|
|
7
|
+
/** Runtime-only ownership: a token is valid only while its exact socket owns the lease. */
|
|
8
|
+
export class DrawioLocks {
|
|
9
|
+
leases = new Map();
|
|
10
|
+
closed = false;
|
|
11
|
+
key(projectId, path) { return JSON.stringify([projectId, path]); }
|
|
12
|
+
active(projectId, path) {
|
|
13
|
+
const lease = this.leases.get(this.key(projectId, path));
|
|
14
|
+
if (lease && (lease.expiresAt <= Date.now() || lease.socket.readyState !== 1 || !lease.valid())) {
|
|
15
|
+
this.release(lease);
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return lease;
|
|
19
|
+
}
|
|
20
|
+
acquire(projectId, path, userId, name, socket, valid, revision = "") {
|
|
21
|
+
if (this.closed || !valid()) {
|
|
22
|
+
socket.close(1008, "Access denied");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (socket.readyState !== 1)
|
|
26
|
+
return;
|
|
27
|
+
const existing = this.active(projectId, path);
|
|
28
|
+
if (existing) {
|
|
29
|
+
socket.send(JSON.stringify({ type: "busy", name: existing.name }));
|
|
30
|
+
socket.close(1000);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const token = randomUUID();
|
|
34
|
+
const lease = { projectId, path, userId, name, token, socket, valid, expiresAt: Date.now() + DRAWIO_LOCK_TTL_MS,
|
|
35
|
+
timer: setInterval(() => {
|
|
36
|
+
if (this.active(projectId, path) !== lease)
|
|
37
|
+
return;
|
|
38
|
+
try {
|
|
39
|
+
socket.ping();
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
this.release(lease);
|
|
43
|
+
}
|
|
44
|
+
}, DRAWIO_LOCK_PING_MS) };
|
|
45
|
+
lease.timer.unref();
|
|
46
|
+
this.leases.set(this.key(projectId, path), lease);
|
|
47
|
+
socket.on("pong", () => {
|
|
48
|
+
// A late pong cannot resurrect an expired/replaced lease.
|
|
49
|
+
if (this.active(projectId, path) === lease)
|
|
50
|
+
lease.expiresAt = Date.now() + DRAWIO_LOCK_TTL_MS;
|
|
51
|
+
});
|
|
52
|
+
socket.on("message", (data) => {
|
|
53
|
+
if (data.toString() === "release")
|
|
54
|
+
this.release(lease);
|
|
55
|
+
});
|
|
56
|
+
socket.on("close", () => this.release(lease));
|
|
57
|
+
socket.on("error", () => this.release(lease));
|
|
58
|
+
socket.send(JSON.stringify({ type: "acquired", token, revision }));
|
|
59
|
+
}
|
|
60
|
+
assertOwned(projectId, path, token, userId) {
|
|
61
|
+
const lease = this.active(projectId, path);
|
|
62
|
+
if (!lease || lease.userId !== userId || lease.token !== token)
|
|
63
|
+
throw httpError(409, "DRAWIO_LOCK_LOST");
|
|
64
|
+
}
|
|
65
|
+
*matching(projectId, paths) {
|
|
66
|
+
for (const candidate of this.leases.values()) {
|
|
67
|
+
if (candidate.projectId !== projectId)
|
|
68
|
+
continue;
|
|
69
|
+
const lease = this.active(projectId, candidate.path);
|
|
70
|
+
if (lease && paths.some((path) => containsPath(path, lease.path) || containsPath(path, drawioPdfPath(lease.path))))
|
|
71
|
+
yield lease;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
assertUnlocked(projectId, paths) {
|
|
75
|
+
for (const lease of this.matching(projectId, paths)) {
|
|
76
|
+
throw httpError(409, "DRAWIO_LOCKED", { name: lease.name });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** The owning editor may delete its source, but not another lease or just its exported PDF. */
|
|
80
|
+
prepareDelete(projectId, path, userId, token) {
|
|
81
|
+
let removedLease;
|
|
82
|
+
for (const lease of this.matching(projectId, [path])) {
|
|
83
|
+
if (lease.userId !== userId || lease.token !== token || !containsPath(path, lease.path)) {
|
|
84
|
+
throw httpError(409, "DRAWIO_LOCKED", { name: lease.name });
|
|
85
|
+
}
|
|
86
|
+
removedLease = lease;
|
|
87
|
+
}
|
|
88
|
+
if (token !== undefined && !removedLease)
|
|
89
|
+
throw httpError(409, "DRAWIO_LOCK_LOST");
|
|
90
|
+
// Run only after the filesystem deletion succeeds, inside the same mutation.
|
|
91
|
+
return () => { if (removedLease)
|
|
92
|
+
this.release(removedLease); };
|
|
93
|
+
}
|
|
94
|
+
revokeProject(projectId) {
|
|
95
|
+
for (const lease of [...this.leases.values()])
|
|
96
|
+
if (lease.projectId === projectId)
|
|
97
|
+
this.release(lease);
|
|
98
|
+
}
|
|
99
|
+
close() {
|
|
100
|
+
this.closed = true;
|
|
101
|
+
for (const lease of [...this.leases.values()])
|
|
102
|
+
this.release(lease);
|
|
103
|
+
}
|
|
104
|
+
release(lease) {
|
|
105
|
+
const key = this.key(lease.projectId, lease.path);
|
|
106
|
+
if (this.leases.get(key) !== lease)
|
|
107
|
+
return;
|
|
108
|
+
this.leases.delete(key);
|
|
109
|
+
clearInterval(lease.timer);
|
|
110
|
+
// terminate avoids a dead peer keeping the close handshake alive forever.
|
|
111
|
+
if (lease.socket.readyState !== 3)
|
|
112
|
+
lease.socket.terminate();
|
|
113
|
+
}
|
|
114
|
+
}
|