codex-copilot-dx 1.2.24 → 1.2.25

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.24/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.24/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.25/install.sh) (macOS/Linux) or [install.ps1](https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.25/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
 
@@ -54,9 +54,9 @@ Requests shows live app/source/model flow above existing summaries and finished
54
54
 
55
55
  Run `ccdx web` without GitHub sign-in. In **Model sources → Add API**, enter the HTTPS address/key, read the catalog, select models and declare their real interfaces. Then open **Codex** or **Claude**, choose visible models across sources, set a default and save. Claude App/Code use Messages; Codex uses Responses, all on port 2026. GitHub-only Codex selections retain native OpenAI mode and readable model names. Token counting is separate from message generation. For manual APIs, an observed count-endpoint 404 is remembered for one minute per model/API-header scope; CCDX returns a clear 404 without inventing a token count. Unknown count capabilities share their first admitted request; a 404 prevents distinct waiting inputs from fanning out. A supported endpoint still counts each distinct input separately. Identical small count requests share bounded work. A request stays on its selected deployment; there is no automatic cross-source retry or model replacement. Reopen clients after configuration changes and start a new conversation after source/key changes. 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. 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.
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.24 changes and verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.24.md) cover upstream maker metadata, first-wave token-count compatibility, memory-model dependency notices and dashed flow activity 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.25 changes and verification](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/RELEASE_1.2.25.md) cover paused-access recovery, installation-lock diagnostics, native memory-state labels, cancellable API preparation and isolated flow animation while retaining native GitHub sign-in/model protections.
60
60
 
61
61
  ## Microsoft 365 access
62
62
 
@@ -24,6 +24,15 @@ which owns grants, switches, versioned model-deployment bindings and lifecycle.
24
24
  validates strict versioned metadata and locked atomic writes; stale cross-process
25
25
  saves are rejected. Accepted inputs and public snapshots do not share mutable
26
26
  objects with the live graph. The built-in registry does not load external code.
27
+ One Codex access-mode calculation distinguishes disabled, paused (no selections),
28
+ native GitHub and gateway bindings. Sync and request authorization share that
29
+ calculation; paused access is rejected before credential checks without expanding
30
+ model visibility or changing sign-in.
31
+
32
+ Manual API setup uses abort-aware shared waits for credentials and transport.
33
+ A cancelled caller releases its wait independently; a late shared result cannot
34
+ resume its request. Messages keeps body upload, preparation and upstream budgets
35
+ separate using the existing request-abort boundary.
27
36
 
28
37
  `model-capabilities.mjs` owns neutral limits, reasoning/tool/input/search fields,
29
38
  strict manual values, per-field evidence and deployment revisions. It reads no
@@ -533,6 +542,8 @@ Byte-weighted request admission is not a simultaneous-stream limit. The 1.2.0 lo
533
542
  and no-Node bootstraps. It bounds downloads/decompression, verifies the exact
534
543
  release package and checksum, backs up only this package/commands under an
535
544
  exclusive lock, restores on failure and validates the version/sharp/broker.
545
+ The lock records its PID, timestamp and backup path; existing/legacy locks remain
546
+ explicit recovery barriers, while unrelated I/O failures keep their own cause.
536
547
  It reuses the selected npm's bundled downloader with named proxy/CA/TLS/offline settings and no retries; no new download dependency is added. No network installation runs on ordinary startup or inference paths. Opted-in supervisor startup copies/verifies its current immutable runtime; its separate night scheduler is described below. `package-update.mjs` keeps
537
548
  source choice, named npm-policy probes and fixed platform launch arguments;
538
549
  verified filenames enter cmd.exe, while paths enter cwd. Private-runtime commands
package/docs/REFERENCE.md CHANGED
@@ -92,6 +92,15 @@ starts. Its value is never returned by management or copied into client config.
92
92
  Private helpers omit unrelated credentials and Node hooks. API error bodies are
93
93
  replaced with stable codes; valid Retry-After metadata is retained.
94
94
 
95
+ An explicit empty Codex deployment array pauses CCDX access, including after a
96
+ restart or disabling the last selected source. Models, Responses and compact
97
+ requests return `503 ccdx_client_source_disabled` before checking a client key;
98
+ no upstream call, automatic model selection or login repair is attempted. Enable
99
+ the app/source and select at least one model to resume. GitHub-only selections
100
+ retain native OpenAI mode; nonempty mixed/API deployments retain private-key
101
+ authentication. With automatic sync enabled, pausing restores only owned Codex
102
+ configuration; manual sync leaves native files unchanged. Neither changes login.
103
+
95
104
  `client-gateway-keys.json` holds local credentials separately. Disabled sources leave normal source lists. **Model sources** owns **Disabled sources**; application access cards own **Disabled clients**. App navigation remains available while access is closed, so its restoration control stays reachable. Each
96
105
  collapsed list appears only when it has entries and provides **Enable again**.
97
106
  Closing a client stops CCDX access, not the app. Disabling an in-use source
@@ -1264,8 +1273,13 @@ Before npm changes a discovered global target, CCDX backs up only its package
1264
1273
  and two command entries and acquires an exclusive install lock. A linked target
1265
1274
  is preserved and refused. Installer or runtime-verification failure restores the
1266
1275
  old package/commands; successful installation removes the backup. A failed restore
1267
- reports the retained backup and lock for manual recovery. A lock left by a killed
1268
- installer requires checking that no installation is running before removing it.
1276
+ reports the retained backup and lock for manual recovery. New lock records include
1277
+ the installer PID, creation time and backup directory. Existing-lock errors name
1278
+ the exact file; other lock-creation failures retain their actual I/O error rather
1279
+ than claiming another install. Old empty locks remain owner-unknown. A lock left
1280
+ by a killed installer requires checking that no installation is running and
1281
+ inspecting its retained backup before recovery. Locks are not removed merely
1282
+ because they are old; an incomplete restore must be completed first.
1269
1283
  There is no promise of crash/power-loss atomicity. Other apps, credentials,
1270
1284
  settings, caches and the running service are not replaced. Readonly/busy Windows
1271
1285
  files can prevent installation; finish use of that installation and retry.
@@ -1302,7 +1316,7 @@ Unknown support prevents an explicitly requested exception from starting.
1302
1316
  For an older updater that still requires Git, install the Release tarball directly:
1303
1317
 
1304
1318
  ```sh
1305
- npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.24/codex-copilot-dx-1.2.24.tgz
1319
+ npm install -g https://github.com/DaleXiao/codex-copilot-dx/releases/download/v1.2.25/codex-copilot-dx-1.2.25.tgz
1306
1320
  # Windows PowerShell: use npm.cmd instead of npm.
1307
1321
  ```
1308
1322
 
@@ -1749,7 +1763,7 @@ unset the variable after the investigation. Records disappear on service exit.
1749
1763
  | `CCDX_REQUEST_BODY_TIMEOUT_MS` | `120000` | Maximum time to receive and decode a request body before returning `408` |
1750
1764
  | `CCDX_MAX_UPSTREAM_BODY_BYTES` | `31457280` | Strict maximum forwarded Responses body size; larger payloads are adapted locally or rejected with `413` |
1751
1765
  | `CCDX_MAX_SSE_BUFFER_BYTES` | `8388608` | Maximum buffered bytes for one unterminated upstream SSE line or event |
1752
- | `CCDX_UPSTREAM_TIMEOUT_MS` | `120000` | Per-phase timeout for Responses preparation and non-streaming upstream requests |
1766
+ | `CCDX_UPSTREAM_TIMEOUT_MS` | `120000` | Per-phase timeout for Responses/Messages preparation and non-streaming upstream requests |
1753
1767
  | `CCDX_STREAM_HANDSHAKE_TIMEOUT_MS` | `120000` | Timeout while waiting for upstream streaming response headers |
1754
1768
  | `CCDX_STREAM_IDLE_TIMEOUT_MS` | `120000` | Maximum idle time between upstream streaming body chunks |
1755
1769
  | `CCDX_UPSTREAM_RETRIES` | `2` | Retries for safe requests and clearly pre-connect POST failures; capped at `5` |
@@ -1829,6 +1843,16 @@ Native Responses forwards Codex `agent_message` items unchanged. When a model re
1829
1843
 
1830
1844
  After the stream handshake succeeds, stream liveness uses the idle timeout rather than the expired handshake deadline. Eligible HTTP-200 failure recovery acquires a bounded preparation budget and history admission before rebuilding its payload, then releases those reservations when the retry opens upstream or fails. Normal streams still release preparation admission after their response headers arrive.
1831
1845
 
1846
+ Messages and token counting stop the body-upload timer after JSON is read, then
1847
+ use `CCDX_UPSTREAM_TIMEOUT_MS` for preparation. A preparation timeout returns
1848
+ `504 messages_prepare_timeout`; a slow body upload remains governed by its own
1849
+ body timeout. Upstream dispatch starts the existing handshake/non-streaming
1850
+ budget, and counting keeps its shared dispatch deadline across capability waits.
1851
+ Cancelling a manual API credential waiter returns promptly without cancelling
1852
+ other callers or forwarding after a late credential result. The shared OS secret
1853
+ read may finish under its existing ten-second bound. No new timeout setting or
1854
+ inference retry is added.
1855
+
1832
1856
  Downstream backpressure waits also observe cancellation and the stream deadline. A client that stops reading cannot retain the pending stream indefinitely after timeout; CCDX closes that connection without retrying its request. Final error-frame delivery has a separate one-second maximum drain wait.
1833
1857
 
1834
1858
  Successful streaming responses are accepted only when the upstream body is SSE and reaches its protocol terminal event. Unexpected EOF becomes a protocol-native stream error, and repeated blank tool-argument deltas are stopped per tool call. Allowlisted rate-limit, retry, model, trace, and upstream request-ID metadata are forwarded; cookies, authorization, body-length, and encoding headers are not.
@@ -2120,7 +2144,11 @@ one unambiguous local HTTP 400 model. No prompt, memory text or model-name
2120
2144
  heuristic is used. Explicit configuration is labelled Configured in Codex;
2121
2145
  observations are Recently observed. The current client does not expose its
2122
2146
  compiled default in the queried interface, so CCDX does not label a guessed
2123
- model as Codex default. Without evidence it shows Not detected.
2147
+ model as Codex default. With memory generation explicitly enabled but no model
2148
+ evidence, the editor shows Chosen by Codex and Default model ID not available;
2149
+ this does not infer a model from the checked model list or claim a successful
2150
+ memory write. With generation explicitly disabled it shows Memory generation is
2151
+ off. Unknown generation state and no model evidence remain Not detected.
2124
2152
 
2125
2153
  The optional native log helper runs only on startup/connection-view reads (including an explicit WebUI refresh),
2126
2154
  coalesced and at least one minute apart, with a 2.5-second limit. It reads up to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
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",
@@ -13,7 +13,7 @@ export const CLIENT_NAMES = Object.freeze({ codex: "Codex App", claude_app: "Cla
13
13
  const APIS = ["messages", "responses", "chat"];
14
14
  const messages = {
15
15
  ccdx_codex_catalog_cache_unavailable: "Codex model cache could not be refreshed safely. Close Codex App and try again; existing files were kept.",
16
- ccdx_client_source_disabled: "This client's CCDX access or selected source is disabled. Review Settings.",
16
+ ccdx_client_source_disabled: "CCDX access is paused. Enable the app and source, then select a model in the WebUI.",
17
17
  ccdx_client_credential_required: "The client's local CCDX credential is missing or outdated. Reopen the client after setup.",
18
18
  ccdx_conversation_source_changed: "This conversation was observed on another source or key. Start a new conversation.",
19
19
  ccdx_conversation_state_invalid: "Conversation source records are unreadable. The existing file was preserved.",
@@ -130,6 +130,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
130
130
  release = await acquireRequest(req, { signal: abort.signal });
131
131
  abort.setTimeout(config.requestBodyTimeoutMs, "request_body_timeout");
132
132
  let body = await readJsonBody(req, { admission: release, signal: abort.signal, maxBodyBytes: config.maxBodyBytes, maxDecodedBodyBytes: decodedLimit });
133
+ abort.setTimeout(config.upstreamTimeoutMs, "messages_prepare_timeout");
133
134
  observeRequestedModel(body);
134
135
  context.requestOptions = requestOptionsEvidence(body);
135
136
  if (!body || typeof body.model !== "string" || !Array.isArray(body.messages)) {
@@ -159,6 +160,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
159
160
  if (value.upstream) { context.upstreamAttempts = (context.upstreamAttempts || 0) + 1;tracker?.upstreamStarted(false); }
160
161
  },
161
162
  onUpstreamStart() {
163
+ if (abort.signal.aborted) throw abort.signal.reason;
162
164
  const timeout = streamed ? config.streamHandshakeTimeoutMs : config.upstreamTimeoutMs;
163
165
  if (countTokens) countDeadline ??= Date.now() + timeout;
164
166
  abort.setTimeout(countTokens ? Math.max(1, countDeadline - Date.now()) : timeout, "upstream_timeout");
@@ -224,7 +226,7 @@ export function createClaudeGatewayHandler({ provider, apiKey, desktopAliases =
224
226
  context.onHttpError?.({ code: detail.code, origin: terminalOrigin, ...(diagnostic ? { transport: diagnostic } : {}) });
225
227
  if (outcome === "cancelled") return;
226
228
  if (!res.headersSent) {
227
- const value = apiError(error.code || abort.reason || "ccdx_gateway_error", message);
229
+ const value = apiError(abort.reason || error.code || "ccdx_gateway_error", message);
228
230
  if (diagnostic) value.error.diagnostic = diagnostic;
229
231
  send(res, statusCode, value);
230
232
  }
@@ -50,8 +50,16 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
50
50
  const binding = id => managed ? settings.clients[id] : { ...settings.clients[id], source: id === "codex" ? legacy.selection().codex : legacy.snapshot().m365.enabled ? "m365" : null };
51
51
  // GitHub-only selections retain the existing native loopback access contract.
52
52
  // Any other deployment still requires the private per-client credential.
53
- const codexRequiresKey = () => !Array.isArray(binding("codex").deployments)
54
- || !binding("codex").deployments.length || binding("codex").deployments.some(item => item.source !== "github");
53
+ function codexAccessMode() {
54
+ const client = binding("codex");
55
+ if (!client.enabled) return "disabled";
56
+ if (Array.isArray(client.deployments)) {
57
+ if (!client.deployments.length) return "paused";
58
+ return client.deployments.every(item => item.source === "github") ? "native" : "gateway";
59
+ }
60
+ return !client.source ? "paused" : client.source === "github" ? "native" : "gateway";
61
+ }
62
+ const codexRequiresKey = () => codexAccessMode() === "gateway";
55
63
  function requireCodexKey(req) {
56
64
  if (gatewayClient(req.headers, identities()) === "codex") return;
57
65
  // An old native process may still send its ChatGPT bearer. A local access
@@ -147,9 +155,12 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
147
155
  if (!managed || closed) return;
148
156
  if (options.preserveClientConfiguration?.()) { for (const id of targets) setup[id] = "preserved";return; }
149
157
  const codex = binding("codex"), compiledCodex = plan("codex");
150
- const explicit = Array.isArray(codex.deployments), native = explicit ? codex.deployments.length > 0 && codex.deployments.every(item => item.source === "github") : codex.source === "github";
158
+ const explicit = Array.isArray(codex.deployments), mode = codexAccessMode(), native = mode === "native";
151
159
  if (targets.has("codex")) try {
152
- if (codex.enabled && codex.auto_sync === false) setup.codex = "manual_sync";
160
+ if (mode === "paused" || mode === "disabled") {
161
+ if (mode === "disabled" || codex.auto_sync !== false) configureCodex({ ...options, restore: true });
162
+ setup.codex = mode;
163
+ } else if (codex.auto_sync === false) setup.codex = "manual_sync";
153
164
  else if (codex.enabled && compiledCodex.defaultUnavailable && !native) setup.codex = "default_unavailable";
154
165
  else {
155
166
  setup.codex = configureCodex({ ...options, ...(codex.enabled && (native || explicit && codex.deployments.length || codex.source?.startsWith("api_"))
@@ -387,9 +398,10 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
387
398
  },
388
399
  current(req) {
389
400
  if (!managed) return legacy.current();
401
+ const mode = codexAccessMode();
402
+ if (mode === "paused" || mode === "disabled") throw accessError("ccdx_client_source_disabled", 503);
390
403
  const c = binding("codex"), compiled = plan("codex");
391
404
  if (Array.isArray(c.deployments) && req?.method === "GET") {
392
- if (!c.enabled) throw accessError("ccdx_client_source_disabled", 503);
393
405
  if (codexRequiresKey()) requireCodexKey(req);
394
406
  return { id: "connections", registry: { models: { data: compiled.models.map(model => ({ ...model, id: model.public_id })) } },
395
407
  client: { listModels: async () => ({ status: 200, body: JSON.stringify({ data: compiled.models.map(model => ({ ...model, id: model.public_id })) }) }) },
@@ -407,7 +419,10 @@ export function createConnectionRuntime({ legacy, home, env = process.env, platf
407
419
  },
408
420
  hasModelBindings(client = "codex") { return managed && Array.isArray(binding(client).deployments); },
409
421
  resolveCodex(body, req) {
410
- if (!managed || !Array.isArray(binding("codex").deployments)) return null;
422
+ if (!managed) return null;
423
+ const mode = codexAccessMode();
424
+ if (mode === "paused" || mode === "disabled") throw accessError("ccdx_client_source_disabled", 503);
425
+ if (!Array.isArray(binding("codex").deployments)) return null;
411
426
  if (codexRequiresKey()) requireCodexKey(req);
412
427
  const requested = body.model === "codex-auto-review" ? binding("codex").auto_review_model || plan("codex").defaultModel : body.model;
413
428
  if (body.model === "codex-auto-review") {
@@ -264,8 +264,8 @@
264
264
  const area = el("connection-memory-model");if (!area || !data) return;
265
265
  area.hidden = editingClient !== "codex";if (area.hidden) return;
266
266
  const c = client("codex"), dep = c.memory_model || {};
267
- el("connection-memory-name").textContent = dep.model || format("memory_not_detected");
268
- words(el("connection-memory-basis"), dep.model ? `memory_basis_${dep.basis}` : "");
267
+ el("connection-memory-name").textContent = dep.model || format(dep.enabled === true ? "memory_codex_default" : dep.enabled === false ? "memory_generation_off" : "memory_not_detected");
268
+ words(el("connection-memory-basis"), dep.model ? `memory_basis_${dep.basis}` : dep.enabled === true ? "memory_default_unknown" : "");
269
269
  const selected = (c.deployments || c.model_plan?.models || []).some(memoryMatches);
270
270
  const draft = dep.model && [...bindingSelection].some(key => {
271
271
  const [source, id] = key.split("\0");return memoryMatches({ id, route_id: c.model_plan?.available?.find(x => x.source === source && x.id === id)?.route_id });
@@ -7,6 +7,7 @@
7
7
  const format = (key, values = {}) => globalThis.ccdxLanguage.format(key, values);
8
8
  const nodes = { apps: new Map(), models: new Map() };
9
9
  const detailRows = new Map();
10
+ const movingWires = new Map();
10
11
  let rows = [], total = null, omitted = 0, fresh = false, deadline = 0, expiry = null;
11
12
  let selected = null, expanded = false, lastSignature = "", geometry = "", wireState = "", positions = null, known = false;
12
13
  let lastApps = [], lastModels = [];
@@ -150,17 +151,25 @@
150
151
  const matches = rows.filter(row => (edge.left ? row.application : modelKey(row)) === edge.id && related(row));
151
152
  return { active: fresh && matches.length > 0, moving: fresh && matches.some(responding), dim: edge.node.dataset.related === "false" };
152
153
  });
153
- const state = JSON.stringify(states), wires = el("flow-wires");
154
+ const state = JSON.stringify(states), wires = el("flow-wires"), activity = el("flow-active-wires");
154
155
  if (next === geometry && state === wireState) return;
155
156
  if (next !== geometry) {
156
157
  geometry = next;wires.setAttribute("viewBox", `0 0 ${width} ${height}`);wires.replaceChildren();
158
+ activity.setAttribute("viewBox", `0 0 ${width} ${height}`);activity.replaceChildren();movingWires.clear();
157
159
  for (const edge of edges) wires.append(svg("path", { d: edge.d }));
158
160
  }
159
161
  wireState = state;
160
162
  edges.forEach((edge, index) => {
161
163
  const value = states[index], path = wires.children[index];
162
- path.setAttribute("class", `flow-wire${value.dim ? " flow-dim" : value.active ? " flow-live" : ""}${value.moving ? " flow-streaming" : value.active ? " flow-waiting" : ""}`);
164
+ const classes = `flow-wire${value.dim ? " flow-dim" : value.active ? " flow-live" : ""}${value.moving ? " flow-streaming" : value.active ? " flow-waiting" : ""}`;
165
+ path.setAttribute("class", classes + (value.moving ? " flow-split" : ""));
166
+ let copy = movingWires.get(path);
167
+ if (value.moving) {
168
+ if (!copy) { copy = svg("path", { d: edge.d });activity.append(copy);movingWires.set(path, copy); }
169
+ copy.setAttribute("class", classes);
170
+ } else if (copy) { copy.remove();movingWires.delete(path); }
163
171
  });
172
+ if (movingWires.size) activity.removeAttribute("hidden");else activity.setAttribute("hidden", "");
164
173
  }
165
174
  function unavailable() { clearTimeout(expiry);expiry = null;fresh = false;deadline = 0;render(); }
166
175
  function visibilityChanged() { if (deadline && Date.now() >= deadline) { unavailable();return; }render();draw(); }
@@ -18,7 +18,7 @@
18
18
  }
19
19
  const kind = value => ["running", "active"].includes(value) ? "running"
20
20
  : ["ready", "authorized", "configured", "saved", "passed", "ok", "completed"].includes(value) ? "ok"
21
- : ["unavailable", "disabled", "unsupported", "not_installed", "unconfigured"].includes(value) ? "unavailable"
21
+ : ["unavailable", "disabled", "paused", "unsupported", "not_installed", "unconfigured"].includes(value) ? "unavailable"
22
22
  : ["warn", "err", "invalid", "failed", "configuration_unavailable"].includes(value) ? "warning" : "unknown";
23
23
  globalThis.ccdxIcons = { icon, set, kind };
24
24
  })();
@@ -311,6 +311,7 @@
311
311
  <div class="panel-heading"><h2 data-i18n="request_flow">REQUEST FLOW</h2><span id="flow-state" role="status" aria-live="polite" data-i18n="flow_status_unknown">Status unavailable</span></div>
312
312
  <div id="flow-network" class="flow-network" role="group" data-i18n-label="request_flow" aria-label="Request flow">
313
313
  <svg id="flow-wires" class="flow-wires" aria-hidden="true"></svg>
314
+ <svg id="flow-active-wires" class="flow-wires flow-activity" aria-hidden="true" hidden></svg>
314
315
  <div class="flow-column"><p class="flow-column-title" data-i18n="clients">Apps</p><div id="flow-apps" class="flow-apps"></div></div>
315
316
  <div class="flow-hub-column"><button id="flow-hub" type="button" data-i18n-label="flow_show_all" aria-label="Show all requests"><b>CCDX</b></button></div>
316
317
  <div class="flow-column"><p class="flow-column-title" data-i18n="flow_sources_models">Sources / models</p><div id="flow-models"></div></div>
@@ -1,11 +1,14 @@
1
1
  (() => {
2
2
  const translations = {
3
3
  "request_access_blocked": ["Access blocked", "请求已拦截"],
4
+ "access_paused": ["Access paused", "接入已暂停"],
4
5
  "not_applicable": ["Not applicable", "不适用"],
5
6
  "model_owner": ["Model owner", "模型归属"],
6
7
  "memory_extract_model": ["Memory extraction model", "记忆提取模型"],
7
8
  "memory_extract_role": ["Memory extraction", "记忆提取"],
8
9
  "memory_not_detected": ["Not detected", "未检测到"],
10
+ "memory_codex_default": ["Chosen by Codex", "由 Codex 选择"],
11
+ "memory_default_unknown": ["Default model ID not available.", "尚未取得默认型号。"],
9
12
  "memory_basis_configured": ["Configured in Codex", "Codex 已配置"],
10
13
  "memory_basis_observed": ["Recently observed", "最近检测到"],
11
14
  "memory_model_on": ["Enabled", "已启用"],
@@ -41,7 +44,7 @@
41
44
  "model_not_selected_message": ["This model is not selected for this app.", "此应用尚未选入该模型。"],
42
45
  "model_ambiguous_message": ["This model name matches multiple sources. Select its source-specific entry.", "模型同名,请选择明确来源。"],
43
46
  "model_catalog_unavailable_message": ["The selected model is not currently available in its source catalog.", "来源目录中暂时没有该模型。"],
44
- "client_source_disabled_message": ["This app or its model source is turned off.", "应用或模型来源已关闭。"],
47
+ "client_source_disabled_message": ["Access is paused. Enable the app and source, then select a model.", "接入已暂停。请启用应用和来源,并选择模型。"],
45
48
  "local_validation_message": ["The request was rejected locally before an upstream call.", "本机校验未通过,未调用上游。"],
46
49
  "count_endpoint_missing_message": ["The source's token-count endpoint returned HTTP 404. Message generation is separate.", "上游计数接口返回 404,回复另行处理。"],
47
50
  "nightly_update": ["Update overnight", "夜间自动更新"],
@@ -213,7 +216,7 @@
213
216
  "ccdx_source_in_use": ["Change the current source or pause its clients first.", "请先更换来源,或暂停相关客户端。"],
214
217
  "ccdx_source_busy": ["A previous M365 request is still running. Let it finish before disabling.", "旧的 M365 请求仍在运行,请结束后关闭。"],
215
218
  "ccdx_provider_environment_disabled": ["Microsoft 365 is disabled by CCDX_M365=0.", "Microsoft 365 已被环境设置关闭。"],
216
- "ccdx_client_source_disabled": ["The client or source is disabled. Review Settings.", "客户端或来源已关闭,请查看设置。"],
219
+ "ccdx_client_source_disabled": ["Access is paused. Enable the app and source, then select a model.", "接入已暂停。请启用应用和来源,并选择模型。"],
217
220
  "ccdx_client_source_mismatch": ["Save the selected source before changing its review model.", "请先保存来源,再修改审查模型。"],
218
221
  "ccdx_conversation_source_changed": ["This history belongs to another source or key. Start a new conversation.", "此历史属于其他来源或 Key,请新建对话。"],
219
222
  "ccdx_conversation_state_invalid": ["Conversation source records are unreadable. The existing file was kept.", "会话来源记录无法读取,原文件已保留。"],
@@ -12,7 +12,7 @@
12
12
  function renderProviders(data) {
13
13
  const providers = data.providers || [];
14
14
  const states = { saved: "saved_locally", authorized: "authorized", disabled: "disabled", unavailable: "unavailable_ca184",
15
- unknown: "unknown", unconfigured: "not_configured", ready: "ready", checking: "checking", unsupported: "unsupported",
15
+ unknown: "unknown", paused: "access_paused", unconfigured: "not_configured", ready: "ready", checking: "checking", unsupported: "unsupported",
16
16
  configured: "configured", default_unavailable: "cap_default_unavailable", preserved: "existing_settings_kept", partially_preserved: "existing_settings_kept",
17
17
  restored: "settings_restored", not_installed: "not_installed", configuration_unavailable: "setup_unavailable", not_configured: "unknown", standby: "standby" };
18
18
  const auth = element("provider-auth"), clients = element("provider-clients"), requests = element("provider-requests"), claudeClients = element("claude-clients");
@@ -51,7 +51,7 @@
51
51
  }
52
52
  for (const entries of applications.values()) {
53
53
  const selected = entries.find(entry => entry.client.selected === true) || (entries.length === 1 ? entries[0] : null);
54
- const client = selected?.client || { name: entries[0].client.name, state: "unknown" };
54
+ const client = selected?.client || { name: entries[0].client.name, state: entries.every(entry => entry.client.state === "paused") ? "paused" : "unknown" };
55
55
  const row = tableRow([client.name, selected?.provider.name || "—", states[client.state] || "unknown",
56
56
  client.gateway || "—", time(client.last_request_at)], { labels: [2, 3] });
57
57
  if (client.reason) localize(row.children[2], "state_reason", { state: phrase(states[client.state] || "unknown"), reason: client.reason });
@@ -433,6 +433,8 @@ input[role="switch"]:disabled { opacity: .5; cursor: wait; }
433
433
 
434
434
  .flow-network { position:relative;display:grid;grid-template-columns:minmax(130px,1fr) 70px minmax(170px,1fr);column-gap:clamp(36px,6vw,92px);align-items:stretch;min-height:236px;margin:26px 0 18px; }
435
435
  .flow-wires { position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible; }
436
+ .flow-activity { will-change:transform; }
437
+ .flow-wires .flow-split { visibility:hidden;animation:none; }
436
438
  .flow-column,.flow-hub-column { position:relative;min-width:0; }
437
439
  .flow-column { display:flex;flex-direction:column; }
438
440
  .flow-column-title { height:18px;line-height:18px;margin:0 0 18px;color:var(--muted);font-size:11px;text-align:center; }
@@ -322,7 +322,7 @@ export function isAbortLikeError(err) {
322
322
 
323
323
  export function abortErrorStatusCode(reason) {
324
324
  if (reason === "request_body_timeout") return 408;
325
- if (["responses_prepare_timeout", "upstream_timeout", "stream_handshake_timeout", "stream_idle_timeout"].includes(reason)) return 504;
325
+ if (["responses_prepare_timeout", "messages_prepare_timeout", "upstream_timeout", "stream_handshake_timeout", "stream_idle_timeout"].includes(reason)) return 504;
326
326
  if (reason === "client_aborted" || reason === "client_closed") return 499;
327
327
  return 502;
328
328
  }
@@ -56,8 +56,11 @@ export function createApiProvider({ config, secrets, env = process.env, platform
56
56
  if (!model?.supported_endpoints.includes(paths[api])) throw accessError("ccdx_api_model_unavailable");return model;
57
57
  };
58
58
  async function request(url, body, options = {}, api = "responses") {
59
+ if (closed) throw accessError("ccdx_api_closed", 503);
59
60
  if (config.key_env && !env[config.key_env]) throw accessError("ccdx_api_environment_key_missing", 503);
60
- const key = config.key_env ? checkedApiKey(env[config.key_env]) : await secrets.get(config.secret_ref), transport = await getNetwork(options.signal);
61
+ const key = config.key_env ? checkedApiKey(env[config.key_env]) : await initialization.run("credential", () => secrets.get(config.secret_ref),
62
+ { signal: options.signal ? AbortSignal.any([options.signal, lifetime.signal]) : lifetime.signal });
63
+ const transport = await getNetwork(options.signal);
61
64
  const headers = { "Content-Type": "application/json", Accept: body?.stream ? "text/event-stream" : "application/json" };
62
65
  headers[api === "messages" && config.auth_header === "x-api-key" ? "x-api-key" : "Authorization"] = api === "messages" && config.auth_header === "x-api-key" ? key : `Bearer ${key}`;
63
66
  if (api === "messages") {
@@ -102,10 +102,16 @@ export function protectInstallation({ target, prefix, platform = process.platfor
102
102
  if (!target || !prefix) return { commit() {}, rollback() {} };
103
103
  const parent = path.dirname(target);fs.mkdirSync(parent, { recursive: true });
104
104
  const lock = path.join(parent, ".ccdx-install.lock");let fd;
105
- try { fd = fs.openSync(lock, "wx", 0o600); } catch { throw new Error("Another install may be running. Check the CCDX install lock before retrying."); }
105
+ try { fd = fs.openSync(lock, "wx", 0o600); }
106
+ catch (error) {
107
+ if (error.code === "EEXIST") throw new Error(`Another install may be running. CCDX install lock: ${lock}. Inspect its owner and .ccdx-backup-* in ${parent} before recovery; do not remove an active install lock.`, { cause: error });
108
+ throw new Error(`Cannot create the CCDX install lock at ${lock} (${error.code || "I/O error"}). Check directory permissions and free space; no installation was started.`, { cause: error });
109
+ }
106
110
  let backup;
107
- try { backup = fs.mkdtempSync(path.join(parent, ".ccdx-backup-")); }
108
- catch (error) { fs.closeSync(fd);fs.unlinkSync(lock);throw error; }
111
+ try {
112
+ backup = fs.mkdtempSync(path.join(parent, ".ccdx-backup-"));
113
+ fs.writeFileSync(fd, JSON.stringify({ version: 1, pid: process.pid, created_at: new Date().toISOString(), backup }) + "\n");
114
+ } catch (error) { if (backup) fs.rmSync(backup, { recursive: true, force: true });fs.closeSync(fd);fs.unlinkSync(lock);throw error; }
109
115
  const entries = [target, ...["ccdx", "codex-copilot-dx"].flatMap(name => platform === "win32"
110
116
  ? [name, `${name}.cmd`, `${name}.ps1`].map(file => path.join(prefix, file)) : [path.join(prefix, "bin", name)])];
111
117
  const saved = [];
@@ -63,7 +63,7 @@ export function providerStartupSummary(data = {}) {
63
63
  const connections = data.providers.connections;
64
64
  if (connections?.managed) {
65
65
  const enabled = connections.providers.filter(provider => provider.enabled);
66
- const states = { configured: "configured", not_configured: "not configured", not_installed: "not installed", preserved: "custom settings kept", configuration_unavailable: "config unavailable", partially_preserved: "partly configured", unavailable: "source unavailable" };
66
+ const states = { configured: "configured", paused: "paused", disabled: "off", not_configured: "not configured", not_installed: "not installed", preserved: "custom settings kept", configuration_unavailable: "config unavailable", partially_preserved: "partly configured", unavailable: "source unavailable" };
67
67
  const sourceLines = enabled.map(provider => `${terminalCell(provider.name)} / ${provider.builtin ? provider.id === "m365" ? terminalCell(connections.m365_state) : "sign-in checked separately" : `${provider.model_count} configured models`}`);
68
68
  const claudeLines = connections.clients.filter(client => client.id !== "codex").map(client => `${client.name}: ${!client.enabled ? "off" : client.source ? states[client.setup] || "not checked" : "paused"}`);
69
69
  return { catalogs: `${enabled.length} enabled source${enabled.length === 1 ? "" : "s"}`, claude: claudeLines.join(" / "), sourceLines, claudeLines,