codex-copilot-dx 0.9.41 → 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 (50) hide show
  1. package/README.md +23 -2
  2. package/bin/cli.mjs +37 -11
  3. package/docs/ARCHITECTURE.md +62 -8
  4. package/docs/REFERENCE.md +158 -4
  5. package/package.json +4 -1
  6. package/src/adapter.mjs +83 -22
  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 +6 -0
  14. package/src/codex-model-catalog.mjs +7 -2
  15. package/src/copilot-responses-policy.mjs +2 -64
  16. package/src/dashboard/index.html +11 -1
  17. package/src/dashboard/language.js +26 -0
  18. package/src/dashboard/status.js +16 -2
  19. package/src/dashboard/ui.css +2 -2
  20. package/src/dashboard/ui.js +16 -7
  21. package/src/dashboard/usage.js +3 -1
  22. package/src/dashboard-api.mjs +10 -7
  23. package/src/doctor-repair.mjs +2 -0
  24. package/src/doctor.mjs +18 -2
  25. package/src/m365-settings.mjs +89 -0
  26. package/src/native-prediction-windows.mjs +2 -7
  27. package/src/profile-model-runtime.mjs +4 -2
  28. package/src/provider-management.mjs +28 -0
  29. package/src/provider-runtime.mjs +179 -0
  30. package/src/provider-settings.mjs +32 -0
  31. package/src/providers/github.mjs +62 -0
  32. package/src/providers/m365-auth-helper.mjs +72 -0
  33. package/src/providers/m365-auth.mjs +105 -0
  34. package/src/providers/m365-messages-policy.mjs +20 -0
  35. package/src/providers/m365-network.mjs +73 -0
  36. package/src/providers/m365.mjs +238 -0
  37. package/src/response-failures.mjs +4 -2
  38. package/src/response-history.mjs +20 -3
  39. package/src/responses-handler.mjs +40 -95
  40. package/src/responses-image-tools.mjs +61 -0
  41. package/src/responses-proxy.mjs +5 -5
  42. package/src/responses-request.mjs +25 -0
  43. package/src/stream-performance.mjs +7 -4
  44. package/src/usage-analysis.mjs +3 -2
  45. package/src/usage-store.mjs +41 -12
  46. package/src/usage.mjs +8 -2
  47. package/src/windows-http-network.mjs +122 -0
  48. package/src/windows-prediction-network.cs +13 -6
  49. package/src/windows-prediction-network.mjs +4 -108
  50. 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
@@ -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
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,6 +17,49 @@ 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
@@ -102,12 +149,19 @@ The existing PEM reader, App-profile trust schema and transactional activation
102
149
  remain shared. Issuance requires neither external OpenSSL nor a Windows
103
150
  certificate store. Valid existing credentials skip issuance; default-off startup
104
151
  does not invoke it. macOS keeps the existing system OpenSSL implementation.
105
- Windows automatic-proxy support has one isolated native WinHTTP worker
106
- (`windows-prediction-network.mjs` / `.cs`) for company routing, authentication and
107
- 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.
108
160
  The App PAC delegates unrelated URLs to the company script; Node never executes
109
- that script. This worker is not a shared inference/image network backend and is
110
- 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.
111
165
  Bridge-port ownership is shared across macOS and Windows in the existing
112
166
  prediction lifecycle, with locked first-start persistence and no replacement
113
167
  on conflict. OS process inspection stays in the launcher/platform boundary;
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "0.9.41",
3
+ "version": "0.10.0",
4
4
  "description": "Use Codex App with GitHub Copilot",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
@@ -53,5 +53,8 @@
53
53
  "dependencies": {
54
54
  "sharp": "0.35.3",
55
55
  "smol-toml": "1.8.0"
56
+ },
57
+ "optionalDependencies": {
58
+ "@azure/msal-node-runtime": "0.20.6"
56
59
  }
57
60
  }