codex-copilot-dx 1.2.17 → 1.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/docs/ARCHITECTURE.md +9 -1
- package/docs/REFERENCE.md +20 -1
- package/package.json +1 -1
- package/src/adapter.mjs +1 -1
- package/src/codex-api-config.mjs +21 -5
- package/src/connection-runtime.mjs +13 -3
- package/src/dashboard/connections.js +7 -4
- package/src/dashboard/language.js +2 -1
package/README.md
CHANGED
|
@@ -11,13 +11,13 @@ 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.18/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.18/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
|
|
|
18
18
|
The [local control console](http://127.0.0.1:2026/) separates Overview, Codex/Claude, Model sources, Usage, Requests, Checks & repairs and Settings, with a stable sticky header. Model sources owns API accounts, keys and model capabilities; application pages own visible models and defaults. Settings owns independent web/terminal colors (classic green, Klein blue or Soft pink), startup and updates. Accounts and model catalogs stay with Model sources; client-specific tools stay with their application. CLI remains English; WebUI supports English/Chinese. An interactive terminal shows bounded startup checks, source/client state, a usage table with approximate cache hit rate, notices and animation. Plain/NO_COLOR/narrow output remains supported; `--verbose` retains request detail.
|
|
19
19
|
|
|
20
|
-
Requests shows live app/source/model flow above existing summaries and finished records. Usage offers animated bars or curves; reduced motion stays static. Hidden pages stop scheduled reads; status refreshes about every two seconds and source/settings evidence about every 16 seconds. Catalogs and retained usage load on demand or every 30 minutes while open. The UI does not add inference calls. Ready means local service availability, not verified model access. First output uses ms, speed token/s, and partial/unknown usage remains explicit. Images/predictions stay opt-in; their first setup uses CLI. See the [control reference](docs/REFERENCE.md#control-console-and-online-settings), [1.2.
|
|
20
|
+
Requests shows live app/source/model flow above existing summaries and finished records. Usage offers animated bars or curves; reduced motion stays static. Hidden pages stop scheduled reads; status refreshes about every two seconds and source/settings evidence about every 16 seconds. Catalogs and retained usage load on demand or every 30 minutes while open. The UI does not add inference calls. Ready means local service availability, not verified model access. First output uses ms, speed token/s, and partial/unknown usage remains explicit. Images/predictions stay opt-in; their first setup uses CLI. 1.2.18 preserves Codex sign-in and unavailable model selections after saving bindings. See the [control reference](docs/REFERENCE.md#control-console-and-online-settings), [1.2.18 fixes and verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.18.md) and [copy inventory](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/UX_COPY.md).
|
|
21
21
|
|
|
22
22
|
## Commands
|
|
23
23
|
| Command | Purpose |
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -85,7 +85,13 @@ company-network inputs while omitting unrelated credentials and Node hooks.
|
|
|
85
85
|
|
|
86
86
|
`client-gateway-keys.mjs` separates caller identity from display hints and upstream
|
|
87
87
|
credentials. `codex-api-config.mjs` reconciles an owned provider/model/table with
|
|
88
|
-
paired writes.
|
|
88
|
+
paired writes. Native sign-in material/store policy keeps OpenAI authentication
|
|
89
|
+
enabled for account operations; the static local bearer still takes precedence
|
|
90
|
+
for model requests. No native credential writer is added. GitHub-only bindings
|
|
91
|
+
retain legacy loopback callers but expose only selected models; any mixed or
|
|
92
|
+
non-GitHub binding requires the private Codex key. Bound catalog reads use their
|
|
93
|
+
compiled facade even when the default source is GitHub, without a live refresh.
|
|
94
|
+
Claude uses its existing mounted relay and field journal with
|
|
89
95
|
independent app/code lifecycles. M365 beta policy is not imposed on API clients;
|
|
90
96
|
adding a source alone never migrates old client credentials. Configuring clients
|
|
91
97
|
does not patch/restart their binaries or override managed settings.
|
|
@@ -111,6 +117,8 @@ The existing Responses route-plan boundary continues to own opaque-state checks.
|
|
|
111
117
|
|
|
112
118
|
`dashboard/connections.js` owns settings forms; application source/review and
|
|
113
119
|
account/catalog views keep their existing scopes and use the same backend graph.
|
|
120
|
+
Its binding draft retains selected identities independently from current catalog
|
|
121
|
+
availability. Missing selections stay visible and cannot be silently dropped on save.
|
|
114
122
|
Full configuration is on-demand; ordinary status uses compact cached summaries.
|
|
115
123
|
Disabled sources and clients have separate restore lists inside their owning
|
|
116
124
|
Settings cards, hidden when empty.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -102,6 +102,25 @@ an API alone does not migrate existing M365 client credentials. First explicit
|
|
|
102
102
|
Claude connection management installs private client keys; reopen affected apps.
|
|
103
103
|
Codex reconciliation owns only the provider/model/table and preserves user edits.
|
|
104
104
|
Repeated identical setup does not rewrite its file.
|
|
105
|
+
When an existing native sign-in or credential-store policy is present, the owned
|
|
106
|
+
provider keeps `requires_openai_auth = true`. Native account operations keep their
|
|
107
|
+
own authentication; model traffic uses only CCDX's local bearer credential. A fresh
|
|
108
|
+
API-only profile without native authentication remains usable without a ChatGPT
|
|
109
|
+
login. Reconciliation never writes `auth.json` or deletes/replaces native credentials.
|
|
110
|
+
A changed default model is preserved independently; it does not prevent repair
|
|
111
|
+
of an otherwise unchanged owned provider table. Reopen Codex after an owned
|
|
112
|
+
provider/authentication configuration change.
|
|
113
|
+
|
|
114
|
+
GitHub-only explicit bindings preserve the legacy native loopback access contract,
|
|
115
|
+
including requests from a process that has not yet reloaded its configuration.
|
|
116
|
+
Their catalog comes from the selected deployments, not a second live Copilot read.
|
|
117
|
+
Adding any non-GitHub deployment requires the private Codex key for the entire
|
|
118
|
+
catalog and all bound inference requests. Unselected models remain refused.
|
|
119
|
+
A supplied non-Codex bearer receives a local 403, not a ChatGPT 401 refresh
|
|
120
|
+
challenge. Missing credentials still receive 401; neither denial reaches upstream.
|
|
121
|
+
Temporarily unavailable selected models remain visible in the application editor.
|
|
122
|
+
Saving them fails without changing prior settings; refresh the catalog or explicitly
|
|
123
|
+
clear the affected selection. A missing directory entry never means deselection.
|
|
105
124
|
|
|
106
125
|
A manual Codex provider includes an authenticated `model_catalog_url` on the same
|
|
107
126
|
listener. Supported native selectors list configured custom names. Unknown names
|
|
@@ -1227,7 +1246,7 @@ Unknown support prevents an explicitly requested exception from starting.
|
|
|
1227
1246
|
For an older updater that still requires Git, install the Release tarball directly:
|
|
1228
1247
|
|
|
1229
1248
|
```sh
|
|
1230
|
-
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.
|
|
1249
|
+
npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.18/codex-copilot-dx-1.2.18.tgz
|
|
1231
1250
|
# Windows PowerShell: use npm.cmd instead of npm.
|
|
1232
1251
|
```
|
|
1233
1252
|
|
package/package.json
CHANGED
package/src/adapter.mjs
CHANGED
|
@@ -315,7 +315,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
315
315
|
if (req.method === "GET" && pathname === "/v1/models") {
|
|
316
316
|
const clientVersion = modelClientVersion(req.url);
|
|
317
317
|
const selectedRegistry = target?.registry || codexModelRegistry;
|
|
318
|
-
const selectedListModels = target && target.id !== "github" ? target.client.listModels : listModelsFn;
|
|
318
|
+
const selectedListModels = target && (target.id !== "github" || options.providerRuntime.hasModelBindings?.()) ? target.client.listModels : listModelsFn;
|
|
319
319
|
const modelOptions = { codexModelCatalog, clientVersion, providerCatalog: target?.codexCatalog, restrictToUpstream: Boolean(target && target.id !== "github") };
|
|
320
320
|
const abort = createRequestAbort(req, res);
|
|
321
321
|
// Keep live discovery and explicit auth failures authoritative, but do
|
package/src/codex-api-config.mjs
CHANGED
|
@@ -8,6 +8,17 @@ import { atomicWriteFilePairSync } from "./atomic-file.mjs";
|
|
|
8
8
|
import { withFileLockSync } from "./lock.mjs";
|
|
9
9
|
|
|
10
10
|
const ID = "ccdx_gateway";
|
|
11
|
+
function retainsCodexSignIn(config, directory, env) {
|
|
12
|
+
if (["keyring", "auto"].includes(config.cli_auth_credentials_store) || config.forced_login_method
|
|
13
|
+
|| config.forced_chatgpt_workspace_id || ["CODEX_ACCESS_TOKEN", "CODEX_API_KEY", "OPENAI_API_KEY"].some(key => env[key])) return true;
|
|
14
|
+
try {
|
|
15
|
+
const auth = JSON.parse(readBoundedFileSync(path.join(directory, "auth.json"), { encoding: "utf8", maxBytes: 1024 * 1024 }));
|
|
16
|
+
return Boolean(auth?.auth_mode || auth?.tokens || auth?.OPENAI_API_KEY);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if (error.code === "ENOENT") return false;
|
|
19
|
+
throw accessError("ccdx_codex_config_invalid", 409);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
11
22
|
// Only the provider, selected model and private provider table are owned.
|
|
12
23
|
export function configureCodexApi({ baseUrl, apiKey, model, restore = false, ...options } = {}) {
|
|
13
24
|
if (!restore) {
|
|
@@ -27,7 +38,9 @@ export function configureCodexApi({ baseUrl, apiKey, model, restore = false, ...
|
|
|
27
38
|
const firstTable = content.search(/^\s*\[/m), head = firstTable < 0 ? content : content.slice(0, firstTable), tail = firstTable < 0 ? "" : content.slice(firstTable);
|
|
28
39
|
const sectionPattern = /^\[model_providers\.ccdx_gateway\]\r?\n[^]*?(?=^\[|$(?![^]))/m;
|
|
29
40
|
const currentSection = tail.match(sectionPattern)?.[0] || null;
|
|
30
|
-
if (owner && (config.model_provider !== ID || currentSection !== owner.section
|
|
41
|
+
if (owner && (config.model_provider !== ID || currentSection !== owner.section)) return { state: "preserved" };
|
|
42
|
+
const modelEdited = owner?.model !== undefined && config.model !== owner.model;
|
|
43
|
+
if (restore && modelEdited) return { state: "preserved" };
|
|
31
44
|
if (!owner && (config.model_provider && config.model_provider !== "openai" || config.model_providers?.[ID])) return { state: "preserved" };
|
|
32
45
|
let next, nextOwner = null;
|
|
33
46
|
if (restore) {
|
|
@@ -36,16 +49,19 @@ export function configureCodexApi({ baseUrl, apiKey, model, restore = false, ...
|
|
|
36
49
|
if (owner.model !== undefined) root = root.replace(/^model\s*=.*(?:\r?\n|$)/m, owner.beforeModel || "");
|
|
37
50
|
next = root + tail.replace(sectionPattern, owner.beforeSection || "");
|
|
38
51
|
} else {
|
|
39
|
-
|
|
52
|
+
// Account identity remains native; only model traffic uses the local key.
|
|
53
|
+
const requiresAuth = retainsCodexSignIn(config, path.dirname(file), options.env || process.env);
|
|
54
|
+
const section = `[model_providers.${ID}]\nname = "CCDX"\nbase_url = ${JSON.stringify(baseUrl)}\nmodel_catalog_url = ${JSON.stringify(baseUrl + "/models")}\nwire_api = "responses"\nrequires_openai_auth = ${requiresAuth}\nexperimental_bearer_token = ${JSON.stringify(apiKey)}\n\n`;
|
|
40
55
|
let root = head;
|
|
41
|
-
if (model) root = root.match(/^model\s*=/m) ? root.replace(/^model\s*=.*(?:\r?\n|$)/m, `model = ${JSON.stringify(model)}\n`) : `model = ${JSON.stringify(model)}\n` + root;
|
|
56
|
+
if (model && !modelEdited) root = root.match(/^model\s*=/m) ? root.replace(/^model\s*=.*(?:\r?\n|$)/m, `model = ${JSON.stringify(model)}\n`) : `model = ${JSON.stringify(model)}\n` + root;
|
|
42
57
|
next = (root.match(/^model_provider\s*=/m) ? root.replace(/^model_provider\s*=.*(?:\r?\n|$)/m, `model_provider = "${ID}"\n`) : `model_provider = "${ID}"\n` + root)
|
|
43
58
|
+ (currentSection ? tail.replace(sectionPattern, section) : tail + (tail && !tail.endsWith("\n") ? "\n" : "") + "\n" + section);
|
|
44
59
|
nextOwner = { version: 1, beforeProvider: owner ? owner.beforeProvider : head.match(/^model_provider\s*=.*(?:\r?\n|$)/m)?.[0] || null,
|
|
45
60
|
beforeSection: owner ? owner.beforeSection : currentSection, section,
|
|
46
|
-
...(
|
|
61
|
+
...(modelEdited ? { model: owner.model, beforeModel: owner.beforeModel }
|
|
62
|
+
: model ? { model, beforeModel: owner && Object.hasOwn(owner, "beforeModel") ? owner.beforeModel : head.match(/^model\s*=.*(?:\r?\n|$)/m)?.[0] || null } : {}) };
|
|
47
63
|
}
|
|
48
64
|
parse(next);if (next !== content || JSON.stringify(nextOwner) !== JSON.stringify(owner)) atomicWriteFilePairSync(file, next, journal, nextOwner ? JSON.stringify(nextOwner) + "\n" : null, { mode: 0o600 });
|
|
49
|
-
return { state: "configured", changed: next !== content };
|
|
65
|
+
return { state: modelEdited ? "preserved" : "configured", changed: next !== content };
|
|
50
66
|
});
|
|
51
67
|
}
|
|
@@ -38,6 +38,16 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
38
38
|
const identities = () => keys ||= readClientGatewayKeys(options);
|
|
39
39
|
const enabled = id => id?.startsWith("api_") ? settings.apis.find(api => api.id === id)?.enabled === true : settings.providers[id] === true;
|
|
40
40
|
const binding = id => managed ? settings.clients[id] : { ...settings.clients[id], source: id === "codex" ? legacy.selection().codex : legacy.snapshot().m365.enabled ? "m365" : null };
|
|
41
|
+
// GitHub-only selections retain the existing native loopback access contract.
|
|
42
|
+
// Any other deployment still requires the private per-client credential.
|
|
43
|
+
const codexRequiresKey = () => !Array.isArray(binding("codex").deployments)
|
|
44
|
+
|| !binding("codex").deployments.length || binding("codex").deployments.some(item => item.source !== "github");
|
|
45
|
+
function requireCodexKey(req) {
|
|
46
|
+
if (gatewayClient(req.headers, identities()) === "codex") return;
|
|
47
|
+
// An old native process may still send its ChatGPT bearer. A local access
|
|
48
|
+
// denial must not trigger recovery/replacement of that unrelated sign-in.
|
|
49
|
+
throw accessError("ccdx_client_credential_required", req.headers?.authorization ? 403 : 401);
|
|
50
|
+
}
|
|
41
51
|
const permitted = (id, source) => binding(id)?.enabled && binding(id).allowed.includes(source) && enabled(source);
|
|
42
52
|
function getSource(id) {
|
|
43
53
|
if (!id?.startsWith("api_")) return legacy.source(id);
|
|
@@ -311,18 +321,18 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
|
|
|
311
321
|
const c = binding("codex"), compiled = plan("codex");
|
|
312
322
|
const source = requireSource("codex", Array.isArray(c.deployments) ? compiled.routes.get(compiled.defaultModel)?.source : c.source);
|
|
313
323
|
if (Array.isArray(c.deployments) && req?.method === "GET") {
|
|
314
|
-
if (
|
|
324
|
+
if (codexRequiresKey()) requireCodexKey(req);
|
|
315
325
|
return { ...source, registry: { models: { data: compiled.models.map(model => ({ ...model, id: model.public_id })) } },
|
|
316
326
|
client: { ...source.client, listModels: async () => ({ status: 200, body: JSON.stringify({ data: compiled.models.map(model => ({ ...model, id: model.public_id })) }) }) },
|
|
317
327
|
codexCatalog: codexClientCatalog(compiled, getSource) };
|
|
318
328
|
}
|
|
319
|
-
if (source?.id.startsWith("api_") && req
|
|
329
|
+
if (source?.id.startsWith("api_") && req) requireCodexKey(req);
|
|
320
330
|
return source;
|
|
321
331
|
},
|
|
322
332
|
hasModelBindings(client = "codex") { return managed && Array.isArray(binding(client).deployments); },
|
|
323
333
|
resolveCodex(body, req) {
|
|
324
334
|
if (!managed || !Array.isArray(binding("codex").deployments)) return null;
|
|
325
|
-
if (
|
|
335
|
+
if (codexRequiresKey()) requireCodexKey(req);
|
|
326
336
|
const requested = body.model === "codex-auto-review" ? binding("codex").auto_review_model || plan("codex").defaultModel : body.model;
|
|
327
337
|
if (body.model === "codex-auto-review") {
|
|
328
338
|
delete body.service_tier;
|
|
@@ -221,17 +221,20 @@
|
|
|
221
221
|
function bindingRows() {
|
|
222
222
|
el("connection-client-cancel").disabled = !bindingDirty;
|
|
223
223
|
const body = el("connection-bindings"), c = client(editingClient);body.replaceChildren();
|
|
224
|
-
|
|
224
|
+
const available = c.model_plan?.available || [], availableKeys = new Set(available.map(item => bindingKey(item.source, item.id)));
|
|
225
|
+
const missing = [...bindingSelection].filter(key => !availableKeys.has(key)).map(key => { const [source, id] = key.split("\0");return { source, id, unavailable: true }; });
|
|
226
|
+
for (const item of [...available, ...missing]) {
|
|
225
227
|
const key = bindingKey(item.source, item.id), row = node("tr"), name = node("td"), capability = item.capability?.values || {};
|
|
226
228
|
const selection = check("binding-model", key, bindingSelection.has(key), item.id);
|
|
227
229
|
selection.firstChild.addEventListener("change", event => {
|
|
228
230
|
bindingDirty = true;if (event.target.checked) { bindingSelection.add(key);bindingDefault ||= routeId(item); }
|
|
229
|
-
else { bindingSelection.delete(key);if (bindingDefault === routeId(item)) bindingDefault =
|
|
231
|
+
else { bindingSelection.delete(key);if (bindingDefault === routeId(item) || !available.some(entry => routeId(entry) === bindingDefault)) bindingDefault = available.find(entry => bindingSelection.has(bindingKey(entry.source, entry.id)))?.route_id || null; }
|
|
230
232
|
bindingRows();
|
|
231
233
|
});name.append(selection);
|
|
232
234
|
const action = button(bindingDefault === routeId(item) && bindingSelection.has(key) ? "cap_default" : "cap_set_default", () => { bindingDirty = true;bindingSelection.add(key);bindingDefault = routeId(item);bindingRows(); });
|
|
233
235
|
action.setAttribute("aria-pressed", String(bindingDefault === routeId(item) && bindingSelection.has(key)));
|
|
234
|
-
const cell = node("td");
|
|
236
|
+
const cell = node("td");if (item.unavailable) words(cell, "cap_model_unavailable");else cell.append(action);
|
|
237
|
+
row.append(name, node("td", source(item.source)?.name || item.source), node("td", count(capability.context_window)), node("td", reasoningText(capability)), cell);body.append(row);
|
|
235
238
|
}
|
|
236
239
|
if (!body.children.length) { const row = node("tr"), cell = node("td");cell.colSpan = 5;words(cell, "cap_no_models");const link = node("a");link.href = "#models";words(link, "model_services");cell.append(" ", link);row.append(cell);body.append(row); }
|
|
237
240
|
}
|
|
@@ -244,7 +247,7 @@
|
|
|
244
247
|
el("connection-client-cancel").addEventListener("click", () => mountClient(true));
|
|
245
248
|
function bindingInput(operation) {
|
|
246
249
|
const c = client(editingClient);return { operation, id: c.id, enabled: true, allowed: c.allowed,
|
|
247
|
-
deployments:
|
|
250
|
+
deployments: [...bindingSelection].map(key => { const [source, model] = key.split("\0");return { source, model }; }),
|
|
248
251
|
default_model: bindingDefault, auto_sync: el("connection-auto-sync").checked };
|
|
249
252
|
}
|
|
250
253
|
clientForm.addEventListener("submit", event => { event.preventDefault();void change(bindingInput("client")); });
|
|
@@ -125,7 +125,8 @@
|
|
|
125
125
|
"ccdx_api_name_exists": ["This source name is already used. Choose another name.", "来源名称已存在,请换一个名称。"],
|
|
126
126
|
"ccdx_api_model_reserved": ["codex-auto-review is reserved by CCDX. Enter the real upstream model ID.", "codex-auto-review 为内部名称,请填真实模型 ID。"],
|
|
127
127
|
"ccdx_connections_limit": ["Connection settings exceed the 8 MiB limit.", "接入配置超过 8 MiB 上限。"],
|
|
128
|
-
"ccdx_api_model_unavailable": ["
|
|
128
|
+
"ccdx_api_model_unavailable": ["Selected model unavailable. Refresh or clear its selection.", "所选模型暂不可用,请刷新或取消选择。"],
|
|
129
|
+
"cap_model_unavailable": ["Unavailable", "暂不可用"],
|
|
129
130
|
"ccdx_api_protocol_required": ["Claude needs Messages; Codex needs Responses.", "Claude 需 Messages;Codex 需 Responses。"],
|
|
130
131
|
"ccdx_api_effort_unavailable": ["Choose a reasoning level advertised by this model, or follow the client.", "请选择模型支持的推理档位,或跟随客户端。"],
|
|
131
132
|
"ccdx_source_in_use": ["Change the current source or pause its clients first.", "请先更换来源,或暂停相关客户端。"],
|