codex-copilot-dx 0.4.36 → 0.4.37

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
@@ -78,7 +78,11 @@ For live runtime diagnostics, query the running adapter from the same machine:
78
78
  curl -s http://127.0.0.1:2026/_ccdx/status | jq
79
79
  ```
80
80
 
81
- The status endpoint is restricted to the socket's real loopback address, even when LAN binding is explicitly enabled. It reports fixed-size request counters, latency totals, admission pressure, memory use, response-history size, image queue state, model cache counts, and token expiry state. It never includes prompts, completions, tool arguments, image content, account names, or token values. API responses and related log lines include the same safe `X-Request-Id`/`request_id` for correlation.
81
+ The status endpoint is restricted to the socket's real loopback address, even when LAN binding is explicitly enabled. It reports fixed-size request counters, latency totals, admission pressure, memory use, response-history size, image queue state, model cache counts, and token expiry state. It never includes prompts, completions, tool arguments, image content, account names, or token values. API responses always include a safe `X-Request-Id` for correlation. To include the same ID as `request_id` in related terminal and file log lines, start the adapter with:
82
+
83
+ ```bash
84
+ codex-copilot-dx --show-request-id
85
+ ```
82
86
 
83
87
  When the saved token is missing, `codex-copilot-dx` first looks for compatible local Copilot GitHub tokens, validates them with GitHub and Copilot, and imports a valid one before starting device login. It checks explicit token sources (`CCDX_GITHUB_TOKEN`, `CCDX_GITHUB_TOKEN_PATH`, `CCDX_GITHUB_TOKEN_PATHS`) plus common local `auth.json` layouts under application config directories. It does not rely on a specific app name. Generic discovery refuses to choose silently when valid tokens for multiple GitHub accounts are found. After an account is selected, automatic `401`/`403` recovery and in-process token rotation accept only the 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 switch accounts.
84
88
 
package/bin/cli.mjs CHANGED
@@ -250,6 +250,7 @@ try {
250
250
  claudeDesktopApiKey,
251
251
  claudeDesktopModelDefs,
252
252
  modelRegistry: MODEL_REGISTRY,
253
+ showRequestId: CLI.showRequestId,
253
254
  upstreamTimeoutMs: RUNTIME.upstreamTimeoutMs,
254
255
  streamHandshakeTimeoutMs: RUNTIME.streamHandshakeTimeoutMs,
255
256
  streamIdleTimeoutMs: RUNTIME.streamIdleTimeoutMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "0.4.36",
3
+ "version": "0.4.37",
4
4
  "description": "Use Codex Desktop, Claude Code, and Claude App with GitHub Copilot",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
package/src/adapter.mjs CHANGED
@@ -235,7 +235,11 @@ export function createAdapterHandler(options = {}) {
235
235
  }
236
236
 
237
237
  try {
238
- const result = runWithRequestContext({ requestId, pathname }, () => dispatch(req, res, pathname));
238
+ const result = runWithRequestContext({
239
+ requestId,
240
+ pathname,
241
+ showRequestId: options.showRequestId === true,
242
+ }, () => dispatch(req, res, pathname));
239
243
  if (result && typeof result.then === "function") {
240
244
  return result.catch((error) => {
241
245
  complete({ statusCode: res.statusCode >= 400 ? res.statusCode : 500 });
@@ -1,5 +1,6 @@
1
1
  const HELP_COMMANDS = new Set(["help", "--help", "-h"]);
2
2
  const VERSION_COMMANDS = new Set(["version", "--version", "-v"]);
3
+ const START_OPTIONS = new Set(["--configure-claude-desktop", "--show-request-id"]);
3
4
 
4
5
  function unexpectedArgs(args) {
5
6
  throw new Error(`Unexpected argument${args.length === 1 ? "" : "s"}: ${args.join(" ")}`);
@@ -7,18 +8,18 @@ function unexpectedArgs(args) {
7
8
 
8
9
  export function parseCliArgs(args = []) {
9
10
  const [command, ...rest] = args;
10
- if (!command) return { command: "start", configureClaudeDesktop: false, online: false, compat: false };
11
+ if (!command) return { command: "start", configureClaudeDesktop: false, showRequestId: false, online: false, compat: false };
11
12
  if (HELP_COMMANDS.has(command)) {
12
13
  if (rest.length) unexpectedArgs(rest);
13
- return { command: "help", configureClaudeDesktop: false, online: false, compat: false };
14
+ return { command: "help", configureClaudeDesktop: false, showRequestId: false, online: false, compat: false };
14
15
  }
15
16
  if (VERSION_COMMANDS.has(command)) {
16
17
  if (rest.length) unexpectedArgs(rest);
17
- return { command: "version", configureClaudeDesktop: false, online: false, compat: false };
18
+ return { command: "version", configureClaudeDesktop: false, showRequestId: false, online: false, compat: false };
18
19
  }
19
20
  if (command === "usage") {
20
21
  if (rest.length) unexpectedArgs(rest);
21
- return { command: "usage", configureClaudeDesktop: false, online: false, compat: false };
22
+ return { command: "usage", configureClaudeDesktop: false, showRequestId: false, online: false, compat: false };
22
23
  }
23
24
  if (command === "doctor" || command === "--doctor") {
24
25
  const supported = new Set(["--online", "--compat"]);
@@ -30,13 +31,25 @@ export function parseCliArgs(args = []) {
30
31
  return {
31
32
  command: "doctor",
32
33
  configureClaudeDesktop: false,
34
+ showRequestId: false,
33
35
  online: rest.includes("--online"),
34
36
  compat: rest.includes("--compat"),
35
37
  };
36
38
  }
37
- if (command === "--configure-claude-desktop") {
38
- if (rest.length) unexpectedArgs(rest);
39
- return { command: "start", configureClaudeDesktop: true, online: false, compat: false };
39
+ if (START_OPTIONS.has(command)) {
40
+ const options = [command, ...rest];
41
+ const invalid = options.filter((arg) => !START_OPTIONS.has(arg));
42
+ if (invalid.length) unexpectedArgs(invalid);
43
+ for (const option of START_OPTIONS) {
44
+ if (options.filter((arg) => arg === option).length > 1) unexpectedArgs([option]);
45
+ }
46
+ return {
47
+ command: "start",
48
+ configureClaudeDesktop: options.includes("--configure-claude-desktop"),
49
+ showRequestId: options.includes("--show-request-id"),
50
+ online: false,
51
+ compat: false,
52
+ };
40
53
  }
41
54
  throw new Error(`Unknown command or option: ${command}`);
42
55
  }
@@ -69,7 +82,7 @@ export function parseRuntimeOptions(env = process.env) {
69
82
 
70
83
  export function cliHelp() {
71
84
  return `Usage:
72
- codex-copilot-dx [--configure-claude-desktop]
85
+ codex-copilot-dx [--configure-claude-desktop] [--show-request-id]
73
86
  codex-copilot-dx doctor [--online] [--compat]
74
87
  codex-copilot-dx usage
75
88
  codex-copilot-dx --version
package/src/status.mjs CHANGED
@@ -10,7 +10,8 @@ const LABELS = {
10
10
  };
11
11
 
12
12
  export function status(kind, message) {
13
- const requestId = currentRequestContext()?.requestId;
13
+ const requestContext = currentRequestContext();
14
+ const requestId = requestContext?.showRequestId ? requestContext.requestId : "";
14
15
  const context = requestId ? ` request_id=${requestId}` : "";
15
16
  return `${LABELS[kind] || LABELS.info}${context} ${message}`;
16
17
  }