codex-copilot-dx 1.2.29 → 1.2.30
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 +4 -4
- package/bin/cli.mjs +1 -0
- package/docs/ARCHITECTURE.md +20 -3
- package/docs/REFERENCE.md +28 -6
- package/package.json +2 -1
- package/src/cli-options.mjs +1 -1
- package/src/cli-web.mjs +1 -0
- package/src/dashboard/ui.js +1 -0
- package/src/nightly-update.mjs +11 -4
- package/src/package-update.mjs +45 -14
- package/src/profile-model-runtime.mjs +9 -3
- package/src/provider-runtime.mjs +10 -2
- package/src/release-install.mjs +37 -10
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install -g codex-copilot-dx@latest
|
|
|
11
11
|
ccdx
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
14
|
+
No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.30/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.30/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. Manifest-listed complete packages install their bundled dependencies offline; older source-only releases need the configured registry. See [installation limits and private command paths](docs/REFERENCE.md#install-without-node-or-git).
|
|
15
15
|
|
|
16
16
|
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.
|
|
17
17
|
|
|
@@ -54,9 +54,9 @@ Requests shows live app/source/model flow above existing summaries and finished
|
|
|
54
54
|
|
|
55
55
|
Run `ccdx web` without GitHub sign-in. In **Model sources → Add API**, enter the HTTPS address/key, read the catalog, select models and declare their real interfaces. Then open **Codex** or **Claude**, choose visible models across sources, set a default and save. Claude App/Code use Messages; Codex uses Responses, all on port 2026. GitHub-only Codex selections retain native OpenAI mode and readable model names. Token counting is separate from message generation. For manual APIs, an observed count-endpoint 404 is remembered for one minute per model/API-header scope; CCDX returns a clear 404 without inventing a token count. Unknown count capabilities share their first admitted request; a 404 prevents distinct waiting inputs from fanning out. A supported endpoint still counts each distinct input separately. Identical small count requests share bounded work. A request stays on its selected deployment; there is no automatic cross-source retry or model replacement. Reopen clients after configuration changes. Claude App can continue an existing conversation on a different selected, authorized source when complete Messages history is available; unfinished tool turns, unavailable attachments and company-account isolation still apply. Codex and Claude Code retain their existing history rules. Stop management before normal `ccdx` startup for the live terminal.
|
|
56
56
|
|
|
57
|
-
Keys use system credential protection or an explicit environment reference; clients receive separate local credentials. Saving reads model metadata automatically, without inference. Startup and the existing model refresh cycle also refresh enabled APIs when the 30-minute cache expires; failed reads retain saved configuration. Selecting no models pauses access; enable a source and select models to resume. Closed sources can be restored on Model sources; closed apps remain reachable for restoration on their app pages. Pinned streams finish on their original source. The version-two graph preserves old single-source visibility and saves a byte-for-byte v1 backup before migration. User and managed client settings remain protected.
|
|
57
|
+
Keys use system credential protection or an explicit environment reference; clients receive separate local credentials. Saving reads model metadata automatically, without inference. Startup and the existing model refresh cycle also refresh enabled APIs when the 30-minute cache expires; failed reads retain saved configuration. Selecting no models pauses access; enable a source and select models to resume. Closed sources can be restored on Model sources; closed apps remain reachable for restoration on their app pages. Pinned streams finish on their original source. The version-two graph preserves old single-source visibility and saves a byte-for-byte v1 backup before migration. User and managed client settings remain protected. Refreshing GitHub models also updates Codex candidates without changing saved selections or native sign-in.
|
|
58
58
|
|
|
59
|
-
Model lists/details preserve the upstream maker declaration separately from your API source name. Missing maker metadata shows Not provided; model names are never used to guess a maker. Maker evidence is rebuildable display cache and does not change the strict connection schema or routing identity. Model details show upstream capabilities per API, with optional manual overrides collapsed below. Context, input/output limits, reasoning levels, thinking modes, input types, tools and native search are deployment-specific. Structured Anthropic declarations are mapped to Messages; they do not grant the same capabilities to a gateway's other interfaces. Missing and unrecognized metadata are distinguished, without guessing from model names. Manual overrides, including false, take priority. Claude synchronization projects compatible routes, supported host controls and per-model budgets. Unknown or out-of-range windows and unverified client versions are reported as limited; they are not promoted to 1M. Output requests are bounded by declared limits. Compatibility routes do not prove that every model supports every App tool, search or reasoning mode. See the [capability and synchronization limits](docs/REFERENCE.md#model-capabilities-and-claude-synchronization). [1.2.
|
|
59
|
+
Model lists/details preserve the upstream maker declaration separately from your API source name. Missing maker metadata shows Not provided; model names are never used to guess a maker. Maker evidence is rebuildable display cache and does not change the strict connection schema or routing identity. Model details show upstream capabilities per API, with optional manual overrides collapsed below. Context, input/output limits, reasoning levels, thinking modes, input types, tools and native search are deployment-specific. Structured Anthropic declarations are mapped to Messages; they do not grant the same capabilities to a gateway's other interfaces. Missing and unrecognized metadata are distinguished, without guessing from model names. Manual overrides, including false, take priority. Claude synchronization projects compatible routes, supported host controls and per-model budgets. Unknown or out-of-range windows and unverified client versions are reported as limited; they are not promoted to 1M. Output requests are bounded by declared limits. Compatibility routes do not prove that every model supports every App tool, search or reasoning mode. See the [capability and synchronization limits](docs/REFERENCE.md#model-capabilities-and-claude-synchronization). [1.2.30 changes and verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.30.md) cover shared GitHub model catalogs and the policy-preserving complete-package update fallback. Existing native Codex sign-in/model protections and the 1.2.27 context-preference fix remain included.
|
|
60
60
|
|
|
61
61
|
## Microsoft 365 access
|
|
62
62
|
|
|
@@ -111,7 +111,7 @@ See the [M365 reference](docs/REFERENCE.md#microsoft-365-provider) for ownership
|
|
|
111
111
|
|
|
112
112
|
Open `ccdx web` for source-specific account tools and Checks & repairs without signing in first. It starts a management-only service when needed; stop it before normal app startup. Safe reauth, config preview/backup, local reports, feature pause/resume and matching circle SVG status icons are described in the [account tools reference](docs/REFERENCE.md#account-and-repair-tools). Existing themes, layout and bilingual support are preserved. 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; failed checks remain unknown. The separate **Update overnight** switch defaults off and requires a normal CCDX restart after enabling. Its foreground supervisor checks during 00:00–04:00 local time after ten observed idle minutes, selects same-series stable patches at least 24 hours old, stages verified packages and attempts rollback on failure. Ctrl+C stops it; no OS service is installed. Review the displayed risk and [handoff limits](docs/REFERENCE.md#nightly-updates-opt-in) before enabling. See the [reference](docs/REFERENCE.md#version-and-update-information).
|
|
113
113
|
Settings → **Save & restore**, immediately after Version & updates, defaults to automatic saving of this page’s preferences. Turn it off to save or discard drafts manually. Restore defaults backs up the saved preferences first and offers Restore backup; it preserves accounts, keys, model/source selections, native sign-in, client connections, image/prediction access, chats and usage. Browser appearance stays browser-local; failed or conflicting saves retain the draft and show the actual result. See the [scope and recovery rules](docs/REFERENCE.md#settings-saving-and-restore).
|
|
114
|
-
GitHub updates verify
|
|
114
|
+
GitHub updates verify the exact Release without Git. Source packages use the configured npm registry; a confirmed EALLOWREMOTE restores the old package and permits one same-version complete platform package attempt offline. Nightly preparation shares this fallback. A blocked old updater can use the current verified bootstrap once. 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. Manual updates require a separate adapter restart. 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).
|
|
117
117
|
|
package/bin/cli.mjs
CHANGED
|
@@ -485,6 +485,7 @@ try {
|
|
|
485
485
|
log: (kind, message) => console.log(startupComplete ? status(kind, message) : startupCheck(kind, "Models", message)),
|
|
486
486
|
});
|
|
487
487
|
providerRuntime = createProviderRuntime({ githubClient: profileRuntime.codexClient, githubRegistry: profileModels.codexRegistry,
|
|
488
|
+
refreshGithubCatalog: () => profileModels.refreshCodex({ strict: true }),
|
|
488
489
|
corePort: ADAPTER_PORT, preserveClientConfiguration: () => serviceWorker?.preserving === true || serviceWorker?.draining === true,
|
|
489
490
|
clientAccessChanged: async enabled => { earlyIntegration.setPredictionActive(enabled && servicePreferences().prediction_enabled);if (enabled) await earlyIntegration.configure(); },
|
|
490
491
|
githubCredentialFingerprint: () => profileRuntime.codexCredentialFingerprint,
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -278,11 +278,26 @@ the installer, not an unrelated working project's `.npmrc`. It queries version,
|
|
|
278
278
|
Default installer argv preserves the saved download policy. The boolean
|
|
279
279
|
`--allow-remote` opt-in adds one fixed permission argument only when supported;
|
|
280
280
|
it applies to that installation's entire dependency tree, not selected hosts.
|
|
281
|
-
Unknown support fails before an explicitly requested override.
|
|
282
|
-
|
|
283
|
-
|
|
281
|
+
Unknown support fails before an explicitly requested override. npm stderr is
|
|
282
|
+
forwarded unchanged while a bounded scanner recognizes only EALLOWREMOTE.
|
|
283
|
+
A confirmed GitHub dependency-policy refusal rolls back the first installation,
|
|
284
|
+
then permits one same-version complete platform package attempt offline. Other
|
|
285
|
+
failures do not trigger a retry. There is no npm policy write or public-registry
|
|
286
|
+
fallback. Explicit npm-source updates retain their original source.
|
|
284
287
|
The source lock retains exact versions/integrities without binding smol-toml to a
|
|
285
288
|
developer's corporate feed; omitted registry resolution is delegated to npm.
|
|
289
|
+
|
|
290
|
+
`release-install.mjs` owns complete-asset names, platform selection and bounded
|
|
291
|
+
SHA-256/version/target/bundled-root validation. Manual GitHub updates and nightly
|
|
292
|
+
candidate preparation reuse this contract. Complete installs disable network
|
|
293
|
+
dependency resolution and scripts; existing installation protection and native
|
|
294
|
+
runtime verification remain required. Bootstrap prefers a manifest-listed complete
|
|
295
|
+
asset and retains the old path for source-only releases. `runtime-package.mjs`
|
|
296
|
+
builds each complete package from the exact standard source tarball plus its
|
|
297
|
+
locked runtime dependencies, pruning only unrelated Broker OS/architecture files.
|
|
298
|
+
The npm artifact remains unchanged in form. Native target CI installs complete
|
|
299
|
+
packages using empty caches and strict npm12 offline policy. No runtime component
|
|
300
|
+
cache, new loader, inference route or background process is introduced.
|
|
286
301
|
Readonly update preflight reports Node/npm, the running package and npm's selected
|
|
287
302
|
global target. A different target warns, but never changes PATH or prefix. Its
|
|
288
303
|
bounded npm probe is limited to explicit update/full doctor commands and opted-in supervisor startup, never inference.
|
|
@@ -731,6 +746,8 @@ No new polling, framework, runtime dependency, setting or endpoint is introduced
|
|
|
731
746
|
|
|
732
747
|
## Catalog transactions and default identity (1.2.20)
|
|
733
748
|
|
|
749
|
+
GitHub dashboard catalog reads use the existing `profile-model-runtime.mjs` single-flight through an injected refresh callback, rather than a second independent directory request. Successful publication updates the shared provider registry/endpoint cache, and the dashboard rereads connection candidates while preserving drafts. Explicit reads report refresh failures instead of presenting the last-good fallback as fresh success. Credential changes during a read reject publication; catalog browsing never synchronizes client files or changes selected deployments, defaults, grants or native authentication.
|
|
750
|
+
|
|
734
751
|
`api-catalog-refresh.mjs` owns bounded catalog I/O, same-source single-flight,
|
|
735
752
|
existing success/failure cooldowns, cancellation and deployment-version checks.
|
|
736
753
|
It receives source/config/commit callbacks; it does not write configuration or
|
package/docs/REFERENCE.md
CHANGED
|
@@ -149,6 +149,8 @@ Temporarily unavailable selected models remain visible in the application editor
|
|
|
149
149
|
Saving them fails without changing prior settings; refresh the catalog or explicitly
|
|
150
150
|
clear the affected selection. A missing directory entry never means deselection.
|
|
151
151
|
|
|
152
|
+
GitHub catalog reads in Model sources share the running model registry and endpoint cache with Codex. A successful read updates available candidates without selecting new models, changing defaults or rewriting client files. Concurrent reads join one refresh. An explicit failed refresh remains an error while the prior catalog is retained; an account change during the read prevents publication under the new identity.
|
|
153
|
+
|
|
152
154
|
A manual Codex provider includes an authenticated `model_catalog_url` on the same
|
|
153
155
|
listener. Native app-server catalogs list configured names; the App may still use
|
|
154
156
|
its custom-provider UI for non-GitHub selections. Unknown names
|
|
@@ -1183,7 +1185,7 @@ Opening Settings reads `GET /_ccdx/ui/updates`, protected by the existing loopba
|
|
|
1183
1185
|
|
|
1184
1186
|
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.
|
|
1185
1187
|
|
|
1186
|
-
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.
|
|
1188
|
+
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. The current installer prefers a complete platform package and installs it offline; source-only old releases require the configured registry.
|
|
1187
1189
|
|
|
1188
1190
|
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.
|
|
1189
1191
|
|
|
@@ -1279,7 +1281,7 @@ channel or automatically grants remote-download permission. Each asset has a
|
|
|
1279
1281
|
60-second download deadline and bounded size (64 KiB manifest, 16 MiB package,
|
|
1280
1282
|
64 MiB decompressed metadata scan). The checksum comes from the same HTTPS
|
|
1281
1283
|
release; it detects corrupt/mismatched files and is not a separate signature.
|
|
1282
|
-
|
|
1284
|
+
Source packages use npm's configured registry, including a company mirror. A confirmed EALLOWREMOTE in a GitHub update permits one verified complete-package attempt offline, without changing that registry or policy.
|
|
1283
1285
|
This is not a fully offline or registry-free distribution.
|
|
1284
1286
|
|
|
1285
1287
|
Windows runs `npm.cmd` through system `cmd.exe` with AutoRun and delayed expansion
|
|
@@ -1320,8 +1322,17 @@ installs `codex-copilot-dx@latest`; it never silently switches to GitHub.
|
|
|
1320
1322
|
npm policy is read using bounded named global fields, without printing credentials.
|
|
1321
1323
|
An unrelated project's `.npmrc` cannot grant permission. npm 12's
|
|
1322
1324
|
`allow-remote=none` can reject a mirror's cross-origin dependency URL with
|
|
1323
|
-
`EALLOWREMOTE`.
|
|
1324
|
-
|
|
1325
|
+
`EALLOWREMOTE`. GitHub updates restore the previous package, then try one
|
|
1326
|
+
same-version complete platform package from the official Release. Its SHA-256,
|
|
1327
|
+
version, platform marker and bundled dependency declaration must validate before
|
|
1328
|
+
an offline installation. Missing/corrupt complete assets stop the fallback;
|
|
1329
|
+
authentication, integrity and other npm errors do not trigger it. Nightly updates
|
|
1330
|
+
perform this fallback in their candidate directory before any service handoff.
|
|
1331
|
+
No registry, proxy, CA, download permission or saved client selection is changed.
|
|
1332
|
+
Explicit npm-source updates keep their selected source and do not silently use GitHub.
|
|
1333
|
+
|
|
1334
|
+
If the complete package is unavailable, only if company policy permits and you
|
|
1335
|
+
trust this entire package tree, use the explicit one-install exception:
|
|
1325
1336
|
|
|
1326
1337
|
```sh
|
|
1327
1338
|
ccdx update github --allow-remote
|
|
@@ -1329,14 +1340,14 @@ ccdx update npm --allow-remote
|
|
|
1329
1340
|
```
|
|
1330
1341
|
|
|
1331
1342
|
This grants URL downloads throughout that installation's dependency tree, not a
|
|
1332
|
-
hostname allowlist. It does not change `.npmrc`, add
|
|
1343
|
+
hostname allowlist. It does not change `.npmrc`, add further retries, allow every script
|
|
1333
1344
|
or override other administrator policy. Older npm receives no unsupported flag.
|
|
1334
1345
|
Unknown support prevents an explicitly requested exception from starting.
|
|
1335
1346
|
|
|
1336
1347
|
For an older updater that still requires Git, install the Release tarball directly:
|
|
1337
1348
|
|
|
1338
1349
|
```sh
|
|
1339
|
-
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
1350
|
+
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.30/codex-copilot-dx-1.2.30.tgz
|
|
1340
1351
|
# Windows PowerShell: use npm.cmd instead of npm.
|
|
1341
1352
|
```
|
|
1342
1353
|
|
|
@@ -1397,6 +1408,17 @@ choose a writable prefix without `%` using `npm_config_prefix`. Unicode, spaces,
|
|
|
1397
1408
|
an additional native executable just to bypass the shell's path parsing.
|
|
1398
1409
|
No install hook is added to the npm package.
|
|
1399
1410
|
|
|
1411
|
+
The current verified bootstrap chooses a complete platform package when the
|
|
1412
|
+
Release manifest contains one, then installs it offline with scripts disabled.
|
|
1413
|
+
Source-only old releases retain the previous registry-based path. Complete packs
|
|
1414
|
+
are separate from the lightweight npm artifact and contain the locked runtime
|
|
1415
|
+
dependency closure, including the applicable sharp/libvips and Broker files.
|
|
1416
|
+
Supported complete targets are macOS/Windows x64 and ARM64, and Linux x64/ARM64
|
|
1417
|
+
with glibc or musl. Selection follows the running Node architecture. Other Node
|
|
1418
|
+
platforms retain the source installation path without claiming a complete package.
|
|
1419
|
+
An old 1.2.29 updater does not learn this fallback until updated; use the current verified
|
|
1420
|
+
bootstrap once when the old path cannot install under its saved npm policy.
|
|
1421
|
+
|
|
1400
1422
|
The scripts accept only `sh install.sh [--allow-remote]` or
|
|
1401
1423
|
`./install.ps1 [-AllowRemote]`; the permission is explicit and applies to that
|
|
1402
1424
|
one installation, with the same whole-tree meaning described above. Do not use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-copilot-dx",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.30",
|
|
4
4
|
"description": "Local gateway for Codex and Claude with Copilot, Microsoft 365 and custom APIs",
|
|
5
5
|
"author": "Dale Xiao",
|
|
6
6
|
"type": "module",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"verify": "npm test && npm run test:smoke && npm run bench:check && npm run pack:check",
|
|
52
52
|
"prepublishOnly": "npm run verify",
|
|
53
53
|
"release:pack": "node scripts/release-artifacts.mjs",
|
|
54
|
+
"release:runtime": "node scripts/runtime-package.mjs",
|
|
54
55
|
"test:release-network": "node scripts/release-network-replay.mjs"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
package/src/cli-options.mjs
CHANGED
|
@@ -423,7 +423,7 @@ function topicHelp(name, topic) {
|
|
|
423
423
|
"suggestion": `The CCDX prediction panel has been retired. Run ${name} suggestion off to safely remove unchanged CCDX registrations. This cleanup does not change native predictions; see ${name} prediction --help for that separate opt-in feature.`,
|
|
424
424
|
m365: `Usage:\n ${name} m365 [status|models|accounts|account|on|off|remove]\n ${name} m365 account [--id ID]\n ${name} m365 switch [github|m365] [--model ID] [--auto-review-model ID]\n\n- M365 is discovered silently at startup on supported managed environments.\n- accounts lists local company accounts without requesting tokens.\n- account chooses a company account; --id supports scripts. A running updated service is required.\n- Saved bindings stay selected. Otherwise an exact Windows sign-in match, then a single company account, is used.\n- Changing accounts applies to M365 in Codex and Claude; start a new conversation.\n- Claude uses /anthropic on the same local port.\n- Codex stays on GitHub unless you explicitly switch.\n- M365 switching requires a running compatible adapter and available GPT/Auto-review choices; it never substitutes unavailable models.\n- Select an available model in Codex after switching an existing thread.\n- Off restores only owned Claude settings and selects GitHub.\n- Remove also clears the CCDX M365 profile, retaining a disabled preference and historical usage.\n- System Microsoft sign-in, GitHub credentials, predictions and images are preserved.`,
|
|
425
425
|
prediction: `Usage:\n ${name} prediction [status|on|off|fix|pause|resume]\n\n- Pause/resume only pauses adaptation; trust and route setup are kept.\n- Resume does not activate a feature that has not been set up.\n- Optional native next-message predictions; off by default. macOS and Windows.\n- Windows requires the registered official MSIX App, an initialized profile, Windows PowerShell and .NET Framework 4.7.2+; Git/OpenSSL is not required for prediction setup.\n- Quit Codex before on/off, then restart ccdx.\n- On adds private App-profile certificate trust and an App-only route for chatgpt.com and ab.chatgpt.com.\n- HTTPS on those hosts is decrypted locally; only prediction configuration is changed.\n- No client program files, OS trust, account permissions, MCP or Hooks are changed.\n- Static HTTP/HTTPS/SOCKS5 proxies and bypass rules are preserved.\n- Windows supports company PAC/WPAD; macOS dynamic PAC/WPAD remains unsupported.\n- Static IPv4/IPv6 CIDRs match URL IP literals without DNS.\n- The bridge port persists across restarts/updates; a busy saved port disables only predictions.\n- Launch/reuse checks the App's actual route; an older random or missing route may require one full App quit.\n- Official prediction configuration is preserved; the conversation's model is used.\n- App updates require another compatibility check.\n- Status distinguishes saved preference and observed config traffic from unverified candidate visibility.\n- Fix asks a compatible running CCDX adapter to repair the enabled bridge once on its saved port.\n- It never enables predictions, renews certificates or force-restarts Codex.\n- Healthy unchanged bridges are retained.\n- Fix rechecks system proxy settings.\n- Changed routes may need a normal App relaunch to reload cached PAC; failed rechecks preserve the previous bridge with a nonzero exit.\n- Process environment variables and Node trust are not hot-reloaded; changed trust inputs need a CCDX service restart.\n- Startup, status and doctor share sanitized environment diagnostics.\n- Missing App routes require a normal full quit and ccdx launch; partial repair exits 1.\n- An older adapter must first be upgraded and restarted once to gain this repair endpoint.`,
|
|
426
|
-
update: `Usage:\n ${name} update [npm|github] [--allow-remote]\n\n- Updates the global package from the configured npm registry or the latest stable GitHub release.\n- With no source, an interactive terminal prompts for one.\n- Windows uses system cmd.exe to run npm.cmd without changing PowerShell policy; use the .cmd entrypoint if scripts are blocked.\n- GitHub verifies a Release tarball; Git is not required. Dependencies use the configured npm registry.\n- By default npm's remote-download policy is preserved.\n- If npm reports EALLOWREMOTE for a trusted mirror tarball, --allow-remote explicitly permits URL dependencies for this one installation's entire dependency tree; it is not a hostname allowlist.\n- No .npmrc, registry or persistent policy is changed
|
|
426
|
+
update: `Usage:\n ${name} update [npm|github] [--allow-remote]\n\n- Updates the global package from the configured npm registry or the latest stable GitHub release.\n- With no source, an interactive terminal prompts for one.\n- Windows uses system cmd.exe to run npm.cmd without changing PowerShell policy; use the .cmd entrypoint if scripts are blocked.\n- GitHub verifies a Release tarball; Git is not required. Dependencies use the configured npm registry.\n- By default npm's remote-download policy is preserved.\n- If npm reports EALLOWREMOTE for a trusted mirror tarball, --allow-remote explicitly permits URL dependencies for this one installation's entire dependency tree; it is not a hostname allowlist.\n- No .npmrc, registry or persistent policy is changed. GitHub updates retry once offline with a verified same-version platform package only after EALLOWREMOTE; other errors are not retried.\n- Use this only if company policy permits it.\n- Restart the running adapter after installation.`,
|
|
427
427
|
version: `Usage:\n ${name} --version`,
|
|
428
428
|
};
|
|
429
429
|
return sections[topic];
|
package/src/cli-web.mjs
CHANGED
|
@@ -19,6 +19,7 @@ export async function runWebCommand({ host = "127.0.0.1", port = 2026, env = pro
|
|
|
19
19
|
let profile = createProfileRuntime({ home, codexClient: defaultCopilotClient });
|
|
20
20
|
const models = createProfileModelRuntime({ home, env, codexClient: defaultCopilotClient, codexCredentialFingerprint: () => profile.codexCredentialFingerprint });
|
|
21
21
|
const providers = createProviderRuntime({ home, env, corePort: port, githubClient: defaultCopilotClient,
|
|
22
|
+
refreshGithubCatalog: () => models.refreshCodex({ strict: true }),
|
|
22
23
|
githubRegistry: models.codexRegistry, githubClientConfigured: false, githubCredentialFingerprint: () => profile.codexCredentialFingerprint });
|
|
23
24
|
const serviceControl = createServiceControl({ home, env, providerRuntime: providers });
|
|
24
25
|
const server = await startAdapter(port, host, { providerRuntime: providers, codexModelRegistry: models.codexRegistry,
|
package/src/dashboard/ui.js
CHANGED
|
@@ -193,6 +193,7 @@ function catalogReadDetails(data) {
|
|
|
193
193
|
}
|
|
194
194
|
function applyModels(data, { changed }) {
|
|
195
195
|
modelSnapshots.set(data.provider || selectedProvider, data);
|
|
196
|
+
if (changed) void globalThis.ccdxConnections?.load?.();
|
|
196
197
|
if (data.provider && data.provider !== selectedProvider) return;
|
|
197
198
|
if (changed) {
|
|
198
199
|
const body = element("live-models-body");
|
package/src/nightly-update.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { execFile } from 'node:child_process';
|
|
5
5
|
import { promisify } from 'node:util';
|
|
6
6
|
import { inspectPackageUpdateEnvironment } from './package-update.mjs';
|
|
7
|
-
import { downloadRelease, createNpmReleaseFetch, protectInstallation, stableVersion, writePrivateLaunchers, privateUnixLauncher } from './release-install.mjs';
|
|
7
|
+
import { downloadRelease, createNpmReleaseFetch, protectInstallation, stableVersion, writePrivateLaunchers, privateUnixLauncher, remoteDownloadDenied } from './release-install.mjs';
|
|
8
8
|
import { inspectWindowsCommand } from './windows-command.mjs';
|
|
9
9
|
import { isVersionGreater } from './version.mjs';
|
|
10
10
|
import { readBoundedResponseText } from './upstream-body.mjs';
|
|
@@ -64,15 +64,22 @@ export async function prepareNightlyRelease(release, { environment, root=nightly
|
|
|
64
64
|
const target=path.join(directory,...(process.platform==='win32'?[]:['lib']),'node_modules/codex-copilot-dx');
|
|
65
65
|
const brokerRequired=fs.existsSync(path.join(environment.target,'node_modules/@azure/msal-node-runtime'));
|
|
66
66
|
try {
|
|
67
|
-
|
|
67
|
+
let artifact=await downloadRelease(version,{directory,fetchImpl,signal});
|
|
68
68
|
const args=['install','--global','--ignore-scripts','--no-audit','--no-fund'];
|
|
69
|
-
|
|
69
|
+
const installArgs=()=>[...args,...(artifact.complete?['--offline']:[])];
|
|
70
|
+
try { await execute(process.execPath,[environment.npmCli,...installArgs(),'--prefix',directory,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true}); }
|
|
71
|
+
catch(error) {
|
|
72
|
+
if(!remoteDownloadDenied(error)||signal?.aborted)throw error;
|
|
73
|
+
artifact=await downloadRelease(version,{directory,fetchImpl,signal,complete:true});
|
|
74
|
+
fs.rmSync(target,{recursive:true,force:true});
|
|
75
|
+
await execute(process.execPath,[environment.npmCli,...installArgs(),'--prefix',directory,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true});
|
|
76
|
+
}
|
|
70
77
|
await verify(target,version,{signal,brokerRequired});
|
|
71
78
|
return { version, target, directory,
|
|
72
79
|
async install() {
|
|
73
80
|
signal?.throwIfAborted();const transaction=protectInstallation(environment);
|
|
74
81
|
try {
|
|
75
|
-
await execute(process.execPath,[environment.npmCli,...
|
|
82
|
+
await execute(process.execPath,[environment.npmCli,...installArgs(),'--prefix',environment.prefix,artifact.file],{env,signal,timeout:300000,maxBuffer:128*1024,windowsHide:true});
|
|
76
83
|
await verify(environment.target,version,{signal,brokerRequired});
|
|
77
84
|
const normalize=value=>process.platform==='win32'?path.resolve(value).toLowerCase():path.resolve(value);
|
|
78
85
|
if(env.CCDX_PRIVATE_INSTALL_PREFIX&&normalize(env.CCDX_PRIVATE_INSTALL_PREFIX)===normalize(environment.prefix))await writePrivateLaunchers(environment);
|
package/src/package-update.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { spawn, execFileSync } from "node:child_process";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import os from "node:os";
|
|
4
|
-
import { downloadRelease, protectInstallation, verifyPackageRuntime, writePrivateLaunchers, createNpmReleaseFetch } from "./release-install.mjs";
|
|
4
|
+
import { downloadRelease, protectInstallation, verifyPackageRuntime, writePrivateLaunchers, createNpmReleaseFetch, remoteDownloadDenied } from "./release-install.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createInterface } from "node:readline/promises";
|
|
@@ -77,16 +77,20 @@ export function inspectNpmDownloadPolicy({ env = process.env, platform = process
|
|
|
77
77
|
return result;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export function globalUpdateCommand(source, { platform = process.platform, releaseTag, releaseFile, allowRemote = false } = {}) {
|
|
80
|
+
export function globalUpdateCommand(source, { platform = process.platform, releaseTag, releaseFile, allowRemote = false, complete = false } = {}) {
|
|
81
81
|
if (typeof allowRemote !== "boolean") throw new Error("Remote download permission must be a boolean");
|
|
82
|
+
if (typeof complete !== "boolean") throw new Error("Complete-package selection must be a boolean");
|
|
82
83
|
const normalized = normalizeUpdateSource(source);
|
|
83
84
|
if (!normalized) throw new Error(`Choose npm or github. Received: ${source}`);
|
|
84
85
|
const args = ["install", "--global"];
|
|
85
86
|
if (allowRemote) args.push("--allow-remote=all");
|
|
87
|
+
if (complete) args.push("--offline", "--ignore-scripts", "--no-audit", "--no-fund");
|
|
86
88
|
if (normalized === "github") {
|
|
87
89
|
if (!githubReleaseVersion(releaseTag)) throw new Error("A valid stable GitHub release tag is required");
|
|
88
90
|
const version = githubReleaseVersion(releaseTag), name = `codex-copilot-dx-${version}.tgz`;
|
|
89
|
-
|
|
91
|
+
const runtimeNames = ["darwin-x64", "darwin-arm64", "win32-x64", "win32-arm64", "linux-x64-glibc", "linux-arm64-glibc", "linux-x64-musl", "linux-arm64-musl"]
|
|
92
|
+
.map(target => `./codex-copilot-dx-${version}-${target}.tgz`);
|
|
93
|
+
if (releaseFile !== undefined && releaseFile !== `./${name}` && !(complete && runtimeNames.includes(releaseFile))) throw new Error("Invalid verified release filename");
|
|
90
94
|
args.push(releaseFile || `${UPDATE_SPECS.github}/v${version}/${name}`);
|
|
91
95
|
} else {
|
|
92
96
|
args.push(UPDATE_SPECS[normalized]);
|
|
@@ -100,17 +104,29 @@ export function globalUpdateCommand(source, { platform = process.platform, relea
|
|
|
100
104
|
|
|
101
105
|
function waitForExit(child) {
|
|
102
106
|
return new Promise((resolve, reject) => {
|
|
103
|
-
let settled = false;
|
|
107
|
+
let settled = false, exited = false, ended = !child.stderr, failure, tail = "", denied = false;
|
|
104
108
|
const finish = (handler, value) => {
|
|
105
109
|
if (settled) return;
|
|
106
110
|
settled = true;
|
|
107
111
|
handler(value);
|
|
108
112
|
};
|
|
113
|
+
const complete = () => { if (exited && ended) {
|
|
114
|
+
if (failure) { if (denied) failure.npmCode = "EALLOWREMOTE";finish(reject, failure); }
|
|
115
|
+
else finish(resolve);
|
|
116
|
+
} };
|
|
117
|
+
child.stderr?.on("data", bytes => {
|
|
118
|
+
process.stderr.write(bytes);const text = tail + bytes.toString();
|
|
119
|
+
if (/npm (?:error|ERR!) code EALLOWREMOTE\b/.test(text)) denied = true;
|
|
120
|
+
tail = text.slice(-64);
|
|
121
|
+
});
|
|
122
|
+
const end = () => { ended = true;complete(); };
|
|
123
|
+
child.stderr?.once("end", end);child.stderr?.once("close", end);child.stderr?.once("error", end);
|
|
109
124
|
child.once("error", (error) => finish(reject, error));
|
|
110
125
|
child.once("exit", (code, signal) => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
else
|
|
126
|
+
exited = true;
|
|
127
|
+
if (signal) failure = new Error(`npm update was interrupted by ${signal}`);
|
|
128
|
+
else if (code !== 0) failure = Object.assign(new Error(`npm update exited with status ${code}`), { npmExitCode: code });
|
|
129
|
+
complete();
|
|
114
130
|
});
|
|
115
131
|
});
|
|
116
132
|
}
|
|
@@ -203,7 +219,6 @@ export async function runPackageUpdateCommand({
|
|
|
203
219
|
output.write("Release package verified; Git is not required. Dependencies use the configured npm registry.\n");
|
|
204
220
|
}
|
|
205
221
|
try {
|
|
206
|
-
const update = globalUpdateCommand(selectedSource, { platform, releaseTag: release?.tagName, releaseFile: artifact ? `./${artifact.name}` : undefined, allowRemote: permitRemote });
|
|
207
222
|
const sourceLabel = selectedSource === "npm" ? "npm registry" : `GitHub release ${release.tagName}`;
|
|
208
223
|
output.write(`Updating ${PACKAGE_NAME} from ${sourceLabel}...\n`);
|
|
209
224
|
if (policy.allowRemote) output.write(`npm ${terminalCell(policy.version)}: saved allow-remote=${policy.allowRemote}${policy.registryOrigin ? `; registry ${terminalCell(policy.registryOrigin)}` : ""}.\n`);
|
|
@@ -214,30 +229,46 @@ export async function runPackageUpdateCommand({
|
|
|
214
229
|
}
|
|
215
230
|
// The verified tarball basename is fixed and safe for cmd.exe. Its directory
|
|
216
231
|
// is passed as cwd, never interpolated into the Windows command string.
|
|
217
|
-
const launch = npmLaunch(update.args, { platform, env });
|
|
218
232
|
const brokerRequired = Boolean(environment?.target && fs.existsSync(path.join(environment.target, "node_modules", "@azure", "msal-node-runtime")));
|
|
233
|
+
const install = async item => {
|
|
234
|
+
const update = globalUpdateCommand(selectedSource, { platform, releaseTag: release?.tagName,
|
|
235
|
+
releaseFile: item ? `./${item.name}` : undefined, allowRemote: permitRemote && !item?.complete, complete: item?.complete === true });
|
|
236
|
+
const launch = npmLaunch(update.args, { platform, env });
|
|
219
237
|
const transaction = protectInstallationFn({ ...environment, platform });
|
|
220
|
-
let
|
|
238
|
+
let version;
|
|
221
239
|
try {
|
|
222
240
|
const child = spawnImpl(launch.command, launch.args, {
|
|
223
241
|
env,
|
|
224
242
|
...(directory ? { cwd: directory } : {}),
|
|
225
243
|
shell: false,
|
|
226
|
-
stdio: "inherit",
|
|
244
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
227
245
|
...launch.options,
|
|
228
246
|
});
|
|
229
247
|
try { await waitForExit(child); }
|
|
230
248
|
catch (error) {
|
|
231
249
|
if (Number.isInteger(error.npmExitCode) && !allowRemote && ["none", "root"].includes(policy.allowRemote)) {
|
|
232
|
-
error.message += `. npm allow-remote=${policy.allowRemote} was preserved. If npm reported EALLOWREMOTE, its registry/mirror tarball URL was refused; only if you trust this update and policy permits it, retry explicitly with ${terminalCell(commandName)} update ${selectedSource} --allow-remote. This grants URL downloads to this installation's dependency tree, not just one hostname. No
|
|
250
|
+
error.message += `. npm allow-remote=${policy.allowRemote} was preserved. If npm reported EALLOWREMOTE, its registry/mirror tarball URL was refused; only if you trust this update and policy permits it, retry explicitly with ${terminalCell(commandName)} update ${selectedSource} --allow-remote. This grants URL downloads to this installation's dependency tree, not just one hostname. No permission or config change was made.`;
|
|
233
251
|
}
|
|
234
252
|
throw error;
|
|
235
253
|
}
|
|
236
|
-
|
|
237
|
-
if (environment?.target &&
|
|
254
|
+
version = verifyInstalledFn(environment?.target, { expectedVersion: release?.version });
|
|
255
|
+
if (environment?.target && version) verifyRuntimeFn(environment.target, version, { brokerRequired });
|
|
238
256
|
if (env.CCDX_PRIVATE_INSTALL_PREFIX && environment?.prefix && (platform === "win32" ? path.win32.resolve(env.CCDX_PRIVATE_INSTALL_PREFIX).toLowerCase() === path.win32.resolve(environment.prefix).toLowerCase() : path.resolve(env.CCDX_PRIVATE_INSTALL_PREFIX) === path.resolve(environment.prefix))) await writePrivateLaunchers(environment);
|
|
239
257
|
transaction.commit();
|
|
258
|
+
return version;
|
|
240
259
|
} catch (error) { transaction.rollback();throw error; }
|
|
260
|
+
};
|
|
261
|
+
let installedVersion;
|
|
262
|
+
try { installedVersion = await install(artifact); }
|
|
263
|
+
catch (error) {
|
|
264
|
+
if (selectedSource !== "github" || allowRemote || !remoteDownloadDenied(error)) throw error;
|
|
265
|
+
output.write("npm refused a remote dependency. Previous installation restored; checking the same version's complete platform package.\n");
|
|
266
|
+
try { artifact = await downloadReleaseFn(release.tagName, { fetchImpl, directory, complete: true, platform }); }
|
|
267
|
+
catch (fallbackError) { error.message += ` Complete platform package unavailable: ${fallbackError.message}`;throw error; }
|
|
268
|
+
if (!artifact.complete) throw new Error("The fallback is not a verified complete platform package; no second installation was started");
|
|
269
|
+
output.write("Complete platform package verified; installing offline with the saved npm policy.\n");
|
|
270
|
+
installedVersion = await install(artifact);
|
|
271
|
+
}
|
|
241
272
|
if (installedVersion) {
|
|
242
273
|
output.write(`Updated ${PACKAGE_NAME}: installed v${terminalCell(installedVersion)} at ${terminalCell(environment.target)}.\n`);
|
|
243
274
|
if (platform === "win32") {
|
|
@@ -148,9 +148,11 @@ export function createProfileModelRuntime({
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
async function performRefresh(generation) {
|
|
151
|
+
const fingerprint = credentialFingerprint();
|
|
151
152
|
try {
|
|
152
153
|
const models = await requestCatalog();
|
|
153
154
|
if (refreshGeneration !== generation) return codexRegistry.models;
|
|
155
|
+
if (fingerprint !== credentialFingerprint()) throw new Error("GitHub account changed during model refresh; the previous catalog was preserved");
|
|
154
156
|
checkCatalog(models);
|
|
155
157
|
applyCatalog(models, "live");
|
|
156
158
|
persist(models, generation);
|
|
@@ -173,8 +175,12 @@ export function createProfileModelRuntime({
|
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
function refreshCodex() {
|
|
177
|
-
|
|
178
|
+
function refreshCodex({ strict = false } = {}) {
|
|
179
|
+
const result = flight => strict ? flight.then(models => {
|
|
180
|
+
if (codexRegistry.lastError || !isValidModelList(models)) throw new Error(codexRegistry.lastError || "GitHub model catalog is unavailable");
|
|
181
|
+
return models;
|
|
182
|
+
}) : flight;
|
|
183
|
+
if (refreshFlight) return result(refreshFlight);
|
|
178
184
|
const generation = refreshGeneration + 1;
|
|
179
185
|
refreshGeneration = generation;
|
|
180
186
|
codexRegistry.generation = generation;
|
|
@@ -184,7 +190,7 @@ export function createProfileModelRuntime({
|
|
|
184
190
|
if (refreshGeneration === generation) codexRegistry.refreshInFlight = false;
|
|
185
191
|
});
|
|
186
192
|
refreshFlight = flight;
|
|
187
|
-
return flight;
|
|
193
|
+
return result(flight);
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
async function initialize() {
|
package/src/provider-runtime.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { providerDescriptors } from "./provider-descriptors.mjs";
|
|
|
3
3
|
import { autoReviewPreference, writeAutoReviewModel } from "./user-settings.mjs";
|
|
4
4
|
import { autoReviewReasoningEfforts, DEFAULT_CODEX_AUTO_REVIEW_MODEL, responsesModelIdsFromCopilotModels } from "./models.mjs";
|
|
5
5
|
import { publicModelCatalog } from "./provider-metadata.mjs";
|
|
6
|
+
import { selectableCopilotModels } from "./live-models.mjs";
|
|
6
7
|
import { createGithubProvider } from "./providers/github.mjs";
|
|
7
8
|
import { readProviderSettings, writeProviderSettings } from "./provider-settings.mjs";
|
|
8
9
|
import { readM365Settings, updateM365Settings, m365Paths, ensureM365GatewayKey, readM365Account, m365AccountKey } from "./m365-settings.mjs";
|
|
@@ -30,7 +31,7 @@ export function createProviderRuntime(options = {}) {
|
|
|
30
31
|
connections = createConnectionRuntime({ ...options, legacy });return connections;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
function createBuiltinProviderRuntime({ githubClient, githubRegistry, githubCredentialFingerprint = "", githubClientConfigured = true, home, env = process.env, platform = process.platform,
|
|
34
|
+
function createBuiltinProviderRuntime({ githubClient, githubRegistry, refreshGithubCatalog, githubCredentialFingerprint = "", githubClientConfigured = true, home, env = process.env, platform = process.platform,
|
|
34
35
|
corePort = Number(env.ADAPTER_PORT || 2026), log = () => {}, createM365, startGateway, configureClients, restoreClients,
|
|
35
36
|
discoverM365 = requestM365Accounts, managedClaude, onClaudeReady, preserveClientConfiguration } = {}) {
|
|
36
37
|
const options = { home, env, platform }, github = { ...createGithubProvider({ client: githubClient,
|
|
@@ -243,7 +244,14 @@ function createBuiltinProviderRuntime({ githubClient, githubRegistry, githubCred
|
|
|
243
244
|
definitions: providerRegistry.list() });
|
|
244
245
|
},
|
|
245
246
|
async dashboardCatalog({ provider = selection.codex } = {}) {
|
|
246
|
-
if (provider === "github")
|
|
247
|
+
if (provider === "github") {
|
|
248
|
+
if (!refreshGithubCatalog) return null;
|
|
249
|
+
const catalog = await refreshGithubCatalog();
|
|
250
|
+
const selected = new Set(selectableCopilotModels(catalog).models.map(model => model.id));
|
|
251
|
+
const upstreamHost = githubClient.runtimeStatus?.().upstream_host;
|
|
252
|
+
return { source: "live", checkedAt: new Date().toISOString(), upstreamHost: upstreamHost && upstreamHost !== "unknown" ? upstreamHost : "GitHub Copilot", advertised: catalog.data.length,
|
|
253
|
+
models: publicModelCatalog(catalog.data, { selectable: model => selected.has(model.id), clients: model => selected.has(model.id) ? ["codex"] : [] }) };
|
|
254
|
+
}
|
|
247
255
|
if (provider !== "m365") throw Object.assign(new Error("Unknown provider"), { statusCode: 400 });
|
|
248
256
|
if (!enabled || !["darwin", "win32"].includes(platform)) throw unavailable(!enabled ? "m365_disabled" : "m365_unsupported");
|
|
249
257
|
if (!m365) throw unavailable(reason || "m365_not_ready");
|
package/src/release-install.mjs
CHANGED
|
@@ -66,8 +66,8 @@ export function releaseChecksum(manifest, name) {
|
|
|
66
66
|
if (lines.length !== 1 || !/^[a-f0-9]{64} [\w.-]+$/.test(lines[0])) throw new Error("Release checksum is missing or invalid");
|
|
67
67
|
return lines[0].slice(0, 64);
|
|
68
68
|
}
|
|
69
|
-
export function packageMetadata(bytes) {
|
|
70
|
-
const tar = gunzipSync(bytes, { maxOutputLength: 64 * 1024 * 1024 });
|
|
69
|
+
export function packageMetadata(bytes, { complete = false } = {}) {
|
|
70
|
+
const tar = gunzipSync(bytes, { maxOutputLength: (complete ? 256 : 64) * 1024 * 1024 });
|
|
71
71
|
let metadata;
|
|
72
72
|
for (let offset = 0; offset + 512 <= tar.length;) {
|
|
73
73
|
const header = tar.subarray(offset, offset + 512), name = header.subarray(0, 100).toString().replace(/\0.*$/s, "");
|
|
@@ -85,15 +85,41 @@ export function packageMetadata(bytes) {
|
|
|
85
85
|
if (metadata?.name !== "codex-copilot-dx" || !stableVersion(metadata.version)) throw new Error("Release package identity is invalid");
|
|
86
86
|
return metadata;
|
|
87
87
|
}
|
|
88
|
-
export
|
|
88
|
+
export function runtimeReleaseTarget({ platform = process.platform, arch = process.arch, libc } = {}) {
|
|
89
|
+
if (!["darwin", "win32", "linux"].includes(platform) || !["x64", "arm64"].includes(arch)) throw new Error("No complete Release package is available for this platform");
|
|
90
|
+
if (platform !== "linux") return `${platform}-${arch}`;
|
|
91
|
+
libc ||= process.report?.getReport().header.glibcVersionRuntime ? "glibc" : "musl";
|
|
92
|
+
if (!["glibc", "musl"].includes(libc)) throw new Error("Unsupported Linux runtime");
|
|
93
|
+
return `${platform}-${arch}-${libc}`;
|
|
94
|
+
}
|
|
95
|
+
export function remoteDownloadDenied(error) {
|
|
96
|
+
return error?.npmCode === "EALLOWREMOTE" || /(?:^|\n)npm (?:error|ERR!) code EALLOWREMOTE(?:\r?\n|$)/.test(String(error?.stderr || ""));
|
|
97
|
+
}
|
|
98
|
+
export async function downloadRelease(tag, { fetchImpl = fetch, directory, signal, complete = false, preferComplete = false, platform, arch, libc } = {}) {
|
|
89
99
|
const version = stableVersion(tag);if (!version) throw new Error("A valid stable GitHub release tag is required");
|
|
90
|
-
const
|
|
100
|
+
const base = `${RELEASE_BASE}/v${version}`;
|
|
91
101
|
const manifest = await releaseBytes(`${base}/SHA256SUMS`, { fetchImpl, maxBytes: 65536, signal });
|
|
102
|
+
let name = `codex-copilot-dx-${version}.tgz`, target;
|
|
103
|
+
if (complete || preferComplete) {
|
|
104
|
+
if (complete) target = runtimeReleaseTarget({ platform, arch, libc });
|
|
105
|
+
else {
|
|
106
|
+
try { target = runtimeReleaseTarget({ platform, arch, libc }); } catch { /* Other platforms retain the source-only bootstrap path. */ }
|
|
107
|
+
}
|
|
108
|
+
if (target) {
|
|
109
|
+
const runtimeName = `codex-copilot-dx-${version}-${target}.tgz`;
|
|
110
|
+
if (complete || manifest.toString("utf8").split(/\r?\n/).some(line => line.endsWith(` ${runtimeName}`))) { name = runtimeName;complete = true; }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
92
113
|
const expected = releaseChecksum(manifest, name);
|
|
93
|
-
const bytes = await releaseBytes(`${base}/${name}`, { fetchImpl, maxBytes: 16 * 1024 * 1024, signal });
|
|
114
|
+
const bytes = await releaseBytes(`${base}/${name}`, { fetchImpl, maxBytes: (complete ? 64 : 16) * 1024 * 1024, signal });
|
|
94
115
|
if (createHash("sha256").update(bytes).digest("hex") !== expected) throw new Error("Release checksum mismatch; no installation was started");
|
|
95
|
-
|
|
96
|
-
|
|
116
|
+
const metadata = packageMetadata(bytes, { complete });
|
|
117
|
+
if (metadata.version !== version) throw new Error("Release package version does not match its tag");
|
|
118
|
+
if (complete && (metadata.ccdx_runtime?.schema !== 1 || metadata.ccdx_runtime.target !== target
|
|
119
|
+
|| !Array.isArray(metadata.bundleDependencies) || !["sharp", "smol-toml", "@azure/msal-node-runtime"].every(name => metadata.bundleDependencies.includes(name)))) {
|
|
120
|
+
throw new Error("Complete Release package does not match this runtime or lacks bundled dependencies");
|
|
121
|
+
}
|
|
122
|
+
const file = path.join(directory, name);fs.writeFileSync(file, bytes, { flag: "wx", mode: 0o600 });return { file, name, version, complete };
|
|
97
123
|
}
|
|
98
124
|
|
|
99
125
|
// Preserve only this package and its command entries. Never snapshot credentials
|
|
@@ -190,11 +216,12 @@ async function bootstrap() {
|
|
|
190
216
|
const target = path.join(prefix, ...(process.platform === "win32" ? [] : ["lib"]), "node_modules", "codex-copilot-dx");
|
|
191
217
|
const directory = fs.mkdtempSync(path.join(os.tmpdir(), "ccdx-install-"));let transaction;
|
|
192
218
|
try {
|
|
193
|
-
const release = await downloadRelease(tag, { directory, fetchImpl: createNpmReleaseFetch(npmCli) });
|
|
219
|
+
const release = await downloadRelease(tag, { directory, fetchImpl: createNpmReleaseFetch(npmCli), preferComplete: true });
|
|
194
220
|
transaction = protectInstallation({ target, prefix });
|
|
195
221
|
const npmVersion = execFileSync(process.execPath, [npmCli, "--version"], { encoding: "utf8", timeout: 10000 }).trim();
|
|
196
222
|
const args = [npmCli, "install", "--global", "--prefix", prefix, "--ignore-scripts", "--no-audit", "--no-fund"];
|
|
197
|
-
if (
|
|
223
|
+
if (release.complete) args.push("--offline");
|
|
224
|
+
else if (permission && Number(npmVersion.split(".")[0]) >= 12) args.push("--allow-remote=all");
|
|
198
225
|
args.push(release.file);
|
|
199
226
|
execFileSync(process.execPath, args, { stdio: "inherit", timeout: 300000 });
|
|
200
227
|
verifyPackageRuntime(target, release.version, { brokerRequired: ["darwin", "win32"].includes(process.platform) });
|
|
@@ -202,7 +229,7 @@ async function bootstrap() {
|
|
|
202
229
|
transaction.commit();transaction = null;
|
|
203
230
|
console.log(`Installed CCDX ${release.version}. Existing services keep running until restarted.`);
|
|
204
231
|
} catch (error) {
|
|
205
|
-
transaction?.rollback();throw new Error("Installation failed. Previous CCDX package and commands were restored. Check
|
|
232
|
+
transaction?.rollback();throw new Error("Installation failed. Previous CCDX package and commands were restored. Check the Release package, platform, proxy, certificates and npm policy. Older source-only releases still need registry access.", { cause: error });
|
|
206
233
|
} finally { fs.rmSync(directory, { recursive: true, force: true }); }
|
|
207
234
|
}
|
|
208
235
|
if (process.argv[1] && path.basename(process.argv[1]) === "ccdx-install.mjs" && fs.realpathSync(process.argv[1]) === fileURLToPath(import.meta.url)) {
|