texlite 0.20.0 → 0.22.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 +215 -35
- package/OPERATIONS.md +2 -2
- package/README.md +48 -44
- package/README.zh-CN.md +42 -36
- package/dist/client/assets/AdminUsers-DepqkT6m.js +1 -0
- package/dist/client/assets/AdminUsers-DepqkT6m.js.br +0 -0
- package/dist/client/assets/AdminUsers-DepqkT6m.js.gz +0 -0
- package/dist/client/assets/{AgentIcon-dCMgWJG-.css → AgentIcon-DeoZDwgh.css} +1 -1
- package/dist/client/assets/AgentIcon-DeoZDwgh.css.br +0 -0
- package/dist/client/assets/AgentIcon-DeoZDwgh.css.gz +0 -0
- package/dist/client/assets/{AgentManagement-rIYtm4Bo.js → AgentManagement-DlV6tHez.js} +1 -1
- package/dist/client/assets/AgentManagement-DlV6tHez.js.br +0 -0
- package/dist/client/assets/AgentManagement-DlV6tHez.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-CvOz5X_j.js +2 -0
- package/dist/client/assets/AgentTerminal-CvOz5X_j.js.br +0 -0
- package/dist/client/assets/AgentTerminal-CvOz5X_j.js.gz +0 -0
- package/dist/client/assets/{AgentTerminalSurface-B2rwONYs.js → AgentTerminalSurface-COqg_GdK.js} +1 -1
- package/dist/client/assets/AgentTerminalSurface-COqg_GdK.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-COqg_GdK.js.gz +0 -0
- package/dist/client/assets/{AvatarSettingsDialog-DplRpiJJ.js → AvatarSettingsDialog-C8WQhZBK.js} +1 -1
- package/dist/client/assets/AvatarSettingsDialog-C8WQhZBK.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-C8WQhZBK.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-SpudGDwi.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js +3 -0
- package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-D3CjBD0p.js +1 -0
- package/dist/client/assets/Dashboard-CD1w42mA.js +5 -0
- package/dist/client/assets/Dashboard-CD1w42mA.js.br +0 -0
- package/dist/client/assets/Dashboard-CD1w42mA.js.gz +0 -0
- package/dist/client/assets/GitDialog-DGzZ3GRj.js +4 -0
- package/dist/client/assets/GitDialog-DGzZ3GRj.js.br +0 -0
- package/dist/client/assets/GitDialog-DGzZ3GRj.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js +1 -0
- package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-DTZxCgyT.js +8 -0
- package/dist/client/assets/HistoryDialog-DTZxCgyT.js.br +0 -0
- package/dist/client/assets/HistoryDialog-DTZxCgyT.js.gz +0 -0
- package/dist/client/assets/InfoPopover-Ba7GvcuW.js +1 -0
- package/dist/client/assets/LatexEditor-Boc-45KL.js +25 -0
- package/dist/client/assets/LatexEditor-Boc-45KL.js.br +0 -0
- package/dist/client/assets/LatexEditor-Boc-45KL.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-BH2iwvle.js +1 -0
- package/dist/client/assets/MarkdownPreview-BH2iwvle.js.br +0 -0
- package/dist/client/assets/MarkdownPreview-BH2iwvle.js.gz +0 -0
- package/dist/client/assets/PdfPreview-CIOM7sbu.js +1 -0
- package/dist/client/assets/PdfPreview-CIOM7sbu.js.br +0 -0
- package/dist/client/assets/PdfPreview-CIOM7sbu.js.gz +0 -0
- package/dist/client/assets/{ProjectIconPickerDialog-B9_XvdIC.js → ProjectIconPickerDialog-Bfkaxcnh.js} +1 -1
- package/dist/client/assets/ProjectIconPickerDialog-Bfkaxcnh.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-Bfkaxcnh.js.gz +0 -0
- package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js +1 -0
- package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js.br +0 -0
- package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-ChXx_cmP.js +4 -0
- package/dist/client/assets/ProjectSettings-ChXx_cmP.js.br +0 -0
- package/dist/client/assets/ProjectSettings-ChXx_cmP.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js +25 -0
- package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js +1 -0
- package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js.gz +0 -0
- package/dist/client/assets/ReadOnlySource-DKcmDg0e.js +2 -0
- package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js +3 -0
- package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-l8GSYTm-.js +2 -0
- package/dist/client/assets/SharedProjectPage-l8GSYTm-.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-l8GSYTm-.js.gz +0 -0
- package/dist/client/assets/{SystemMetricsDialog-BExTHWxg.js → SystemMetricsDialog-DkmBA4o4.js} +1 -1
- package/dist/client/assets/SystemMetricsDialog-DkmBA4o4.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-DkmBA4o4.js.gz +0 -0
- package/dist/client/assets/{TagColorSelect-CzPUDAny.js → TagColorSelect-e-Tq5V3H.js} +1 -1
- package/dist/client/assets/TagManagementDialog-BM1MRuwh.js +1 -0
- package/dist/client/assets/TagManagementDialog-BM1MRuwh.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BM1MRuwh.js.gz +0 -0
- package/dist/client/assets/TagMarquee-BLmCTTCt.js +1 -0
- package/dist/client/assets/ThemeSwitcher-dcvtWVCO.js +1 -0
- package/dist/client/assets/{WordCountDialog-CgDcnPdJ.js → WordCountDialog-DI0Jv-fg.js} +1 -1
- package/dist/client/assets/WordCountDialog-DI0Jv-fg.js.br +0 -0
- package/dist/client/assets/WordCountDialog-DI0Jv-fg.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-BeOSrdut.js → chktex-BrzPYHey.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-C9O-A_C4.js +1 -0
- package/dist/client/assets/dist-C9O-A_C4.js.br +0 -0
- package/dist/client/assets/dist-C9O-A_C4.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-Dtn6w-qA.js +13 -0
- package/dist/client/assets/i18n-Dtn6w-qA.js.br +0 -0
- package/dist/client/assets/i18n-Dtn6w-qA.js.gz +0 -0
- package/dist/client/assets/index-BbU2fbRw.css +1 -0
- package/dist/client/assets/index-BbU2fbRw.css.br +0 -0
- package/dist/client/assets/index-BbU2fbRw.css.gz +0 -0
- package/dist/client/assets/index-CPR6YZEf.js +2 -0
- package/dist/client/assets/index-CPR6YZEf.js.br +0 -0
- package/dist/client/assets/index-CPR6YZEf.js.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/plus-Cei21TlT.js +1 -0
- package/dist/client/assets/relativeTime-mmWGtWRR.js +1 -0
- package/dist/client/assets/relativeTime-mmWGtWRR.js.br +0 -0
- package/dist/client/assets/relativeTime-mmWGtWRR.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-BVDvDKeP.js +1 -0
- package/dist/client/assets/sourceCursorStore-BVDvDKeP.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-BVDvDKeP.js.gz +0 -0
- package/dist/client/assets/{spellCheck-P-fMO4iR.js → spellCheck-BTyLQAFH.js} +1 -1
- package/dist/client/assets/spellCheck-BTyLQAFH.js.br +0 -0
- package/dist/client/assets/spellCheck-BTyLQAFH.js.gz +0 -0
- package/dist/client/assets/{textLanguageSupport-BSIE7WPM.js → textLanguageSupport-Ck8lMOWz.js} +1 -1
- package/dist/client/assets/textLanguages-CwWstpJ5.js +78 -0
- 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-Ba_yhkrl.js +1 -0
- package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js.br +0 -0
- package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js.gz +0 -0
- package/dist/client/assets/{vimSupport-BwIAfLU0.js → vimSupport-C-WiMLjc.js} +6 -6
- 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/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 +7 -27
- 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/collaboration.js +39 -5
- 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 +9 -0
- package/dist/server/locales/zh-Hant.js +5 -0
- package/dist/server/projectPreview.js +8 -12
- package/dist/server/projectReferences.js +110 -9
- package/dist/server/projectReplace.js +67 -0
- package/dist/server/projectSearch.js +72 -0
- package/dist/server/routes/auth.js +3 -0
- package/dist/server/routes/citations.js +28 -61
- package/dist/server/routes/commentSuggestions.js +1 -1
- package/dist/server/routes/comments.js +8 -3
- package/dist/server/routes/projectGit.js +10 -0
- package/dist/server/routes/projectHistory.js +42 -0
- package/dist/server/routes/projectSearch.js +72 -0
- package/dist/server/routes/projects.js +1 -2
- package/dist/server/routes/users.js +2 -2
- 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/projectSearch.js +17 -0
- package/dist/shared/textDiff.js +36 -1
- package/package.json +1 -1
- package/dist/client/assets/AdminUsers-BghRo_hC.js +0 -1
- package/dist/client/assets/AdminUsers-BghRo_hC.js.br +0 -0
- package/dist/client/assets/AdminUsers-BghRo_hC.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-rIYtm4Bo.js.br +0 -0
- package/dist/client/assets/AgentManagement-rIYtm4Bo.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-BEjiw51y.js +0 -2
- package/dist/client/assets/AgentTerminal-BEjiw51y.js.br +0 -0
- package/dist/client/assets/AgentTerminal-BEjiw51y.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-B2rwONYs.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-B2rwONYs.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-DplRpiJJ.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-DplRpiJJ.js.gz +0 -0
- package/dist/client/assets/CitationBibtexEditor-BnK6nZPi.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js +0 -3
- package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js.gz +0 -0
- package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js +0 -36
- package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js.br +0 -0
- package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js.gz +0 -0
- package/dist/client/assets/Dashboard-Dcl0Y_C3.js +0 -5
- package/dist/client/assets/Dashboard-Dcl0Y_C3.js.br +0 -0
- package/dist/client/assets/Dashboard-Dcl0Y_C3.js.gz +0 -0
- package/dist/client/assets/GitDialog-BeYvUCDv.js +0 -3
- package/dist/client/assets/GitDialog-BeYvUCDv.js.br +0 -0
- package/dist/client/assets/GitDialog-BeYvUCDv.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js +0 -1
- package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-B-C4Zaef.js +0 -8
- package/dist/client/assets/HistoryDialog-B-C4Zaef.js.br +0 -0
- package/dist/client/assets/HistoryDialog-B-C4Zaef.js.gz +0 -0
- package/dist/client/assets/InfoPopover-Dkz742vJ.js +0 -1
- package/dist/client/assets/LatexEditor-CohUJrGD.js +0 -25
- package/dist/client/assets/LatexEditor-CohUJrGD.js.br +0 -0
- package/dist/client/assets/LatexEditor-CohUJrGD.js.gz +0 -0
- package/dist/client/assets/PdfPreview-BvJxduy3.js +0 -1
- package/dist/client/assets/PdfPreview-BvJxduy3.js.br +0 -0
- package/dist/client/assets/PdfPreview-BvJxduy3.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-B9_XvdIC.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-B9_XvdIC.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-D8uH3PqQ.js +0 -4
- package/dist/client/assets/ProjectSettings-D8uH3PqQ.js.br +0 -0
- package/dist/client/assets/ProjectSettings-D8uH3PqQ.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js +0 -31
- package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js +0 -1
- package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js.gz +0 -0
- package/dist/client/assets/ReadOnlySource-BZ7WYQO7.js +0 -2
- package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js +0 -3
- package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js.gz +0 -0
- package/dist/client/assets/SharedProjectPage-DJjR-D8d.js +0 -2
- package/dist/client/assets/SharedProjectPage-DJjR-D8d.js.br +0 -0
- package/dist/client/assets/SharedProjectPage-DJjR-D8d.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-BExTHWxg.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-BExTHWxg.js.gz +0 -0
- package/dist/client/assets/TagManagementDialog-BBOpD_62.js +0 -1
- package/dist/client/assets/TagManagementDialog-BBOpD_62.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-BBOpD_62.js.gz +0 -0
- package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js +0 -1
- package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js.br +0 -0
- package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-CgDcnPdJ.js.br +0 -0
- package/dist/client/assets/WordCountDialog-CgDcnPdJ.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/dist-Bcdl4EAC.js +0 -1
- package/dist/client/assets/dist-Bcdl4EAC.js.br +0 -0
- package/dist/client/assets/dist-Bcdl4EAC.js.gz +0 -0
- package/dist/client/assets/editor-JqCouYk8.js +0 -14
- package/dist/client/assets/editor-JqCouYk8.js.br +0 -0
- package/dist/client/assets/editor-JqCouYk8.js.gz +0 -0
- package/dist/client/assets/editor-languages-CRI2h3Fj.js +0 -36
- package/dist/client/assets/editor-languages-CRI2h3Fj.js.br +0 -0
- package/dist/client/assets/editor-languages-CRI2h3Fj.js.gz +0 -0
- package/dist/client/assets/editorThemeExtension-BNWs0sHh.js +0 -1
- package/dist/client/assets/editorThemeExtension-BNWs0sHh.js.br +0 -0
- package/dist/client/assets/editorThemeExtension-BNWs0sHh.js.gz +0 -0
- package/dist/client/assets/eye-BnslGpqB.js +0 -1
- package/dist/client/assets/i18n-Bv4wFb8D.js +0 -13
- package/dist/client/assets/i18n-Bv4wFb8D.js.br +0 -0
- package/dist/client/assets/i18n-Bv4wFb8D.js.gz +0 -0
- package/dist/client/assets/index-Bdb2ITID.js +0 -2
- package/dist/client/assets/index-Bdb2ITID.js.br +0 -0
- package/dist/client/assets/index-Bdb2ITID.js.gz +0 -0
- package/dist/client/assets/index-wqKiaXZr.css +0 -1
- package/dist/client/assets/index-wqKiaXZr.css.br +0 -0
- package/dist/client/assets/index-wqKiaXZr.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-DlKXhH_h.js +0 -1
- package/dist/client/assets/relativeTime-DlKXhH_h.js.br +0 -0
- package/dist/client/assets/relativeTime-DlKXhH_h.js.gz +0 -0
- package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js +0 -1
- package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js.br +0 -0
- package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js.gz +0 -0
- package/dist/client/assets/spellCheck-P-fMO4iR.js.br +0 -0
- package/dist/client/assets/spellCheck-P-fMO4iR.js.gz +0 -0
- package/dist/client/assets/tags-GrE3ZIQN.js +0 -1
- package/dist/client/assets/textLanguages-DAJ1OXJA.js +0 -78
- package/dist/client/assets/textLanguages-DAJ1OXJA.js.br +0 -0
- package/dist/client/assets/textLanguages-DAJ1OXJA.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-BwIAfLU0.js.br +0 -0
- package/dist/client/assets/vimSupport-BwIAfLU0.js.gz +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js → AgentIcon-CA-PfOka.js} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.br → AgentIcon-CA-PfOka.js.br} +0 -0
- /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.gz → AgentIcon-CA-PfOka.js.gz} +0 -0
package/dist/server/app.js
CHANGED
|
@@ -32,6 +32,7 @@ import { registerCommentRoutes } from "./routes/comments.js";
|
|
|
32
32
|
import { registerProjectMemberRoutes } from "./routes/projectMembers.js";
|
|
33
33
|
import { registerProjectViewLinkRoutes } from "./routes/projectViewLinks.js";
|
|
34
34
|
import { registerProjectFileRoutes } from "./routes/projectFiles.js";
|
|
35
|
+
import { registerProjectSearchRoutes } from "./routes/projectSearch.js";
|
|
35
36
|
import { registerProjectReferenceRoutes } from "./routes/projectReferences.js";
|
|
36
37
|
import { registerProjectHistoryRoutes } from "./routes/projectHistory.js";
|
|
37
38
|
import { registerProjectGitRoutes } from "./routes/projectGit.js";
|
|
@@ -124,9 +125,9 @@ export async function buildApp(config, db, options = {}) {
|
|
|
124
125
|
app.log.error({ err: error, projectId: id }, "Failed to record project edit history");
|
|
125
126
|
signalHistory(id);
|
|
126
127
|
});
|
|
127
|
-
const recordHistory = (projectId, userId, reason, paths) => {
|
|
128
|
+
const recordHistory = (projectId, userId, reason, paths, { hasAgent = false } = {}) => {
|
|
128
129
|
try {
|
|
129
|
-
const version = history.record(projectId, userId, reason, failedSnapshots.has(projectId) ? undefined : paths, { deferRetention: reason === "autosave" });
|
|
130
|
+
const version = history.record(projectId, userId, reason, failedSnapshots.has(projectId) ? undefined : paths, { deferRetention: reason === "autosave", hasAgent });
|
|
130
131
|
if (failedSnapshots.delete(projectId))
|
|
131
132
|
signalHistory(projectId);
|
|
132
133
|
if (version && reason === "autosave")
|
|
@@ -143,7 +144,9 @@ export async function buildApp(config, db, options = {}) {
|
|
|
143
144
|
const collaboration = new CollaborationService(config, db, ({ projectId, userId, paths, edits, durationMs }) => {
|
|
144
145
|
const started = performance.now();
|
|
145
146
|
editRetry.save(projectId, edits);
|
|
146
|
-
|
|
147
|
+
// A coding agent's text reaches the source through the live room, so the
|
|
148
|
+
// autosave that persists it carries the flag of its edit segments.
|
|
149
|
+
recordHistory(projectId, userId, "autosave", paths, { hasAgent: edits.some((edit) => edit.hasAgent) });
|
|
147
150
|
metrics.record("collaboration.persist", durationMs + performance.now() - started);
|
|
148
151
|
});
|
|
149
152
|
const projectMutations = new ProjectMutationCoordinator(collaboration);
|
|
@@ -273,16 +276,21 @@ export async function buildApp(config, db, options = {}) {
|
|
|
273
276
|
: null;
|
|
274
277
|
const routePrefix = basePathPrefix(config.basePath);
|
|
275
278
|
await app.register(async (routes) => {
|
|
276
|
-
routes.addHook("onRequest", async (request) => {
|
|
277
|
-
const requestPath = withoutBasePath(config.basePath, request.url) ?? request.url;
|
|
279
|
+
routes.addHook("onRequest", async (request, reply) => {
|
|
280
|
+
const requestPath = (withoutBasePath(config.basePath, request.url) ?? request.url).split("?")[0];
|
|
278
281
|
if (requestPath.startsWith("/api/")
|
|
279
282
|
&& requestPath !== "/api/auth/login"
|
|
280
283
|
&& requestPath !== "/api/health"
|
|
281
284
|
&& requestPath !== "/api/config") {
|
|
282
285
|
const token = request.cookies.texlite_session;
|
|
283
|
-
|
|
286
|
+
const user = token ? currentUser(request, db) : null;
|
|
287
|
+
if (token && !user) {
|
|
284
288
|
db.prepare("DELETE FROM sessions WHERE id = ?").run(digestToken(token));
|
|
285
289
|
}
|
|
290
|
+
if (user?.must_change_password
|
|
291
|
+
&& !["/api/me", "/api/me/password", "/api/auth/logout"].includes(requestPath)) {
|
|
292
|
+
return apiError(reply, 403, "PASSWORD_CHANGE_REQUIRED");
|
|
293
|
+
}
|
|
286
294
|
}
|
|
287
295
|
});
|
|
288
296
|
registerSystemRoutes(routes, {
|
|
@@ -322,6 +330,7 @@ export async function buildApp(config, db, options = {}) {
|
|
|
322
330
|
metrics,
|
|
323
331
|
recordHistory
|
|
324
332
|
});
|
|
333
|
+
registerProjectSearchRoutes(routes, { config, db, projectMutations, collaboration });
|
|
325
334
|
registerProjectReferenceRoutes(routes, { config, db, projectMutations });
|
|
326
335
|
registerProjectHistoryRoutes(routes, { config, db, history, editHistory, projectMutations, recordHistory,
|
|
327
336
|
clearPendingEdits: (id) => { editRetry.clear(id); failedEdits.delete(id); signalHistory(id); },
|
|
@@ -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
|
}
|
|
@@ -157,7 +157,7 @@ export class CollaborationService {
|
|
|
157
157
|
// Without a pending application, source files remain authoritative.
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
async
|
|
160
|
+
async prepareSourceEditRoom(projectId) {
|
|
161
161
|
if (this.closed || this.isMaintaining(projectId))
|
|
162
162
|
throw httpError(409, "PROJECT_BUSY");
|
|
163
163
|
const room = await this.initializeRoom(projectId, this.projectGeneration(projectId));
|
|
@@ -165,6 +165,36 @@ export class CollaborationService {
|
|
|
165
165
|
// still needs idle eviction even if no browser ever connects to it.
|
|
166
166
|
this.scheduleRoomCleanup(room);
|
|
167
167
|
}
|
|
168
|
+
/** Exact HTTP range edits share the normal Yjs attribution, anchors and history pipeline. */
|
|
169
|
+
applySourceEdits(projectId, files, userId) {
|
|
170
|
+
const room = this.rooms.get(projectId);
|
|
171
|
+
if (!room || room.maintenanceReason)
|
|
172
|
+
throw httpError(409, "PROJECT_BUSY");
|
|
173
|
+
// Check every file before changing any of them. The caller holds runWrite,
|
|
174
|
+
// and this synchronous block cannot interleave incoming WebSocket updates.
|
|
175
|
+
for (const file of files) {
|
|
176
|
+
if (this.activeFormatLease(room, file.path))
|
|
177
|
+
throw httpError(409, "PROJECT_BUSY");
|
|
178
|
+
if (!room.allowedPaths.has(file.path) || this.trackedText(room, file.path).toString() !== file.before) {
|
|
179
|
+
throw httpError(409, "SEARCH_SOURCE_CHANGED");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
room.doc.transact(() => {
|
|
183
|
+
for (const file of files) {
|
|
184
|
+
const text = this.trackedText(room, file.path);
|
|
185
|
+
for (const edit of [...file.edits].reverse()) {
|
|
186
|
+
text.delete(edit.from, edit.to - edit.from);
|
|
187
|
+
if (edit.insert)
|
|
188
|
+
text.insert(edit.from, edit.insert);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, { externalUserId: userId, exact: true });
|
|
192
|
+
const receipt = this.flushRoom(room);
|
|
193
|
+
for (const file of files)
|
|
194
|
+
this.bumpFiles(room, { kind: "update", path: file.path });
|
|
195
|
+
if (!receipt.ok)
|
|
196
|
+
throw new SourceFlushError(receipt.failedPaths);
|
|
197
|
+
}
|
|
168
198
|
/** A source-range operation, not an HTTP whole-file replacement. Called inside runWrite. */
|
|
169
199
|
applyCommentSuggestion(projectId, filePath, commentId, userId) {
|
|
170
200
|
const room = this.rooms.get(projectId);
|
|
@@ -194,7 +224,8 @@ export class CollaborationService {
|
|
|
194
224
|
this.externalSources.delete(projectId); };
|
|
195
225
|
}
|
|
196
226
|
/** Apply disk edits as a real attributed Yjs delta, retaining pending human edits and anchors. */
|
|
197
|
-
|
|
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 } = {}) {
|
|
198
229
|
const room = this.rooms.get(projectId);
|
|
199
230
|
if (!room || !isCollaborativeTextFile(filePath))
|
|
200
231
|
return false;
|
|
@@ -217,7 +248,7 @@ export class CollaborationService {
|
|
|
217
248
|
offset += value.length;
|
|
218
249
|
}
|
|
219
250
|
}
|
|
220
|
-
}, { externalUserId: userId });
|
|
251
|
+
}, { externalUserId: userId, ...(agent ? { agent: true } : {}) });
|
|
221
252
|
this.bumpFiles(room, { kind: "update", path: filePath });
|
|
222
253
|
return true;
|
|
223
254
|
}
|
|
@@ -1003,7 +1034,7 @@ export class CollaborationService {
|
|
|
1003
1034
|
this.recordEditStep(room, filePath, connection.user.id, event, before, after, this.activeFormatLease(room, filePath)?.connection === connection);
|
|
1004
1035
|
}
|
|
1005
1036
|
if (isExternalOrigin(transaction.origin) && before !== after) {
|
|
1006
|
-
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);
|
|
1007
1038
|
}
|
|
1008
1039
|
if (before !== after) {
|
|
1009
1040
|
const edits = [];
|
|
@@ -1047,7 +1078,7 @@ export class CollaborationService {
|
|
|
1047
1078
|
* segment is only handed to the history service after `flushRoom()` has
|
|
1048
1079
|
* made the matching source content durable.
|
|
1049
1080
|
*/
|
|
1050
|
-
recordEditStep(room, filePath, authorId, event, before, after, formatted = false) {
|
|
1081
|
+
recordEditStep(room, filePath, authorId, event, before, after, formatted = false, hasAgent = false) {
|
|
1051
1082
|
const spans = editSpansFromYDelta(event.delta, before, after);
|
|
1052
1083
|
if (!spans.length)
|
|
1053
1084
|
return;
|
|
@@ -1065,6 +1096,8 @@ export class CollaborationService {
|
|
|
1065
1096
|
&& previous.filePath === filePath
|
|
1066
1097
|
&& previous.authorId === authorId
|
|
1067
1098
|
&& previous.kind === kind
|
|
1099
|
+
// Agent and direct edits by the same user stay in separate segments.
|
|
1100
|
+
&& Boolean(previous.hasAgent) === hasAgent
|
|
1068
1101
|
&& previous.afterHash === step.beforeHash
|
|
1069
1102
|
&& Number.isFinite(previousTime)
|
|
1070
1103
|
&& Date.parse(createdAt) - previousTime <= EDIT_SEGMENT_IDLE_MS) {
|
|
@@ -1077,6 +1110,7 @@ export class CollaborationService {
|
|
|
1077
1110
|
filePath,
|
|
1078
1111
|
authorId,
|
|
1079
1112
|
kind,
|
|
1113
|
+
...(hasAgent ? { hasAgent: true } : {}),
|
|
1080
1114
|
beforeHash: step.beforeHash,
|
|
1081
1115
|
afterHash: step.afterHash,
|
|
1082
1116
|
createdAt,
|
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))
|
package/dist/server/git.js
CHANGED
|
@@ -23,6 +23,7 @@ export class ProjectGitService {
|
|
|
23
23
|
assertNoSourceSymlinks(this.config, project.id);
|
|
24
24
|
const settings = this.settings(project.id);
|
|
25
25
|
const account = this.userSettings(project.owner_id);
|
|
26
|
+
const commitIdentity = this.identityForUser(project.owner_id);
|
|
26
27
|
const gitDirectory = path.join(sourceRoot(this.config, project.id), ".git");
|
|
27
28
|
let gitStat = null;
|
|
28
29
|
try {
|
|
@@ -49,7 +50,8 @@ export class ProjectGitService {
|
|
|
49
50
|
restorable: false,
|
|
50
51
|
changedFiles: 0,
|
|
51
52
|
ahead: 0,
|
|
52
|
-
latestCommit: null
|
|
53
|
+
latestCommit: null,
|
|
54
|
+
commitIdentity
|
|
53
55
|
};
|
|
54
56
|
const root = sourceRoot(this.config, project.id);
|
|
55
57
|
const porcelain = (await this.git(root, ["status", "--porcelain=v1"])).stdout.trim();
|
|
@@ -77,12 +79,35 @@ export class ProjectGitService {
|
|
|
77
79
|
restorable: porcelain.split("\n").some((line) => Boolean(line) && !line.startsWith("??")),
|
|
78
80
|
changedFiles: porcelain ? porcelain.split("\n").length : 0,
|
|
79
81
|
ahead: aheadResult?.code === 0 ? Number.parseInt(aheadResult.stdout.trim(), 10) || 0 : 0,
|
|
80
|
-
latestCommit: latestResult.code === 0 ? parseCommit(latestResult.stdout.trim()) : null
|
|
82
|
+
latestCommit: latestResult.code === 0 ? parseCommit(latestResult.stdout.trim()) : null,
|
|
83
|
+
commitIdentity
|
|
81
84
|
};
|
|
82
85
|
}
|
|
83
86
|
githubAccountStatus(userId) {
|
|
84
87
|
const settings = this.userSettings(userId);
|
|
85
|
-
|
|
88
|
+
const identity = this.identityForUser(userId);
|
|
89
|
+
return {
|
|
90
|
+
tokenConfigured: Boolean(settings?.token_ciphertext),
|
|
91
|
+
githubLogin: settings?.github_login ?? null,
|
|
92
|
+
gitUsername: identity.name,
|
|
93
|
+
gitEmail: identity.email
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
updateGitIdentity(userId, usernameInput, emailInput) {
|
|
97
|
+
const username = usernameInput.trim();
|
|
98
|
+
const email = emailInput.trim();
|
|
99
|
+
const controlCharacter = /\p{Cc}/u;
|
|
100
|
+
if (!username || username.length > 100 || controlCharacter.test(username) || /[<>]/.test(username)
|
|
101
|
+
|| !email || email.length > 254 || controlCharacter.test(email) || !/^[^\s<>@]+@[^\s<>@]+$/.test(email)) {
|
|
102
|
+
throw httpError(400, "GIT_IDENTITY_INVALID");
|
|
103
|
+
}
|
|
104
|
+
const timestamp = new Date().toISOString();
|
|
105
|
+
this.db.prepare(`INSERT INTO user_github_settings (user_id, git_username, git_email, created_at, updated_at)
|
|
106
|
+
VALUES (?, ?, ?, ?, ?)
|
|
107
|
+
ON CONFLICT(user_id) DO UPDATE SET
|
|
108
|
+
git_username = excluded.git_username, git_email = excluded.git_email, updated_at = excluded.updated_at`)
|
|
109
|
+
.run(userId, username, email, timestamp, timestamp);
|
|
110
|
+
return this.githubAccountStatus(userId);
|
|
86
111
|
}
|
|
87
112
|
async configureUserToken(userId, tokenInput) {
|
|
88
113
|
const token = tokenInput.trim();
|
|
@@ -101,7 +126,11 @@ export class ProjectGitService {
|
|
|
101
126
|
return this.githubAccountStatus(userId);
|
|
102
127
|
}
|
|
103
128
|
removeUserToken(userId) {
|
|
104
|
-
|
|
129
|
+
// Keep the row so a separately configured commit identity survives
|
|
130
|
+
// disconnecting GitHub.
|
|
131
|
+
this.db.prepare(`UPDATE user_github_settings
|
|
132
|
+
SET token_ciphertext = NULL, github_login = NULL, updated_at = ? WHERE user_id = ?`)
|
|
133
|
+
.run(new Date().toISOString(), userId);
|
|
105
134
|
return this.githubAccountStatus(userId);
|
|
106
135
|
}
|
|
107
136
|
async createGitHubRepository(project, name, isPrivate) {
|
|
@@ -148,13 +177,24 @@ export class ProjectGitService {
|
|
|
148
177
|
const staged = await this.git(root, ["diff", "--cached", "--quiet"], [1]);
|
|
149
178
|
if (staged.code === 0)
|
|
150
179
|
throw httpError(409, "GIT_NO_CHANGES");
|
|
180
|
+
const identity = this.identityForUser(owner.id);
|
|
181
|
+
// GIT_AUTHOR_* / GIT_COMMITTER_* take precedence over -c configuration.
|
|
182
|
+
// Pin them to the saved identity so a host-level environment cannot
|
|
183
|
+
// replace the author shown in the UI or on GitHub.
|
|
184
|
+
const identityEnvironment = {
|
|
185
|
+
...process.env,
|
|
186
|
+
GIT_AUTHOR_NAME: identity.name,
|
|
187
|
+
GIT_AUTHOR_EMAIL: identity.email,
|
|
188
|
+
GIT_COMMITTER_NAME: identity.name,
|
|
189
|
+
GIT_COMMITTER_EMAIL: identity.email
|
|
190
|
+
};
|
|
151
191
|
await this.git(root, [
|
|
152
|
-
"-c", `user.name=${
|
|
153
|
-
"-c", `user.email=${
|
|
192
|
+
"-c", `user.name=${identity.name}`,
|
|
193
|
+
"-c", `user.email=${identity.email}`,
|
|
154
194
|
"-c", "commit.gpgSign=false",
|
|
155
195
|
"-c", "core.hooksPath=/dev/null",
|
|
156
196
|
"commit", "-m", message
|
|
157
|
-
]);
|
|
197
|
+
], [], identityEnvironment);
|
|
158
198
|
const result = await this.git(root, ["log", "-1", "--format=%H%x1f%h%x1f%an%x1f%ae%x1f%aI%x1f%s"]);
|
|
159
199
|
return parseCommit(result.stdout.trim());
|
|
160
200
|
}
|
|
@@ -282,6 +322,17 @@ export class ProjectGitService {
|
|
|
282
322
|
userSettings(userId) {
|
|
283
323
|
return this.db.prepare("SELECT * FROM user_github_settings WHERE user_id = ?").get(userId);
|
|
284
324
|
}
|
|
325
|
+
/** Resolve the effective author identity, applying account defaults. */
|
|
326
|
+
identityForUser(userId) {
|
|
327
|
+
const row = this.db.prepare(`SELECT users.username, settings.git_username, settings.git_email
|
|
328
|
+
FROM users LEFT JOIN user_github_settings settings ON settings.user_id = users.id
|
|
329
|
+
WHERE users.id = ?`).get(userId);
|
|
330
|
+
const username = row?.username ?? "texlite";
|
|
331
|
+
return {
|
|
332
|
+
name: row?.git_username?.trim() || username,
|
|
333
|
+
email: row?.git_email?.trim() || `${username}@texlite.com`
|
|
334
|
+
};
|
|
335
|
+
}
|
|
285
336
|
requireUserTokenSettings(userId) {
|
|
286
337
|
const settings = this.userSettings(userId);
|
|
287
338
|
if (!settings?.token_ciphertext)
|