codex-copilot-dx 1.2.3 → 1.2.4
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 +2 -2
- package/docs/ARCHITECTURE.md +2 -0
- package/docs/README.md +2 -0
- package/docs/REFERENCE.md +12 -2
- package/package.json +1 -1
- package/src/dashboard/console.js +1 -2
- package/src/dashboard/index.html +23 -9
- package/src/dashboard/language.js +23 -0
- package/src/dashboard/status.js +5 -6
- package/src/dashboard/ui.css +20 -4
- package/src/dashboard/ui.js +10 -9
- package/src/dashboard/updates.js +73 -0
- package/src/dashboard-api.mjs +9 -0
- package/src/dashboard-updates.mjs +71 -0
- package/src/dashboard.mjs +1 -0
- package/src/optional-routes.mjs +2 -2
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm install -g codex-copilot-dx@latest
|
|
|
14
14
|
ccdx
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
17
|
+
No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.4/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.4/install.ps1) (Windows), then run `sh install.sh` or `./install.ps1` under your current shell policy. The bootstrap reuses compatible Node/npm or installs verified official Node 24.22.0 privately for CCDX. It adds no Git, compiler or system package manager. It keeps registry/proxy/certificate policy, verifies the Release package and installed runtime, and restores the prior CCDX package if installation fails. Dependencies still need your configured registry. See [installation limits and private command paths](docs/REFERENCE.md#install-without-node-or-git).
|
|
18
18
|
|
|
19
19
|
CCDX reuses a compatible local credential or starts GitHub Device Flow, listens on `127.0.0.1:2026`, configures Codex, and opens the App. Interactive desktop starts also open the local WebUI once; use `ccdx --no-browser` or disable this in WebUI settings. No client binary patch is needed. On Windows, open the App manually unless native prediction setup is enabled. In restricted Windows PowerShell, use `npm.cmd` to install and `ccdx.cmd` for the first launch, or run `ccdx.cmd doctor --fix`. Startup, updates and explicit repair remove only CCDX's exact npm-generated `.ps1` launchers so later calls can use `ccdx`. The npm package adds no install hook or policy change; custom launchers are preserved. npm's own script is untouched. The configured `dummy` API key is a placeholder, not a credential.
|
|
20
20
|
|
|
@@ -110,7 +110,7 @@ See the [M365 reference](docs/REFERENCE.md#microsoft-365-provider) for ownership
|
|
|
110
110
|
expose it to the public internet. The dashboard is not an authentication wall
|
|
111
111
|
for the API. Inference rejects browser Origin headers; native clients remain supported. Diagnostic errors may contain sensitive upstream text.
|
|
112
112
|
|
|
113
|
-
Startup checks GitHub's latest-release web redirect, not npm or the anonymous REST quota, and suggests `ccdx update github`.
|
|
113
|
+
Startup checks GitHub's latest-release web redirect, not npm or the anonymous REST quota, and suggests `ccdx update github`. Settings → Version & updates shows the running version, release dates and newer releases, with copyable update and macOS/Windows recovery commands. This separate, cached GitHub metadata check never installs automatically; failed checks remain unknown. See the [reference](docs/REFERENCE.md#version-and-update-information).
|
|
114
114
|
GitHub updates verify and install the exact Release tarball without Git; dependencies still use npm's configured registry. Lookup errors identify HTTP refusal, timeout, network failure or invalid redirects. For npm `EALLOWREMOTE`, only if policy permits and the update is trusted, use `ccdx update github --allow-remote`: explicit URL-download permission for that installation's whole dependency tree, not a hostname allowlist. Persistent npm settings stay unchanged.
|
|
115
115
|
Updates back up the discovered CCDX package and commands, restore them on install/runtime-check failure, and verify the installed version (exact for GitHub). Mismatched npm targets warn without changing PATH/prefix. Restart the adapter separately. Full `ccdx doctor` reports this target and readonly credential permissions; it never changes ACLs.
|
|
116
116
|
Recent errors separate HTTP and model failures. By default HTTP metadata retains status, source and IDs, not error bodies or prompts; original errors still reach Codex unchanged. Explicit, bounded error-excerpt collection is described in the [reference](docs/REFERENCE.md#http-error-diagnostics).
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -277,6 +277,8 @@ while visible/automatic, and source/settings evidence every eight status ticks.
|
|
|
277
277
|
Catalog and retained-log reads retain their slower, view-scoped policy. Animation
|
|
278
278
|
frames still load once per page when opened.
|
|
279
279
|
|
|
280
|
+
`dashboard-updates.mjs` is loaded only by the protected update-information route. It projects bounded public stable-release metadata and publication dates, with process-local single-flight, five-minute success and one-minute failure caches. Its asynchronous npm network-configuration read reuses the installer's existing policy-preserving downloader; it adds no runtime dependency, credentials or synchronous child process on the service event loop. Metadata has a four-second per-request deadline and 128 KiB decoded-body bound. It never installs or restarts anything and does not alter startup's independent web-redirect lookup. `dashboard/updates.js` renders current/available/unknown states and validated, pinned installation command text; `refresh.js` owns its visible Settings refresh cadence. Failed checks preserve explicitly labeled prior metadata. No provider authentication or inference is involved.
|
|
281
|
+
|
|
280
282
|
`claude-models.mjs` owns exact ID spelling and capability-cap projection shared by
|
|
281
283
|
configuration and model discovery. M365 resolves both canonical and existing raw
|
|
282
284
|
IDs to the same catalog entry and checks explicit effort lists without modifying
|
package/docs/README.md
CHANGED
|
@@ -17,6 +17,8 @@ effective Codex configuration or validate every field against the installed app.
|
|
|
17
17
|
|
|
18
18
|
## Historical release evidence
|
|
19
19
|
|
|
20
|
+
- [1.2.4: Navigation clarity and bounded version discovery](RELEASE_1.2.4.md)
|
|
21
|
+
|
|
20
22
|
These reports record a specific release and test environment. Their version,
|
|
21
23
|
test counts, timings, live-provider observations, and limitations remain
|
|
22
24
|
historical facts rather than current guarantees.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -848,6 +848,16 @@ Terminal color uses `terminal_color_theme: "klein"` in the normal CCDX user conf
|
|
|
848
848
|
|
|
849
849
|
The terminal sample in Settings is labeled Preview and uses sample numbers, not current usage. Existing nine animation previews and their save operation remain available beneath the color choice. Red errors and amber warnings keep their meaning across webpage themes.
|
|
850
850
|
|
|
851
|
+
### Version and update information
|
|
852
|
+
|
|
853
|
+
Settings ends with Version & updates. The current version belongs to the running service, which can differ from a newly installed package until CCDX restarts. Dates are GitHub Release publication dates, not local installation dates; an unavailable date is explicitly unknown. A verified newer stable release shows its version/date and `ccdx update github`. Copying a command never executes it. No background installation or service restart is added.
|
|
854
|
+
|
|
855
|
+
Opening Settings reads `GET /_ccdx/ui/updates`, protected by the existing loopback/Host/dashboard-header checks. It reads public GitHub REST release metadata without credentials, accepting stable, non-draft releases only. The first successful check needs at most two serial metadata requests: latest, and the exact current tag when different. The current publication date is retained in memory. Concurrent reads share one lookup; successful results are cached for five minutes and failures for one minute. The page reuses the visible-view 30-minute refresh controller, so the two-second status timer never polls GitHub. Manual checks also respect the service cache. Network configuration discovery is asynchronous and reads only npm's named proxy/CA/TLS/offline settings; no registry or policy is rewritten. Each metadata request has a four-second deadline and a 128 KiB decoded-body limit, with no automatic retry.
|
|
856
|
+
|
|
857
|
+
Failed/rate-limited checks never claim that the installed version is latest. Last-known release details remain labeled as such, separate from the latest check attempt. A failed current-tag date lookup does not hide an otherwise verified available update. The startup web-redirect check remains unchanged and independent of this REST check. If npm/network settings cannot be read or company policy blocks GitHub, the version card reports the check as unavailable.
|
|
858
|
+
|
|
859
|
+
Expand the recovery instructions to choose macOS Terminal or Windows PowerShell. Commands download the version-pinned Release installer into a unique temporary directory and remove that directory afterward. They use the newer of the running version and last-known stable release, falling back to the running version if no release is known; stale metadata cannot select a downgrade. Installers retain the documented no-Git, minimum-runtime, rollback and configured-registry behavior. Windows instructions keep the current execution policy; if company policy blocks scripts, use its approved installation method. Dependencies still require the configured npm registry.
|
|
860
|
+
|
|
851
861
|
Model-list failures name the selected source, retain its last successful list when available, and distinguish that list's timestamp from the failed check. Expand Check details for the bounded public reason, source, available HTTP status and check time. A retry time is shown only when the source supplies an actual retry delay; no new retry or automatic provider failover is added. Existing diagnostic redaction and size limits remain.
|
|
852
862
|
|
|
853
863
|
### Terminal animation
|
|
@@ -994,7 +1004,7 @@ Unknown support prevents an explicitly requested exception from starting.
|
|
|
994
1004
|
For an older updater that still requires Git, install the Release tarball directly:
|
|
995
1005
|
|
|
996
1006
|
```sh
|
|
997
|
-
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
1007
|
+
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.4/codex-copilot-dx-1.2.4.tgz
|
|
998
1008
|
# Windows PowerShell: use npm.cmd instead of npm.
|
|
999
1009
|
```
|
|
1000
1010
|
|
|
@@ -1166,7 +1176,7 @@ A locally saved GitHub credential is not online entitlement. Account names with
|
|
|
1166
1176
|
underscores retain their exact display value; identity, keys and environment
|
|
1167
1177
|
values are not inferred from model names. Client configuration, gateway state,
|
|
1168
1178
|
recent requests and actual inference are separate observations. The top summary
|
|
1169
|
-
|
|
1179
|
+
describes source/application status without mapping arrows. The source card counts and lists every discovered registered source, including disabled sources; availability and account evidence remain in the detailed tables. Each sidebar tab has a decorative inline SVG icon, with application entries indented. Terminal appearance has one Settings entry, and the animation selector has one separating rule.
|
|
1170
1180
|
|
|
1171
1181
|
Catalog tabs browse registered Provider directories without changing routing.
|
|
1172
1182
|
Rows retain protocol, eligible clients, reasoning metadata and directory state.
|
package/package.json
CHANGED
package/src/dashboard/console.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
if (["codex", "models", "system"].includes(next)) void loadSettings();
|
|
49
49
|
if (next === "models") { void dashboardRefresh.refresh("models");void dashboardRefresh.refresh("auth"); }
|
|
50
50
|
if (next === "usage") void dashboardRefresh.refresh("usage");
|
|
51
|
-
if (next === "system") void dashboardRefresh.refresh("animation");
|
|
51
|
+
if (next === "system") { void dashboardRefresh.refresh("animation");void dashboardRefresh.refresh("updates"); }
|
|
52
52
|
syncAnimationPreview();
|
|
53
53
|
}
|
|
54
54
|
async function api(body) {
|
|
@@ -266,6 +266,5 @@
|
|
|
266
266
|
el("refresh").addEventListener("click", () => { if (["codex", "models", "system"].includes(current)) void loadSettings(); });
|
|
267
267
|
window.addEventListener("pagehide", () => { stopped = true;clearTimeout(timer); });
|
|
268
268
|
window.addEventListener("pageshow", () => { stopped = false;schedule(); });
|
|
269
|
-
el("open-animation").addEventListener("click", () => { location.hash = "system";navigate(); });
|
|
270
269
|
navigate();schedule();
|
|
271
270
|
})();
|
package/src/dashboard/index.html
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<script src="/refresh.js" defer></script>
|
|
12
12
|
<script src="/status.js" defer></script>
|
|
13
13
|
<script src="/usage.js" defer></script>
|
|
14
|
+
<script src="/updates.js" defer></script>
|
|
14
15
|
<script src="/ui.js" defer></script>
|
|
15
16
|
<script src="/console.js" defer></script>
|
|
16
17
|
<title data-i18n="ccdx_local_dashboard">CCDX · Dashboard</title>
|
|
@@ -20,16 +21,15 @@
|
|
|
20
21
|
<aside class="sidebar">
|
|
21
22
|
<a class="sidebar-brand" href="#overview"><svg id="status-icon" class="status-icon" viewBox="0 0 64 64" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><ellipse cx="32" cy="32" rx="26" ry="10"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(60 32 32)"/><ellipse cx="32" cy="32" rx="26" ry="10" transform="rotate(120 32 32)"/></g><circle cx="32" cy="32" r="4.5" fill="currentColor"/></svg><span class="brand-name">CCDX</span><span class="brand-caption" data-i18n="local_control">LOCAL CONTROL</span></a>
|
|
22
23
|
<nav aria-label="Navigation" data-i18n-label="main_navigation">
|
|
23
|
-
<a href="#overview" data-route="overview" aria-current="page" data-i18n="overview">Overview</a>
|
|
24
|
+
<a href="#overview" data-route="overview" aria-current="page"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg><span data-i18n="overview">Overview</span></a>
|
|
24
25
|
<span class="nav-group" data-i18n="clients">Apps</span>
|
|
25
|
-
<a class="nav-child" href="#codex" data-route="codex">Codex</a>
|
|
26
|
-
<a class="nav-child" href="#claude" data-route="claude">Claude</a>
|
|
27
|
-
<a href="#models" data-route="models" data-i18n="model_services">Model sources</a>
|
|
28
|
-
<a href="#usage" data-route="usage" data-i18n="usage_and_diagnostics">Usage</a>
|
|
29
|
-
<a href="#requests" data-route="requests" data-i18n="request_records">Requests</a>
|
|
30
|
-
<a href="#system" data-route="system" data-i18n="system_and_settings">Settings</a>
|
|
26
|
+
<a class="nav-child" href="#codex" data-route="codex"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="3" width="18" height="18" rx="2"/><path d="m7 8 4 4-4 4m7 0h3"/></svg><span>Codex</span></a>
|
|
27
|
+
<a class="nav-child" href="#claude" data-route="claude"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M21 15a3 3 0 0 1-3 3H8l-5 3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3Z"/></svg><span>Claude</span></a>
|
|
28
|
+
<a href="#models" data-route="models"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m12 3 10 5-10 5L2 8Zm-10 9 10 5 10-5M2 16l10 5 10-5"/></svg><span data-i18n="model_services">Model sources</span></a>
|
|
29
|
+
<a href="#usage" data-route="usage"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 3v18h18M7 16v-5m5 5V7m5 9V4"/></svg><span data-i18n="usage_and_diagnostics">Usage</span></a>
|
|
30
|
+
<a href="#requests" data-route="requests"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg><span data-i18n="request_records">Requests</span></a>
|
|
31
|
+
<a href="#system" data-route="system"><svg class="nav-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M3 6h4m4 0h10M3 12h10m4 0h4M3 18h4m4 0h10"/><circle cx="9" cy="6" r="2"/><circle cx="15" cy="12" r="2"/><circle cx="9" cy="18" r="2"/></svg><span data-i18n="system_and_settings">Settings</span></a>
|
|
31
32
|
</nav>
|
|
32
|
-
<div class="sidebar-bottom"><button id="open-animation" type="button" aria-controls="animation-settings" aria-expanded="false" data-i18n="terminal_appearance">Terminal appearance</button></div>
|
|
33
33
|
</aside>
|
|
34
34
|
|
|
35
35
|
<header class="topbar">
|
|
@@ -245,7 +245,7 @@ Missing data is unknown. This panel keeps no prompts or images.</p>
|
|
|
245
245
|
<pre class="terminal-motion"><span id="terminal-sample-frame">[ :::::::]</span> <span id="terminal-sample-status">Working</span></pre>
|
|
246
246
|
</div>
|
|
247
247
|
|
|
248
|
-
<div class="setting-row"><label for="setting-terminal_animation_enabled" data-i18n="terminal_animation">Terminal animation</label><input id="setting-terminal_animation_enabled" type="checkbox" role="switch" disabled><span id="effect-terminal_animation_enabled" class="hint" role="status"></span></div>
|
|
248
|
+
<div class="setting-row terminal-animation-toggle"><label for="setting-terminal_animation_enabled" data-i18n="terminal_animation">Terminal animation</label><input id="setting-terminal_animation_enabled" type="checkbox" role="switch" disabled><span id="effect-terminal_animation_enabled" class="hint" role="status"></span></div>
|
|
249
249
|
<details id="animation-settings" class="appearance-animation settings-panel">
|
|
250
250
|
<summary class="panel-heading"><h2 data-i18n="terminal_animation_9edf6">TERMINAL ANIMATION</h2><span id="animation-state" data-i18n="reading">READING</span></summary>
|
|
251
251
|
<div id="animation-options" class="animation-options" role="group" aria-label="Animation style" data-i18n-label="animation_theme"></div>
|
|
@@ -262,6 +262,20 @@ Missing data is unknown. This panel keeps no prompts or images.</p>
|
|
|
262
262
|
|
|
263
263
|
<section class="panel dashboard-section"><h2 data-i18n="process_listener">LOCAL SERVICE</h2><p id="process-state" class="table-note"></p><p id="process-memory" class="hint"></p><p id="process-queues" class="hint"></p><p id="process-notice" class="hint" role="status"></p></section>
|
|
264
264
|
<section class="overview client-overview"><article class="card"><h2 data-i18n="http_traffic">SERVICE REQUESTS</h2><strong id="requests">—</strong><p id="request-errors">—</p><p id="http-error-breakdown">—</p><p><span data-i18n="per_request_limits_active">Per-request limits</span><br><span id="body-limits">—</span></p></article></section>
|
|
265
|
+
<section class="panel dashboard-section" id="version-updates" aria-labelledby="version-updates-title">
|
|
266
|
+
<div class="version-heading"><h2 id="version-updates-title" data-i18n="version_updates">VERSION & UPDATES</h2><button id="check-updates" type="button" data-i18n="check_updates">Check for updates</button></div>
|
|
267
|
+
<dl class="version-list"><div><dt data-i18n="current_version">Current version</dt><dd id="update-current-version">—</dd><dd id="update-current-date" class="hint">—</dd></div><div id="update-latest-row" hidden><dt data-i18n="available_update">Update available</dt><dd id="update-latest-version">—</dd><dd id="update-latest-date" class="hint">—</dd></div></dl>
|
|
268
|
+
<p id="update-state" class="hint" role="status" data-i18n="reading">READING</p>
|
|
269
|
+
<div id="update-command-row" class="update-command"><code id="update-command">ccdx update github</code><button type="button" id="copy-update" data-i18n="copy_command">Copy command</button></div>
|
|
270
|
+
<p class="hint" data-i18n="update_restart">Run in your terminal, then restart CCDX.</p>
|
|
271
|
+
<p id="update-checked" class="refresh-time"></p>
|
|
272
|
+
<details class="update-install"><summary data-i18n="update_install_help">Update failed? View full installation commands</summary><p class="hint" data-i18n="update_install_hint">Download the official installer. No Git required.</p>
|
|
273
|
+
<div class="section-actions install-platforms" role="group" aria-label="Installation platform" data-i18n-label="installation_platform"><button type="button" data-install-platform="macos" aria-pressed="true">macOS</button><button type="button" data-install-platform="windows" aria-pressed="false">Windows</button></div>
|
|
274
|
+
<div class="install-command-heading"><span id="install-shell" class="hint">macOS · Terminal</span><button type="button" id="copy-install" data-i18n="copy_command">Copy command</button></div><pre id="install-command" class="install-command"></pre>
|
|
275
|
+
<p class="hint" data-i18n="update_install_policy">Reuses compatible Node/npm or installs a private runtime. Keeps your registry, proxy, certificates and shell policy.</p>
|
|
276
|
+
<p id="install-windows-policy" class="hint" hidden data-i18n="update_windows_policy">If scripts are blocked, use your company’s approved installation method.</p>
|
|
277
|
+
</details><p id="update-copy-note" class="hint" role="status"></p>
|
|
278
|
+
</section>
|
|
265
279
|
</div>
|
|
266
280
|
</main>
|
|
267
281
|
<footer data-i18n="local_only_visible_page_updates">THIS COMPUTER ONLY / UPDATES WHILE VISIBLE</footer>
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
const translations = {
|
|
3
|
+
"provider_status_scope": ["Source and application status", "模型来源与应用状态"],
|
|
4
|
+
"version_updates": ["VERSION & UPDATES", "版本与更新"],
|
|
5
|
+
"copy_command": ["Copy command", "复制指令"],
|
|
6
|
+
"check_updates": ["Check for updates", "检查更新"],
|
|
7
|
+
"checking_updates": ["Checking…", "正在检查…"],
|
|
8
|
+
"current_version": ["Current version", "当前版本"],
|
|
9
|
+
"available_update": ["Update available", "可用更新"],
|
|
10
|
+
"last_known_version": ["Last known version", "上次查到的版本"],
|
|
11
|
+
"released_date": ["Released {date}", "发布于 {date}"],
|
|
12
|
+
"release_date_unknown": ["Release date unknown", "发布日期未知"],
|
|
13
|
+
"new_version_available": ["A new version is available.", "发现新版本。"],
|
|
14
|
+
"already_latest": ["You’re up to date.", "已是最新版本。"],
|
|
15
|
+
"update_check_failed": ["Could not check updates. Latest version unknown.", "暂时无法检查,最新版本未知。"],
|
|
16
|
+
"update_rate_limited": ["GitHub limited update checks. Try again later.", "GitHub 限制了检查,请稍后再试。"],
|
|
17
|
+
"update_restart": ["Run in your terminal, then restart CCDX.", "在终端运行,完成后重启 CCDX。"],
|
|
18
|
+
"update_checked_time": ["Last checked: {time}", "上次检查:{time}"],
|
|
19
|
+
"update_attempted_time": ["Last attempt: {time}", "最近尝试:{time}"],
|
|
20
|
+
"update_install_help": ["Update failed? View full installation commands", "更新遇到问题?查看完整安装指令"],
|
|
21
|
+
"installation_platform": ["Installation platform", "安装平台"],
|
|
22
|
+
"update_install_hint": ["Download the official installer. No Git required.", "下载官方安装器,无需 Git。"],
|
|
23
|
+
"update_install_policy": ["Reuses compatible Node/npm or installs a private runtime. Keeps your registry, proxy, certificates and shell policy.", "复用可用的 Node/npm,否则安装专用运行环境。\n保留镜像、代理、证书和脚本策略。"],
|
|
24
|
+
"update_windows_policy": ["If scripts are blocked, use your company’s approved installation method.", "若公司禁止运行脚本,请使用公司批准的安装方式。"],
|
|
25
|
+
"update_copy_unavailable": ["Clipboard unavailable. Select the command and copy it.", "无法自动复制,请选中指令复制。"],
|
|
3
26
|
"company_account": ["Company account", "公司账号"],
|
|
4
27
|
"check_accounts": ["Check accounts", "检查账号"],
|
|
5
28
|
"choose_company_account": ["Choose a company account", "选择公司账号"],
|
package/src/dashboard/status.js
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
restored: "settings_restored", not_installed: "not_installed", configuration_unavailable: "setup_unavailable", not_configured: "unknown", standby: "standby" };
|
|
15
15
|
const auth = element("provider-auth"), clients = element("provider-clients"), requests = element("provider-requests");
|
|
16
16
|
auth.replaceChildren();clients.replaceChildren();requests.replaceChildren();
|
|
17
|
-
const routes = [];
|
|
18
17
|
for (const provider of providers) {
|
|
19
18
|
sourceNames.set(provider.id, provider.name);
|
|
20
19
|
const identity = provider.auth || {};
|
|
@@ -27,7 +26,6 @@
|
|
|
27
26
|
client.gateway || "—", client.last_request_at || "—"], { labels: [2, 3] });
|
|
28
27
|
if (client.reason) localize(row.children[2], "state_reason", { state: phrase(states[client.state] || "unknown"), reason: client.reason });
|
|
29
28
|
clients.append(row);
|
|
30
|
-
if (client.selected && client.id === "codex") routes.push(`${client.name} → ${provider.name}`);
|
|
31
29
|
}
|
|
32
30
|
if (provider.requests) {
|
|
33
31
|
const item = document.createElement("p");
|
|
@@ -36,10 +34,11 @@
|
|
|
36
34
|
requests.append(item);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
text("source-summary", "count_providers", { count: providers.
|
|
40
|
-
element("source-detail").
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
text("source-summary", "count_providers", { count: providers.length });
|
|
38
|
+
element("source-detail").replaceChildren(...providers.map(provider => {
|
|
39
|
+
const item = document.createElement("span");item.textContent = provider.name;return item;
|
|
40
|
+
}));
|
|
41
|
+
text("auth-account", "provider_status_scope");
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
function duration(value) {
|
package/src/dashboard/ui.css
CHANGED
|
@@ -159,9 +159,6 @@ footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color:
|
|
|
159
159
|
.sidebar nav a[aria-current="page"] { color: var(--accent); background: var(--selected-bg); border-left-color: var(--accent); }
|
|
160
160
|
.sidebar nav a:focus-visible, .sidebar-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
|
|
161
161
|
.nav-group { color: var(--subtle); font-size: 10px; padding: 18px 12px 4px; text-transform: uppercase; letter-spacing: .08em; }
|
|
162
|
-
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
|
|
163
|
-
.sidebar-bottom button { width: 100%; text-align: left; }
|
|
164
|
-
.sidebar-bottom p { color: var(--subtle); font-size: 11px; line-height: 1.7; }
|
|
165
162
|
.topbar, main, footer { grid-column: 2; min-width: 0; }
|
|
166
163
|
.topbar { min-height: 76px; gap: 14px; }
|
|
167
164
|
.brand { font-size: 12px; }
|
|
@@ -188,7 +185,7 @@ input[role="switch"]:focus-visible, input[type="number"]:focus-visible { outline
|
|
|
188
185
|
input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
189
186
|
#process-queues { overflow-wrap: anywhere; font-size: 11px; }
|
|
190
187
|
@media (max-width: 900px) { .shell { grid-template-columns: 170px minmax(0, 1fr); column-gap: 20px; padding: 0 20px; } .topbar .brand { display: none; } .topbar { justify-content: flex-end; } .setting-row { grid-template-columns: minmax(0, 1fr) 44px; } .setting-row .hint { grid-column: 1 / -1; } .overview { grid-template-columns: 1fr; } }
|
|
191
|
-
@media (max-width: 640px) { .shell { display: block; padding: 0 16px; } .sidebar { position: static; height: auto; padding: 20px 0 14px; border-right: 0; border-bottom: 1px solid var(--border); } .sidebar-brand { font-size: 20px; width: fit-content; } .sidebar-brand .brand-caption { margin-top: 4px; } .sidebar nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 16px; } .sidebar nav a { padding: 9px 10px; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; } .sidebar nav a[aria-current="page"] { border-bottom-color: var(--accent); } .nav-group
|
|
188
|
+
@media (max-width: 640px) { .shell { display: block; padding: 0 16px; } .sidebar { position: static; height: auto; padding: 20px 0 14px; border-right: 0; border-bottom: 1px solid var(--border); } .sidebar-brand { font-size: 20px; width: fit-content; } .sidebar-brand .brand-caption { margin-top: 4px; } .sidebar nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin-top: 16px; } .sidebar nav a { padding: 9px 10px; font-size: 12px; border-left: 0; border-bottom: 2px solid transparent; } .sidebar nav a[aria-current="page"] { border-bottom-color: var(--accent); } .nav-group { display: none; } .topbar { min-height: 62px; justify-content: flex-start; } .topbar-actions { justify-content: flex-start; gap: 9px; } .intro { padding: 24px 0 18px; } .panel, .lower { padding: 17px; } .section-actions > label { width: 100%; } .stats { gap: 12px; } }
|
|
192
189
|
|
|
193
190
|
/* Keep forms aligned with the existing dashboard controls. */
|
|
194
191
|
.dashboard-section + .client-overview { margin-top: 10px; }
|
|
@@ -234,6 +231,25 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
|
|
|
234
231
|
.appearance-select { width:100%; max-width:100%; min-width:0; height:36px; box-sizing:border-box; border-radius:2px; padding:0 10px; font-size:12px; }
|
|
235
232
|
.appearance-note { color:var(--subtle); margin:17px 0 0; font-size:12px; line-height:1.7; }
|
|
236
233
|
.appearance-animation { margin-top:22px; border-top:1px solid var(--border); padding-top:18px; }
|
|
234
|
+
.terminal-animation-toggle { border-bottom:0; }
|
|
235
|
+
.sidebar nav a { display:flex; align-items:center; gap:10px; }
|
|
236
|
+
.nav-icon { width:17px; height:17px; flex:none; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
|
|
237
|
+
#source-detail { display:flex; flex-wrap:wrap; gap:5px 22px; }
|
|
238
|
+
.version-heading, .install-command-heading { display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
|
|
239
|
+
.version-heading h2 { margin:0; }
|
|
240
|
+
.version-list { margin:18px 0 0; }
|
|
241
|
+
.version-list > div { display:grid; grid-template-columns:minmax(110px,1fr) auto minmax(150px,1fr); align-items:baseline; gap:16px; padding:14px 0; border-bottom:1px solid var(--border); }
|
|
242
|
+
.version-list dt { font-size:12px; }
|
|
243
|
+
.version-list dd { margin:0; }
|
|
244
|
+
.version-list dd:nth-child(2) { font-size:18px; font-weight:650; color:var(--strong); }
|
|
245
|
+
.version-list dd:last-child { text-align:right; }
|
|
246
|
+
.update-command { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:12px; margin-top:16px; background:var(--page); border:1px solid var(--border); }
|
|
247
|
+
.update-command code { overflow-wrap:anywhere; }
|
|
248
|
+
.update-install { margin-top:20px; padding-top:16px; border-top:1px solid var(--border); }
|
|
249
|
+
.update-install > summary { color:var(--heading); font-size:12px; }
|
|
250
|
+
.install-command-heading { margin-top:16px; }
|
|
251
|
+
.install-command { white-space:pre-wrap; overflow-wrap:anywhere; word-break:break-word; font-size:12px; line-height:1.75; padding:14px; background:var(--page); border:1px solid var(--border); }
|
|
252
|
+
@media(max-width:700px) { .version-list > div { grid-template-columns:1fr auto; gap:8px; } .version-list dd:last-child { grid-column:1/-1; text-align:left; } }
|
|
237
253
|
.appearance-animation > summary { color:var(--heading); font-size:12px; font-weight:700; }
|
|
238
254
|
.terminal-sample { --sample-bg:#0F151D; --sample-text:#DFE7F2; --sample-muted:#A2B0C2; --sample-line:#304054; --sample-logo:#A6F5A8; --sample-table:#DFE7F2; --sample-motion:#84E99E; padding:16px; margin-top:20px; border:1px solid var(--sample-line); border-radius:2px; background:var(--sample-bg); color:var(--sample-text); }
|
|
239
255
|
.terminal-sample[data-terminal-palette="klein"] { --sample-logo:#4C9FFF; --sample-table:#4C9FFF; --sample-motion:#4C9FFF; }
|
package/src/dashboard/ui.js
CHANGED
|
@@ -362,15 +362,22 @@ for (const [key, ids] of [["auth", ["account-authorization"]], ["status", ["clie
|
|
|
362
362
|
}));
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
+
const updateView = globalThis.ccdxDashboardUpdates.create(viewHelpers);
|
|
365
366
|
const dashboardRefresh = globalThis.ccdxRefresh.createController({
|
|
366
367
|
visible: () => document.visibilityState === "visible",
|
|
367
368
|
onState: ({ pendingKeys }) => {
|
|
368
|
-
//
|
|
369
|
-
const busy = pendingKeys.some(key => key !== "auth");
|
|
369
|
+
// Account and release reads must not block normal dashboard refreshes.
|
|
370
|
+
const busy = pendingKeys.some(key => key !== "auth" && key !== "updates");
|
|
370
371
|
element("refresh").disabled = busy;
|
|
371
372
|
element("refresh").setAttribute("aria-busy", String(busy));
|
|
372
373
|
},
|
|
373
374
|
resources: {
|
|
375
|
+
updates: {
|
|
376
|
+
visible: () => !element("version-updates").closest("[hidden]"),
|
|
377
|
+
load: ({ signal }) => readDashboard("/_ccdx/ui/updates", { signal, timeout: 20000, source: "release_status" }),
|
|
378
|
+
apply: updateView.render,
|
|
379
|
+
state: updateView.state,
|
|
380
|
+
},
|
|
374
381
|
status: {
|
|
375
382
|
visible: () => true,
|
|
376
383
|
load: async ({ signal }) => {
|
|
@@ -522,17 +529,11 @@ for (const [id, key] of [["account-authorization", "auth"], ["client-features",
|
|
|
522
529
|
}
|
|
523
530
|
|
|
524
531
|
element("save-animation").addEventListener("click", saveAnimation);
|
|
532
|
+
element("check-updates").addEventListener("click", () => dashboardRefresh.refresh("updates", { force: true }));
|
|
525
533
|
element("animation-settings").addEventListener("toggle", () => {
|
|
526
|
-
element("open-animation").setAttribute("aria-expanded", String(element("animation-settings").open));
|
|
527
534
|
if (element("animation-settings").open) loadAnimation();
|
|
528
535
|
syncAnimationPreview();
|
|
529
536
|
});
|
|
530
|
-
element("open-animation").addEventListener("click", () => {
|
|
531
|
-
const settings = element("animation-settings");
|
|
532
|
-
settings.open = true;
|
|
533
|
-
settings.scrollIntoView({ block: "center" });
|
|
534
|
-
settings.querySelector("summary").focus();
|
|
535
|
-
});
|
|
536
537
|
element("usage-analytics").addEventListener("toggle", () => {
|
|
537
538
|
if (element("usage-analytics").open && element("model-usage").open) dashboardRefresh.refresh("usage");
|
|
538
539
|
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const stable = value => typeof value === "string" && /^(0|[1-9]\d{0,14})\.(0|[1-9]\d{0,14})\.(0|[1-9]\d{0,14})$/.test(value) ? value : null;
|
|
3
|
+
function installationCommand(platform, version, latestVersion) {
|
|
4
|
+
const current = stable(version), latest = stable(latestVersion);
|
|
5
|
+
if (latest && (!current || ([0, 1, 2].map(index => Number(latest.split(".")[index]) - Number(current.split(".")[index])).find(value => value !== 0) || 0) > 0)) version = latest;
|
|
6
|
+
if (!stable(version)) return "";
|
|
7
|
+
const base = `https://github.com/DaleXiao/codex-copilot-dx/releases/download/v${version}`;
|
|
8
|
+
if (platform === "windows") return `$ccdxInstallDir = Join-Path ([IO.Path]::GetTempPath()) ("ccdx-install-" + [guid]::NewGuid().ToString("N"))
|
|
9
|
+
New-Item -ItemType Directory -Path $ccdxInstallDir -ErrorAction Stop | Out-Null
|
|
10
|
+
try {
|
|
11
|
+
$ccdxInstaller = Join-Path $ccdxInstallDir "install.ps1"
|
|
12
|
+
Invoke-WebRequest -UseBasicParsing -Uri "${base}/install.ps1" -OutFile $ccdxInstaller -TimeoutSec 300 -ErrorAction Stop
|
|
13
|
+
& $ccdxInstaller
|
|
14
|
+
} finally {
|
|
15
|
+
Remove-Item -LiteralPath $ccdxInstallDir -Recurse -Force
|
|
16
|
+
}`;
|
|
17
|
+
return `(
|
|
18
|
+
set -e
|
|
19
|
+
ccdx_install_dir="$(mktemp -d)"
|
|
20
|
+
trap 'rm -rf "$ccdx_install_dir"' EXIT
|
|
21
|
+
curl --fail --location --proto '=https' --proto-redir '=https' --connect-timeout 20 --max-time 300 \\
|
|
22
|
+
${base}/install.sh \\
|
|
23
|
+
--output "$ccdx_install_dir/install.sh"
|
|
24
|
+
sh "$ccdx_install_dir/install.sh"
|
|
25
|
+
)`;
|
|
26
|
+
}
|
|
27
|
+
function create({ element, localize, navigator }) {
|
|
28
|
+
let snapshot = null, platform = "macos";
|
|
29
|
+
const date = value => typeof value === "string" && Number.isFinite(Date.parse(value)) ? value.slice(0, 10) : null;
|
|
30
|
+
function install() {
|
|
31
|
+
const command = installationCommand(platform, snapshot?.current?.version, snapshot?.latest?.version);
|
|
32
|
+
element("install-command").textContent = command;
|
|
33
|
+
element("copy-install").disabled = !command;
|
|
34
|
+
element("install-shell").textContent = platform === "windows" ? "Windows · PowerShell" : "macOS · Terminal";
|
|
35
|
+
element("install-windows-policy").hidden = platform !== "windows";
|
|
36
|
+
}
|
|
37
|
+
function render(data) {
|
|
38
|
+
snapshot = data;
|
|
39
|
+
const checked = data.status === "checked", latest = stable(data.latest?.version), current = stable(data.current?.version);
|
|
40
|
+
element("update-current-version").textContent = current ? `v${current}` : "—";
|
|
41
|
+
const currentDate = date(data.current?.published_at), latestDate = date(data.latest?.published_at);
|
|
42
|
+
localize(element("update-current-date"), currentDate ? "released_date" : "release_date_unknown", { date: currentDate });
|
|
43
|
+
element("update-latest-row").hidden = !latest || checked && !data.update_available;
|
|
44
|
+
localize(element("update-latest-row").querySelector("dt"), checked ? "available_update" : "last_known_version");
|
|
45
|
+
element("update-latest-version").textContent = latest ? `v${latest}` : "—";
|
|
46
|
+
localize(element("update-latest-date"), latestDate ? "released_date" : "release_date_unknown", { date: latestDate });
|
|
47
|
+
localize(element("update-state"), checked ? data.update_available ? "new_version_available" : "already_latest" : data.status === "rate_limited" ? "update_rate_limited" : "update_check_failed");
|
|
48
|
+
element("update-command-row").hidden = checked && !data.update_available;
|
|
49
|
+
const time = typeof data.checked_at === "string" && Number.isFinite(Date.parse(data.checked_at)) ? new Date(data.checked_at).toLocaleString() : "—";
|
|
50
|
+
localize(element("update-checked"), checked ? "update_checked_time" : "update_attempted_time", { time });
|
|
51
|
+
install();
|
|
52
|
+
}
|
|
53
|
+
function state(value) {
|
|
54
|
+
element("check-updates").disabled = Boolean(value.pending);
|
|
55
|
+
localize(element("check-updates"), value.pending ? "checking_updates" : "check_updates");
|
|
56
|
+
if (value.error) {
|
|
57
|
+
render({ ...snapshot, status: "unavailable", checked_at: new Date().toISOString(), current: snapshot?.current || { version: stable(element("version").textContent.replace(/^v/, "")) } });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const button of document.querySelectorAll("[data-install-platform]")) button.addEventListener("click", () => {
|
|
61
|
+
platform = button.dataset.installPlatform;
|
|
62
|
+
for (const item of document.querySelectorAll("[data-install-platform]")) item.setAttribute("aria-pressed", String(item === button));
|
|
63
|
+
install();
|
|
64
|
+
});
|
|
65
|
+
for (const [button, target] of [["copy-update", "update-command"], ["copy-install", "install-command"]]) element(button).addEventListener("click", async () => {
|
|
66
|
+
try { await navigator.clipboard.writeText(element(target).textContent);localize(element("update-copy-note"), "copied"); }
|
|
67
|
+
catch { localize(element("update-copy-note"), "update_copy_unavailable"); }
|
|
68
|
+
});
|
|
69
|
+
element("copy-install").disabled = true;
|
|
70
|
+
return { render, state };
|
|
71
|
+
}
|
|
72
|
+
globalThis.ccdxDashboardUpdates = { create, installationCommand };
|
|
73
|
+
})();
|
package/src/dashboard-api.mjs
CHANGED
|
@@ -143,6 +143,7 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
143
143
|
providerCatalogFn,
|
|
144
144
|
providerStateFn,
|
|
145
145
|
providerAccountsFn,
|
|
146
|
+
updateStatusFn,
|
|
146
147
|
serviceControl,
|
|
147
148
|
applyAnimation,
|
|
148
149
|
} = {}) {
|
|
@@ -163,6 +164,14 @@ export async function handleDashboardApi(req, res, pathname, {
|
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
166
|
|
|
167
|
+
if (pathname === "/_ccdx/ui/updates") {
|
|
168
|
+
if (req.method !== "GET") { sendJson(res, 405, { error: "Use GET" });return; }
|
|
169
|
+
const { dashboardUpdateStatus } = await import("./dashboard-updates.mjs");
|
|
170
|
+
try { sendJson(res, 200, await (updateStatusFn || dashboardUpdateStatus)()); }
|
|
171
|
+
catch { sendJson(res, 503, { error: "Could not check releases" }); }
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
|
|
166
175
|
if (pathname === "/_ccdx/ui/m365/accounts" && req.method === "GET") {
|
|
167
176
|
if (!providerAccountsFn) { sendJson(res, 503, { error: "Account selection requires the updated running service" });return; }
|
|
168
177
|
try {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { execFile } from "node:child_process";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { createNpmReleaseFetch, stableVersion } from "./release-install.mjs";
|
|
6
|
+
import { isVersionGreater } from "./version.mjs";
|
|
7
|
+
import { ADAPTER_VERSION } from "./running-adapter.mjs";
|
|
8
|
+
import { readBoundedResponseText } from "./upstream-body.mjs";
|
|
9
|
+
|
|
10
|
+
const API = "https://api.github.com/repos/DaleXiao/codex-copilot-dx/releases";
|
|
11
|
+
const run = promisify(execFile);
|
|
12
|
+
|
|
13
|
+
async function releaseFetch() {
|
|
14
|
+
const env = process.env, windows = process.platform === "win32", paths = windows ? path.win32 : path;
|
|
15
|
+
const search = Object.entries(env).find(([key]) => key.toLowerCase() === "path")?.[1] || "";
|
|
16
|
+
const npm = search.split(windows ? ";" : ":").filter(Boolean)
|
|
17
|
+
.map(directory => paths.join(directory.replace(/^"|"$/g, ""), windows ? "npm.cmd" : "npm"))
|
|
18
|
+
.find(file => { try { return fs.statSync(file).isFile(); } catch { return false; } });
|
|
19
|
+
if (!npm) throw new Error("npm unavailable");
|
|
20
|
+
const cli = windows ? paths.join(paths.dirname(npm), "node_modules", "npm", "bin", "npm-cli.js") : fs.realpathSync(npm);
|
|
21
|
+
// Read only the installer's named network settings, off the service event loop.
|
|
22
|
+
const { stdout } = await run(process.execPath, [cli, "config", "get", "--global", "https-proxy", "proxy", "noproxy", "cafile", "strict-ssl", "offline"],
|
|
23
|
+
{ env, encoding: "utf8", timeout: 5000, maxBuffer: 128 * 1024, windowsHide: true });
|
|
24
|
+
return createNpmReleaseFetch(cli, { env, exec: () => stdout });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createDashboardUpdateStatus({ currentVersion = ADAPTER_VERSION, fetchFactory = releaseFetch, now = Date.now, timeoutMs = 4000 } = {}) {
|
|
28
|
+
let pending, snapshot, attemptedAt = -Infinity, currentDate = null;
|
|
29
|
+
const current = () => ({ version: currentVersion, published_at: currentDate });
|
|
30
|
+
async function metadata(fetchImpl, suffix, expectedVersion) {
|
|
31
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
32
|
+
const response = await fetchImpl(`${API}/${suffix}`, { signal, redirect: "error",
|
|
33
|
+
headers: { Accept: "application/vnd.github+json", "User-Agent": "codex-copilot-dx", "X-GitHub-Api-Version": "2022-11-28" } });
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
await response.body?.cancel();
|
|
36
|
+
throw Object.assign(new Error("Release metadata unavailable"), { code: [403, 429].includes(response.status) ? "rate_limited" : "unavailable" });
|
|
37
|
+
}
|
|
38
|
+
const value = JSON.parse(await readBoundedResponseText(response, { maxBytes: 128 * 1024, signal, label: "Release metadata" }));
|
|
39
|
+
const version = stableVersion(value.tag_name);
|
|
40
|
+
if (!version || value.draft !== false || value.prerelease !== false || expectedVersion && version !== expectedVersion) throw new Error("Invalid stable release");
|
|
41
|
+
const date = typeof value.published_at === "string" && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$/.test(value.published_at) && Number.isFinite(Date.parse(value.published_at))
|
|
42
|
+
&& new Date(value.published_at).toISOString().replace(".000Z", "Z") === value.published_at
|
|
43
|
+
? new Date(value.published_at).toISOString() : null;
|
|
44
|
+
return { version, published_at: date };
|
|
45
|
+
}
|
|
46
|
+
return async () => {
|
|
47
|
+
if (pending) return structuredClone(await pending);
|
|
48
|
+
const ttl = snapshot?.status === "checked" ? 5 * 60 * 1000 : 60 * 1000;
|
|
49
|
+
if (snapshot && now() - attemptedAt < ttl) return structuredClone(snapshot);
|
|
50
|
+
attemptedAt = now();
|
|
51
|
+
pending = (async () => {
|
|
52
|
+
try {
|
|
53
|
+
const fetchImpl = await fetchFactory();
|
|
54
|
+
const latest = await metadata(fetchImpl, "latest");
|
|
55
|
+
if (latest.version === currentVersion) currentDate = latest.published_at;
|
|
56
|
+
else if (!currentDate && stableVersion(currentVersion)) {
|
|
57
|
+
try { currentDate = (await metadata(fetchImpl, `tags/v${currentVersion}`, currentVersion)).published_at; } catch { /* The date can be unknown without hiding a verified newer release. */ }
|
|
58
|
+
}
|
|
59
|
+
snapshot = { source: "release_status", status: "checked", current: current(), latest,
|
|
60
|
+
update_available: isVersionGreater(latest.version, currentVersion), checked_at: new Date(now()).toISOString(), last_success_at: new Date(now()).toISOString() };
|
|
61
|
+
} catch (error) {
|
|
62
|
+
snapshot = { source: "release_status", status: error.code === "rate_limited" ? "rate_limited" : "unavailable", current: current(),
|
|
63
|
+
latest: snapshot?.latest || null, update_available: false, checked_at: new Date(now()).toISOString(), last_success_at: snapshot?.last_success_at || null };
|
|
64
|
+
}
|
|
65
|
+
return snapshot;
|
|
66
|
+
})();
|
|
67
|
+
try { return structuredClone(await pending); } finally { pending = null; }
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const dashboardUpdateStatus = createDashboardUpdateStatus();
|
package/src/dashboard.mjs
CHANGED
|
@@ -8,6 +8,7 @@ const ASSETS = new Map([
|
|
|
8
8
|
["/language.js", ["./dashboard/language.js", "text/javascript; charset=utf-8"]],
|
|
9
9
|
["/ui.js", ["./dashboard/ui.js", "text/javascript; charset=utf-8"]],
|
|
10
10
|
["/console.js", ["./dashboard/console.js", "text/javascript; charset=utf-8"]],
|
|
11
|
+
["/updates.js", ["./dashboard/updates.js", "text/javascript; charset=utf-8"]],
|
|
11
12
|
["/status.js", ["./dashboard/status.js", "text/javascript; charset=utf-8"]],
|
|
12
13
|
["/usage.js", ["./dashboard/usage.js", "text/javascript; charset=utf-8"]],
|
|
13
14
|
["/refresh.js", ["./dashboard/refresh.js", "text/javascript; charset=utf-8"]],
|
package/src/optional-routes.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/status.js", "/usage.js", "/ui.js", "/console.js"]);
|
|
2
|
-
export const DASHBOARD_API_PATHS = new Set(["/_ccdx/ui/animation", "/_ccdx/ui/models/live", "/_ccdx/ui/usage", "/_ccdx/ui/auth", "/_ccdx/ui/providers", "/_ccdx/ui/settings", "/_ccdx/ui/m365/accounts"]);
|
|
1
|
+
export const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/status.js", "/usage.js", "/ui.js", "/console.js", "/updates.js"]);
|
|
2
|
+
export const DASHBOARD_API_PATHS = new Set(["/_ccdx/ui/animation", "/_ccdx/ui/models/live", "/_ccdx/ui/usage", "/_ccdx/ui/auth", "/_ccdx/ui/providers", "/_ccdx/ui/settings", "/_ccdx/ui/m365/accounts", "/_ccdx/ui/updates"]);
|
|
3
3
|
|
|
4
4
|
export function isOptionalRoute(method, pathname) {
|
|
5
5
|
return DASHBOARD_API_PATHS.has(pathname) || pathname === "/mcp/image"
|