codex-copilot-dx 1.2.28 → 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 +5 -5
- package/bin/cli.mjs +1 -0
- package/docs/ARCHITECTURE.md +47 -5
- package/docs/REFERENCE.md +69 -7
- package/package.json +2 -1
- package/src/adapter.mjs +1 -1
- package/src/claude-gateway.mjs +2 -1
- package/src/cli-options.mjs +1 -1
- package/src/cli-web.mjs +1 -0
- package/src/connection-runtime.mjs +40 -6
- package/src/dashboard/connections.js +25 -1
- package/src/dashboard/index.html +5 -2
- package/src/dashboard/language.js +22 -0
- package/src/dashboard/tools.js +48 -4
- package/src/dashboard/ui.css +8 -0
- package/src/dashboard/ui.js +18 -2
- package/src/dashboard-api.mjs +2 -1
- package/src/messages-history-transfer.mjs +74 -23
- 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 +19 -10
- package/src/providers/m365-catalog-diagnostic.mjs +12 -0
- package/src/providers/m365.mjs +22 -6
- package/src/release-install.mjs +37 -10
- package/src/response-failures.mjs +7 -0
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,15 +54,15 @@ 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
|
|
|
63
63
|
Eligible macOS/Windows machines attempt silent Microsoft authorization at startup, without Copilot CLI or a browser login. MDM alone is insufficient: account, tenant, device policy and Loki entitlement must permit access. Optional failure does not block GitHub. Saved bindings stay selected; unresolved company accounts can be chosen under **Model sources → Microsoft 365** or `ccdx m365 account` in the updated running service. Listing is local; changing accounts validates only the selected account, affects M365 in Codex/Claude and requires new conversations. See the reference for identity and history limits. Microsoft 365 uses the fixed `loki.delve.office.com` service origin. Account/origin-bound model discovery is separate from inference; old environment caches are not advertised as current. This does not enable a paused source or change existing application routing.
|
|
64
64
|
|
|
65
|
-
Claude clients use `http://127.0.0.1:2026/anthropic` (or the configured main port), a private local gateway key and a Claude-only catalog. No second Claude listener is opened. Existing unchanged CCDX-owned 2027 addresses migrate automatically; hand-written or managed addresses are preserved and need explicit migration. The optional prediction CONNECT/PAC bridge remains a separate transport.
|
|
65
|
+
In **Model sources → Microsoft 365 → Allowed apps**, choose consuming apps; discovery alone does not configure them all. Existing grants are retained, and changing access preserves other sources. Claude clients use `http://127.0.0.1:2026/anthropic` (or the configured main port), a private local gateway key and a Claude-only catalog. No second Claude listener is opened. Existing unchanged CCDX-owned 2027 addresses migrate automatically; hand-written or managed addresses are preserved and need explicit migration. The optional prediction CONNECT/PAC bridge remains a separate transport.
|
|
66
66
|
Existing custom/managed settings are preserved; already-running clients may need a normal restart.
|
|
67
67
|
Canonical Claude IDs and advertised effort caps refresh only in unchanged CCDX-owned settings. User and managed choices are preserved; supported App versions can update model knowledge through Anthropic's signed catalog. New protocol semantics may require a client or CCDX update. See the [model reference](docs/REFERENCE.md#claude-gateway-and-client-ownership).
|
|
68
68
|
`ccdx m365 off` restores unchanged owned fields; `remove` also clears owned M365 state. With managed client connections, off pauses affected bindings instead of selecting another source; removal retains shared client-ownership records needed by manual APIs.
|
|
@@ -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
|
@@ -145,8 +145,17 @@ handles. New-source thinking after the checkpoint stays unchanged. Changed
|
|
|
145
145
|
prefixes can be rebuilt only at a completed tool boundary. It adds no automatic
|
|
146
146
|
retry, summary inference, routing fallback or conversation database.
|
|
147
147
|
|
|
148
|
-
Transfer records are bounded to 1024 hashed keys
|
|
149
|
-
they contain owner hashes, prefix hashes and
|
|
148
|
+
Transfer records are bounded to 1024 hashed keys per 512 KiB versioned file;
|
|
149
|
+
they contain owner hashes, prefix hashes and counts, not transcripts.
|
|
150
|
+
`conversation-prefixes.json` adds protocol-equivalent block fingerprints beside
|
|
151
|
+
the unchanged legacy `conversation-transfers.json` shape. Strings and single
|
|
152
|
+
text blocks compare equally; adjacent same-role messages can be combined without
|
|
153
|
+
changing the proved block prefix. Text/code whitespace, arrays and tool argument
|
|
154
|
+
values remain significant. Only protocol cache hints are excluded. The semantic
|
|
155
|
+
receipt is anchored to its legacy owner/count/hash so an older writer invalidates
|
|
156
|
+
stale proof. Both files commit under the existing lock and atomic file-pair
|
|
157
|
+
rollback. Legacy receipts upgrade only after their prefix is proved; unmatched
|
|
158
|
+
old history is never guessed. Old versions can still read the legacy receipt.
|
|
150
159
|
Count/model-validation requests do not rebind. A per-conversation request lease
|
|
151
160
|
pins active source work; the gateway commits a checkpoint immediately before
|
|
152
161
|
delivering usable output/tool/private state and releases every lease on failure
|
|
@@ -157,6 +166,15 @@ owners are still refused. Native Responses recovery/configuration is unchanged.
|
|
|
157
166
|
|
|
158
167
|
`dashboard/connections.js` owns settings forms; application source/review and
|
|
159
168
|
account/catalog views keep their existing scopes and use the same backend graph.
|
|
169
|
+
M365's `source_access` action changes client grants without choosing a source or
|
|
170
|
+
model. Only revoked active routes and necessary shared-key migrations synchronize
|
|
171
|
+
client configuration; unrelated clients and empty sync targets are untouched.
|
|
172
|
+
Unchecked routes are removed from runtime authorization while other deployments
|
|
173
|
+
remain selected. Fresh discovery without owned legacy configuration grants no
|
|
174
|
+
automatic M365 consumers; existing graph/legacy ownership is retained. Explicit
|
|
175
|
+
CLI source selection remains an intentional grant for Codex only. Shared native
|
|
176
|
+
Claude capability settings are preserved when an unaffected consumer is not yet
|
|
177
|
+
checked, until normal reconciliation can verify both consumers.
|
|
160
178
|
Its binding draft retains selected identities independently from current catalog
|
|
161
179
|
availability. Missing selections stay visible and cannot be silently dropped on save.
|
|
162
180
|
Full configuration is on-demand; ordinary status uses compact cached summaries.
|
|
@@ -260,11 +278,26 @@ the installer, not an unrelated working project's `.npmrc`. It queries version,
|
|
|
260
278
|
Default installer argv preserves the saved download policy. The boolean
|
|
261
279
|
`--allow-remote` opt-in adds one fixed permission argument only when supported;
|
|
262
280
|
it applies to that installation's entire dependency tree, not selected hosts.
|
|
263
|
-
Unknown support fails before an explicitly requested override.
|
|
264
|
-
|
|
265
|
-
|
|
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.
|
|
266
287
|
The source lock retains exact versions/integrities without binding smol-toml to a
|
|
267
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.
|
|
268
301
|
Readonly update preflight reports Node/npm, the running package and npm's selected
|
|
269
302
|
global target. A different target warns, but never changes PATH or prefix. Its
|
|
270
303
|
bounded npm probe is limited to explicit update/full doctor commands and opted-in supervisor startup, never inference.
|
|
@@ -423,6 +456,13 @@ settlement for two seconds; no successful plaintext cache or transcript index ex
|
|
|
423
456
|
## Dashboard reads
|
|
424
457
|
|
|
425
458
|
`account-tools.mjs` is the shared explicit GitHub sign-in/check/sign-out boundary for CLI and WebUI. It reuses bounded device polling and `auth-status.mjs` access checks, isolates candidate credentials until verification, compares the original credential under the existing cross-process auth lock, and atomically commits to the CCDX-owned store. It does not own Microsoft SSO. Public snapshots project fixed stages/codes and omit token material. A cancelled or failed candidate is never persisted; the service keeps one sign-in controller and one connection-check flight, with bounded lifetimes/cooldowns. Explicit cache invalidation aborts a pending token refresh while preserving the runtime's account binding. The CLI notifies a compatible local service after changes; account changes require a restart.
|
|
459
|
+
The verification view starts one deferred ClipboardItem write in the explicit
|
|
460
|
+
sign-in gesture, resolves it only to the short public user code and retains an
|
|
461
|
+
explicit writeText/selectable-text fallback. Fixed-URL native link activation
|
|
462
|
+
retries copying without awaiting a popup-blocking task. Flow/account generations
|
|
463
|
+
ignore cancelled or obsolete completion; unchanged polls do not rewrite or
|
|
464
|
+
reannounce the clipboard feedback. No clipboard read or token projection is added.
|
|
465
|
+
|
|
426
466
|
|
|
427
467
|
`local-tools.mjs` reuses doctor and the existing config writer. It projects redacted local checks and a revision-bound config preview rather than wrapping arbitrary shell commands. The config writer validates the revision again inside its own lock, then preserves unmanaged settings and backs up changed originals. `dashboard-tools.mjs` owns the small strict action schema and bounded request-body transport; `optional-routes.mjs` creates these tools lazily per handler and disposes sign-in work when the listener closes. `dashboard/tools.js` owns the source-specific account view, user-triggered checks/preview and local progress polling; source selection does not change routing. `dashboard/icons.js` supplies fixed local circle SVGs and separate localized text nodes, preserving language changes without replacing the icons. No runtime dependency or per-stream instrumentation is added.
|
|
428
468
|
|
|
@@ -706,6 +746,8 @@ No new polling, framework, runtime dependency, setting or endpoint is introduced
|
|
|
706
746
|
|
|
707
747
|
## Catalog transactions and default identity (1.2.20)
|
|
708
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
|
+
|
|
709
751
|
`api-catalog-refresh.mjs` owns bounded catalog I/O, same-source single-flight,
|
|
710
752
|
existing success/failure cooldowns, cancellation and deployment-version checks.
|
|
711
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
|
|
@@ -1760,7 +1782,7 @@ unchanged.
|
|
|
1760
1782
|
|
|
1761
1783
|
New explicit-tool sign-ins use `~/.local/share/ccdx/github_token` and fingerprint-bound `.account.json` metadata, with private permissions and the existing atomic paired writer. When present, this owned store takes precedence over `~/.local/share/copilot-api/github_token`; existing startup/discovery compatibility remains supported. `auth logout` requires interactive confirmation or `--yes`, writes an empty owned credential, and does not delete or revoke other apps' legacy credentials. This intentionally blocks inference's legacy fallback. New login or normal startup can perform the existing explicit discovery/sign-in process again. CLI changes notify a compatible running local service; if notification is unavailable, the CLI asks for a service restart. In-flight model requests are not replayed or forcibly stopped. A token cache invalidation preserves its running account binding, so switching accounts still requires a restart.
|
|
1762
1784
|
|
|
1763
|
-
Model sources uses one source selector for the selected source controls, account and catalog. Disabled sources remain under its collapsed list; there is no second list of enabled source cards. Selecting a tab is browsing only. GitHub offers sign-in, independent connection checks and cancellation; sign-out is under More actions. The browser opens only the fixed GitHub device authorization URL after the user chooses
|
|
1785
|
+
Model sources uses one source selector for the selected source controls, account and catalog. Disabled sources remain under its collapsed list; there is no second list of enabled source cards. Selecting a tab is browsing only. GitHub offers sign-in, independent connection checks and cancellation; sign-out is under More actions. The browser opens only the fixed GitHub device authorization URL after the user chooses Copy & open GitHub. Its copy icon writes only the displayed short user code. The originating sign-in click prepares one asynchronous clipboard write; browsers that reject it retain an explicit copy action and selectable text. Re-rendering/polling does not repeatedly overwrite the clipboard. Clipboard reads are never requested, failed writes never show Copied, and cancelled/obsolete flow completions cannot update the new flow. Opening the link retries the copy in the click without delaying the native link activation. No token or password entry field is added. Microsoft 365 retains local account discovery/selection and source controls; its corporate SSO is not replaced with a GitHub-style login. Raw codes remain under details and last-good model lists retain their previous timestamp after failures.
|
|
1764
1786
|
|
|
1765
1787
|
`ccdx web` opens an existing compatible dashboard or starts a management-only local listener without sign-in, app configuration, app launch, prediction setup or automatic M365 startup. It does not claim normal startup integrations are active. Stop that management listener with Ctrl+C before running normal `ccdx` for application routing and optional integrations. Opening the dashboard does not initiate a GitHub Device Flow or model inference.
|
|
1766
1788
|
|
|
@@ -2215,6 +2237,46 @@ survive ordinary service restart; corrupt records are preserved and reported,
|
|
|
2215
2237
|
not replaced with empty defaults. This does not persist Responses history or
|
|
2216
2238
|
change Codex login/provider/model-list configuration.
|
|
2217
2239
|
|
|
2240
|
+
`conversation-prefixes.json` adds a second bounded receipt with protocol-equivalent
|
|
2241
|
+
block fingerprints. A string and its single text block compare equally, and
|
|
2242
|
+
combining adjacent same-role messages preserves the proved block prefix. This
|
|
2243
|
+
changes only comparison, not the client's messages. Text/code whitespace and
|
|
2244
|
+
tool argument values remain significant. Each semantic receipt is tied to the
|
|
2245
|
+
legacy owner/count/hash; an older writer makes stale semantic proof ineligible.
|
|
2246
|
+
The pair commits atomically. Legacy receipts upgrade only when their prefix is
|
|
2247
|
+
proved, and the original legacy file remains readable by older versions. Each
|
|
2248
|
+
file is limited to 1024 keys and a 512 KiB read. No tool or private state is
|
|
2249
|
+
replayed to work around an unknown prefix or account mismatch. Rejections report
|
|
2250
|
+
whether the source changed or the prefix changed, and whether a tool result is
|
|
2251
|
+
missing/unmatched or a tool turn is active.
|
|
2252
|
+
|
|
2253
|
+
### Explicit M365 app access and directory read receipts
|
|
2254
|
+
|
|
2255
|
+
Model sources → Microsoft 365 → Allowed apps grants the current source to one,
|
|
2256
|
+
several or no enabled apps. Granting access does not choose models or change the
|
|
2257
|
+
current source. Removing access removes only that source's selected routes,
|
|
2258
|
+
preserving other source selections and an unavailable default until explicitly
|
|
2259
|
+
replaced. The runtime enforces revoked access even if a client retains its old
|
|
2260
|
+
model menu. Shared legacy Claude-key migration reports which retained consumers
|
|
2261
|
+
need reopening. Existing saved grants/owned legacy setups are retained; first-time
|
|
2262
|
+
discovery/sign-in alone does not connect all apps. An explicit CLI M365 source
|
|
2263
|
+
choice authorizes Codex only. Ordinary grants do not synchronize unrelated Codex
|
|
2264
|
+
configuration, authentication or catalogs.
|
|
2265
|
+
|
|
2266
|
+
M365's explicit directory refresh always requests the network, even when a
|
|
2267
|
+
usable local model cache exists. `Cache-Control: no-cache` and `Pragma: no-cache`
|
|
2268
|
+
request HTTP revalidation through the existing transport. They do not bypass
|
|
2269
|
+
enterprise proxies, certificates, account policies or change token refresh.
|
|
2270
|
+
The read summary distinguishes network from CCDX cache, records the data time,
|
|
2271
|
+
raw total, compatible GPT/Claude counts and locally excluded count. Collapsed
|
|
2272
|
+
details include sanitized upstream/client correlation IDs, HTTP status and a
|
|
2273
|
+
bounded upstream Age value when returned. A network response containing five
|
|
2274
|
+
models replaces an older fifteen-model cache; a failed check preserves and
|
|
2275
|
+
labels prior data. Directory access is not inference authorization. There is no
|
|
2276
|
+
automatic empty-directory substitution, fabricated Claude entry, extra polling
|
|
2277
|
+
loop or inference probe. Correlation IDs are receipts, not proof that every
|
|
2278
|
+
intermediate proxy honored revalidation.
|
|
2279
|
+
|
|
2218
2280
|
### Upstream maker metadata
|
|
2219
2281
|
|
|
2220
2282
|
Manual API discovery accepts bounded text from publisher, vendor and owned_by.
|
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/adapter.mjs
CHANGED
|
@@ -276,7 +276,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
276
276
|
const query = new URL(req.url, "http://localhost").search;
|
|
277
277
|
req.url = pathname.slice("/anthropic".length) + query;
|
|
278
278
|
try { return await options.providerRuntime.handleClaude(req, res); }
|
|
279
|
-
catch (error) { sendJsonError(res, error, error.statusCode || 502); }
|
|
279
|
+
catch (error) { return sendJsonError(res, error, error.statusCode || 502); }
|
|
280
280
|
finally { req.url = original; }
|
|
281
281
|
}
|
|
282
282
|
if (req.method === "POST" && ["/v1/responses", "/v1/responses/compact"].includes(pathname)
|
package/src/claude-gateway.mjs
CHANGED
|
@@ -228,10 +228,11 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
|
|
|
228
228
|
const diagnostic = error.code === "ccdx_api_network_unavailable" ? transportErrorDetails(error) : null;
|
|
229
229
|
log(outcome === "cancelled" ? "info" : "warn", `Claude request ${requestId}: ${detail.code}${diagnostic ? ` (${diagnostic.code}, ${diagnostic.phase})` : ""}`);
|
|
230
230
|
tracker?.setErrorOrigin(terminalOrigin);
|
|
231
|
-
context.onHttpError?.({ code: detail.code, origin: terminalOrigin, ...(diagnostic ? { transport: diagnostic } : {}) });
|
|
231
|
+
context.onHttpError?.({ code: detail.code, origin: terminalOrigin, ...(rejectionReason ? { reason: rejectionReason } : {}), ...(diagnostic ? { transport: diagnostic } : {}) });
|
|
232
232
|
if (outcome === "cancelled") return;
|
|
233
233
|
if (!res.headersSent) {
|
|
234
234
|
const value = apiError(abort.reason || error.code || "ccdx_gateway_error", message);
|
|
235
|
+
if (rejectionReason) value.error.reason = rejectionReason;
|
|
235
236
|
if (diagnostic) value.error.diagnostic = diagnostic;
|
|
236
237
|
send(res, statusCode, value);
|
|
237
238
|
}
|
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,
|
|
@@ -19,6 +19,7 @@ import { codexClientCatalog, codexSourceCatalog } from "./clients/codex-models.m
|
|
|
19
19
|
import { currentRequestContext } from "./request-context.mjs";
|
|
20
20
|
import { claudeSharedCapabilityPlan, syncClaudeCapabilities, inspectClaudeCapabilitySupport, inspectClaudeCapabilityConfiguration } from "./claude-capability-config.mjs";
|
|
21
21
|
import { deploymentModelId, resolveModelCapabilities, deploymentRevision } from "./model-capabilities.mjs";
|
|
22
|
+
import { m365Paths } from "./m365-settings.mjs";
|
|
22
23
|
|
|
23
24
|
const validObject = (value, keys) => value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).every(key => keys.includes(key));
|
|
24
25
|
export function createConnectionRuntime({ legacy, home, env = process.env, platform = process.platform, corePort = 2026,
|
|
@@ -29,6 +30,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
29
30
|
const messagesTransfer = createMessagesHistoryTransfer({ ...options, onTransfer: () => log("info", "Conversation continued on the selected source; original history kept") });
|
|
30
31
|
const memoryModel = createCodexMemoryModel({ ...options, corePort });
|
|
31
32
|
let settings = readAccessSettings(options), managed = fs.existsSync(accessSettingsPath(options)), serial = Promise.resolve(), keys, closed = false;
|
|
33
|
+
const legacyClaudeAccess = fs.existsSync(m365Paths(options).ownership);
|
|
32
34
|
const instances = new Map(), active = new Map(), retired = new Set(), handlers = new Map(), summaries = new WeakMap(), sourceSecrets = new WeakMap(), setup = {}, lastClients = {};
|
|
33
35
|
const retiredSecrets = new Map(), cleanups = new Set(), plans = new Map(), discoveries = new Map();
|
|
34
36
|
const catalogRefresh = createApiCatalogRefresh({ config: id => settings.apis.find(api => api.id === id), source: getSource, track,
|
|
@@ -49,7 +51,9 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
49
51
|
}
|
|
50
52
|
const identities = () => keys ||= readClientGatewayKeys(options);
|
|
51
53
|
const enabled = id => id?.startsWith("api_") ? settings.apis.find(api => api.id === id)?.enabled === true : settings.providers[id] === true;
|
|
52
|
-
const binding = id => managed ? settings.clients[id] : { ...settings.clients[id],
|
|
54
|
+
const binding = id => managed ? settings.clients[id] : { ...settings.clients[id],
|
|
55
|
+
allowed: settings.clients[id].allowed.filter(source => source !== "m365" || legacyClaudeAccess || id === "codex" && legacy.selection().codex === "m365"),
|
|
56
|
+
source: id === "codex" ? legacy.selection().codex : legacyClaudeAccess && legacy.snapshot().m365.enabled ? "m365" : null };
|
|
53
57
|
// GitHub-only selections retain the existing native loopback access contract.
|
|
54
58
|
// Any other deployment still requires the private per-client credential.
|
|
55
59
|
function codexAccessMode() {
|
|
@@ -113,7 +117,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
113
117
|
function editable() {
|
|
114
118
|
if (managed) return structuredClone(settings);
|
|
115
119
|
const next = structuredClone(settings);next.providers.m365 = legacy.snapshot().m365.enabled === true;
|
|
116
|
-
for (const id of CLIENT_IDS) next.clients[id]
|
|
120
|
+
for (const id of CLIENT_IDS) next.clients[id] = { ...binding(id) };
|
|
117
121
|
return next;
|
|
118
122
|
}
|
|
119
123
|
function save(next) {
|
|
@@ -148,6 +152,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
148
152
|
route_id: deploymentModelId(source, model.id), capability: model.capability || resolveModelCapabilities(model, { builtin: true }) }))), sync: sharedSync, support: capabilitySupport } }) })), managed, m365_state: state.m365.state });
|
|
149
153
|
}
|
|
150
154
|
async function syncClients(ids = CLIENT_IDS) {
|
|
155
|
+
if (!ids.length) return;
|
|
151
156
|
for (const id of ids) syncTargets.add(id);
|
|
152
157
|
syncAgain = true;if (syncFlight) return syncFlight;
|
|
153
158
|
syncFlight = (async () => { do { syncAgain = false;const targets = new Set(syncTargets);syncTargets.clear();await performClientSync(targets); } while (syncAgain && !closed); })();
|
|
@@ -191,6 +196,10 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
191
196
|
if (["claude_app", "claude_code"].some(id => setup[id] === "default_unavailable")) {
|
|
192
197
|
sharedSync = { ...sharedSync, state: "partially_preserved", limitations: [{ code: "default_model_unavailable" }] };return;
|
|
193
198
|
}
|
|
199
|
+
if (!["claude_app", "claude_code"].some(id => targets.has(id))) return;
|
|
200
|
+
if (["claude_app", "claude_code"].some(id => !targets.has(id) && !setup[id] && binding(id).enabled && plan(id).models.length)) {
|
|
201
|
+
sharedSync = { state: "partially_preserved", limitations: [{ code: "other_client_not_checked" }] };return;
|
|
202
|
+
}
|
|
194
203
|
const shared = claudeSharedCapabilityPlan({ app: setup.claude_app === "configured" ? plan("claude_app").models : [],
|
|
195
204
|
code: setup.claude_code === "configured" ? plan("claude_code").models : [], support: capabilitySupport });
|
|
196
205
|
if (["claude_app", "claude_code"].some(id => setup[id] === "manual_sync")) {
|
|
@@ -232,7 +241,29 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
232
241
|
if (closed) throw accessError("ccdx_connections_closed", 503);
|
|
233
242
|
if (!validObject(input, ["operation", "id", "config", "key", "allowed", "source", "enabled", "replacements", "model", "auto_review_model", "auto_review_effort", "deployments", "default_model", "auto_sync"])) throw accessError("ccdx_connections_action_invalid");
|
|
234
243
|
const next = editable();let freshRef, previousRef;
|
|
235
|
-
if (input.operation === "
|
|
244
|
+
if (input.operation === "source_access") {
|
|
245
|
+
if (input.id !== "m365" || !Array.isArray(input.allowed) || new Set(input.allowed).size !== input.allowed.length || input.allowed.some(id => !CLIENT_IDS.includes(id))) throw accessError("ccdx_connections_action_invalid");
|
|
246
|
+
const affected = CLIENT_IDS.filter(id => next.clients[id].allowed.includes(input.id) !== input.allowed.includes(id));
|
|
247
|
+
const sharedClaude = ["claude_app", "claude_code"].filter(id => next.clients[id].enabled && next.clients[id].source === "m365");
|
|
248
|
+
const migrateClaude = !next.claude_private_keys && sharedClaude.length > 0 && affected.some(id => id !== "codex");
|
|
249
|
+
const targets = new Set();
|
|
250
|
+
for (const id of affected) {
|
|
251
|
+
const c = next.clients[id];
|
|
252
|
+
c.allowed = [...c.allowed.filter(source => source !== input.id), ...(input.allowed.includes(id) ? [input.id] : [])];
|
|
253
|
+
if (!input.allowed.includes(id)) {
|
|
254
|
+
if (c.source === input.id || c.deployments?.some(item => item.source === input.id)) targets.add(id);
|
|
255
|
+
if (c.source === input.id) c.source = null;
|
|
256
|
+
if (Array.isArray(c.deployments)) c.deployments = c.deployments.filter(item => item.source !== input.id);
|
|
257
|
+
c.history_isolation = true;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (migrateClaude) next.claude_private_keys = true;
|
|
261
|
+
if (migrateClaude) for (const id of ["claude_app", "claude_code"]) if (next.clients[id].source === "m365") targets.add(id);
|
|
262
|
+
save(next);await syncClients([...targets]);
|
|
263
|
+
const retained = migrateClaude ? [...targets].filter(id => id !== "codex" && next.clients[id].enabled && next.clients[id].source === "m365") : [];
|
|
264
|
+
return { ...snapshot(), client_refresh: retained.filter(id => setup[id] === "configured"),
|
|
265
|
+
client_review: retained.filter(id => ["preserved", "partially_preserved", "manual_sync", "configuration_unavailable"].includes(setup[id])) };
|
|
266
|
+
} else if (input.operation === "save_api") {
|
|
236
267
|
const existing = next.apis.find(api => api.id === input.id);
|
|
237
268
|
if (!existing && next.apis.length >= 16) throw accessError("ccdx_api_limit");
|
|
238
269
|
if (!validObject(input.config, ["name", "base_url", "endpoints", "auth_header", "models", "key_env", "model_display"])) throw accessError("ccdx_api_config_invalid");
|
|
@@ -355,6 +386,9 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
355
386
|
}
|
|
356
387
|
return {
|
|
357
388
|
...legacy,
|
|
389
|
+
managesClaude() { return !managed ? !legacyClaudeAccess : settings.claude_private_keys
|
|
390
|
+
|| !["claude_app", "claude_code"].every(id => binding(id).enabled && binding(id).source === "m365" && binding(id).allowed.includes("m365")); },
|
|
391
|
+
syncSourceClients(source) { return syncClients(CLIENT_IDS.filter(id => binding(id).source === source || binding(id).deployments?.some(item => item.source === source))); },
|
|
358
392
|
source: getSource,
|
|
359
393
|
connections: snapshot,
|
|
360
394
|
privateScopes: id => [...new Set(plan(id).models.map(model => model.source_id))].sort().map(source => [source, getSource(source).profileId(id === "codex" ? "responses" : "messages")]),
|
|
@@ -454,7 +488,7 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
454
488
|
return { historyNamespace: target.profileId() };
|
|
455
489
|
},
|
|
456
490
|
async handleClaude(req, res) {
|
|
457
|
-
if (!managed) return legacy.handleClaude(req, res);
|
|
491
|
+
if (!managed) { if (!legacyClaudeAccess) throw accessError("ccdx_client_source_disabled", 503);return legacy.handleClaude(req, res); }
|
|
458
492
|
if (!settings.claude_private_keys) {
|
|
459
493
|
if (["claude_app", "claude_code"].every(id => permitted(id, "m365") && binding(id).source === "m365")) return legacy.handleClaude(req, res);
|
|
460
494
|
throw accessError("ccdx_client_source_disabled", 503);
|
|
@@ -524,9 +558,9 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
524
558
|
model: input.model, auto_review_model: input.auto_review_model, auto_review_effort: input.auto_review_effort });return this.snapshot(); }
|
|
525
559
|
if (input.action === "auto-review" && managed && binding("codex").source !== "github") { await this.manageConnections({ operation: "client", id: "codex", ...clientInput, auto_review_model: input.model, auto_review_effort: input.effort });return this.snapshot(); }
|
|
526
560
|
if (input.action === "auto-review" && managed && legacy.selection().codex !== "github") await legacy.action({ action: "switch", provider: "github" });
|
|
527
|
-
if (managed && input.action === "switch" && !
|
|
561
|
+
if (managed && input.action === "switch" && !enabled(input.provider)) throw accessError("ccdx_client_source_disabled", 503);
|
|
528
562
|
const result = await legacy.action(input);
|
|
529
|
-
if (managed && input.action === "switch") { const next = editable();if (next.clients.codex.source !== input.provider) next.clients.codex.history_isolation = true;next.clients.codex.source = input.provider;next.clients.codex.deployments = null;next.clients.codex.default_model = null;for (const key of ["model", "auto_review_model", "auto_review_effort"]) delete next.clients.codex[key];if (input.provider === "m365") Object.assign(next.clients.codex, legacy.selection().m365);save(next);await syncClients(); }
|
|
563
|
+
if (managed && input.action === "switch") { const next = editable();if (next.clients.codex.source !== input.provider) next.clients.codex.history_isolation = true;next.clients.codex.allowed = [...new Set([...next.clients.codex.allowed, input.provider])];next.clients.codex.source = input.provider;next.clients.codex.deployments = null;next.clients.codex.default_model = null;for (const key of ["model", "auto_review_model", "auto_review_effort"]) delete next.clients.codex[key];if (input.provider === "m365") Object.assign(next.clients.codex, legacy.selection().m365);save(next);await syncClients(["codex"]); }
|
|
530
564
|
return result;
|
|
531
565
|
},
|
|
532
566
|
async close() { closed = true;await memoryModel.close();await catalogRefresh.close();await serial;await syncFlight;for (const { source } of instances.values()) source.close();for (const source of retired) source.close();active.clear();for (const id of retiredSecrets.keys()) cleanSecrets(id);await Promise.allSettled([...cleanups]);secrets.close();await legacy.close(); },
|
|
@@ -8,6 +8,28 @@
|
|
|
8
8
|
const apiForm = el("connection-api-form"), clientForm = el("connection-client-form");
|
|
9
9
|
const node = (tag, text, className) => { const item = document.createElement(tag);if (text !== undefined) item.textContent = text;if (className) item.className = className;return item; };
|
|
10
10
|
const source = id => data.providers.find(item => item.id === id), client = id => data.clients.find(item => item.id === id);
|
|
11
|
+
let accessDraft = null, accessError = null, accessRefresh = [], accessReview = [];
|
|
12
|
+
const accessForm = el("m365-app-access");
|
|
13
|
+
function renderAccess() {
|
|
14
|
+
if (!accessForm) return;accessForm.hidden = selectedProvider !== "m365";
|
|
15
|
+
const saved = data.clients.filter(c => c.allowed.includes("m365")).map(c => c.id), selected = accessDraft || saved;
|
|
16
|
+
const area = el("m365-allowed-apps"), focus = area.contains(document.activeElement) ? document.activeElement.value : null;
|
|
17
|
+
area.replaceChildren(...data.clients.filter(c => c.enabled).map(c => {
|
|
18
|
+
const item = check("m365-app", c.id, selected.includes(c.id), c.name);
|
|
19
|
+
item.firstChild.disabled = busy;item.firstChild.addEventListener("change", () => {
|
|
20
|
+
accessDraft = [...selected.filter(id => !data.clients.find(c => c.id === id)?.enabled), ...[...area.querySelectorAll("input:checked")].map(input => input.value)];
|
|
21
|
+
accessError = null;
|
|
22
|
+
renderAccess();[...area.querySelectorAll("input")].find(input => input.value === c.id)?.focus();
|
|
23
|
+
});return item;
|
|
24
|
+
}));
|
|
25
|
+
const dirty = JSON.stringify([...saved].sort()) !== JSON.stringify([...selected].sort());el("m365-access-save").disabled = busy || !dirty;
|
|
26
|
+
words(el("m365-access-state"), accessError || (dirty ? "cap_unsaved" : accessReview.length ? "source_apps_review" : accessRefresh.length ? "source_apps_reopen" : saved.length ? "cap_saved" : "source_apps_none"),
|
|
27
|
+
{ apps: (accessReview.length ? [...new Set([...accessReview, ...accessRefresh])] : accessRefresh).map(id => data.clients.find(c => c.id === id)?.name || id).join(" / ") });
|
|
28
|
+
const affected = data.clients.filter(c => !selected.includes(c.id) && (c.source === "m365" || c.deployments?.some(item => item.source === "m365")));
|
|
29
|
+
el("m365-access-warning").hidden = !affected.length;words(el("m365-access-warning"), "source_apps_pause", { apps: affected.map(c => c.name).join(" / ") });
|
|
30
|
+
if (focus) [...area.querySelectorAll("input")].find(input => input.value === focus)?.focus();
|
|
31
|
+
}
|
|
32
|
+
accessForm?.addEventListener("submit", event => { event.preventDefault();accessError = null;void change({ operation: "source_access", id: "m365", allowed: accessDraft || [] }, result => { accessDraft = null;accessRefresh = result.client_refresh || [];accessReview = result.client_review || [];renderAccess(); }); });
|
|
11
33
|
const compatible = (provider, id) => provider.protocols.includes(id === "codex" ? "responses" : "messages");
|
|
12
34
|
const selectableSource = (provider, id) => compatible(provider, id)
|
|
13
35
|
&& (provider.builtin || provider.models?.some(model => model.protocols.includes(id === "codex" ? "responses" : "messages")));
|
|
@@ -66,6 +88,7 @@
|
|
|
66
88
|
const m365Toggle = el("m365-enabled")?.closest(".setting-row");if (m365Toggle) m365Toggle.hidden = true;
|
|
67
89
|
for (const link of document.querySelectorAll("[data-source-link]")) { const id = link.dataset.sourceLink;if (["m365", "github"].includes(id)) link.hidden = !source(id)?.enabled; }
|
|
68
90
|
globalThis.ccdxConnectionNames = Object.fromEntries(data.providers.map(p => [p.id, p.name]));
|
|
91
|
+
renderAccess();
|
|
69
92
|
}
|
|
70
93
|
async function load() {
|
|
71
94
|
if (busy) return;const current = ++generation;
|
|
@@ -91,9 +114,10 @@
|
|
|
91
114
|
if (input.operation === "client" && input.source && setup === "not_installed") key = "api_client_not_installed";
|
|
92
115
|
if (input.operation === "client") words(el("connection-client-note"), key);else message(key);
|
|
93
116
|
}window.dispatchEvent(new CustomEvent("ccdx:connections"));void dashboardRefresh.refresh("auth", { force: true });void dashboardRefresh.refresh("status", { force: true }); }
|
|
94
|
-
catch (error) { if (input.operation === "client") words(el("connection-client-note"), error.message);else message(error.message); }
|
|
117
|
+
catch (error) { if (input.operation === "source_access") accessError = error.message;else if (input.operation === "client") words(el("connection-client-note"), error.message);else message(error.message); }
|
|
95
118
|
finally { busy = false;if (trigger?.tagName === "BUTTON") { trigger.removeAttribute("aria-busy");trigger.disabled = false;if (oldKey) words(trigger, oldKey);else trigger.textContent = oldText; }
|
|
96
119
|
if (["client", "preview_client"].includes(input.operation)) bindingRows();
|
|
120
|
+
if (input.operation === "source_access") renderAccess();
|
|
97
121
|
}
|
|
98
122
|
}
|
|
99
123
|
const resolved = (model, protocol = model.protocols.includes("messages") ? "messages" : model.protocols[0]) => {
|
package/src/dashboard/index.html
CHANGED
|
@@ -212,8 +212,10 @@
|
|
|
212
212
|
<p class="hint" data-i18n="tools_no_inference">Checks access and models. No chat request is sent.</p>
|
|
213
213
|
<section id="github-login-flow" class="tool-flow" hidden aria-label="GitHub sign-in">
|
|
214
214
|
<h3 id="github-flow-state" data-i18n="tools_waiting">Waiting for GitHub</h3>
|
|
215
|
-
<p class="hint" data-i18n="tools_device_instructions">Open GitHub, enter this code, and authorize CCDX.</p
|
|
216
|
-
<
|
|
215
|
+
<p class="hint" data-i18n="tools_device_instructions">Open GitHub, enter this code, and authorize CCDX.</p>
|
|
216
|
+
<div class="device-code-row"><code id="github-user-code" class="device-code">—</code><button id="github-copy-code" class="icon-button" type="button" aria-label="Copy code" data-i18n-label="tools_copy_code" disabled><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="1"/><path d="M16 8V4H4v12h4"/></svg></button></div>
|
|
217
|
+
<p id="github-copy-state" class="hint" role="status" aria-live="polite"></p>
|
|
218
|
+
<a id="github-authorize" class="tool-link button-link" href="https://github.com/login/device" target="_blank" rel="noopener noreferrer" data-i18n="tools_copy_open_github">Copy & open GitHub</a>
|
|
217
219
|
<button id="github-cancel" type="button" data-i18n="cancel">Cancel</button>
|
|
218
220
|
<p class="hint" data-i18n="tools_keep_old_signin">Old sign-in is kept until verification succeeds.</p>
|
|
219
221
|
</section>
|
|
@@ -236,6 +238,7 @@
|
|
|
236
238
|
<p class="hint" data-i18n="company_account_scope">Applies to Microsoft 365 in Codex and Claude. Start a new conversation after changing accounts.</p>
|
|
237
239
|
</div>
|
|
238
240
|
<p id="m365-account-note" class="hint" role="status" aria-live="polite"></p>
|
|
241
|
+
<form id="m365-app-access" hidden><fieldset><legend data-i18n="source_allowed_apps">Allowed apps</legend><div class="connection-checks" id="m365-allowed-apps"></div></fieldset><p class="hint" data-i18n="source_apps_hint">Choose models on the app page after granting access.</p><p id="m365-access-warning" class="hint" role="status" hidden></p><div class="section-actions"><button id="m365-access-save" type="submit" data-i18n="api_save" disabled>Save</button><span id="m365-access-state" class="hint" role="status" aria-live="polite"></span></div></form>
|
|
239
242
|
</section>
|
|
240
243
|
<details class="panel dashboard-section model-catalog" id="upstream-models" open>
|
|
241
244
|
<summary class="panel-heading"><h2 data-i18n="model_catalog">MODEL LIST</h2><span id="models-state" role="status" aria-live="polite" data-i18n="checking_live">CHECKING</span></summary>
|