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.
Files changed (319) hide show
  1. package/DESIGN.md +215 -35
  2. package/OPERATIONS.md +2 -2
  3. package/README.md +48 -44
  4. package/README.zh-CN.md +42 -36
  5. package/dist/client/assets/AdminUsers-DepqkT6m.js +1 -0
  6. package/dist/client/assets/AdminUsers-DepqkT6m.js.br +0 -0
  7. package/dist/client/assets/AdminUsers-DepqkT6m.js.gz +0 -0
  8. package/dist/client/assets/{AgentIcon-dCMgWJG-.css → AgentIcon-DeoZDwgh.css} +1 -1
  9. package/dist/client/assets/AgentIcon-DeoZDwgh.css.br +0 -0
  10. package/dist/client/assets/AgentIcon-DeoZDwgh.css.gz +0 -0
  11. package/dist/client/assets/{AgentManagement-rIYtm4Bo.js → AgentManagement-DlV6tHez.js} +1 -1
  12. package/dist/client/assets/AgentManagement-DlV6tHez.js.br +0 -0
  13. package/dist/client/assets/AgentManagement-DlV6tHez.js.gz +0 -0
  14. package/dist/client/assets/AgentTerminal-CvOz5X_j.js +2 -0
  15. package/dist/client/assets/AgentTerminal-CvOz5X_j.js.br +0 -0
  16. package/dist/client/assets/AgentTerminal-CvOz5X_j.js.gz +0 -0
  17. package/dist/client/assets/{AgentTerminalSurface-B2rwONYs.js → AgentTerminalSurface-COqg_GdK.js} +1 -1
  18. package/dist/client/assets/AgentTerminalSurface-COqg_GdK.js.br +0 -0
  19. package/dist/client/assets/AgentTerminalSurface-COqg_GdK.js.gz +0 -0
  20. package/dist/client/assets/{AvatarSettingsDialog-DplRpiJJ.js → AvatarSettingsDialog-C8WQhZBK.js} +1 -1
  21. package/dist/client/assets/AvatarSettingsDialog-C8WQhZBK.js.br +0 -0
  22. package/dist/client/assets/AvatarSettingsDialog-C8WQhZBK.js.gz +0 -0
  23. package/dist/client/assets/CitationBibtexEditor-SpudGDwi.js +1 -0
  24. package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js +3 -0
  25. package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js.br +0 -0
  26. package/dist/client/assets/CitationLibraryDialog-DgOIkLwK.js.gz +0 -0
  27. package/dist/client/assets/CitationNotesPreview-D3CjBD0p.js +1 -0
  28. package/dist/client/assets/Dashboard-CD1w42mA.js +5 -0
  29. package/dist/client/assets/Dashboard-CD1w42mA.js.br +0 -0
  30. package/dist/client/assets/Dashboard-CD1w42mA.js.gz +0 -0
  31. package/dist/client/assets/GitDialog-DGzZ3GRj.js +4 -0
  32. package/dist/client/assets/GitDialog-DGzZ3GRj.js.br +0 -0
  33. package/dist/client/assets/GitDialog-DGzZ3GRj.js.gz +0 -0
  34. package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js +1 -0
  35. package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js.br +0 -0
  36. package/dist/client/assets/GitHubAccountDialog-CGZl3mcY.js.gz +0 -0
  37. package/dist/client/assets/HistoryDialog-DTZxCgyT.js +8 -0
  38. package/dist/client/assets/HistoryDialog-DTZxCgyT.js.br +0 -0
  39. package/dist/client/assets/HistoryDialog-DTZxCgyT.js.gz +0 -0
  40. package/dist/client/assets/InfoPopover-Ba7GvcuW.js +1 -0
  41. package/dist/client/assets/LatexEditor-Boc-45KL.js +25 -0
  42. package/dist/client/assets/LatexEditor-Boc-45KL.js.br +0 -0
  43. package/dist/client/assets/LatexEditor-Boc-45KL.js.gz +0 -0
  44. package/dist/client/assets/MarkdownContent-BeKi2gI5.js +36 -0
  45. package/dist/client/assets/MarkdownContent-BeKi2gI5.js.br +0 -0
  46. package/dist/client/assets/MarkdownContent-BeKi2gI5.js.gz +0 -0
  47. package/dist/client/assets/MarkdownPreview-BH2iwvle.js +1 -0
  48. package/dist/client/assets/MarkdownPreview-BH2iwvle.js.br +0 -0
  49. package/dist/client/assets/MarkdownPreview-BH2iwvle.js.gz +0 -0
  50. package/dist/client/assets/PdfPreview-CIOM7sbu.js +1 -0
  51. package/dist/client/assets/PdfPreview-CIOM7sbu.js.br +0 -0
  52. package/dist/client/assets/PdfPreview-CIOM7sbu.js.gz +0 -0
  53. package/dist/client/assets/{ProjectIconPickerDialog-B9_XvdIC.js → ProjectIconPickerDialog-Bfkaxcnh.js} +1 -1
  54. package/dist/client/assets/ProjectIconPickerDialog-Bfkaxcnh.js.br +0 -0
  55. package/dist/client/assets/ProjectIconPickerDialog-Bfkaxcnh.js.gz +0 -0
  56. package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js +1 -0
  57. package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js.br +0 -0
  58. package/dist/client/assets/ProjectSearchDialog-DPIzxVYj.js.gz +0 -0
  59. package/dist/client/assets/ProjectSettings-ChXx_cmP.js +4 -0
  60. package/dist/client/assets/ProjectSettings-ChXx_cmP.js.br +0 -0
  61. package/dist/client/assets/ProjectSettings-ChXx_cmP.js.gz +0 -0
  62. package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js +25 -0
  63. package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js.br +0 -0
  64. package/dist/client/assets/ProjectWorkspace-B-w2ix8N.js.gz +0 -0
  65. package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js +1 -0
  66. package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js.br +0 -0
  67. package/dist/client/assets/QuickOpenDialog-CHjPlBu2.js.gz +0 -0
  68. package/dist/client/assets/ReadOnlySource-DKcmDg0e.js +2 -0
  69. package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js +3 -0
  70. package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js.br +0 -0
  71. package/dist/client/assets/SelectionHistoryDialog-Dnj22E8N.js.gz +0 -0
  72. package/dist/client/assets/SharedProjectPage-l8GSYTm-.js +2 -0
  73. package/dist/client/assets/SharedProjectPage-l8GSYTm-.js.br +0 -0
  74. package/dist/client/assets/SharedProjectPage-l8GSYTm-.js.gz +0 -0
  75. package/dist/client/assets/{SystemMetricsDialog-BExTHWxg.js → SystemMetricsDialog-DkmBA4o4.js} +1 -1
  76. package/dist/client/assets/SystemMetricsDialog-DkmBA4o4.js.br +0 -0
  77. package/dist/client/assets/SystemMetricsDialog-DkmBA4o4.js.gz +0 -0
  78. package/dist/client/assets/{TagColorSelect-CzPUDAny.js → TagColorSelect-e-Tq5V3H.js} +1 -1
  79. package/dist/client/assets/TagManagementDialog-BM1MRuwh.js +1 -0
  80. package/dist/client/assets/TagManagementDialog-BM1MRuwh.js.br +0 -0
  81. package/dist/client/assets/TagManagementDialog-BM1MRuwh.js.gz +0 -0
  82. package/dist/client/assets/TagMarquee-BLmCTTCt.js +1 -0
  83. package/dist/client/assets/ThemeSwitcher-dcvtWVCO.js +1 -0
  84. package/dist/client/assets/{WordCountDialog-CgDcnPdJ.js → WordCountDialog-DI0Jv-fg.js} +1 -1
  85. package/dist/client/assets/WordCountDialog-DI0Jv-fg.js.br +0 -0
  86. package/dist/client/assets/WordCountDialog-DI0Jv-fg.js.gz +0 -0
  87. package/dist/client/assets/{bibtexFormatterWorker-B_jvobIv.js → bibtexFormatterWorker-Bp8kjjvw.js} +14 -14
  88. package/dist/client/assets/bibtexFormatterWorker-Bp8kjjvw.js.br +0 -0
  89. package/dist/client/assets/bibtexFormatterWorker-Bp8kjjvw.js.gz +0 -0
  90. package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js +2 -0
  91. package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js.br +0 -0
  92. package/dist/client/assets/bibtexMetadataWorker-CQozbzep.js.gz +0 -0
  93. package/dist/client/assets/bibtexNames-CPGbBJxd.js +1 -0
  94. package/dist/client/assets/bibtexReferences-xpSF8IXH.js +1 -0
  95. package/dist/client/assets/bot-ClmnQ29j.js +1 -0
  96. package/dist/client/assets/{chktex-BeOSrdut.js → chktex-BrzPYHey.js} +2 -2
  97. package/dist/client/assets/citationAuthors-BWHXhKvT.js +1 -0
  98. package/dist/client/assets/citationAuthors-BWHXhKvT.js.br +0 -0
  99. package/dist/client/assets/citationAuthors-BWHXhKvT.js.gz +0 -0
  100. package/dist/client/assets/citationLibrary-DxGdbZEQ.js +1 -0
  101. package/dist/client/assets/citationLibrary-DxGdbZEQ.js.br +0 -0
  102. package/dist/client/assets/citationLibrary-DxGdbZEQ.js.gz +0 -0
  103. package/dist/client/assets/dist-C9O-A_C4.js +1 -0
  104. package/dist/client/assets/dist-C9O-A_C4.js.br +0 -0
  105. package/dist/client/assets/dist-C9O-A_C4.js.gz +0 -0
  106. package/dist/client/assets/dist-Dxkdrap6.js +2 -0
  107. package/dist/client/assets/dist-Dxkdrap6.js.br +0 -0
  108. package/dist/client/assets/dist-Dxkdrap6.js.gz +0 -0
  109. package/dist/client/assets/editor-CkUEg2La.js +14 -0
  110. package/dist/client/assets/editor-CkUEg2La.js.br +0 -0
  111. package/dist/client/assets/editor-CkUEg2La.js.gz +0 -0
  112. package/dist/client/assets/editor-languages-kcWr1Z3Q.js +36 -0
  113. package/dist/client/assets/editor-languages-kcWr1Z3Q.js.br +0 -0
  114. package/dist/client/assets/editor-languages-kcWr1Z3Q.js.gz +0 -0
  115. package/dist/client/assets/editorThemeExtension-BWtZV1Af.js +1 -0
  116. package/dist/client/assets/editorThemeExtension-BWtZV1Af.js.br +0 -0
  117. package/dist/client/assets/editorThemeExtension-BWtZV1Af.js.gz +0 -0
  118. package/dist/client/assets/generatedParser-CZa2vsK6.js +1 -0
  119. package/dist/client/assets/generatedParser-CZa2vsK6.js.br +0 -0
  120. package/dist/client/assets/generatedParser-CZa2vsK6.js.gz +0 -0
  121. package/dist/client/assets/git-compare-arrows-158rS_vn.js +1 -0
  122. package/dist/client/assets/i18n-Dtn6w-qA.js +13 -0
  123. package/dist/client/assets/i18n-Dtn6w-qA.js.br +0 -0
  124. package/dist/client/assets/i18n-Dtn6w-qA.js.gz +0 -0
  125. package/dist/client/assets/index-BbU2fbRw.css +1 -0
  126. package/dist/client/assets/index-BbU2fbRw.css.br +0 -0
  127. package/dist/client/assets/index-BbU2fbRw.css.gz +0 -0
  128. package/dist/client/assets/index-CPR6YZEf.js +2 -0
  129. package/dist/client/assets/index-CPR6YZEf.js.br +0 -0
  130. package/dist/client/assets/index-CPR6YZEf.js.gz +0 -0
  131. package/dist/client/assets/katex-Ca9qmXPj.js +257 -0
  132. package/dist/client/assets/katex-Ca9qmXPj.js.br +0 -0
  133. package/dist/client/assets/katex-Ca9qmXPj.js.gz +0 -0
  134. package/dist/client/assets/katex.min-VLoWtPY0.js +1 -0
  135. package/dist/client/assets/{latexFormatterWorker-BIDCSZPd.js → latexFormatterWorker-BWiogBYE.js} +1 -1
  136. package/dist/client/assets/latexFormatterWorker-BWiogBYE.js.br +0 -0
  137. package/dist/client/assets/latexFormatterWorker-BWiogBYE.js.gz +0 -0
  138. package/dist/client/assets/latexScanner-D9bMX44Y.js +6 -0
  139. package/dist/client/assets/latexScanner-D9bMX44Y.js.br +0 -0
  140. package/dist/client/assets/latexScanner-D9bMX44Y.js.gz +0 -0
  141. package/dist/client/assets/palette-8_-Y5XON.js +1 -0
  142. package/dist/client/assets/plus-Cei21TlT.js +1 -0
  143. package/dist/client/assets/relativeTime-mmWGtWRR.js +1 -0
  144. package/dist/client/assets/relativeTime-mmWGtWRR.js.br +0 -0
  145. package/dist/client/assets/relativeTime-mmWGtWRR.js.gz +0 -0
  146. package/dist/client/assets/sourceCursorStore-BVDvDKeP.js +1 -0
  147. package/dist/client/assets/sourceCursorStore-BVDvDKeP.js.br +0 -0
  148. package/dist/client/assets/sourceCursorStore-BVDvDKeP.js.gz +0 -0
  149. package/dist/client/assets/{spellCheck-P-fMO4iR.js → spellCheck-BTyLQAFH.js} +1 -1
  150. package/dist/client/assets/spellCheck-BTyLQAFH.js.br +0 -0
  151. package/dist/client/assets/spellCheck-BTyLQAFH.js.gz +0 -0
  152. package/dist/client/assets/{textLanguageSupport-BSIE7WPM.js → textLanguageSupport-Ck8lMOWz.js} +1 -1
  153. package/dist/client/assets/textLanguages-CwWstpJ5.js +78 -0
  154. package/dist/client/assets/textLanguages-CwWstpJ5.js.br +0 -0
  155. package/dist/client/assets/textLanguages-CwWstpJ5.js.gz +0 -0
  156. package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js +1 -0
  157. package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js.br +0 -0
  158. package/dist/client/assets/useDeletionTransitions-Ba_yhkrl.js.gz +0 -0
  159. package/dist/client/assets/{vimSupport-BwIAfLU0.js → vimSupport-C-WiMLjc.js} +6 -6
  160. package/dist/client/assets/vimSupport-C-WiMLjc.js.br +0 -0
  161. package/dist/client/assets/vimSupport-C-WiMLjc.js.gz +0 -0
  162. package/dist/client/index.html +3 -3
  163. package/dist/server/agentChanges.js +149 -0
  164. package/dist/server/agents/sessions.js +1 -1
  165. package/dist/server/agents/workspaces.js +7 -27
  166. package/dist/server/app.js +15 -6
  167. package/dist/server/boundedExpiringCache.js +69 -0
  168. package/dist/server/citationFolderTransfer.js +5 -5
  169. package/dist/server/citationInput.js +1 -0
  170. package/dist/server/collaboration.js +39 -5
  171. package/dist/server/db.js +23 -0
  172. package/dist/server/editHistory.js +71 -12
  173. package/dist/server/git.js +58 -7
  174. package/dist/server/history.js +58 -9
  175. package/dist/server/i18n.js +9 -0
  176. package/dist/server/locales/zh-Hant.js +5 -0
  177. package/dist/server/projectPreview.js +8 -12
  178. package/dist/server/projectReferences.js +110 -9
  179. package/dist/server/projectReplace.js +67 -0
  180. package/dist/server/projectSearch.js +72 -0
  181. package/dist/server/routes/auth.js +3 -0
  182. package/dist/server/routes/citations.js +28 -61
  183. package/dist/server/routes/commentSuggestions.js +1 -1
  184. package/dist/server/routes/comments.js +8 -3
  185. package/dist/server/routes/projectGit.js +10 -0
  186. package/dist/server/routes/projectHistory.js +42 -0
  187. package/dist/server/routes/projectSearch.js +72 -0
  188. package/dist/server/routes/projects.js +1 -2
  189. package/dist/server/routes/users.js +2 -2
  190. package/dist/shared/bibtexBraces.js +20 -0
  191. package/dist/shared/bibtexNames.js +82 -0
  192. package/dist/shared/bibtexReferences.js +52 -12
  193. package/dist/shared/bibtexText.js +175 -0
  194. package/dist/shared/gitProtocol.js +2 -0
  195. package/dist/shared/historyProtocol.js +5 -0
  196. package/dist/shared/projectSearch.js +17 -0
  197. package/dist/shared/textDiff.js +36 -1
  198. package/package.json +1 -1
  199. package/dist/client/assets/AdminUsers-BghRo_hC.js +0 -1
  200. package/dist/client/assets/AdminUsers-BghRo_hC.js.br +0 -0
  201. package/dist/client/assets/AdminUsers-BghRo_hC.js.gz +0 -0
  202. package/dist/client/assets/AgentIcon-dCMgWJG-.css.br +0 -0
  203. package/dist/client/assets/AgentIcon-dCMgWJG-.css.gz +0 -0
  204. package/dist/client/assets/AgentManagement-rIYtm4Bo.js.br +0 -0
  205. package/dist/client/assets/AgentManagement-rIYtm4Bo.js.gz +0 -0
  206. package/dist/client/assets/AgentTerminal-BEjiw51y.js +0 -2
  207. package/dist/client/assets/AgentTerminal-BEjiw51y.js.br +0 -0
  208. package/dist/client/assets/AgentTerminal-BEjiw51y.js.gz +0 -0
  209. package/dist/client/assets/AgentTerminalSurface-B2rwONYs.js.br +0 -0
  210. package/dist/client/assets/AgentTerminalSurface-B2rwONYs.js.gz +0 -0
  211. package/dist/client/assets/AvatarSettingsDialog-DplRpiJJ.js.br +0 -0
  212. package/dist/client/assets/AvatarSettingsDialog-DplRpiJJ.js.gz +0 -0
  213. package/dist/client/assets/CitationBibtexEditor-BnK6nZPi.js +0 -1
  214. package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js +0 -3
  215. package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js.br +0 -0
  216. package/dist/client/assets/CitationLibraryDialog-CZvJiTmT.js.gz +0 -0
  217. package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js +0 -36
  218. package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js.br +0 -0
  219. package/dist/client/assets/CitationNotesPreview-CiIzdjCa.js.gz +0 -0
  220. package/dist/client/assets/Dashboard-Dcl0Y_C3.js +0 -5
  221. package/dist/client/assets/Dashboard-Dcl0Y_C3.js.br +0 -0
  222. package/dist/client/assets/Dashboard-Dcl0Y_C3.js.gz +0 -0
  223. package/dist/client/assets/GitDialog-BeYvUCDv.js +0 -3
  224. package/dist/client/assets/GitDialog-BeYvUCDv.js.br +0 -0
  225. package/dist/client/assets/GitDialog-BeYvUCDv.js.gz +0 -0
  226. package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js +0 -1
  227. package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js.br +0 -0
  228. package/dist/client/assets/GitHubAccountDialog-BGKINOwJ.js.gz +0 -0
  229. package/dist/client/assets/HistoryDialog-B-C4Zaef.js +0 -8
  230. package/dist/client/assets/HistoryDialog-B-C4Zaef.js.br +0 -0
  231. package/dist/client/assets/HistoryDialog-B-C4Zaef.js.gz +0 -0
  232. package/dist/client/assets/InfoPopover-Dkz742vJ.js +0 -1
  233. package/dist/client/assets/LatexEditor-CohUJrGD.js +0 -25
  234. package/dist/client/assets/LatexEditor-CohUJrGD.js.br +0 -0
  235. package/dist/client/assets/LatexEditor-CohUJrGD.js.gz +0 -0
  236. package/dist/client/assets/PdfPreview-BvJxduy3.js +0 -1
  237. package/dist/client/assets/PdfPreview-BvJxduy3.js.br +0 -0
  238. package/dist/client/assets/PdfPreview-BvJxduy3.js.gz +0 -0
  239. package/dist/client/assets/ProjectIconPickerDialog-B9_XvdIC.js.br +0 -0
  240. package/dist/client/assets/ProjectIconPickerDialog-B9_XvdIC.js.gz +0 -0
  241. package/dist/client/assets/ProjectSettings-D8uH3PqQ.js +0 -4
  242. package/dist/client/assets/ProjectSettings-D8uH3PqQ.js.br +0 -0
  243. package/dist/client/assets/ProjectSettings-D8uH3PqQ.js.gz +0 -0
  244. package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js +0 -31
  245. package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js.br +0 -0
  246. package/dist/client/assets/ProjectWorkspace-BZj-CRZB.js.gz +0 -0
  247. package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js +0 -1
  248. package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js.br +0 -0
  249. package/dist/client/assets/QuickOpenDialog-B9bf5mnw.js.gz +0 -0
  250. package/dist/client/assets/ReadOnlySource-BZ7WYQO7.js +0 -2
  251. package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js +0 -3
  252. package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js.br +0 -0
  253. package/dist/client/assets/SelectionHistoryDialog-DYQb9hXp.js.gz +0 -0
  254. package/dist/client/assets/SharedProjectPage-DJjR-D8d.js +0 -2
  255. package/dist/client/assets/SharedProjectPage-DJjR-D8d.js.br +0 -0
  256. package/dist/client/assets/SharedProjectPage-DJjR-D8d.js.gz +0 -0
  257. package/dist/client/assets/SystemMetricsDialog-BExTHWxg.js.br +0 -0
  258. package/dist/client/assets/SystemMetricsDialog-BExTHWxg.js.gz +0 -0
  259. package/dist/client/assets/TagManagementDialog-BBOpD_62.js +0 -1
  260. package/dist/client/assets/TagManagementDialog-BBOpD_62.js.br +0 -0
  261. package/dist/client/assets/TagManagementDialog-BBOpD_62.js.gz +0 -0
  262. package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js +0 -1
  263. package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js.br +0 -0
  264. package/dist/client/assets/ThemeSwitcher-BTDUp7Wj.js.gz +0 -0
  265. package/dist/client/assets/WordCountDialog-CgDcnPdJ.js.br +0 -0
  266. package/dist/client/assets/WordCountDialog-CgDcnPdJ.js.gz +0 -0
  267. package/dist/client/assets/bibtexFormatterWorker-B_jvobIv.js.br +0 -0
  268. package/dist/client/assets/bibtexFormatterWorker-B_jvobIv.js.gz +0 -0
  269. package/dist/client/assets/citationLibrary-BzlqZiFU.js +0 -26
  270. package/dist/client/assets/citationLibrary-BzlqZiFU.js.br +0 -0
  271. package/dist/client/assets/citationLibrary-BzlqZiFU.js.gz +0 -0
  272. package/dist/client/assets/clipboard-CslquMx4.js +0 -1
  273. package/dist/client/assets/dist-Bcdl4EAC.js +0 -1
  274. package/dist/client/assets/dist-Bcdl4EAC.js.br +0 -0
  275. package/dist/client/assets/dist-Bcdl4EAC.js.gz +0 -0
  276. package/dist/client/assets/editor-JqCouYk8.js +0 -14
  277. package/dist/client/assets/editor-JqCouYk8.js.br +0 -0
  278. package/dist/client/assets/editor-JqCouYk8.js.gz +0 -0
  279. package/dist/client/assets/editor-languages-CRI2h3Fj.js +0 -36
  280. package/dist/client/assets/editor-languages-CRI2h3Fj.js.br +0 -0
  281. package/dist/client/assets/editor-languages-CRI2h3Fj.js.gz +0 -0
  282. package/dist/client/assets/editorThemeExtension-BNWs0sHh.js +0 -1
  283. package/dist/client/assets/editorThemeExtension-BNWs0sHh.js.br +0 -0
  284. package/dist/client/assets/editorThemeExtension-BNWs0sHh.js.gz +0 -0
  285. package/dist/client/assets/eye-BnslGpqB.js +0 -1
  286. package/dist/client/assets/i18n-Bv4wFb8D.js +0 -13
  287. package/dist/client/assets/i18n-Bv4wFb8D.js.br +0 -0
  288. package/dist/client/assets/i18n-Bv4wFb8D.js.gz +0 -0
  289. package/dist/client/assets/index-Bdb2ITID.js +0 -2
  290. package/dist/client/assets/index-Bdb2ITID.js.br +0 -0
  291. package/dist/client/assets/index-Bdb2ITID.js.gz +0 -0
  292. package/dist/client/assets/index-wqKiaXZr.css +0 -1
  293. package/dist/client/assets/index-wqKiaXZr.css.br +0 -0
  294. package/dist/client/assets/index-wqKiaXZr.css.gz +0 -0
  295. package/dist/client/assets/katex-CBRBI6nR.js +0 -257
  296. package/dist/client/assets/katex-CBRBI6nR.js.br +0 -0
  297. package/dist/client/assets/katex-CBRBI6nR.js.gz +0 -0
  298. package/dist/client/assets/latexFormatterWorker-BIDCSZPd.js.br +0 -0
  299. package/dist/client/assets/latexFormatterWorker-BIDCSZPd.js.gz +0 -0
  300. package/dist/client/assets/relativeTime-DlKXhH_h.js +0 -1
  301. package/dist/client/assets/relativeTime-DlKXhH_h.js.br +0 -0
  302. package/dist/client/assets/relativeTime-DlKXhH_h.js.gz +0 -0
  303. package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js +0 -1
  304. package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js.br +0 -0
  305. package/dist/client/assets/sourceCursorStore-C7u-3Gbl.js.gz +0 -0
  306. package/dist/client/assets/spellCheck-P-fMO4iR.js.br +0 -0
  307. package/dist/client/assets/spellCheck-P-fMO4iR.js.gz +0 -0
  308. package/dist/client/assets/tags-GrE3ZIQN.js +0 -1
  309. package/dist/client/assets/textLanguages-DAJ1OXJA.js +0 -78
  310. package/dist/client/assets/textLanguages-DAJ1OXJA.js.br +0 -0
  311. package/dist/client/assets/textLanguages-DAJ1OXJA.js.gz +0 -0
  312. package/dist/client/assets/useDeletionTransitions-TAZINdHX.js +0 -1
  313. package/dist/client/assets/useDeletionTransitions-TAZINdHX.js.br +0 -0
  314. package/dist/client/assets/useDeletionTransitions-TAZINdHX.js.gz +0 -0
  315. package/dist/client/assets/vimSupport-BwIAfLU0.js.br +0 -0
  316. package/dist/client/assets/vimSupport-BwIAfLU0.js.gz +0 -0
  317. /package/dist/client/assets/{AgentIcon-DsoMeMA8.js → AgentIcon-CA-PfOka.js} +0 -0
  318. /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.br → AgentIcon-CA-PfOka.js.br} +0 -0
  319. /package/dist/client/assets/{AgentIcon-DsoMeMA8.js.gz → AgentIcon-CA-PfOka.js.gz} +0 -0
@@ -3,8 +3,12 @@ import { requireUser } from "../auth.js";
3
3
  import { apiError, httpError, ValidationError } from "../http.js";
4
4
  import { MAX_CITATION_BIBTEX_BYTES } from "../limits.js";
5
5
  import { assertCitationCollectionCapacity, citationCollectionIds, citationCollectionsForEntries, filterCitationCollection, registerCitationCollectionRoutes } from "../citationCollections.js";
6
- import { comparableCitationBibtex } from "../../shared/citationContent.js";
7
6
  import { citationInput } from "../citationInput.js";
7
+ /**
8
+ * The lookup carries only citation keys from one .bib file, which is itself
9
+ * capped at MAX_CITATION_BIBTEX_BYTES; twice that leaves room for JSON quoting.
10
+ */
11
+ const MAX_LOOKUP_BODY_BYTES = MAX_CITATION_BIBTEX_BYTES * 2;
8
12
  const tagColors = ["red", "orange", "yellow", "green", "blue", "purple", "gray"];
9
13
  const now = () => new Date().toISOString();
10
14
  function escapeLikePattern(value) {
@@ -26,6 +30,7 @@ function citationJson(row, tags = [], collectionIds = []) {
26
30
  title: row.title,
27
31
  authors: row.authors,
28
32
  year: row.year,
33
+ venue: row.venue,
29
34
  revision: row.revision,
30
35
  collectionIds,
31
36
  tags: tags.map((tag) => ({ id: tag.id, name: tag.name, color: tag.color, ownerId: tag.user_id })),
@@ -102,8 +107,9 @@ export function registerCitationRoutes(app, context) {
102
107
  OR COALESCE(title, '') LIKE ? ESCAPE '\\'
103
108
  OR COALESCE(authors, '') LIKE ? ESCAPE '\\'
104
109
  OR COALESCE(year, '') LIKE ? ESCAPE '\\'
110
+ OR COALESCE(venue, '') LIKE ? ESCAPE '\\'
105
111
  )`);
106
- params.push(...Array.from({ length: 5 }, () => `%${escapeLikePattern(search)}%`));
112
+ params.push(...Array.from({ length: 6 }, () => `%${escapeLikePattern(search)}%`));
107
113
  }
108
114
  if (tagId) {
109
115
  where.push(`EXISTS (SELECT 1 FROM citation_library_entry_tags filter_link
@@ -194,31 +200,11 @@ export function registerCitationRoutes(app, context) {
194
200
  return;
195
201
  return apiError(reply, 403, "CITATION_LIBRARY_PRIVATE");
196
202
  });
197
- app.post("/api/citations/lookup", { bodyLimit: MAX_CITATION_BIBTEX_BYTES * 8 }, async (request, reply) => {
203
+ app.post("/api/citations/lookup", { bodyLimit: MAX_LOOKUP_BODY_BYTES }, async (request, reply) => {
198
204
  const user = requireUser(request, reply, db);
199
205
  if (!user)
200
206
  return;
201
- const body = request.body;
202
- let contents = null;
203
- let keyInput = body?.keys;
204
- if (body?.entries !== undefined) {
205
- if (body.keys !== undefined || !Array.isArray(body.entries) || body.entries.length > 5000)
206
- throw new ValidationError();
207
- contents = new Map();
208
- let bytes = 0;
209
- keyInput = body.entries.map((value) => {
210
- if (typeof value !== "object" || !value)
211
- throw new ValidationError();
212
- const item = value;
213
- if (typeof item.citationKey !== "string" || typeof item.bibtex !== "string" || !item.bibtex.trim())
214
- throw new ValidationError();
215
- bytes += Buffer.byteLength(item.bibtex, "utf8");
216
- if (bytes > MAX_CITATION_BIBTEX_BYTES)
217
- throw httpError(413, "CITATION_TOO_LARGE");
218
- contents.set(item.citationKey.trim().toLowerCase(), comparableCitationBibtex(item.bibtex));
219
- return item.citationKey;
220
- });
221
- }
207
+ const keyInput = request.body?.keys;
222
208
  if (!Array.isArray(keyInput) || keyInput.length > 5000
223
209
  || keyInput.some((key) => typeof key !== "string" || !key.trim() || key.length > 512)) {
224
210
  throw new ValidationError();
@@ -228,12 +214,11 @@ export function registerCitationRoutes(app, context) {
228
214
  for (let offset = 0; offset < keys.length; offset += 500) {
229
215
  const chunk = keys.slice(offset, offset + 500);
230
216
  const placeholders = chunk.map(() => "?").join(", ");
231
- const rows = db.prepare(`SELECT id, citation_key, revision${contents ? ", bibtex" : ""} FROM citation_library_entries
217
+ const rows = db.prepare(`SELECT id, citation_key, revision FROM citation_library_entries
232
218
  WHERE user_id = ? AND citation_key COLLATE NOCASE IN (${placeholders})`)
233
219
  .iterate(user.id, ...chunk);
234
220
  for (const row of rows)
235
- matches.push({ id: row.id, citationKey: row.citation_key, revision: row.revision,
236
- ...(contents ? { sameContent: comparableCitationBibtex(row.bibtex) === contents.get(row.citation_key.toLowerCase()) } : {}) });
221
+ matches.push({ id: row.id, citationKey: row.citation_key, revision: row.revision });
237
222
  }
238
223
  return { matches };
239
224
  });
@@ -245,46 +230,28 @@ export function registerCitationRoutes(app, context) {
245
230
  const citation = citationInput(body);
246
231
  const tagIds = citationTagIds(db, user.id, body?.tagIds);
247
232
  const collectionIds = citationCollectionIds(db, user.id, body?.collectionIds);
248
- const overwrite = body?.overwrite === true;
249
- const existing = db.prepare("SELECT id, revision FROM citation_library_entries WHERE user_id = ? AND citation_key = ? COLLATE NOCASE")
250
- .get(user.id, citation.citationKey);
251
- if (existing && !overwrite)
252
- return apiError(reply, 409, "CITATION_KEY_EXISTS");
253
- const expectedRevision = existing ? citationExpectedRevision(body?.expectedRevision) : null;
254
- if (existing && existing.revision !== expectedRevision) {
255
- return apiError(reply, 409, "CITATION_CONFLICT");
256
- }
257
- const id = existing?.id ?? randomUUID();
233
+ // POST only creates. An existing entry is changed through PATCH, which
234
+ // requires its revision; a key already in the library is a conflict.
235
+ const id = randomUUID();
258
236
  const timestamp = now();
259
237
  db.transaction(() => {
238
+ const existing = db.prepare("SELECT 1 FROM citation_library_entries WHERE user_id = ? AND citation_key = ? COLLATE NOCASE")
239
+ .get(user.id, citation.citationKey);
240
+ if (existing)
241
+ throw httpError(409, "CITATION_KEY_EXISTS");
260
242
  assertCitationCollectionCapacity(db, user.id, id, collectionIds ?? []);
261
- if (existing) {
262
- const result = db.prepare(`UPDATE citation_library_entries SET citation_key = ?, entry_type = ?, bibtex = ?,
263
- title = ?, authors = ?, year = ?, notes = COALESCE(?, notes), revision = revision + 1, updated_at = ?
264
- WHERE id = ? AND user_id = ? AND revision = ?`)
265
- .run(citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.notes ?? null, timestamp, id, user.id, expectedRevision);
266
- if (!result.changes)
267
- throw httpError(409, "CITATION_CONFLICT");
268
- }
269
- else {
270
- db.prepare(`INSERT INTO citation_library_entries
271
- (id, user_id, citation_key, entry_type, bibtex, title, authors, year, notes, revision, created_at, updated_at)
272
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`)
273
- .run(id, user.id, citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.notes ?? "", timestamp, timestamp);
274
- }
275
- if (tagIds !== null) {
276
- db.prepare("DELETE FROM citation_library_entry_tags WHERE entry_id = ?").run(id);
277
- for (const tagId of tagIds)
278
- db.prepare("INSERT INTO citation_library_entry_tags (entry_id, tag_id, created_at) VALUES (?, ?, ?)").run(id, tagId, timestamp);
279
- }
280
- // Saving from a project's .bib adds the chosen folder without removing
281
- // other placements of an already-saved reference.
243
+ db.prepare(`INSERT INTO citation_library_entries
244
+ (id, user_id, citation_key, entry_type, bibtex, title, authors, year, venue, notes, revision, created_at, updated_at)
245
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`)
246
+ .run(id, user.id, citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.venue, citation.notes ?? "", timestamp, timestamp);
247
+ for (const tagId of tagIds ?? [])
248
+ db.prepare("INSERT INTO citation_library_entry_tags (entry_id, tag_id, created_at) VALUES (?, ?, ?)").run(id, tagId, timestamp);
282
249
  for (const collectionId of collectionIds ?? [])
283
250
  db.prepare("INSERT OR IGNORE INTO citation_library_entry_collections (entry_id, collection_id) VALUES (?, ?)").run(id, collectionId);
284
251
  })();
285
252
  const row = db.prepare("SELECT * FROM citation_library_entries WHERE id = ? AND user_id = ?")
286
253
  .get(id, user.id);
287
- return reply.code(existing ? 200 : 201).send({ entry: citationDetails(db, row), updated: Boolean(existing) });
254
+ return reply.code(201).send({ entry: citationDetails(db, row) });
288
255
  });
289
256
  app.patch("/api/citations/:citationId/tags", async (request, reply) => {
290
257
  const user = requireUser(request, reply, db);
@@ -360,9 +327,9 @@ export function registerCitationRoutes(app, context) {
360
327
  if (duplicate)
361
328
  return apiError(reply, 409, "CITATION_KEY_EXISTS");
362
329
  const result = db.prepare(`UPDATE citation_library_entries SET citation_key = ?, entry_type = ?, bibtex = ?,
363
- title = ?, authors = ?, year = ?, notes = COALESCE(?, notes), revision = revision + 1, updated_at = ?
330
+ title = ?, authors = ?, year = ?, venue = ?, notes = COALESCE(?, notes), revision = revision + 1, updated_at = ?
364
331
  WHERE id = ? AND user_id = ? AND revision = ?`)
365
- .run(citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.notes ?? null, now(), citationId, user.id, expectedRevision);
332
+ .run(citation.citationKey, citation.entryType, citation.bibtex, citation.title, citation.authors, citation.year, citation.venue, citation.notes ?? null, now(), citationId, user.id, expectedRevision);
366
333
  if (!result.changes)
367
334
  return apiError(reply, 409, "CITATION_CONFLICT");
368
335
  const updated = db.prepare("SELECT * FROM citation_library_entries WHERE id = ? AND user_id = ?")
@@ -82,7 +82,7 @@ export function registerSuggestionRoutes(app, context) {
82
82
  };
83
83
  validate();
84
84
  if (action === "accept")
85
- await collaboration.prepareSuggestionRoom(id);
85
+ await collaboration.prepareSourceEditRoom(id);
86
86
  return projectMutations.runWrite(id, () => {
87
87
  const row = validate();
88
88
  const expected = action === "accept" ? "accepted" : "rejected";
@@ -6,7 +6,7 @@ import { resolveSourcePath, safeRelativePath } from "../files.js";
6
6
  import { apiError, httpError } from "../http.js";
7
7
  import { accessibleProject } from "../projects.js";
8
8
  import { isCollaborativeTextFile } from "../collaboration.js";
9
- import { attachSuggestion, suggestionRow } from "../commentSuggestions.js";
9
+ import { attachSuggestion, suggestionReviewers, suggestionRow } from "../commentSuggestions.js";
10
10
  import { registerSuggestionRoutes } from "./commentSuggestions.js";
11
11
  import { defaultSuggestionComments } from "../../shared/suggestionMessages.js";
12
12
  import { serverLocale } from "../i18n.js";
@@ -217,8 +217,13 @@ export function registerCommentRoutes(app, context) {
217
217
  changed = true;
218
218
  }
219
219
  if (typeof body.resolved === "boolean") {
220
- if (body.resolved && suggestionRow(db, id, commentId)?.status === "pending")
221
- return apiError(reply, 409, "SUGGESTION_PENDING");
220
+ if (body.resolved) {
221
+ const suggestion = suggestionRow(db, id, commentId);
222
+ if (suggestion?.status === "pending" && (suggestion.apply_update
223
+ || suggestionReviewers(db, id, suggestion.author_id).some(user => user.id === suggestion.reviewer_id))) {
224
+ return apiError(reply, 409, "SUGGESTION_PENDING");
225
+ }
226
+ }
222
227
  changed = true;
223
228
  }
224
229
  if (!changed)
@@ -38,6 +38,16 @@ export function registerProjectGitRoutes(app, context) {
38
38
  return apiError(reply, 400, "GIT_TOKEN_INVALID");
39
39
  return { status: await projectGit.configureUserToken(user.id, body.token) };
40
40
  });
41
+ app.put("/api/account/github/identity", async (request, reply) => {
42
+ const user = requireUser(request, reply, db);
43
+ if (!user)
44
+ return;
45
+ const body = request.body;
46
+ if (typeof body.username !== "string" || typeof body.email !== "string") {
47
+ return apiError(reply, 400, "GIT_IDENTITY_INVALID");
48
+ }
49
+ return { status: projectGit.updateGitIdentity(user.id, body.username, body.email) };
50
+ });
41
51
  app.delete("/api/account/github", async (request, reply) => {
42
52
  const user = requireUser(request, reply, db);
43
53
  if (!user)
@@ -7,6 +7,8 @@ import { resolveSourcePath, safeRelativePath } from "../files.js";
7
7
  import { apiError, httpError } from "../http.js";
8
8
  import { MAX_TEXT_PREVIEW_BYTES } from "../limits.js";
9
9
  import { defaultHistoryTracking, historyTextCandidate } from "../../shared/historyTracking.js";
10
+ /** Files with agent changes examined per request; the newest edits matter most. */
11
+ const MAX_AGENT_CHANGE_FILES = 200;
10
12
  import { accessibleProject, canEdit } from "../projects.js";
11
13
  import { commentsSummaryForProject, projectJson, projectTextSnapshot, reanchorProjectSnapshot, requireEditableProject, requireProjectOwnerPermission, tagsForProject, text, touchProject } from "./projectShared.js";
12
14
  /** Register retained project version listing, inspection, restoration, and cleanup routes. */
@@ -80,6 +82,46 @@ export function registerProjectHistoryRoutes(app, context) {
80
82
  throw httpError(404, "PROJECT_NOT_FOUND");
81
83
  } });
82
84
  });
85
+ /**
86
+ * The caller's own coding-agent changes across the project, mapped to the
87
+ * current sources. Other users' agent work is never returned. Read-only:
88
+ * which changes were reviewed is kept by the browser.
89
+ */
90
+ app.get("/api/projects/:id/agent-changes", async (request, reply) => {
91
+ const user = requireUser(request, reply, db);
92
+ if (!user)
93
+ return;
94
+ const { id } = request.params;
95
+ if (!accessibleProject(db, id, user))
96
+ return apiError(reply, 404, "PROJECT_NOT_FOUND");
97
+ return await projectMutations.runConsistentRead(id, () => {
98
+ const paths = db.prepare(`SELECT DISTINCT file_path FROM project_edit_segments
99
+ WHERE project_id = ? AND author_id = ? AND has_agent = 1 ORDER BY file_path LIMIT ?`)
100
+ .all(id, user.id, MAX_AGENT_CHANGE_FILES).map((row) => row.file_path);
101
+ const files = [];
102
+ for (const filePath of paths) {
103
+ if (!isCollaborativeTextFile(filePath))
104
+ continue;
105
+ let source;
106
+ try {
107
+ source = resolveSourcePath(config, id, filePath);
108
+ }
109
+ catch {
110
+ continue;
111
+ }
112
+ if (!fs.existsSync(source) || !fs.statSync(source).isFile() || fs.statSync(source).size > maxCollaborativeFileBytes(config))
113
+ continue;
114
+ const content = fs.readFileSync(source, "utf8");
115
+ const changes = editHistory.agentChanges(id, filePath, content, user.id);
116
+ if (changes.length)
117
+ files.push({ path: filePath, sourceHash: hashText(content), changes });
118
+ }
119
+ return { files };
120
+ }, { preflight: () => {
121
+ if (!accessibleProject(db, id, user))
122
+ throw httpError(404, "PROJECT_NOT_FOUND");
123
+ } });
124
+ });
83
125
  app.get("/api/projects/:id/history", async (request, reply) => {
84
126
  const user = requireUser(request, reply, db);
85
127
  if (!user)
@@ -0,0 +1,72 @@
1
+ import { isTextContent } from "../../shared/fileTypes.js";
2
+ import { PROJECT_SEARCH_MAX_QUERY_LENGTH, PROJECT_SEARCH_MAX_MATCHES, PROJECT_SEARCH_MAX_REPLACEMENT_LENGTH } from "../../shared/projectSearch.js";
3
+ import { requireUser } from "../auth.js";
4
+ import { apiError, httpError } from "../http.js";
5
+ import { searchProject } from "../projectSearch.js";
6
+ import { accessibleProject } from "../projects.js";
7
+ import { requireEditableProject } from "./projectShared.js";
8
+ import { prepareProjectReplacement } from "../projectReplace.js";
9
+ import { safeRelativePath } from "../files.js";
10
+ function searchOptions(body) {
11
+ if (!body || typeof body.query !== "string" || body.query.length === 0
12
+ || body.query.length > PROJECT_SEARCH_MAX_QUERY_LENGTH || /[\r\n\0]/.test(body.query)
13
+ || (body.caseSensitive !== undefined && typeof body.caseSensitive !== "boolean")
14
+ || (body.wholeWord !== undefined && typeof body.wholeWord !== "boolean"))
15
+ throw httpError(400, "REQUEST_INVALID");
16
+ return { query: body.query, caseSensitive: body.caseSensitive !== false, wholeWord: body.wholeWord !== false };
17
+ }
18
+ export function registerProjectSearchRoutes(app, { config, db, projectMutations, collaboration }) {
19
+ app.post("/api/projects/:id/search", async (request, reply) => {
20
+ const user = requireUser(request, reply, db);
21
+ if (!user)
22
+ return;
23
+ const { id } = request.params;
24
+ if (!accessibleProject(db, id, user))
25
+ return apiError(reply, 404, "PROJECT_NOT_FOUND");
26
+ const options = searchOptions(request.body);
27
+ return await projectMutations.runConsistentRead(id, () => searchProject(config, id, options), {
28
+ preflight: () => { if (!accessibleProject(db, id, user))
29
+ throw httpError(404, "PROJECT_NOT_FOUND"); }
30
+ });
31
+ });
32
+ app.post("/api/projects/:id/search/replace", async (request, reply) => {
33
+ const user = requireUser(request, reply, db);
34
+ if (!user)
35
+ return;
36
+ const { id } = request.params;
37
+ requireEditableProject(db, id, user);
38
+ const body = request.body;
39
+ const options = searchOptions(body);
40
+ if (typeof body?.replacement !== "string" || body.replacement.length > PROJECT_SEARCH_MAX_REPLACEMENT_LENGTH
41
+ || !isTextContent(Buffer.from(body.replacement, "utf8")) || !Array.isArray(body.targets)
42
+ || !body.targets.length || body.targets.length > PROJECT_SEARCH_MAX_MATCHES)
43
+ throw httpError(400, "REQUEST_INVALID");
44
+ const replacement = body.replacement;
45
+ const paths = new Set();
46
+ let totalRanges = 0;
47
+ const targets = body.targets.map((value) => {
48
+ const target = value;
49
+ if (!target || typeof target.path !== "string" || safeRelativePath(target.path) !== target.path || paths.has(target.path)
50
+ || typeof target.sourceHash !== "string" || !/^[a-f0-9]{64}$/.test(target.sourceHash)
51
+ || !Array.isArray(target.ranges) || !target.ranges.length
52
+ || target.ranges.some((range) => !range || !Number.isSafeInteger(range.from) || !Number.isSafeInteger(range.to)
53
+ || range.from < 0 || range.to <= range.from))
54
+ throw httpError(400, "REQUEST_INVALID");
55
+ const ranges = [...target.ranges].sort((a, b) => a.from - b.from);
56
+ if (ranges.some((range, index) => index > 0 && range.from < ranges[index - 1].to))
57
+ throw httpError(400, "REQUEST_INVALID");
58
+ paths.add(target.path);
59
+ totalRanges += ranges.length;
60
+ return { path: target.path, sourceHash: target.sourceHash, ranges };
61
+ });
62
+ if (totalRanges > PROJECT_SEARCH_MAX_MATCHES)
63
+ throw httpError(400, "REQUEST_INVALID");
64
+ await collaboration.prepareSourceEditRoom(id);
65
+ return projectMutations.runWrite(id, () => {
66
+ const plan = prepareProjectReplacement(config, id, options, replacement, targets);
67
+ if (plan.files.length)
68
+ collaboration.applySourceEdits(id, plan.files, user.id);
69
+ return { replaced: plan.replaced, files: plan.files.length };
70
+ }, { preflight: () => { requireEditableProject(db, id, user); } });
71
+ });
72
+ }
@@ -185,8 +185,7 @@ export function registerProjectCatalogRoutes(app, context) {
185
185
  const previews = new Map();
186
186
  if (query.previews === "1")
187
187
  await Promise.all(projects.map(async (project) => {
188
- if (!projectTags.get(project.id)?.length)
189
- previews.set(project.id, await projectPreviews.read(project.id, project.main_file));
188
+ previews.set(project.id, await projectPreviews.read(project.id, project.main_file));
190
189
  }));
191
190
  return {
192
191
  projects: projects.map((project) => ({ ...projectJson({ ...project, archived: archivedOnly }, projectTags.get(project.id) ?? [], commentsSummaries.get(project.id), unreadMentionCounts.get(project.id) ?? 0), ...(previews.has(project.id) ? { preview: previews.get(project.id) } : {}) })),
@@ -58,11 +58,11 @@ export function registerUserManagementRoutes(app, context) {
58
58
  const user = {
59
59
  id: randomUUID(), username, display_name: displayName,
60
60
  password_hash: await hashPassword(password), role, disabled: 0,
61
- must_change_password: 0, can_create_projects: body?.canCreateProjects === true ? 1 : 0, created_at: now()
61
+ must_change_password: 1, can_create_projects: body?.canCreateProjects === true ? 1 : 0, created_at: now()
62
62
  };
63
63
  db.prepare(`INSERT INTO users
64
64
  (id, username, display_name, password_hash, role, disabled, must_change_password, can_create_projects, created_at)
65
- VALUES (?, ?, ?, ?, ?, 0, 0, ?, ?)`)
65
+ VALUES (?, ?, ?, ?, ?, 0, 1, ?, ?)`)
66
66
  .run(user.id, user.username, user.display_name, user.password_hash, user.role, user.can_create_projects, user.created_at);
67
67
  return reply.code(201).send({ user: publicUser(user) });
68
68
  });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Index just after the brace that closes the BibTeX group opened at `start`,
3
+ * or -1 when the group is not closed. A backslash escapes the next character,
4
+ * so `\{` and `\}` are not counted.
5
+ */
6
+ export function bracedGroupEnd(source, start) {
7
+ let depth = 0;
8
+ for (let index = start; index < source.length; index += 1) {
9
+ const character = source[index];
10
+ if (character === "\\") {
11
+ index += 1;
12
+ continue;
13
+ }
14
+ if (character === "{")
15
+ depth += 1;
16
+ else if (character === "}" && --depth === 0)
17
+ return index + 1;
18
+ }
19
+ return -1;
20
+ }
@@ -0,0 +1,82 @@
1
+ import { bracedGroupEnd } from "./bibtexBraces.js";
2
+ /**
3
+ * Find BibTeX name-list separators: the word `and` (any case) after
4
+ * whitespace, at brace depth 0, so `{Barnes and Noble}` and escaped TeX are
5
+ * never split. A trailing `and` (a list still being typed) counts too, so it
6
+ * never becomes part of a name. Shared by the editor's completion and
7
+ * diagnostics and by author display.
8
+ */
9
+ export function findTopLevelAndSeparators(text) {
10
+ const separators = [];
11
+ let depth = 0;
12
+ for (let index = 0; index < text.length; index++) {
13
+ const character = text[index];
14
+ if (character === "\\") {
15
+ index++;
16
+ continue;
17
+ }
18
+ if (character === "{") {
19
+ depth++;
20
+ continue;
21
+ }
22
+ if (character === "}") {
23
+ depth = Math.max(0, depth - 1);
24
+ continue;
25
+ }
26
+ if (depth !== 0 || text.slice(index, index + 3).toLowerCase() !== "and")
27
+ continue;
28
+ const before = text[index - 1];
29
+ const after = text[index + 3];
30
+ if (!before || !/\s/.test(before) || (after !== undefined && !/\s/.test(after)))
31
+ continue;
32
+ let from = index;
33
+ while (from > 0 && /\s/.test(text[from - 1]))
34
+ from--;
35
+ let to = index + 3;
36
+ while (to < text.length && /\s/.test(text[to]))
37
+ to++;
38
+ separators.push({ from, to });
39
+ index += 2;
40
+ }
41
+ return separators;
42
+ }
43
+ /**
44
+ * Split a BibTeX name list (`author`, `editor`) into names at its top-level
45
+ * `and` separators. A final `others` is BibTeX's marker for an incomplete
46
+ * list, not a name. Names keep their original form: reordering or
47
+ * abbreviating them would need BibTeX's full von/Jr. rules, and the source
48
+ * text is never wrong.
49
+ */
50
+ export function splitBibtexNames(value) {
51
+ const names = [];
52
+ let start = 0;
53
+ for (const separator of findTopLevelAndSeparators(value)) {
54
+ names.push(value.slice(start, separator.from));
55
+ start = separator.to;
56
+ }
57
+ names.push(value.slice(start));
58
+ const cleaned = names.map(displayName).filter(Boolean);
59
+ const others = cleaned.length > 1 && cleaned[cleaned.length - 1].toLowerCase() === "others";
60
+ return { names: others ? cleaned.slice(0, -1) : cleaned, others };
61
+ }
62
+ /** Trim a name and drop braces that only protect the whole name, such as `{World Health Organization}`. */
63
+ function displayName(name) {
64
+ const trimmed = name.trim();
65
+ if (trimmed.startsWith("{") && bracedGroupEnd(trimmed, 0) === trimmed.length)
66
+ return trimmed.slice(1, -1).trim();
67
+ return trimmed;
68
+ }
69
+ /**
70
+ * biblatex's default name-list truncation (`maxnames=3`, `minnames=1`): a list
71
+ * longer than `maxNames` shows only its first `minNames` names followed by
72
+ * "et al.". A list ending in `and others` is already truncated, so it is
73
+ * shortened the same way and always followed by "et al.".
74
+ */
75
+ export function truncateBibtexNames(list, { maxNames = 3, minNames = 1 } = {}) {
76
+ const tooLong = list.names.length > maxNames;
77
+ return {
78
+ shown: tooLong ? list.names.slice(0, minNames) : list.names,
79
+ truncated: tooLong || list.others,
80
+ total: list.others ? null : list.names.length
81
+ };
82
+ }
@@ -23,6 +23,16 @@ function readBibtexBlock(source, start) {
23
23
  continue;
24
24
  }
25
25
  if (opening === "{") {
26
+ // Comments belong to the entry body, not to its brace structure. Skip
27
+ // them before counting braces so an unpaired } or { in a comment cannot
28
+ // close or extend the entry. Quotes at the top level protect literal
29
+ // percent signs inside quoted values.
30
+ if (depth === 1 && !quoted && isLatexCommentStart(source, index)) {
31
+ index = skipLatexComment(source, index);
32
+ continue;
33
+ }
34
+ if (depth === 1 && character === "\"")
35
+ quoted = !quoted;
26
36
  if (character === "{") {
27
37
  depth += 1;
28
38
  continue;
@@ -51,6 +61,10 @@ function readBibtexBlock(source, start) {
51
61
  braceDepth -= 1;
52
62
  continue;
53
63
  }
64
+ if (depth === 1 && isLatexCommentStart(source, index)) {
65
+ index = skipLatexComment(source, index);
66
+ continue;
67
+ }
54
68
  if (character === "{") {
55
69
  braceDepth = 1;
56
70
  continue;
@@ -72,24 +86,25 @@ function readBibtexBlock(source, start) {
72
86
  }
73
87
  return null;
74
88
  }
89
+ /**
90
+ * Characters that end a key, as in the editor grammar's key token. A key must
91
+ * then be followed, after whitespace and comments, by `,` or the end of the
92
+ * entry: `@article{f(1), ...}` and `@article{title = {A}}` have no key.
93
+ */
94
+ const keyTerminator = /[\s,{}()%]/;
75
95
  function bibtexKeyRange(source, entry) {
76
- let from = entry.contentFrom;
77
- while (from < entry.contentTo && /\s/.test(source[from]))
78
- from += 1;
96
+ const from = skipLatexTrivia(source, entry.contentFrom);
79
97
  if (from >= entry.contentTo)
80
98
  return null;
81
99
  let to = from;
82
- while (to < entry.contentTo && source[to] !== "," && !/\s/.test(source[to]))
100
+ while (to < entry.contentTo && !keyTerminator.test(source[to]))
83
101
  to += 1;
84
- let trimmedTo = to;
85
- while (trimmedTo > from && /\s/.test(source[trimmedTo - 1]))
86
- trimmedTo -= 1;
87
- if (trimmedTo <= from)
102
+ if (to <= from)
88
103
  return null;
89
104
  const separator = skipLatexTrivia(source, to);
90
105
  if (separator < entry.contentTo && source[separator] !== ",")
91
106
  return null;
92
- return { key: source.slice(from, trimmedTo), from, to: trimmedTo };
107
+ return { key: source.slice(from, to), from, to };
93
108
  }
94
109
  /**
95
110
  * Find ordinary BibTeX/BibLaTeX entry keys. `@string`, `@preamble`, and
@@ -111,13 +126,15 @@ export function findBibtexEntryKeys(source) {
111
126
  index += 1;
112
127
  continue;
113
128
  }
129
+ // An entry type is a letter followed by letters, digits, `_` or `-`,
130
+ // matching the editor grammar (`@misc1`, `@article-v2`).
114
131
  let typeEnd = index + 1;
115
- while (typeEnd < source.length && /[A-Za-z]/.test(source[typeEnd]))
116
- typeEnd += 1;
117
- if (typeEnd === index + 1) {
132
+ if (!/[A-Za-z]/.test(source[typeEnd] ?? "")) {
118
133
  index += 1;
119
134
  continue;
120
135
  }
136
+ while (typeEnd < source.length && /[A-Za-z0-9_-]/.test(source[typeEnd]))
137
+ typeEnd += 1;
121
138
  let opening = typeEnd;
122
139
  while (opening < source.length && /\s/.test(source[opening]))
123
140
  opening += 1;
@@ -137,3 +154,26 @@ export function findBibtexEntryKeys(source) {
137
154
  }
138
155
  return entries;
139
156
  }
157
+ /**
158
+ * Where an entry was published. biblatex spells a journal `journaltitle`;
159
+ * BibTeX spells it `journal`. Proceedings and collection parts prefer their
160
+ * book title.
161
+ */
162
+ export function bibtexVenue(entryType, fields) {
163
+ const journal = fields.journaltitle ?? fields.journal;
164
+ const venue = /inproceedings|conference|incollection/.test(entryType.toLowerCase())
165
+ ? fields.booktitle ?? journal
166
+ : journal ?? fields.booktitle;
167
+ return venue?.trim() || null;
168
+ }
169
+ /**
170
+ * Publication year: BibTeX's `year`, or the year of biblatex's ISO 8601
171
+ * `date` (`2021-05-03`, `2021/2022`). A `date` without a leading four-digit
172
+ * year gives no year rather than a guess.
173
+ */
174
+ export function bibtexYear(fields) {
175
+ const year = fields.year?.trim();
176
+ if (year)
177
+ return year;
178
+ return /^\s*(-?\d{4})(?!\d)/.exec(fields.date ?? "")?.[1] ?? null;
179
+ }