texlite 0.21.0 → 0.23.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 +174 -22
- package/OPERATIONS.md +23 -3
- package/README.md +44 -37
- package/README.zh-CN.md +38 -31
- package/addon.md +76 -0
- package/dist/client/assets/AdminUsers-xuVuiwoh.js +1 -0
- 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-dCMgWJG-.css → AgentIcon-DJGGRJnV.css} +1 -1
- 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-0n1UkKZ5.js → AgentManagement-D-0hrv6f.js} +1 -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 +2 -0
- 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 +16 -0
- 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 +1 -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 +1 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js +3 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DqO9e0GV.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-D3CjBD0p.js +1 -0
- package/dist/client/assets/Dashboard-BYgqCgBM.js +5 -0
- 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 +4 -0
- 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 +1 -0
- 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 +8 -0
- 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 +1 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js +25 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js.br +0 -0
- package/dist/client/assets/LatexEditor-vNOVTIl7.js.gz +0 -0
- package/dist/client/assets/MarkdownContent-BeKi2gI5.js +36 -0
- package/dist/client/assets/MarkdownContent-BeKi2gI5.js.br +0 -0
- package/dist/client/assets/MarkdownContent-BeKi2gI5.js.gz +0 -0
- package/dist/client/assets/MarkdownPreview-BJPqGTcw.js +1 -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-DAiP7wVe.js → ProjectIconPickerDialog-ChiEUQ0g.js} +1 -1
- 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 +1 -0
- 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 +4 -0
- 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 +25 -0
- 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-kW-97LBY.js → QuickOpenDialog-B7NTqOpu.js} +1 -1
- 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-B-ZZIpJq.js → ReadOnlySource-DIalHHvP.js} +2 -2
- package/dist/client/assets/SelectionHistoryDialog-BhOyneNx.js +3 -0
- 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 +2 -0
- 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-Dz_zxjfR.js → SystemMetricsDialog-Bycm88U1.js} +1 -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 +1 -0
- 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 +1 -0
- package/dist/client/assets/TikzGalleryDialog-Bqzl2256.css +1 -0
- package/dist/client/assets/TikzGalleryDialog-Bqzl2256.css.br +0 -0
- package/dist/client/assets/TikzGalleryDialog-Bqzl2256.css.gz +0 -0
- package/dist/client/assets/TikzGalleryDialog-CLAmKmS6.js +1 -0
- 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 +1 -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/{bibtexFormatterWorker-B_jvobIv.js → bibtexFormatterWorker-Bp8kjjvw.js} +14 -14
- package/dist/client/assets/bibtexFormatterWorker-Bp8kjjvw.js.br +0 -0
- package/dist/client/assets/bibtexFormatterWorker-Bp8kjjvw.js.gz +0 -0
- package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js +2 -0
- package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js.br +0 -0
- package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js.gz +0 -0
- package/dist/client/assets/bibtexNames-CPGbBJxd.js +1 -0
- package/dist/client/assets/bibtexReferences-xpSF8IXH.js +1 -0
- package/dist/client/assets/bot-ClmnQ29j.js +1 -0
- package/dist/client/assets/{chktex-CCcr_9m7.js → chktex-22lKGvKa.js} +2 -2
- package/dist/client/assets/citationAuthors-BWHXhKvT.js +1 -0
- package/dist/client/assets/citationAuthors-BWHXhKvT.js.br +0 -0
- package/dist/client/assets/citationAuthors-BWHXhKvT.js.gz +0 -0
- package/dist/client/assets/citationLibrary-DxGdbZEQ.js +1 -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-Dxkdrap6.js +2 -0
- package/dist/client/assets/dist-Dxkdrap6.js.br +0 -0
- package/dist/client/assets/dist-Dxkdrap6.js.gz +0 -0
- package/dist/client/assets/editor-CkUEg2La.js +14 -0
- 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 +36 -0
- 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 +1 -0
- 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 +1 -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/git-compare-arrows-158rS_vn.js +1 -0
- package/dist/client/assets/i18n-Wn96VbWM.js +13 -0
- 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 +2 -0
- 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 +1 -0
- package/dist/client/assets/index-DSF5eT29.css.br +0 -0
- package/dist/client/assets/index-DSF5eT29.css.gz +0 -0
- package/dist/client/assets/katex-Ca9qmXPj.js +257 -0
- package/dist/client/assets/katex-Ca9qmXPj.js.br +0 -0
- package/dist/client/assets/katex-Ca9qmXPj.js.gz +0 -0
- package/dist/client/assets/katex.min-VLoWtPY0.js +1 -0
- package/dist/client/assets/{latexFormatterWorker-BIDCSZPd.js → latexFormatterWorker-BWiogBYE.js} +1 -1
- package/dist/client/assets/latexFormatterWorker-BWiogBYE.js.br +0 -0
- package/dist/client/assets/latexFormatterWorker-BWiogBYE.js.gz +0 -0
- package/dist/client/assets/latexScanner-D9bMX44Y.js +6 -0
- package/dist/client/assets/latexScanner-D9bMX44Y.js.br +0 -0
- package/dist/client/assets/latexScanner-D9bMX44Y.js.gz +0 -0
- package/dist/client/assets/palette-8_-Y5XON.js +1 -0
- package/dist/client/assets/relativeTime-C-GTw3lA.js +1 -0
- 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 +1 -0
- 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-D-tYd_ac.js → spellCheck-kxvnxrvw.js} +1 -1
- 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-Kz9ESEVW.js → textLanguageSupport-Ck8lMOWz.js} +1 -1
- package/dist/client/assets/{textLanguages-Dac6mieP.js → textLanguages-CwWstpJ5.js} +5 -5
- 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 +1 -0
- 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-DWYaSMuX.js → vimSupport-C-WiMLjc.js} +6 -6
- package/dist/client/assets/vimSupport-C-WiMLjc.js.br +0 -0
- package/dist/client/assets/{vimSupport-DWYaSMuX.js.gz → vimSupport-C-WiMLjc.js.gz} +0 -0
- package/dist/client/index.html +3 -3
- package/dist/server/agentChanges.js +149 -0
- package/dist/server/agents/sessions.js +1 -1
- package/dist/server/agents/workspaces.js +21 -28
- package/dist/server/app.js +15 -6
- package/dist/server/boundedExpiringCache.js +69 -0
- package/dist/server/citationFolderTransfer.js +5 -5
- package/dist/server/citationInput.js +1 -0
- package/dist/server/cli.js +12 -1
- package/dist/server/collaboration.js +8 -4
- package/dist/server/config.js +10 -0
- package/dist/server/db.js +23 -0
- package/dist/server/editHistory.js +71 -12
- package/dist/server/git.js +58 -7
- package/dist/server/history.js +58 -9
- package/dist/server/i18n.js +12 -0
- package/dist/server/locales/zh-Hant.js +6 -0
- package/dist/server/projectReferences.js +110 -9
- package/dist/server/routes/auth.js +3 -0
- package/dist/server/routes/citations.js +28 -61
- package/dist/server/routes/comments.js +8 -3
- package/dist/server/routes/compile.js +56 -4
- package/dist/server/routes/projectGit.js +10 -0
- package/dist/server/routes/projectHistory.js +42 -0
- package/dist/server/routes/system.js +1 -0
- package/dist/server/routes/tikzGallery.js +38 -0
- package/dist/server/routes/users.js +2 -2
- package/dist/server/tikzEditorAddon.js +115 -0
- package/dist/server/tikzEditorRelease.js +9 -0
- package/dist/server/tikzGallery.js +63 -0
- package/dist/shared/bibtexBraces.js +20 -0
- package/dist/shared/bibtexNames.js +82 -0
- package/dist/shared/bibtexReferences.js +52 -12
- package/dist/shared/bibtexText.js +175 -0
- package/dist/shared/gitProtocol.js +2 -0
- package/dist/shared/historyProtocol.js +5 -0
- package/dist/shared/textDiff.js +36 -1
- package/dist/shared/tikzStandalone.js +15 -0
- package/package.json +2 -1
- package/templates/agents/AGENTS.md +12 -0
- package/texlite.config.example.json +4 -0
- package/dist/client/assets/AdminUsers-Cpj29JD6.js +0 -1
- package/dist/client/assets/AdminUsers-Cpj29JD6.js.br +0 -0
- package/dist/client/assets/AdminUsers-Cpj29JD6.js.gz +0 -0
- package/dist/client/assets/AgentIcon-dCMgWJG-.css.br +0 -0
- package/dist/client/assets/AgentIcon-dCMgWJG-.css.gz +0 -0
- package/dist/client/assets/AgentManagement-0n1UkKZ5.js.br +0 -0
- package/dist/client/assets/AgentManagement-0n1UkKZ5.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-BbGH5iPx.js +0 -2
- package/dist/client/assets/AgentTerminal-BbGH5iPx.js.br +0 -0
- package/dist/client/assets/AgentTerminal-BbGH5iPx.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-CIouKd-C.js +0 -16
- package/dist/client/assets/AgentTerminalSurface-CIouKd-C.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-CIouKd-C.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-BjTx2yjQ.js +0 -1
- package/dist/client/assets/AvatarSettingsDialog-BjTx2yjQ.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-BjTx2yjQ.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-B4ITqbxl.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-DDP3gXNt.js +0 -3
- package/dist/client/assets/CitationLibraryDialog-DDP3gXNt.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DDP3gXNt.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-BjbIDOCl.js +0 -36
- package/dist/client/assets/CitationNotesPreview-BjbIDOCl.js.br +0 -0
- package/dist/client/assets/CitationNotesPreview-BjbIDOCl.js.gz +0 -0
- package/dist/client/assets/Dashboard-Dc3ANXhG.js +0 -5
- package/dist/client/assets/Dashboard-Dc3ANXhG.js.br +0 -0
- package/dist/client/assets/Dashboard-Dc3ANXhG.js.gz +0 -0
- package/dist/client/assets/GitDialog-CzLmo9Z_.js +0 -3
- package/dist/client/assets/GitDialog-CzLmo9Z_.js.br +0 -0
- package/dist/client/assets/GitDialog-CzLmo9Z_.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-DsQgHv-Z.js +0 -1
- package/dist/client/assets/GitHubAccountDialog-DsQgHv-Z.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-DsQgHv-Z.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-C4zmnE1s.js +0 -8
- package/dist/client/assets/HistoryDialog-C4zmnE1s.js.br +0 -0
- package/dist/client/assets/HistoryDialog-C4zmnE1s.js.gz +0 -0
- package/dist/client/assets/InfoPopover-Dkz742vJ.js +0 -1
- package/dist/client/assets/LatexEditor-BRPiyMbH.js +0 -25
- package/dist/client/assets/LatexEditor-BRPiyMbH.js.br +0 -0
- package/dist/client/assets/LatexEditor-BRPiyMbH.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-DAiP7wVe.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-DAiP7wVe.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-B5a5mHXl.js +0 -1
- package/dist/client/assets/ProjectSearchDialog-B5a5mHXl.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-B5a5mHXl.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-CARW1k8M.js +0 -4
- package/dist/client/assets/ProjectSettings-CARW1k8M.js.br +0 -0
- package/dist/client/assets/ProjectSettings-CARW1k8M.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-BQ3QGBVy.js +0 -31
- package/dist/client/assets/ProjectWorkspace-BQ3QGBVy.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-BQ3QGBVy.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-kW-97LBY.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-kW-97LBY.js.gz +0 -0
- package/dist/client/assets/SelectionHistoryDialog-CmHcjD4T.js +0 -3
- package/dist/client/assets/SelectionHistoryDialog-CmHcjD4T.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-CmHcjD4T.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-BjhT-js7.js +0 -2
- package/dist/client/assets/SharedProjectPage-BjhT-js7.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-BjhT-js7.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-Dz_zxjfR.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-Dz_zxjfR.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-BIsAi9rh.js +0 -1
- package/dist/client/assets/TagManagementDialog-BIsAi9rh.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BIsAi9rh.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-dp0oKTtC.js +0 -1
- package/dist/client/assets/ThemeSwitcher-dp0oKTtC.js.br +0 -0
- package/dist/client/assets/ThemeSwitcher-dp0oKTtC.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-CJb1b8cD.js +0 -1
- package/dist/client/assets/WordCountDialog-CJb1b8cD.js.br +0 -0
- package/dist/client/assets/WordCountDialog-CJb1b8cD.js.gz +0 -0
- package/dist/client/assets/bibtexFormatterWorker-B_jvobIv.js.br +0 -0
- package/dist/client/assets/bibtexFormatterWorker-B_jvobIv.js.gz +0 -0
- package/dist/client/assets/citationLibrary-BzlqZiFU.js +0 -26
- package/dist/client/assets/citationLibrary-BzlqZiFU.js.br +0 -0
- package/dist/client/assets/citationLibrary-BzlqZiFU.js.gz +0 -0
- package/dist/client/assets/clipboard-CslquMx4.js +0 -1
- package/dist/client/assets/editor-fyrvjoqA.js +0 -14
- package/dist/client/assets/editor-fyrvjoqA.js.br +0 -0
- package/dist/client/assets/editor-fyrvjoqA.js.gz +0 -0
- package/dist/client/assets/editor-languages-D1a-K8dK.js +0 -36
- package/dist/client/assets/editor-languages-D1a-K8dK.js.br +0 -0
- package/dist/client/assets/editor-languages-D1a-K8dK.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-BpJbXyCP.js +0 -1
- package/dist/client/assets/editorThemeExtension-BpJbXyCP.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-BpJbXyCP.js.gz +0 -0
- package/dist/client/assets/eye-BnslGpqB.js +0 -1
- package/dist/client/assets/i18n-DNTfpttY.js +0 -13
- package/dist/client/assets/i18n-DNTfpttY.js.br +0 -0
- package/dist/client/assets/i18n-DNTfpttY.js.gz +0 -0
- package/dist/client/assets/index-CfSDaTd4.js +0 -2
- package/dist/client/assets/index-CfSDaTd4.js.br +0 -0
- package/dist/client/assets/index-CfSDaTd4.js.gz +0 -0
- package/dist/client/assets/index-PNFHDg2W.css +0 -1
- package/dist/client/assets/index-PNFHDg2W.css.br +0 -0
- package/dist/client/assets/index-PNFHDg2W.css.gz +0 -0
- package/dist/client/assets/katex-CBRBI6nR.js +0 -257
- package/dist/client/assets/katex-CBRBI6nR.js.br +0 -0
- package/dist/client/assets/katex-CBRBI6nR.js.gz +0 -0
- package/dist/client/assets/latexFormatterWorker-BIDCSZPd.js.br +0 -0
- package/dist/client/assets/latexFormatterWorker-BIDCSZPd.js.gz +0 -0
- package/dist/client/assets/relativeTime-DKEihsTa.js +0 -1
- package/dist/client/assets/relativeTime-DKEihsTa.js.br +0 -0
- package/dist/client/assets/relativeTime-DKEihsTa.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-QnrFw3Ft.js +0 -1
- package/dist/client/assets/sourceCursorStore-QnrFw3Ft.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-QnrFw3Ft.js.gz +0 -0
- package/dist/client/assets/spellCheck-D-tYd_ac.js.br +0 -0
- package/dist/client/assets/spellCheck-D-tYd_ac.js.gz +0 -0
- package/dist/client/assets/textLanguages-Dac6mieP.js.br +0 -0
- package/dist/client/assets/textLanguages-Dac6mieP.js.gz +0 -0
- package/dist/client/assets/useDeletionTransitions-TAZINdHX.js +0 -1
- package/dist/client/assets/useDeletionTransitions-TAZINdHX.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-TAZINdHX.js.gz +0 -0
- package/dist/client/assets/vimSupport-DWYaSMuX.js.br +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js → AgentIcon-qmglBc3M.js} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.br → AgentIcon-qmglBc3M.js.br} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.gz → AgentIcon-qmglBc3M.js.gz} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
|
-
import {
|
|
4
|
+
import { textReplacements } from "../../shared/textDiff.js";
|
|
5
5
|
import { isTextContent } from "../../shared/fileTypes.js";
|
|
6
6
|
import { isCollaborativeTextFile, maxCollaborativeFileBytes } from "../collaboration.js";
|
|
7
7
|
import { assertNoSourceSymlinks, outputRoot, resolveSourcePath, sourceRoot } from "../files.js";
|
|
@@ -34,30 +34,9 @@ export async function ensureAgentInstructions(context, projectId, user) {
|
|
|
34
34
|
}, { preflight: () => { requireEditableProject(db, projectId, user); } });
|
|
35
35
|
}
|
|
36
36
|
const ignored = (name) => name === ".git" || name === ".texlite-agent-conflicts" || /\.(?:collaboration-\d+-[^.]+|agent-[^.]+)\.tmp$/.test(name);
|
|
37
|
+
/** Exact (uncleaned) replacements, so three-way merging never widens an edit. */
|
|
37
38
|
function changes(before, after) {
|
|
38
|
-
|
|
39
|
-
let offset = 0;
|
|
40
|
-
let pending;
|
|
41
|
-
for (const [kind, text] of makeDiff(before, after, { checkLines: true, timeout: 1 })) {
|
|
42
|
-
if (kind === 0) {
|
|
43
|
-
if (pending)
|
|
44
|
-
result.push(pending);
|
|
45
|
-
pending = undefined;
|
|
46
|
-
offset += text.length;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
pending ??= { from: offset, to: offset, insert: "" };
|
|
50
|
-
if (kind === -1) {
|
|
51
|
-
offset += text.length;
|
|
52
|
-
pending.to = offset;
|
|
53
|
-
}
|
|
54
|
-
else
|
|
55
|
-
pending.insert += text;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (pending)
|
|
59
|
-
result.push(pending);
|
|
60
|
-
return result;
|
|
39
|
+
return textReplacements(before, after);
|
|
61
40
|
}
|
|
62
41
|
/** Conservative three-way merge: never fuzzy-apply overlapping replacements. */
|
|
63
42
|
export function mergeAgentText(base, editor, agent) {
|
|
@@ -264,7 +243,7 @@ export class AgentSourceSync {
|
|
|
264
243
|
if (next !== null) {
|
|
265
244
|
if (next !== after?.text)
|
|
266
245
|
this.write(relative, next);
|
|
267
|
-
if (!collaboration.importExternalText(this.projectId, relative, next, this.userId)) {
|
|
246
|
+
if (!collaboration.importExternalText(this.projectId, relative, next, this.userId, { agent: true })) {
|
|
268
247
|
const previous = before?.text ?? "";
|
|
269
248
|
reanchorFileComments(db, this.projectId, relative, previous, next);
|
|
270
249
|
collaboration.updateFile(this.projectId, relative, next, this.userId);
|
|
@@ -289,7 +268,8 @@ export class AgentSourceSync {
|
|
|
289
268
|
this.syncing = false;
|
|
290
269
|
if (changed.length) {
|
|
291
270
|
touchProject(db, this.projectId, this.userId);
|
|
292
|
-
|
|
271
|
+
// The task's user is the author; the flag shows a coding agent made the change.
|
|
272
|
+
recordHistory(this.projectId, this.userId, "file", changed, { hasAgent: true });
|
|
293
273
|
collaboration.signalComments(this.projectId);
|
|
294
274
|
}
|
|
295
275
|
}
|
|
@@ -314,6 +294,19 @@ export class AgentSourceSync {
|
|
|
314
294
|
}
|
|
315
295
|
}
|
|
316
296
|
}
|
|
297
|
+
/** The add-on's guide for figure work, when the add-on is enabled and ships one. */
|
|
298
|
+
async function tikzGuidePath(config) {
|
|
299
|
+
if (!config.tikzGalleryEnabled)
|
|
300
|
+
return null;
|
|
301
|
+
const guide = path.join(config.tikzGalleryDir, "TIKZ.md");
|
|
302
|
+
try {
|
|
303
|
+
await fs.promises.access(guide, fs.constants.R_OK);
|
|
304
|
+
return guide;
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
317
310
|
/** Provide logs outside the source tree without introducing generated project files. */
|
|
318
311
|
export async function writeAgentProjectContext(context, taskId, projectId) {
|
|
319
312
|
const { config, db } = context;
|
|
@@ -326,7 +319,7 @@ export async function writeAgentProjectContext(context, taskId, projectId) {
|
|
|
326
319
|
await fs.promises.writeFile(path.join(state, "project-context.json"), JSON.stringify({ sourceDirectory: sourceRoot(config, projectId),
|
|
327
320
|
mainFile: project.main_file, outputDirectory: outputRoot(config, projectId),
|
|
328
321
|
latestCompile: latest ? { runId: latest.id, status: latest.status } : null,
|
|
329
|
-
compileLog: path.join(state, "compile.log") }, null, 2), { mode: 0o600 });
|
|
322
|
+
compileLog: path.join(state, "compile.log"), tikzGuide: await tikzGuidePath(config) }, null, 2), { mode: 0o600 });
|
|
330
323
|
}
|
|
331
324
|
function externalEdit(filePath, before, after, authorId) {
|
|
332
325
|
const createdAt = new Date().toISOString();
|
|
@@ -336,6 +329,6 @@ function externalEdit(filePath, before, after, authorId) {
|
|
|
336
329
|
shift += edit.insert.length - (edit.to - edit.from);
|
|
337
330
|
return createEditHistorySpan(edit.from, afterStart, before.slice(edit.from, edit.to), edit.insert);
|
|
338
331
|
});
|
|
339
|
-
return { filePath, authorId, kind: "edit", beforeHash: hashText(before), afterHash: hashText(after), createdAt, updatedAt: createdAt,
|
|
332
|
+
return { filePath, authorId, kind: "edit", hasAgent: true, beforeHash: hashText(before), afterHash: hashText(after), createdAt, updatedAt: createdAt,
|
|
340
333
|
steps: [{ beforeHash: hashText(before), afterHash: hashText(after), createdAt, spans }] };
|
|
341
334
|
}
|
package/dist/server/app.js
CHANGED
|
@@ -40,6 +40,7 @@ import { registerProjectCatalogRoutes } from "./routes/projects.js";
|
|
|
40
40
|
import { registerSystemRoutes } from "./routes/system.js";
|
|
41
41
|
import { registerUserManagementRoutes } from "./routes/users.js";
|
|
42
42
|
import { registerWordCountRoutes } from "./routes/wordCount.js";
|
|
43
|
+
import { registerTikzGalleryRoutes } from "./routes/tikzGallery.js";
|
|
43
44
|
import { registerAgentRoutes } from "./routes/agents.js";
|
|
44
45
|
import { AgentService } from "./agents/sessions.js";
|
|
45
46
|
import { HarperService } from "./harper.js";
|
|
@@ -125,9 +126,9 @@ export async function buildApp(config, db, options = {}) {
|
|
|
125
126
|
app.log.error({ err: error, projectId: id }, "Failed to record project edit history");
|
|
126
127
|
signalHistory(id);
|
|
127
128
|
});
|
|
128
|
-
const recordHistory = (projectId, userId, reason, paths) => {
|
|
129
|
+
const recordHistory = (projectId, userId, reason, paths, { hasAgent = false } = {}) => {
|
|
129
130
|
try {
|
|
130
|
-
const version = history.record(projectId, userId, reason, failedSnapshots.has(projectId) ? undefined : paths, { deferRetention: reason === "autosave" });
|
|
131
|
+
const version = history.record(projectId, userId, reason, failedSnapshots.has(projectId) ? undefined : paths, { deferRetention: reason === "autosave", hasAgent });
|
|
131
132
|
if (failedSnapshots.delete(projectId))
|
|
132
133
|
signalHistory(projectId);
|
|
133
134
|
if (version && reason === "autosave")
|
|
@@ -144,7 +145,9 @@ export async function buildApp(config, db, options = {}) {
|
|
|
144
145
|
const collaboration = new CollaborationService(config, db, ({ projectId, userId, paths, edits, durationMs }) => {
|
|
145
146
|
const started = performance.now();
|
|
146
147
|
editRetry.save(projectId, edits);
|
|
147
|
-
|
|
148
|
+
// A coding agent's text reaches the source through the live room, so the
|
|
149
|
+
// autosave that persists it carries the flag of its edit segments.
|
|
150
|
+
recordHistory(projectId, userId, "autosave", paths, { hasAgent: edits.some((edit) => edit.hasAgent) });
|
|
148
151
|
metrics.record("collaboration.persist", durationMs + performance.now() - started);
|
|
149
152
|
});
|
|
150
153
|
const projectMutations = new ProjectMutationCoordinator(collaboration);
|
|
@@ -274,16 +277,21 @@ export async function buildApp(config, db, options = {}) {
|
|
|
274
277
|
: null;
|
|
275
278
|
const routePrefix = basePathPrefix(config.basePath);
|
|
276
279
|
await app.register(async (routes) => {
|
|
277
|
-
routes.addHook("onRequest", async (request) => {
|
|
278
|
-
const requestPath = withoutBasePath(config.basePath, request.url) ?? request.url;
|
|
280
|
+
routes.addHook("onRequest", async (request, reply) => {
|
|
281
|
+
const requestPath = (withoutBasePath(config.basePath, request.url) ?? request.url).split("?")[0];
|
|
279
282
|
if (requestPath.startsWith("/api/")
|
|
280
283
|
&& requestPath !== "/api/auth/login"
|
|
281
284
|
&& requestPath !== "/api/health"
|
|
282
285
|
&& requestPath !== "/api/config") {
|
|
283
286
|
const token = request.cookies.texlite_session;
|
|
284
|
-
|
|
287
|
+
const user = token ? currentUser(request, db) : null;
|
|
288
|
+
if (token && !user) {
|
|
285
289
|
db.prepare("DELETE FROM sessions WHERE id = ?").run(digestToken(token));
|
|
286
290
|
}
|
|
291
|
+
if (user?.must_change_password
|
|
292
|
+
&& !["/api/me", "/api/me/password", "/api/auth/logout"].includes(requestPath)) {
|
|
293
|
+
return apiError(reply, 403, "PASSWORD_CHANGE_REQUIRED");
|
|
294
|
+
}
|
|
287
295
|
}
|
|
288
296
|
});
|
|
289
297
|
registerSystemRoutes(routes, {
|
|
@@ -341,6 +349,7 @@ export async function buildApp(config, db, options = {}) {
|
|
|
341
349
|
recordHistory
|
|
342
350
|
});
|
|
343
351
|
registerWordCountRoutes(routes, { config, db, projectMutations, texcount });
|
|
352
|
+
registerTikzGalleryRoutes(routes, { config, db });
|
|
344
353
|
registerCompileRoutes(routes, { config, db, collaboration, projectMutations, compileCoordinator, metrics, pruneCompileRuns });
|
|
345
354
|
// The factory owns shared services and lifecycle hooks; route modules own endpoint behavior.
|
|
346
355
|
if (renderedIndex !== null) {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small least-recently-used cache bounded by entry count and bytes.
|
|
3
|
+
*
|
|
4
|
+
* The TTL does more than stop an entry from being reused: one unref'd timer,
|
|
5
|
+
* aimed at the earliest expiry, frees expired entries so an idle project's
|
|
6
|
+
* data does not stay resident until something else displaces it. The timer is
|
|
7
|
+
* not re-armed once the cache is empty and never keeps the process alive.
|
|
8
|
+
*/
|
|
9
|
+
export class BoundedExpiringCache {
|
|
10
|
+
limits;
|
|
11
|
+
entries = new Map();
|
|
12
|
+
totalBytes = 0;
|
|
13
|
+
sweep = null;
|
|
14
|
+
constructor(limits) {
|
|
15
|
+
this.limits = limits;
|
|
16
|
+
}
|
|
17
|
+
get(key) {
|
|
18
|
+
const entry = this.entries.get(key);
|
|
19
|
+
if (!entry || entry.expiresAt <= Date.now())
|
|
20
|
+
return undefined;
|
|
21
|
+
// Refresh recency so an actively used entry is evicted last.
|
|
22
|
+
this.entries.delete(key);
|
|
23
|
+
this.entries.set(key, entry);
|
|
24
|
+
if (this.limits.refreshOnHit)
|
|
25
|
+
entry.expiresAt = Date.now() + this.limits.ttlMs;
|
|
26
|
+
return entry.value;
|
|
27
|
+
}
|
|
28
|
+
set(key, value, bytes) {
|
|
29
|
+
this.delete(key);
|
|
30
|
+
if (bytes > this.limits.maxEntryBytes)
|
|
31
|
+
return;
|
|
32
|
+
this.entries.set(key, { value, bytes, expiresAt: Date.now() + this.limits.ttlMs });
|
|
33
|
+
this.totalBytes += bytes;
|
|
34
|
+
while (this.entries.size > this.limits.maxEntries || this.totalBytes > this.limits.maxBytes) {
|
|
35
|
+
const oldest = this.entries.keys().next().value;
|
|
36
|
+
if (oldest === undefined)
|
|
37
|
+
break;
|
|
38
|
+
this.delete(oldest);
|
|
39
|
+
}
|
|
40
|
+
this.scheduleSweep();
|
|
41
|
+
}
|
|
42
|
+
delete(key) {
|
|
43
|
+
const removed = this.entries.get(key);
|
|
44
|
+
if (!removed)
|
|
45
|
+
return;
|
|
46
|
+
this.entries.delete(key);
|
|
47
|
+
this.totalBytes -= removed.bytes;
|
|
48
|
+
}
|
|
49
|
+
stats() {
|
|
50
|
+
return { entries: this.entries.size, bytes: this.totalBytes };
|
|
51
|
+
}
|
|
52
|
+
scheduleSweep() {
|
|
53
|
+
if (this.sweep !== null || this.entries.size === 0)
|
|
54
|
+
return;
|
|
55
|
+
let earliest = Infinity;
|
|
56
|
+
for (const entry of this.entries.values())
|
|
57
|
+
earliest = Math.min(earliest, entry.expiresAt);
|
|
58
|
+
this.sweep = setTimeout(() => {
|
|
59
|
+
this.sweep = null;
|
|
60
|
+
const now = Date.now();
|
|
61
|
+
for (const [key, entry] of this.entries) {
|
|
62
|
+
if (entry.expiresAt <= now)
|
|
63
|
+
this.delete(key);
|
|
64
|
+
}
|
|
65
|
+
this.scheduleSweep();
|
|
66
|
+
}, Math.max(0, earliest - Date.now()));
|
|
67
|
+
this.sweep.unref();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -8,7 +8,7 @@ export function exportCitationFolder(db, userId, folder) {
|
|
|
8
8
|
const bundle = { format: CITATION_FOLDER_FORMAT, version: CITATION_FOLDER_VERSION, entries: [] };
|
|
9
9
|
let bytes = Buffer.byteLength(JSON.stringify(bundle), "utf8");
|
|
10
10
|
const rows = db.prepare(`SELECT entry.citation_key AS citationKey, entry.entry_type AS entryType,
|
|
11
|
-
entry.bibtex, entry.title, entry.authors, entry.year, entry.notes
|
|
11
|
+
entry.bibtex, entry.title, entry.authors, entry.year, entry.venue, entry.notes
|
|
12
12
|
FROM citation_library_entries entry JOIN citation_library_entry_collections link ON link.entry_id = entry.id
|
|
13
13
|
WHERE entry.user_id = ? AND link.collection_id = ? ORDER BY entry.citation_key COLLATE NOCASE, entry.id`)
|
|
14
14
|
.iterate(userId, folder.id);
|
|
@@ -53,16 +53,16 @@ export function registerCitationFolderImport(app, db) {
|
|
|
53
53
|
}
|
|
54
54
|
db.prepare("INSERT INTO citation_library_collections (id, user_id, name, created_at) VALUES (?, ?, ?, ?)").run(id, user.id, candidate, timestamp);
|
|
55
55
|
const upsert = db.prepare(`INSERT INTO citation_library_entries
|
|
56
|
-
(id, user_id, citation_key, entry_type, bibtex, title, authors, year, notes, revision, created_at, updated_at)
|
|
57
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)
|
|
56
|
+
(id, user_id, citation_key, entry_type, bibtex, title, authors, year, venue, notes, revision, created_at, updated_at)
|
|
57
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)
|
|
58
58
|
ON CONFLICT (user_id, citation_key) DO UPDATE SET citation_key = excluded.citation_key,
|
|
59
59
|
entry_type = excluded.entry_type, bibtex = excluded.bibtex, title = excluded.title,
|
|
60
|
-
authors = excluded.authors, year = excluded.year, notes = excluded.notes,
|
|
60
|
+
authors = excluded.authors, year = excluded.year, venue = excluded.venue, notes = excluded.notes,
|
|
61
61
|
revision = citation_library_entries.revision + 1, updated_at = excluded.updated_at
|
|
62
62
|
RETURNING id`);
|
|
63
63
|
const place = db.prepare("INSERT INTO citation_library_entry_collections (entry_id, collection_id) VALUES (?, ?)");
|
|
64
64
|
for (const entry of entries.values()) {
|
|
65
|
-
const saved = upsert.get(randomUUID(), user.id, entry.citationKey, entry.entryType, entry.bibtex, entry.title, entry.authors, entry.year, entry.notes, timestamp, timestamp);
|
|
65
|
+
const saved = upsert.get(randomUUID(), user.id, entry.citationKey, entry.entryType, entry.bibtex, entry.title, entry.authors, entry.year, entry.venue, entry.notes, timestamp, timestamp);
|
|
66
66
|
// Existing placements and tags are retained. Imported content replaces
|
|
67
67
|
// the user's shared entry, so all its placements see the updated notes.
|
|
68
68
|
place.run(saved.id, id);
|
|
@@ -29,6 +29,7 @@ export function citationInput(value) {
|
|
|
29
29
|
return {
|
|
30
30
|
bibtex: body.bibtex.trim(), citationKey: body.citationKey.trim(), entryType: body.entryType.trim(),
|
|
31
31
|
title: nullableText(body.title, 2048), authors: nullableText(body.authors, 2048), year: nullableText(body.year, 128),
|
|
32
|
+
venue: nullableText(body.venue, 2048),
|
|
32
33
|
notes: body.notes
|
|
33
34
|
};
|
|
34
35
|
}
|
package/dist/server/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ import { serve } from "./index.js";
|
|
|
13
13
|
import { processStatus, restartManaged, startManaged, stopManaged, streamLogs, waitForOnline } from "./pm2.js";
|
|
14
14
|
import { resolveConfigPath } from "./runtimePaths.js";
|
|
15
15
|
import { basePathHref } from "../shared/basePath.js";
|
|
16
|
+
import { TikzGalleryLibrary } from "./tikzGallery.js";
|
|
16
17
|
const HELP = `TexLite ${packageVersion()}
|
|
17
18
|
|
|
18
19
|
Usage:
|
|
@@ -211,7 +212,8 @@ async function requirements(options) {
|
|
|
211
212
|
function inspectDoctorApplication(config, configPath) {
|
|
212
213
|
const checks = [
|
|
213
214
|
{ name: "Configuration", status: "passed", detail: `Valid: ${configPath}` },
|
|
214
|
-
inspectClientAssets(config)
|
|
215
|
+
inspectClientAssets(config),
|
|
216
|
+
...(config.tikzGalleryEnabled ? [inspectTikzGallery(config)] : [])
|
|
215
217
|
];
|
|
216
218
|
let db = null;
|
|
217
219
|
try {
|
|
@@ -242,6 +244,14 @@ function inspectClientAssets(config) {
|
|
|
242
244
|
catch { /* Report a concise diagnostic below. */ }
|
|
243
245
|
return { name: "Client assets", status: "failed", detail: `Missing ${entry}; run \`npm run build\` or reinstall TexLite.` };
|
|
244
246
|
}
|
|
247
|
+
function inspectTikzGallery(config) {
|
|
248
|
+
const result = new TikzGalleryLibrary(config.tikzGalleryDir).catalog();
|
|
249
|
+
if (result.status === "ok")
|
|
250
|
+
return { name: "TikZ gallery", status: "passed", detail: `${result.catalog.items.length} figures: ${config.tikzGalleryDir}` };
|
|
251
|
+
return { name: "TikZ gallery", status: "failed", detail: result.status === "incompatible"
|
|
252
|
+
? `${config.tikzGalleryDir} has a catalog this TexLite cannot read; update TexLite or the add-on.`
|
|
253
|
+
: `No catalog in ${config.tikzGalleryDir}; clone the add-on there or set tikzGallery.enabled to false.` };
|
|
254
|
+
}
|
|
245
255
|
function errorMessage(error) {
|
|
246
256
|
return error instanceof Error ? error.message.replace(/\s+/g, " ").slice(0, 240) : String(error).slice(0, 240);
|
|
247
257
|
}
|
|
@@ -256,6 +266,7 @@ async function printConfig(options) {
|
|
|
256
266
|
dataDir: config.dataDir,
|
|
257
267
|
databasePath: config.databasePath,
|
|
258
268
|
projectsDir: config.projectsDir,
|
|
269
|
+
tikzGallery: { enabled: config.tikzGalleryEnabled, path: config.tikzGalleryDir },
|
|
259
270
|
clientDir: config.clientDir,
|
|
260
271
|
sessionDays: config.sessionDays,
|
|
261
272
|
compileTimeoutSeconds: config.compileTimeoutMs / 1000,
|
|
@@ -224,7 +224,8 @@ export class CollaborationService {
|
|
|
224
224
|
this.externalSources.delete(projectId); };
|
|
225
225
|
}
|
|
226
226
|
/** Apply disk edits as a real attributed Yjs delta, retaining pending human edits and anchors. */
|
|
227
|
-
|
|
227
|
+
/** `agent` marks text written by a coding agent on behalf of `userId`; it is recorded in edit history. */
|
|
228
|
+
importExternalText(projectId, filePath, content, userId, { agent = false } = {}) {
|
|
228
229
|
const room = this.rooms.get(projectId);
|
|
229
230
|
if (!room || !isCollaborativeTextFile(filePath))
|
|
230
231
|
return false;
|
|
@@ -247,7 +248,7 @@ export class CollaborationService {
|
|
|
247
248
|
offset += value.length;
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
|
-
}, { externalUserId: userId });
|
|
251
|
+
}, { externalUserId: userId, ...(agent ? { agent: true } : {}) });
|
|
251
252
|
this.bumpFiles(room, { kind: "update", path: filePath });
|
|
252
253
|
return true;
|
|
253
254
|
}
|
|
@@ -1033,7 +1034,7 @@ export class CollaborationService {
|
|
|
1033
1034
|
this.recordEditStep(room, filePath, connection.user.id, event, before, after, this.activeFormatLease(room, filePath)?.connection === connection);
|
|
1034
1035
|
}
|
|
1035
1036
|
if (isExternalOrigin(transaction.origin) && before !== after) {
|
|
1036
|
-
this.recordEditStep(room, filePath, transaction.origin.externalUserId, event, before, after);
|
|
1037
|
+
this.recordEditStep(room, filePath, transaction.origin.externalUserId, event, before, after, false, transaction.origin.agent === true);
|
|
1037
1038
|
}
|
|
1038
1039
|
if (before !== after) {
|
|
1039
1040
|
const edits = [];
|
|
@@ -1077,7 +1078,7 @@ export class CollaborationService {
|
|
|
1077
1078
|
* segment is only handed to the history service after `flushRoom()` has
|
|
1078
1079
|
* made the matching source content durable.
|
|
1079
1080
|
*/
|
|
1080
|
-
recordEditStep(room, filePath, authorId, event, before, after, formatted = false) {
|
|
1081
|
+
recordEditStep(room, filePath, authorId, event, before, after, formatted = false, hasAgent = false) {
|
|
1081
1082
|
const spans = editSpansFromYDelta(event.delta, before, after);
|
|
1082
1083
|
if (!spans.length)
|
|
1083
1084
|
return;
|
|
@@ -1095,6 +1096,8 @@ export class CollaborationService {
|
|
|
1095
1096
|
&& previous.filePath === filePath
|
|
1096
1097
|
&& previous.authorId === authorId
|
|
1097
1098
|
&& previous.kind === kind
|
|
1099
|
+
// Agent and direct edits by the same user stay in separate segments.
|
|
1100
|
+
&& Boolean(previous.hasAgent) === hasAgent
|
|
1098
1101
|
&& previous.afterHash === step.beforeHash
|
|
1099
1102
|
&& Number.isFinite(previousTime)
|
|
1100
1103
|
&& Date.parse(createdAt) - previousTime <= EDIT_SEGMENT_IDLE_MS) {
|
|
@@ -1107,6 +1110,7 @@ export class CollaborationService {
|
|
|
1107
1110
|
filePath,
|
|
1108
1111
|
authorId,
|
|
1109
1112
|
kind,
|
|
1113
|
+
...(hasAgent ? { hasAgent: true } : {}),
|
|
1110
1114
|
beforeHash: step.beforeHash,
|
|
1111
1115
|
afterHash: step.afterHash,
|
|
1112
1116
|
createdAt,
|
package/dist/server/config.js
CHANGED
|
@@ -14,6 +14,9 @@ export const CONFIG_DEFAULTS = {
|
|
|
14
14
|
basePath: ROOT_BASE_PATH,
|
|
15
15
|
dataDir: defaultDataDirectory(),
|
|
16
16
|
clientDir: packageClientDirectory(),
|
|
17
|
+
tikzGalleryEnabled: false,
|
|
18
|
+
/** Relative to the configuration file, like a relative storage.dataDir. */
|
|
19
|
+
tikzGalleryPath: path.join("addon", "texlite-tikz"),
|
|
17
20
|
sessionDays: 14,
|
|
18
21
|
compileTimeoutSeconds: 600,
|
|
19
22
|
maxCompileJobs: 10,
|
|
@@ -93,6 +96,8 @@ export function loadConfig(configPathOverride) {
|
|
|
93
96
|
databasePath: path.join(dataDir, "texlite.db"),
|
|
94
97
|
projectsDir: path.join(dataDir, "projects"),
|
|
95
98
|
clientDir,
|
|
99
|
+
tikzGalleryEnabled: fileConfig.tikzGallery?.enabled ?? CONFIG_DEFAULTS.tikzGalleryEnabled,
|
|
100
|
+
tikzGalleryDir: resolveConfiguredPath("tikzGallery.path", fileConfig.tikzGallery?.path ?? CONFIG_DEFAULTS.tikzGalleryPath, configDirectory),
|
|
96
101
|
sessionDays: integerSetting("sessionDays", process.env.TEXLITE_SESSION_DAYS, fileConfig.sessionDays, CONFIG_DEFAULTS.sessionDays, CONFIG_LIMITS.sessionDays),
|
|
97
102
|
compileTimeoutMs: compileTimeoutSeconds * 1000,
|
|
98
103
|
maxCompileJobs,
|
|
@@ -210,6 +215,11 @@ function validateFileConfig(config) {
|
|
|
210
215
|
optionalString(server?.basePath, "server.basePath", { min: 1, max: 1_024 });
|
|
211
216
|
const storage = optionalSection(config.storage, "storage");
|
|
212
217
|
optionalString(storage?.dataDir, "storage.dataDir", { min: 1, max: 4_096 });
|
|
218
|
+
const tikzGallery = optionalSection(config.tikzGallery, "tikzGallery");
|
|
219
|
+
if (tikzGallery && Object.prototype.hasOwnProperty.call(tikzGallery, "enabled") && typeof tikzGallery.enabled !== "boolean") {
|
|
220
|
+
throw configurationError("tikzGallery.enabled", "must be true or false");
|
|
221
|
+
}
|
|
222
|
+
optionalString(tikzGallery?.path, "tikzGallery.path", { min: 1, max: 4_096 });
|
|
213
223
|
const uploads = optionalSection(config.uploads, "uploads");
|
|
214
224
|
optionalInteger(uploads?.maxFileSizeMB, "uploads.maxFileSizeMB", CONFIG_LIMITS.maxFileSizeMB);
|
|
215
225
|
const pdf = optionalSection(config.pdf, "pdf");
|
package/dist/server/db.js
CHANGED
|
@@ -174,6 +174,29 @@ const databaseMigrations = [
|
|
|
174
174
|
if (missingColumn(db, "citation_library_entries", "notes")) {
|
|
175
175
|
db.exec("ALTER TABLE citation_library_entries ADD COLUMN notes TEXT NOT NULL DEFAULT ''");
|
|
176
176
|
}
|
|
177
|
+
} },
|
|
178
|
+
{ version: 20, name: "add_user_git_identity", apply: (db) => {
|
|
179
|
+
if (missingColumn(db, "user_github_settings", "git_username")) {
|
|
180
|
+
db.exec("ALTER TABLE user_github_settings ADD COLUMN git_username TEXT");
|
|
181
|
+
}
|
|
182
|
+
if (missingColumn(db, "user_github_settings", "git_email")) {
|
|
183
|
+
db.exec("ALTER TABLE user_github_settings ADD COLUMN git_email TEXT");
|
|
184
|
+
}
|
|
185
|
+
} },
|
|
186
|
+
{ version: 21, name: "add_citation_venue", apply: (db) => {
|
|
187
|
+
if (missingColumn(db, "citation_library_entries", "venue")) {
|
|
188
|
+
db.exec("ALTER TABLE citation_library_entries ADD COLUMN venue TEXT");
|
|
189
|
+
}
|
|
190
|
+
} },
|
|
191
|
+
// A coding agent took part in a snapshot or an edit segment. Rows written
|
|
192
|
+
// before this migration cannot be classified reliably and stay false.
|
|
193
|
+
{ version: 22, name: "add_agent_history_flags", apply: (db) => {
|
|
194
|
+
if (missingColumn(db, "project_history_versions", "has_agent")) {
|
|
195
|
+
db.exec("ALTER TABLE project_history_versions ADD COLUMN has_agent INTEGER NOT NULL DEFAULT 0");
|
|
196
|
+
}
|
|
197
|
+
if (missingColumn(db, "project_edit_segments", "has_agent")) {
|
|
198
|
+
db.exec("ALTER TABLE project_edit_segments ADD COLUMN has_agent INTEGER NOT NULL DEFAULT 0");
|
|
199
|
+
}
|
|
177
200
|
} }
|
|
178
201
|
];
|
|
179
202
|
function migrateGitHubTokensToUsers(db) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash, randomUUID } from "node:crypto";
|
|
2
2
|
import { CONFIG_DEFAULTS } from "./config.js";
|
|
3
3
|
import { safeRelativePath } from "./files.js";
|
|
4
|
+
import { collectAgentChanges } from "./agentChanges.js";
|
|
4
5
|
/** Store reversible replacements; only selection-history presentation is shortened. */
|
|
5
6
|
export function createEditHistorySpan(beforeStart, afterStart, deleted, inserted) {
|
|
6
7
|
return {
|
|
@@ -10,8 +11,13 @@ export function createEditHistorySpan(beforeStart, afterStart, deleted, inserted
|
|
|
10
11
|
deletedPreview: deleted, insertedPreview: inserted, truncated: false
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
/** Agent-change mapping walks at most this many of a file's newest segments. */
|
|
15
|
+
const MAX_AGENT_CHANGE_CHAIN_SEGMENTS = 2_000;
|
|
13
16
|
const DEFAULT_RESULT_LIMIT = 60;
|
|
14
|
-
|
|
17
|
+
/** Edits separated by at most this pause belong to one displayed entry. */
|
|
18
|
+
const EDIT_SESSION_GAP_MS = 5 * 60 * 1_000;
|
|
19
|
+
/** A long continuous session is still split, so earlier states stay visible. */
|
|
20
|
+
const MAX_EDIT_ENTRY_SPAN_MS = 30 * 60 * 1_000;
|
|
15
21
|
const MAX_PASSAGE_PREVIEW_CHARS = 6_000;
|
|
16
22
|
export const DEFAULT_EDIT_HISTORY_MAX_STORAGE_BYTES = CONFIG_DEFAULTS.editHistoryMaxStorageMB * 1024 * 1024;
|
|
17
23
|
/**
|
|
@@ -49,11 +55,11 @@ export class ProjectEditHistoryService {
|
|
|
49
55
|
segments.push({ segment, stepsJson, stepsBytes });
|
|
50
56
|
}
|
|
51
57
|
const insert = this.db.prepare(`INSERT INTO project_edit_segments
|
|
52
|
-
(id, project_id, file_path, author_id, kind, before_hash, after_hash, steps_json, created_at, updated_at, steps_bytes)
|
|
53
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
58
|
+
(id, project_id, file_path, author_id, kind, has_agent, before_hash, after_hash, steps_json, created_at, updated_at, steps_bytes)
|
|
59
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
54
60
|
this.db.transaction(() => {
|
|
55
61
|
for (const { segment, stepsJson, stepsBytes } of segments) {
|
|
56
|
-
insert.run(randomUUID(), projectId, segment.filePath, segment.authorId, segment.kind, segment.beforeHash, segment.afterHash, stepsJson, segment.createdAt, segment.updatedAt, stepsBytes);
|
|
62
|
+
insert.run(randomUUID(), projectId, segment.filePath, segment.authorId, segment.kind, segment.hasAgent ? 1 : 0, segment.beforeHash, segment.afterHash, stepsJson, segment.createdAt, segment.updatedAt, stepsBytes);
|
|
57
63
|
}
|
|
58
64
|
for (const segment of skipped)
|
|
59
65
|
this.recordRetentionBoundary(projectId, segment.filePath, segment.afterHash, segment.updatedAt);
|
|
@@ -175,8 +181,11 @@ export class ProjectEditHistoryService {
|
|
|
175
181
|
break;
|
|
176
182
|
}
|
|
177
183
|
if (relevant) {
|
|
178
|
-
if (openEntry &&
|
|
179
|
-
mergeSelectionHistoryEntry(openEntry, row);
|
|
184
|
+
if (openEntry && canMergeIntoEntry(openEntry, row)) {
|
|
185
|
+
mergeSelectionHistoryEntry(openEntry, row, "session");
|
|
186
|
+
}
|
|
187
|
+
else if (openEntry && hasSameSelectionContent(openEntry, afterPassage)) {
|
|
188
|
+
mergeSelectionHistoryEntry(openEntry, row, "same-text");
|
|
180
189
|
}
|
|
181
190
|
else {
|
|
182
191
|
if (openEntry) {
|
|
@@ -203,6 +212,40 @@ export class ProjectEditHistoryService {
|
|
|
203
212
|
}
|
|
204
213
|
return { entries, baseline, hasMore: !exhaustedRows, chainComplete };
|
|
205
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Coding-agent changes made for `userId` in one file, mapped to `currentSource`.
|
|
217
|
+
* Only the newest part of the chain is walked; a gap in it (an unrecorded
|
|
218
|
+
* replacement, a restore, retention) drops everything before the gap, and a
|
|
219
|
+
* chain that does not end at the current source yields nothing rather than
|
|
220
|
+
* misplaced ranges.
|
|
221
|
+
*/
|
|
222
|
+
agentChanges(projectId, filePathInput, currentSource, userId) {
|
|
223
|
+
const filePath = safeRelativePath(filePathInput);
|
|
224
|
+
const rows = this.db.prepare(`SELECT id, author_id, has_agent, before_hash, after_hash, steps_json
|
|
225
|
+
FROM project_edit_segments WHERE project_id = ? AND file_path = ?
|
|
226
|
+
ORDER BY updated_at DESC, rowid DESC LIMIT ?`)
|
|
227
|
+
.all(projectId, filePath, MAX_AGENT_CHANGE_CHAIN_SEGMENTS).reverse();
|
|
228
|
+
let steps = [];
|
|
229
|
+
let expectedHash = null;
|
|
230
|
+
for (const row of rows) {
|
|
231
|
+
const parsed = parseSteps(row.steps_json);
|
|
232
|
+
const valid = parsed.length > 0 && parsed[0].beforeHash === row.before_hash && parsed.at(-1).afterHash === row.after_hash
|
|
233
|
+
&& parsed.every((step, index) => index === 0 || parsed[index - 1].afterHash === step.beforeHash);
|
|
234
|
+
// A gap before this row, or a row that cannot be replayed, means earlier
|
|
235
|
+
// positions cannot be carried forward.
|
|
236
|
+
if (!valid || (expectedHash !== null && row.before_hash !== expectedHash))
|
|
237
|
+
steps = [];
|
|
238
|
+
expectedHash = row.after_hash;
|
|
239
|
+
if (!valid)
|
|
240
|
+
continue;
|
|
241
|
+
const agent = Boolean(row.has_agent) && row.author_id === userId;
|
|
242
|
+
parsed.forEach((step, index) => steps.push({ id: `${row.id}:${index}`, agent, createdAt: step.createdAt, spans: step.spans }));
|
|
243
|
+
}
|
|
244
|
+
if (expectedHash !== hashText(currentSource))
|
|
245
|
+
return [];
|
|
246
|
+
const first = steps.findIndex((step) => step.agent);
|
|
247
|
+
return first < 0 ? [] : collectAgentChanges(steps.slice(first), currentSource);
|
|
248
|
+
}
|
|
206
249
|
reachedRetentionBoundary(projectId, filePath, expectedHash) {
|
|
207
250
|
const row = this.db.prepare(`SELECT after_hash FROM project_edit_history_boundaries
|
|
208
251
|
WHERE project_id = ? AND file_path = ?`).get(projectId, filePath);
|
|
@@ -218,15 +261,26 @@ function createSelectionHistoryEntry(row, afterPassage) {
|
|
|
218
261
|
updatedAt: row.updated_at,
|
|
219
262
|
authorKeys: new Set([authorKey(row)]),
|
|
220
263
|
authors: [authorFromRow(row)],
|
|
264
|
+
hasAgent: Boolean(row.has_agent),
|
|
221
265
|
content: content.text,
|
|
222
266
|
contentTruncated: content.truncated
|
|
223
267
|
};
|
|
224
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Rows are visited newest first. A row joins the open entry when it is part of
|
|
271
|
+
* the same editing session (no pause longer than the gap before the entry's
|
|
272
|
+
* oldest edit, and the entry stays within its maximum span) and when it is the
|
|
273
|
+
* same kind of change: agent and direct edits are shown separately.
|
|
274
|
+
*/
|
|
225
275
|
function canMergeIntoEntry(entry, row) {
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
276
|
+
const newest = Date.parse(entry.updatedAt);
|
|
277
|
+
const oldest = Date.parse(entry.createdAt);
|
|
278
|
+
const rowEnd = Date.parse(row.updated_at);
|
|
279
|
+
const rowStart = Date.parse(row.created_at);
|
|
280
|
+
return [newest, oldest, rowEnd, rowStart].every(Number.isFinite)
|
|
281
|
+
&& Boolean(row.has_agent) === entry.hasAgent
|
|
282
|
+
&& oldest >= rowEnd && oldest - rowEnd <= EDIT_SESSION_GAP_MS
|
|
283
|
+
&& newest - rowStart <= MAX_EDIT_ENTRY_SPAN_MS;
|
|
230
284
|
}
|
|
231
285
|
/**
|
|
232
286
|
* A history row can be relevant because it moved a selection boundary even
|
|
@@ -241,8 +295,13 @@ function hasSameSelectionContent(entry, passage) {
|
|
|
241
295
|
&& candidate.text !== null && !candidate.truncated
|
|
242
296
|
&& entry.content === candidate.text;
|
|
243
297
|
}
|
|
244
|
-
function mergeSelectionHistoryEntry(entry, row) {
|
|
298
|
+
function mergeSelectionHistoryEntry(entry, row, reason) {
|
|
245
299
|
entry.createdAt = row.created_at;
|
|
300
|
+
// Session merges only join rows of the same kind, so the flag is unchanged.
|
|
301
|
+
// An older row folded in because the entry's newer rows left the selected
|
|
302
|
+
// text as it produced it is the row that wrote that text: its flag decides.
|
|
303
|
+
if (reason === "same-text")
|
|
304
|
+
entry.hasAgent = Boolean(row.has_agent);
|
|
246
305
|
if (!entry.authorKeys.has(authorKey(row))) {
|
|
247
306
|
entry.authorKeys.add(authorKey(row));
|
|
248
307
|
entry.authors.push(authorFromRow(row));
|
|
@@ -332,7 +391,7 @@ function validateSpan(span) {
|
|
|
332
391
|
|| typeof span.truncated !== "boolean")
|
|
333
392
|
throw new Error("Invalid edit history span");
|
|
334
393
|
}
|
|
335
|
-
function parseSteps(input) {
|
|
394
|
+
export function parseSteps(input) {
|
|
336
395
|
try {
|
|
337
396
|
const parsed = JSON.parse(input);
|
|
338
397
|
if (!Array.isArray(parsed))
|