codex-copilot-dx 0.9.40 → 0.10.0

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.
Files changed (56) hide show
  1. package/README.md +25 -4
  2. package/bin/cli.mjs +37 -11
  3. package/docs/ARCHITECTURE.md +84 -13
  4. package/docs/REFERENCE.md +207 -16
  5. package/package.json +4 -1
  6. package/src/adapter.mjs +98 -152
  7. package/src/auto-review-model.mjs +4 -3
  8. package/src/claude-client-config.mjs +217 -0
  9. package/src/claude-gateway.mjs +163 -0
  10. package/src/cli-m365.mjs +133 -0
  11. package/src/cli-models.mjs +1 -1
  12. package/src/cli-options.mjs +20 -6
  13. package/src/cli-status.mjs +23 -7
  14. package/src/codex-model-catalog.mjs +7 -2
  15. package/src/copilot-client.mjs +4 -0
  16. package/src/copilot-responses-compat.mjs +1 -1
  17. package/src/copilot-responses-policy.mjs +11 -64
  18. package/src/dashboard/index.html +14 -4
  19. package/src/dashboard/language.js +40 -2
  20. package/src/dashboard/status.js +26 -4
  21. package/src/dashboard/ui.css +2 -2
  22. package/src/dashboard/ui.js +16 -7
  23. package/src/dashboard/usage.js +3 -1
  24. package/src/dashboard-api.mjs +10 -7
  25. package/src/doctor-repair.mjs +2 -0
  26. package/src/doctor.mjs +18 -2
  27. package/src/http-transport.mjs +6 -3
  28. package/src/m365-settings.mjs +89 -0
  29. package/src/management-routes.mjs +118 -0
  30. package/src/native-prediction-windows.mjs +2 -7
  31. package/src/optional-routes.mjs +33 -0
  32. package/src/profile-model-runtime.mjs +4 -2
  33. package/src/provider-management.mjs +28 -0
  34. package/src/provider-runtime.mjs +179 -0
  35. package/src/provider-settings.mjs +32 -0
  36. package/src/providers/github.mjs +62 -0
  37. package/src/providers/m365-auth-helper.mjs +72 -0
  38. package/src/providers/m365-auth.mjs +105 -0
  39. package/src/providers/m365-messages-policy.mjs +20 -0
  40. package/src/providers/m365-network.mjs +73 -0
  41. package/src/providers/m365.mjs +238 -0
  42. package/src/response-failures.mjs +66 -5
  43. package/src/response-history.mjs +20 -3
  44. package/src/responses-bridge.mjs +1 -1
  45. package/src/responses-handler.mjs +40 -103
  46. package/src/responses-image-tools.mjs +61 -0
  47. package/src/responses-proxy.mjs +5 -5
  48. package/src/responses-request.mjs +25 -0
  49. package/src/stream-performance.mjs +42 -10
  50. package/src/usage-analysis.mjs +3 -2
  51. package/src/usage-store.mjs +41 -12
  52. package/src/usage.mjs +8 -2
  53. package/src/windows-http-network.mjs +122 -0
  54. package/src/windows-prediction-network.cs +13 -6
  55. package/src/windows-prediction-network.mjs +4 -108
  56. package/src/windows-process.mjs +8 -0
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # codex-copilot-dx
2
2
 
3
- Use Codex App with GitHub Copilot through a local adapter.
3
+ Use Codex App with GitHub Copilot through a local adapter, with isolated Microsoft 365 access where authorized.
4
4
 
5
- CCDX targets Codex App: Copilot discovery, adapted model catalogs, Responses streaming, tool calls and conversation history.
5
+ CCDX keeps GitHub Copilot as the default Codex source: discovery, adapted model catalogs, Responses streaming, tool calls and conversation history. Eligible Microsoft 365 environments can also use a separate Claude gateway and manually select M365 as a Codex backup.
6
6
  Default Auto-review: **GPT-6.1 Sol / low**. Image generation is **off by default**. Native predictions are also **off by default**.
7
7
 
8
8
  ## Install and run
@@ -21,7 +21,7 @@ is needed. On Windows, open the App manually unless native prediction setup is
21
21
  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`. No install script, alias or policy change is added; custom launchers are preserved. npm's own script is untouched. The configured `dummy` API key is a placeholder, not a credential.
22
22
 
23
23
  Open [the local dashboard](http://127.0.0.1:2026/) for status, model discovery,
24
- usage, cache/limits, recent failures, request context and animation settings.
24
+ usage, cache/limits, recent failures, request context and animation settings. First output uses **ms**; estimated output speed uses **token/s**. Inference HTTP failures are retained separately from route and MCP-method errors.
25
25
  Auto refresh runs every 30 minutes while visible and can be switched off. Hidden pages pause; opening sections and manual refresh still work. The atom rotates once on page load and manual refresh, respecting reduced motion. Startup uses a compact six-line atom and aligned checks; `Ready` refers to the core service. Narrow/non-color terminals use a plain title.
26
26
 
27
27
  ## Commands
@@ -39,6 +39,10 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
39
39
  | `ccdx auth status` | Saved account; add `--online` to verify access |
40
40
  | `ccdx models` | Fresh upstream model list |
41
41
  | `ccdx usage` | Recorded tokens and upstream prompt-cache hit rate |
42
+ | `ccdx usage --provider github` / `m365` | Separate source-specific usage |
43
+ | `ccdx m365 status` / `models` | M365 authorization, Claude gateway and Claude models |
44
+ | `ccdx m365 switch` | Choose the Codex source; default remains GitHub |
45
+ | `ccdx m365 on` / `off` / `remove` | Enable discovery, restore owned client settings, or remove owned M365 state |
42
46
  | `ccdx auto-review-model` | Select model, then reasoning effort; `0` follows client |
43
47
  | `ccdx animation` | Preview and select terminal animation |
44
48
  | `ccdx prediction fix` | Recheck system routing and repair enabled predictions; report required restarts |
@@ -50,6 +54,23 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
50
54
  | `ccdx prediction on` / `off` / `status` | Opt in to native predictions (macOS and Windows) |
51
55
  | `ccdx update` | Update the global package |
52
56
 
57
+ ## Microsoft 365 access
58
+
59
+ Eligible macOS/Windows machines attempt silent Microsoft authorization at startup,
60
+ without Copilot CLI or a browser login. MDM alone is insufficient: account, tenant,
61
+ device policy and Loki entitlement must permit access. Optional failure does not block GitHub.
62
+
63
+ Claude clients use the separate, keyed `127.0.0.1:2027` gateway and Claude-only catalog.
64
+ Existing custom/managed settings are preserved; already-running clients may need a normal restart.
65
+ `ccdx m365 off` restores unchanged owned fields; `remove` also clears owned M365 state.
66
+
67
+ Codex stays on GitHub until `ccdx m365 switch`. Select available GPT/review models;
68
+ there is no automatic failover or missing-model substitution. Use **Standard** on M365:
69
+ Fast is unverified. Tokens, accounts and review choices are isolated; prediction and images remain independent.
70
+
71
+ The optional native broker adds a **14.6 MB download**, with no install hook. Linux retains core support without M365.
72
+ See the [M365 reference](docs/REFERENCE.md#microsoft-365-provider) for ownership, cache/experimental-feature limits and cleanup.
73
+
53
74
  ## Compatibility and safety
54
75
 
55
76
  - Standard/Fast follow the exact variants advertised by Copilot; CCDX does not
@@ -88,7 +109,7 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
88
109
  Startup checks GitHub's latest-release web redirect, not npm or the anonymous REST quota, and suggests `ccdx update github`.
89
110
  Updates install the exact stable tag; dependencies still use npm's configured registry. 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.
90
111
  Updates warn about mismatched npm targets without changing PATH/prefix and verify the installed target version (exact tag for GitHub). Restart the adapter separately. Full `ccdx doctor` reports this target and readonly credential permissions; it never changes ACLs.
91
- Recent errors separate HTTP and model failures. HTTP metadata retains status, source and IDs, not error bodies or prompts; original errors still reach Codex unchanged.
112
+ 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).
92
113
 
93
114
  The dashboard and CLI separate prediction preference, bridge state and observed config traffic; candidate visibility stays unknown. See [architecture boundaries](docs/ARCHITECTURE.md) for separate inference, integration, image and management ownership.
94
115
 
package/bin/cli.mjs CHANGED
@@ -14,13 +14,13 @@ import { runInBackground } from "../src/startup.mjs";
14
14
  import { cliCommandName, cliHelp, parseAdapterAddressOptions, parseAdapterProbeOptions, parseCliArgs, parseRuntimeOptions } from "../src/cli-options.mjs";
15
15
  import { formatAdapterStatus, readAdapterStatus } from "../src/cli-status.mjs";
16
16
  import { closeHttpServer } from "../src/shutdown.mjs";
17
- import { runAutoReviewModelCommand } from "../src/auto-review-model.mjs";
18
17
  import { autoReviewModelPreference, autoReviewPreference, responseHistoryLimitPreference, terminalAnimationPreference } from "../src/user-settings.mjs";
19
- import { fetchLiveCopilotModels, formatLiveCopilotModels } from "../src/cli-models.mjs";
18
+ import { formatLiveCopilotModels } from "../src/cli-models.mjs";
20
19
  import { runAuthCommand } from "../src/cli-auth.mjs";
21
20
  import { createProfileRuntime } from "../src/profile-runtime.mjs";
22
21
  import { createProfileModelRuntime } from "../src/profile-model-runtime.mjs";
23
22
  import { createCodexModelCatalog } from "../src/codex-model-catalog.mjs";
23
+ import { createProviderRuntime } from "../src/provider-runtime.mjs";
24
24
  import { setResponseHistoryMaxBytes } from "../src/response-history.mjs";
25
25
  import { startupBanner, startupCheck, startupReady, startupLogger, predictionStartupCheck } from "../src/startup-ui.mjs";
26
26
 
@@ -45,6 +45,14 @@ if (CLI.command === "version") {
45
45
  console.log(CLI_BANNER);
46
46
  process.exit(0);
47
47
  }
48
+ if (CLI.command === "m365") {
49
+ try {
50
+ const { runM365Command } = await import("../src/cli-m365.mjs");
51
+ const address = parseAdapterAddressOptions(process.env);
52
+ await runM365Command({ ...CLI, host: address.adapterHost, port: address.adapterPort });
53
+ process.exit(0);
54
+ } catch (error) { console.error(status("err", error.message));process.exit(1); }
55
+ }
48
56
  if (CLI.command === "animation") {
49
57
  try {
50
58
  const { runAnimationCommand } = await import("../src/cli-animation.mjs");
@@ -107,6 +115,7 @@ if (CLI.command === "usage") {
107
115
  try {
108
116
  await printUsageSummary({
109
117
  format: CLI.outputFormat || "auto",
118
+ provider: CLI.provider || "",
110
119
  output: process.stdout,
111
120
  });
112
121
  process.exit(0);
@@ -204,7 +213,8 @@ if (CLI.command === "status") {
204
213
  }
205
214
  if (CLI.command === "models") {
206
215
  try {
207
- const catalog = await fetchLiveCopilotModels({ profile: CLI.profile });
216
+ const { fetchActiveProviderModels } = await import("../src/cli-m365.mjs");
217
+ const catalog = await fetchActiveProviderModels();
208
218
  console.log(formatLiveCopilotModels(catalog, {
209
219
  commandName: CLI_NAME,
210
220
  format: CLI.outputFormat || "auto",
@@ -218,7 +228,9 @@ if (CLI.command === "models") {
218
228
  }
219
229
  if (CLI.command === "auto-review-model") {
220
230
  try {
221
- await runAutoReviewModelCommand({ commandName: CLI_NAME });
231
+ const { runProviderAutoReviewCommand } = await import("../src/cli-m365.mjs");
232
+ const address = parseAdapterAddressOptions(process.env);
233
+ await runProviderAutoReviewCommand({ commandName: CLI_NAME, host: address.adapterHost, port: address.adapterPort });
222
234
  process.exit(0);
223
235
  } catch (e) {
224
236
  console.error(status("err", e.message));
@@ -271,6 +283,7 @@ let modelRefreshTimer = null;
271
283
  let shuttingDown = false;
272
284
  let nativePrediction = null;
273
285
  let clientIntegration = null;
286
+ let providerRuntime = null;
274
287
 
275
288
  async function clientIntegrations() {
276
289
  if (!clientIntegration) {
@@ -387,23 +400,32 @@ try {
387
400
  const earlyIntegration = await clientIntegrations();
388
401
  const predictionSetup = runInBackground(() => earlyIntegration.start());
389
402
 
390
- // Ensure GitHub login, using device flow if no token exists.
391
- await ensureAuth({ log: startupLogger("Auth") });
392
-
393
- const profileRuntime = createProfileRuntime({ codexClient: defaultCopilotClient });
403
+ let profileRuntime = createProfileRuntime({ codexClient: defaultCopilotClient });
394
404
  let startupComplete = false;
395
405
  const profileModels = createProfileModelRuntime({
396
406
  codexClient: profileRuntime.codexClient,
397
- codexCredentialFingerprint: profileRuntime.codexCredentialFingerprint,
407
+ codexCredentialFingerprint: () => profileRuntime.codexCredentialFingerprint,
398
408
  timeoutMs: MODEL_REFRESH_TIMEOUT_MS,
399
409
  commandName: CLI_NAME,
400
410
  autoReviewModelResolver: () => autoReviewModelPreference().model,
401
411
  log: (kind, message) => console.log(startupComplete ? status(kind, message) : startupCheck(kind, "Models", message)),
402
412
  });
413
+ providerRuntime = createProviderRuntime({ githubClient: profileRuntime.codexClient, githubRegistry: profileModels.codexRegistry,
414
+ githubCredentialFingerprint: () => profileRuntime.codexCredentialFingerprint,
415
+ log: (kind, message) => console.log(startupComplete ? status(kind, message) : startupCheck(kind, "M365", message)) });
416
+ const m365Setup = runInBackground(() => providerRuntime.start());
417
+ if (providerRuntime.selection().codex === "github") {
418
+ try { await ensureAuth({ log: startupLogger("Auth") }); }
419
+ catch (error) { if (!await m365Setup) throw error;console.warn(startupCheck("warn", "Auth", "GitHub authorization is unavailable; Microsoft 365 is independent. Check ccdx m365 status or switch")); }
420
+ } else {
421
+ await m365Setup;
422
+ console.log(startupCheck("info", "Provider", "Codex uses the explicitly selected Microsoft 365 backup"));
423
+ }
424
+ profileRuntime = createProfileRuntime({ codexClient: defaultCopilotClient });
403
425
 
404
426
  // Refresh the VS Code version in the background; fallback is non-blocking.
405
427
  void refreshVSCodeVersion();
406
- await profileModels.initialize();
428
+ if (providerRuntime.selection().codex === "github") await profileModels.initialize();
407
429
  if (profileModels.codexRegistry.source !== "live") {
408
430
  console.log(startupCheck("info", "Models", `${profileModels.codexRegistry.source} list loaded${profileModels.codexRegistry.refreshInFlight ? "; refreshing" : ""}`));
409
431
  }
@@ -421,6 +443,7 @@ try {
421
443
  codexClient: profileRuntime.codexClient,
422
444
  codexModelCatalog,
423
445
  codexModelRegistry: profileModels.codexRegistry,
446
+ providerRuntime,
424
447
  showRequestId: CLI.showRequestId,
425
448
  upstreamTimeoutMs: RUNTIME.upstreamTimeoutMs,
426
449
  streamHandshakeTimeoutMs: RUNTIME.streamHandshakeTimeoutMs,
@@ -451,7 +474,8 @@ try {
451
474
  const refreshIntervalMs = RUNTIME.modelRefreshIntervalMs;
452
475
  if (Number.isFinite(refreshIntervalMs) && refreshIntervalMs > 0) {
453
476
  modelRefreshTimer = setInterval(() => {
454
- profileModels.refreshAll().catch(() => {});
477
+ if (providerRuntime.selection().codex === "github") profileModels.refreshAll().catch(() => {});
478
+ providerRuntime.refresh().catch(() => {});
455
479
  }, refreshIntervalMs);
456
480
  modelRefreshTimer.unref?.();
457
481
  }
@@ -467,6 +491,7 @@ try {
467
491
  try {
468
492
  if (modelRefreshTimer) clearInterval(modelRefreshTimer);
469
493
  await clientIntegration?.close();
494
+ await providerRuntime?.close();
470
495
  const result = await closeHttpServer(activeServer, { timeoutMs: RUNTIME.shutdownTimeoutMs });
471
496
  if (result.forced) console.warn(status("warn", "Forced remaining adapter connections closed"));
472
497
  await flushUsageWrites();
@@ -484,6 +509,7 @@ try {
484
509
  } catch (e) {
485
510
  console.error(status("err", e.message));
486
511
  await clientIntegration?.close().catch(() => {});
512
+ await providerRuntime?.close().catch(() => {});
487
513
  await closeHttpServer(activeServer, { timeoutMs: RUNTIME.shutdownTimeoutMs }).catch(() => {});
488
514
  await flushUsageWrites();
489
515
  await LOGGING.cleanup();
@@ -1,11 +1,15 @@
1
1
  # Architecture boundaries
2
2
 
3
- CCDX is one local Node service for Codex App. Client integration, image tools and
4
- the dashboard are optional parts of that service, not a general plugin framework.
3
+ CCDX is one local Node service with client-specific protocol surfaces and isolated
4
+ upstream providers. GitHub is the default Codex provider; Microsoft 365 is optional.
5
+ Client integration, image tools and the dashboard are not a general plugin framework.
5
6
 
6
7
  | Responsibility | Ownership | Boundary |
7
8
  | --- | --- | --- |
8
- | Core inference | `adapter.mjs`, Responses modules, model catalog, history | Copilot requests, streaming and recovery |
9
+ | Core inference | `adapter.mjs`, Responses modules, model catalog, history | Codex wire contracts, streaming and recovery |
10
+ | Providers | `providers/github.mjs`, `providers/m365*.mjs` | Source-owned auth, discovery, routing, capabilities and transport |
11
+ | Provider composition | `provider-runtime.mjs`, `provider-settings.mjs` | Explicit selection, lifecycle, history namespaces and snapshots |
12
+ | Claude clients | `claude-gateway.mjs`, `claude-client-config.mjs` | Native Messages relay and field-owned reversible client setup |
9
13
  | Client integration | `client-integration.mjs`, Codex config, native prediction | Client setup, optional start/stop, diagnostic snapshots |
10
14
  | Optional images | Image provider, CLI setup, image MCP and skill | Opt-in API access and image delivery; failures do not block core startup |
11
15
  | Management | CLI, dashboard, observability, package updates | Bounded metadata and explicit user actions |
@@ -13,10 +17,62 @@ the dashboard are optional parts of that service, not a general plugin framework
13
17
 
14
18
  ## Composition and lifecycle
15
19
 
20
+ ### Provider boundary
21
+
22
+ Each provider supplies its client, model registry, route plan, model/request policy
23
+ and compatibility opener. The existing GitHub implementation remains the default;
24
+ its Fast mapping, retries and recovery are not applied blindly to M365. Protocol
25
+ adaptation belongs to the client boundary. There is no generic intermediate message
26
+ format that would erase native Responses or Anthropic semantics.
27
+
28
+ `provider-runtime.mjs` owns source selection, not the providers themselves. Each
29
+ request pins a provider before admission. An explicit change affects later requests;
30
+ it does not reroute an in-flight stream or retry it through another account. Core
31
+ `providers.json` stores Codex selection separately from the optional M365 profile.
32
+ History lookup keys include source/account namespaces; the existing global byte
33
+ budget remains shared. Explicit source transfer can restore visible history but
34
+ cannot silently discard encrypted tool or compaction state. Existing verified local
35
+ plaintext recovery is attempted at that boundary; failure remains explicit.
36
+
37
+ M365 discovery is background-only when GitHub is selected. On supported platforms,
38
+ a bounded short-lived Node helper loads the official optional Microsoft broker
39
+ runtime, discovers an unambiguous/matching account and requests a token silently.
40
+ Private pipes carry the result; no token is saved or logged. Cached tokens refresh
41
+ within two minutes of expiry, with single-flight cancellation and bounded failure
42
+ backoff. Device management is not inferred to be sufficient authorization.
43
+
44
+ The fixed Loki target, account-bound catalog and dedicated network agent belong
45
+ to M365. No GitHub token, image credential or browser Cookie is reused. Windows can
46
+ use a separate OS WinHTTP worker for M365 company routing; macOS preserves static
47
+ system/environment routing and reports unsupported dynamic PAC. Native runtime
48
+ absence, policy refusal and gateway-port conflicts do not disable GitHub.
49
+ Claude listener/configuration readiness is also separate from M365 provider
50
+ readiness. A busy Claude port or a GPT-only catalog cannot block the explicitly
51
+ selected Codex backup; a catalog without Claude models does not install Claude settings.
52
+
53
+ The Claude gateway listens on loopback only, requires its private local key and
54
+ rejects browser-origin requests. It preserves native Messages/SSE bytes, observes
55
+ bounded usage/terminal metadata and honors downstream backpressure. The client
56
+ writer records field-level ownership before applying changes and restores only
57
+ fields that still match its own values. Foreign gateways and managed desktop
58
+ policies are not overwritten. Removing M365 does not remove shared management,
59
+ GitHub auth, prediction, image configuration or historical usage.
60
+
61
+ ### Existing service composition
62
+
16
63
  The CLI composes the service. Client integration owns its `configure`, `start`,
17
64
  `snapshot` and `close` operations. It does not forward inference requests or
18
65
  render the dashboard. The adapter exposes integration snapshots and keeps
19
66
  management/MCP routes separate from the Responses path.
67
+ `management-routes.mjs` owns status, health, cache control and prediction repair
68
+ HTTP checks. It receives a snapshot callback and the existing explicit repair
69
+ action, not a model client or a second recovery lifecycle.
70
+ `optional-routes.mjs` owns lazy WebUI/API and image-MCP dispatch and image stats.
71
+ The adapter remains the HTTP composition root; neither extracted route module
72
+ imports it. Native prediction belongs to client integration, WebUI to management,
73
+ and terminal animation to presentation. Input-image optimization remains core
74
+ multimodal inference, distinct from optional image generation. This is a module
75
+ boundary, not a plugin framework, daemon, IPC protocol or package split.
20
76
  The HTTP dispatch boundary rejects browser Origin-bearing inference requests
21
77
  before body admission, credential use or provider dispatch; native LAN opt-in is unchanged.
22
78
 
@@ -93,12 +149,19 @@ The existing PEM reader, App-profile trust schema and transactional activation
93
149
  remain shared. Issuance requires neither external OpenSSL nor a Windows
94
150
  certificate store. Valid existing credentials skip issuance; default-off startup
95
151
  does not invoke it. macOS keeps the existing system OpenSSL implementation.
96
- Windows automatic-proxy support has one isolated native WinHTTP worker
97
- (`windows-prediction-network.mjs` / `.cs`) for company routing, authentication and
98
- TLS trust. Its private, credit-based pipes stream data without transcript files.
152
+ Windows automatic-proxy support uses an isolated native WinHTTP worker
153
+ (`windows-http-network.mjs` / `windows-prediction-network.cs`) for company routing, authentication and
154
+ TLS trust. `windows-prediction-network.mjs` preserves the existing prediction
155
+ interface. Each worker is restricted to one fixed target group: prediction hosts
156
+ or M365 Loki, never an arbitrary URL supplied by a client. Its private,
157
+ credit-based pipes stream data without transcript files.
158
+ The existing C# filename and entry class remain available for an older running
159
+ prediction bridge during package replacement; there is no duplicate worker source.
99
160
  The App PAC delegates unrelated URLs to the company script; Node never executes
100
- that script. This worker is not a shared inference/image network backend and is
101
- not started for disabled predictions or static/direct configurations.
161
+ that script. Prediction and M365 never share a worker or its lifecycle. GitHub and
162
+ image networking are unchanged; disabled prediction does not start its worker.
163
+ M365 starts its own worker only after successful authorization when explicit
164
+ environment routing does not take precedence.
102
165
  Bridge-port ownership is shared across macOS and Windows in the existing
103
166
  prediction lifecycle, with locked first-start persistence and no replacement
104
167
  on conflict. OS process inspection stays in the launcher/platform boundary;
@@ -226,11 +289,19 @@ Prediction preference, bridge readiness and observed configuration responses are
226
289
  different states. None proves that a candidate appeared in the App. The dashboard
227
290
  keeps that result unknown. Integration diagnostics retain bounded, redacted
228
291
  metadata, not conversation or image contents.
229
- HTTP failures have a separate 20-entry metadata ring (`http_errors`): status,
230
- safe technical code, model when observed, route, source and request IDs. Original
231
- HTTP error bodies are returned unchanged but not saved in that ring. Model
232
- terminal diagnostics and their counters retain their existing meaning. The
233
- dashboard merges recent HTTP, model and request-timeline failures for display.
292
+ HTTP failures retain the original 20-entry metadata ring (`http_errors.recent`)
293
+ plus independent 20-entry inference/other and eight-entry image-MCP method rings.
294
+ Fixed categories distinguish inference, image-MCP HTTP 405, unmatched routes and
295
+ other failures without treating every 404/405 as harmless. Status, safe technical
296
+ code/type/parameter, method, allowlisted target, request IDs and numeric/enum
297
+ request options survive; body/query/prompt/tool/schema values do not. Optional
298
+ error prose requires `CCDX_HTTP_ERROR_DETAILS=1` at service creation, is redacted
299
+ and capped at 500 characters, and still needs review before sharing.
300
+ Original error responses are preserved. Per-request attempt timings retain only
301
+ the first and last two provider calls, not unbounded stream events. All data is
302
+ process-local and cleared on restart. The dashboard uses the independently
303
+ retained actionable HTTP errors rather than letting route noise erase them.
304
+ Model terminal diagnostics and HTTP counters retain their original meanings.
234
305
 
235
306
  Tests cover module dependency direction, default-off behavior, concurrent writers,
236
307
  proxy handshakes, TLS validation, streaming, history isolation and release lookup.
package/docs/REFERENCE.md CHANGED
@@ -1,6 +1,160 @@
1
1
  # CCDX command, configuration and compatibility reference
2
2
 
3
- Use Codex App with GPT models available to your **GitHub Copilot** account.
3
+ Use Codex App with GPT models available to your **GitHub Copilot** account by default.
4
+ The optional [Microsoft 365 provider](#microsoft-365-provider) supplies a separate
5
+ Claude gateway and an explicitly selected Codex backup.
6
+
7
+ ## Microsoft 365 provider
8
+
9
+ Starting with 0.10.0, CCDX can discover authorized M365 models independently of
10
+ Copilot CLI. This is not restoration of the retired personal-GitHub Claude profile
11
+ or PM Studio patch. The core Codex provider remains GitHub until explicitly changed.
12
+
13
+ ```bash
14
+ ccdx m365 status
15
+ ccdx m365 models
16
+ ccdx m365 switch
17
+ ccdx m365 switch m365 --model gpt-6-sol --auto-review-model gpt-6-sol
18
+ ccdx m365 switch github
19
+ ccdx m365 off
20
+ ccdx m365 on
21
+ ccdx m365 remove
22
+ ccdx usage --provider m365
23
+ ccdx usage --provider github
24
+ ```
25
+
26
+ The model IDs above are examples, not guaranteed entitlement. `switch` checks the
27
+ current M365 catalog before committing. Interactive mode asks for the provider,
28
+ Codex GPT model and Auto-review model; scripts must supply available IDs (or reuse
29
+ previously saved valid choices). Switching requires the running updated adapter.
30
+ It affects subsequent requests, not in-flight streams. Existing Codex threads keep
31
+ their selected model: choose an available M365 model in the App. Unavailable
32
+ models return a clear error instead of being aliased. There is no automatic
33
+ cross-provider failover, quota borrowing or organization/account substitution.
34
+
35
+ Startup uses the official optional `@azure/msal-node-runtime` 0.20.6 package in a
36
+ short-lived Node helper. It discovers OS broker accounts and calls silent token
37
+ acquisition only. It neither launches a login UI nor reads Copilot CLI tokens.
38
+ macOS requires MDM enrollment and a working Microsoft Enterprise SSO broker;
39
+ Windows uses its Microsoft account broker. Tenant policy, device compliance,
40
+ account authorization and Loki entitlement still decide access. Multiple accounts
41
+ without a prior binding, interaction requirements, policy refusal or a missing
42
+ native package leave M365 unavailable. None of these invalidate GitHub credentials.
43
+ The GitHub-selected Codex path retains its existing first-run GitHub login flow.
44
+
45
+ The optional package download is approximately 14.6 MB, contains prebuilt binaries
46
+ and has no install script or runtime dependencies. It is not bundled Copilot CLI.
47
+ If this optional broker alone is unavailable, core GitHub/prediction/image behavior
48
+ remains available with the existing dependencies installed. Do not use a blanket
49
+ `--omit=optional` workaround: sharp still needs its platform-specific optional binaries.
50
+ M365 is enabled automatically only on macOS/Windows; Linux reports it
51
+ unsupported. The `CCDX_M365` environment control accepts `0` to suppress M365 startup for that process. It does not
52
+ restore existing client settings; use `m365 off` for that explicit operation.
53
+
54
+ Entra tokens are retained in memory until renewal/close, never saved in a CCDX
55
+ credential file. Renewal is silent and single-flight, with a 28-second helper
56
+ deadline and one-minute failure backoff. The provider uses only
57
+ `https://df.loki.delve.office.com/api/v1/llmapi`; discovery uses `/models` and
58
+ inference uses its advertised native Responses or Messages endpoints. This is a
59
+ dogfood service, not a promised public SLA. No request is redirected to another
60
+ origin. Explicit proxy/trust settings are preserved. Windows delegates system
61
+ PAC/WPAD and integrated authentication to its own isolated WinHTTP worker;
62
+ unsupported macOS dynamic PAC is reported rather than bypassed.
63
+
64
+ The M365 profile under `~/.local/share/codex-copilot-dx/profiles/m365/` contains
65
+ `settings.json`, nonsecret `account.json`, account-bound `models.json`, a private
66
+ local `gateway.json` key, and `client-config.json` field ownership. JSON reads are
67
+ bounded at 4 MiB and regular files only; new owned files use private permissions.
68
+ Codex source and M365 review choices live separately in
69
+ `~/.config/codex-copilot-dx/providers.json` (or under `XDG_CONFIG_HOME`). Existing
70
+ GitHub auth/cache/preferences, Codex auth, prediction trust and image keys are not
71
+ copied into the M365 profile. The system's Microsoft SSO account is never deleted.
72
+
73
+ M365 catalogs refresh at startup and on the existing background model interval.
74
+ Request-time catalog reads use the account-bound cache, trigger refresh after two
75
+ hours and reject disk caches older than seven days. `ccdx models`, Auto-review's
76
+ selector and dashboard models follow the selected Codex source. Under M365 they
77
+ use the running provider's catalog, labeled as a catalog rather than a fresh
78
+ per-command GitHub lookup. Disabled/hidden models and wrong publisher/protocol
79
+ families are not exposed. A catalog listing is not proof that inference will pass
80
+ quota or policy checks. M365 Fast is unverified and `priority` requests fail
81
+ explicitly; choose Standard. This does not change GitHub Fast behavior.
82
+
83
+ M365 Auto-review has its own required model choice and defaults to low reasoning.
84
+ `ccdx auto-review-model` changes that provider's model/effort without touching the
85
+ GitHub preference or falling back to its cached catalog. Native prediction still
86
+ uses the conversation's selected model through the normal Codex endpoint. The
87
+ optional image MCP/skill/API remains separately configured and off by default.
88
+
89
+ ### Claude gateway and client ownership
90
+
91
+ The gateway is a second listener in the same Node service, on `127.0.0.1:2027`.
92
+ It accepts a private local Bearer key or `x-api-key`, rejects browser Origin
93
+ headers and exposes Claude only: `GET /v1/models`, `POST /v1/messages` and
94
+ `POST /v1/messages/count_tokens` (upstream support remains authoritative).
95
+ Messages tools, thinking, cache breakpoints, image blocks, beta headers and native
96
+ SSE are relayed without OpenAI-format conversion. Cancellation and downstream
97
+ backpressure are preserved. Upstream and local gateway credentials are distinct;
98
+ the local key is never forwarded upstream. The legacy Claude URL on port 2026
99
+ remains retired. Claude requests never reach GitHub.
100
+
101
+ Loki explicitly rejects one-hour prompt-cache retention. M365's request policy
102
+ caps standard `cache_control: {type: "ephemeral", ttl: "1h"}` fields to `5m`,
103
+ logs that limitation once and counts adjustments in its status. Prompt bytes,
104
+ breakpoint positions, tool input, thinking and approval settings do not change.
105
+ This is a retention/cost limitation of the new M365 path, not an equivalent
106
+ one-hour cache guarantee. GitHub caching is unchanged.
107
+
108
+ For Claude Code, CCDX owns only its gateway environment fields in
109
+ `CLAUDE_CONFIG_DIR/settings.json` or `~/.claude/settings.json`. For Claude App it
110
+ uses the installed client's third-party config library, with one named
111
+ `CCDX Microsoft 365` profile and the normal third-party deployment setting.
112
+ macOS stores the owned App configuration below `~/Library/Application Support/Claude-3p`;
113
+ Windows uses `%LOCALAPPDATA%/Claude-3p`. First-party Claude configuration is not modified.
114
+ See the [official desktop configuration contract](https://claude.com/docs/third-party/claude-desktop/configuration).
115
+ Existing foreign gateways,
116
+ cloud-provider choices, other selected App profiles and detected managed desktop
117
+ policies are preserved. No binary patch, system certificate, execution-policy
118
+ change or forced App restart is performed. An already-running client can require
119
+ its normal restart to read the saved settings; “configured” is not proof of a
120
+ visible chat or successful reply.
121
+
122
+ Claude Code 2.1.295 emits experimental fields that this Loki API rejects with
123
+ `invalid_body`. Owned gateway setup therefore supplies the documented
124
+ `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` compatibility option when no explicit
125
+ environment override exists. Existing user values are preserved. This leaves
126
+ standard tools, thinking and prompt-cache fields available; first-party-only beta
127
+ features are not promised. CCDX does not silently delete conversation content,
128
+ disable approval checks, or retry inference with reduced semantics. See the
129
+ [official variable reference](https://code.claude.com/docs/en/env-vars).
130
+ For Codex, both verified providers reject native image-generation declarations;
131
+ their explicit request policy retains CCDX image function/MCP tools instead.
132
+
133
+ `off` selects GitHub, stops M365 and restores only unchanged owned Claude fields.
134
+ `remove` additionally removes CCDX's account/catalog/gateway/ownership files,
135
+ while retaining the disabled preference and historical usage. Active M365 requests
136
+ block removal; user-modified fields block full cleanup and are reported, not
137
+ deleted. Neither operation clears Codex transcripts or shared image output.
138
+
139
+ ### Isolation and measurements
140
+
141
+ Each request is pinned to its provider. Response IDs/history are namespaced by
142
+ provider and account inside the existing shared history-byte limit; this is not a
143
+ second unbounded history cache. Explicit switching can replay complete visible
144
+ history. Foreign encrypted reasoning is not forwarded; opaque tool/compaction
145
+ state requires verified local plaintext recovery, otherwise the request fails
146
+ without discarding earlier context. No automatic cross-source retry is performed.
147
+
148
+ CLI usage and WebUI include source filtering; historical records without a source
149
+ are treated as GitHub. Claude's cache-read/cache-write input is included in its
150
+ normalized total input, with raw reported usage retained. Missing counts remain
151
+ unknown. Combined totals are labeled; identical model names across providers can
152
+ be separated with the filter. The M365 status card separates auth/catalog state,
153
+ gateway availability, client configuration and selected Codex source. Observed
154
+ client requests are not claimed to prove the App's UI state. `doctor --online`
155
+ checks the selected provider; `doctor --fix` does not reimport inactive GitHub auth.
156
+ Claude gateway outcomes are displayed separately; core HTTP totals retain their
157
+ existing main-listener meaning rather than mixing in another protocol's counts.
4
158
 
5
159
  CCDX is a local compatibility adapter for Codex App. It configures Codex to use an OpenAI Responses API on loopback while GitHub authentication, model discovery, and inference stay backed by GitHub Copilot.
6
160
 
@@ -493,7 +647,7 @@ Interactive image setup rereads the shared config after prompts and network vali
493
647
 
494
648
  ## Version 0.7.0 migration
495
649
 
496
- CCDX 0.7.0 retires the former Claude App, Claude Code, Anthropic Messages API, isolated Claude account, and PM Studio patch integrations. Their setup, status, restore, profile, and routing commands are no longer supported.
650
+ CCDX 0.7.0 retired the former personal-GitHub Claude App, Claude Code, Anthropic Messages API, isolated Claude account, and PM Studio patch integrations. Their old setup, status, restore, profile, and routing commands remain unsupported. Version 0.10.0 adds a separate M365-only Claude gateway; it does not reactivate these old routes or PM Studio support.
497
651
 
498
652
  If PM Studio is still patched by an older CCDX release, update or reinstall PM Studio to restore its official application bundle. CCDX 0.7.0 does not patch PM Studio and does not provide a restore workflow.
499
653
 
@@ -524,7 +678,7 @@ does not wait for optional update/compression work or add online doctor/model pr
524
678
  ccdx models
525
679
  ```
526
680
 
527
- This performs a fresh, read-only GitHub Copilot model-directory lookup without starting the adapter, opening Device Flow, reading the local model cache, or consuming an inference request. It lists selectable GPT model IDs, providers, advertised APIs, and preview status. Catalog availability does not guarantee that a later inference request will avoid quota, rate-limit, or policy enforcement.
681
+ With GitHub selected, this performs a fresh, read-only GitHub Copilot model-directory lookup without starting the adapter, opening Device Flow, reading the local model cache, or consuming an inference request. It lists selectable GPT model IDs, providers, advertised APIs, and preview status. With M365 selected it reads the running provider's isolated GPT catalog. Catalog availability does not guarantee that a later inference request will avoid quota, rate-limit, or policy enforcement.
528
682
 
529
683
  Concurrent identical live lookups share only the active request. Caller
530
684
  cancellation is independent; results are not retained as a fresh catalog after
@@ -540,7 +694,7 @@ Interactive terminals use aligned tables for `models`, `auth status`, and `usage
540
694
  ccdx auto-review-model
541
695
  ```
542
696
 
543
- The selector first queries the running adapter, including its last-known-good model list when live refresh is unavailable, then falls back to a local model cache no older than seven days. It offers model IDs that advertise a Responses endpoint and are not explicitly hidden from the model picker. This selection does not itself verify policy or inference access.
697
+ With GitHub selected, the selector first queries the running adapter, including its last-known-good model list when live refresh is unavailable, then falls back to a local model cache no older than seven days. It offers model IDs that advertise a Responses endpoint and are not explicitly hidden from the model picker. M365 selection uses only that running provider's catalog and separate saved preference, with no GitHub cache fallback. This selection does not itself verify policy or inference access.
544
698
 
545
699
  Enter a model number, then a reasoning-effort number. The second menu reuses the same model-directory lookup and lists only advertised efforts. GPT-6.1 Sol excludes `none` and `minimal`, even if upstream metadata incorrectly lists them. Enter keeps the current valid effort or selects `low` for a new selection when advertised; `0` follows the client (or `low` if the request omits effort). If effort metadata is absent, only `0` is offered. Enter `q` at either step to cancel without saving either choice.
546
700
 
@@ -793,8 +947,16 @@ output is observed at the gateway from generated deltas, hidden-reasoning/tool
793
947
  announcements or content snapshots; a runtime-only result is marked separately.
794
948
  Empty message/envelope frames, client tool results and compaction are excluded.
795
949
  `first_output_sources` and each recent request's `first_output_source` describe
796
- that evidence, not internal model decode or prefill timing. Per-token time is a
797
- gateway estimate and can include hosted-tool and downstream delays. The new
950
+ that evidence, not internal model decode or prefill timing. First output is
951
+ displayed in ms, and output speed in token/s. The additive
952
+ `output_tokens_per_second` metric divides the sum of reported output-token
953
+ intervals (`output_tokens - 1`) by their summed first-output-to-finish durations.
954
+ It is a time-weighted per-request estimate, not the inverse of average TPOT, an
955
+ unweighted average of request speeds, or concurrent system throughput. At least
956
+ two integral output tokens and a positive duration are required; missing usage
957
+ is unknown, not zero speed. The existing TPOT histogram remains unchanged for
958
+ API consumers, including its partial-failure samples. Both estimates can
959
+ include hosted-tool and downstream delays. The new
798
960
  timing classifier does not change stream forwarding or the existing output
799
961
  commitment that gates compatibility retries.
800
962
 
@@ -892,7 +1054,7 @@ For the complete machine-readable status payload:
892
1054
  curl -s http://127.0.0.1:2026/_ccdx/status | jq
893
1055
  ```
894
1056
 
895
- The status endpoint is restricted to the socket's real loopback address even when LAN binding is explicitly enabled. It reports fixed-size HTTP request counters separately from bounded `completed` / `incomplete` / `failed` / `cancelled` response outcomes by model and origin, plus bounded incomplete-reason counts, TTFT/TPOT histograms, admission pressure, memory use, response-history size/tree concentration/lookup misses, image queue/cache and adaptive-history state, model-cache counts, token expiry state, and the ten most recent upstream `response.failed` diagnostics retained by the running process. HTTP errors without a model terminal remain "without terminal" and retain their known origin; they are not counted as model failures. History eviction markers are not failed-request counts; `ccdx status` warns near the cache limit without deleting or compressing history. Failure diagnostics include the event type, model, error code/message, response/request IDs when supplied upstream, and retry outcome. Common credential forms, long opaque encrypted values, and explicitly labelled input/prompt/tool-content echoes are redacted. They are cleared when the adapter restarts. No request/response bodies, credential fields, or account profiles are copied into status. Arbitrary upstream prose cannot be guaranteed free of sensitive content; review diagnostics before sharing them.
1057
+ The status endpoint is restricted to the socket's real loopback address even when LAN binding is explicitly enabled. It reports fixed-size HTTP request counters separately from bounded `completed` / `incomplete` / `failed` / `cancelled` response outcomes by model and origin, plus bounded incomplete-reason counts, TTFT/TPOT histograms, admission pressure, memory use, response-history size/tree concentration/lookup misses, image queue/cache and adaptive-history state, model-cache counts, token expiry state, and the ten most recent upstream `response.failed` diagnostics retained by the running process. HTTP errors without a model terminal remain "without terminal" and retain their known origin; they are not counted as model failures. History eviction markers are not failed-request counts; `ccdx status` warns near the cache limit without deleting or compressing history. Failure diagnostics include the event type, model, error code/message, response/request IDs when supplied upstream, and retry outcome. Common credential forms, long opaque encrypted values, and explicitly labelled input/prompt/tool-content echoes are redacted. They are cleared when the adapter restarts. Whole request/response bodies, credential fields, and account profiles are not archived in status. Explicit HTTP diagnostic mode can retain a bounded error excerpt; see HTTP error diagnostics below. Arbitrary upstream prose cannot be guaranteed free of sensitive content; review diagnostics before sharing them.
896
1058
 
897
1059
  `stream_performance.by_route.*.empty_stream_completions` counts completed streams
898
1060
  with no observed output and an explicit zero output-token count. The recent request's
@@ -960,14 +1122,42 @@ selection. Isolated/custom credential clients retain their own recovery contract
960
1122
 
961
1123
  After an account is selected, automatic `401`/`403` recovery and in-process token rotation accept only that same GitHub account. Concurrent callers share token refresh work without sharing cancellation, and a still-valid Copilot token may be used briefly after a transient refresh failure. Explicit token variables remain the intentional way to select another account.
962
1124
 
963
- If refresh still fails with `401` or `403`, the saved GitHub OAuth credential may be expired, revoked, or missing Copilot access. After stopping the adapter, remove that exact saved token and start again to rerun authentication recovery:
964
-
965
- ```bash
966
- rm ~/.local/share/copilot-api/github_token
967
- ccdx
968
- ```
969
-
970
- Recovery first tries compatible local credentials and starts Device Flow only when none can be imported. Set `CCDX_DISABLE_TOKEN_DISCOVERY=1` for that launch if a fresh Device Flow is intended after removing the saved token.
1125
+ If refresh still fails with Copilot `401` or `403`, preserve the saved credential.
1126
+ Run `ccdx auth status --online` only when you explicitly want an online diagnosis;
1127
+ check account entitlement and company routing policy separately. Reauthorization
1128
+ is appropriate only after independent GitHub identity rejection or an explicit
1129
+ account-change decision, not merely a Copilot denial, package update, or failed
1130
+ network probe. Existing same-account recovery and explicit source selection are
1131
+ unchanged.
1132
+
1133
+ ## HTTP error diagnostics
1134
+
1135
+ `http_errors.recent` keeps its 20-record rolling view. Independent
1136
+ `actionable_recent` (20 inference/other failures) and `protocol_recent` (eight
1137
+ image-MCP HTTP 405 records) prevent route/method noise from erasing inference
1138
+ evidence. `by_category` counts inference, protocol, route and other HTTP failures;
1139
+ classification does not discard errors, grant access or retry requests.
1140
+ The WebUI prioritizes actionable records; raw HTTP counters remain visible.
1141
+
1142
+ New records retain safe error code/type/parameter paths, method, an allowlisted
1143
+ endpoint without a query, and upstream attempt count. Requested/served model
1144
+ IDs are distinct; only the explicit Auto-review alias identifies that request
1145
+ purpose. Other purposes remain unknown, not guessed from a model name.
1146
+ Known enum/numeric options
1147
+ include reasoning effort, service tier, output format, max output tokens and
1148
+ input/tool counts; no prompt, schema or tool values are kept. `error_body` says
1149
+ whether the upstream provided empty, structured or unstructured error details.
1150
+ Recent request `attempts` and HTTP `attempt_timings` retain the first and last two
1151
+ provider dispatch/header offsets and statuses; these are not TCP-retry counts.
1152
+
1153
+ By default arbitrary upstream error prose is not copied into HTTP diagnostics.
1154
+ For a specific investigation, start a **new** service with
1155
+ `CCDX_HTTP_ERROR_DETAILS=1` to retain a redacted error-message excerpt, capped at
1156
+ 500 characters, in those bounded in-memory records. In Windows PowerShell set
1157
+ `$env:CCDX_HTTP_ERROR_DETAILS='1'` before `ccdx.cmd`. This does not reconfigure an
1158
+ already-running service, enable file logging, retain whole requests, or guarantee
1159
+ that arbitrary upstream prose contains no private context. Review before sharing;
1160
+ unset the variable after the investigation. Records disappear on service exit.
971
1161
 
972
1162
  ## Security
973
1163
 
@@ -976,7 +1166,7 @@ Recovery first tries compatible local credentials and starts Device Flow only wh
976
1166
  - Inference POSTs reject any browser `Origin` header before reading the body or contacting upstream, including simple `text/plain` requests. Native Codex/Node requests without Origin and deliberately enabled native LAN clients keep their existing access. This is not authentication or protection against untrusted local native programs.
977
1167
  - The GitHub OAuth credential is stored locally at `~/.local/share/copilot-api/github_token`. Short-lived Copilot service tokens remain in process memory and are refreshed as needed.
978
1168
  - The optional image API credential is stored separately with mode `0600` only after `ccdx enable-image`; it is never placed in Codex configuration or diagnostic output.
979
- - Runtime status and usage records retain metadata rather than request/response content. Diagnostic logging records status and error messages; it is not a general redaction layer for arbitrary error text. See Debug logging before sharing logs.
1169
+ - Runtime status and usage records retain metadata by default; explicitly enabled HTTP error excerpts can contain private context. Diagnostic logging records status and error messages; it is not a general redaction layer for arbitrary error text. See Debug logging before sharing logs.
980
1170
  - Request/response bodies, request-admission queues, retained history, image work, SSE buffers, log queues, retries, and shutdown have explicit limits. These component limits are not a single process-wide memory ceiling; completed image files are persistent user artifacts, not an automatically evicted cache.
981
1171
 
982
1172
  ## Configuration
@@ -1004,6 +1194,7 @@ Recovery first tries compatible local credentials and starts Device Flow only wh
1004
1194
  | `CCDX_AUTO_REVIEW_MODEL` | saved selection or `gpt-6.1-sol` | Copilot Responses model used for Codex Auto-review; overrides the interactive selection |
1005
1195
  | `CCDX_LOG_PATH` | unset | Mirror terminal logs to a file; set to `1` for `~/.local/share/codex-copilot-dx/debug.log` |
1006
1196
  | `CCDX_LOG_LEVEL` | `info` | Set to `debug` for upstream attempts, status codes, retry causes, and timings |
1197
+ | `CCDX_HTTP_ERROR_DETAILS` | unset | Set to `1` on a new service to retain redacted HTTP error excerpts (500 characters) in bounded memory; review before sharing, no file logging is enabled |
1007
1198
  | `CCDX_LOG_MAX_BYTES` | `16777216` | Rotate the debug log at this size and retain one `.1` backup; set to `0` to disable rotation |
1008
1199
  | `CCDX_TERMINAL_ANIMATION` | auto | Show the selected transient animation while an interactive terminal has active requests and no output for 800 ms; set to `0`, `false`, `no`, or `off` to disable |
1009
1200
  | `CCDX_IMG_MAX_DIM` | `2048` | Maximum long edge in pixels for image downscaling |