texlite 0.18.0 → 0.19.1

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 (228) hide show
  1. package/DESIGN.md +442 -26
  2. package/NPM_TESTING.md +23 -0
  3. package/OPERATIONS.md +227 -6
  4. package/README.md +8 -2
  5. package/README.zh-CN.md +6 -2
  6. package/THIRD_PARTY_NOTICES.md +73 -0
  7. package/dist/client/assets/AdminUsers-CuYfWnEk.js +1 -0
  8. package/dist/client/assets/AdminUsers-CuYfWnEk.js.br +0 -0
  9. package/dist/client/assets/AdminUsers-CuYfWnEk.js.gz +0 -0
  10. package/dist/client/assets/AgentIcon-ClP5dPRL.js +1 -0
  11. package/dist/client/assets/AgentIcon-ClP5dPRL.js.br +0 -0
  12. package/dist/client/assets/AgentIcon-ClP5dPRL.js.gz +0 -0
  13. package/dist/client/assets/AgentIcon-DxrC-zx_.css +1 -0
  14. package/dist/client/assets/AgentIcon-DxrC-zx_.css.br +0 -0
  15. package/dist/client/assets/AgentIcon-DxrC-zx_.css.gz +0 -0
  16. package/dist/client/assets/AgentManagement-jY_BF6Qy.js +1 -0
  17. package/dist/client/assets/AgentManagement-jY_BF6Qy.js.br +0 -0
  18. package/dist/client/assets/AgentManagement-jY_BF6Qy.js.gz +0 -0
  19. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js +2 -0
  20. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.br +0 -0
  21. package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.gz +0 -0
  22. package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css +1 -0
  23. package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css.br +0 -0
  24. package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css.gz +0 -0
  25. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js +16 -0
  26. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.br +0 -0
  27. package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.gz +0 -0
  28. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js +1 -0
  29. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.br +0 -0
  30. package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.gz +0 -0
  31. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js +1 -0
  32. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.br +0 -0
  33. package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.gz +0 -0
  34. package/dist/client/assets/Dashboard-B7mMz5Gj.js +5 -0
  35. package/dist/client/assets/Dashboard-B7mMz5Gj.js.br +0 -0
  36. package/dist/client/assets/Dashboard-B7mMz5Gj.js.gz +0 -0
  37. package/dist/client/assets/GitDialog-C2H-jKVO.js +3 -0
  38. package/dist/client/assets/GitDialog-C2H-jKVO.js.br +0 -0
  39. package/dist/client/assets/GitDialog-C2H-jKVO.js.gz +0 -0
  40. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js +1 -0
  41. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.br +0 -0
  42. package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.gz +0 -0
  43. package/dist/client/assets/{GitHubIcon-DNR0CleM.js → GitHubIcon-Cjli8pd_.js} +1 -1
  44. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js +8 -0
  45. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.br +0 -0
  46. package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.gz +0 -0
  47. package/dist/client/assets/{LatexEditor-BzAk3WQM.js → LatexEditor-BhAKioho.js} +26 -26
  48. package/dist/client/assets/LatexEditor-BhAKioho.js.br +0 -0
  49. package/dist/client/assets/LatexEditor-BhAKioho.js.gz +0 -0
  50. package/dist/client/assets/PdfPreview-CC8KEz1Y.js +1 -0
  51. package/dist/client/assets/PdfPreview-CC8KEz1Y.js.br +0 -0
  52. package/dist/client/assets/PdfPreview-CC8KEz1Y.js.gz +0 -0
  53. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js +1 -0
  54. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.br +0 -0
  55. package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.gz +0 -0
  56. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js +4 -0
  57. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.br +0 -0
  58. package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.gz +0 -0
  59. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js +30 -0
  60. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.br +0 -0
  61. package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.gz +0 -0
  62. package/dist/client/assets/{QuickOpenDialog-CyqeckBM.js → QuickOpenDialog-BAzyrB-4.js} +1 -1
  63. package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.br +0 -0
  64. package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.gz +0 -0
  65. package/dist/client/assets/SaveButton-DkyoEu6j.js +1 -0
  66. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js +3 -0
  67. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.br +0 -0
  68. package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.gz +0 -0
  69. package/dist/client/assets/SuccessNotice-ubBtzzi_.js +1 -0
  70. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js +1 -0
  71. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.br +0 -0
  72. package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.gz +0 -0
  73. package/dist/client/assets/TagColorSelect-xbc2H5ou.js +1 -0
  74. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js +1 -0
  75. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.br +0 -0
  76. package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.gz +0 -0
  77. package/dist/client/assets/{WordCountDialog-Bp8kYngA.js → WordCountDialog-BODhL9iz.js} +1 -1
  78. package/dist/client/assets/WordCountDialog-BODhL9iz.js.br +0 -0
  79. package/dist/client/assets/WordCountDialog-BODhL9iz.js.gz +0 -0
  80. package/dist/client/assets/arrow-down-B6T7Z6IO.js +1 -0
  81. package/dist/client/assets/check-BRlv1lrZ.js +1 -0
  82. package/dist/client/assets/chevron-up-krb7w67X.js +1 -0
  83. package/dist/client/assets/{chktex-BcGmZVUy.js → chktex-Bz-LKycq.js} +1 -1
  84. package/dist/client/assets/{clock-3-x2vcGFSH.js → clock-3-Fb1_e3ec.js} +1 -1
  85. package/dist/client/assets/{dist-D5mbpudl.js → dist-CMYWzCHL.js} +1 -1
  86. package/dist/client/assets/dist-CMYWzCHL.js.br +0 -0
  87. package/dist/client/assets/dist-CMYWzCHL.js.gz +0 -0
  88. package/dist/client/assets/{eye-CvzXPIMu.js → eye-B6AX_5uX.js} +1 -1
  89. package/dist/client/assets/{hard-drive-BeGQ5o79.js → hard-drive-CBmnJ2xS.js} +1 -1
  90. package/dist/client/assets/i18n-DF6keNBA.js +13 -0
  91. package/dist/client/assets/i18n-DF6keNBA.js.br +0 -0
  92. package/dist/client/assets/i18n-DF6keNBA.js.gz +0 -0
  93. package/dist/client/assets/index-DCwfhKK9.js +42 -0
  94. package/dist/client/assets/index-DCwfhKK9.js.br +0 -0
  95. package/dist/client/assets/index-DCwfhKK9.js.gz +0 -0
  96. package/dist/client/assets/index-SVNFLCYh.css +1 -0
  97. package/dist/client/assets/index-SVNFLCYh.css.br +0 -0
  98. package/dist/client/assets/index-SVNFLCYh.css.gz +0 -0
  99. package/dist/client/assets/info-DNSAs0_-.js +1 -0
  100. package/dist/client/assets/{minimize-2-yYMmsVER.js → minimize-2-C8oL6PTV.js} +1 -1
  101. package/dist/client/assets/{minus-CNHOVLWS.js → minus-TCBOakyi.js} +1 -1
  102. package/dist/client/assets/plus-Dfkyfvvy.js +1 -0
  103. package/dist/client/assets/{refresh-cw-B7vZa5K2.js → refresh-cw-DuLtxWBX.js} +1 -1
  104. package/dist/client/assets/relativeTime-BR0CVAvz.js +1 -0
  105. package/dist/client/assets/relativeTime-BR0CVAvz.js.br +0 -0
  106. package/dist/client/assets/relativeTime-BR0CVAvz.js.gz +0 -0
  107. package/dist/client/assets/{search-Czv3qsBy.js → search-n-2tBATf.js} +1 -1
  108. package/dist/client/assets/{spellCheck-DDCaK8Yx.js → spellCheck-xzICTGx1.js} +1 -1
  109. package/dist/client/assets/spellCheck-xzICTGx1.js.br +0 -0
  110. package/dist/client/assets/spellCheck-xzICTGx1.js.gz +0 -0
  111. package/dist/client/assets/tags-Dy96boLq.js +1 -0
  112. package/dist/client/assets/terminal-C0xh8jVR.js +1 -0
  113. package/dist/client/assets/{type-NT195OCy.js → type-BjXWxrjH.js} +1 -1
  114. package/dist/client/assets/{user-plus-BRuwNzcg.js → user-plus-3oJZJXHW.js} +1 -1
  115. package/dist/client/index.html +13 -7
  116. package/dist/server/agents/adapters/claude.js +180 -0
  117. package/dist/server/agents/adapters/codex.js +47 -0
  118. package/dist/server/agents/adapters/common.js +86 -0
  119. package/dist/server/agents/adapters/opencode.js +196 -0
  120. package/dist/server/agents/adapters/types.js +1 -0
  121. package/dist/server/agents/execution.js +147 -0
  122. package/dist/server/agents/launcher.js +57 -0
  123. package/dist/server/agents/processIdentity.js +63 -0
  124. package/dist/server/agents/registry.js +72 -0
  125. package/dist/server/agents/sessions.js +574 -0
  126. package/dist/server/agents/terminal.js +84 -0
  127. package/dist/server/agents/workspaces.js +341 -0
  128. package/dist/server/app.js +32 -1
  129. package/dist/server/cli.js +19 -47
  130. package/dist/server/collaboration.js +64 -36
  131. package/dist/server/compileArtifacts.js +11 -44
  132. package/dist/server/compiler.js +16 -38
  133. package/dist/server/config.js +8 -2
  134. package/dist/server/db.js +33 -0
  135. package/dist/server/editHistory.js +59 -65
  136. package/dist/server/history.js +28 -13
  137. package/dist/server/i18n.js +26 -8
  138. package/dist/server/latexRoot.js +4 -2
  139. package/dist/server/locales/zh-Hant.js +145 -0
  140. package/dist/server/lucideIcons.js +14 -17
  141. package/dist/server/projectMutations.js +21 -0
  142. package/dist/server/routes/agents.js +135 -0
  143. package/dist/server/routes/compile.js +23 -43
  144. package/dist/server/routes/projectHistory.js +13 -6
  145. package/dist/server/routes/projectShared.js +6 -1
  146. package/dist/server/routes/projects.js +15 -23
  147. package/dist/shared/agentMessages.js +51 -0
  148. package/dist/shared/agentProtocol.js +41 -0
  149. package/dist/shared/historyFiles.js +1 -1
  150. package/dist/shared/historyTracking.js +2 -0
  151. package/dist/shared/locales.js +21 -0
  152. package/dist/shared/sourceCommentAnchors.js +52 -4
  153. package/package.json +7 -3
  154. package/templates/agents/AGENTS.md +135 -0
  155. package/texlite.config.example.json +3 -2
  156. package/dist/client/assets/AdminUsers-rPpYTAU6.js +0 -1
  157. package/dist/client/assets/AdminUsers-rPpYTAU6.js.br +0 -0
  158. package/dist/client/assets/AdminUsers-rPpYTAU6.js.gz +0 -0
  159. package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js +0 -1
  160. package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js.br +0 -0
  161. package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js.gz +0 -0
  162. package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js +0 -1
  163. package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js.br +0 -0
  164. package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js.gz +0 -0
  165. package/dist/client/assets/Dashboard-DppEhsjL.js +0 -5
  166. package/dist/client/assets/Dashboard-DppEhsjL.js.br +0 -0
  167. package/dist/client/assets/Dashboard-DppEhsjL.js.gz +0 -0
  168. package/dist/client/assets/GitDialog-BOu46hxA.js +0 -3
  169. package/dist/client/assets/GitDialog-BOu46hxA.js.br +0 -0
  170. package/dist/client/assets/GitDialog-BOu46hxA.js.gz +0 -0
  171. package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js +0 -1
  172. package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js.br +0 -0
  173. package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js.gz +0 -0
  174. package/dist/client/assets/HistoryDialog-BdkuEl8r.js +0 -8
  175. package/dist/client/assets/HistoryDialog-BdkuEl8r.js.br +0 -0
  176. package/dist/client/assets/HistoryDialog-BdkuEl8r.js.gz +0 -0
  177. package/dist/client/assets/LatexEditor-BzAk3WQM.js.br +0 -0
  178. package/dist/client/assets/LatexEditor-BzAk3WQM.js.gz +0 -0
  179. package/dist/client/assets/PdfPreview-DkjI1eCo.js +0 -1
  180. package/dist/client/assets/PdfPreview-DkjI1eCo.js.br +0 -0
  181. package/dist/client/assets/PdfPreview-DkjI1eCo.js.gz +0 -0
  182. package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js +0 -1
  183. package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js.br +0 -0
  184. package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js.gz +0 -0
  185. package/dist/client/assets/ProjectSettings-Jdr94nOc.js +0 -1
  186. package/dist/client/assets/ProjectSettings-Jdr94nOc.js.br +0 -0
  187. package/dist/client/assets/ProjectSettings-Jdr94nOc.js.gz +0 -0
  188. package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js +0 -30
  189. package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js.br +0 -0
  190. package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js.gz +0 -0
  191. package/dist/client/assets/QuickOpenDialog-CyqeckBM.js.br +0 -0
  192. package/dist/client/assets/QuickOpenDialog-CyqeckBM.js.gz +0 -0
  193. package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js +0 -3
  194. package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js.br +0 -0
  195. package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js.gz +0 -0
  196. package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js +0 -1
  197. package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js.br +0 -0
  198. package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js.gz +0 -0
  199. package/dist/client/assets/TagColorSelect-D3T-rw4K.js +0 -1
  200. package/dist/client/assets/TagManagementDialog-CxjrSX-o.js +0 -1
  201. package/dist/client/assets/TagManagementDialog-CxjrSX-o.js.br +0 -0
  202. package/dist/client/assets/TagManagementDialog-CxjrSX-o.js.gz +0 -0
  203. package/dist/client/assets/WordCountDialog-Bp8kYngA.js.br +0 -0
  204. package/dist/client/assets/WordCountDialog-Bp8kYngA.js.gz +0 -0
  205. package/dist/client/assets/binary-B57nBiwS.js +0 -1
  206. package/dist/client/assets/check-DFoA73zZ.js +0 -1
  207. package/dist/client/assets/chevron-up-C8DyKLxi.js +0 -1
  208. package/dist/client/assets/dist-D5mbpudl.js.br +0 -0
  209. package/dist/client/assets/dist-D5mbpudl.js.gz +0 -0
  210. package/dist/client/assets/i18n-CRWKZA6W.js +0 -9
  211. package/dist/client/assets/i18n-CRWKZA6W.js.br +0 -0
  212. package/dist/client/assets/i18n-CRWKZA6W.js.gz +0 -0
  213. package/dist/client/assets/index-D0eqhDpZ.js +0 -42
  214. package/dist/client/assets/index-D0eqhDpZ.js.br +0 -0
  215. package/dist/client/assets/index-D0eqhDpZ.js.gz +0 -0
  216. package/dist/client/assets/index-DnhiIb1V.css +0 -1
  217. package/dist/client/assets/index-DnhiIb1V.css.br +0 -0
  218. package/dist/client/assets/index-DnhiIb1V.css.gz +0 -0
  219. package/dist/client/assets/plus-BDquy76g.js +0 -1
  220. package/dist/client/assets/relativeTime-DuOytR_J.js +0 -1
  221. package/dist/client/assets/relativeTime-DuOytR_J.js.br +0 -0
  222. package/dist/client/assets/relativeTime-DuOytR_J.js.gz +0 -0
  223. package/dist/client/assets/sigma-CI6gmAkl.js +0 -1
  224. package/dist/client/assets/spellCheck-DDCaK8Yx.js.br +0 -0
  225. package/dist/client/assets/spellCheck-DDCaK8Yx.js.gz +0 -0
  226. package/dist/client/assets/tags-CLK7WRSs.js +0 -1
  227. package/preview-1.png +0 -0
  228. package/preview-2.png +0 -0
package/DESIGN.md CHANGED
@@ -34,14 +34,22 @@ and day-to-day operation.
34
34
  | Formatting | Browser-side `tex-fmt` WASM package and `bibtex-tidy` |
35
35
  | Git backup | Optional host Git and the GitHub REST API |
36
36
  | Process management | Foreground `serve`, or the bundled PM2 lifecycle commands |
37
+ | External tool terminals | Administrator opt-in; adapter-based host CLIs, optional `node-pty`, lazy xterm.js UI, independent task working copies |
37
38
 
38
39
  ## Localization
39
40
 
40
- The browser owns interface copy through the English and Chinese JSON resources
41
- in `src/client/locales`. API errors use stable codes rather than route-local
41
+ The browser owns interface copy through English (`en`), Simplified Chinese (`zh`),
42
+ and Traditional Chinese (`zh-Hant`) JSON resources in `src/client/locales`.
43
+ The shared locale resolver preserves existing `zh` preferences and recognizes
44
+ `zh-TW`, `zh-HK`, and `zh-MO` as Traditional Chinese; an explicit `Hans` or
45
+ `Hant` script takes precedence over the region. Saved choices take precedence
46
+ over browser preferences. The active locale also drives the HTML language and
47
+ localized dates and relative times. API errors use stable codes rather than route-local
42
48
  human text. The server resolves those codes through `src/server/i18n.ts` using
43
49
  the request's `Accept-Language` header; the browser API helper always supplies
44
- its active language, and unmatched or non-browser requests fall back to
50
+ its active language for both JSON requests and ZIP uploads. The server honors
51
+ language preference weights and uses matching Traditional Chinese messages;
52
+ unmatched or non-browser requests fall back to
45
53
  English. This keeps direct API clients usable while allowing the React client
46
54
  to retain its more contextual local translations.
47
55
 
@@ -51,6 +59,11 @@ in route, filesystem, Git, or compiler-control code. Operational logs and
51
59
  raw LaTeX output remain in their original form, so they can be searched and
52
60
  diagnosed without changing behavior by browser language.
53
61
 
62
+ Traditional Chinese is a separately maintained catalog, not a runtime character
63
+ conversion. Use consistent terminology such as 專案, 檔案, 原始碼, 儲存庫,
64
+ and 批註 (collaborative comments). Tests check catalog keys, interpolation
65
+ variables, rich-text tags, language detection, persistence, and API headers.
66
+
54
67
  ### Citation library
55
68
 
56
69
  The citation library is stored in SQLite and is independent of project source
@@ -64,6 +77,14 @@ citation library as a separate management page beside the other management
64
77
  controls; the project workspace keeps a smaller `.bib` import dialog for
65
78
  in-context writing. Library results are server-filtered and paginated with 60
66
79
  entries per page by default (the API accepts a bounded page-size override).
80
+ Entry management actions live in an accessible, portalled overflow menu, with
81
+ deletion separated from ordinary actions and still requiring confirmation.
82
+ Copy BibTeX remains a direct button, preserves the full entry text and shows a
83
+ two-second result on the button. It falls back to selection-based copying for
84
+ HTTP/LAN browsers without usable
85
+ Clipboard API access. Save/import remain direct actions in project dialogs.
86
+ Library rows use compact spacing and a single-line title with the full title
87
+ available on hover.
67
88
  Library entries are checked in the browser with the `bibtex-tidy` JavaScript
68
89
  parser and formatter before a mutation request is sent. Citation keys are unique
69
90
  per user without regard to letter case. Creating an existing key is rejected;
@@ -142,7 +163,12 @@ collaboration drafts and layout preferences include the mount point in their
142
163
  storage namespace so two instances under one origin cannot share local state.
143
164
 
144
165
  `texlite init` creates the configuration when necessary and creates the first
145
- administrator. The server refuses to start without at least one active
166
+ administrator. New configuration files contain only explicit initialization
167
+ choices: a supplied site name/contact email and host, port, base-path or data
168
+ directory overrides. Accepting all defaults can produce an empty JSON object;
169
+ omitted options use runtime defaults and can follow future default changes.
170
+ Existing configuration files are never automatically rewritten or stripped.
171
+ The server refuses to start without at least one active
146
172
  administrator; public registration is not enabled. Configuration values are
147
173
  validated before environment checks, database opening, or binding the HTTP
148
174
  listener. Validation covers paths, limits, engines, timeout/queue settings,
@@ -276,8 +302,17 @@ session exists and remounts only when that session is replaced. The
276
302
  collaboration hook owns subscriptions; the session boundary owns resources.
277
303
  Ordinary file, permission and UI updates retain the current session, and
278
304
  leaving never deletes the persisted offline draft. A client DOM regression
279
- test exercises StrictMode replay, identity changes and cleanup; only that
280
- test uses the development-only DOM emulator.
305
+ test exercises StrictMode replay, identity changes and cleanup.
306
+
307
+ Workspace connection status distinguishes opening the socket (`connecting`),
308
+ an open socket awaiting document synchronization (`syncing`), a synchronized
309
+ connection (`connected`), and an actual connection failure (`disconnected`).
310
+ Only a synchronized connection enables editing. Connection labels overlay
311
+ save progress rather than overwrite it, so a successful reconnect cannot leave
312
+ an old offline label behind. The retained-draft notice is shown on disconnect
313
+ only when there are pending local edits or a recoverable browser draft. Client
314
+ DOM tests cover startup, synchronization, failed connections, retries and
315
+ subscription cleanup without changing or deleting the draft.
281
316
 
282
317
  Read permission is intentionally different from edit permission: read-only
283
318
  members cannot modify source files, but can view the project and add or reply
@@ -286,8 +321,14 @@ can be resolved, edited, deleted, and replied to. If an author is removed,
286
321
  the record remains visible as “Deleted User”.
287
322
 
288
323
  Live anchor updates replay the actual Yjs text deltas against their saved
289
- source baseline. HTTP replacements, recovered state without a delta chain,
290
- and chains that do not reconstruct the final source use a before/after diff.
324
+ source baseline. Agent disk imports retain an inferred-diff flag even when
325
+ their changes are transported as Yjs operations. HTTP replacements, recovered
326
+ state without a delta chain, and chains that do not reconstruct the final
327
+ source also use a before/after diff. Unlike actual edits, inferred partial
328
+ matches require contiguous meaningful text, sufficient retention relative to
329
+ both ranges, and matching context (or a substantially intact quote). Exact
330
+ quotes and whitespace-only formatting remain recognizable; scattered shared
331
+ letters must not stretch a discussion across unrelated replacement prose.
291
332
  Partial edits retain the discussion; fully erased selections preserve their
292
333
  last attached quote and surrounding context for recovery. Recovery requires
293
334
  the original quote to be formed by the current insertion, replacement or an
@@ -484,9 +525,19 @@ because they do not carry editor operations. These existing
484
525
  database fields remain durable across restarts, without a schema change.
485
526
  The server and editor share the range/context rules. Live editor anchors retain
486
527
  detached state through undo and supply current offsets for thread-to-source
487
- navigation, even before a save. Unchanged or stale saved anchors cannot replace
488
- a valid live mapping. Browser recovery searches are bounded around the hint
489
- and newly inserted fragments; ordinary edits never flatten the entire document.
528
+ navigation, even before a save. Comment responses include a response-only
529
+ SHA-256 source revision, computed once per file. An authoritative server anchor
530
+ can correct a misleading live mapping only at that exact revision, including
531
+ when its HTTP response arrives before the Yjs source update. Stale saved
532
+ anchors cannot replace a live mapping, reactivate a deleted selection at a
533
+ duplicate occurrence, or overwrite undo recovery. Results for a different
534
+ revision remain pending; a view-owned 200 ms trailing check retries after
535
+ document updates, coalesces typing, and is cancelled on editor destruction.
536
+ Failed checks do not poll or reschedule themselves. Browser recovery searches
537
+ are bounded around the hint and newly inserted fragments; document-change
538
+ mapping never flattens/hashes the file for revision reconciliation. Incoming
539
+ comment responses may hash the current source once to apply matching results
540
+ immediately.
490
541
 
491
542
  The collaboration service uses a versioned handshake and a versioned epoch
492
543
  marker. When a browser from an incompatible release connects, it is forced to
@@ -561,17 +612,32 @@ checkpoint also captures currently excluded files that will be overwritten or
561
612
  deleted (including attachments affected by legacy restores), without changing
562
613
  project tracking settings. Failure to save that checkpoint aborts restoration.
563
614
  Explicitly included non-text attachments are shown as a compact change notice
564
- without decoding a text diff. Source and
615
+ without decoding a text diff. Automatic recording and text comparison share
616
+ the same file-kind and UTF-8 content classifier, rather than separate extension
617
+ lists (including Windows batch scripts and text with unfamiliar extensions).
618
+ New manifest entries cache this classification from the bytes already read
619
+ during recording. Snapshot details expose it for changed files, including
620
+ deleted files when the previous snapshot is available. Older snapshots are
621
+ classified on demand within the text-preview size limit without rewriting
622
+ their manifests; missing objects and oversized previews retain their normal
623
+ comparison errors. Source and
565
624
  ordinary text/data formats support bounded UTF-8 comparisons, including file
566
625
  deletions; invalid or oversized text is reported as unavailable, not as unchanged.
567
626
 
568
627
  After a source write succeeds, connection-originated Yjs text deltas are also
569
628
  stored as ordered edit segments. Each segment belongs to exactly one user, one
570
629
  file, and one operation type (`edit` or `format`). The edit records store only
571
- positional replacements and bounded source previews, not duplicate complete
572
- files. They live in SQLite separately from recovery snapshots and are retained
573
- as the newest 5,000 project segments within an independent 32 MB serialized
574
- payload budget (`editHistory.maxStorageMB`). This budget never shares or
630
+ positional replacements with complete deleted and inserted text, rather than
631
+ per-edit whole-file snapshots. Browser and agent edits use the same lossless
632
+ span encoding; only displayed passage previews are shortened. Older truncated
633
+ records remain readable but cannot reconstruct affected earlier passages.
634
+ The records live in SQLite separately from recovery snapshots and are retained
635
+ as the newest 20,000 project segments (`editHistory.maxSegments`) within an
636
+ independent 64 MB serialized payload budget (`editHistory.maxStorageMB`). Both
637
+ settings are optional; omitted values use these defaults. Explicit existing
638
+ limits are preserved. Selection-history reads stream records and stop when
639
+ the requested display windows are complete, rather than loading all retained
640
+ payloads at once. This budget never shares or
575
641
  reduces the 128 MB recovery-snapshot budget. A too-large individual edit burst
576
642
  is omitted, and retention removes the oldest records; both deliberately create
577
643
  a visible history boundary rather than presenting an unsafe attribution. When selection history is viewed,
@@ -671,11 +737,19 @@ Workspace resizing uses `react-resizable-panels` v4 (`Group`, `Panel`,
671
737
  would mean pixels. The editor and preview share the space remaining after the
672
738
  file panel and optional drawer. Each visible panel combination keeps its own
673
739
  browser layout using `useDefaultLayout` and a storage adapter scoped to the
674
- deployment base path. The adapter validates saved preferences and reads v2's
675
- legacy array in visual order, rather than the alphabetized record-key order,
676
- so source/PDF widths do not get swapped. Legacy records remain intact; new
677
- layouts use v4's per-combination keys. Blocked or corrupt browser storage
678
- falls back to usable defaults. File-panel collapse state follows `onResize`.
740
+ deployment base path. The adapter validates current v4 per-combination records
741
+ and does not convert v2 layout arrays. Missing, unsupported or corrupt records
742
+ use default sizes; older browser records are left untouched. Blocked browser
743
+ storage also falls back to usable defaults. File-panel collapse state follows `onResize`.
744
+ Source comments sit at the left edge of the preview region, immediately beside
745
+ the editor. They do not add an outer resizable panel or change the editor/file
746
+ widths. A 760 px preview-container breakpoint switches between a 300–360 px
747
+ inline review column and a drawer over the PDF; closing it restores the preview.
748
+ The PDF stays mounted, and a stable portal host preserves review filters and
749
+ reply forms across responsive changes. Editor-only mode falls back to an
750
+ adjacent resizable context pane; settings keep their existing right-hand pane.
751
+ Source annotations use small outlined comment icons with the same toggle,
752
+ keyboard activation and tooltip behavior as the former pins.
679
753
  SyncTeX arrows are portalled outside the group and anchored to the separator,
680
754
  so v4's document-level drag capture does not consume their pointer/keyboard
681
755
  actions. Observers and window listeners are removed when the separator unmounts.
@@ -718,7 +792,10 @@ prose, subdued cool-gray comments and quieter line numbers. One browser-local
718
792
  light/dark/system preference controls the whole application and editor. The
719
793
  dashboard user popover groups identity, GitHub integration, language, theme and
720
794
  sign-out controls. Explicit light/dark selections remain unchanged; system mode
721
- follows OS color-scheme changes while the page is open. The default remains light.
795
+ follows OS color-scheme changes while the page is open. New browsers default to
796
+ System; existing explicit Light/Dark choices are preserved. Missing or blocked
797
+ browser storage follows the system too, with Light as the fallback when media
798
+ queries are unavailable. The pre-paint script uses the same resolution rules.
722
799
  It is stored in localStorage
723
800
  (scoped to the deployment base path), never in the database or tied to a
724
801
  user/project. Other tabs follow
@@ -835,6 +912,13 @@ uses a process-wide queue capped at eight checks across projects and users. Its
835
912
  LaTeX writing diagnostics use a blue-gray dotted underline and never replace
836
913
  the compile diagnostics; the setting is off by default.
837
914
 
915
+ Both writing-check endpoints require a page-local UUID `clientId` and a
916
+ positive safe-integer `sequence` with each source request. Missing identifiers
917
+ return HTTP 409 `CLIENT_UPDATE_REQUIRED` with a localized save-and-reload hint;
918
+ malformed identifiers return HTTP 400. There is no session-cookie lane fallback.
919
+ The server always scopes lanes by project, authenticated user, client and file.
920
+ It never forces a browser reload or discards local edits for this error.
921
+
838
922
  Formatting is independent from the editor's local appearance. A user can
839
923
  manually format a selection or enable the per-user/per-project “format before
840
924
  compile” preference. The browser uses bundled `tex-fmt` WASM for `.tex`, `.cls`,
@@ -848,6 +932,9 @@ localized messages; a failed or timed-out worker is discarded and recreated on
848
932
  the next format attempt, with a 30-second request timeout. Citation-library form
849
933
  validation remains in the browser's main thread. A formatter failure reports an
850
934
  error but does not prevent compilation. There is no silent Prettier fallback.
935
+ Missing, non-string or oversized stored TOML values use `wrap = false`; an explicitly
936
+ saved empty string uses tex-fmt's own defaults. The browser no longer guesses
937
+ whether an empty value came from an older default or requires a migration marker.
851
938
 
852
939
  Before a formatter computes a replacement it acquires a short-lived, per-file
853
940
  lease from the live Yjs room. The lease is held only for the format/snapshot,
@@ -886,11 +973,24 @@ the currently selected root is compiled. Compile state, logs, retained PDF,
886
973
  artifacts, outline, and SyncTeX are keyed by root, so collaborators working on
887
974
  different roots do not replace each other's result or compile notification.
888
975
 
976
+ The supported direct-upgrade baseline is TexLite 0.2.0. Compilation artifacts
977
+ use the per-root v2 manifest introduced in that release:
978
+ `output/.texlite/targets/<root-hash>/latest.json` points to an immutable run
979
+ bundle under `output/.texlite/runs/<run-id>/`. Pre-0.2.0 project-wide v1
980
+ manifests, `.texlite/latest.pdf`, and direct `output/<root>.pdf` fallbacks are
981
+ not read; those generated results can be recreated by compiling. The optional
982
+ `generation` field remains backward-compatible with 0.2.0 manifests. This
983
+ output-format policy does not remove database migrations or source, comment,
984
+ and snapshot data compatibility.
985
+
889
986
  Compilation follows this sequence:
890
987
 
891
988
  1. Admission validates permissions/root selection and coalesces requests by
892
989
  project, root, and a cheap source/settings generation.
893
- 2. After coalescing, TexLite flushes the room and captures a source snapshot.
990
+ The internal coordinator accepts only `generation`; `revision` remains the
991
+ content fingerprint on results, not an alternate admission-key parameter.
992
+ 2. After coalescing, one project-queue reservation flushes the room,
993
+ revalidates permissions/root selection, and captures a source snapshot.
894
994
  A short snapshot barrier prevents autosave from modifying the source tree
895
995
  while the asynchronous copy and digest run. Edits that arrive during the
896
996
  barrier remain in Yjs memory until the snapshot is complete, so the
@@ -915,9 +1015,12 @@ The previous successful PDF remains visible during a new compile. The latest
915
1015
  published bundle is recovered after a restart and can be served before a cold
916
1016
  collaboration room is initialized. PDF requests support range responses for
917
1017
  PDF.js and expose the successful compile time and artifact size. The default
918
- automatic loading policy uses a complete, cache-friendly response through 5 MB
1018
+ automatic loading policy uses a complete, cache-friendly response through 2 MB
919
1019
  and enables PDF.js byte-range loading above that threshold; deployments can
920
- force either mode without changing project compiler settings. The output panel groups the PDF,
1020
+ force either mode without changing project compiler settings. The threshold is
1021
+ a size-based heuristic, not a universal latency optimum. Range mode allows
1022
+ PDF.js to combine streaming and ranged requests; it does not guarantee that
1023
+ only the visible page's bytes are downloaded. The output panel groups the PDF,
921
1024
  log, warnings, errors, generated artifacts, and recovery actions; clean-cache
922
1025
  and clean-artifact actions are for recovery rather than routine compilation.
923
1026
  The Vite build publishes the installed PDF.js version's predefined Adobe CMaps
@@ -938,6 +1041,45 @@ worker. Rendering and viewer assets remain lazy, in separate core/viewer chunks.
938
1041
  TexLite retains its own toolbar and fit-width-relative zoom percentages. Resize
939
1042
  and viewport reporting are coalesced with animation frames. Only effective width
940
1043
  changes recalculate the fit scale, and each zoom applies the final scale once.
1044
+ The initial destination page is selected before scaling starts the native
1045
+ rendering queue, avoiding an unnecessary first-page draw when restoring a later
1046
+ page. A local compile uses its POST result rather than refetching the same run
1047
+ after a WebSocket completion; if that POST fails in transit, the shared state
1048
+ still provides a recovery lookup. Collaborators continue fetching completed
1049
+ runs normally. Post-compile artifact-list refreshes wait for the replacement
1050
+ PDF's first paint, or run when the PDF panel is hidden so output inspection
1051
+ never depends on a successful PDF render.
1052
+
1053
+ `CompilationResults` owns an immutable result snapshot for one workspace
1054
+ selection lifetime. Both the latest run and the retained successful PDF carry
1055
+ `projectId`, `mainFile`, and their own `runId`; a failed latest run does not
1056
+ change the successful PDF's identity. Switching project/root creates a new
1057
+ owner, including A-to-B-to-A navigation, and old responses cannot publish into
1058
+ that owner. Opening/reopening a workspace restores retained output; switching
1059
+ roots inside it starts empty until another compile is observed or requested.
1060
+ The initial metadata lookup settles before shared completion replays can start
1061
+ a recovery lookup. Local POSTs, shared completions, and bootstrap results all
1062
+ use the same result receiver, so acceptance, duplicate suppression, PDF
1063
+ replacement and reset rules are not maintained as separate run/URL refs.
1064
+ Saving finishes before the previous run is cleared or root-switch replay
1065
+ suppression is lifted; a failed save cannot replay an old result as a new
1066
+ compile success. Shared completions deferred or interrupted by cleanup are
1067
+ reconciled when cleanup ends. A successful cleanup response does not discard
1068
+ newer collaboration events received while its HTTP request was pending.
1069
+ The hook still owns request cancellation and output-panel lifetimes. Artifact
1070
+ lists/previews are checked against both the selection owner and the published
1071
+ PDF, and deferred bootstrap scans are cancelled when a compile begins. Pending
1072
+ local compiles are keyed by project and root; leaving a project or unmounting
1073
+ cancels their HTTP requests without letting late errors affect the next view.
1074
+ Leaving a project also retires its compiling/cancelling flags, independently
1075
+ of whether those requests have settled; root switches within that project
1076
+ keep pending tasks intact. Bootstrap active-state hints use a functional
1077
+ state update so queued React notifications cannot be overwritten. The same
1078
+ run cannot regress from running or completed to an earlier phase. A fresh
1079
+ lookup can discover a different run when no notification arrived during it;
1080
+ route preloads cannot replace existing notifications because their starting
1081
+ state is unknown. This ordering does not depend on browser clock timestamps.
1082
+
941
1083
  Page numbers use separate elements, leaving PDF.js's loading pseudo-element intact.
942
1084
  A replacement viewer is laid out and rendered without displaying it; the old PDF stays visible until
943
1085
  a visible page in the replacement has painted successfully. Failed replacements
@@ -982,8 +1124,17 @@ to collaborators. The separate selection-history stream provides that
982
1124
  author-attributed editing view and never changes snapshot retention or restore
983
1125
  semantics.
984
1126
  Its edit segments have their own `editHistory.maxStorageMB` hard payload cap
985
- (32 MB by default), so selection-history retention cannot consume the snapshot
1127
+ (64 MB by default), so selection-history retention cannot consume the snapshot
986
1128
  budget or affect recovery capacity.
1129
+ Internal edit batches are validated before any records are inserted. Invalid
1130
+ steps, spans, timestamps, or hash chains fail the batch and use the existing
1131
+ bounded retry/history-warning path; they are not silently dropped or assigned
1132
+ replacement timestamps. A damaged stored edit row stops selection-history
1133
+ reconstruction at that boundary instead of reconstructing a partial chain.
1134
+ Invalid snapshot changed-path metadata is reported as an error rather than an
1135
+ empty file list. File-backed root validation and icon lookup likewise preserve
1136
+ normal not-found results while allowing permission, I/O, and malformed generated
1137
+ resource errors to reach the server's error handler and logs.
987
1138
  Autosaves across authors are coalesced within a fixed two-minute project window.
988
1139
  A mixed-author snapshot has no single author attribution; selection edit history
989
1140
  retains the individual contributions independently. File
@@ -1101,6 +1252,271 @@ receive implicit access to another user's projects; they see a project only
1101
1252
  when they own it or it has been explicitly shared with them. The last active
1102
1253
  administrator cannot be removed or disabled.
1103
1254
 
1255
+ ## External agent terminals
1256
+
1257
+ Schema migration 10 adds an initially empty administrator agent allowlist, task records,
1258
+ and operation records. Tasks have independent UUIDs; project/user/agent is a
1259
+ grouping key, not a uniqueness constraint. One project admits only one active
1260
+ execution across all users, tasks and agents; different projects are independent.
1261
+ There are no limits on distinct tasks, elapsed runtime, provider quotas, or billing. Historical
1262
+ records do not retain live PTY handles. The application never automatically
1263
+ starts an agent in response to a compile failure or writing action.
1264
+ The workspace's Start task action creates and immediately launches a task; names
1265
+ are optional and default to six uniformly sampled characters from `A–Z`, `a–z`,
1266
+ `0–9` and `-`, independently of the task UUID.
1267
+ Creation is accepted into the UI before launching, so a launch failure retains
1268
+ the task and name for retry instead of creating duplicate conversations.
1269
+ The terminal heading can maximize the panel to the editor column's full height
1270
+ and restore its previous split. The source panel is also collapsible through
1271
+ the separator. Editor tabs/source and the live terminal stay mounted during
1272
+ maximization, preserving editor state, terminal output and the PTY connection;
1273
+ the collapsed editor is inert. Closing a maximized terminal resets the split
1274
+ so reopening does not leave the editor collapsed.
1275
+
1276
+ `AgentAdapter` in `src/server/agents/adapters/types.ts` defines feature discovery,
1277
+ native preparation, start, exact-context resume, native-session identification,
1278
+ and scoped cleanup. Codex, OpenCode, and Claude implement it separately;
1279
+ registration/discovery and session orchestration do not contain native command
1280
+ switches. PTY attachment, input ownership, process termination, task authorization,
1281
+ and retry state are shared service responsibilities. A task owns one native
1282
+ conversation, but launching a CLI process does not itself prove that a native
1283
+ conversation was created. A previously launched task without a saved session ID
1284
+ may launch again when its adapter verifies no conversation for that task. Discovery
1285
+ distinguishes found, empty and unknown states: missing storage, failed commands
1286
+ and ambiguous results never authorize a fresh conversation. OpenCode state is
1287
+ inspected through SQLite in read-only mode, preferring the V2 `session_v2`
1288
+ projection over a retained legacy `session` table. Older private layouts can use
1289
+ native JSON session listing. Detected `--standalone`
1290
+ support selects a private server owned by the task's process tree, avoiding
1291
+ host background-service dependencies for execution, discovery and cleanup.
1292
+ An existing session ID is verified before resuming because newer OpenCode
1293
+ versions may create an unknown `--session` ID instead of rejecting it.
1294
+ Once a session ID is saved, the service always resumes that
1295
+ exact ID and never clears it or silently replaces the conversation after a
1296
+ resume failure. The UI offers Continue only for an identified context. These
1297
+ decisions are server-owned, not a browser-supplied start/resume toggle. A separate
1298
+ conversation after an established one requires a new task UUID and state directory.
1299
+
1300
+ New OpenCode 2 tasks reuse the service account's native database and XDG
1301
+ data/state locations, so provider sign-ins (including GitHub Copilot) and token
1302
+ refreshes are shared with native terminals. TexLite asks `opencode debug paths db`
1303
+ for the actual database path, respecting `OPENCODE_DB` and native channel/platform
1304
+ defaults. Before launching, it registers a task-derived `ses_texlite…` ID and pins
1305
+ the database path in the task's `state/opencode-session.json`. Launches always
1306
+ pass that exact `--session` ID, and shared-state discovery never enumerates host
1307
+ conversations or chooses a newest/unique one. An ID already present before its
1308
+ ownership binding is created is not claimed. The native CLI creates the bound
1309
+ conversation when needed; an unused task may still have no persisted conversation.
1310
+ Existing private OpenCode conversations stay in their original database. Only
1311
+ verified empty private stores switch to the shared layout; their old files remain
1312
+ until task deletion.
1313
+
1314
+ TexLite lists and authorizes tasks exclusively from its own `agent_tasks` rows,
1315
+ not the OpenCode session catalog. Shared-state cleanup uses native
1316
+ `session delete <registered-id> --standalone` and verifies that exact ID is gone
1317
+ before removing the task record/files. It never removes the host database,
1318
+ credentials or unrelated native sessions. The native terminal's own history
1319
+ picker can expose shared host conversations; this is an accepted boundary for
1320
+ trusted writers, not additional tasks imported into TexLite.
1321
+
1322
+ All adapters inherit the service account's `XDG_CACHE_HOME`; when it is unset,
1323
+ the CLI chooses its own default. Shared caches can reuse model catalogs and
1324
+ installed dependencies across projects, tasks and native terminals.
1325
+ Codex keeps a task-specific `CODEX_HOME`. Claude directly shares the service
1326
+ account's native configuration and login instead of copying selected files.
1327
+ For the default home, `CLAUDE_CONFIG_DIR` stays unset to preserve native
1328
+ `~/.claude.json` onboarding discovery. An explicit configuration directory is
1329
+ passed through. Each task durably binds that location and its UUID in
1330
+ `state/claude-session.json` before its CLI can launch. Native discovery and
1331
+ continuation target only that UUID; existing host conversations are not adopted.
1332
+ Claude-specific model/context, provider-authentication, timeout and client-certificate
1333
+ variables supplement the shared gateway/proxy environment on each start/resume.
1334
+ The source is only the current service process, not a port-specific lookup or a
1335
+ shell-profile loader. Runtime session markers and transcript controls stay excluded;
1336
+ the durable ownership binding stores no inherited credentials.
1337
+ Deletion removes only that session's transcript, subagent directory, transcript
1338
+ sidecars and UUID-scoped checkpoint/task/debug data. Shared prompt history,
1339
+ settings, credentials, plugins, project memory and caches are left untouched.
1340
+ A missing or invalid ownership binding blocks native cleanup rather than
1341
+ dropping the task and leaving an unmanaged conversation. After successful native
1342
+ cleanup, `agent_tasks.native_cleanup_done` is committed before local file removal;
1343
+ retries (including after restart) then need neither the binding nor CLI discovery.
1344
+ The successful deletion audit and final task-row deletion commit together.
1345
+ OpenCode management falls back to the task-state directory when a project's
1346
+ source directory is gone, retaining the registered database and exact session ID.
1347
+ Old private Claude conversations are not migrated and should be removed before
1348
+ upgrading. Task deletion also removes its private TexLite UUID directory,
1349
+ never the inherited host cache or the host configuration directory.
1350
+ These locations organize tasks; they do not sandbox agents running as the same
1351
+ service account.
1352
+
1353
+ The administrative screen is a separate lazy page, with agent settings and a
1354
+ paginated cross-project task catalog. Task listings use server-side pagination
1355
+ with 50 tasks per page across management pages and project terminals.
1356
+ Administrators can stop/delete tasks but
1357
+ cannot attach to another user's terminal. This metadata-specific authority does
1358
+ not change ordinary project visibility. Users can manage their own tasks, and
1359
+ execution/attachment additionally requires current project write
1360
+ access and membership in the administrator allowlist. Mutating requests reconcile active tasks after
1361
+ permission changes. Terminal input/output also validates access, and WebSocket
1362
+ authentication queries the actual session row rather than the HTTP request cache.
1363
+
1364
+ Tasks have no archive state; project archival only organizes project lists.
1365
+ Explicit termination releases the owned process
1366
+ group, including children, while retaining context. Explicit deletion also
1367
+ removes only task state, never project files. Cleanup failure preserves its record
1368
+ for retry; an unverified native operation is never represented as successful.
1369
+ Windows termination treats an OS-confirmed missing process as already stopped,
1370
+ including the race with natural exit; command failures and permission errors
1371
+ alone are not proof of termination. Graceful shutdown awaits every task's stop
1372
+ and final source synchronization before aggregating failures, so one failed
1373
+ task cannot make database shutdown overtake another task's final writes.
1374
+ Deleting a project/account stops affected executions and attempts scoped
1375
+ cleanup; orphaned tasks keep ownership labels and cleanup locators independently
1376
+ of the deleted rows, so administrators can resolve failures. Operation records
1377
+ retain project, agent, task, and actor identity after deletion, without transcripts.
1378
+
1379
+ New executions persist a task-owned `execution.json` lease with an independent
1380
+ execution UUID, platform, launcher PID and OS birth identity. A small Node
1381
+ launcher preserves the CLI's inherited TTY and waits for its verified identity
1382
+ to be committed before starting the CLI. It remains the identifiable process
1383
+ group leader after CLI exit; the normal stop path reaps the group before
1384
+ releasing the project. The CLI's exit code is relayed through an execution-scoped
1385
+ result file, not confused with the launcher's eventual termination code.
1386
+
1387
+ Startup recovery runs before requests are accepted. It verifies the UUID marker
1388
+ and birth identity (Linux boot ID/start ticks, macOS start time, Windows CIM
1389
+ creation time) before terminating any previous execution. Uncommitted launch
1390
+ permits are cancelled without starting their CLI. PID reuse never authorizes a
1391
+ kill. Unreadable identities, failed termination, or a live leaderless POSIX group
1392
+ retain the lease, task record, project claim, and an actionable recovery error;
1393
+ owners/admins can retry **End execution** or deletion after resolving the host
1394
+ problem. Project replacement cannot bypass the claim. Recovered source files
1395
+ are preserved and recorded in project snapshots; lost in-memory per-edit
1396
+ attribution cannot be reconstructed after a service crash.
1397
+
1398
+ These leases apply to executions started by this implementation. Pre-lease
1399
+ executions have no verifiable process locator: stop them before upgrading.
1400
+ Recovery does not discover or kill unrelated native CLI sessions or deliberately
1401
+ detached/escaped processes; Coding Agent terminals remain trusted host tools,
1402
+ not OS sandboxes. No database schema change is required.
1403
+
1404
+ Agents run directly in the project source directory. Task directories retain
1405
+ session bindings, private native state where used, and compilation context, not baseline/work copies. A synchronous
1406
+ project claim is acquired before asynchronous startup and released only after
1407
+ process-tree termination and final source synchronization. Source-tree exclusive
1408
+ operations end the writer before entering the project queue, preventing deadlocks
1409
+ with its final synchronization. This is a single-instance claim, not an OS lock.
1410
+
1411
+ An active source synchronizer polls directory metadata every 750 ms; only changed
1412
+ small files are read. Before a dirty collaborative file is saved, the same
1413
+ synchronizer checks its disk contents synchronously. Non-overlapping edits are
1414
+ three-way merged against the last known disk text. External text is applied as
1415
+ an attributed incremental Yjs transaction, preserving human edit segments and
1416
+ the exact anchor-update chain. Ordinary HTTP/browser writes advance the known
1417
+ disk state and are not attributed to the agent. Added/deleted/binary files update
1418
+ the tree and snapshots. Overlapping replacements preserve the editor draft and
1419
+ save the agent version under `.texlite-agent-conflicts/<task-id>/`, then stop the
1420
+ task with a visible warning. Symlinks and unreadable files stop synchronization
1421
+ instead of being followed. Polling ends with execution, not browser attachment.
1422
+
1423
+ Task context JSON and a compile log are exposed through `TEXLITE_PROJECT_CONTEXT`
1424
+ and `TEXLITE_COMPILE_LOG`; compile API completion refreshes this context. A CLI
1425
+ does not become sandboxed by running in a project, nor does this watcher impose
1426
+ filesystem barriers on arbitrary host processes. Compile snapshots retain their
1427
+ existing consistency checks; external edits should not be treated as OS-locked
1428
+ transactions across several files.
1429
+
1430
+ Before each launch, the service copies the fixed English
1431
+ `templates/agents/AGENTS.md` into the source root if `AGENTS.md` is absent. The
1432
+ exclusive-create copy never overwrites existing instructions. Creation uses
1433
+ the project write coordinator and updates collaboration, metadata and snapshots.
1434
+ The template scopes the agent to the current manuscript's LaTeX and academic
1435
+ writing, including bibliography work, compilation diagnostics and directly
1436
+ related supporting scripts. It directs the agent to refuse unrelated requests
1437
+ before using tools, handle mixed/ambiguous requests explicitly, and avoid
1438
+ fabricated references or results. The collaboration, source/output and compile
1439
+ context guidance remains deployment-independent; the template ships as a package
1440
+ runtime asset. Existing project instructions are not migrated automatically.
1441
+ The CLIs retain native instruction-file loading, without generated `CLAUDE.md`
1442
+ files or injected system-prompt flags. CLI versions/settings determine whether
1443
+ the file is loaded. Task scope is behavioral guidance for trusted users, not
1444
+ an enforced filesystem or execution boundary.
1445
+
1446
+ The browser mounts a terminal only for the visible task, and streams private
1447
+ terminal data over authenticated, origin-checked WebSockets with base-path and
1448
+ HTTPS support. One attachment owns input/resize; takeover is explicit. Server
1449
+ display replay is bounded, slow sockets disconnect without stopping the task,
1450
+ and full transcripts are not persisted by TexLite. Native CLI history can still
1451
+ exist in task-local or shared host state. Raw terminal replay is a bounded recent stream, not a
1452
+ complete saved terminal screen; very long full-screen sessions may need a redraw.
1453
+
1454
+ Terminal appearance is separate from editor appearance. Its font, size and theme
1455
+ are browser-local preferences shared across projects and scoped to the
1456
+ deployment base path, without user/database or CLI configuration changes. The
1457
+ Terminal tab also saves a default-on execution-reminder toggle in this browser
1458
+ store. It controls the terminal/task-list reminder text and active-task count
1459
+ badges on Terminal and Agent tasks entries, including their accessible labels.
1460
+ It does not stop or reconnect tasks, alter actual counts/access, or hide
1461
+ project-busy warnings and other operational guidance.
1462
+ Older preferences without the toggle keep the reminder enabled. The
1463
+ default is JetBrains Mono at 13 px with fixed 1.2 line spacing; existing web fonts and
1464
+ a system-monospace fallback are available. The original Catppuccin-inspired
1465
+ TexLite dark palette remains the default; Catppuccin Latte (light) and Gruvbox
1466
+ Dark are also bundled in `terminalTheme.ts`. Terminal color schemes and
1467
+ scrollbars follow the selected terminal palette, independently of the app/system
1468
+ theme. Existing preferences without a theme retain the original
1469
+ palette. xterm receives the selected palette at construction, before the CLI can query
1470
+ terminal colors. Padding, empty states and the font preview share the same
1471
+ palette; outer task controls still follow the application theme. Switching the
1472
+ app/system theme does not recolor, recreate or reconnect a running terminal.
1473
+ The palettes control xterm's default and ANSI colors; explicit true-color output
1474
+ and a coding agent's own application theme remain under that CLI's control.
1475
+ Latte uses xterm's minimum-contrast adjustment at 4.5 for readable terminal text;
1476
+ dark palettes retain xterm's default contrast behavior. Cursor, selection and
1477
+ preview accents are adapted for legibility on the pale Latte background.
1478
+ No Starship installation or host/agent configuration changes are required.
1479
+ Saving updates the current xterm palette immediately without reconnecting or
1480
+ clearing output. Theme-only changes do not reload fonts or resize the terminal;
1481
+ font changes fit its row/column geometry after loading. Font loading completes
1482
+ before measuring the selected font, with stale
1483
+ loads and unmounted terminals ignored; failed web fonts use the fallback stack.
1484
+ Previously stored terminal line-spacing choices are ignored and omitted on the
1485
+ next save; the editor's independent line-spacing setting is unchanged.
1486
+ Manual saves for editor/terminal/compiler settings show a blue check and “Saved” on
1487
+ the header and footer save buttons for two seconds, without a success banner.
1488
+ Feedback is scoped to the saved tab, including delayed compiler responses;
1489
+ idle buttons retain their existing labels. Unchanged compiler settings are
1490
+ reported on the buttons instead. Failures remain visible as errors rather than
1491
+ claiming success. User, citation, tag and Coding Agent management actions follow
1492
+ the same button-only success-feedback convention. Deletions and permission
1493
+ changes are reflected by their resulting list/control state without success
1494
+ banners; failures keep their contextual errors. Citation/tag edit forms remain
1495
+ open after saving, retaining the updated revision for subsequent writes.
1496
+ Snapshot naming and GitHub token saves use the same button-only confirmation.
1497
+ All explicit save buttons share `SaveButton`: a neutral surface and text,
1498
+ a save icon at rest, a disabled spinner while saving, and a blue check for
1499
+ confirmed feedback. The owning workflow still controls persistence, errors and
1500
+ the two-second feedback timer. Dialogs that close after saving retain that
1501
+ behavior; create, send and destructive actions keep their distinct semantics.
1502
+
1503
+ Management pages use the Coding Agent page's compact control scale: 12 px
1504
+ controls and table text, 32 px main actions, and matching themed primary buttons.
1505
+ User, citation and Coding Agent management share the localized “Back to projects”
1506
+ navigation label and fixed 32 px button height, including when the Agent page's
1507
+ stylesheet loads later. Citation list actions use the same compact height,
1508
+ line height and icon scale, including Copy BibTeX and the overflow trigger.
1509
+ Project-list controls and editor content are not rescaled.
1510
+
1511
+ `node-pty` loads dynamically and is an optional production dependency. xterm.js
1512
+ and its fit addon are build dependencies behind a lazy terminal boundary. Missing
1513
+ PTY support does not block startup. Graceful shutdown stops managed executions;
1514
+ restart marks prior executions interrupted without trusting stored PIDs or
1515
+ automatically respawning them. Native state formats and resume capabilities vary
1516
+ by agent version; the deployed tools remain responsible for their own authentication.
1517
+ Working copies do not provide OS isolation. See `OPERATIONS.md` for the current
1518
+ adapter capability matrix and usage.
1519
+
1104
1520
  ## Known limitations and TODO
1105
1521
 
1106
1522
  These items describe remaining engineering work rather than promises of a
package/NPM_TESTING.md CHANGED
@@ -76,6 +76,9 @@ XDG_DATA_HOME="$TEST_ROOT/data" \
76
76
  ~~~
77
77
 
78
78
  The `config` output should show the temporary configuration and data paths.
79
+ The generated JSON is intentionally minimal: unspecified settings are omitted
80
+ and resolved at runtime. The explicit test site name is saved; default history,
81
+ compiler, PDF and other settings should not be copied into the file.
79
82
  `requirements` is safe before initialization: it checks only default host
80
83
  commands on `PATH` and does not read the temporary configuration or data.
81
84
  `doctor` verifies the configuration, database, administrator, and required
@@ -109,6 +112,26 @@ Ctrl+C to stop the server.
109
112
  The package requires Node.js 24 or newer and the LaTeX engines enabled in the
110
113
  selected configuration.
111
114
 
115
+ ## Test optional external agent terminals
116
+
117
+ On the isolated test installation, sign in as an administrator and open
118
+ **Coding Agent CLI**. The default agent allowlist must be empty. Confirm that missing
119
+ commands are reported without blocking normal project editing, then allow only
120
+ the agents intentionally configured for this test.
121
+
122
+ In a writable project, open **Terminal**, create a task and explicitly start it.
123
+ Verify input, resize, browser reconnect, and end execution. Make a small direct
124
+ source edit and check live editor synchronization, attributed history and comment
125
+ anchors. Another user's/agent's task in the same project must fail to start until
126
+ the first execution ends. Delete the task and verify project files remain.
127
+ Never use a real model for an automated
128
+ package smoke test; the integration tests use deterministic fake agents.
129
+
130
+ For a second package installation, `npm install --omit=dev --omit=optional` must
131
+ still allow normal startup and login; the external-tools page should report
132
+ unavailable terminal support. Terminal resources must be present in the built
133
+ browser assets even though xterm packages are development dependencies.
134
+
112
135
  ## Test the PM2 lifecycle in isolation
113
136
 
114
137
  Use both a private `PM2_HOME` and a test-only port. Every lifecycle command must