codex-overleaf-link 2.1.4 → 2.1.5
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/README.md +23 -23
- package/extension/bootstrap/manifest.template.json +1 -1
- package/extension/runtime-manifest.json +1 -0
- package/extension/src/content/composerPanel.js +5 -1
- package/extension/src/content/contentRuntime.js +5 -8
- package/extension/src/content/otWarmMirror.js +1 -1
- package/extension/src/content/projectSessionCleanup.js +100 -0
- package/extension/src/content/recentProjects.js +17 -11
- package/extension/src/content/runController.js +2 -2
- package/extension/src/shared/compatibility.js +1 -1
- package/extension/src/shared/i18n.js +16 -0
- package/extension/styles/panel.css +51 -3
- package/native-host/src/codexSessionRunner.js +1 -1
- package/native-host/src/diffEngine.js +10 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<h1>Codex Overleaf Link</h1>
|
|
4
4
|
<p><strong>Empower Overleaf with Codex.</strong></p>
|
|
5
5
|
<p>
|
|
6
|
-
<img src="https://img.shields.io/badge/version-2.1.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-2.1.5-blue" alt="version">
|
|
7
7
|
<img src="https://img.shields.io/badge/platform-macOS%20%2F%20Windows%20%2F%20Linux-lightgrey" alt="platform">
|
|
8
8
|
<img src="https://img.shields.io/badge/chrome-MV3-green" alt="chrome manifest v3">
|
|
9
9
|
<img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node version">
|
|
@@ -38,14 +38,14 @@ One command installs the managed native host **and** managed extension runtime.
|
|
|
38
38
|
macOS / Linux:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
|
-
CODEX_OVERLEAF_REF=v2.1.
|
|
41
|
+
CODEX_OVERLEAF_REF=v2.1.5 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v2.1.5/install.sh)"
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
Windows PowerShell:
|
|
45
45
|
|
|
46
46
|
```powershell
|
|
47
|
-
iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v2.1.
|
|
48
|
-
$env:CODEX_OVERLEAF_REF='v2.1.
|
|
47
|
+
iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v2.1.5/install.ps1 -OutFile install.ps1
|
|
48
|
+
$env:CODEX_OVERLEAF_REF='v2.1.5'
|
|
49
49
|
powershell -ExecutionPolicy Bypass -File install.ps1
|
|
50
50
|
```
|
|
51
51
|
|
|
@@ -56,7 +56,7 @@ Then, in the `chrome://extensions` tab the script opened: enable **Developer mod
|
|
|
56
56
|
`npm exec` installs the same managed native host and extension runtime without keeping a source checkout. Use it if you prefer a pinned npm package.
|
|
57
57
|
|
|
58
58
|
```bash
|
|
59
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
59
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- install-managed
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Then, in `chrome://extensions`, enable **Developer mode**, click **Load unpacked**, and select the managed extension path printed by the command. The Release extension zip remains available for explicitly unmanaged/manual installations.
|
|
@@ -86,9 +86,9 @@ npm installs, updates, and uninstalls the coordinated managed extension/native p
|
|
|
86
86
|
|
|
87
87
|
| Action | Command |
|
|
88
88
|
|--------|---------|
|
|
89
|
-
| Install / update | `npm exec --yes codex-overleaf-link@2.1.
|
|
90
|
-
| Diagnose | `npm exec --yes codex-overleaf-link@2.1.
|
|
91
|
-
| Uninstall | `npm exec --yes codex-overleaf-link@2.1.
|
|
89
|
+
| Install / update | `npm exec --yes codex-overleaf-link@2.1.5 -- install-managed` |
|
|
90
|
+
| Diagnose | `npm exec --yes codex-overleaf-link@2.1.5 -- doctor` |
|
|
91
|
+
| Uninstall | `npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed` |
|
|
92
92
|
|
|
93
93
|
Use `--extension-id <chrome-extension-id>` only for a custom/dev unpacked extension id that differs from the official bundled id.
|
|
94
94
|
|
|
@@ -98,13 +98,13 @@ Managed installations discover signed stable updates automatically and apply the
|
|
|
98
98
|
|
|
99
99
|
## GitHub Release Artifacts
|
|
100
100
|
|
|
101
|
-
The v2.1.
|
|
101
|
+
The v2.1.5 GitHub Release contains:
|
|
102
102
|
|
|
103
|
-
- `codex-overleaf-link-extension-v2.1.
|
|
104
|
-
- `codex-overleaf-native-host-v2.1.
|
|
105
|
-
- `codex-overleaf-link-2.1.
|
|
106
|
-
- `install.sh`: release-pinned macOS / Linux installer that defaults to `v2.1.
|
|
107
|
-
- `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v2.1.
|
|
103
|
+
- `codex-overleaf-link-extension-v2.1.5.zip`: loadable Chrome extension package for manual unpacked installation.
|
|
104
|
+
- `codex-overleaf-native-host-v2.1.5.tar.gz`: native host runtime files used by the installer and release verification.
|
|
105
|
+
- `codex-overleaf-link-2.1.5.tgz`: npm native host CLI package for pinned install, doctor, and uninstall flows.
|
|
106
|
+
- `install.sh`: release-pinned macOS / Linux installer that defaults to `v2.1.5` when run directly from the release artifact.
|
|
107
|
+
- `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v2.1.5` when run directly from the release artifact.
|
|
108
108
|
- `uninstall-native-host.mjs`: native host uninstaller that removes the Chrome Native Messaging manifest, bridge executable, and runtime copy.
|
|
109
109
|
- `nativeHostPlatform.js`, `manifest.js`, `runtimeInstaller.js`: helper files required by the loose uninstaller asset.
|
|
110
110
|
- `SHA256SUMS` and `release-manifest.json`: checksum and artifact metadata for release verification.
|
|
@@ -115,7 +115,7 @@ The v2.1.4 GitHub Release contains:
|
|
|
115
115
|
Remove the native host (use `--browser chromium` on Linux Chromium):
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
118
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
The same command works on Windows PowerShell. If you installed from a manual checkout or source installer, you can also run `npm run uninstall:native` inside the repo, use `node ~/.codex-overleaf/source/scripts/uninstall-native-host.mjs` on macOS / Linux, or use `node $env:LOCALAPPDATA\CodexOverleaf\source\scripts\uninstall-native-host.mjs` on Windows PowerShell.
|
|
@@ -150,13 +150,13 @@ Then remove the extension from `chrome://extensions`. To delete local data: on m
|
|
|
150
150
|
Linux Chromium install or update:
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
|
-
CODEX_OVERLEAF_REF=v2.1.
|
|
153
|
+
CODEX_OVERLEAF_REF=v2.1.5 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v2.1.5/install.sh)" -- --browser chromium
|
|
154
154
|
```
|
|
155
155
|
|
|
156
156
|
Linux Chromium uninstall:
|
|
157
157
|
|
|
158
158
|
```bash
|
|
159
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
159
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed --browser chromium
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
## Features
|
|
@@ -292,7 +292,7 @@ Composer attachments are turn-scoped Codex context. Limits are 8 attachments per
|
|
|
292
292
|
Re-run any [native host installer](#install), reload the extension in `chrome://extensions`, then refresh the Overleaf tab. This also fixes extension/native version mismatch and native protocol mismatch.
|
|
293
293
|
|
|
294
294
|
```bash
|
|
295
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
295
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- install-managed
|
|
296
296
|
```
|
|
297
297
|
|
|
298
298
|
**The Windows popup or panel shows a Bash recovery command**
|
|
@@ -341,8 +341,8 @@ Use this matrix for release-candidate signoff and compatibility reports. Record
|
|
|
341
341
|
| Browser/channel/version | Google Chrome channel and version. | Google Chrome channel and version. | Google Chrome channel and version. | Chromium channel/package and version. |
|
|
342
342
|
| Install mode | Manual unpacked extension from GitHub Release zip or checkout. | Manual unpacked extension from GitHub Release zip or checkout. | Manual unpacked extension from GitHub Release zip or checkout. | Manual unpacked extension from GitHub Release zip or checkout; native host installed with `--browser chromium`. |
|
|
343
343
|
| Extension id | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. | Bundled id `illdpneeeopfffmiepaejglgmhpmdhdc`, or actual custom id passed with `--extension-id`. |
|
|
344
|
-
| Installer/update command | `npm exec --yes codex-overleaf-link@2.1.
|
|
345
|
-
| Uninstall command | `npm exec --yes codex-overleaf-link@2.1.
|
|
344
|
+
| Installer/update command | `npm exec --yes codex-overleaf-link@2.1.5 -- install-managed` | `npm exec --yes codex-overleaf-link@2.1.5 -- install-managed` | `npm exec --yes codex-overleaf-link@2.1.5 -- install-managed` | `npm exec --yes codex-overleaf-link@2.1.5 -- install-managed --browser chromium` |
|
|
345
|
+
| Uninstall command | `npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-managed --browser chromium` |
|
|
346
346
|
| Manifest/registry path | `~/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.codex.overleaf.json` | `HKCU\Software\Google\Chrome\NativeMessagingHosts\com.codex.overleaf` -> `%LOCALAPPDATA%\CodexOverleaf\native-host-runtime\com.codex.overleaf.json` | `~/.config/google-chrome/NativeMessagingHosts/com.codex.overleaf.json` | `~/.config/chromium/NativeMessagingHosts/com.codex.overleaf.json` |
|
|
347
347
|
| Bridge/runtime/source path | Bridge `~/.codex-overleaf/codex-overleaf-bridge`; runtime `~/.codex-overleaf/native-host-runtime`; source `~/.codex-overleaf/source`. | Bridge `%LOCALAPPDATA%\CodexOverleaf\codex-overleaf-bridge.cmd`; runtime `%LOCALAPPDATA%\CodexOverleaf\native-host-runtime`; source `%LOCALAPPDATA%\CodexOverleaf\source`. | Bridge `~/.codex-overleaf/codex-overleaf-bridge`; runtime `~/.codex-overleaf/native-host-runtime`; source `~/.codex-overleaf/source`. | Bridge `~/.codex-overleaf/codex-overleaf-bridge`; runtime `~/.codex-overleaf/native-host-runtime`; source `~/.codex-overleaf/source`. |
|
|
348
348
|
| Node/Git/Codex/TeX | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. | Node.js >= 20; Git; Codex CLI installed and logged in; TeX optional. |
|
|
@@ -378,7 +378,7 @@ Contributions are welcome. Please open an issue before submitting large changes
|
|
|
378
378
|
The recommended v1.9 installation owns one stable unpacked-extension directory and a versioned native-host directory:
|
|
379
379
|
|
|
380
380
|
```bash
|
|
381
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
381
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- install-managed
|
|
382
382
|
```
|
|
383
383
|
|
|
384
384
|
Load the printed extension path once from `chrome://extensions`. Starting with the next signed stable release, Codex Overleaf Link checks GitHub Releases automatically, downloads and verifies the coordinated extension/native-host bundle, waits until every connected Overleaf tab is saved and idle, and then updates both components together. A failed health check restores the previous version automatically.
|
|
@@ -388,11 +388,11 @@ The stable updater ignores drafts and prereleases, performs no telemetry, and ca
|
|
|
388
388
|
The legacy native-only installer remains available for source or unmanaged extension directories:
|
|
389
389
|
|
|
390
390
|
```bash
|
|
391
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
391
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- install-native
|
|
392
392
|
```
|
|
393
393
|
|
|
394
394
|
Legacy native-only installations can be removed with:
|
|
395
395
|
|
|
396
396
|
```bash
|
|
397
|
-
npm exec --yes codex-overleaf-link@2.1.
|
|
397
|
+
npm exec --yes codex-overleaf-link@2.1.5 -- uninstall-native
|
|
398
398
|
```
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"src/content/applyResultFormatters.js",
|
|
59
59
|
"src/content/modelPickerSupport.js",
|
|
60
60
|
"src/content/modelPicker.js",
|
|
61
|
+
"src/content/projectSessionCleanup.js",
|
|
61
62
|
"src/content/recentProjects.js",
|
|
62
63
|
"src/content/otWarmMirror.js",
|
|
63
64
|
"src/content/writebackOrchestrator.js",
|
|
@@ -49,7 +49,11 @@
|
|
|
49
49
|
</label>
|
|
50
50
|
<div class="codex-model-config" data-model-config>
|
|
51
51
|
<button type="button" class="codex-model-config-button" data-model-config-toggle aria-haspopup="menu" aria-expanded="false">
|
|
52
|
-
<span class="codex-model-speed-indicator" data-speed-indicator hidden
|
|
52
|
+
<span class="codex-model-speed-indicator" data-speed-indicator hidden aria-hidden="true">
|
|
53
|
+
<svg viewBox="0 0 16 16" focusable="false">
|
|
54
|
+
<path d="M8.9 1.8 3.8 8.8h3.3l-.5 5.4 5.5-7.5H8.8z"></path>
|
|
55
|
+
</svg>
|
|
56
|
+
</span>
|
|
53
57
|
<span data-model-display>5.4</span>
|
|
54
58
|
<span data-reasoning-display>Medium</span>
|
|
55
59
|
</button>
|
|
@@ -1727,13 +1727,10 @@
|
|
|
1727
1727
|
return;
|
|
1728
1728
|
}
|
|
1729
1729
|
appendRunEvent({
|
|
1730
|
-
//
|
|
1731
|
-
// reads and writes to these files (shouldRestrictWritebackToFocus),
|
|
1732
|
-
// it does not merely "prioritize" them. The selection persists across
|
|
1733
|
-
// turns until cleared via the + tray.
|
|
1730
|
+
// @context prioritizes these files; complete project runs may still update related files.
|
|
1734
1731
|
title: tx(
|
|
1735
|
-
`This run
|
|
1736
|
-
|
|
1732
|
+
`This run will prioritize: ${formatContextItems(getActiveFocusFiles())} (persists across turns; clear via +)`,
|
|
1733
|
+
`本轮将优先处理:${formatContextItems(getActiveFocusFiles())}(跨轮保留,可在 + 中清除)`
|
|
1737
1734
|
),
|
|
1738
1735
|
status: 'completed'
|
|
1739
1736
|
});
|
|
@@ -1785,7 +1782,7 @@
|
|
|
1785
1782
|
focusFiles,
|
|
1786
1783
|
isUsableProjectFileContent: window.CodexOverleafProjectFiles.isUsableProjectFileContent
|
|
1787
1784
|
});
|
|
1788
|
-
let restrictToFocusFiles = runController.shouldRestrictWritebackToFocus({ focusFiles });
|
|
1785
|
+
let restrictToFocusFiles = runController.shouldRestrictWritebackToFocus({ focusFiles, focusedPartialSnapshot });
|
|
1789
1786
|
if (snapshotWarnings.blocking.length && !warmMirrorReuse.useExistingMirror && !focusedPartialSnapshot) {
|
|
1790
1787
|
for (const warning of snapshotWarnings.blocking) {
|
|
1791
1788
|
appendLog(tx(`Cannot continue: ${formatProjectSnapshotWarning(warning)}`, `无法继续:${formatProjectSnapshotWarning(warning)}`));
|
|
@@ -1827,8 +1824,8 @@
|
|
|
1827
1824
|
if (Array.isArray(warmMirrorReuse.focusFiles) && warmMirrorReuse.focusFiles.length) {
|
|
1828
1825
|
focusFiles = warmMirrorReuse.focusFiles;
|
|
1829
1826
|
}
|
|
1830
|
-
restrictToFocusFiles = true;
|
|
1831
1827
|
}
|
|
1828
|
+
restrictToFocusFiles = runController.shouldRestrictWritebackToFocus({ focusFiles, focusedPartialSnapshot: warmMirrorReuse.partialSnapshot, otWarmStart });
|
|
1832
1829
|
appendRunEvent({
|
|
1833
1830
|
title: warmMirrorReuse.warmStart
|
|
1834
1831
|
? tr('warmMirrorReuseTitle')
|
|
@@ -881,7 +881,7 @@
|
|
|
881
881
|
return {
|
|
882
882
|
ok: true,
|
|
883
883
|
project,
|
|
884
|
-
restrictToFocusFiles: runController.shouldRestrictWritebackToFocus({ focusFiles })
|
|
884
|
+
restrictToFocusFiles: runController.shouldRestrictWritebackToFocus({ focusFiles, focusedPartialSnapshot })
|
|
885
885
|
};
|
|
886
886
|
}
|
|
887
887
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
(function initCodexOverleafProjectSessionCleanup() {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const FRESH_RUNNING_WINDOW_MS = 30 * 60 * 1000;
|
|
5
|
+
|
|
6
|
+
function create(deps = {}) {
|
|
7
|
+
const {
|
|
8
|
+
tr,
|
|
9
|
+
getAccountScopeId,
|
|
10
|
+
showPluginConfirm,
|
|
11
|
+
showPluginToast,
|
|
12
|
+
sendBackgroundNative,
|
|
13
|
+
mutateProjectPanelState,
|
|
14
|
+
renderRecentProjectsVariant
|
|
15
|
+
} = deps;
|
|
16
|
+
|
|
17
|
+
function isFreshRunningRecord(StorageDb, record) {
|
|
18
|
+
if (StorageDb.derivePrimaryStatusBadge(record) !== 'running') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
const touched = Date.parse(record.updatedAt || record.lastActivityAt || record.createdAt || '');
|
|
22
|
+
return !Number.isFinite(touched) || (Date.now() - touched) <= FRESH_RUNNING_WINDOW_MS;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function clearProjectSessions(projectId, projectName) {
|
|
26
|
+
const StorageDb = window.CodexOverleafStorageDb;
|
|
27
|
+
const SessionState = window.CodexOverleafSessionState;
|
|
28
|
+
if (!StorageDb || !SessionState) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const scope = getAccountScopeId();
|
|
32
|
+
const records = (await StorageDb.getAllByIndex('sessions', 'projectId', projectId))
|
|
33
|
+
.filter(record => record && (!scope || record.accountScopeId === scope));
|
|
34
|
+
if (!records.length) {
|
|
35
|
+
await renderRecentProjectsVariant();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (records.some(record => isFreshRunningRecord(StorageDb, record))) {
|
|
39
|
+
showPluginToast(tr('recentProjects_clearProject_running'), { status: 'warning', sticky: true });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const approved = await showPluginConfirm({
|
|
43
|
+
title: tr('recentProjects_clearProject_title', { project: projectName }),
|
|
44
|
+
message: tr('recentProjects_clearProject_message', { count: String(records.length), project: projectName }),
|
|
45
|
+
confirmLabel: tr('recentProjects_clearProject_confirm'),
|
|
46
|
+
cancelLabel: tr('confirmDefaultCancel'),
|
|
47
|
+
destructive: true
|
|
48
|
+
});
|
|
49
|
+
if (!approved) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
await mutateProjectPanelState(projectId, state => records.reduce(
|
|
54
|
+
(nextState, record) => SessionState.deleteSession(nextState, record.id),
|
|
55
|
+
state
|
|
56
|
+
));
|
|
57
|
+
} catch (_error) { /* IndexedDB deletion remains authoritative for the dashboard. */ }
|
|
58
|
+
|
|
59
|
+
let removed = 0;
|
|
60
|
+
let historyFailures = 0;
|
|
61
|
+
for (const record of records) {
|
|
62
|
+
try {
|
|
63
|
+
await StorageDb.deleteRecord('sessions', record.id);
|
|
64
|
+
removed++;
|
|
65
|
+
} catch (_error) { /* The remaining record stays visible and can be retried. */ }
|
|
66
|
+
try {
|
|
67
|
+
const response = await sendBackgroundNative({
|
|
68
|
+
method: 'codex.history.clearPlugin',
|
|
69
|
+
params: { sessionId: record.id, threadId: record.codexThreadId || '' }
|
|
70
|
+
});
|
|
71
|
+
if (!response || !response.ok) {
|
|
72
|
+
historyFailures++;
|
|
73
|
+
}
|
|
74
|
+
} catch (_error) {
|
|
75
|
+
historyFailures++;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (removed < records.length) {
|
|
79
|
+
showPluginToast(tr('recentProjects_clearProject_partial', {
|
|
80
|
+
removed: String(removed),
|
|
81
|
+
count: String(records.length)
|
|
82
|
+
}), { status: 'warning', sticky: true });
|
|
83
|
+
} else if (historyFailures) {
|
|
84
|
+
showPluginToast(tr('recentProjects_clearProject_historyPartial', {
|
|
85
|
+
count: String(historyFailures)
|
|
86
|
+
}), { status: 'warning', sticky: true });
|
|
87
|
+
} else {
|
|
88
|
+
showPluginToast(tr('recentProjects_clearProject_done', {
|
|
89
|
+
count: String(removed),
|
|
90
|
+
project: projectName
|
|
91
|
+
}), { status: 'completed' });
|
|
92
|
+
}
|
|
93
|
+
await renderRecentProjectsVariant();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return { clearProjectSessions };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
window.CodexOverleafProjectSessionCleanup = { create };
|
|
100
|
+
})();
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
(function initCodexOverleafRecentProjects() {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
// of contentRuntime.js (v1.4.8 structural-debt phase 4): the account-scoped
|
|
6
|
-
// project-name cache + DOM enrichment, the welcome/empty/degraded states,
|
|
7
|
-
// row rendering, and the per-project/variant switchers. Code moved verbatim;
|
|
8
|
-
// runtime collaborators are factory-injected (the account scope id stays in
|
|
9
|
-
// the runtime and is read through a getter).
|
|
4
|
+
// Cross-project dashboard: account-scoped names, project rows and sessions.
|
|
10
5
|
function create(deps = {}) {
|
|
11
6
|
const {
|
|
12
7
|
tr,
|
|
@@ -24,6 +19,10 @@
|
|
|
24
19
|
PROJECT_EDITOR_RESERVED_IDS,
|
|
25
20
|
STATUS_BADGE_CLASS
|
|
26
21
|
} = deps;
|
|
22
|
+
const projectSessionCleanup = window.CodexOverleafProjectSessionCleanup.create({
|
|
23
|
+
tr, getAccountScopeId: getCachedAccountScopeId, showPluginConfirm, showPluginToast,
|
|
24
|
+
sendBackgroundNative, mutateProjectPanelState, renderRecentProjectsVariant
|
|
25
|
+
});
|
|
27
26
|
|
|
28
27
|
// chrome.storage.local cache key (spec §5.6.3). The cache is keyed by
|
|
29
28
|
// accountScopeId so a second account on the same Chrome profile cannot
|
|
@@ -416,9 +415,6 @@
|
|
|
416
415
|
el.appendChild(textNode(tr('recentProjects_row_projectLinkUnavailable'), 'recent-projects-row-warning'));
|
|
417
416
|
}
|
|
418
417
|
if (!valid) {
|
|
419
|
-
// Dead entry: the session records behind it carry an empty/garbage
|
|
420
|
-
// projectId, so it can never be opened or expanded. Offer a cleanup
|
|
421
|
-
// action that removes those records (and with them, this row).
|
|
422
418
|
var deadWrap = document.createElement('div');
|
|
423
419
|
deadWrap.className = 'recent-projects-row-wrap';
|
|
424
420
|
var deadHead = document.createElement('div');
|
|
@@ -438,8 +434,6 @@
|
|
|
438
434
|
deadWrap.appendChild(deadHead);
|
|
439
435
|
return deadWrap;
|
|
440
436
|
}
|
|
441
|
-
// Wrap the row with an expand toggle + a lazily-populated session list so
|
|
442
|
-
// sessions can be managed (delete/rename) without entering the project.
|
|
443
437
|
var wrap = document.createElement('div');
|
|
444
438
|
wrap.className = 'recent-projects-row-wrap';
|
|
445
439
|
wrap.setAttribute('data-project-row-wrap', projectId);
|
|
@@ -456,8 +450,20 @@
|
|
|
456
450
|
expand.textContent = tr('recentProjects_sessions_action');
|
|
457
451
|
var head = document.createElement('div');
|
|
458
452
|
head.className = 'recent-projects-row-head';
|
|
453
|
+
var clear = document.createElement('button');
|
|
454
|
+
clear.type = 'button';
|
|
455
|
+
clear.className = 'recent-projects-row-clear';
|
|
456
|
+
clear.setAttribute('data-project-clear', '');
|
|
457
|
+
clear.title = tr('recentProjects_clearProject');
|
|
458
|
+
clear.setAttribute('aria-label', tr('recentProjects_clearProject'));
|
|
459
|
+
clear.textContent = '×';
|
|
460
|
+
clear.addEventListener('click', function (event) {
|
|
461
|
+
event.stopPropagation();
|
|
462
|
+
projectSessionCleanup.clearProjectSessions(projectId, name).catch(function () { /* surfaced by the action */ });
|
|
463
|
+
});
|
|
459
464
|
head.appendChild(el);
|
|
460
465
|
head.appendChild(expand);
|
|
466
|
+
head.appendChild(clear);
|
|
461
467
|
var sessionsEl = document.createElement('div');
|
|
462
468
|
sessionsEl.className = 'recent-projects-sessions';
|
|
463
469
|
sessionsEl.setAttribute('data-project-sessions', '');
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
function shouldRestrictWritebackToFocus({ focusFiles = [] } = {}) {
|
|
134
|
-
return normalizeFocusFiles(focusFiles).length > 0;
|
|
133
|
+
function shouldRestrictWritebackToFocus({ focusFiles = [], focusedPartialSnapshot = false, otWarmStart = false } = {}) {
|
|
134
|
+
return normalizeFocusFiles(focusFiles).length > 0 && (focusedPartialSnapshot === true || otWarmStart === true);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
function isFullSnapshotWarning(warning) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
const MIN_NATIVE_VERSION = '1.0.0';
|
|
13
13
|
const MIN_COMPATIBLE_NATIVE_VERSION = '1.0.0';
|
|
14
14
|
const MIN_COMPATIBLE_EXTENSION_VERSION = '1.0.0';
|
|
15
|
-
const BUILD_TARGET_VERSION = '2.1.
|
|
15
|
+
const BUILD_TARGET_VERSION = '2.1.5';
|
|
16
16
|
const DEFAULT_CHROME_EXTENSION_ID = 'illdpneeeopfffmiepaejglgmhpmdhdc';
|
|
17
17
|
const REQUIRED_CAPABILITIES = Object.freeze([
|
|
18
18
|
'bridgePing',
|
|
@@ -469,6 +469,14 @@
|
|
|
469
469
|
recentProjects_sessions_toggle: "Show / manage this project's sessions",
|
|
470
470
|
recentProjects_sessions_action: 'View runs',
|
|
471
471
|
recentProjects_sessions_action_open: 'Hide runs',
|
|
472
|
+
recentProjects_clearProject: 'Delete all sessions for this project',
|
|
473
|
+
recentProjects_clearProject_title: 'Delete all Codex sessions for {project}?',
|
|
474
|
+
recentProjects_clearProject_message: 'This permanently deletes all {count} plugin sessions, run history, and matching plugin-local Codex thread history for {project}. It will not modify Overleaf files or global Codex history.',
|
|
475
|
+
recentProjects_clearProject_confirm: 'Delete all',
|
|
476
|
+
recentProjects_clearProject_running: 'This project may still have a running Codex task. Cancel it before deleting all sessions.',
|
|
477
|
+
recentProjects_clearProject_done: 'Deleted {count} session(s) from {project}.',
|
|
478
|
+
recentProjects_clearProject_partial: 'Deleted {removed} of {count} sessions. The remaining records are still visible; retry to remove them.',
|
|
479
|
+
recentProjects_clearProject_historyPartial: 'Sessions were deleted, but {count} plugin-local Codex thread history item(s) could not be cleared.',
|
|
472
480
|
recentProjects_cleanup: 'Remove this dead entry',
|
|
473
481
|
recentProjects_cleanup_title: 'Remove dead project entry?',
|
|
474
482
|
recentProjects_cleanup_message: 'This entry has no usable project link, so it cannot be opened or expanded. Removing it deletes all of its session records. This cannot be undone.',
|
|
@@ -954,6 +962,14 @@
|
|
|
954
962
|
recentProjects_sessions_toggle: '查看/管理该项目的会话',
|
|
955
963
|
recentProjects_sessions_action: '查看会话',
|
|
956
964
|
recentProjects_sessions_action_open: '收起会话',
|
|
965
|
+
recentProjects_clearProject: '删除该项目的全部会话',
|
|
966
|
+
recentProjects_clearProject_title: '删除 {project} 的全部 Codex 会话?',
|
|
967
|
+
recentProjects_clearProject_message: '这会永久删除 {project} 的全部 {count} 个插件会话、运行历史及对应的插件本地 Codex 线程历史。不会修改 Overleaf 文件或全局 Codex 历史。',
|
|
968
|
+
recentProjects_clearProject_confirm: '全部删除',
|
|
969
|
+
recentProjects_clearProject_running: '该项目可能仍有 Codex 任务在运行。请先取消任务,再删除全部会话。',
|
|
970
|
+
recentProjects_clearProject_done: '已删除 {project} 的 {count} 个会话。',
|
|
971
|
+
recentProjects_clearProject_partial: '已删除 {count} 个会话中的 {removed} 个。剩余记录仍会显示,可重试删除。',
|
|
972
|
+
recentProjects_clearProject_historyPartial: '会话已删除,但有 {count} 条插件本地 Codex 线程历史未能清除。',
|
|
957
973
|
recentProjects_cleanup: '清除这条失效记录',
|
|
958
974
|
recentProjects_cleanup_title: '清除失效的项目记录?',
|
|
959
975
|
recentProjects_cleanup_message: '这条记录的项目链接已失效,无法打开或展开。清除后,它名下的全部会话记录将被删除,且无法恢复。',
|
|
@@ -3390,9 +3390,30 @@
|
|
|
3390
3390
|
|
|
3391
3391
|
#codex-overleaf-panel .codex-model-speed-indicator {
|
|
3392
3392
|
flex: 0 0 auto;
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3393
|
+
display: inline-flex;
|
|
3394
|
+
align-items: center;
|
|
3395
|
+
justify-content: center;
|
|
3396
|
+
width: 14px;
|
|
3397
|
+
height: 14px;
|
|
3398
|
+
color: var(--tl-fg-1);
|
|
3399
|
+
line-height: 0;
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
#codex-overleaf-panel .codex-model-speed-indicator[hidden] {
|
|
3403
|
+
display: none;
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
#codex-overleaf-panel .codex-model-speed-indicator svg {
|
|
3407
|
+
width: 100%;
|
|
3408
|
+
height: 100%;
|
|
3409
|
+
overflow: visible;
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
#codex-overleaf-panel .codex-model-speed-indicator path {
|
|
3413
|
+
fill: currentColor;
|
|
3414
|
+
stroke: currentColor;
|
|
3415
|
+
stroke-width: 0.55;
|
|
3416
|
+
stroke-linejoin: round;
|
|
3396
3417
|
}
|
|
3397
3418
|
|
|
3398
3419
|
#codex-overleaf-panel .codex-model-config-popover {
|
|
@@ -4192,6 +4213,33 @@
|
|
|
4192
4213
|
color: var(--tl-fail);
|
|
4193
4214
|
}
|
|
4194
4215
|
|
|
4216
|
+
#codex-overleaf-panel .recent-projects-row-clear {
|
|
4217
|
+
position: absolute;
|
|
4218
|
+
top: 8px;
|
|
4219
|
+
right: 8px;
|
|
4220
|
+
z-index: 2;
|
|
4221
|
+
width: 24px;
|
|
4222
|
+
height: 24px;
|
|
4223
|
+
border-radius: var(--tl-r-sm);
|
|
4224
|
+
color: var(--tl-fg-4);
|
|
4225
|
+
font-size: 16px;
|
|
4226
|
+
line-height: 1;
|
|
4227
|
+
opacity: 0;
|
|
4228
|
+
transform: translateX(4px);
|
|
4229
|
+
transition: color 120ms ease, background 120ms ease, opacity 120ms ease, transform 120ms ease;
|
|
4230
|
+
}
|
|
4231
|
+
|
|
4232
|
+
#codex-overleaf-panel .recent-projects-row-wrap:hover .recent-projects-row-clear,
|
|
4233
|
+
#codex-overleaf-panel .recent-projects-row-clear:focus-visible {
|
|
4234
|
+
opacity: 1;
|
|
4235
|
+
transform: translateX(0);
|
|
4236
|
+
}
|
|
4237
|
+
|
|
4238
|
+
#codex-overleaf-panel .recent-projects-row-clear:hover {
|
|
4239
|
+
background: var(--tl-hover);
|
|
4240
|
+
color: var(--tl-fail);
|
|
4241
|
+
}
|
|
4242
|
+
|
|
4195
4243
|
#codex-overleaf-panel .recent-projects-loading {
|
|
4196
4244
|
padding: 10px 12px;
|
|
4197
4245
|
color: var(--tl-fg-3);
|
|
@@ -252,7 +252,7 @@ async function runCodexSession({ params = {}, env = process.env, emit = () => {}
|
|
|
252
252
|
if (change.type === 'write' && typeof change.previousContent === 'string') {
|
|
253
253
|
return {
|
|
254
254
|
...change,
|
|
255
|
-
diff: computeLineDiff(change.previousContent, change.content),
|
|
255
|
+
diff: computeLineDiff(change.previousContent, change.content, 3, params.locale === 'zh' ? 'zh' : 'en'),
|
|
256
256
|
patches: computeTextPatches(change.previousContent, change.content)
|
|
257
257
|
};
|
|
258
258
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function computeLineDiff(oldText, newText, contextLines = 3) {
|
|
3
|
+
function computeLineDiff(oldText, newText, contextLines = 3, locale = 'en') {
|
|
4
4
|
const oldLines = splitLines(oldText);
|
|
5
5
|
const newLines = splitLines(newText);
|
|
6
6
|
|
|
@@ -12,23 +12,28 @@ function computeLineDiff(oldText, newText, contextLines = 3) {
|
|
|
12
12
|
const MAX_DIFF_PRODUCT = 4000000;
|
|
13
13
|
|
|
14
14
|
if (oldLines.length > MAX_LINES || newLines.length > MAX_LINES || oldLines.length * newLines.length > MAX_DIFF_PRODUCT) {
|
|
15
|
-
return buildTruncatedResult(oldLines.length, newLines.length);
|
|
15
|
+
return buildTruncatedResult(oldLines.length, newLines.length, locale);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const edits = myersDiff(oldLines, newLines);
|
|
19
19
|
if (edits === null) {
|
|
20
|
-
return buildTruncatedResult(oldLines.length, newLines.length);
|
|
20
|
+
return buildTruncatedResult(oldLines.length, newLines.length, locale);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
return buildHunks(oldLines, newLines, edits, contextLines);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function buildTruncatedResult(oldCount, newCount) {
|
|
26
|
+
function buildTruncatedResult(oldCount, newCount, locale = 'en') {
|
|
27
27
|
return [{
|
|
28
28
|
startA: 1,
|
|
29
29
|
startB: 1,
|
|
30
30
|
truncated: true,
|
|
31
|
-
lines: [{
|
|
31
|
+
lines: [{
|
|
32
|
+
type: 'context',
|
|
33
|
+
text: locale === 'zh'
|
|
34
|
+
? `文件改动较大(${oldCount} → ${newCount} 行),请在 Overleaf 中查看完整差异。`
|
|
35
|
+
: `Large file change (${oldCount} → ${newCount} lines). Review the full diff in Overleaf.`
|
|
36
|
+
}]
|
|
32
37
|
}];
|
|
33
38
|
}
|
|
34
39
|
|