codex-copilot-dx 1.2.26 → 1.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -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.26/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.26/install.ps1) (Windows), then run `sh install.sh` or `./install.ps1` under your current shell policy. The bootstrap reuses compatible Node/npm or installs verified official Node 24.22.0 privately for CCDX. It adds no Git, compiler or system package manager. It keeps registry/proxy/certificate policy, verifies the Release package and installed runtime, and restores the prior CCDX package if installation fails. Dependencies still need your configured registry. See [installation limits and private command paths](docs/REFERENCE.md#install-without-node-or-git).
14
+ No Node or Git? Download [install.sh](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.27/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.27/install.ps1) (Windows), then run `sh install.sh` or `./install.ps1` under your current shell policy. The bootstrap reuses compatible Node/npm or installs verified official Node 24.22.0 privately for CCDX. It adds no Git, compiler or system package manager. It keeps registry/proxy/certificate policy, verifies the Release package and installed runtime, and restores the prior CCDX package if installation fails. Dependencies still need your configured registry. See [installation limits and private command paths](docs/REFERENCE.md#install-without-node-or-git).
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
 
@@ -56,7 +56,7 @@ Run `ccdx web` without GitHub sign-in. In **Model sources → Add API**, enter t
56
56
 
57
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.
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.26 changes and verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.26.md) cover the M365 service origin, automatic settings saving, bounded restore backups and lighter dashboard status while retaining native GitHub sign-in/model protections.
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.27 changes and verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.27.md) cover Claude App model synchronization that preserves its 1M preference and avoids duplicate context choices, while retaining native GitHub sign-in/model protections.
60
60
 
61
61
  ## Microsoft 365 access
62
62
 
@@ -188,6 +188,15 @@ absence and policy refusal do not disable GitHub.
188
188
 
189
189
  `providers/m365-network-diagnostic.mjs` is a small pure projection of fixed proxy failure codes, source and stage, shared by transport, provider state, protected dashboard routes and CLI. Raw error chains/settings never cross that boundary. M365 retains existing outer error categories; the source runtime forwards the bounded diagnostic, and existing bilingual renderers expose a readable explanation with technical details. Startup uses the same fixed English explanation. Refresh failures retain last-good catalogs and never change the selected provider; successful transport creation clears the setup diagnostic. No new service, storage, dependency, route fallback or provider retry is introduced.
190
190
 
191
+ `claude-client-config.mjs` treats only the typed App-owned `prefer1m` flag as a
192
+ mutable preference during ordinary model-list synchronization. The generated list
193
+ keeps that flag per exact model name and defaults declared 1M entries to one 1M
194
+ choice. Structural comparison tolerates JSON formatting, but not changed managed
195
+ fields or model ordering. Already-desired manual recovery can refresh an existing
196
+ ownership record only when surviving recorded entries remain unchanged apart from
197
+ that preference. Its original `before` value stays intact; it does not claim an
198
+ unowned field or broaden restoration, route, key or organization-policy authority.
199
+
191
200
  `claude-client-lifecycle.mjs` owns configuration reconciliation and restore state, independently from source auth/catalog code. It checks lifecycle/profile validity after asynchronous policy inspection and preserves the existing field-ownership writer.
192
201
  Claude handler/configuration readiness is also separate from M365 provider
193
202
  readiness. A Claude setup failure or a GPT-only catalog cannot block the explicitly
package/docs/REFERENCE.md CHANGED
@@ -373,6 +373,26 @@ optional image MCP/skill/API remains separately configured and off by default.
373
373
 
374
374
  ### Claude gateway and client ownership
375
375
 
376
+ Claude App ordinary model synchronization compares the model-list JSON by its
377
+ structure. The App-owned boolean `prefer1m` may change without blocking managed
378
+ model additions or removals; its explicit true/false value is preserved by exact
379
+ model identity while 1M support remains declared. New entries with declared 1M
380
+ support default to `prefer1m: true`, so the App shows one 1M option rather than
381
+ separate standard/1M rows. Unknown or smaller windows are not promoted to 1M.
382
+ Names, display overrides, effort caps, unknown fields and meaningful model order
383
+ changes retain strict ownership protection. Invalid JSON, duplicate identities or
384
+ invalid preference types are preserved rather than rewritten.
385
+
386
+ When a prior manual recovery already exactly matches the generated selected list,
387
+ a previous ownership record may be refreshed without rewriting the App profile.
388
+ Surviving old entries must retain their non-preference fields and relative order;
389
+ the original restoration value is kept. An unowned model list is not claimed just
390
+ because it happens to match. Non-model fields and restoration keep their existing
391
+ strict ownership checks. Restart the App normally if its loaded model menu is
392
+ older than the saved profile. Source/key changes in an existing conversation still
393
+ require a new conversation; this patch does not relax that isolation.
394
+
395
+
376
396
  Company-account history is isolated. `conversations.json` stores at most 1024 hashes of conversation identifiers (or the first user item when no native identifier exists) and their account fingerprints; no messages, raw session IDs or tokens are stored there. Each new conversation writes its ownership once; known conversations use memory. After changing accounts, known foreign conversations are refused before forwarding. Unknown requests containing old history are also refused, including after restart; use a new conversation. Clients without stable conversation IDs can collide when their first user item is identical, so supply a unique native session ID. Evicted/unrecognized history fails closed after a switch. The history-isolation marker is saved with the binding and survives token renewal. Removing the M365 profile clears this ownership file, but never removes system sign-in or usage history.
377
397
 
378
398
  Account selection stages the new authorization/catalog before replacing the old provider. Catalog and binding writes use the existing locked atomic writer with restoration on failure; this is not a crash/power-loss transaction. Client configuration remains a separate readiness state: its failure does not claim that account authorization failed or overwrite custom/managed fields. Previously saved model preferences are not substituted when the new account lacks those models.
@@ -1316,7 +1336,7 @@ Unknown support prevents an explicitly requested exception from starting.
1316
1336
  For an older updater that still requires Git, install the Release tarball directly:
1317
1337
 
1318
1338
  ```sh
1319
- npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.26/codex-copilot-dx-1.2.26.tgz
1339
+ npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.27/codex-copilot-dx-1.2.27.tgz
1320
1340
  # Windows PowerShell: use npm.cmd instead of npm.
1321
1341
  ```
1322
1342
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.2.26",
3
+ "version": "1.2.27",
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",
@@ -87,6 +87,33 @@ function setOperation(snapshot, operation, value) {
87
87
  setAt(snapshot, operation.keys, { exists: true, value: next });
88
88
  }
89
89
 
90
+ function parsedAppModels(value) {
91
+ try {
92
+ if (typeof value !== "string") return null;
93
+ const models = JSON.parse(value), names = new Set();
94
+ if (!Array.isArray(models)) return null;
95
+ for (const model of models) {
96
+ if (!model || typeof model !== "object" || Array.isArray(model) || typeof model.name !== "string" || !model.name || names.has(model.name)
97
+ || Object.hasOwn(model, "prefer1m") && typeof model.prefer1m !== "boolean") return null;
98
+ names.add(model.name);
99
+ }
100
+ return models;
101
+ } catch { return null; }
102
+ }
103
+ const withoutAppPreference = models => models.map(({ prefer1m, ...model }) => model);
104
+ function appModelsOwned(current, previous, desired, alreadyDesired) {
105
+ const actual = parsedAppModels(current), recorded = parsedAppModels(previous);
106
+ if (!actual || !recorded) return false;
107
+ if (isDeepStrictEqual(withoutAppPreference(actual), withoutAppPreference(recorded))) return true;
108
+ // A prior manual recovery may already equal the selected generated list.
109
+ // Adopt only if surviving old entries retain their fields and relative order.
110
+ const selected = alreadyDesired && parsedAppModels(desired);
111
+ if (!selected) return false;
112
+ const oldNames = new Set(recorded.map(model => model.name)), wanted = new Set(selected.map(model => model.name));
113
+ return isDeepStrictEqual(withoutAppPreference(actual.filter(model => oldNames.has(model.name))),
114
+ withoutAppPreference(recorded.filter(model => wanted.has(model.name))));
115
+ }
116
+
90
117
  export function reconcileClaudeConfiguration(operations, { restore = false, ...options } = {}) {
91
118
  const paths = claudeClientPaths(options), allowed = new Set(Object.values(paths)), journalPath = m365Paths(options).ownership;
92
119
  fs.mkdirSync(path.dirname(journalPath), { recursive: true, mode: 0o700 });
@@ -122,10 +149,22 @@ export function reconcileClaudeConfiguration(operations, { restore = false, ...o
122
149
  setOperation(state.next, operation, desired);
123
150
  nextJournal.operations = nextJournal.operations.filter(op => !(op.file === operation.file && isDeepStrictEqual(op.keys, operation.keys) && op.itemId === operation.itemId));
124
151
  } else {
125
- if (isDeepStrictEqual(current, desired)) continue;
152
+ const modelField = operation.file === paths.profile && operation.keys.join(".") === "inferenceModels";
153
+ const currentModels = modelField && parsedAppModels(current.value), desiredModels = modelField && parsedAppModels(desired.value);
154
+ const alreadyDesired = isDeepStrictEqual(current, desired)
155
+ || Boolean(currentModels && desiredModels && isDeepStrictEqual(currentModels, desiredModels));
156
+ const owned = previous && (isDeepStrictEqual(current, { exists: true, value: previous.after })
157
+ || modelField && current.exists && appModelsOwned(current.value, previous.after, desired.value, alreadyDesired));
158
+ if (alreadyDesired) {
159
+ if (modelField && owned && previous.after !== current.value) {
160
+ nextJournal.operations = nextJournal.operations.map(op => op.file === operation.file
161
+ && isDeepStrictEqual(op.keys, operation.keys) && op.itemId === operation.itemId ? { ...op, after: current.value } : op);
162
+ }
163
+ continue;
164
+ }
126
165
  const replaceMode = operation.keys.join(".") === "deploymentMode" && [paths.normal, paths.threep].includes(operation.file)
127
166
  && current.value === "1p";
128
- if (current.exists && !replaceMode && (!previous || !isDeepStrictEqual(current, { exists: true, value: previous.after }))) { skipped.push(operation.file);continue; }
167
+ if (current.exists && !replaceMode && !owned) { skipped.push(operation.file);continue; }
129
168
  const entry = { file: operation.file, keys: operation.keys, ...(operation.itemId ? { itemId: operation.itemId } : {}),
130
169
  before: previous?.before || current, after: operation.value };
131
170
  setOperation(state.next, operation, desired);
@@ -220,7 +259,11 @@ export function configureClaudeClients({ baseUrl, apiKey, models, desktopInstall
220
259
  const name = typeof entry === "string" ? entry : entry?.name;
221
260
  return [typeof name === "string" ? claudeClientModelId(name) : "", index];
222
261
  }));
223
- const desktopEntries = desktopAliases ? claudeModelEntries(models, { desktopAliases }) : entries;
262
+ const previousByName = new Map((Array.isArray(previousModels) ? previousModels : []).filter(model => model && typeof model === "object").map(model => [model.name, model]));
263
+ const desktopEntries = (desktopAliases ? claudeModelEntries(models, { desktopAliases }) : entries).map(entry => {
264
+ const previous = previousByName.get(entry.name);
265
+ return entry.supports1m ? { ...entry, prefer1m: typeof previous?.prefer1m === "boolean" ? previous.prefer1m : true } : entry;
266
+ });
224
267
  for (let index = 0; index < models.length; index++) {
225
268
  const old = order.get(claudeClientModelId(models[index].id));
226
269
  if (old !== undefined && !order.has(desktopEntries[index].name)) order.set(desktopEntries[index].name, old);