codex-overleaf-link 1.9.11 → 1.9.12
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 +5 -3
- package/extension/src/content/contentRuntime.js +60 -325
- package/extension/src/content/projectSettingsCoordinator.js +365 -0
- package/extension/src/content/sessionManager.js +20 -204
- package/extension/src/content/sessionMenuView.js +218 -0
- package/extension/src/page/saveState.js +292 -0
- package/extension/src/pageBridge.js +10 -274
- package/extension/src/shared/compatibility.js +1 -1
- 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-1.9.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-1.9.12-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=v1.9.
|
|
41
|
+
CODEX_OVERLEAF_REF=v1.9.12 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.12/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/v1.9.
|
|
48
|
-
$env:CODEX_OVERLEAF_REF='v1.9.
|
|
47
|
+
iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.12/install.ps1 -OutFile install.ps1
|
|
48
|
+
$env:CODEX_OVERLEAF_REF='v1.9.12'
|
|
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@1.9.
|
|
59
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- 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@1.9.
|
|
90
|
-
| Diagnose | `npm exec --yes codex-overleaf-link@1.9.
|
|
91
|
-
| Uninstall | `npm exec --yes codex-overleaf-link@1.9.
|
|
89
|
+
| Install / update | `npm exec --yes codex-overleaf-link@1.9.12 -- install-managed` |
|
|
90
|
+
| Diagnose | `npm exec --yes codex-overleaf-link@1.9.12 -- doctor` |
|
|
91
|
+
| Uninstall | `npm exec --yes codex-overleaf-link@1.9.12 -- 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 v1.9.
|
|
101
|
+
The v1.9.12 GitHub Release contains:
|
|
102
102
|
|
|
103
|
-
- `codex-overleaf-link-extension-v1.9.
|
|
104
|
-
- `codex-overleaf-native-host-v1.9.
|
|
105
|
-
- `codex-overleaf-link-1.9.
|
|
106
|
-
- `install.sh`: release-pinned macOS / Linux installer that defaults to `v1.9.
|
|
107
|
-
- `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.9.
|
|
103
|
+
- `codex-overleaf-link-extension-v1.9.12.zip`: loadable Chrome extension package for manual unpacked installation.
|
|
104
|
+
- `codex-overleaf-native-host-v1.9.12.tar.gz`: native host runtime files used by the installer and release verification.
|
|
105
|
+
- `codex-overleaf-link-1.9.12.tgz`: npm native host CLI package for pinned install, doctor, and uninstall flows.
|
|
106
|
+
- `install.sh`: release-pinned macOS / Linux installer that defaults to `v1.9.12` when run directly from the release artifact.
|
|
107
|
+
- `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.9.12` 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 v1.9.11 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@1.9.
|
|
118
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- 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=v1.9.
|
|
153
|
+
CODEX_OVERLEAF_REF=v1.9.12 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.12/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@1.9.
|
|
159
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- uninstall-managed --browser chromium
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
## Features
|
|
@@ -291,7 +291,7 @@ Composer attachments are turn-scoped Codex context. Limits are 8 attachments per
|
|
|
291
291
|
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.
|
|
292
292
|
|
|
293
293
|
```bash
|
|
294
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
294
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- install-managed
|
|
295
295
|
```
|
|
296
296
|
|
|
297
297
|
**The Windows popup or panel shows a Bash recovery command**
|
|
@@ -340,8 +340,8 @@ Use this matrix for release-candidate signoff and compatibility reports. Record
|
|
|
340
340
|
| Browser/channel/version | Google Chrome channel and version. | Google Chrome channel and version. | Google Chrome channel and version. | Chromium channel/package and version. |
|
|
341
341
|
| 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`. |
|
|
342
342
|
| 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`. |
|
|
343
|
-
| Installer/update command | `npm exec --yes codex-overleaf-link@1.9.
|
|
344
|
-
| Uninstall command | `npm exec --yes codex-overleaf-link@1.9.
|
|
343
|
+
| Installer/update command | `npm exec --yes codex-overleaf-link@1.9.12 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.12 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.12 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.12 -- install-managed --browser chromium` |
|
|
344
|
+
| Uninstall command | `npm exec --yes codex-overleaf-link@1.9.12 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.12 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.12 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.12 -- uninstall-managed --browser chromium` |
|
|
345
345
|
| 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` |
|
|
346
346
|
| 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`. |
|
|
347
347
|
| 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. |
|
|
@@ -377,7 +377,7 @@ Contributions are welcome. Please open an issue before submitting large changes
|
|
|
377
377
|
The recommended v1.9 installation owns one stable unpacked-extension directory and a versioned native-host directory:
|
|
378
378
|
|
|
379
379
|
```bash
|
|
380
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
380
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- install-managed
|
|
381
381
|
```
|
|
382
382
|
|
|
383
383
|
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.
|
|
@@ -387,11 +387,11 @@ The stable updater ignores drafts and prereleases, performs no telemetry, and ca
|
|
|
387
387
|
The legacy native-only installer remains available for source or unmanaged extension directories:
|
|
388
388
|
|
|
389
389
|
```bash
|
|
390
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
390
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- install-native
|
|
391
391
|
```
|
|
392
392
|
|
|
393
393
|
Legacy native-only installations can be removed with:
|
|
394
394
|
|
|
395
395
|
```bash
|
|
396
|
-
npm exec --yes codex-overleaf-link@1.9.
|
|
396
|
+
npm exec --yes codex-overleaf-link@1.9.12 -- uninstall-native
|
|
397
397
|
```
|
|
@@ -44,9 +44,11 @@
|
|
|
44
44
|
"src/content/composerPanel.js",
|
|
45
45
|
"src/content/themeController.js",
|
|
46
46
|
"src/content/markdownText.js",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
"src/content/diagnosticsController.js",
|
|
48
|
+
"src/content/runTimelineView.js",
|
|
49
|
+
"src/content/projectSettingsCoordinator.js",
|
|
50
|
+
"src/content/sessionMenuView.js",
|
|
51
|
+
"src/content/sessionManager.js",
|
|
50
52
|
"src/content/applyResultFormatters.js",
|
|
51
53
|
"src/content/modelPicker.js",
|
|
52
54
|
"src/content/recentProjects.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
undefined,
|
|
65
65
|
getCurrentExtensionId()
|
|
66
66
|
) || 'curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/main/install.sh | bash -s -- --extension-id <chrome-extension-id>';
|
|
67
|
-
const PAGE_BRIDGE_SCRIPT_REVISION = '2026-05-21-editor-readiness-
|
|
67
|
+
const PAGE_BRIDGE_SCRIPT_REVISION = '2026-05-21-editor-readiness-v11';
|
|
68
68
|
const PAGE_BRIDGE_CAPABILITY = createPageBridgeCapability();
|
|
69
69
|
const pageBridgeReady = injectPageBridge();
|
|
70
70
|
const {
|
|
@@ -172,6 +172,64 @@
|
|
|
172
172
|
hasUnsafeRuntimePathSegments
|
|
173
173
|
} = markdownText;
|
|
174
174
|
|
|
175
|
+
const projectSettingsCoordinator = window.CodexOverleafProjectSettingsCoordinator.create({
|
|
176
|
+
CodexOverleafTheme: window.CodexOverleafTheme,
|
|
177
|
+
GovernanceRules,
|
|
178
|
+
SettingsPanel,
|
|
179
|
+
closeContextTray: () => closeContextTray(),
|
|
180
|
+
closeDiagnosticsMenu: () => closeDiagnosticsMenu(),
|
|
181
|
+
closeDiagnosticsResult: () => closeDiagnosticsResult(),
|
|
182
|
+
closeModelConfigPopover: () => closeModelConfigPopover(),
|
|
183
|
+
closeSlashMenu: () => closeSlashMenu(),
|
|
184
|
+
getCurrentProjectId: () => getCurrentProjectId(),
|
|
185
|
+
getLocalSkillsPanel: () => localSkillsPanel,
|
|
186
|
+
getLocale: () => getLocale(),
|
|
187
|
+
getPanel: () => panel,
|
|
188
|
+
getPanelRendererInstance: () => panelRendererInstance,
|
|
189
|
+
getSettingsPanelInstance: () => settingsPanelInstance,
|
|
190
|
+
getState: () => state,
|
|
191
|
+
isProjectEditorRoute,
|
|
192
|
+
refreshStorageUsageSummary: () => refreshStorageUsageSummary(),
|
|
193
|
+
renderAuditHistoryPanel: () => renderAuditHistoryPanel(),
|
|
194
|
+
renderRecentProjectsVariant: (...args) => renderRecentProjectsVariant(...args),
|
|
195
|
+
saveStateSoon: () => saveStateSoon(),
|
|
196
|
+
setState: next => { state = next; },
|
|
197
|
+
tr,
|
|
198
|
+
tx,
|
|
199
|
+
window
|
|
200
|
+
});
|
|
201
|
+
const {
|
|
202
|
+
applyPanelTheme,
|
|
203
|
+
clearProjectSettingsStatus,
|
|
204
|
+
closeCustomInstructionsSettings,
|
|
205
|
+
closeSkillsView,
|
|
206
|
+
getCodexOverleafSkillEnabled,
|
|
207
|
+
getCustomInstructionsForCurrentProject,
|
|
208
|
+
getGovernanceRulesForCurrentProject,
|
|
209
|
+
getSkillLoadingSettings,
|
|
210
|
+
getThemePreference,
|
|
211
|
+
isCodexOverleafSkillEnabled,
|
|
212
|
+
normalizeCustomInstructionsByProject,
|
|
213
|
+
normalizeGovernanceRules,
|
|
214
|
+
normalizeGovernanceRulesByProject,
|
|
215
|
+
normalizeProjectPreferenceKey,
|
|
216
|
+
openCustomInstructionsSettings,
|
|
217
|
+
openSkillsView,
|
|
218
|
+
readGovernanceRulesFromSettings,
|
|
219
|
+
readSkillLoadingSettingsFromSettings,
|
|
220
|
+
refreshLocalSkills,
|
|
221
|
+
renderLocalSkillList,
|
|
222
|
+
setCodexOverleafSkillEnabled,
|
|
223
|
+
setCustomInstructionsForProject,
|
|
224
|
+
setGovernanceRulesForCurrentProject,
|
|
225
|
+
setProjectSettingsStatus,
|
|
226
|
+
setSkillLoadingSettings,
|
|
227
|
+
syncCustomInstructionsEditorForProject,
|
|
228
|
+
syncProjectSettingsEditorForProject,
|
|
229
|
+
toggleCustomInstructionsSettings,
|
|
230
|
+
updateSkillsEntrySummary
|
|
231
|
+
} = projectSettingsCoordinator;
|
|
232
|
+
|
|
175
233
|
const otWarmMirror = window.CodexOverleafOtWarmMirror.create({
|
|
176
234
|
tr,
|
|
177
235
|
tx,
|
|
@@ -702,8 +760,6 @@
|
|
|
702
760
|
let slashCodexOverleafSkillsLoaded = false;
|
|
703
761
|
let slashCodexOverleafSkillsLoading = false;
|
|
704
762
|
let renderedSlashCommands = new Map();
|
|
705
|
-
let customInstructionsEditorProjectId = '';
|
|
706
|
-
let customInstructionsEditorValue = '';
|
|
707
763
|
let runCancellationRequested = false;
|
|
708
764
|
let activePluginConfirmResolve = null;
|
|
709
765
|
const updateIdleClient = root.CodexOverleafUpdateIdle?.create({
|
|
@@ -1175,328 +1231,6 @@
|
|
|
1175
1231
|
DiagnosticsPanel.closeMenu(diagnosticsPanelInstance);
|
|
1176
1232
|
}
|
|
1177
1233
|
|
|
1178
|
-
function normalizeCustomInstructionsByProject(value) {
|
|
1179
|
-
const result = {};
|
|
1180
|
-
const textMaxChars = 12000;
|
|
1181
|
-
const keyMaxChars = 160;
|
|
1182
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1183
|
-
return result;
|
|
1184
|
-
}
|
|
1185
|
-
for (const rawKey of Object.keys(value)) {
|
|
1186
|
-
const key = typeof rawKey === 'string' ? rawKey.trim() : '';
|
|
1187
|
-
if (!key) {
|
|
1188
|
-
continue;
|
|
1189
|
-
}
|
|
1190
|
-
const normalizedKey = key.length <= keyMaxChars ? key : key.slice(0, keyMaxChars - 1) + '…';
|
|
1191
|
-
const rawText = typeof value[rawKey] === 'string' ? value[rawKey] : '';
|
|
1192
|
-
result[normalizedKey] = rawText.length <= textMaxChars
|
|
1193
|
-
? rawText
|
|
1194
|
-
: rawText.slice(0, textMaxChars - 1) + '…';
|
|
1195
|
-
}
|
|
1196
|
-
return result;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
function getCustomInstructionsForCurrentProject() {
|
|
1200
|
-
const projectId = getCurrentProjectId();
|
|
1201
|
-
const normalizedProject = normalizeCustomInstructionsByProject({ [projectId]: '' });
|
|
1202
|
-
const normalizedProjectId = Object.keys(normalizedProject)[0] || '';
|
|
1203
|
-
if (!normalizedProjectId) {
|
|
1204
|
-
return '';
|
|
1205
|
-
}
|
|
1206
|
-
return normalizeCustomInstructionsByProject(state?.customInstructionsByProject)[normalizedProjectId] || '';
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
function setCustomInstructionsForProject(projectId, value) {
|
|
1210
|
-
const normalizedProject = normalizeCustomInstructionsByProject({ [projectId]: value });
|
|
1211
|
-
const normalizedProjectId = Object.keys(normalizedProject)[0] || '';
|
|
1212
|
-
if (!normalizedProjectId) {
|
|
1213
|
-
return;
|
|
1214
|
-
}
|
|
1215
|
-
state = {
|
|
1216
|
-
...state,
|
|
1217
|
-
customInstructionsByProject: {
|
|
1218
|
-
...normalizeCustomInstructionsByProject(state?.customInstructionsByProject),
|
|
1219
|
-
[normalizedProjectId]: normalizedProject[normalizedProjectId]
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
function openCustomInstructionsSettings() {
|
|
1226
|
-
if (!settingsPanelInstance) {
|
|
1227
|
-
return;
|
|
1228
|
-
}
|
|
1229
|
-
closeDiagnosticsMenu();
|
|
1230
|
-
closeDiagnosticsResult();
|
|
1231
|
-
closeModelConfigPopover();
|
|
1232
|
-
closeContextTray();
|
|
1233
|
-
if (typeof closeSlashMenu === 'function') {
|
|
1234
|
-
closeSlashMenu();
|
|
1235
|
-
}
|
|
1236
|
-
clearProjectSettingsStatus();
|
|
1237
|
-
syncCustomInstructionsEditorForProject(getCurrentProjectId(), { force: true });
|
|
1238
|
-
syncProjectSettingsEditorForProject();
|
|
1239
|
-
panelRendererInstance?.setView?.('settings');
|
|
1240
|
-
SettingsPanel.show(settingsPanelInstance);
|
|
1241
|
-
refreshStorageUsageSummary();
|
|
1242
|
-
// A history card left expanded re-loads on every settings open; the
|
|
1243
|
-
// toggle listener only fires on the closed->open transition.
|
|
1244
|
-
if (settingsPanelInstance?.container?.querySelector('[data-history-card]')?.open) {
|
|
1245
|
-
renderAuditHistoryPanel();
|
|
1246
|
-
}
|
|
1247
|
-
if (typeof refreshLocalSkills === 'function') {
|
|
1248
|
-
refreshLocalSkills().catch(error => setProjectSettingsStatus(tx(`Could not list local skills: ${error.message}`, `无法列出本地技能:${error.message}`), 'failed'));
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
function toggleCustomInstructionsSettings() {
|
|
1253
|
-
if (SettingsPanel.isVisible(settingsPanelInstance)) {
|
|
1254
|
-
closeCustomInstructionsSettings();
|
|
1255
|
-
return;
|
|
1256
|
-
}
|
|
1257
|
-
openCustomInstructionsSettings();
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
function closeCustomInstructionsSettings() {
|
|
1261
|
-
SettingsPanel.hide(settingsPanelInstance);
|
|
1262
|
-
// Back from settings must return to the variant that matches the current
|
|
1263
|
-
// route, not unconditionally to the per-project session view. On a
|
|
1264
|
-
// non-project URL (e.g. /project, /project/, account / billing) the
|
|
1265
|
-
// session view is meaningless and shows an empty per-project conversation
|
|
1266
|
-
// UI; the user expects to return to the Recent-projects variant they
|
|
1267
|
-
// came from. Mirror the SPA route hook's variant dispatch.
|
|
1268
|
-
if (isProjectEditorRoute(window.location)) {
|
|
1269
|
-
panelRendererInstance?.setView?.('session');
|
|
1270
|
-
} else {
|
|
1271
|
-
renderRecentProjectsVariant().catch(() => { /* swallow */ });
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
// Skills sub-page: reached from the settings screen's Codex Overleaf skills
|
|
1276
|
-
// entry row. Its in-memory view-state is the panel root's data-view="skills".
|
|
1277
|
-
function openSkillsView() {
|
|
1278
|
-
if (!settingsPanelInstance) {
|
|
1279
|
-
return;
|
|
1280
|
-
}
|
|
1281
|
-
panelRendererInstance?.setView?.('skills');
|
|
1282
|
-
refreshLocalSkills().catch(error => setProjectSettingsStatus(tx(`Could not list local skills: ${error.message}`, `无法列出本地技能:${error.message}`), 'failed'));
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
function closeSkillsView() {
|
|
1286
|
-
// The skills screen's back button returns to the settings screen.
|
|
1287
|
-
panelRendererInstance?.setView?.('settings');
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
function updateSkillsEntrySummary() {
|
|
1291
|
-
if (!settingsPanelInstance) {
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
const summary = getSkillLoadingSettings().loadCodexOverleafSkills === false
|
|
1295
|
-
? tr('codexOverleafSkillsSummaryOff')
|
|
1296
|
-
: tr('codexOverleafSkillsSummaryCount', { count: countEnabledCodexOverleafSkills() });
|
|
1297
|
-
SettingsPanel.setSkillsSummary(settingsPanelInstance, summary);
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
function countEnabledCodexOverleafSkills() {
|
|
1301
|
-
const skills = Array.isArray(state?.codexOverleafSkills) ? state.codexOverleafSkills : [];
|
|
1302
|
-
return skills.reduce((total, skill) => {
|
|
1303
|
-
const id = String(skill?.id || '').trim();
|
|
1304
|
-
return id && isCodexOverleafSkillEnabled(id) ? total + 1 : total;
|
|
1305
|
-
}, 0);
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
function syncCustomInstructionsEditorForProject(projectId = getCurrentProjectId(), options) {
|
|
1309
|
-
const syncOptions = options || {};
|
|
1310
|
-
const input = panel?.querySelector('[data-custom-instructions-input]');
|
|
1311
|
-
if (!input) {
|
|
1312
|
-
return;
|
|
1313
|
-
}
|
|
1314
|
-
const normalizedProject = normalizeCustomInstructionsByProject({ [projectId]: '' });
|
|
1315
|
-
const normalizedProjectId = Object.keys(normalizedProject)[0] || '';
|
|
1316
|
-
const storedValue = normalizedProjectId
|
|
1317
|
-
? normalizeCustomInstructionsByProject(state?.customInstructionsByProject)[normalizedProjectId] || ''
|
|
1318
|
-
: '';
|
|
1319
|
-
input.placeholder = tr('customInstructionsPlaceholder');
|
|
1320
|
-
const editorIsOpen = panel?.dataset?.view === 'settings' || panel?.dataset?.view === 'skills';
|
|
1321
|
-
const editorIsDirty = normalizedProjectId
|
|
1322
|
-
&& customInstructionsEditorProjectId === normalizedProjectId
|
|
1323
|
-
&& input.value !== customInstructionsEditorValue;
|
|
1324
|
-
if (!syncOptions.force && editorIsOpen && editorIsDirty) {
|
|
1325
|
-
return;
|
|
1326
|
-
}
|
|
1327
|
-
input.value = storedValue;
|
|
1328
|
-
customInstructionsEditorProjectId = normalizedProjectId;
|
|
1329
|
-
customInstructionsEditorValue = storedValue;
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
function normalizeGovernanceRulesByProject(value) {
|
|
1333
|
-
const result = {};
|
|
1334
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1335
|
-
return result;
|
|
1336
|
-
}
|
|
1337
|
-
for (const rawKey of Object.keys(value)) {
|
|
1338
|
-
const key = normalizeProjectPreferenceKey(rawKey);
|
|
1339
|
-
if (!key) {
|
|
1340
|
-
continue;
|
|
1341
|
-
}
|
|
1342
|
-
result[key] = normalizeGovernanceRules(value[rawKey]);
|
|
1343
|
-
}
|
|
1344
|
-
return result;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
function normalizeSelectedLocalSkillIdsByProject(value) {
|
|
1348
|
-
const result = {};
|
|
1349
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1350
|
-
return result;
|
|
1351
|
-
}
|
|
1352
|
-
for (const rawKey of Object.keys(value)) {
|
|
1353
|
-
const key = normalizeProjectPreferenceKey(rawKey);
|
|
1354
|
-
if (!key) {
|
|
1355
|
-
continue;
|
|
1356
|
-
}
|
|
1357
|
-
result[key] = normalizeSelectedLocalSkillIds(value[rawKey]);
|
|
1358
|
-
}
|
|
1359
|
-
return result;
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
function normalizeProjectPreferenceKey(value) {
|
|
1363
|
-
const text = String(value || '').trim();
|
|
1364
|
-
return text.length <= 160 ? text : text.slice(0, 159) + '…';
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
function normalizeGovernanceRules(value = {}) {
|
|
1368
|
-
if (GovernanceRules?.normalizeGovernanceRules) {
|
|
1369
|
-
return GovernanceRules.normalizeGovernanceRules(value);
|
|
1370
|
-
}
|
|
1371
|
-
return {
|
|
1372
|
-
readonlyPatterns: normalizePatternTextList(value.readonlyPatterns),
|
|
1373
|
-
writablePatterns: normalizePatternTextList(value.writablePatterns),
|
|
1374
|
-
sensitiveCheckEnabled: value.sensitiveCheckEnabled !== false,
|
|
1375
|
-
sensitiveConfirmAllowed: value.sensitiveConfirmAllowed === true
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
function normalizePatternTextList(value) {
|
|
1380
|
-
if (Array.isArray(value)) {
|
|
1381
|
-
return value.map(item => String(item || '').trim()).filter(Boolean);
|
|
1382
|
-
}
|
|
1383
|
-
return String(value || '').split(/\r?\n/).map(item => item.trim()).filter(Boolean);
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
function getGovernanceRulesForCurrentProject() {
|
|
1387
|
-
const projectId = normalizeProjectPreferenceKey(getCurrentProjectId());
|
|
1388
|
-
return normalizeGovernanceRulesByProject(state?.governanceRulesByProject)[projectId] || normalizeGovernanceRules({});
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
function setGovernanceRulesForCurrentProject(rules) {
|
|
1392
|
-
const projectId = normalizeProjectPreferenceKey(getCurrentProjectId());
|
|
1393
|
-
if (!projectId) {
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1396
|
-
state = {
|
|
1397
|
-
...state,
|
|
1398
|
-
governanceRulesByProject: {
|
|
1399
|
-
...normalizeGovernanceRulesByProject(state?.governanceRulesByProject),
|
|
1400
|
-
[projectId]: normalizeGovernanceRules(rules)
|
|
1401
|
-
}
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
// Theme: a global preference (dark / light / auto) applied to the panel root
|
|
1406
|
-
// via themeController. 'auto' resolves through prefers-color-scheme; the
|
|
1407
|
-
// disposer detaches the OS-change listener when switching away from auto.
|
|
1408
|
-
let themeAutoDisposer = null;
|
|
1409
|
-
function getThemePreference() {
|
|
1410
|
-
return CodexOverleafTheme.normalizeThemePreference(state?.theme);
|
|
1411
|
-
}
|
|
1412
|
-
function applyPanelTheme(preference) {
|
|
1413
|
-
const normalized = CodexOverleafTheme.normalizeThemePreference(preference);
|
|
1414
|
-
CodexOverleafTheme.applyTheme(normalized, panel);
|
|
1415
|
-
if (themeAutoDisposer) {
|
|
1416
|
-
themeAutoDisposer();
|
|
1417
|
-
themeAutoDisposer = null;
|
|
1418
|
-
}
|
|
1419
|
-
themeAutoDisposer = CodexOverleafTheme.watchAuto(normalized, panel);
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
function getSkillLoadingSettings() {
|
|
1423
|
-
return {
|
|
1424
|
-
loadCodexLocalSkills: state?.loadCodexLocalSkills !== false,
|
|
1425
|
-
loadCodexOverleafSkills: state?.loadCodexOverleafSkills !== false
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
function setSkillLoadingSettings(settings = {}) {
|
|
1430
|
-
state = {
|
|
1431
|
-
...state,
|
|
1432
|
-
loadCodexLocalSkills: settings.loadCodexLocalSkills !== false,
|
|
1433
|
-
loadCodexOverleafSkills: settings.loadCodexOverleafSkills !== false
|
|
1434
|
-
};
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
function getCodexOverleafSkillEnabled() {
|
|
1438
|
-
const map = state?.codexOverleafSkillEnabled;
|
|
1439
|
-
return map && typeof map === 'object' && !Array.isArray(map) ? map : {};
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
function isCodexOverleafSkillEnabled(skillId) {
|
|
1443
|
-
const map = getCodexOverleafSkillEnabled();
|
|
1444
|
-
if (!Object.prototype.hasOwnProperty.call(map, skillId)) {
|
|
1445
|
-
return true; // absent means enabled (default true)
|
|
1446
|
-
}
|
|
1447
|
-
return map[skillId] !== false;
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
function setCodexOverleafSkillEnabled(skillId, enabled) {
|
|
1451
|
-
const map = getCodexOverleafSkillEnabled();
|
|
1452
|
-
state = {
|
|
1453
|
-
...state,
|
|
1454
|
-
codexOverleafSkillEnabled: {
|
|
1455
|
-
...map,
|
|
1456
|
-
[skillId]: Boolean(enabled)
|
|
1457
|
-
}
|
|
1458
|
-
};
|
|
1459
|
-
saveStateSoon();
|
|
1460
|
-
renderLocalSkillList();
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
function readSkillLoadingSettingsFromSettings() {
|
|
1464
|
-
return SettingsPanel.readState(settingsPanelInstance).skillToggles;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
function readGovernanceRulesFromSettings() {
|
|
1468
|
-
return normalizeGovernanceRules(SettingsPanel.readState(settingsPanelInstance).governanceRules);
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
function syncProjectSettingsEditorForProject() {
|
|
1472
|
-
SettingsPanel.loadState(settingsPanelInstance, {
|
|
1473
|
-
governanceRules: getGovernanceRulesForCurrentProject(),
|
|
1474
|
-
skillToggles: getSkillLoadingSettings(),
|
|
1475
|
-
theme: getThemePreference(),
|
|
1476
|
-
language: getLocale()
|
|
1477
|
-
});
|
|
1478
|
-
renderLocalSkillList();
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
function setProjectSettingsStatus(text, status = 'info') {
|
|
1482
|
-
SettingsPanel.setStatus(settingsPanelInstance, text, status);
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
function clearProjectSettingsStatus() {
|
|
1486
|
-
SettingsPanel.clearStatus(settingsPanelInstance);
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
async function refreshLocalSkills() {
|
|
1490
|
-
return localSkillsPanel.refreshLocalSkills();
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
function renderLocalSkillList() {
|
|
1494
|
-
localSkillsPanel.renderLocalSkillList();
|
|
1495
|
-
// Keep the settings-screen entry-row summary in sync with the skill list:
|
|
1496
|
-
// it reflects the enabled-skill count (or "Off" when the master is off).
|
|
1497
|
-
updateSkillsEntrySummary();
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
1234
|
function handleComposerPaste(event) {
|
|
1501
1235
|
composerAttachmentController.handlePaste(event);
|
|
1502
1236
|
}
|
|
@@ -6082,6 +5816,7 @@
|
|
|
6082
5816
|
await injectScriptOnce('src/shared/governanceRules.js', 'codex-overleaf-governance-rules-script');
|
|
6083
5817
|
await injectScriptOnce('src/shared/sensitiveScan.js', 'codex-overleaf-sensitive-scan-script');
|
|
6084
5818
|
await injectScriptOnce('src/shared/auditRecords.js', 'codex-overleaf-audit-records-script');
|
|
5819
|
+
await injectScriptOnce('src/page/saveState.js', 'codex-overleaf-save-state-script', { force: true });
|
|
6085
5820
|
await injectScriptOnce('src/page/overleafCapabilities.js', 'codex-overleaf-capabilities-script');
|
|
6086
5821
|
await injectScriptOnce('src/page/compileBridge.js', 'codex-overleaf-compile-bridge-script');
|
|
6087
5822
|
await injectScriptOnce('src/page/overleafEditor.js', 'codex-overleaf-editor-script');
|