codex-overleaf-link 1.7.7 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.7.7-blue" alt="version">
6
+ <img src="https://img.shields.io/badge/version-1.8.0-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 native host **and** sets up the extension: the script r
38
38
  macOS / Linux:
39
39
 
40
40
  ```bash
41
- CODEX_OVERLEAF_REF=v1.7.7 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.7.7/install.sh)"
41
+ CODEX_OVERLEAF_REF=v1.8.0 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.8.0/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.7.7/install.ps1 -OutFile install.ps1
48
- $env:CODEX_OVERLEAF_REF='v1.7.7'
47
+ iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.8.0/install.ps1 -OutFile install.ps1
48
+ $env:CODEX_OVERLEAF_REF='v1.8.0'
49
49
  powershell -ExecutionPolicy Bypass -File install.ps1
50
50
  ```
51
51
 
@@ -56,10 +56,10 @@ Then, in the `chrome://extensions` tab the script opened: enable **Developer mod
56
56
  `npm exec` installs and updates the **native host only** — it does not include the Chrome extension. Use it if you prefer a pinned npm package to a source checkout.
57
57
 
58
58
  ```bash
59
- npm exec --yes codex-overleaf-link@1.7.7 -- install-native
59
+ npm exec --yes codex-overleaf-link@1.8.0 -- install-native
60
60
  ```
61
61
 
62
- Then add the extension yourself: download `codex-overleaf-link-extension-v1.7.7.zip` from the [v1.7.7 GitHub Release](https://github.com/Ghqqqq/codex-overleaf-link/releases/tag/v1.7.7), unzip it to a stable folder, and in `chrome://extensions` enable **Developer mode**, click **Load unpacked**, and select that folder.
62
+ Then add the extension yourself: download `codex-overleaf-link-extension-v1.8.0.zip` from the [v1.8.0 GitHub Release](https://github.com/Ghqqqq/codex-overleaf-link/releases/tag/v1.8.0), unzip it to a stable folder, and in `chrome://extensions` enable **Developer mode**, click **Load unpacked**, and select that folder.
63
63
 
64
64
  ### Open Overleaf
65
65
 
@@ -86,9 +86,9 @@ npm installs, updates, uninstalls, and diagnoses the native host only. npm does
86
86
 
87
87
  | Action | Command |
88
88
  |--------|---------|
89
- | Install / update | `npm exec --yes codex-overleaf-link@1.7.7 -- install-native` |
90
- | Diagnose | `npm exec --yes codex-overleaf-link@1.7.7 -- doctor` |
91
- | Uninstall | `npm exec --yes codex-overleaf-link@1.7.7 -- uninstall-native` |
89
+ | Install / update | `npm exec --yes codex-overleaf-link@1.8.0 -- install-native` |
90
+ | Diagnose | `npm exec --yes codex-overleaf-link@1.8.0 -- doctor` |
91
+ | Uninstall | `npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native` |
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 @@ To update, re-run any of the [native host installers](#install) — they install
98
98
 
99
99
  ## GitHub Release Artifacts
100
100
 
101
- The v1.7.7 GitHub Release contains:
101
+ The v1.8.0 GitHub Release contains:
102
102
 
103
- - `codex-overleaf-link-extension-v1.7.7.zip`: loadable Chrome extension package for manual unpacked installation.
104
- - `codex-overleaf-native-host-v1.7.7.tar.gz`: native host runtime files used by the installer and release verification.
105
- - `codex-overleaf-link-1.7.7.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.7.7` when run directly from the release artifact.
107
- - `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.7.7` when run directly from the release artifact.
103
+ - `codex-overleaf-link-extension-v1.8.0.zip`: loadable Chrome extension package for manual unpacked installation.
104
+ - `codex-overleaf-native-host-v1.8.0.tar.gz`: native host runtime files used by the installer and release verification.
105
+ - `codex-overleaf-link-1.8.0.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.8.0` when run directly from the release artifact.
107
+ - `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.8.0` 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.7.7 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.7.7 -- uninstall-native
118
+ npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native
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.7.7 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.7.7/install.sh)" -- --browser chromium
153
+ CODEX_OVERLEAF_REF=v1.8.0 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.8.0/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.7.7 -- uninstall-native --browser chromium
159
+ npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native --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.7.7 -- install-native
294
+ npm exec --yes codex-overleaf-link@1.8.0 -- install-native
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.7.7 -- install-native` | `npm exec --yes codex-overleaf-link@1.7.7 -- install-native` | `npm exec --yes codex-overleaf-link@1.7.7 -- install-native` | `npm exec --yes codex-overleaf-link@1.7.7 -- install-native --browser chromium` |
344
- | Uninstall command | `npm exec --yes codex-overleaf-link@1.7.7 -- uninstall-native` | `npm exec --yes codex-overleaf-link@1.7.7 -- uninstall-native` | `npm exec --yes codex-overleaf-link@1.7.7 -- uninstall-native` | `npm exec --yes codex-overleaf-link@1.7.7 -- uninstall-native --browser chromium` |
343
+ | Installer/update command | `npm exec --yes codex-overleaf-link@1.8.0 -- install-native` | `npm exec --yes codex-overleaf-link@1.8.0 -- install-native` | `npm exec --yes codex-overleaf-link@1.8.0 -- install-native` | `npm exec --yes codex-overleaf-link@1.8.0 -- install-native --browser chromium` |
344
+ | Uninstall command | `npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native` | `npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native` | `npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native` | `npm exec --yes codex-overleaf-link@1.8.0 -- uninstall-native --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. |
@@ -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 = '1.7.7';
15
+ const BUILD_TARGET_VERSION = '1.8.0';
16
16
  const DEFAULT_CHROME_EXTENSION_ID = 'illdpneeeopfffmiepaejglgmhpmdhdc';
17
17
  const REQUIRED_CAPABILITIES = Object.freeze([
18
18
  'bridgePing',
@@ -290,6 +290,10 @@
290
290
  runTurnNavLabel: 'Jump to a turn\u2026',
291
291
  historyTitle: 'Change history',
292
292
  historyHelp: 'What Codex wrote to this project, per run. Filter by file name or task text.',
293
+ runSearchPlaceholder: 'Search this session\u2019s runs\u2026',
294
+ undoFileSelectTitle: 'Undo which files?',
295
+ undoFileSelectConfirm: 'Undo selected',
296
+ undoFileSelectAll: 'Select all',
293
297
  privacyTitle: 'Privacy',
294
298
  governanceBroadReadonlyWarning: '"{pattern}" matches every file — Codex will not be able to write anything. Saved; narrow it if unintended.',
295
299
  governanceWritableAllowlistNote: 'Writable allowlist active — files outside these patterns cannot be written.',
@@ -748,6 +752,10 @@
748
752
  runTurnNavLabel: '跳到某一轮…',
749
753
  historyTitle: '变更历史',
750
754
  historyHelp: 'Codex 每一轮写入本项目的记录。可按文件名或任务内容过滤。',
755
+ runSearchPlaceholder: '搜索本会话的轮次…',
756
+ undoFileSelectTitle: '撤销哪些文件?',
757
+ undoFileSelectConfirm: '撤销所选',
758
+ undoFileSelectAll: '全选',
751
759
  privacyTitle: '隐私',
752
760
  governanceBroadReadonlyWarning: '「{pattern}」匹配所有文件——Codex 将无法写入任何内容。已保存;若非有意请收窄范围。',
753
761
  governanceWritableAllowlistNote: '已设置可写白名单——白名单之外的文件都不可写。',
@@ -130,6 +130,7 @@
130
130
  state.task = typeof state.task === 'string' ? state.task : '';
131
131
  state.model = typeof state.model === 'string' && state.model ? state.model : DEFAULT_PANEL_STATE.model;
132
132
  state.customInstructionsByProject = normalizeCustomInstructionsByProject(state.customInstructionsByProject);
133
+ state.composerAttachments = normalizeComposerAttachmentsForPersistence(state.composerAttachments);
133
134
  const localizedOptions = { ...options, locale: state.locale };
134
135
  state.runs = normalizeRuns(state.runs, localizedOptions);
135
136
  state.sessions = normalizeSessions(state, input, localizedOptions);
@@ -722,6 +723,31 @@
722
723
  .slice(-MAX_RUN_EVENTS);
723
724
  }
724
725
 
726
+ // v1.8.0 C4: composer attachments that survive a page refresh. Hard caps
727
+ // keep chrome.storage and every debounced saveState cheap: 3 attachments,
728
+ // 1MB of base64 each.
729
+ function normalizeComposerAttachmentsForPersistence(attachments) {
730
+ const MAX_COUNT = 3;
731
+ const MAX_CONTENT_CHARS = 1024 * 1024;
732
+ return (Array.isArray(attachments) ? attachments : [])
733
+ .filter(item => item && typeof item === 'object'
734
+ && normalizeAttachmentName(item.name)
735
+ && typeof item.contentBase64 === 'string'
736
+ && item.contentBase64.length > 0
737
+ && item.contentBase64.length <= MAX_CONTENT_CHARS)
738
+ .slice(0, MAX_COUNT)
739
+ .map(item => ({
740
+ id: normalizeTextField(item.id, 80),
741
+ name: normalizeAttachmentName(item.name),
742
+ mimeType: normalizeTextField(item.mimeType, 120),
743
+ size: Number(item.size) || 0,
744
+ kind: item.kind === 'image' ? 'image' : 'file',
745
+ previewDataUrl: typeof item.previewDataUrl === 'string' ? item.previewDataUrl : '',
746
+ contentBase64: item.contentBase64,
747
+ dedupeKey: normalizeTextField(item.dedupeKey, 200)
748
+ }));
749
+ }
750
+
725
751
  function normalizeRunAttachments(attachments, limits = STORAGE_DEFAULT_LIMITS) {
726
752
  const normalized = [];
727
753
  for (const attachment of Array.isArray(attachments) ? attachments : []) {
@@ -909,6 +935,7 @@
909
935
  // stripped here — so the gate silently died after any reload until the
910
936
  // Skills page was reopened.
911
937
  codexOverleafSkills: compactCodexOverleafSkillsForStorage(source.codexOverleafSkills),
938
+ composerAttachments: normalizeComposerAttachmentsForPersistence(source.composerAttachments),
912
939
  mode: VALID_MODES.has(active?.mode) ? active.mode : normalizeMode(source.mode),
913
940
  model: normalizeTextField(active?.model || source.model || DEFAULT_PANEL_STATE.model, 80),
914
941
  reasoningEffort: VALID_REASONING.has(active?.reasoningEffort)
@@ -771,6 +771,61 @@ async function applyFileOverlays({ projectId, overlays, rootDir }) {
771
771
  });
772
772
  }
773
773
 
774
+ // v1.8.0: after a VERIFIED writeback, the workspace already holds the exact
775
+ // content that landed in Overleaf (the writeback reads from this workspace).
776
+ // Instead of re-downloading the whole project only to rewrite what we just
777
+ // uploaded, re-hash the written workspace files in place and refresh the
778
+ // baseline freshness metadata. Any doubt -> ok:false, and the caller falls
779
+ // back to a full syncOverleafToMirror.
780
+ async function confirmWritebackFiles({ projectId, paths, rootDir }) {
781
+ const mirror = getProjectMirror(projectId, { rootDir });
782
+ const baseline = readBaseline(mirror.baselinePath);
783
+ if (!baseline.lastFullSyncAt) {
784
+ return { ok: false, reason: 'no_baseline' };
785
+ }
786
+ if (baseline.dirty === true) {
787
+ return { ok: false, reason: 'dirty_mirror' };
788
+ }
789
+ const filesByPath = new Map((baseline.files || []).map(file => [file.path, file]));
790
+ const confirmed = [];
791
+ for (const rawPath of Array.isArray(paths) ? paths : []) {
792
+ const normalizedPath = normalizeRelativePath(rawPath);
793
+ const baselineFile = filesByPath.get(normalizedPath);
794
+ if (!baselineFile) {
795
+ return { ok: false, reason: 'missing_baseline_file', path: normalizedPath };
796
+ }
797
+ if (baselineFile.kind !== 'text') {
798
+ return { ok: false, reason: 'not_text', path: normalizedPath };
799
+ }
800
+ let target;
801
+ try {
802
+ target = resolveWorkspacePath(mirror.workspacePath, normalizedPath);
803
+ } catch (error) {
804
+ return { ok: false, reason: 'unsafe_path', path: normalizedPath };
805
+ }
806
+ let content;
807
+ try {
808
+ content = fs.readFileSync(target, 'utf8');
809
+ } catch (error) {
810
+ return { ok: false, reason: 'workspace_read_failed', path: normalizedPath };
811
+ }
812
+ const hash = hashText(content);
813
+ filesByPath.set(normalizedPath, { ...baselineFile, hash, content });
814
+ confirmed.push({ path: normalizedPath, hash });
815
+ }
816
+ if (!confirmed.length) {
817
+ return { ok: false, reason: 'no_paths' };
818
+ }
819
+ const now = new Date().toISOString();
820
+ writeBaseline(mirror.baselinePath, {
821
+ ...baseline,
822
+ lastFullSyncAt: now,
823
+ lastSyncSource: 'writeback-confirm',
824
+ files: Array.from(filesByPath.values())
825
+ });
826
+ return { ok: true, confirmed, lastFullSyncAt: now };
827
+ }
828
+
774
829
  async function patchMirrorFiles({ projectId, files, rootDir, source = 'ot' }) {
775
830
  const mirror = getProjectMirror(projectId, { rootDir });
776
831
  const baseline = readBaseline(mirror.baselinePath);
@@ -1013,6 +1068,7 @@ module.exports = {
1013
1068
  SAFE_INLINE_BINARY_CHANGE_BYTES,
1014
1069
  SAFE_NATIVE_RESPONSE_PAYLOAD_BYTES,
1015
1070
  applyFileOverlays,
1071
+ confirmWritebackFiles,
1016
1072
  collectMirrorChangesDetailed,
1017
1073
  collectMirrorChanges,
1018
1074
  getDefaultMirrorRoot,
@@ -26,6 +26,8 @@ function validateNativeRequestQuotas(request = {}) {
26
26
  ]);
27
27
  case 'mirror.sync':
28
28
  return validateProjectSnapshotQuota(params.project);
29
+ case 'mirror.confirmWriteback':
30
+ return validateOperationListQuota(params.paths, 'paths');
29
31
  case 'mirror.patchFiles':
30
32
  return firstQuotaViolation([
31
33
  validateOperationListQuota(params.files, 'files'),
@@ -65,6 +65,10 @@ async function handleRequest(request, env = process.env, emit = () => {}) {
65
65
  return handleMirrorPatchFiles(request, env);
66
66
  }
67
67
 
68
+ if (request.method === 'mirror.confirmWriteback') {
69
+ return handleMirrorConfirmWriteback(request, env);
70
+ }
71
+
68
72
  if (request.method === 'mirror.status') {
69
73
  return handleMirrorStatus(request, env);
70
74
  }
@@ -551,6 +555,32 @@ async function handleMirrorPatchFiles(request, env) {
551
555
  }
552
556
  }
553
557
 
558
+ async function handleMirrorConfirmWriteback(request, env) {
559
+ const { confirmWritebackFiles } = require('./mirrorWorkspace');
560
+ const params = request.params || {};
561
+ const projectId = params.projectId || 'unknown';
562
+ const projectKey = resolveProjectKey(params);
563
+ const rootDir = env.CODEX_OVERLEAF_MIRROR_ROOT;
564
+
565
+ const lockToken = acquireProjectLock(projectKey);
566
+ if (!lockToken) {
567
+ return errorResponse(request.id, 'project_locked', `Project ${projectKey} is currently in use by codex.run`);
568
+ }
569
+
570
+ try {
571
+ const result = await confirmWritebackFiles({
572
+ projectId,
573
+ paths: params.paths,
574
+ rootDir
575
+ });
576
+ return okResponse(request.id, result);
577
+ } catch (error) {
578
+ return errorResponse(request.id, 'mirror_confirm_writeback_failed', error.message);
579
+ } finally {
580
+ releaseProjectLock(projectKey, lockToken);
581
+ }
582
+ }
583
+
554
584
  function handleMirrorStatus(request, env) {
555
585
  const { getMirrorStatus } = require('./mirrorWorkspace');
556
586
  const params = request.params || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-overleaf-link",
3
- "version": "1.7.7",
3
+ "version": "1.8.0",
4
4
  "description": "Cross-platform Chrome bridge that connects Codex to the active Overleaf project.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",