codex-overleaf-link 1.9.5 → 1.9.6

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.9.5-blue" alt="version">
6
+ <img src="https://img.shields.io/badge/version-1.9.6-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.5 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.5/install.sh)"
41
+ CODEX_OVERLEAF_REF=v1.9.6 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.6/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.5/install.ps1 -OutFile install.ps1
48
- $env:CODEX_OVERLEAF_REF='v1.9.5'
47
+ iwr https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.6/install.ps1 -OutFile install.ps1
48
+ $env:CODEX_OVERLEAF_REF='v1.9.6'
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.5 -- install-managed
59
+ npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 -- install-managed` |
90
- | Diagnose | `npm exec --yes codex-overleaf-link@1.9.5 -- doctor` |
91
- | Uninstall | `npm exec --yes codex-overleaf-link@1.9.5 -- uninstall-managed` |
89
+ | Install / update | `npm exec --yes codex-overleaf-link@1.9.6 -- install-managed` |
90
+ | Diagnose | `npm exec --yes codex-overleaf-link@1.9.6 -- doctor` |
91
+ | Uninstall | `npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 GitHub Release contains:
101
+ The v1.9.6 GitHub Release contains:
102
102
 
103
- - `codex-overleaf-link-extension-v1.9.5.zip`: loadable Chrome extension package for manual unpacked installation.
104
- - `codex-overleaf-native-host-v1.9.5.tar.gz`: native host runtime files used by the installer and release verification.
105
- - `codex-overleaf-link-1.9.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 `v1.9.5` when run directly from the release artifact.
107
- - `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.9.5` when run directly from the release artifact.
103
+ - `codex-overleaf-link-extension-v1.9.6.zip`: loadable Chrome extension package for manual unpacked installation.
104
+ - `codex-overleaf-native-host-v1.9.6.tar.gz`: native host runtime files used by the installer and release verification.
105
+ - `codex-overleaf-link-1.9.6.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.6` when run directly from the release artifact.
107
+ - `install.ps1`: release-pinned Windows PowerShell installer that defaults to `v1.9.6` 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.5 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.5 -- uninstall-managed
118
+ npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.5/install.sh)" -- --browser chromium
153
+ CODEX_OVERLEAF_REF=v1.9.6 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ghqqqq/codex-overleaf-link/v1.9.6/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.5 -- uninstall-managed --browser chromium
159
+ npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 -- install-managed
294
+ npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.5 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.5 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.5 -- install-managed --browser chromium` |
344
- | Uninstall command | `npm exec --yes codex-overleaf-link@1.9.5 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.5 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.5 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.5 -- uninstall-managed --browser chromium` |
343
+ | Installer/update command | `npm exec --yes codex-overleaf-link@1.9.6 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.6 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.6 -- install-managed` | `npm exec --yes codex-overleaf-link@1.9.6 -- install-managed --browser chromium` |
344
+ | Uninstall command | `npm exec --yes codex-overleaf-link@1.9.6 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.6 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.6 -- uninstall-managed` | `npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 -- install-managed
380
+ npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 -- install-native
390
+ npm exec --yes codex-overleaf-link@1.9.6 -- 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.5 -- uninstall-native
396
+ npm exec --yes codex-overleaf-link@1.9.6 -- uninstall-native
397
397
  ```
@@ -24,6 +24,10 @@ try {
24
24
  runtimeLoadError = error;
25
25
  }
26
26
 
27
+ globalThis.CodexOverleafManagedUpdateExecutor = Object.freeze({
28
+ installAuthorizedUpdate: () => checkAndStage({ manual: true })
29
+ });
30
+
27
31
  chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
28
32
  if (message?.type === 'codex-overleaf/update-get-state') {
29
33
  getUpdateState().then(sendResponse);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Codex Overleaf Link",
4
- "version": "1.9.5",
4
+ "version": "1.9.6",
5
5
  "description": "Connect the active Overleaf project to a local Codex bridge.",
6
6
  "icons": {
7
7
  "16": "assets/icons/icon16.png",
@@ -1,26 +1,176 @@
1
+ :root {
2
+ color-scheme: dark;
3
+ --popup-bg: #151816;
4
+ --popup-surface: #1d211f;
5
+ --popup-surface-raised: #222724;
6
+ --popup-border: #303733;
7
+ --popup-border-strong: #3d4842;
8
+ --popup-text: #edf1ee;
9
+ --popup-muted: #9da6a0;
10
+ --popup-green: #82d596;
11
+ --popup-blue: #62a8e8;
12
+ --popup-danger: #e27b72;
13
+ }
14
+
15
+ html {
16
+ margin: 0;
17
+ overflow: hidden;
18
+ background: var(--popup-bg);
19
+ }
20
+
21
+ * { box-sizing: border-box; }
22
+
1
23
  body {
2
- width: 328px;
24
+ width: 340px;
3
25
  margin: 0;
4
- padding: 16px;
5
- color: #e8ecef;
6
- background: #171918;
26
+ padding: 18px;
27
+ color: var(--popup-text);
28
+ background:
29
+ radial-gradient(circle at 88% -20%, rgba(98, 168, 232, 0.1), transparent 42%),
30
+ var(--popup-bg);
7
31
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
32
+ animation: popup-enter 160ms ease-out both;
8
33
  }
9
- h1 { margin: 0 0 12px; font-size: 16px; }
34
+
35
+ h1 {
36
+ margin: 0 0 12px;
37
+ font-size: 16px;
38
+ font-weight: 720;
39
+ letter-spacing: -0.025em;
40
+ }
41
+
10
42
  p { margin: 8px 0 0; }
11
- .version-status, .section-head, .update-actions { display: flex; align-items: center; gap: 8px; }
12
- .version-status { margin-bottom: 12px; color: #a8aeaa; font-size: 12px; }
43
+
44
+ .version-status,
45
+ .section-head,
46
+ .update-actions {
47
+ display: flex;
48
+ align-items: center;
49
+ gap: 8px;
50
+ }
51
+
52
+ .version-status {
53
+ margin-bottom: 12px;
54
+ color: var(--popup-muted);
55
+ font-size: 12px;
56
+ }
57
+
13
58
  .section-head { justify-content: space-between; }
14
- .status-icon { display: inline-flex; min-width: 24px; min-height: 24px; align-items: center; justify-content: center; border-radius: 999px; color: #fff; font: 10px/1 ui-monospace, monospace; }
15
- .status-icon.compatible { background: #397d50; }
16
- .status-icon.update-available { background: #9b6a26; }
17
- .status-icon.incompatible { background: #a84038; }
18
- button { width: 100%; border: 1px solid #5b8fc9; background: #2f6eae; color: #fff; border-radius: 7px; padding: 8px 10px; cursor: pointer; }
19
- button.secondary { margin-top: 8px; border-color: #3c4440; background: #242826; color: #dce1de; }
20
- button.quiet { margin-top: 8px; border-color: transparent; background: transparent; color: #b8bfba; }
21
- .updates, .install { margin-top: 14px; padding: 11px; border: 1px solid #303532; border-radius: 9px; background: #1d201e; }
22
- .install[hidden], button[hidden] { display: none; }
23
- .update-state { color: #83cf96; font-size: 11px; text-transform: capitalize; }
24
- .muted { color: #939a96; font-size: 12px; }
59
+
60
+ .status-icon {
61
+ display: inline-flex;
62
+ width: 10px;
63
+ min-width: 10px;
64
+ height: 10px;
65
+ min-height: 10px;
66
+ overflow: hidden;
67
+ align-items: center;
68
+ justify-content: center;
69
+ border-radius: 999px;
70
+ color: transparent;
71
+ font-size: 0;
72
+ box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.035);
73
+ }
74
+
75
+ .status-icon.compatible { background: var(--popup-green); }
76
+ .status-icon.update-available { background: #d5b46e; }
77
+ .status-icon.incompatible { background: var(--popup-danger); }
78
+
79
+ button {
80
+ width: 100%;
81
+ border: 1px solid #4d88c0;
82
+ border-radius: 8px;
83
+ padding: 8px 11px;
84
+ color: #f7fbff;
85
+ background: #2f70ad;
86
+ font: inherit;
87
+ font-weight: 650;
88
+ cursor: pointer;
89
+ transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
90
+ }
91
+
92
+ button:hover:not(:disabled) {
93
+ border-color: #6aa7df;
94
+ background: #397dbb;
95
+ }
96
+
97
+ button:active:not(:disabled) { transform: translateY(1px); }
98
+ button:disabled { cursor: default; opacity: 0.62; }
99
+
100
+ button.secondary {
101
+ margin-top: 8px;
102
+ border-color: var(--popup-border-strong);
103
+ color: #e2e8e4;
104
+ background: #222724;
105
+ }
106
+
107
+ button.quiet {
108
+ margin-top: 8px;
109
+ border-color: transparent;
110
+ color: #b8c0bb;
111
+ background: transparent;
112
+ }
113
+
114
+ .updates {
115
+ margin-top: 16px;
116
+ padding: 13px 0 0;
117
+ border: 0;
118
+ border-top: 1px solid var(--popup-border);
119
+ border-radius: 0;
120
+ background: transparent;
121
+ }
122
+
123
+ .install {
124
+ margin-top: 14px;
125
+ padding: 12px;
126
+ border: 1px solid var(--popup-border);
127
+ border-radius: 10px;
128
+ background: var(--popup-surface);
129
+ }
130
+
131
+ .install[hidden],
132
+ button[hidden] { display: none; }
133
+
134
+ .update-state {
135
+ color: var(--popup-green);
136
+ font-size: 11px;
137
+ text-transform: capitalize;
138
+ }
139
+
140
+ .muted {
141
+ color: var(--popup-muted);
142
+ font-size: 12px;
143
+ }
144
+
25
145
  .update-actions > button { flex: 1; }
26
- code { display: block; margin-top: 8px; padding: 8px; overflow: auto; border-radius: 6px; background: #111312; color: #dce1de; white-space: pre-wrap; word-break: break-word; font: 11px/1.45 ui-monospace, monospace; }
146
+
147
+ code {
148
+ display: block;
149
+ margin-top: 8px;
150
+ padding: 8px;
151
+ overflow: auto;
152
+ border-radius: 6px;
153
+ color: #dce3df;
154
+ background: #101311;
155
+ white-space: pre-wrap;
156
+ word-break: break-word;
157
+ font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
158
+ }
159
+
160
+ body.consent-update-focus {
161
+ min-height: 340px;
162
+ padding: 20px;
163
+ }
164
+
165
+ body.consent-update-focus > [data-popup-context] { display: none !important; }
166
+ body.consent-update-focus > .popup-brand { margin-bottom: 18px; }
167
+
168
+ @keyframes popup-enter {
169
+ from { opacity: 0; }
170
+ to { opacity: 1; }
171
+ }
172
+
173
+ @media (prefers-reduced-motion: reduce) {
174
+ body { animation: none; }
175
+ button { transition: none; }
176
+ }
@@ -6,13 +6,13 @@
6
6
  <link rel="stylesheet" href="popup.css">
7
7
  </head>
8
8
  <body>
9
- <h1>Codex Overleaf Link</h1>
10
- <div class="version-status">
9
+ <h1 class="popup-brand">Codex Overleaf Link</h1>
10
+ <div class="version-status" data-popup-context>
11
11
  <span id="compat-status-icon" class="status-icon incompatible" title="Native host incompatible">X</span>
12
12
  <span id="version-pair">Extension unknown / Native unknown</span>
13
13
  </div>
14
- <button id="open-panel">Open panel in Overleaf</button>
15
- <p id="status">Use this on an Overleaf project tab.</p>
14
+ <button id="open-panel" data-popup-context>Open panel in Overleaf</button>
15
+ <p id="status" data-popup-context>Use this on an Overleaf project tab.</p>
16
16
  <section class="updates" aria-labelledby="updates-title">
17
17
  <div class="section-head">
18
18
  <strong id="updates-title">Stable updates</strong>
@@ -25,7 +25,7 @@
25
25
  <button id="postpone-update" class="quiet" type="button" hidden>Later</button>
26
26
  </div>
27
27
  </section>
28
- <div id="native-install" class="install" hidden>
28
+ <div id="native-install" class="install" data-popup-context hidden>
29
29
  <strong>Native host attention required</strong>
30
30
  <p>Run this command in Terminal, then reload this extension in Chrome.</p>
31
31
  <code id="install-command"></code>
@@ -7,6 +7,7 @@
7
7
  const CHECK_INTERVAL_MINUTES = 24 * 60;
8
8
  const SNOOZE_MS = 24 * 60 * 60 * 1000;
9
9
  const CANDIDATE_MAX_AGE_MS = 5 * 60 * 1000;
10
+ const CHECK_REQUEST_TIMEOUT_MS = 15 * 1000;
10
11
  const LEGACY_GUARD = Number.MAX_SAFE_INTEGER;
11
12
  const OVERLEAF_MATCHES = [
12
13
  'https://www.overleaf.com/project/*',
@@ -16,7 +17,8 @@
16
17
  'codex-overleaf/consent-update-get-state',
17
18
  'codex-overleaf/consent-update-check',
18
19
  'codex-overleaf/consent-update-install',
19
- 'codex-overleaf/consent-update-later'
20
+ 'codex-overleaf/consent-update-later',
21
+ 'codex-overleaf/consent-update-dismiss'
20
22
  ]);
21
23
 
22
24
  const policy = root.CodexOverleafUpdateConsent;
@@ -60,6 +62,7 @@
60
62
  delayInMinutes: 0.5,
61
63
  periodInMinutes: CHECK_INTERVAL_MINUTES
62
64
  });
65
+ await recoverInterruptedCheck();
63
66
  await settleTerminalConsent();
64
67
  await armLegacyGuard();
65
68
  await publishView();
@@ -75,6 +78,8 @@
75
78
  return installUpdate();
76
79
  case 'codex-overleaf/consent-update-later':
77
80
  return postponeUpdate();
81
+ case 'codex-overleaf/consent-update-dismiss':
82
+ return dismissCompletedUpdate();
78
83
  default:
79
84
  throw codedError('unknown_update_action', 'Unknown update action.');
80
85
  }
@@ -95,10 +100,14 @@
95
100
  });
96
101
 
97
102
  try {
98
- const result = await requestNative('update.check', {
99
- currentVersion: currentVersion(),
100
- etag: currentState.etag || ''
101
- });
103
+ const result = await withTimeout(
104
+ requestNative('update.check', {
105
+ currentVersion: currentVersion(),
106
+ etag: currentState.etag || ''
107
+ }),
108
+ CHECK_REQUEST_TIMEOUT_MS,
109
+ codedError('update_check_timeout', 'The managed update check did not complete in time.')
110
+ );
102
111
  const checkedAt = Date.now();
103
112
  if (result.available) {
104
113
  const nextConsent = result.latestVersion !== consent.snoozedVersion
@@ -158,6 +167,41 @@
158
167
  }
159
168
  }
160
169
 
170
+ async function recoverInterruptedCheck() {
171
+ const state = await getUpdateState();
172
+ if (state.state !== 'checking') return;
173
+ const nextState = policy.compareStableVersions(state.latestVersion, currentVersion()) > 0
174
+ ? 'update_available'
175
+ : 'idle';
176
+ await setUpdateState({
177
+ ...state,
178
+ state: nextState,
179
+ blocker: '',
180
+ blockers: [],
181
+ code: '',
182
+ message: ''
183
+ });
184
+ }
185
+
186
+ async function dismissCompletedUpdate() {
187
+ const state = await getUpdateState();
188
+ if (state.state !== 'committed') return getView();
189
+ const version = state.latestVersion || state.currentVersion || currentVersion();
190
+ await setUpdateState({
191
+ ...state,
192
+ state: 'idle',
193
+ currentVersion: version,
194
+ latestVersion: version,
195
+ transactionId: '',
196
+ stagedAt: 0,
197
+ blocker: '',
198
+ blockers: [],
199
+ code: '',
200
+ message: ''
201
+ });
202
+ return getView();
203
+ }
204
+
161
205
  async function installUpdate() {
162
206
  let state = await getUpdateState();
163
207
  let consent = await getConsentState();
@@ -189,10 +233,11 @@
189
233
  await setUpdateState({ ...state, postponeUntil: 0, code: '', message: '' });
190
234
 
191
235
  try {
192
- const result = await chrome.runtime.sendMessage({ type: 'codex-overleaf/update-check-now' });
193
- if (result === undefined) {
236
+ const executor = root.CodexOverleafManagedUpdateExecutor;
237
+ if (typeof executor?.installAuthorizedUpdate !== 'function') {
194
238
  throw codedError('update_executor_unavailable', 'The managed update executor is unavailable.');
195
239
  }
240
+ await executor.installAuthorizedUpdate();
196
241
  return getView();
197
242
  } catch (error) {
198
243
  await bestEffortRevoke({
@@ -393,6 +438,22 @@
393
438
  return error;
394
439
  }
395
440
 
441
+ function withTimeout(promise, timeoutMs, timeoutError) {
442
+ return new Promise((resolve, reject) => {
443
+ const timer = setTimeout(() => reject(timeoutError), timeoutMs);
444
+ Promise.resolve(promise).then(
445
+ value => {
446
+ clearTimeout(timer);
447
+ resolve(value);
448
+ },
449
+ error => {
450
+ clearTimeout(timer);
451
+ reject(error);
452
+ }
453
+ );
454
+ });
455
+ }
456
+
396
457
  function safeError(error) {
397
458
  return { code: safeCode(error), message: safeMessage(error) };
398
459
  }
@@ -309,6 +309,7 @@
309
309
  check: 'codex-overleaf/consent-update-check',
310
310
  install: 'codex-overleaf/consent-update-install',
311
311
  later: 'codex-overleaf/consent-update-later',
312
+ dismiss: 'codex-overleaf/consent-update-dismiss',
312
313
  retry: 'codex-overleaf/consent-update-check'
313
314
  }[action];
314
315
  const response = await chrome.runtime.sendMessage({ type });
@@ -339,8 +340,19 @@
339
340
  const state = view?.state || { state: 'idle' };
340
341
  const progress = view?.progress || { value: 0, determinate: true, phase: 'idle' };
341
342
  const copy = getUpdateCopy(state, view);
343
+ const stateName = state.state || 'idle';
344
+ const focusMode = Boolean(
345
+ options.busyAction === 'install' ||
346
+ view.execution ||
347
+ ['committed', 'rolled_back', 'failed'].includes(stateName)
348
+ );
349
+ section.classList.toggle('is-quiet', stateName === 'idle');
350
+ section.classList.toggle('is-offer', stateName === 'update_available');
351
+ section.classList.toggle('is-focus', focusMode);
352
+ section.classList.toggle('is-result', ['committed', 'rolled_back', 'failed'].includes(stateName));
353
+ document.body.classList.toggle('consent-update-focus', focusMode);
342
354
  const card = document.createElement('div');
343
- card.className = 'consent-update-card state-' + (state.state || 'idle');
355
+ card.className = 'consent-update-card state-' + stateName;
344
356
 
345
357
  const head = document.createElement('div');
346
358
  head.className = 'consent-update-head';
@@ -350,6 +362,14 @@
350
362
  version.textContent = copy.version;
351
363
  head.append(title, version);
352
364
 
365
+ const route = document.createElement('div');
366
+ route.className = 'consent-update-route';
367
+ const currentVersion = state.currentVersion ? 'v' + state.currentVersion : '';
368
+ const latestVersion = state.latestVersion ? 'v' + state.latestVersion : '';
369
+ route.textContent = currentVersion && latestVersion && currentVersion !== latestVersion
370
+ ? currentVersion + ' → ' + latestVersion
371
+ : latestVersion || currentVersion;
372
+
353
373
  const detail = document.createElement('p');
354
374
  detail.className = 'consent-update-detail';
355
375
  detail.textContent = copy.detail;
@@ -369,6 +389,9 @@
369
389
  const phase = document.createElement('div');
370
390
  phase.className = 'consent-update-phase';
371
391
  phase.textContent = copy.phase;
392
+ const showPhaseText = Boolean(copy.phase && copy.phase !== copy.detail);
393
+ const steps = createUpdateSteps(stateName);
394
+ const footnote = createUpdateFootnote(stateName);
372
395
 
373
396
  const actions = document.createElement('div');
374
397
  actions.className = 'consent-update-actions';
@@ -387,10 +410,15 @@
387
410
  live.setAttribute('aria-live', 'polite');
388
411
  live.textContent = ['committed', 'rolled_back', 'failed'].includes(state.state) ? copy.phase : '';
389
412
 
390
- card.append(head, detail);
413
+ card.append(head);
414
+ if ((focusMode || stateName === 'update_available') && route.textContent) card.append(route);
415
+ card.append(detail);
391
416
  if (!['idle', 'update_available'].includes(state.state) || options.busyAction === 'check') {
392
- card.append(progressEl, phase);
417
+ card.append(progressEl);
418
+ if (showPhaseText) card.append(phase);
393
419
  }
420
+ if (steps) card.append(steps);
421
+ if (footnote) card.append(footnote);
394
422
  card.append(actions, live);
395
423
  if (state.state === 'failed' && (state.code || state.message)) {
396
424
  const details = document.createElement('details');
@@ -407,6 +435,57 @@
407
435
  }
408
436
  }
409
437
 
438
+ function createUpdateSteps(state) {
439
+ const activeIndex = {
440
+ downloading: 0,
441
+ staged: 1,
442
+ waiting_for_idle: 1,
443
+ applying: 2,
444
+ awaiting_health: 2,
445
+ committed: 3,
446
+ rolled_back: 2
447
+ }[state];
448
+ if (!Number.isInteger(activeIndex)) return null;
449
+ const labels = [
450
+ utx('Download and verify', '下载并验证'),
451
+ utx('Wait for a safe point', '等待安全时机'),
452
+ utx('Restart and health check', '重启并健康检查')
453
+ ];
454
+ const list = document.createElement('ol');
455
+ list.className = 'consent-update-steps';
456
+ labels.forEach((label, index) => {
457
+ const item = document.createElement('li');
458
+ const status = state === 'committed'
459
+ ? 'done'
460
+ : state === 'rolled_back' && index === 2
461
+ ? 'error'
462
+ : index < activeIndex
463
+ ? 'done'
464
+ : index === activeIndex
465
+ ? 'active'
466
+ : 'pending';
467
+ item.className = 'is-' + status;
468
+ const marker = document.createElement('span');
469
+ marker.className = 'consent-update-step-marker';
470
+ marker.textContent = String(index + 1);
471
+ const text = document.createElement('span');
472
+ text.textContent = label;
473
+ item.append(marker, text);
474
+ list.append(item);
475
+ });
476
+ return list;
477
+ }
478
+
479
+ function createUpdateFootnote(state) {
480
+ if (!['downloading', 'staged', 'waiting_for_idle', 'applying', 'awaiting_health'].includes(state)) return null;
481
+ const note = document.createElement('p');
482
+ note.className = 'consent-update-footnote';
483
+ note.textContent = ['applying', 'awaiting_health'].includes(state)
484
+ ? utx('This popup may close briefly while the extension restarts.', '扩展重启时此窗口可能会短暂关闭。')
485
+ : utx('You can close this popup. The update continues in the background.', '可以关闭此窗口,更新会在后台继续。');
486
+ return note;
487
+ }
488
+
410
489
  function getVisibleActions(view = {}, busyAction = '') {
411
490
  const state = view.state?.state || 'idle';
412
491
  if (busyAction) {
@@ -422,6 +501,9 @@
422
501
  return [{ id: 'later', label: utx('Later', '稍后提醒'), primary: false }];
423
502
  }
424
503
  if (['downloading', 'applying', 'awaiting_health', 'checking'].includes(state)) return [];
504
+ if (state === 'committed') {
505
+ return [{ id: 'dismiss', label: utx('Done', '完成'), primary: true }];
506
+ }
425
507
  if (['failed', 'rolled_back'].includes(state)) {
426
508
  return [{ id: 'retry', label: utx('Retry', '重试'), primary: true }];
427
509
  }
@@ -434,6 +516,7 @@
434
516
  retry: utx('Checking...', '正在检查...'),
435
517
  install: utx('Starting update...', '正在启动更新...'),
436
518
  later: utx('Saving...', '正在保存...')
519
+ , dismiss: utx('Closing...', '正在关闭...')
437
520
  }[action] || utx('Working...', '处理中...');
438
521
  }
439
522
 
@@ -442,7 +525,7 @@
442
525
  const latest = state.latestVersion ? 'v' + state.latestVersion : '';
443
526
  const blocker = formatBlocker(state.blocker);
444
527
  const map = {
445
- idle: [utx('Stable updates', '稳定版更新'), utx('Up to date', '已是最新版'), utx('Automatically checks signed stable releases.', '自动检查经过签名验证的稳定版本。')],
528
+ idle: [utx('Updates', '更新'), utx('Up to date', '已是最新版'), utx('Signed stable channel.', '签名稳定版通道。')],
446
529
  checking: [utx('Checking for updates', '正在检查更新'), '', utx('Checking the latest signed stable release', '正在检查最新签名稳定版本')],
447
530
  update_available: [utx('Update available', '发现新版本'), latest, view.snoozed ? utx('Reminder paused. Update remains ready here.', '提醒已暂停,仍可随时从这里更新。') : utx('Signed stable update for the extension and Native Host.', '扩展与 Native Host 的签名稳定更新。')],
448
531
  downloading: [utx('Downloading update', '正在下载更新'), latest, utx('Downloading and verifying the coordinated update', '正在下载并验证协调更新')],
@@ -450,7 +533,7 @@
450
533
  waiting_for_idle: [utx('Waiting for a safe point', '正在等待安全时机'), latest, blocker],
451
534
  applying: [utx('Installing update', '正在安装更新'), latest, utx('Installing extension and Native Host', '正在安装扩展与 Native Host')],
452
535
  awaiting_health: [utx('Checking updated components', '正在检查更新后的组件'), latest, utx('Restarting and checking both components', '正在重启并检查两个组件')],
453
- committed: [utx('Update complete', '更新完成'), latest || current, utx('Extension and Native Host were updated together.', '扩展与 Native Host 已同步更新。')],
536
+ committed: [utx('Update complete', '更新完成'), latest || current, utx('Extension and Native Host are healthy.', '扩展与 Native Host 均运行正常。')],
454
537
  rolled_back: [utx('Previous version restored', '已恢复上一版本'), current, utx('Health check failed, so the previous coordinated pair was restored.', '健康检查失败,已恢复上一组协调版本。')],
455
538
  failed: [utx('Update could not continue', '更新无法继续'), latest, state.message || utx('Check the details and retry.', '请查看详情后重试。')]
456
539
  };
@@ -482,6 +565,7 @@
482
565
  const style = document.createElement('style');
483
566
  style.id = 'codex-overleaf-consent-update-styles';
484
567
  style.textContent = [
568
+ 'html { overflow:hidden; background:#171918; }',
485
569
  'body { width:344px; padding:16px; background:#171918; color:#eceeec; font-family:"Avenir Next","Segoe UI",sans-serif; }',
486
570
  'h1 { font-size:16px; letter-spacing:-.01em; }',
487
571
  '.version-status { color:#a8ada9; }',
@@ -504,6 +588,31 @@
504
588
  '.consent-update-actions button:focus-visible { outline:2px solid #79b8f2; outline-offset:2px; }',
505
589
  '.consent-update-live { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }',
506
590
  '.consent-update-card details { margin-top:10px; color:#a9aea9; font-size:11px; } .consent-update-card details code { background:#202320; color:#c9ceca; }',
591
+ 'body .consent-updates { margin-top:16px; padding:13px 0 0; border:0; border-top:1px solid #303733; border-radius:0; background:transparent; }',
592
+ 'body .consent-update-card { border:0; padding:0; background:transparent; box-shadow:none; }',
593
+ 'body .consent-updates.is-quiet .consent-update-card { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:6px 12px; }',
594
+ 'body .consent-updates.is-quiet .consent-update-detail { display:none; }',
595
+ 'body .consent-updates.is-quiet .consent-update-actions { grid-column:2; grid-row:1; margin:0; }',
596
+ 'body .consent-updates.is-quiet .consent-update-actions button { width:auto; min-width:0; padding:5px 9px; border-color:transparent; background:transparent; color:#aeb7b1; }',
597
+ 'body .consent-updates.is-offer, body .consent-updates.is-focus { padding-top:0; border-top:0; }',
598
+ 'body .consent-updates.is-offer .consent-update-card { padding:15px; border:1px solid #34433b; border-radius:12px; background:linear-gradient(145deg,#202622,#1b201d); box-shadow:0 12px 32px rgba(0,0,0,.16); }',
599
+ 'body.consent-update-focus { width:340px; min-height:340px; padding:20px; }',
600
+ 'body.consent-update-focus > .version-status, body.consent-update-focus > #open-panel, body.consent-update-focus > #status, body.consent-update-focus > .install { display:none !important; }',
601
+ 'body.consent-update-focus > h1 { margin-bottom:18px; }',
602
+ 'body.consent-update-focus .consent-updates { margin-top:0; padding:0; border:0; }',
603
+ 'body.consent-update-focus .consent-update-card { min-height:274px; padding:18px; border:1px solid #35443d; border-radius:14px; background:radial-gradient(circle at 95% 0,rgba(79,158,232,.12),transparent 42%),linear-gradient(150deg,#202522,#1a1e1c); box-shadow:0 18px 42px rgba(0,0,0,.24); }',
604
+ '.consent-update-route { margin:9px 0 0; color:#d9e6dd; font:600 13px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing:-.02em; }',
605
+ '.consent-update-steps { display:grid; gap:10px; margin:16px 0 0; padding:0; list-style:none; }',
606
+ '.consent-update-steps li { display:grid; grid-template-columns:24px minmax(0,1fr); align-items:center; gap:9px; color:#8f9892; font-size:12px; }',
607
+ '.consent-update-step-marker { display:inline-flex; width:22px; height:22px; align-items:center; justify-content:center; border:1px solid #3a413d; border-radius:999px; color:#89918c; font:700 10px/1 ui-monospace,monospace; }',
608
+ '.consent-update-steps li.is-done { color:#aeb9b2; }',
609
+ '.consent-update-steps li.is-done .consent-update-step-marker { border-color:#42694f; color:#8bd79e; background:#21392a; }',
610
+ '.consent-update-steps li.is-active { color:#edf2ef; }',
611
+ '.consent-update-steps li.is-active .consent-update-step-marker { border-color:#68a8e2; color:#eef7ff; background:#2d669a; box-shadow:0 0 0 3px rgba(98,168,232,.12); }',
612
+ '.consent-update-steps li.is-error .consent-update-step-marker { border-color:#9d554f; color:#ffd9d5; background:#542b28; }',
613
+ '.consent-update-footnote { margin:15px 0 0; padding-top:12px; border-top:1px solid #303733; color:#929b95; font-size:11px; }',
614
+ 'body .consent-updates.is-result .consent-update-progress { margin-top:18px; }',
615
+ 'body .consent-updates.is-focus .consent-update-actions { margin-top:18px; }',
507
616
  '@keyframes consent-progress { 0% { transform:translateX(-110%); } 100% { transform:translateX(240%); } }',
508
617
  '@media (prefers-reduced-motion:reduce) { .consent-update-progress.is-indeterminate span { animation:none; width:65% !important; } }'
509
618
  ].join('\n');
@@ -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.9.5';
15
+ const BUILD_TARGET_VERSION = '1.9.6';
16
16
  const DEFAULT_CHROME_EXTENSION_ID = 'illdpneeeopfffmiepaejglgmhpmdhdc';
17
17
  const REQUIRED_CAPABILITIES = Object.freeze([
18
18
  'bridgePing',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-overleaf-link",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "Cross-platform Chrome bridge that connects Codex to the active Overleaf project.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",