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.
- package/DESIGN.md +442 -26
- package/NPM_TESTING.md +23 -0
- package/OPERATIONS.md +227 -6
- package/README.md +8 -2
- package/README.zh-CN.md +6 -2
- package/THIRD_PARTY_NOTICES.md +73 -0
- package/dist/client/assets/AdminUsers-CuYfWnEk.js +1 -0
- package/dist/client/assets/AdminUsers-CuYfWnEk.js.br +0 -0
- package/dist/client/assets/AdminUsers-CuYfWnEk.js.gz +0 -0
- package/dist/client/assets/AgentIcon-ClP5dPRL.js +1 -0
- package/dist/client/assets/AgentIcon-ClP5dPRL.js.br +0 -0
- package/dist/client/assets/AgentIcon-ClP5dPRL.js.gz +0 -0
- package/dist/client/assets/AgentIcon-DxrC-zx_.css +1 -0
- package/dist/client/assets/AgentIcon-DxrC-zx_.css.br +0 -0
- package/dist/client/assets/AgentIcon-DxrC-zx_.css.gz +0 -0
- package/dist/client/assets/AgentManagement-jY_BF6Qy.js +1 -0
- package/dist/client/assets/AgentManagement-jY_BF6Qy.js.br +0 -0
- package/dist/client/assets/AgentManagement-jY_BF6Qy.js.gz +0 -0
- package/dist/client/assets/AgentTerminal-JKP2SVkZ.js +2 -0
- package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.br +0 -0
- package/dist/client/assets/AgentTerminal-JKP2SVkZ.js.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css +1 -0
- package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-B5LH8GIb.css.gz +0 -0
- package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js +16 -0
- package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.br +0 -0
- package/dist/client/assets/AgentTerminalSurface-CaYNNZ9A.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js +1 -0
- package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-C2TACfvP.js.gz +0 -0
- package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-BdU9nbgG.js.gz +0 -0
- package/dist/client/assets/Dashboard-B7mMz5Gj.js +5 -0
- package/dist/client/assets/Dashboard-B7mMz5Gj.js.br +0 -0
- package/dist/client/assets/Dashboard-B7mMz5Gj.js.gz +0 -0
- package/dist/client/assets/GitDialog-C2H-jKVO.js +3 -0
- package/dist/client/assets/GitDialog-C2H-jKVO.js.br +0 -0
- package/dist/client/assets/GitDialog-C2H-jKVO.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js +1 -0
- package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-DdKiE3pw.js.gz +0 -0
- package/dist/client/assets/{GitHubIcon-DNR0CleM.js → GitHubIcon-Cjli8pd_.js} +1 -1
- package/dist/client/assets/HistoryDialog-CoxJ3EsK.js +8 -0
- package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.br +0 -0
- package/dist/client/assets/HistoryDialog-CoxJ3EsK.js.gz +0 -0
- package/dist/client/assets/{LatexEditor-BzAk3WQM.js → LatexEditor-BhAKioho.js} +26 -26
- package/dist/client/assets/LatexEditor-BhAKioho.js.br +0 -0
- package/dist/client/assets/LatexEditor-BhAKioho.js.gz +0 -0
- package/dist/client/assets/PdfPreview-CC8KEz1Y.js +1 -0
- package/dist/client/assets/PdfPreview-CC8KEz1Y.js.br +0 -0
- package/dist/client/assets/PdfPreview-CC8KEz1Y.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js +1 -0
- package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-vi_HwlCS.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js +4 -0
- package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.br +0 -0
- package/dist/client/assets/ProjectSettings-Bl1t-Gnh.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js +30 -0
- package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-1UOdyfBq.js.gz +0 -0
- package/dist/client/assets/{QuickOpenDialog-CyqeckBM.js → QuickOpenDialog-BAzyrB-4.js} +1 -1
- package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-BAzyrB-4.js.gz +0 -0
- package/dist/client/assets/SaveButton-DkyoEu6j.js +1 -0
- package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js +3 -0
- package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-DzlVKtxs.js.gz +0 -0
- package/dist/client/assets/SuccessNotice-ubBtzzi_.js +1 -0
- package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js +1 -0
- package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-C6RVZdJZ.js.gz +0 -0
- package/dist/client/assets/TagColorSelect-xbc2H5ou.js +1 -0
- package/dist/client/assets/TagManagementDialog-8pZUVaEI.js +1 -0
- package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-8pZUVaEI.js.gz +0 -0
- package/dist/client/assets/{WordCountDialog-Bp8kYngA.js → WordCountDialog-BODhL9iz.js} +1 -1
- package/dist/client/assets/WordCountDialog-BODhL9iz.js.br +0 -0
- package/dist/client/assets/WordCountDialog-BODhL9iz.js.gz +0 -0
- package/dist/client/assets/arrow-down-B6T7Z6IO.js +1 -0
- package/dist/client/assets/check-BRlv1lrZ.js +1 -0
- package/dist/client/assets/chevron-up-krb7w67X.js +1 -0
- package/dist/client/assets/{chktex-BcGmZVUy.js → chktex-Bz-LKycq.js} +1 -1
- package/dist/client/assets/{clock-3-x2vcGFSH.js → clock-3-Fb1_e3ec.js} +1 -1
- package/dist/client/assets/{dist-D5mbpudl.js → dist-CMYWzCHL.js} +1 -1
- package/dist/client/assets/dist-CMYWzCHL.js.br +0 -0
- package/dist/client/assets/dist-CMYWzCHL.js.gz +0 -0
- package/dist/client/assets/{eye-CvzXPIMu.js → eye-B6AX_5uX.js} +1 -1
- package/dist/client/assets/{hard-drive-BeGQ5o79.js → hard-drive-CBmnJ2xS.js} +1 -1
- package/dist/client/assets/i18n-DF6keNBA.js +13 -0
- package/dist/client/assets/i18n-DF6keNBA.js.br +0 -0
- package/dist/client/assets/i18n-DF6keNBA.js.gz +0 -0
- package/dist/client/assets/index-DCwfhKK9.js +42 -0
- package/dist/client/assets/index-DCwfhKK9.js.br +0 -0
- package/dist/client/assets/index-DCwfhKK9.js.gz +0 -0
- package/dist/client/assets/index-SVNFLCYh.css +1 -0
- package/dist/client/assets/index-SVNFLCYh.css.br +0 -0
- package/dist/client/assets/index-SVNFLCYh.css.gz +0 -0
- package/dist/client/assets/info-DNSAs0_-.js +1 -0
- package/dist/client/assets/{minimize-2-yYMmsVER.js → minimize-2-C8oL6PTV.js} +1 -1
- package/dist/client/assets/{minus-CNHOVLWS.js → minus-TCBOakyi.js} +1 -1
- package/dist/client/assets/plus-Dfkyfvvy.js +1 -0
- package/dist/client/assets/{refresh-cw-B7vZa5K2.js → refresh-cw-DuLtxWBX.js} +1 -1
- package/dist/client/assets/relativeTime-BR0CVAvz.js +1 -0
- package/dist/client/assets/relativeTime-BR0CVAvz.js.br +0 -0
- package/dist/client/assets/relativeTime-BR0CVAvz.js.gz +0 -0
- package/dist/client/assets/{search-Czv3qsBy.js → search-n-2tBATf.js} +1 -1
- package/dist/client/assets/{spellCheck-DDCaK8Yx.js → spellCheck-xzICTGx1.js} +1 -1
- package/dist/client/assets/spellCheck-xzICTGx1.js.br +0 -0
- package/dist/client/assets/spellCheck-xzICTGx1.js.gz +0 -0
- package/dist/client/assets/tags-Dy96boLq.js +1 -0
- package/dist/client/assets/terminal-C0xh8jVR.js +1 -0
- package/dist/client/assets/{type-NT195OCy.js → type-BjXWxrjH.js} +1 -1
- package/dist/client/assets/{user-plus-BRuwNzcg.js → user-plus-3oJZJXHW.js} +1 -1
- package/dist/client/index.html +13 -7
- package/dist/server/agents/adapters/claude.js +180 -0
- package/dist/server/agents/adapters/codex.js +47 -0
- package/dist/server/agents/adapters/common.js +86 -0
- package/dist/server/agents/adapters/opencode.js +196 -0
- package/dist/server/agents/adapters/types.js +1 -0
- package/dist/server/agents/execution.js +147 -0
- package/dist/server/agents/launcher.js +57 -0
- package/dist/server/agents/processIdentity.js +63 -0
- package/dist/server/agents/registry.js +72 -0
- package/dist/server/agents/sessions.js +574 -0
- package/dist/server/agents/terminal.js +84 -0
- package/dist/server/agents/workspaces.js +341 -0
- package/dist/server/app.js +32 -1
- package/dist/server/cli.js +19 -47
- package/dist/server/collaboration.js +64 -36
- package/dist/server/compileArtifacts.js +11 -44
- package/dist/server/compiler.js +16 -38
- package/dist/server/config.js +8 -2
- package/dist/server/db.js +33 -0
- package/dist/server/editHistory.js +59 -65
- package/dist/server/history.js +28 -13
- package/dist/server/i18n.js +26 -8
- package/dist/server/latexRoot.js +4 -2
- package/dist/server/locales/zh-Hant.js +145 -0
- package/dist/server/lucideIcons.js +14 -17
- package/dist/server/projectMutations.js +21 -0
- package/dist/server/routes/agents.js +135 -0
- package/dist/server/routes/compile.js +23 -43
- package/dist/server/routes/projectHistory.js +13 -6
- package/dist/server/routes/projectShared.js +6 -1
- package/dist/server/routes/projects.js +15 -23
- package/dist/shared/agentMessages.js +51 -0
- package/dist/shared/agentProtocol.js +41 -0
- package/dist/shared/historyFiles.js +1 -1
- package/dist/shared/historyTracking.js +2 -0
- package/dist/shared/locales.js +21 -0
- package/dist/shared/sourceCommentAnchors.js +52 -4
- package/package.json +7 -3
- package/templates/agents/AGENTS.md +135 -0
- package/texlite.config.example.json +3 -2
- package/dist/client/assets/AdminUsers-rPpYTAU6.js +0 -1
- package/dist/client/assets/AdminUsers-rPpYTAU6.js.br +0 -0
- package/dist/client/assets/AdminUsers-rPpYTAU6.js.gz +0 -0
- package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js +0 -1
- package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js.br +0 -0
- package/dist/client/assets/AvatarSettingsDialog-CIPKapVe.js.gz +0 -0
- package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js.br +0 -0
- package/dist/client/assets/CitationLibraryDialog-BhZX8BV2.js.gz +0 -0
- package/dist/client/assets/Dashboard-DppEhsjL.js +0 -5
- package/dist/client/assets/Dashboard-DppEhsjL.js.br +0 -0
- package/dist/client/assets/Dashboard-DppEhsjL.js.gz +0 -0
- package/dist/client/assets/GitDialog-BOu46hxA.js +0 -3
- package/dist/client/assets/GitDialog-BOu46hxA.js.br +0 -0
- package/dist/client/assets/GitDialog-BOu46hxA.js.gz +0 -0
- package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js +0 -1
- package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js.br +0 -0
- package/dist/client/assets/GitHubAccountDialog-hosK9cLW.js.gz +0 -0
- package/dist/client/assets/HistoryDialog-BdkuEl8r.js +0 -8
- package/dist/client/assets/HistoryDialog-BdkuEl8r.js.br +0 -0
- package/dist/client/assets/HistoryDialog-BdkuEl8r.js.gz +0 -0
- package/dist/client/assets/LatexEditor-BzAk3WQM.js.br +0 -0
- package/dist/client/assets/LatexEditor-BzAk3WQM.js.gz +0 -0
- package/dist/client/assets/PdfPreview-DkjI1eCo.js +0 -1
- package/dist/client/assets/PdfPreview-DkjI1eCo.js.br +0 -0
- package/dist/client/assets/PdfPreview-DkjI1eCo.js.gz +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js +0 -1
- package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js.br +0 -0
- package/dist/client/assets/ProjectIconPickerDialog-D8Uo4H10.js.gz +0 -0
- package/dist/client/assets/ProjectSettings-Jdr94nOc.js +0 -1
- package/dist/client/assets/ProjectSettings-Jdr94nOc.js.br +0 -0
- package/dist/client/assets/ProjectSettings-Jdr94nOc.js.gz +0 -0
- package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js +0 -30
- package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js.br +0 -0
- package/dist/client/assets/ProjectWorkspace-D9v3Jj8T.js.gz +0 -0
- package/dist/client/assets/QuickOpenDialog-CyqeckBM.js.br +0 -0
- package/dist/client/assets/QuickOpenDialog-CyqeckBM.js.gz +0 -0
- package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js +0 -3
- package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js.br +0 -0
- package/dist/client/assets/SelectionHistoryDialog-Dlutex-A.js.gz +0 -0
- package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js +0 -1
- package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js.br +0 -0
- package/dist/client/assets/SystemMetricsDialog-CCWxXw6g.js.gz +0 -0
- package/dist/client/assets/TagColorSelect-D3T-rw4K.js +0 -1
- package/dist/client/assets/TagManagementDialog-CxjrSX-o.js +0 -1
- package/dist/client/assets/TagManagementDialog-CxjrSX-o.js.br +0 -0
- package/dist/client/assets/TagManagementDialog-CxjrSX-o.js.gz +0 -0
- package/dist/client/assets/WordCountDialog-Bp8kYngA.js.br +0 -0
- package/dist/client/assets/WordCountDialog-Bp8kYngA.js.gz +0 -0
- package/dist/client/assets/binary-B57nBiwS.js +0 -1
- package/dist/client/assets/check-DFoA73zZ.js +0 -1
- package/dist/client/assets/chevron-up-C8DyKLxi.js +0 -1
- package/dist/client/assets/dist-D5mbpudl.js.br +0 -0
- package/dist/client/assets/dist-D5mbpudl.js.gz +0 -0
- package/dist/client/assets/i18n-CRWKZA6W.js +0 -9
- package/dist/client/assets/i18n-CRWKZA6W.js.br +0 -0
- package/dist/client/assets/i18n-CRWKZA6W.js.gz +0 -0
- package/dist/client/assets/index-D0eqhDpZ.js +0 -42
- package/dist/client/assets/index-D0eqhDpZ.js.br +0 -0
- package/dist/client/assets/index-D0eqhDpZ.js.gz +0 -0
- package/dist/client/assets/index-DnhiIb1V.css +0 -1
- package/dist/client/assets/index-DnhiIb1V.css.br +0 -0
- package/dist/client/assets/index-DnhiIb1V.css.gz +0 -0
- package/dist/client/assets/plus-BDquy76g.js +0 -1
- package/dist/client/assets/relativeTime-DuOytR_J.js +0 -1
- package/dist/client/assets/relativeTime-DuOytR_J.js.br +0 -0
- package/dist/client/assets/relativeTime-DuOytR_J.js.gz +0 -0
- package/dist/client/assets/sigma-CI6gmAkl.js +0 -1
- package/dist/client/assets/spellCheck-DDCaK8Yx.js.br +0 -0
- package/dist/client/assets/spellCheck-DDCaK8Yx.js.gz +0 -0
- package/dist/client/assets/tags-CLK7WRSs.js +0 -1
- package/preview-1.png +0 -0
- package/preview-2.png +0 -0
package/OPERATIONS.md
CHANGED
|
@@ -94,6 +94,12 @@ npm update --global texlite
|
|
|
94
94
|
texlite restart
|
|
95
95
|
~~~
|
|
96
96
|
|
|
97
|
+
Direct upgrades are supported from TexLite 0.2.0 onward. Back up the data
|
|
98
|
+
directory before upgrading; database migrations run automatically at startup.
|
|
99
|
+
Compilation output layouts from before 0.2.0 are no longer read. If an old
|
|
100
|
+
project has no PDF preview after upgrading, compile it again. This change does
|
|
101
|
+
not remove source files, comments, or project snapshots.
|
|
102
|
+
|
|
97
103
|
Uninstalling the package does not remove configuration or data:
|
|
98
104
|
|
|
99
105
|
~~~bash
|
|
@@ -190,6 +196,16 @@ one process.
|
|
|
190
196
|
|
|
191
197
|
## Configuration
|
|
192
198
|
|
|
199
|
+
`texlite init` writes a minimal configuration, not a copy of all defaults.
|
|
200
|
+
Accepting the default site name and leaving optional inputs empty can produce
|
|
201
|
+
`{}`. Custom site/contact inputs and explicitly supplied initialization
|
|
202
|
+
overrides (`TEXLITE_HOST`, `TEXLITE_PORT`, `TEXLITE_BASE_PATH`, and
|
|
203
|
+
`TEXLITE_DATA_DIR`) are saved; other environment variables remain runtime
|
|
204
|
+
overrides. Omitted options use the current defaults, including after upgrades.
|
|
205
|
+
Use `texlite config` to inspect effective values and the example JSON as a
|
|
206
|
+
reference when adding overrides. Existing configuration files are left intact;
|
|
207
|
+
to adopt a new default, remove the corresponding explicit setting yourself.
|
|
208
|
+
|
|
193
209
|
### Where configuration and data live
|
|
194
210
|
|
|
195
211
|
Configuration path precedence:
|
|
@@ -223,9 +239,9 @@ preferred.
|
|
|
223
239
|
| `clientDir` | Installed package's `dist/client` | Normally changed only for development or a custom deployment. |
|
|
224
240
|
| `sessionDays` | `14` | Login-session lifetime. |
|
|
225
241
|
| `uploads.maxFileSizeMB` | `50` MB | Limit for uploads, ZIP entries, and attachments. |
|
|
226
|
-
| `pdf.loadingStrategy` / `pdf.rangeThresholdMB` | `auto` / `
|
|
242
|
+
| `pdf.loadingStrategy` / `pdf.rangeThresholdMB` | `auto` / `2` MB | Uses full transfer through the threshold and allows PDF.js byte-range requests above it. Explicitly configured thresholds are preserved. |
|
|
227
243
|
| `history.maxVersions` / `history.maxStorageMB` | `0` (unlimited) / `128` MiB | Per-project ordinary-version count (`0` = unlimited) and soft limit for deduplicated files plus snapshot metadata. Protected snapshots may exceed the limit; shared SQLite overhead is excluded. |
|
|
228
|
-
| `editHistory.maxStorageMB` | `
|
|
244
|
+
| `editHistory.maxStorageMB` / `editHistory.maxSegments` | `64` MiB / `20000` | Independent per-project payload and segment-count caps for author-attributed selection edits. Retains the newest records within both limits and never consumes snapshot storage. Both settings are optional; existing explicit limits are preserved. |
|
|
229
245
|
| `latex.latexmk` | `latexmk` | Host command. |
|
|
230
246
|
| `latex.defaultEngine` | `xelatex` | Must appear in the allowed list. |
|
|
231
247
|
| `updates.enabled` | `true` | Background release checks and administrator dashboard reminders. Set to `false` for offline deployments. |
|
|
@@ -249,7 +265,7 @@ TEXLITE_DATA_DIR TEXLITE_CLIENT_DIR
|
|
|
249
265
|
TEXLITE_SESSION_DAYS TEXLITE_MAX_UPLOAD_SIZE_MB
|
|
250
266
|
TEXLITE_PDF_LOADING_STRATEGY TEXLITE_PDF_RANGE_THRESHOLD_MB
|
|
251
267
|
TEXLITE_HISTORY_MAX_VERSIONS TEXLITE_HISTORY_MAX_STORAGE_MB
|
|
252
|
-
TEXLITE_EDIT_HISTORY_MAX_STORAGE_MB
|
|
268
|
+
TEXLITE_EDIT_HISTORY_MAX_STORAGE_MB TEXLITE_EDIT_HISTORY_MAX_SEGMENTS
|
|
253
269
|
TEXLITE_LATEXMK TEXLITE_DEFAULT_ENGINE
|
|
254
270
|
TEXLITE_COMPILE_TIMEOUT TEXLITE_MAX_COMPILE_JOBS
|
|
255
271
|
TEXLITE_GIT TEXLITE_GIT_TIMEOUT
|
|
@@ -264,7 +280,7 @@ default. `texlite init` applies the same validation.
|
|
|
264
280
|
|
|
265
281
|
Accepted limits are: port `1–65535`, sessions `1–3650` days, upload size
|
|
266
282
|
`1–2048` MB, history count `0–50000` (`0` = unlimited), snapshot history size `16–102400` MB,
|
|
267
|
-
edit-history size `4–102400` MB
|
|
283
|
+
edit-history size `4–102400` MB and count `1–100000`, PDF range
|
|
268
284
|
threshold `1–2048` MB, compile timeout `1–3600` seconds, compile jobs `1–32`,
|
|
269
285
|
and Git timeout `1–3600` seconds.
|
|
270
286
|
|
|
@@ -293,14 +309,14 @@ Nginx, omitting a URI from `proxy_pass` keeps `/texlite` intact:
|
|
|
293
309
|
~~~nginx
|
|
294
310
|
location = /texlite {
|
|
295
311
|
proxy_pass http://127.0.0.1:3000;
|
|
296
|
-
proxy_set_header Host $
|
|
312
|
+
proxy_set_header Host $http_host;
|
|
297
313
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
298
314
|
}
|
|
299
315
|
|
|
300
316
|
location ^~ /texlite/ {
|
|
301
317
|
proxy_pass http://127.0.0.1:3000;
|
|
302
318
|
proxy_http_version 1.1;
|
|
303
|
-
proxy_set_header Host $
|
|
319
|
+
proxy_set_header Host $http_host;
|
|
304
320
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
305
321
|
proxy_set_header Upgrade $http_upgrade;
|
|
306
322
|
proxy_set_header Connection "upgrade";
|
|
@@ -367,6 +383,211 @@ npm run build
|
|
|
367
383
|
npm start
|
|
368
384
|
~~~
|
|
369
385
|
|
|
386
|
+
## External agent terminals
|
|
387
|
+
|
|
388
|
+
No agents are allowed by default. Administrators open **Coding Agent CLI** from the
|
|
389
|
+
dashboard to select allowed agents and refresh executable detection. There is no
|
|
390
|
+
separate global switch. Deselecting an agent stops its active executions while
|
|
391
|
+
preserving task context and cleanup access; other allowed agents are unaffected.
|
|
392
|
+
Supported launch commands are `codex`, `opencode`, and `claude` on the
|
|
393
|
+
TexLite service account's `PATH`. Detection reports installation/version, not
|
|
394
|
+
authentication or provider quota. A PM2/systemd service may have a different
|
|
395
|
+
`PATH` from an interactive login shell.
|
|
396
|
+
|
|
397
|
+
The management screen is a normal page. Administrators can filter all projects'
|
|
398
|
+
tasks by project, user, agent, execution state, or failed cleanup,
|
|
399
|
+
with 50 entries per page. They can end/delete individual or selected tasks;
|
|
400
|
+
administrative access does not grant access to other users' terminal streams or
|
|
401
|
+
private project files. Other users get a personal task list from **Agent tasks**.
|
|
402
|
+
|
|
403
|
+
Users with project write access can open **Terminal** in the workspace toolbar.
|
|
404
|
+
Select an allowed installed agent and click **Start task** to create and launch
|
|
405
|
+
it in one action. The task name is optional; an omitted name receives six random
|
|
406
|
+
characters from uppercase/lowercase ASCII letters, digits and `-`. If launch
|
|
407
|
+
fails, the same task stays selected for retry.
|
|
408
|
+
Multiple tasks may use the same agent in the same project. A shared information
|
|
409
|
+
hint in the terminal heading asks users not to create new sessions inside agents,
|
|
410
|
+
for example with `/new` or `/clear`: commands that start a new conversation with
|
|
411
|
+
an empty context can bypass the task's registered session binding.
|
|
412
|
+
Native renaming does not change a session ID, but its title is independent of
|
|
413
|
+
the TexLite task name.
|
|
414
|
+
The resizable terminal sits below the editor. Browser tabs attach to the same running task; one tab
|
|
415
|
+
controls input, and another can take control. Hiding the panel, leaving a project,
|
|
416
|
+
disconnecting a browser, or archiving a project does not stop executions.
|
|
417
|
+
Agent tasks have no archive state: end an execution to free its process, or
|
|
418
|
+
delete a task to remove its saved conversation.
|
|
419
|
+
|
|
420
|
+
Use the terminal heading's maximize/restore button to fill the editor column's
|
|
421
|
+
height and return to the previous split. Dragging the separator can also collapse
|
|
422
|
+
the source editor. Maximizing keeps the editor and terminal mounted; it does not
|
|
423
|
+
restart the task or clear terminal output. Closing and reopening returns to a
|
|
424
|
+
split view.
|
|
425
|
+
|
|
426
|
+
Agents execute directly in the project's source directory. Only one task may
|
|
427
|
+
execute per project, across all users and agents (including different tasks of
|
|
428
|
+
the same user). Other projects are independent. An execution retains the claim
|
|
429
|
+
through startup, termination, and final file synchronization. Hiding a terminal or archiving a project
|
|
430
|
+
does not release it. Stop the active task before starting another one.
|
|
431
|
+
This is a source-consistency and attribution rule, not a CLI limitation or a
|
|
432
|
+
provider quota control. Waiting for input still counts as an active execution;
|
|
433
|
+
the terminal shows a reminder to use **End execution** when finished. Hiding the
|
|
434
|
+
terminal is deliberately separate and keeps the task running.
|
|
435
|
+
|
|
436
|
+
Pending collaboration edits are saved before launch. While the CLI runs, file
|
|
437
|
+
changes are synchronized into Yjs, comment anchors, edit history and snapshots,
|
|
438
|
+
attributed to the task owner. Autosave checks for external edits before writing;
|
|
439
|
+
non-overlapping human and agent changes are merged. Conflicting agent versions
|
|
440
|
+
are saved under `.texlite-agent-conflicts/<task-id>/` in the project, the human
|
|
441
|
+
draft is preserved, and execution ends with a warning. Review those files manually.
|
|
442
|
+
Source-tree replacement (Git checkout/restore, snapshot restore or project
|
|
443
|
+
deletion) ends execution and synchronizes its last writes first.
|
|
444
|
+
|
|
445
|
+
Task-specific CLI state stays under `dataDir/agent-tasks/<task-id>/state/`.
|
|
446
|
+
`TEXLITE_PROJECT_CONTEXT` names a JSON file containing the source directory,
|
|
447
|
+
configured main file, output directory and last compile result.
|
|
448
|
+
`TEXLITE_COMPILE_LOG` names its log file; it is refreshed after compilation through
|
|
449
|
+
TexLite. Ask the agent to read these paths when diagnosing a compile failure.
|
|
450
|
+
There is no separate source copy or review/apply step.
|
|
451
|
+
|
|
452
|
+
Before an agent starts, TexLite copies its fixed English `AGENTS.md` template
|
|
453
|
+
into the project source root if the file is missing. It defines the agent as a
|
|
454
|
+
LaTeX and academic-writing assistant for this manuscript: writing, references,
|
|
455
|
+
typesetting, compilation diagnostics and directly related supporting scripts
|
|
456
|
+
are in scope; unrelated tasks and host administration should be refused before
|
|
457
|
+
using tools. It also covers research integrity, live collaboration, the
|
|
458
|
+
source/output layout and how to find compilation logs and results.
|
|
459
|
+
Existing instructions (even an empty file) are never overwritten. Edit the
|
|
460
|
+
project's copy normally to customize it; upgrades do not rewrite that file.
|
|
461
|
+
To adopt an updated template in an existing project, review and merge the new
|
|
462
|
+
guidance into its `AGENTS.md`, preserving project-specific conventions, then
|
|
463
|
+
start a new conversation. Running or resumed conversations are not guaranteed
|
|
464
|
+
to reload updated instructions.
|
|
465
|
+
|
|
466
|
+
TexLite keeps the CLIs' native project-instruction loading and does not create
|
|
467
|
+
a separate `CLAUDE.md` or change their settings. See the official instructions
|
|
468
|
+
for [Codex](https://developers.openai.com/codex/guides/agents-md/),
|
|
469
|
+
[OpenCode](https://opencode.ai/docs/rules/) and
|
|
470
|
+
[Claude Code](https://code.claude.com/docs/en/memory#agents-md).
|
|
471
|
+
Claude Code's native `AGENTS.md` support requires a supported version and enabled
|
|
472
|
+
project-instruction loading; a project `CLAUDE.md` can take precedence depending
|
|
473
|
+
on the user's CLI settings. These instructions guide model behavior, not enforce
|
|
474
|
+
an OS sandbox or guarantee refusal. The trusted-user deployment model is unchanged.
|
|
475
|
+
|
|
476
|
+
**End execution** releases processes while preserving task files/context.
|
|
477
|
+
**Delete task** ends execution, cleans its native conversation/state and removes
|
|
478
|
+
only task-owned state, never project files. A failed cleanup stays visible
|
|
479
|
+
for retry. Apart from the per-project writer claim, there are no execution-count limits, idle expiry, task timeouts, token
|
|
480
|
+
budgets, or billing controls. A server restart interrupts executions; it does not
|
|
481
|
+
automatically restart them. Exact-context continuation depends on the adapter
|
|
482
|
+
being able to identify a saved native session. Starting a CLI without sending a
|
|
483
|
+
message may leave no conversation to resume. If the adapter confirms that its
|
|
484
|
+
task context has no conversation and no session ID has been saved, the same task can be
|
|
485
|
+
started again. Failed or ambiguous checks require a retry, not an automatic
|
|
486
|
+
new conversation. Once a native session ID is saved, later launches resume that
|
|
487
|
+
exact conversation; a failure never resets its state. Use **+** for a separate
|
|
488
|
+
conversation instead.
|
|
489
|
+
|
|
490
|
+
Executions started by current versions keep an `execution.json` recovery lease
|
|
491
|
+
under their task directory. After an abnormal shutdown, TexLite verifies the
|
|
492
|
+
launcher's execution marker and OS creation identity and reaps the old process
|
|
493
|
+
tree before permitting another task in that project. It never kills a process
|
|
494
|
+
solely because a saved PID matches. The task and native conversation remain
|
|
495
|
+
available for explicit continuation; source files left on disk are preserved
|
|
496
|
+
and included in project snapshots.
|
|
497
|
+
|
|
498
|
+
If recovery cannot verify or stop an execution, its task remains visible as
|
|
499
|
+
stopping with a recovery error, and the project stays reserved. Owners or
|
|
500
|
+
administrators can retry **End execution**. If instructed, stop the task's
|
|
501
|
+
processes on the host first, then retry; do not delete its recovery file to
|
|
502
|
+
bypass the reservation. Deletion and source-tree replacement also require
|
|
503
|
+
successful recovery. This does not manage host sessions started outside TexLite
|
|
504
|
+
or deliberately detached processes. Stop active tasks before upgrading from a
|
|
505
|
+
version that did not write recovery leases; those older processes cannot be
|
|
506
|
+
identified retrospectively.
|
|
507
|
+
|
|
508
|
+
| Agent | Native state and continuation | Cleanup |
|
|
509
|
+
| --- | --- | --- |
|
|
510
|
+
| Codex | Task-specific `CODEX_HOME`; resume an identified transcript UUID. Use `--no-daemon` when advertised by the installed CLI. | Prefer detected native `delete --force`; remove the task-owned state directory afterward. |
|
|
511
|
+
| OpenCode | New V2 tasks share the host database, sign-ins and native history. Bind a separate session ID per task and use `--standalone` to own the execution process tree. Existing private conversations keep their original state. | Delete only the task's registered native session, verify deletion, then remove its task directory. Never remove the shared database or host credentials. |
|
|
512
|
+
| Claude Code | Share the service account's native configuration, credentials and initialization state; start with a task UUID and resume that exact ID. | Remove only the registered session's transcripts and session-scoped files; keep host settings and unrelated conversations. |
|
|
513
|
+
|
|
514
|
+
Task deletion records native-cleanup completion in the database before removing
|
|
515
|
+
the task's local files. If local removal fails or the service restarts, retrying
|
|
516
|
+
deletion finishes that step without needing a removed session binding or an
|
|
517
|
+
installed CLI. Failed native cleanup keeps its ownership information for retry.
|
|
518
|
+
If an OpenCode task's project directory has been deleted, management commands
|
|
519
|
+
use its task-state directory while still targeting only its registered database
|
|
520
|
+
and session ID; the deleted project is not recreated.
|
|
521
|
+
|
|
522
|
+
All agents inherit the TexLite service account's `XDG_CACHE_HOME`. If unset,
|
|
523
|
+
the CLI uses its own default cache location. This lets model catalogs and
|
|
524
|
+
downloaded dependencies be reused without merging task conversations. It does
|
|
525
|
+
not share the mixed state/cache files inside task-specific native homes.
|
|
526
|
+
Different projects and native terminals may use the cache concurrently; clearing
|
|
527
|
+
or updating shared caches can affect all of them. Task deletion never clears the
|
|
528
|
+
host cache. Existing per-task cache directories are left untouched on startup
|
|
529
|
+
and are removed with their task on deletion. No new cache configuration is needed.
|
|
530
|
+
|
|
531
|
+
OpenCode 2 resolves the host database using `opencode debug paths db`, including
|
|
532
|
+
custom `OPENCODE_DB` settings. Its path and a task-specific session ID are recorded
|
|
533
|
+
in `agent-tasks/<task-id>/state/opencode-session.json`; no database migration or
|
|
534
|
+
credential copying is needed. An older task with an empty private database moves
|
|
535
|
+
to this layout on its next start. An existing private conversation is kept in
|
|
536
|
+
place to avoid losing history; use `/connect` there if needed, or create a new
|
|
537
|
+
task to use shared host authentication. TexLite's task pages/API show and manage
|
|
538
|
+
only its own registered tasks. OpenCode's native history picker inside the
|
|
539
|
+
terminal can also show host conversations; those are not imported into TexLite.
|
|
540
|
+
|
|
541
|
+
Claude tasks directly reuse the service account's configuration and sign-in,
|
|
542
|
+
including model settings, plugins and completed onboarding. Without a custom
|
|
543
|
+
`CLAUDE_CONFIG_DIR`, TexLite leaves that variable unset so Claude still finds its
|
|
544
|
+
native `~/.claude.json`; an explicitly configured directory is reused as-is.
|
|
545
|
+
The configuration location and task UUID are registered in
|
|
546
|
+
`agent-tasks/<task-id>/state/claude-session.json` before launching, so later
|
|
547
|
+
environment changes cannot redirect a saved conversation or its cleanup.
|
|
548
|
+
TexLite never imports the host's other conversations into its task list.
|
|
549
|
+
Deletion does not rewrite shared prompt history, settings, plugins or global
|
|
550
|
+
caches, and never uses project-wide `claude purge`.
|
|
551
|
+
Old isolated Claude tasks are not migrated; remove them before upgrading and
|
|
552
|
+
create new tasks to use the shared configuration.
|
|
553
|
+
|
|
554
|
+
Claude starts and resumes also inherit the current TexLite process's exported
|
|
555
|
+
gateway credentials and models (`ANTHROPIC_*`), supported Claude model/context
|
|
556
|
+
settings, cloud-provider authentication (AWS, Azure and Google), request timeout,
|
|
557
|
+
proxy and certificate settings. Only configuration variables are forwarded;
|
|
558
|
+
another Claude session's identity, nested-session markers and transcript controls
|
|
559
|
+
are not. Credentials are not saved in TexLite's session binding.
|
|
560
|
+
Each TexLite instance uses its own process environment, regardless of its port;
|
|
561
|
+
it never reads another instance's environment or sources shell startup files.
|
|
562
|
+
Export variables **before** starting TexLite. After changing a shell profile,
|
|
563
|
+
restart the relevant instance from a shell with those variables loaded
|
|
564
|
+
(`texlite restart --config /path/to/texlite.config.json`, or restart `npm run dev`
|
|
565
|
+
for development); refreshing the browser or restarting only the agent cannot
|
|
566
|
+
update its parent service's environment. Alternatively, put persistent Claude
|
|
567
|
+
variables in the host's `~/.claude/settings.json` under `env`, as described in
|
|
568
|
+
the [Claude environment-variable reference](https://code.claude.com/docs/en/env-vars).
|
|
569
|
+
|
|
570
|
+
On the first start, Codex and legacy isolated OpenCode tasks copy selected host credential/configuration
|
|
571
|
+
files if available; they do not copy host conversation history. Credentials
|
|
572
|
+
subsequently refreshed within a task are preserved. Keychain/credential formats
|
|
573
|
+
vary by CLI version, so an individual task may require login. Provider environment
|
|
574
|
+
variables supported by the adapters are passed through. CLI authentication stays
|
|
575
|
+
in the native terminal; TexLite does not provide an account or model. Agents may
|
|
576
|
+
use the same server account quota and send project contents to their providers.
|
|
577
|
+
|
|
578
|
+
Agent terminals are not OS sandboxes. Enable these terminals only for trusted writers
|
|
579
|
+
who may use server-side tools with the TexLite service account's permissions.
|
|
580
|
+
In Docker, install commands and configure credentials **inside the container**;
|
|
581
|
+
host executables are not automatically available there.
|
|
582
|
+
|
|
583
|
+
`node-pty` is an optional production dependency. If its native module cannot be
|
|
584
|
+
installed or loaded, ordinary TexLite operation remains available and the tool
|
|
585
|
+
page reports terminal support unavailable. Reinstall optional dependencies for
|
|
586
|
+
the server's Node/platform and restart before retrying. The browser's terminal
|
|
587
|
+
renderer is bundled and loaded only when a terminal is opened. Linux PTY I/O and
|
|
588
|
+
termination are covered by a local, deterministic test agent without any model
|
|
589
|
+
calls; platform/native-agent login behavior should also be checked when deploying.
|
|
590
|
+
|
|
370
591
|
## Backup and security
|
|
371
592
|
|
|
372
593
|
Back up the entire configured data directory, including `texlite.db`, its WAL
|
package/README.md
CHANGED
|
@@ -17,8 +17,7 @@ teams. Use your existing LaTeX distribution, with no heavyweight service stack.
|
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-

|
|
20
|
+
https://github.com/user-attachments/assets/c2b277ab-7cab-4f2b-8684-358fd9fefe8f
|
|
22
21
|
|
|
23
22
|
## Why TexLite
|
|
24
23
|
|
|
@@ -123,6 +122,9 @@ shared browser writing, not a replacement for a personal IDE.
|
|
|
123
122
|
project-level `latexmkrc`.
|
|
124
123
|
- Per-project history and owner-only Git/GitHub backup. Git is optional and is
|
|
125
124
|
checked only when its integration is used.
|
|
125
|
+
- Optional browser terminals for host-installed coding agents, enabled by an
|
|
126
|
+
administrator. Agents edit the project directly, with one running task per
|
|
127
|
+
project. See [external agent terminals](OPERATIONS.md#external-agent-terminals).
|
|
126
128
|
|
|
127
129
|
<a id="docker-deployment"></a>
|
|
128
130
|
|
|
@@ -133,6 +135,10 @@ Git, and Harper locally, use the heavier
|
|
|
133
135
|
[TexLite-Docker](https://github.com/SWUFE-DB-Group/TexLite-Docker) deployment.
|
|
134
136
|
Its published image bundles those runtime dependencies for you.
|
|
135
137
|
|
|
138
|
+
The Docker image currently does not include Coding Agent CLIs. For agent
|
|
139
|
+
integration, we recommend deploying TexLite directly via npm and installing and
|
|
140
|
+
configuring the CLIs on the host.
|
|
141
|
+
|
|
136
142
|
```bash
|
|
137
143
|
git clone https://github.com/SWUFE-DB-Group/TexLite-Docker.git
|
|
138
144
|
cd texlite-docker
|
package/README.zh-CN.md
CHANGED
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-

|
|
20
|
+
https://github.com/user-attachments/assets/c2b277ab-7cab-4f2b-8684-358fd9fefe8f
|
|
22
21
|
|
|
23
22
|
## 为什么选择 TexLite
|
|
24
23
|
|
|
@@ -109,6 +108,8 @@ TeX 更新、数据位置与协作工作流的掌控。
|
|
|
109
108
|
可下载产物以及可选的项目级 `latexmkrc`。
|
|
110
109
|
- 每个项目拥有历史版本和仅所有者可用的 Git/GitHub 备份;Git 是可选依赖,仅在使用
|
|
111
110
|
集成时才检查。
|
|
111
|
+
- 可选的网页终端可调用服务器上安装的代码 agent,由管理员启用。Agent 直接编辑项目,
|
|
112
|
+
每个项目同时只能运行一个任务。参见[外部 agent 终端](OPERATIONS.md#external-agent-terminals)。
|
|
112
113
|
|
|
113
114
|
<a id="docker-deployment"></a>
|
|
114
115
|
|
|
@@ -118,6 +119,9 @@ TeX 更新、数据位置与协作工作流的掌控。
|
|
|
118
119
|
[TexLite-Docker](https://github.com/SWUFE-DB-Group/TexLite-Docker) 部署。其已发布镜像会
|
|
119
120
|
一并提供这些运行时依赖。
|
|
120
121
|
|
|
122
|
+
当前 Docker 镜像未预装 Coding Agent CLI。如需使用此功能,推荐通过 npm 直接部署
|
|
123
|
+
TexLite,并在宿主机安装、配置所需 CLI。
|
|
124
|
+
|
|
121
125
|
```bash
|
|
122
126
|
git clone https://github.com/SWUFE-DB-Group/TexLite-Docker.git
|
|
123
127
|
cd texlite-docker
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
+
## Coding agent brand icons
|
|
4
|
+
|
|
5
|
+
The inline SVG paths in `src/client/agents/AgentIcon.tsx` come from theSVG:
|
|
6
|
+
[Codex (OpenAI)](https://thesvg.org/icon/codex-openai),
|
|
7
|
+
[Claude Code](https://thesvg.org/icon/claude-code), and
|
|
8
|
+
[OpenCode](https://thesvg.org/icon/opencode).
|
|
9
|
+
Brand names and marks belong to their respective owners. Their use identifies
|
|
10
|
+
the installed tools and does not imply endorsement of TexLite.
|
|
11
|
+
|
|
12
|
+
MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2025 thesvg.org
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in
|
|
24
|
+
all copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
32
|
+
THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
## Terminal color palettes
|
|
35
|
+
|
|
36
|
+
The terminal presets in `src/client/terminalTheme.ts` adapt ANSI palette values from:
|
|
37
|
+
|
|
38
|
+
- [Catppuccin Latte](https://github.com/catppuccin/windows-terminal/blob/main/latte.json),
|
|
39
|
+
copyright (c) 2021 Catppuccin, distributed under the MIT license.
|
|
40
|
+
- [Gruvbox Dark](https://github.com/morhetz/gruvbox-contrib/blob/master/xresources/gruvbox-dark.xresources),
|
|
41
|
+
by morhetz, published as part of [Gruvbox](https://github.com/morhetz/gruvbox)
|
|
42
|
+
under MIT/X11.
|
|
43
|
+
|
|
44
|
+
The MIT license terms reproduced above apply to these palette adaptations.
|
|
45
|
+
|
|
46
|
+
## xterm.js and node-pty
|
|
47
|
+
|
|
48
|
+
The optional external-agent terminal bundles `@xterm/xterm` and `@xterm/addon-fit`
|
|
49
|
+
in the browser and uses the separately installed optional `node-pty` dependency
|
|
50
|
+
on the server. Their original licenses also ship in the dependency packages.
|
|
51
|
+
|
|
52
|
+
Copyright (c) 2017-2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)
|
|
53
|
+
Copyright (c) 2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)
|
|
54
|
+
Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com)
|
|
55
|
+
Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/)
|
|
56
|
+
Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
|
|
57
|
+
|
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
59
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
60
|
+
in the Software without restriction, including without limitation the rights
|
|
61
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
62
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
63
|
+
furnished to do so, subject to the following conditions:
|
|
64
|
+
|
|
65
|
+
The above copyright notice and this permission notice shall be included in
|
|
66
|
+
all copies or substantial portions of the Software.
|
|
67
|
+
|
|
68
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
69
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
70
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
71
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
72
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
73
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
74
|
+
THE SOFTWARE.
|
|
75
|
+
|
|
3
76
|
## DiceBear avatars
|
|
4
77
|
|
|
5
78
|
TexLite generates optional user avatars locally using
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{$ as r,I as i,M as a,N as ee,Z as te,at as ne,et as re}from"./relativeTime-BR0CVAvz.js";import{t as ie}from"./search-n-2tBATf.js";import{t as o}from"./user-plus-3oJZJXHW.js";import{C as s,E as c,b as l,c as u,j as ae,s as oe,y as se}from"./index-DCwfhKK9.js";import{a as ce,l as le,n as ue,r as de,t as fe}from"./dist-CMYWzCHL.js";import{t as pe}from"./SuccessNotice-ubBtzzi_.js";var d={name:`dices`,size:24,node:[[`rect`,{width:`12`,height:`12`,x:`2`,y:`10`,rx:`2`,ry:`2`,key:`6agr2n`}],[`path`,{d:`m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6`,key:`1o487t`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 14h.01`,key:`ssrbsk`}],[`path`,{d:`M15 6h.01`,key:`cblpky`}],[`path`,{d:`M18 9h.01`,key:`2061c0`}]]};d.node;var f=l(d),p={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};p.node;var m=l(p),h={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};h.node;var g=l(h),_=e(t(),1),v=n();function y(e=10){let t=crypto.getRandomValues(new Uint8Array(e));return Array.from(t,e=>`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%`[e%62]).join(``)}function b({currentUser:e,minPasswordLength:t,onBack:n}){let{t:l}=ae(),[d,p]=(0,_.useState)([]),[h,b]=(0,_.useState)(``),[x,S]=(0,_.useState)(1),[C,me]=(0,_.useState)({page:1,pageSize:20,total:0,totalPages:0}),[w,T]=(0,_.useState)(!0),[E,he]=(0,_.useState)(!1),[ge,_e]=(0,_.useState)(0),[D,O]=(0,_.useState)(``),k=pe(),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(``),[ve,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)({username:``,displayName:``,password:``,role:`user`,canCreateProjects:!1}),[L,R]=(0,_.useState)(null),[z,B]=(0,_.useState)(``),[V,H]=(0,_.useState)(null),[U,W]=(0,_.useState)(!1),[G,K]=(0,_.useState)(!1),[ye,q]=(0,_.useState)(``),[J,Y]=(0,_.useState)(null),[X,be]=(0,_.useState)(!1),[xe,Z]=(0,_.useState)(``),Q=h.trim(),$=()=>_e(e=>e+1);(0,_.useEffect)(()=>{let e=new AbortController;T(!0),he(!1),O(``);let t=window.setTimeout(()=>{let t=new URLSearchParams({page:String(x)});Q&&t.set(`q`,Q),c(`/api/admin/users?${t}`,{signal:e.signal}).then(t=>{e.signal.aborted||(p(t.users),me(t.pagination),S(t.pagination.page))}).catch(t=>{e.signal.aborted||(O(s(t)),he(!0))}).finally(()=>{e.signal.aborted||T(!1)})},Q?200:0);return()=>{window.clearTimeout(t),e.abort()}},[Q,x,ge]);let Se=async()=>{if(!A){if(F.password.length<t)return N(l(`auth.passwordMinimum`,{count:t}));j(!0),N(``),k.clear();try{await c(`/api/admin/users`,{method:`POST`,body:JSON.stringify({username:F.username,displayName:F.displayName||F.username,password:F.password,role:F.role,canCreateProjects:F.canCreateProjects})}),P(!1),I({username:``,displayName:``,password:``,role:`user`,canCreateProjects:!1}),$(),k.show(`create`)}catch(e){N(s(e))}finally{j(!1)}}},Ce=async e=>{Y({target:e,setting:e.role===`admin`?`demote`:`promote`}),Z(``)},we=async e=>{Y({target:e,setting:e.canCreateProjects?`denyProjectCreation`:`allowProjectCreation`}),Z(``)},Te=async()=>{if(!J||X)return;let{target:e,setting:t}=J,n=t===`demote`?{role:`user`}:t===`promote`?{role:`admin`}:{canCreateProjects:t===`allowProjectCreation`};be(!0),Z(``);try{await c(`/api/admin/users/${e.id}`,{method:`PATCH`,body:JSON.stringify(n)}),$(),Y(null)}catch(e){Z(s(e))}finally{be(!1)}},Ee=async()=>{if(L&&z&&!A){if(z.length<t)return N(l(`auth.passwordMinimum`,{count:t}));j(!0),N(``),k.clear();try{await c(`/api/admin/users/${L.id}`,{method:`PATCH`,body:JSON.stringify({password:z})}),k.show(`reset:${L.id}`),R(null),B(``)}catch(e){N(s(e))}finally{j(!1)}}},De=async()=>{if(V&&!G){K(!0),q(``);try{await c(`/api/admin/users/${V.id}`,{method:`DELETE`,body:JSON.stringify({deleteProjects:U})}),H(null),W(!1),$()}catch(e){q(s(e))}finally{K(!1)}}};return(0,v.jsxs)(`section`,{className:`admin-users-page management-page`,children:[(0,v.jsxs)(`div`,{className:`section-title`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`h1`,{children:[(0,v.jsx)(ee,{"aria-hidden":!0,size:25}),l(`users.manage`)]}),(0,v.jsx)(`p`,{className:`muted`,children:l(`users.onlyAdmin`)})]}),(0,v.jsxs)(`button`,{type:`button`,className:`dashboard-back-button`,onClick:n,children:[(0,v.jsx)(ne,{size:14}),l(`navigation.backToProjects`)]})]}),(0,v.jsxs)(`div`,{className:`admin-user-toolbar`,children:[(0,v.jsxs)(`div`,{className:`admin-user-filters`,children:[(0,v.jsxs)(`div`,{className:`admin-user-search`,role:`search`,children:[(0,v.jsx)(ie,{"aria-hidden":!0,size:16}),(0,v.jsx)(`input`,{role:`searchbox`,"aria-label":l(`users.searchPlaceholder`),placeholder:l(`users.searchPlaceholder`),value:h,onChange:e=>{b(e.target.value),S(1)}}),h&&(0,v.jsx)(`button`,{type:`button`,"aria-label":l(`users.clearSearch`),title:l(`users.clearSearch`),onClick:()=>{b(``),S(1)},children:(0,v.jsx)(a,{"aria-hidden":!0,size:14})})]}),!w&&!E&&(0,v.jsx)(`span`,{className:`admin-user-count`,role:`status`,children:l(`users.total`,{count:C.total})})]}),(0,v.jsxs)(`button`,{className:`primary icon-button admin-user-add`,onClick:()=>{k.clear(),N(``),P(!0)},children:[(0,v.jsx)(o,{"aria-hidden":!0,size:15}),(0,v.jsx)(`span`,{role:`status`,children:l(k.message===`create`?`common.done`:`users.add`)})]})]}),D&&(0,v.jsx)(`p`,{className:`error`,role:`alert`,children:D}),(0,v.jsx)(`div`,{className:`table-card admin-user-table`,"aria-busy":w,children:(0,v.jsxs)(`table`,{children:[(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{children:l(`common.user`)}),(0,v.jsx)(`th`,{children:l(`users.role`)}),(0,v.jsx)(`th`,{children:l(`users.createProjects`)}),(0,v.jsx)(`th`,{children:l(`users.ownedProjects`)}),(0,v.jsx)(`th`,{children:l(`users.actions`)})]})}),(0,v.jsx)(`tbody`,{children:w?(0,v.jsx)(`tr`,{children:(0,v.jsx)(`td`,{colSpan:5,className:`admin-user-list-state`,children:(0,v.jsxs)(`span`,{role:`status`,children:[(0,v.jsx)(se,{className:`spin`,size:16}),l(`common.loading`)]})})}):E?(0,v.jsx)(`tr`,{children:(0,v.jsxs)(`td`,{colSpan:5,className:`admin-user-list-state`,children:[(0,v.jsx)(`span`,{children:l(`users.loadFailed`)}),(0,v.jsx)(`button`,{type:`button`,onClick:$,children:l(`common.retry`)})]})}):d.length===0?(0,v.jsx)(`tr`,{children:(0,v.jsx)(`td`,{colSpan:5,className:`admin-user-list-state`,children:l(Q?`users.noMatches`:`users.empty`)})}):d.map(t=>{let n=t.id===e.id,r=A||X;return(0,v.jsxs)(`tr`,{children:[(0,v.jsxs)(`td`,{className:`admin-user-identity`,children:[(0,v.jsx)(`strong`,{children:t.displayName}),(0,v.jsxs)(`small`,{children:[`@`,t.username]})]}),(0,v.jsx)(`td`,{children:n?(0,v.jsxs)(`span`,{className:`admin-user-badge`,title:l(`users.selfProtected`),children:[(0,v.jsx)(g,{size:12,"aria-hidden":!0}),l(`common.admin`)]}):(0,v.jsxs)(`select`,{className:`admin-user-role`,"aria-label":l(`users.roleFor`,{username:t.username}),value:t.role,disabled:r,onChange:()=>void Ce(t),children:[(0,v.jsx)(`option`,{value:`user`,children:l(`common.user`)}),(0,v.jsx)(`option`,{value:`admin`,children:l(`common.admin`)})]})}),(0,v.jsx)(`td`,{children:t.role===`admin`?(0,v.jsxs)(`span`,{className:`admin-user-locked`,title:l(`users.adminCreation`),children:[(0,v.jsx)(g,{size:12,"aria-hidden":!0}),l(`users.allow`)]}):(0,v.jsx)(`button`,{type:`button`,className:`admin-user-switch`,role:`switch`,"aria-checked":t.canCreateProjects,"aria-label":l(`users.creationFor`,{username:t.username}),disabled:r,onClick:()=>void we(t),children:(0,v.jsx)(`span`,{})})}),(0,v.jsx)(`td`,{children:t.ownedProjects??0}),(0,v.jsx)(`td`,{children:(0,v.jsxs)(`div`,{className:`admin-user-actions`,children:[(0,v.jsxs)(`button`,{className:`icon-button`,disabled:r,onClick:()=>{k.clear(),R(t),B(``),N(``)},children:[(0,v.jsx)(m,{"aria-hidden":!0,size:13}),(0,v.jsx)(`span`,{role:`status`,children:l(k.message===`reset:${t.id}`?`common.done`:`users.resetPassword`)})]}),!n&&(0,v.jsxs)(fe,{modal:!1,children:[(0,v.jsx)(le,{asChild:!0,children:(0,v.jsx)(`button`,{className:`icon-button`,disabled:r,"aria-label":l(`users.actionsFor`,{username:t.username}),children:(0,v.jsx)(te,{size:17,"aria-hidden":!0})})}),(0,v.jsx)(ce,{children:(0,v.jsx)(ue,{className:`comment-actions-menu-content`,align:`end`,sideOffset:5,children:(0,v.jsxs)(de,{className:`danger-text`,onSelect:()=>{H(t),W(!1),q(``)},children:[(0,v.jsx)(i,{size:14,"aria-hidden":!0}),l(`users.deleteTitle`)]})})})]})]})})]},t.id)})})]})}),C.totalPages>1&&(0,v.jsxs)(`nav`,{className:`project-pagination admin-user-pagination`,"aria-label":l(`users.pagination`),children:[(0,v.jsxs)(`button`,{type:`button`,disabled:w||E||C.page<=1,onClick:()=>S(C.page-1),children:[(0,v.jsx)(re,{size:15}),l(`users.previousPage`)]}),(0,v.jsx)(`span`,{children:l(`users.pageOf`,{page:C.page,totalPages:C.totalPages})}),(0,v.jsxs)(`button`,{type:`button`,disabled:w||E||C.page>=C.totalPages,onClick:()=>S(C.page+1),children:[l(`users.nextPage`),(0,v.jsx)(r,{size:15})]})]}),(0,v.jsxs)(u,{className:`management-dialog`,open:ve,title:l(`users.add`),description:l(`users.addDescription`),onOpenChange:e=>{A||P(e)},footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`button`,{className:`icon-button`,disabled:A,onClick:()=>P(!1),children:[(0,v.jsx)(a,{"aria-hidden":!0,size:14}),l(`common.cancel`)]}),(0,v.jsxs)(`button`,{className:`primary icon-button`,disabled:A||!F.username.trim()||F.password.length<t,onClick:()=>void Se(),children:[(0,v.jsx)(o,{"aria-hidden":!0,size:14}),l(`users.createUser`)]})]}),children:[M&&(0,v.jsx)(`p`,{className:`error`,role:`alert`,children:M}),(0,v.jsxs)(`fieldset`,{className:`admin-user-form form-stack`,disabled:A,children:[(0,v.jsxs)(`label`,{className:`form-field`,children:[l(`auth.username`),(0,v.jsx)(`input`,{value:F.username,onChange:e=>I({...F,username:e.target.value})})]}),(0,v.jsxs)(`label`,{className:`form-field`,children:[l(`users.displayName`),(0,v.jsx)(`input`,{value:F.displayName,onChange:e=>I({...F,displayName:e.target.value})})]}),(0,v.jsxs)(`label`,{className:`form-field`,children:[l(`users.initialPassword`),(0,v.jsxs)(`span`,{className:`password-generator`,children:[(0,v.jsx)(`input`,{minLength:t,autoComplete:`new-password`,value:F.password,onChange:e=>I({...F,password:e.target.value})}),(0,v.jsxs)(`button`,{type:`button`,title:l(`users.generatePassword`),onClick:()=>I({...F,password:y()}),children:[(0,v.jsx)(f,{size:15}),l(`users.randomPassword`)]})]}),(0,v.jsx)(`small`,{className:`field-hint`,children:l(`auth.passwordMinimum`,{count:t})})]}),(0,v.jsxs)(`label`,{className:`form-field`,children:[l(`users.role`),(0,v.jsxs)(`select`,{value:F.role,onChange:e=>I({...F,role:e.target.value}),children:[(0,v.jsx)(`option`,{value:`user`,children:l(`common.user`)}),(0,v.jsx)(`option`,{value:`admin`,children:l(`common.admin`)})]})]}),(0,v.jsxs)(`label`,{className:`checkbox-field`,children:[(0,v.jsx)(`input`,{type:`checkbox`,checked:F.canCreateProjects||F.role===`admin`,disabled:F.role===`admin`,onChange:e=>I({...F,canCreateProjects:e.target.checked})}),` `,l(`users.allowCreate`)]})]})]}),(0,v.jsxs)(u,{className:`management-dialog`,open:!!L,title:l(`users.resetPassword`),description:l(`users.resetDescription`,{username:L?.username??``}),onOpenChange:e=>{!e&&!A&&R(null)},footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`button`,{className:`icon-button`,disabled:A,onClick:()=>R(null),children:[(0,v.jsx)(a,{"aria-hidden":!0,size:14}),l(`common.cancel`)]}),(0,v.jsxs)(`button`,{className:`primary icon-button`,disabled:A||z.length<t,onClick:()=>void Ee(),children:[(0,v.jsx)(m,{"aria-hidden":!0,size:14}),l(`users.reset`)]})]}),children:[M&&(0,v.jsx)(`p`,{className:`error`,role:`alert`,children:M}),(0,v.jsxs)(`label`,{className:`form-field`,children:[l(`auth.newPassword`),(0,v.jsxs)(`span`,{className:`password-generator`,children:[(0,v.jsx)(`input`,{disabled:A,autoFocus:!0,minLength:t,autoComplete:`new-password`,value:z,onChange:e=>B(e.target.value)}),(0,v.jsxs)(`button`,{type:`button`,disabled:A,onClick:()=>B(y()),children:[(0,v.jsx)(f,{size:15}),l(`users.randomPassword`)]})]}),(0,v.jsx)(`small`,{className:`field-hint`,children:l(`auth.passwordMinimum`,{count:t})})]})]}),(0,v.jsx)(u,{className:`management-dialog`,open:!!V,title:l(`users.deleteTitle`),description:l(`users.deleteDescription`,{username:V?.username??``}),onOpenChange:e=>{!e&&!G&&(H(null),q(``))},footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`button`,{className:`icon-button`,disabled:G,onClick:()=>{H(null),q(``)},children:[(0,v.jsx)(a,{"aria-hidden":!0,size:14}),l(`common.cancel`)]}),(0,v.jsxs)(`button`,{className:`danger icon-button`,disabled:G,"aria-busy":G,onClick:()=>void De(),children:[G?(0,v.jsx)(se,{className:`spin`,"aria-hidden":!0,size:14}):(0,v.jsx)(i,{"aria-hidden":!0,size:14}),l(G?`common.loading`:`users.deleteTitle`)]})]}),children:(0,v.jsxs)(v.Fragment,{children:[ye&&(0,v.jsx)(`p`,{className:`error dialog-error`,children:ye}),(0,v.jsxs)(`fieldset`,{className:`choice-group`,disabled:G,children:[(0,v.jsx)(`legend`,{children:l(`users.ownedChoice`,{count:V?.ownedProjects??0})}),(0,v.jsxs)(`label`,{children:[(0,v.jsx)(`input`,{type:`radio`,checked:!U,onChange:()=>W(!1)}),` `,l(`users.transferProjects`)]}),(0,v.jsxs)(`label`,{children:[(0,v.jsx)(`input`,{type:`radio`,checked:U,onChange:()=>W(!0)}),` `,l(`users.deleteProjects`)]})]})]})}),(0,v.jsx)(oe,{open:!!J,title:l(`userConfirmations.${J?.setting??`demote`}Title`),description:l(`userConfirmations.${J?.setting??`demote`}Description`,{username:J?.target.username??``}),confirmLabel:l(`userConfirmations.${J?.setting??`demote`}Confirm`),danger:J?.setting!==`promote`&&J?.setting!==`allowProjectCreation`,busy:X,error:xe,onCancel:()=>{X||(Y(null),Z(``))},onConfirm:()=>void Te()})]})}export{b as AdminUsers};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-DUEFWlB7.js";import{b as t}from"./index-DCwfhKK9.js";var n={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};n.node;var r=t(n),i={codex:`Codex`,opencode:`OpenCode`,claude:`Claude Code`},a=65536;function o(e){let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length,n+a),i=e.charCodeAt(r-1);r<e.length&&i>=55296&&i<=56319&&r--,t.push(e.slice(n,r)),n=r}return t}var s=e(),c={codex:{path:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`},opencode:{path:`M16 6H8v12h8V6zm4 16H4V2h16v20z`},claude:{color:`#D97757`,path:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`}};function l({agent:e,size:t=18}){let n=c[e];return(0,s.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,width:t,height:t,className:`agent-identity-icon`,fill:n.color??`currentColor`,"aria-hidden":`true`,focusable:`false`,children:(0,s.jsx)(`path`,{d:n.path,fillRule:`evenodd`,clipRule:`evenodd`})})}export{r as i,i as n,o as r,l as t};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.agent-management{gap:20px;padding-bottom:28px;display:grid}.agent-management .section-title{margin-bottom:0}.agent-management h1{align-items:center;gap:10px;display:flex}.agent-management button,.agent-terminal-panel button{border:1px solid var(--ui-border,#d4ddd7);background:var(--ui-surface,#fff);color:var(--ui-text,#273a2f);cursor:pointer;border-radius:6px;justify-content:center;align-items:center;gap:5px;padding:6px 10px;font-size:12px;display:inline-flex}.agent-management button:hover:not(:disabled),.agent-terminal-panel button:hover:not(:disabled){background:var(--ui-hover,#edf4ef)}.agent-management button:disabled,.agent-terminal-panel button:disabled{opacity:.45;cursor:default}.agent-management button.primary,.agent-terminal-panel button.primary{background:var(--ui-accent,#176b44);color:var(--ui-surface,#fff);border-color:#0000}.agent-management button.primary:hover:not(:disabled),.agent-terminal-panel button.primary:hover:not(:disabled){background:color-mix(in srgb, var(--ui-accent,#176b44), #000 12%)}.agent-management input:not([type=checkbox]),.agent-management select,.agent-terminal-panel input:not([type=checkbox]){border:1px solid var(--ui-border,#d4ddd7);background:var(--ui-surface,#fff);min-width:0;color:var(--ui-text,#273a2f);border-radius:6px;padding:7px 9px;font-size:12px}.agent-policy-card{border:1px solid var(--ui-border,#d8e1db);background:var(--ui-surface,#fff);border-radius:12px;padding:20px}.agent-policy-heading,.agent-policy-actions{align-items:center;gap:10px;display:flex}.agent-policy-heading{flex-wrap:wrap;justify-content:space-between}.agent-policy-heading strong{font-size:14px}.agent-policy-title{align-items:center;gap:5px;display:inline-flex}.agent-management .agent-policy-help{width:24px;height:24px;color:var(--ui-muted,#788178);background:0 0;border:0;border-radius:50%;flex:none;padding:0}.agent-policy-help:focus-visible{outline:2px solid var(--ui-accent,#176b44);outline-offset:2px}.agent-catalog{grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr));gap:12px;margin-top:18px;display:grid}.agent-catalog-item{border:1px solid var(--ui-border,#d8e1db);cursor:pointer;border-radius:8px;align-items:flex-start;gap:10px;min-width:0;padding:14px;display:flex}.agent-catalog-item input{accent-color:#23704c;flex:none;margin:3px 0 0}.agent-catalog-details{overflow-wrap:anywhere;min-width:0}.agent-catalog-item strong{align-items:center;gap:8px;font-size:14px;display:flex}.agent-identity{align-items:center;gap:7px;display:inline-flex}.agent-identity-icon{flex:none}.agent-catalog-item small{color:var(--ui-muted,#788178);margin-top:6px;font-size:11px;display:block}.agent-catalog-item.unavailable{opacity:.6}.agent-list-controls{flex-wrap:wrap;align-items:center;gap:9px;display:flex}.agent-list-reminder{border:1px solid var(--ui-border,#d8e1db);background:var(--ui-subtle,#f3f6f3);color:var(--ui-muted,#65756b);border-radius:8px;align-items:flex-start;gap:7px;margin:0;padding:10px 12px;font-size:12px;line-height:1.5;display:flex}.agent-list-reminder>svg,.agent-execution-reminder>svg{flex:none;margin-top:2px}.agent-list-controls>input{flex:130px;max-width:220px}.agent-list-controls small{color:var(--ui-muted,#788178)}.agent-toolbar-spacer{flex:1}.agent-bulk-actions{align-items:center;gap:10px;font-size:12px;display:flex}.agent-table-scroll{overflow-x:auto}.agent-task-table{border-collapse:collapse;width:100%;min-width:760px}.agent-task-table th{white-space:nowrap}.agent-task-table td{vertical-align:middle;font-size:12px}.agent-task-table td small{margin-top:5px;display:block}.agent-task-table tr.selected{background:var(--ui-accent-bg,#eaf3ed)}.agent-task-name{text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;max-width:230px;display:inline-block;overflow:hidden}.agent-task-table .agent-table-time{color:var(--ui-muted,#788178);white-space:nowrap;font-variant-numeric:tabular-nums;font-size:11px}.agent-table-time time,.agent-table-user{cursor:default;border-radius:3px}.agent-table-time time:focus-visible,.agent-table-user:focus-visible{outline:2px solid var(--ui-accent,#176b44);outline-offset:3px}.agent-time-heading{align-items:center;gap:5px;display:inline-flex}.agent-state-badge{background:var(--ui-hover,#eef2ef);color:var(--ui-muted,#788178);white-space:nowrap;border-radius:5px;padding:4px 7px;font-size:11px;display:inline-block}.agent-state-badge.running,.agent-state-badge.starting{background:var(--ui-accent-bg,#eaf3ed);color:var(--ui-accent,#236544)}.agent-state-badge.failed{color:var(--ui-danger,#a33c36)}.agent-row-actions{white-space:nowrap}.agent-management button.agent-danger,.agent-terminal-panel button.agent-danger{color:var(--ui-danger,#a33c36)}.agent-management .project-pagination{margin-top:0}.agent-pagination button{box-sizing:border-box;white-space:nowrap;min-width:92px;height:32px;padding:0 10px;line-height:1}.agent-pagination>span{text-align:center;font-variant-numeric:tabular-nums;min-width:44px}.agent-delete-item{border-bottom:1px solid var(--ui-border,#d8e1db);gap:6px;padding:12px 0;font-size:13px;display:grid}.agent-delete-item small{color:var(--ui-muted,#788178)}.agent-delete-item:last-child{border-bottom:0}.agent-terminal-panel{background:var(--ui-surface,#fafbf9);min-width:0;height:100%;color:var(--ui-text,#273a2f);flex-direction:column;display:flex;overflow:hidden}.agent-terminal-heading{border-bottom:1px solid var(--ui-border,#d8e1db);flex:none;align-items:center;gap:6px;padding:6px 8px;display:flex}.agent-terminal-heading>strong{align-items:center;gap:5px;font-size:11px;font-weight:600;display:flex}.agent-terminal-panel .agent-session-help{width:22px;height:22px;color:var(--ui-muted,#788178);background:0 0;border:0;border-radius:50%;flex:none;padding:0}.agent-session-help:focus-visible{outline:2px solid var(--ui-accent,#176b44);outline-offset:2px}.agent-task-tabs{flex:1;gap:4px;min-width:0;display:flex;overflow-x:auto}.agent-task-tabs button{background:0 0;border-color:#0000;flex:none;max-width:210px;padding:5px 7px;font-size:11px}.agent-task-tabs button>span:not(.agent-state-dot){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.agent-task-tabs button.active{border-color:var(--ui-accent-border,#b4d0be);background:var(--ui-accent-bg,#eaf3ed)}.agent-task-tabs small{color:var(--ui-muted,#788178);font-size:10px}.agent-state-dot{background:var(--ui-muted,#8b948d);border-radius:50%;flex:none;width:5px;height:5px}.agent-state-dot.running{background:#389c68;box-shadow:0 0 0 2px #389c6818}.agent-task-toolbar{border-bottom:1px solid var(--ui-border,#d8e1db);flex-wrap:wrap;flex:none;align-items:center;gap:5px;padding:5px 8px;display:flex}.agent-task-toolbar button{padding:4px 6px;font-size:11px}.agent-task-state{color:var(--ui-muted,#788178);padding-left:4px;font-size:10px}.agent-task-create{flex-wrap:wrap;flex:none;gap:7px;padding:8px;display:flex}.agent-task-create input{flex:120px}.agent-terminal-panel .agent-select-trigger{justify-content:flex-start;min-width:150px;max-width:100%;padding:7px 9px}.agent-select-trigger>span{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.agent-select-trigger>svg:last-child{color:var(--ui-muted,#788178);flex:none;margin-left:auto}.agent-select-trigger:focus-visible{outline:2px solid var(--ui-accent,#176b44);outline-offset:2px}.agent-select-options{z-index:120;min-width:max(200px, var(--radix-dropdown-menu-trigger-width));max-width:calc(100vw - 16px);max-height:var(--radix-dropdown-menu-content-available-height);border:1px solid var(--ui-border,#cbd5ce);background:var(--ui-raised,#fff);color:var(--ui-text,#273a2f);border-radius:8px;padding:4px;overflow-y:auto;box-shadow:0 8px 24px #071c2426}.agent-select-option{cursor:pointer;user-select:none;border-radius:5px;outline:none;align-items:center;gap:9px;min-height:34px;padding:7px 9px;font-size:12px;display:flex}.agent-select-option[data-highlighted]{background:var(--ui-hover,#edf4ef)}.agent-select-option[data-disabled]{opacity:.5;cursor:default}.agent-select-label{flex-direction:column;flex:1;gap:3px;min-width:0;display:flex}.agent-select-label small{color:var(--ui-muted,#788178);font-size:10px}.agent-select-check{color:var(--ui-accent,#176b44);flex:none;margin-left:auto;display:flex}.agent-terminal-body{background:var(--terminal-bg);min-height:0;color:var(--terminal-fg);flex:1;overflow:hidden}.agent-terminal-surface{background:var(--terminal-bg);height:100%;color:var(--terminal-fg);flex-direction:column;display:flex;overflow:hidden}.agent-xterm{background:var(--terminal-bg);flex:1;min-width:0;min-height:0;padding:7px 5px;overflow:hidden}.agent-xterm .xterm{height:100%}.agent-terminal-status{background:var(--ui-surface,#fafbf9);color:var(--ui-muted,#788178);flex:none;justify-content:space-between;align-items:center;gap:8px;padding:5px 10px;font-size:11px;display:flex}.agent-execution-reminder{border-top:1px solid var(--ui-border,#d8e1db);color:var(--ui-muted,#788178);flex:none;align-items:flex-start;gap:6px;margin:0;padding:5px 10px;font-size:11px;line-height:1.5;display:flex}.agent-task-empty{text-align:center;min-height:90px;color:var(--ui-muted,#788178);flex-direction:column;justify-content:center;align-items:center;gap:9px;padding:28px 20px 36px;display:flex}.agent-terminal-body .agent-task-empty{height:100%;color:var(--terminal-muted)}.agent-task-empty strong{color:var(--ui-text,#273a2f);font-size:13px}.agent-terminal-body .agent-task-empty strong{color:var(--terminal-fg)}.agent-task-empty p{max-width:470px;margin:0;font-size:12px;line-height:1.6}.agent-inline-error,.agent-inline-warning{flex:none;align-items:center;gap:6px;margin:0;padding:6px 10px;font-size:11px;display:flex}.agent-inline-error{justify-content:space-between}.agent-inline-warning{border-block:1px solid var(--ui-danger-border,#e9b6b0);background:var(--ui-danger-bg,#fff3f1);color:var(--ui-danger,#b3261e);align-items:flex-start;line-height:1.5}.agent-inline-warning>svg{flex:none;margin-top:1px}@media (width<=900px){.agent-terminal-heading>strong{font-size:0}}@media (width<=550px){.agent-policy-card{padding:13px}}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{t as r}from"./arrow-down-B6T7Z6IO.js";import{$ as i,F as a,I as o,L as s,a as c,at as ee,et as te,f as ne,y as l}from"./relativeTime-BR0CVAvz.js";import{t as re}from"./SaveButton-DkyoEu6j.js";import{t as ie}from"./info-DNSAs0_-.js";import{t as u}from"./refresh-cw-DuLtxWBX.js";import{i as d,n as f,t as p}from"./AgentIcon-ClP5dPRL.js";import{C as m,E as h,c as ae,j as oe,y as g}from"./index-DCwfhKK9.js";import{t as se}from"./SuccessNotice-ubBtzzi_.js";var _=e(t(),1),v=n();function y({user:e,onBack:t}){let{t:n,i18n:y}=oe(),{showExecutionReminder:ce}=ne(),b=e.role===`admin`,x=b?`/api/admin/agent-tasks`:`/api/agent-tasks`,[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)({allowed:[]}),[E,le]=(0,_.useState)({tasks:[],page:1,pageSize:50,total:0}),[D,O]=(0,_.useState)(1),[k,ue]=(0,_.useState)(``),[A,de]=(0,_.useState)(``),[j,fe]=(0,_.useState)(``),[M,pe]=(0,_.useState)(``),[me,N]=(0,_.useState)(0),[P,F]=(0,_.useState)(!0),[I,L]=(0,_.useState)(!1),R=(0,_.useRef)(!1),z=(0,_.useRef)(!0),[B,V]=(0,_.useState)(``),H=se(),[U,W]=(0,_.useState)(new Set),[G,K]=(0,_.useState)([]),[q,J]=(0,_.useState)({});(0,_.useEffect)(()=>(z.current=!0,()=>{z.current=!1}),[]),(0,_.useEffect)(()=>{let e=new AbortController;return h(b?`/api/admin/agents`:`/api/agents`,{signal:e.signal}).then(e=>{C(e),T(e.policy)}).catch(t=>{e.signal.aborted||V(m(t))}),()=>e.abort()},[b]),(0,_.useEffect)(()=>{let e,t=!1,n=()=>{if(document.visibilityState===`hidden`)return;e?.abort(),e=new AbortController;let n=e,r=new URLSearchParams({page:String(D)});k&&r.set(`state`,k),A&&r.set(`agent`,A),j.trim()&&r.set(`project`,j.trim()),M.trim()&&r.set(`user`,M.trim()),h(`${x}?${r}`,{signal:n.signal}).then(e=>{!t&&!n.signal.aborted&&(le(e),F(!1))}).catch(e=>{!t&&!n.signal.aborted&&(V(m(e)),F(!1))})},r=window.setTimeout(n,150),i=window.setInterval(n,5e3);return window.addEventListener(`focus`,n),()=>{t=!0,e?.abort(),window.clearTimeout(r),window.clearInterval(i),window.removeEventListener(`focus`,n)}},[x,D,k,A,j,M,me]);let Y=async e=>{if(!R.current){R.current=!0,L(!0),V(``),H.clear();try{await e()}catch(e){z.current&&V(m(e))}finally{R.current=!1,c(),z.current&&(L(!1),N(e=>e+1))}}},X=async(e,t)=>{let r=await Promise.allSettled(e.map(e=>h(`${x}/${e.id}${t===`stop`?`/stop`:``}`,{method:t===`stop`?`POST`:`DELETE`}))),i={},a=[];r.forEach((t,n)=>{t.status===`rejected`&&(i[e[n].id]=m(t.reason),a.push(e[n]))}),J(i),W(new Set(a.map(e=>e.id))),t===`delete`&&K(a),a.length?V(n(`agents.operationFailed`)):t===`stop`&&e.length===1&&H.show(`stop:${e[0].id}`)},Z=e=>{V(``),J({}),K(e)},Q=(e,t)=>{e(t),O(1),W(new Set)},$=E.tasks.filter(e=>U.has(e.id));return(0,v.jsxs)(`section`,{className:`agent-management management-page`,children:[(0,v.jsxs)(`div`,{className:`section-title`,children:[(0,v.jsxs)(`div`,{children:[(0,v.jsxs)(`h1`,{children:[(0,v.jsx)(s,{size:25}),n(b?`agents.title`:`agents.tasks`)]}),(0,v.jsx)(`p`,{children:n(b?`agents.description`:`agents.personalDescription`)})]}),(0,v.jsxs)(`button`,{type:`button`,className:`dashboard-back-button`,onClick:t,children:[(0,v.jsx)(ee,{size:14}),n(`navigation.backToProjects`)]})]}),B&&!G.length&&(0,v.jsx)(`p`,{className:`error`,role:`alert`,children:B}),b&&(0,v.jsxs)(`section`,{className:`agent-policy-card`,children:[(0,v.jsxs)(`div`,{className:`agent-policy-heading`,children:[(0,v.jsxs)(`div`,{className:`agent-policy-title`,children:[(0,v.jsx)(`strong`,{children:n(`agents.allowedAgents`)}),(0,v.jsx)(`button`,{type:`button`,className:`agent-policy-help`,"aria-label":n(`agents.usageHint`),"data-tooltip":n(`agents.usageHint`),children:(0,v.jsx)(ie,{size:15,"aria-hidden":`true`})})]}),(0,v.jsxs)(`div`,{className:`agent-policy-actions`,children:[(0,v.jsxs)(`button`,{disabled:I,onClick:()=>void Y(async()=>{let e=await h(`/api/admin/agents/refresh`,{method:`POST`});C(e),H.show(`detect`)}),children:[(0,v.jsx)(u,{size:14}),(0,v.jsx)(`span`,{role:`status`,children:n(H.message===`detect`?`common.done`:`agents.detection`)})]}),(0,v.jsx)(re,{saving:I,feedback:H.message===`policy`?n(`editor.saved`):``,disabled:!S,onClick:()=>void Y(async()=>{let e=await h(`/api/admin/agents`,{method:`PATCH`,body:JSON.stringify(w)});C(e),T(e.policy),H.show(`policy`),window.dispatchEvent(new Event(`texlite:agents-policy`))}),children:n(`common.save`)})]})]}),(0,v.jsx)(`div`,{className:`agent-catalog`,children:S?.agents.map(e=>(0,v.jsxs)(`label`,{className:`agent-catalog-item${e.installed?``:` unavailable`}`,children:[(0,v.jsx)(`input`,{type:`checkbox`,"aria-label":`${n(`agents.allowed`)} ${e.label}`,disabled:I,checked:w.allowed.includes(e.id),onChange:t=>T(n=>({...n,allowed:t.target.checked?[...n.allowed,e.id]:n.allowed.filter(t=>t!==e.id)}))}),(0,v.jsxs)(`div`,{className:`agent-catalog-details`,children:[(0,v.jsxs)(`strong`,{children:[(0,v.jsx)(p,{agent:e.id}),e.label]}),(0,v.jsx)(`small`,{children:e.installed?`${n(`agents.installed`)} · ${e.version??n(`agents.unknown`)}`:n(`agents.notInstalled`)})]})]},e.id))}),S&&!S.ptyAvailable&&(0,v.jsx)(`p`,{className:`error`,children:n(`agents.ptyUnavailable`)})]}),ce&&(0,v.jsxs)(`p`,{className:`agent-list-reminder`,children:[(0,v.jsx)(a,{size:14,"aria-hidden":`true`}),(0,v.jsx)(`span`,{children:n(`agents.endReminder`)})]}),(0,v.jsxs)(`div`,{className:`agent-list-controls`,children:[(0,v.jsxs)(`select`,{"aria-label":n(`agents.state`),value:k,onChange:e=>Q(ue,e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:n(`agents.all`)}),(0,v.jsx)(`option`,{value:`running`,children:n(`agents.running`)}),(0,v.jsx)(`option`,{value:`cleanup`,children:n(`agents.cleanup`)})]}),(0,v.jsxs)(`select`,{"aria-label":n(`agents.agent`),value:A,onChange:e=>Q(de,e.target.value),children:[(0,v.jsx)(`option`,{value:``,children:n(`agents.agent`)}),Object.entries(f).map(([e,t])=>(0,v.jsx)(`option`,{value:e,children:t},e))]}),(0,v.jsx)(`input`,{"aria-label":n(`agents.projectFilter`),placeholder:n(`agents.projectFilter`),value:j,onChange:e=>Q(fe,e.target.value)}),b&&(0,v.jsx)(`input`,{"aria-label":n(`agents.userFilter`),placeholder:n(`agents.userFilter`),value:M,onChange:e=>Q(pe,e.target.value)}),(0,v.jsx)(`span`,{className:`agent-toolbar-spacer`}),(0,v.jsx)(`small`,{children:n(`agents.taskCount`,{count:E.total})}),(0,v.jsx)(`button`,{"aria-label":n(`agents.refresh`),disabled:I,onClick:()=>N(e=>e+1),children:(0,v.jsx)(u,{size:14})})]}),$.length>0&&(0,v.jsxs)(`div`,{className:`agent-bulk-actions`,children:[(0,v.jsx)(`span`,{children:n(`agents.selected`,{count:$.length})}),(0,v.jsxs)(`button`,{disabled:I,onClick:()=>void Y(()=>X($,`stop`)),children:[(0,v.jsx)(d,{size:13}),n(`agents.batchEnd`)]}),(0,v.jsxs)(`button`,{className:`agent-danger`,disabled:I,onClick:()=>Z($),children:[(0,v.jsx)(o,{size:13}),n(`agents.batchDelete`)]})]}),(0,v.jsxs)(`div`,{className:`agent-table-scroll table-card`,children:[(0,v.jsxs)(`table`,{className:`agent-task-table`,children:[(0,v.jsx)(`thead`,{children:(0,v.jsxs)(`tr`,{children:[(0,v.jsx)(`th`,{children:(0,v.jsx)(`input`,{type:`checkbox`,"aria-label":n(`agents.all`),checked:E.tasks.length>0&&E.tasks.every(e=>U.has(e.id)),onChange:e=>W(new Set(e.target.checked?E.tasks.map(e=>e.id):[]))})}),(0,v.jsx)(`th`,{children:n(`agents.task`)}),(0,v.jsx)(`th`,{children:n(`agents.project`)}),b&&(0,v.jsx)(`th`,{children:n(`agents.user`)}),(0,v.jsx)(`th`,{children:n(`agents.agent`)}),(0,v.jsx)(`th`,{children:n(`agents.state`)}),(0,v.jsx)(`th`,{scope:`col`,"aria-sort":`descending`,children:(0,v.jsxs)(`span`,{className:`agent-time-heading`,children:[n(`agents.updated`),(0,v.jsx)(r,{size:12,"aria-hidden":`true`})]})}),(0,v.jsx)(`th`,{children:n(`agents.actions`)})]})}),(0,v.jsx)(`tbody`,{children:E.tasks.map(e=>(0,v.jsxs)(`tr`,{className:U.has(e.id)?`selected`:``,children:[(0,v.jsx)(`td`,{children:(0,v.jsx)(`input`,{type:`checkbox`,"aria-label":e.title,checked:U.has(e.id),onChange:t=>W(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})})}),(0,v.jsx)(`td`,{children:(0,v.jsx)(`strong`,{className:`agent-task-name`,title:e.title,children:e.title})}),(0,v.jsx)(`td`,{children:(0,v.jsx)(`span`,{className:`agent-task-name`,title:e.projectId,children:e.projectName})}),b&&(0,v.jsx)(`td`,{children:(0,v.jsx)(`span`,{className:`agent-table-user`,tabIndex:e.userUsername?0:void 0,"data-tooltip":e.userUsername?`@${e.userUsername}`:void 0,children:e.userName})}),(0,v.jsx)(`td`,{children:(0,v.jsxs)(`span`,{className:`agent-identity`,children:[(0,v.jsx)(p,{agent:e.agentId,size:15}),f[e.agentId]]})}),(0,v.jsxs)(`td`,{children:[(0,v.jsx)(`span`,{className:`agent-state-badge ${e.state}`,children:n(`agents.state_${e.state}`)}),e.cleanupState!==`none`&&(0,v.jsx)(`small`,{className:`error`,children:n(`agents.cleanup`)}),e.errorCode&&!q[e.id]&&(0,v.jsx)(`small`,{className:`error`,children:n(`errors.codes.${e.errorCode}`,{defaultValue:n(`agents.taskUnavailable`)})}),q[e.id]&&!G.length&&(0,v.jsx)(`small`,{className:`error`,children:q[e.id]})]}),(0,v.jsx)(`td`,{className:`agent-table-time`,children:(0,v.jsx)(`time`,{dateTime:e.updatedAt,tabIndex:0,"data-tooltip":n(`agents.createdTooltip`,{created:l(e.createdAt,y.resolvedLanguage)}),children:l(e.updatedAt,y.resolvedLanguage,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})})}),(0,v.jsxs)(`td`,{className:`agent-row-actions`,children:[(0,v.jsxs)(`button`,{disabled:I||![`running`,`starting`,`stopping`].includes(e.state),onClick:()=>void Y(()=>X([e],`stop`)),children:[(0,v.jsx)(d,{size:12}),(0,v.jsx)(`span`,{role:`status`,children:n(H.message===`stop:${e.id}`?`common.done`:`agents.end`)})]}),(0,v.jsx)(`button`,{className:`agent-icon-button agent-danger`,title:n(`agents.delete`),"aria-label":n(`agents.delete`),disabled:I,onClick:()=>Z([e]),children:(0,v.jsx)(o,{size:14})})]})]},e.id))})]}),!E.tasks.length&&(0,v.jsxs)(`div`,{className:`agent-task-empty`,children:[P?(0,v.jsx)(g,{size:24,className:`spin`}):(0,v.jsx)(s,{size:28}),(0,v.jsx)(`strong`,{children:n(P?`common.loading`:`agents.noTasks`)}),!P&&(0,v.jsx)(`p`,{children:n(`agents.noTasksHint`)})]})]}),(0,v.jsxs)(`nav`,{className:`project-pagination agent-pagination`,"aria-label":n(`agents.tasks`),children:[(0,v.jsxs)(`button`,{type:`button`,disabled:I||E.page<=1,onClick:()=>{O(E.page-1),W(new Set)},children:[(0,v.jsx)(te,{size:14,"aria-hidden":`true`}),n(`agents.previous`)]}),(0,v.jsxs)(`span`,{children:[E.page,` / `,Math.max(1,Math.ceil(E.total/E.pageSize))]}),(0,v.jsxs)(`button`,{type:`button`,disabled:I||E.page*E.pageSize>=E.total,onClick:()=>{O(E.page+1),W(new Set)},children:[n(`agents.next`),(0,v.jsx)(i,{size:14,"aria-hidden":`true`})]})]}),(0,v.jsx)(ae,{className:`management-dialog`,open:G.length>0,title:n(`agents.delete`),description:n(`agents.bulkDeleteDescription`),onOpenChange:e=>{!e&&!I&&K([])},footer:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`button`,{disabled:I,onClick:()=>K([]),children:n(`common.cancel`)}),(0,v.jsxs)(`button`,{className:`danger`,disabled:I,onClick:()=>void Y(()=>X(G,`delete`)),children:[I&&(0,v.jsx)(g,{size:14,className:`spin`}),n(`agents.delete`)]})]}),children:G.map(e=>(0,v.jsxs)(`div`,{className:`agent-delete-item`,children:[(0,v.jsx)(`strong`,{children:e.title}),(0,v.jsxs)(`small`,{children:[e.projectName,` · `,e.userName,` · `,f[e.agentId]]}),q[e.id]&&(0,v.jsx)(`p`,{className:`error`,role:`alert`,children:q[e.id]})]},e.id))})]})}export{y as AgentManagement};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./AgentTerminalSurface-CaYNNZ9A.js","./rolldown-runtime-XKyaHtl9.js","./react-DUEFWlB7.js","./basePath-B5-c90eh.js","./relativeTime-BR0CVAvz.js","./index-DCwfhKK9.js","./i18nInstance-CIMFwH0l.js","./i18n-DF6keNBA.js","./vite-runtime-CRzLMJPS.js","./index-SVNFLCYh.css","./AgentIcon-ClP5dPRL.js","./AgentIcon-DxrC-zx_.css","./AgentTerminalSurface-B5LH8GIb.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-DUEFWlB7.js";import{t as r}from"./vite-runtime-CRzLMJPS.js";import{$ as i,F as a,I as o,L as s,M as c,a as l,et as u,f as d,p as f,tt as p,z as m}from"./relativeTime-BR0CVAvz.js";import{t as h}from"./check-BRlv1lrZ.js";import{t as g}from"./chevron-up-krb7w67X.js";import{t as _}from"./SaveButton-DkyoEu6j.js";import{t as v}from"./info-DNSAs0_-.js";import{t as y}from"./plus-Dfkyfvvy.js";import{i as b,n as x,t as S}from"./AgentIcon-ClP5dPRL.js";import{C,E as w,c as T,j as E,y as D}from"./index-DCwfhKK9.js";import{a as O,i as k,l as A,n as j,o as M,s as N,t as P}from"./dist-CMYWzCHL.js";import{R as ee}from"./ProjectWorkspace-1UOdyfBq.js";var F=e(t(),1);function I(e){let[t,n]=(0,F.useState)(null),[r,i]=(0,F.useState)({tasks:[],page:1,pageSize:50,total:0}),[a,o]=(0,F.useState)(1),[s,c]=(0,F.useState)(``),[u,d]=(0,F.useState)(``),[f,p]=(0,F.useState)(!1),m=(0,F.useRef)(!1),h=(0,F.useRef)(0),g=(0,F.useRef)(!1),[_,v]=(0,F.useState)(0);(0,F.useEffect)(()=>(g.current=!0,()=>{g.current=!1}),[]),(0,F.useEffect)(()=>{let e=new AbortController;return w(`/api/agents`,{signal:e.signal}).then(n).catch(t=>{e.signal.aborted||d(C(t))}),()=>e.abort()},[e,_]),(0,F.useEffect)(()=>{let t,n=!1,r=()=>{if(document.visibilityState===`hidden`||m.current)return;t?.abort(),t=new AbortController;let r=t,o=h.current,s=new URLSearchParams({project:e,page:String(a)});w(`/api/agent-tasks?${s}`,{signal:r.signal}).then(e=>{n||r.signal.aborted||o!==h.current||(i(e),c(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id??``))}).catch(e=>{!n&&!r.signal.aborted&&o===h.current&&d(C(e))})};r();let o=window.setInterval(r,5e3);return window.addEventListener(`focus`,r),()=>{n=!0,t?.abort(),window.clearInterval(o),window.removeEventListener(`focus`,r)}},[e,a,_]);let y=(0,F.useCallback)(()=>v(e=>e+1),[]),b=(0,F.useCallback)(e=>{h.current++,i(t=>({...t,activeTaskId:[`starting`,`running`,`stopping`].includes(e.state)?e.id:t.activeTaskId===e.id?null:t.activeTaskId,tasks:t.tasks.some(t=>t.id===e.id)?t.tasks.map(t=>t.id===e.id?e:t):[e,...t.tasks],total:t.tasks.some(t=>t.id===e.id)?t.total:t.total+1})),m.current||l()},[]);return{catalog:t,result:r,page:a,setPage:o,selectedId:s,setSelectedId:c,selected:r.tasks.find(e=>e.id===s)??null,error:u,setError:d,busy:f,mutate:async e=>{if(!m.current){m.current=!0,h.current++,p(!0),d(``);try{return await e()}catch(e){g.current&&d(C(e))}finally{m.current=!1,l(),g.current&&(p(!1),y())}}},acceptTask:b}}var L=n();function R({agents:e,value:t,onChange:n,disabled:r=!1}){let{t:i}=E(),[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null),c=e.find(e=>e.id===t),l=r||e.length===0;return(0,F.useEffect)(()=>{l&&o(!1)},[l]),(0,L.jsxs)(P,{modal:!1,open:a,onOpenChange:o,children:[(0,L.jsx)(A,{asChild:!0,children:(0,L.jsxs)(`button`,{ref:s,type:`button`,className:`agent-select-trigger`,disabled:l,"aria-label":c?`${i(`agents.agent`)}: ${c.label}`:i(`agents.agent`),children:[c&&(0,L.jsx)(S,{agent:c.id,size:16}),(0,L.jsx)(`span`,{children:c?.label??i(`agents.agent`)}),(0,L.jsx)(p,{size:13,"aria-hidden":`true`})]})}),(0,L.jsx)(O,{container:s.current?.closest(`[role="dialog"]`),children:(0,L.jsx)(j,{className:`agent-select-options`,side:`top`,align:`start`,sideOffset:5,collisionPadding:8,children:(0,L.jsx)(M,{value:t,"aria-label":i(`agents.agent`),onValueChange:t=>{let r=e.find(e=>e.id===t);!l&&r?.installed&&r.enabled&&n(r.id)},children:e.map(e=>(0,L.jsxs)(N,{value:e.id,textValue:e.label,className:`agent-select-option`,disabled:l||!e.installed||!e.enabled,children:[(0,L.jsx)(S,{agent:e.id,size:16}),(0,L.jsxs)(`span`,{className:`agent-select-label`,children:[e.label,(!e.installed||!e.enabled)&&(0,L.jsx)(`small`,{children:i(e.installed?`agents.disabled`:`agents.notInstalled`)})]}),(0,L.jsx)(k,{className:`agent-select-check`,children:(0,L.jsx)(h,{size:14,"aria-hidden":`true`})})]},e.id))})})})]})}var z=(0,F.lazy)(()=>r(()=>import(`./AgentTerminalSurface-CaYNNZ9A.js`).then(e=>({default:e.AgentTerminalSurface})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url));function B({projectId:e,readOnly:t,onHide:n,maximized:r=!1,onToggleMaximized:l}){let{t:h}=E(),C=I(e),O=d(),k=C.selected,[A,j]=(0,F.useState)(!1),[M,N]=(0,F.useState)(``),[P,B]=(0,F.useState)(``),[V,H]=(0,F.useState)(!1),[U,W]=(0,F.useState)(``),[G,K]=(0,F.useState)(!1),q=k&&[`starting`,`running`,`stopping`].includes(k.state),te=k&&(k.canResume||k.startedAt!==null||[`stopped`,`exited`,`interrupted`].includes(k.state)),J=C.catalog?.agents.find(e=>e.id===k?.agentId),Y=C.catalog?.agents.filter(e=>e.installed&&e.enabled)??[],X=P?C.catalog?.agents.find(e=>e.id===P):Y[0],Z=!!(C.result.activeTaskId&&C.result.activeTaskId!==k?.id),Q=t||C.busy||!!C.result.activeTaskId||!C.catalog?.ptyAvailable||!X?.installed||!X.enabled,ne=!Z&&!t&&J?.installed&&J.enabled&&C.catalog?.ptyAvailable&&k?.cleanupState===`none`,re=e=>{C.setSelectedId(e),H(!1)},$=e=>C.mutate(async()=>{if(!k)return;let t=await w(`/api/agent-tasks/${k.id}${e}`,{method:`POST`});C.acceptTask(t.task)});return(0,L.jsxs)(`section`,{className:`agent-terminal-panel`,"data-agent-terminal":`true`,"aria-label":h(`agents.terminal`),children:[(0,L.jsxs)(`div`,{className:`agent-terminal-heading`,children:[(0,L.jsxs)(`strong`,{children:[(0,L.jsx)(s,{size:14}),h(`agents.terminal`)]}),(0,L.jsx)(`button`,{type:`button`,className:`agent-session-help`,"aria-label":h(`agents.sessionManagementHint`),"data-tooltip":h(`agents.sessionManagementHint`),"data-texlite-tooltip-always":!0,children:(0,L.jsx)(v,{size:13,"aria-hidden":`true`})}),(0,L.jsx)(`div`,{className:`agent-task-tabs`,role:`tablist`,"aria-label":h(`agents.tasks`),children:C.result.tasks.map(e=>(0,L.jsxs)(`button`,{role:`tab`,type:`button`,"aria-selected":e.id===k?.id,title:e.title,className:e.id===k?.id?`active`:``,onClick:()=>re(e.id),children:[(0,L.jsx)(`span`,{className:`agent-state-dot ${e.state}`}),(0,L.jsx)(S,{agent:e.agentId,size:13}),(0,L.jsx)(`span`,{children:e.title}),(0,L.jsx)(`small`,{children:x[e.agentId]})]},e.id))}),(0,L.jsx)(`button`,{className:`agent-icon-button`,disabled:t||C.busy||!Y.length,title:h(`agents.newTask`),"aria-label":h(`agents.newTask`),onClick:()=>j(e=>!e),children:(0,L.jsx)(y,{size:15})}),l&&(0,L.jsx)(`button`,{type:`button`,className:`agent-icon-button`,title:h(r?`agents.restoreTerminal`:`agents.maximizeTerminal`),"aria-label":h(r?`agents.restoreTerminal`:`agents.maximizeTerminal`),"aria-pressed":r,onClick:l,children:r?(0,L.jsx)(p,{size:15}):(0,L.jsx)(g,{size:15})}),(0,L.jsx)(`button`,{className:`agent-icon-button`,title:h(`agents.hide`),"aria-label":h(`agents.hide`),onClick:n,children:(0,L.jsx)(c,{size:15})})]}),(k||C.result.total>C.result.pageSize)&&(0,L.jsxs)(`div`,{className:`agent-task-toolbar`,children:[C.result.total>C.result.pageSize&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{disabled:C.result.page<=1,"aria-label":h(`agents.previous`),onClick:()=>C.setPage(C.result.page-1),children:(0,L.jsx)(u,{size:13})}),(0,L.jsxs)(`small`,{children:[C.result.page,` / `,Math.ceil(C.result.total/C.result.pageSize)]}),(0,L.jsx)(`button`,{disabled:C.result.page*C.result.pageSize>=C.result.total,"aria-label":h(`agents.next`),onClick:()=>C.setPage(C.result.page+1),children:(0,L.jsx)(i,{size:13})})]}),k&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`agent-task-state`,children:h(`agents.state_${k.state}`)}),(0,L.jsx)(`span`,{className:`agent-toolbar-spacer`}),q?(0,L.jsxs)(`button`,{disabled:C.busy,onClick:()=>void $(`/stop`),children:[(0,L.jsx)(b,{size:12}),h(`agents.end`)]}):(0,L.jsxs)(`button`,{disabled:!ne||C.busy,onClick:()=>void $(`/start`),children:[(0,L.jsx)(ee,{size:13}),h(te?`agents.resume`:`agents.start`)]}),(0,L.jsx)(`button`,{className:`agent-icon-button`,title:h(`agents.rename`),"aria-label":h(`agents.rename`),disabled:C.busy,onClick:()=>{W(k.title),H(e=>!e)},children:(0,L.jsx)(m,{size:13})}),(0,L.jsx)(`button`,{className:`agent-icon-button agent-danger`,title:h(`agents.delete`),"aria-label":h(`agents.delete`),disabled:C.busy,onClick:()=>{C.setError(``),K(!0)},children:(0,L.jsx)(o,{size:13})})]})]}),(A||!k)&&(0,L.jsxs)(`form`,{className:`agent-task-create`,onSubmit:t=>{t.preventDefault(),!Q&&C.mutate(async()=>{let t=X?.id,n=await w(`/api/projects/${e}/agent-tasks`,{method:`POST`,body:JSON.stringify({agentId:t,title:M})});C.acceptTask(n.task),C.setPage(1),C.setSelectedId(n.task.id),j(!1),N(``);let r=await w(`/api/agent-tasks/${n.task.id}/start`,{method:`POST`});C.acceptTask(r.task)})},children:[(0,L.jsx)(`input`,{"aria-label":h(`agents.task`),placeholder:h(`agents.titlePlaceholder`),maxLength:160,value:M,onChange:e=>N(e.target.value),disabled:C.busy||t}),(0,L.jsx)(R,{agents:C.catalog?.agents??[],value:X?.id??``,onChange:B,disabled:t||C.busy}),(0,L.jsxs)(`button`,{type:`submit`,disabled:Q,children:[C.busy&&(0,L.jsx)(D,{className:`spin`,size:13}),h(`agents.create`)]})]}),V&&k&&(0,L.jsxs)(`form`,{className:`agent-task-create`,onSubmit:e=>{e.preventDefault(),C.mutate(async()=>{let e=await w(`/api/agent-tasks/${k.id}`,{method:`PATCH`,body:JSON.stringify({title:U})});C.acceptTask(e.task),H(!1)})},children:[(0,L.jsx)(`input`,{value:U,onChange:e=>W(e.target.value),required:!0,maxLength:160,"aria-label":h(`agents.task`)}),(0,L.jsx)(_,{type:`submit`,saving:C.busy,children:h(`common.save`)})]}),C.error&&!G&&(0,L.jsxs)(`p`,{className:`error agent-inline-error`,role:`alert`,children:[C.error,(0,L.jsx)(`button`,{onClick:()=>C.setError(``),"aria-label":h(`common.close`),children:(0,L.jsx)(c,{size:13})})]}),k?.errorCode&&!C.error&&!G&&(0,L.jsx)(`p`,{className:`error agent-inline-error`,role:`alert`,children:h(`errors.codes.${k.errorCode}`,{defaultValue:h(`agents.taskUnavailable`)})}),(Z||A&&C.result.activeTaskId)&&(0,L.jsxs)(`p`,{className:`agent-inline-warning`,role:`status`,children:[(0,L.jsx)(a,{size:14,"aria-hidden":`true`}),(0,L.jsx)(`span`,{children:h(`errors.codes.AGENT_PROJECT_BUSY`)})]}),C.catalog&&!C.catalog.ptyAvailable&&(0,L.jsx)(`p`,{className:`error agent-inline-error`,children:h(`agents.ptyUnavailable`)}),(0,L.jsx)(`div`,{className:`agent-terminal-body`,style:f(O.theme),children:(0,L.jsx)(F.Suspense,{fallback:(0,L.jsx)(`div`,{className:`agent-task-empty`,children:(0,L.jsx)(D,{className:`spin`,size:18})}),children:k&&q&&!t?(0,L.jsx)(z,{task:k,onTask:C.acceptTask},k.id):(0,L.jsxs)(`div`,{className:`agent-task-empty`,children:[(0,L.jsx)(s,{size:24}),(0,L.jsx)(`strong`,{children:k?.title||h(`agents.noTasks`)}),(0,L.jsx)(`p`,{children:h(t?`agents.permissionLost`:`agents.readyHint`)}),k?.exitCode!==null&&k?.exitCode!==void 0&&k.exitCode!==0&&(0,L.jsx)(`small`,{children:h(`agents.exitCode`,{code:k.exitCode})})]})})}),O.showExecutionReminder&&q&&k.state!==`stopping`&&(0,L.jsxs)(`p`,{className:`agent-execution-reminder`,children:[(0,L.jsx)(a,{size:12,"aria-hidden":`true`}),(0,L.jsx)(`span`,{children:h(`agents.endReminder`)})]}),k&&(0,L.jsx)(T,{open:G,title:h(`agents.delete`),description:h(`agents.deleteDescription`),onOpenChange:e=>{C.busy||K(e)},footer:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{disabled:C.busy,onClick:()=>K(!1),children:h(`common.cancel`)}),(0,L.jsxs)(`button`,{className:`danger`,disabled:C.busy,onClick:()=>void C.mutate(async()=>{await w(`/api/agent-tasks/${k.id}`,{method:`DELETE`}),K(!1)}),children:[C.busy&&(0,L.jsx)(D,{className:`spin`,size:13}),h(`agents.delete`)]})]}),children:C.error&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:C.error})})]})}export{B as AgentTerminal};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.xterm{cursor:text;-webkit-user-select:none;-ms-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:underline double}.xterm-underline-3{text-decoration:underline wavy}.xterm-underline-4{text-decoration:underline dotted}.xterm-underline-5{text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}
|
|
Binary file
|
|
Binary file
|