codex-copilot-dx 0.9.31 → 0.9.34
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 +8 -8
- package/bin/cli.mjs +37 -29
- package/docs/ARCHITECTURE.md +50 -2
- package/docs/REFERENCE.md +77 -8
- package/package.json +3 -2
- package/src/adapter.mjs +14 -7
- package/src/auth-credentials.mjs +242 -0
- package/src/auth-device-flow.mjs +210 -0
- package/src/auth-profile.mjs +2 -2
- package/src/auth.mjs +10 -450
- package/src/bounded-file.mjs +28 -0
- package/src/cli-status.mjs +2 -0
- package/src/client-integration.mjs +10 -3
- package/src/config.mjs +3 -2
- package/src/copilot.mjs +1 -1
- package/src/credential-permissions.mjs +21 -0
- package/src/dashboard/index.html +2 -0
- package/src/dashboard/language.js +3 -0
- package/src/dashboard/status.js +192 -0
- package/src/dashboard/ui.js +6 -343
- package/src/dashboard/usage.js +161 -0
- package/src/dashboard-api.mjs +5 -4
- package/src/dashboard.mjs +2 -0
- package/src/doctor.mjs +20 -0
- package/src/http-transport.mjs +7 -0
- package/src/image-provider-config.mjs +2 -2
- package/src/launcher.mjs +26 -16
- package/src/live-models.mjs +16 -0
- package/src/model-cache.mjs +2 -1
- package/src/native-prediction-profile.mjs +2 -1
- package/src/native-prediction-recovery.mjs +39 -0
- package/src/native-prediction-route.mjs +94 -0
- package/src/native-prediction-state.mjs +7 -1
- package/src/native-prediction-transport.mjs +6 -0
- package/src/native-prediction.mjs +42 -4
- package/src/package-update.mjs +44 -7
- package/src/profile-model-runtime.mjs +1 -1
- package/src/response-failures.mjs +7 -0
- package/src/startup-ui.mjs +54 -0
- package/src/status.mjs +1 -1
- package/src/stream-performance.mjs +4 -0
- package/src/user-settings.mjs +2 -2
- package/src/windows-prediction-network.mjs +1 -1
package/README.md
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Use Codex App with GitHub Copilot through a local adapter.
|
|
4
4
|
|
|
5
|
-
CCDX targets Codex App
|
|
6
|
-
catalog, and preserves Responses streaming, tool calls and conversation history.
|
|
5
|
+
CCDX targets Codex App: Copilot discovery, adapted model catalogs, Responses streaming, tool calls and conversation history.
|
|
7
6
|
Default Auto-review: **GPT-6.1 Sol / low**. Image generation is **off by default**. Native predictions are also **off by default**.
|
|
8
7
|
|
|
9
8
|
## Install and run
|
|
@@ -23,7 +22,7 @@ enabled. If PowerShell blocks scripts, use `npm.cmd` / `ccdx.cmd`; do not change
|
|
|
23
22
|
|
|
24
23
|
Open [the local dashboard](http://127.0.0.1:2026/) for status, model discovery,
|
|
25
24
|
usage, cache/limits, recent failures, request context and animation settings.
|
|
26
|
-
Auto refresh runs every 30 minutes while visible and can be switched off. Hidden pages pause; opening sections and manual refresh still work.
|
|
25
|
+
Auto refresh runs every 30 minutes while visible and can be switched off. Hidden pages pause; opening sections and manual refresh still work. Startup uses an atom icon and aligned checks; `Ready` refers to the core service. Narrow/non-color terminals use a plain title.
|
|
27
26
|
|
|
28
27
|
## Commands
|
|
29
28
|
|
|
@@ -75,6 +74,7 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
|
|
|
75
74
|
Other domains and the CCDX model endpoint stay on their existing routes.
|
|
76
75
|
No program files or OS trust are changed. Static HTTP/HTTPS/SOCKS5 proxies and bypass rules are retained.
|
|
77
76
|
Windows supports company PAC/WPAD; macOS dynamic routing remains unsupported. Windows setup needs the official MSIX App, Windows PowerShell and .NET Framework 4.7.2+—not Git/OpenSSL. See the reference for limits.
|
|
77
|
+
Bridge checks allow three same-port recovery attempts per process, without App restart/replay. Only closed, initialized Apps in direct environments receive an owned persistent route; user/company proxies are preserved. Missing routes in running Apps are not hot-attached.
|
|
78
78
|
- CCDX adds experimental local history compression only when installed App
|
|
79
79
|
runtimes support it and report it off. Existing choices are preserved; an
|
|
80
80
|
already-enabled default, unavailable runtime or failed check is skipped.
|
|
@@ -86,13 +86,13 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
|
|
|
86
86
|
|
|
87
87
|
Startup checks GitHub's latest-release web redirect, not npm or the anonymous REST quota, and suggests `ccdx update github`.
|
|
88
88
|
Updates install the exact stable tag; dependencies still use npm's configured registry. Lookup errors identify HTTP refusal, timeout, network failure or invalid redirects.
|
|
89
|
+
Updates warn about mismatched npm targets without changing PATH/prefix. Full `ccdx doctor` reports this target and readonly credential permissions; it never changes ACLs.
|
|
90
|
+
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.
|
|
89
91
|
|
|
90
92
|
The dashboard and CLI separate prediction preference, bridge state and observed config traffic; candidate visibility stays unknown.
|
|
91
93
|
Inference, client integration, optional images and management have separate ownership. See [architecture boundaries](docs/ARCHITECTURE.md).
|
|
92
94
|
|
|
93
|
-
See the [complete
|
|
94
|
-
for authentication recovery, configuration safety, limits, logging, images and client compatibility.
|
|
95
|
-
The same reference is included as `docs/REFERENCE.md` in the installed npm package.
|
|
95
|
+
See the [complete reference](https://github.com/DaleXiao/codex-copilot-dx/blob/main/docs/REFERENCE.md) for authentication, configuration, limits, logging, images and compatibility. It is also included as `docs/REFERENCE.md` in the npm package.
|
|
96
96
|
|
|
97
97
|
## Development
|
|
98
98
|
|
|
@@ -102,7 +102,7 @@ npm run verify
|
|
|
102
102
|
node scripts/config-startup-replay.mjs
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
Verification covers unit tests, isolated HTTP/idle-stream replay, performance
|
|
106
|
-
|
|
105
|
+
Verification covers unit tests, isolated HTTP/idle-stream replay, performance/resource gates and package contents—not an upstream service SLA.
|
|
106
|
+
CI also tests Node 22.15/24 on Linux, Windows and macOS, temporary-prefix installation/upgrade and installed image processing.
|
|
107
107
|
|
|
108
108
|
License: MIT.
|
package/bin/cli.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import { createProfileRuntime } from "../src/profile-runtime.mjs";
|
|
|
22
22
|
import { createProfileModelRuntime } from "../src/profile-model-runtime.mjs";
|
|
23
23
|
import { createCodexModelCatalog } from "../src/codex-model-catalog.mjs";
|
|
24
24
|
import { setResponseHistoryMaxBytes } from "../src/response-history.mjs";
|
|
25
|
+
import { startupBanner, startupCheck, startupReady, startupLogger, predictionStartupCheck } from "../src/startup-ui.mjs";
|
|
25
26
|
|
|
26
27
|
const LOCAL_VERSION = localPackageVersion();
|
|
27
28
|
const CLI_NAME = cliCommandName();
|
|
@@ -271,7 +272,8 @@ async function clientIntegrations() {
|
|
|
271
272
|
if (!clientIntegration) {
|
|
272
273
|
const { createClientIntegration } = await import("../src/client-integration.mjs");
|
|
273
274
|
clientIntegration = createClientIntegration({ port: ADAPTER_PORT, host: ADAPTER_HOST,
|
|
274
|
-
|
|
275
|
+
configLog: startupLogger("Config"),
|
|
276
|
+
info: (message) => console.log(startupCheck("info", "Client", message)), warning: (message) => console.warn(startupCheck("warn", "Client", message)) });
|
|
275
277
|
}
|
|
276
278
|
return clientIntegration;
|
|
277
279
|
}
|
|
@@ -293,30 +295,36 @@ async function reuseRunningAdapterIfAvailable() {
|
|
|
293
295
|
}
|
|
294
296
|
if (!running.ok) return false;
|
|
295
297
|
|
|
296
|
-
console.log(
|
|
297
|
-
|
|
298
|
+
console.log(startupCheck("ok", "Adapter", `Using existing service at ${running.baseUrl}`));
|
|
299
|
+
console.log(startupCheck("info", "Auth", "Using existing service credentials; not rechecked"));
|
|
300
|
+
const { compressionSetup, imageEnabled, imageMcpSkipped } = await configureCodexClient();
|
|
298
301
|
|
|
299
302
|
let predictionPacUrl = null;
|
|
300
303
|
let predictionApp = null;
|
|
301
304
|
let predictionProfile = null;
|
|
305
|
+
let persistedPredictionRoute = false;
|
|
306
|
+
let predictionConfigured = false;
|
|
307
|
+
let launchRoute = "unknown";
|
|
302
308
|
try {
|
|
303
309
|
const { readPredictionSettings } = await import("../src/native-prediction-profile.mjs");
|
|
304
310
|
const preference = readPredictionSettings();
|
|
311
|
+
predictionConfigured = preference.enabled;
|
|
305
312
|
if (preference.enabled) {
|
|
306
313
|
predictionPacUrl = running.data?.native_prediction_pac || null;
|
|
307
314
|
predictionApp = preference.app?.app;
|
|
308
315
|
predictionProfile = preference.app?.profile;
|
|
316
|
+
const { hasInstalledPredictionRoute } = await import("../src/native-prediction-route.mjs");
|
|
317
|
+
const { predictionPaths } = await import("../src/native-prediction-profile.mjs");
|
|
318
|
+
persistedPredictionRoute = hasInstalledPredictionRoute({ ...predictionPaths({ app: preference.app }), pacUrl: predictionPacUrl });
|
|
309
319
|
if (!predictionPacUrl) console.warn(status("warn", "Restart ccdx to activate the newly enabled prediction bridge"));
|
|
310
320
|
}
|
|
311
321
|
} catch (error) { console.warn(status("warn", error.message)); }
|
|
312
|
-
await openCodex({ predictionPacUrl, predictionApp, predictionProfile
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
Tip: Run ${CLI_NAME} help to view more features and commands.
|
|
319
|
-
`);
|
|
322
|
+
await openCodex({ predictionPacUrl, predictionApp, predictionProfile, persistedPredictionRoute,
|
|
323
|
+
onPredictionRoute: route => { launchRoute = route; }, log: startupLogger("App") });
|
|
324
|
+
console.log(predictionStartupCheck({ configured: predictionConfigured, bridge: predictionPacUrl ? "running" : "unknown", launch_route: launchRoute }));
|
|
325
|
+
console.log(startupCheck(imageEnabled && imageMcpSkipped ? "warn" : "info", "Images", imageEnabled
|
|
326
|
+
? imageMcpSkipped ? "Client setup skipped; see warning above" : "Configured; provider not tested" : "Off"));
|
|
327
|
+
console.log(startupReady({ baseUrl: running.baseUrl, commandName: CLI_NAME, reused: true }));
|
|
320
328
|
await compressionSetup;
|
|
321
329
|
return true;
|
|
322
330
|
}
|
|
@@ -337,17 +345,14 @@ if (CLI.command === "doctor") {
|
|
|
337
345
|
process.exit(checks.some((check) => check.kind === "err") ? 1 : 0);
|
|
338
346
|
}
|
|
339
347
|
|
|
340
|
-
console.log(`
|
|
341
|
-
${CLI_BANNER}
|
|
342
|
-
Use Codex App with GitHub Copilot
|
|
343
|
-
`);
|
|
348
|
+
console.log(`\n${startupBanner({ commandName: CLI_NAME, version: LOCAL_VERSION })}\n`);
|
|
344
349
|
|
|
345
350
|
async function printUpdateNotice() {
|
|
346
351
|
try {
|
|
347
352
|
const { latestVersion, updateAvailable } = await checkForUpdate({ currentVersion: LOCAL_VERSION });
|
|
348
353
|
if (!updateAvailable) return;
|
|
349
|
-
console.log(`\n
|
|
350
|
-
console.log(`
|
|
354
|
+
console.log(`\n${status("warn", `Update available: ${LOCAL_VERSION} -> ${latestVersion}`)}`);
|
|
355
|
+
console.log(`Run ${CLI_NAME} update github to update, then restart ${CLI_NAME}.\n`);
|
|
351
356
|
} catch {
|
|
352
357
|
// Never block startup on the update check.
|
|
353
358
|
}
|
|
@@ -364,7 +369,7 @@ try {
|
|
|
364
369
|
}
|
|
365
370
|
|
|
366
371
|
// Ensure GitHub login, using device flow if no token exists.
|
|
367
|
-
await ensureAuth();
|
|
372
|
+
await ensureAuth({ log: startupLogger("Auth") });
|
|
368
373
|
|
|
369
374
|
const profileRuntime = createProfileRuntime({ codexClient: defaultCopilotClient });
|
|
370
375
|
const profileModels = createProfileModelRuntime({
|
|
@@ -373,11 +378,15 @@ try {
|
|
|
373
378
|
timeoutMs: MODEL_REFRESH_TIMEOUT_MS,
|
|
374
379
|
commandName: CLI_NAME,
|
|
375
380
|
autoReviewModelResolver: () => autoReviewModelPreference().model,
|
|
381
|
+
log: (kind, message) => console.log(startupCheck(kind, "Models", message)),
|
|
376
382
|
});
|
|
377
383
|
|
|
378
384
|
// Refresh the VS Code version in the background; fallback is non-blocking.
|
|
379
385
|
void refreshVSCodeVersion();
|
|
380
386
|
await profileModels.initialize();
|
|
387
|
+
if (profileModels.codexRegistry.source !== "live") {
|
|
388
|
+
console.log(startupCheck("info", "Models", `${profileModels.codexRegistry.source} list loaded${profileModels.codexRegistry.refreshInFlight ? "; refreshing" : ""}`));
|
|
389
|
+
}
|
|
381
390
|
|
|
382
391
|
if (!isLoopbackHost(ADAPTER_HOST)) {
|
|
383
392
|
console.log(status("warn", `ADAPTER_HOST=${ADAPTER_HOST} exposes the adapter beyond loopback because CCDX_ALLOW_LAN=1 is set. Use only on trusted networks.`));
|
|
@@ -387,6 +396,7 @@ try {
|
|
|
387
396
|
const terminalAnimationTheme = terminalAnimationPreference().theme;
|
|
388
397
|
const codexModelCatalog = createCodexModelCatalog();
|
|
389
398
|
activeServer = await startAdapter(ADAPTER_PORT, ADAPTER_HOST, {
|
|
399
|
+
log: startupLogger("Adapter"),
|
|
390
400
|
autoReviewModelResolver: () => autoReviewPreference(),
|
|
391
401
|
codexClient: profileRuntime.codexClient,
|
|
392
402
|
codexModelCatalog,
|
|
@@ -401,13 +411,19 @@ try {
|
|
|
401
411
|
});
|
|
402
412
|
|
|
403
413
|
// Point Codex App at the adapter.
|
|
404
|
-
const { compressionSetup } = await configureCodexClient();
|
|
414
|
+
const { compressionSetup, imageEnabled, imageMcpSkipped } = await configureCodexClient();
|
|
405
415
|
|
|
406
416
|
// Optional native prediction setup must never prevent the core adapter from running.
|
|
407
417
|
nativePrediction = await (await clientIntegrations()).start();
|
|
418
|
+
const persistentRoute = await nativePrediction?.prepareRoute();
|
|
408
419
|
|
|
409
420
|
// Launch Codex when available. A running App is never forcibly restarted.
|
|
410
|
-
await openCodex({ predictionPacUrl: nativePrediction?.pacUrl, predictionApp: nativePrediction?.app, predictionProfile: nativePrediction?.profile
|
|
421
|
+
await openCodex({ predictionPacUrl: nativePrediction?.pacUrl, predictionApp: nativePrediction?.app, predictionProfile: nativePrediction?.profile,
|
|
422
|
+
preparePredictionRoute: () => nativePrediction?.prepareRoute(), persistedPredictionRoute: persistentRoute?.status === "installed",
|
|
423
|
+
onPredictionRoute: route => clientIntegration?.launched(route), log: startupLogger("App") });
|
|
424
|
+
console.log(predictionStartupCheck(clientIntegration?.snapshot().prediction));
|
|
425
|
+
console.log(startupCheck(imageEnabled && imageMcpSkipped ? "warn" : "info", "Images", imageEnabled
|
|
426
|
+
? imageMcpSkipped ? "Client setup skipped; see warning above" : "Configured; provider not tested" : "Off"));
|
|
411
427
|
|
|
412
428
|
// Periodically refresh the model list + endpoint cache so a long-running
|
|
413
429
|
// adapter picks up newly released models without a restart.
|
|
@@ -419,15 +435,7 @@ try {
|
|
|
419
435
|
modelRefreshTimer.unref?.();
|
|
420
436
|
}
|
|
421
437
|
|
|
422
|
-
console.log(
|
|
423
|
-
${status("ok", "Ready, CCDX adapter is ready to use")}
|
|
424
|
-
|
|
425
|
-
Adapter: ${adapterBaseUrl(ADAPTER_HOST, ADAPTER_PORT)}
|
|
426
|
-
|
|
427
|
-
Tip: Run ${CLI_NAME} help to view more features and commands.
|
|
428
|
-
|
|
429
|
-
Press Ctrl+C to stop.
|
|
430
|
-
`);
|
|
438
|
+
console.log(startupReady({ baseUrl: adapterBaseUrl(ADAPTER_HOST, ADAPTER_PORT), commandName: CLI_NAME }));
|
|
431
439
|
|
|
432
440
|
const shutdown = async (signal) => {
|
|
433
441
|
if (shuttingDown) return;
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -24,6 +24,16 @@ command interpreter only for the fixed `npm.cmd` installer command; stable-tag
|
|
|
24
24
|
validation remains upstream of launch. macOS/Linux use direct npm argv. There
|
|
25
25
|
is no generic shell runner or package-manager framework, and npm's configured
|
|
26
26
|
registry/proxy environment remains owned by the user.
|
|
27
|
+
Readonly update preflight reports Node/npm, the running package and npm's selected
|
|
28
|
+
global target. A different target warns, but never changes PATH or prefix. Its
|
|
29
|
+
bounded npm probe is limited to explicit update and full doctor commands.
|
|
30
|
+
Its stdout/stderr are captured separately; npm configuration warnings do not
|
|
31
|
+
leak into doctor output. The real installer's inherited streams are unchanged.
|
|
32
|
+
|
|
33
|
+
Authentication keeps its public facade in `auth.mjs`. Device-code polling and
|
|
34
|
+
cancellation live in `auth-device-flow.mjs`; local discovery and transactional
|
|
35
|
+
credential storage live in `auth-credentials.mjs`. These modules do not depend
|
|
36
|
+
on the CLI, dashboard or service composition root.
|
|
27
37
|
|
|
28
38
|
Native prediction has a separate loopback transport and an isolated HTTPS agent.
|
|
29
39
|
Only its two selected hosts use the App-specific route. Non-configuration requests
|
|
@@ -54,9 +64,24 @@ prediction lifecycle, with locked first-start persistence and no replacement
|
|
|
54
64
|
on conflict. OS process inspection stays in the launcher/platform boundary;
|
|
55
65
|
it runs only for explicit prediction-enabled launch/reuse, not per model request.
|
|
56
66
|
macOS uses bounded system `ps` reads and Windows retains its existing registered
|
|
57
|
-
process checks. No process is stopped
|
|
67
|
+
process checks. No process is stopped and no App-process watcher or dependency is
|
|
58
68
|
added. Core inference keeps its existing service port and lifecycle.
|
|
59
69
|
|
|
70
|
+
`native-prediction-recovery.mjs` supervises only the enabled optional bridge,
|
|
71
|
+
using a low-cost listener check, same-route restart, single-flight recovery and
|
|
72
|
+
a three-attempt budget. It does not watch App processes, modify proxy policy or
|
|
73
|
+
replay inference. `native-prediction-route.mjs` separately owns the closed-profile
|
|
74
|
+
preference transaction and its rollback metadata. It accepts direct environments
|
|
75
|
+
only, preserves company/user routing, and never treats a saved preference as
|
|
76
|
+
proof of a running route or visible candidate. App compatibility is rechecked only
|
|
77
|
+
when its recorded identity changes, before existing trust/port checks are reused.
|
|
78
|
+
|
|
79
|
+
`startup-ui.mjs` is pure terminal presentation: a static A atom, aligned checks
|
|
80
|
+
and the common new/reused-service footer. It depends only on terminal/status
|
|
81
|
+
utilities, not on inference or platform probes. The CLI feeds existing lifecycle
|
|
82
|
+
results into it; presentation does not run doctor, call models or wait for optional
|
|
83
|
+
background tasks. All status tags share one fixed-width column.
|
|
84
|
+
|
|
60
85
|
Connection-ownership replay rejection is a provider-owned retry policy. It
|
|
61
86
|
removes only unavailable reasoning once, preserving visible history and tools.
|
|
62
87
|
Opaque compaction cannot be assumed equivalent to remaining plaintext. The
|
|
@@ -75,13 +100,19 @@ and referenced/split histories do not gain filesystem recovery access.
|
|
|
75
100
|
|
|
76
101
|
`dashboard/refresh.js` owns the browser-only read lifecycle: one visible-page
|
|
77
102
|
timer, per-group in-flight deduplication, attempt freshness, cancellation and
|
|
78
|
-
last-good snapshots. `ui.js`
|
|
103
|
+
last-good snapshots. `ui.js` composes the controls and refresh resources;
|
|
104
|
+
`status.js` owns status/failure rendering, and `usage.js` owns usage rendering
|
|
105
|
+
and date selection. Their state stays page-local. Models, usage,
|
|
79
106
|
status/account and animation metadata remain independent resources; no timer
|
|
80
107
|
or data watcher is added to the Node service. Animation frames load once per
|
|
81
108
|
page when opened, and read refresh does not overwrite an unsaved choice.
|
|
82
109
|
`upstream-body.mjs` is the shared bounded response reader. The transport retains
|
|
83
110
|
its existing exports; live model lookup uses the same 8 MiB catalog limit as
|
|
84
111
|
core model discovery, without importing the request lifecycle or UI layer.
|
|
112
|
+
Overlapping live queries with the same credential fingerprint, home, fetch
|
|
113
|
+
implementation and lookup parameters share one in-flight lookup. A waiter can
|
|
114
|
+
cancel independently; the last cancellation aborts the lookup. Completed results
|
|
115
|
+
are not cached as live, and each waiter receives its own snapshot.
|
|
85
116
|
|
|
86
117
|
## Configuration ownership
|
|
87
118
|
|
|
@@ -90,6 +121,12 @@ selection and are not inferred from that directory. CCDX writers use a shared
|
|
|
90
121
|
per-file lock, reread current contents and preserve unrelated values. Locks do
|
|
91
122
|
not coordinate editors or other applications that ignore them. Read-only status
|
|
92
123
|
and doctor commands do not write configuration.
|
|
124
|
+
Small local reads use one open file descriptor with byte limits: 1 MiB for
|
|
125
|
+
settings/auth metadata, 64 KiB for token files, and 9 MiB for cached model data
|
|
126
|
+
(including metadata). This does not change session/history limits or symlink
|
|
127
|
+
semantics. Full doctor checks credential permissions without reading secrets:
|
|
128
|
+
POSIX mode bits or Windows allow entries are review evidence, not a complete
|
|
129
|
+
effective-access calculation. It never rewrites ACLs or blocks startup.
|
|
93
130
|
|
|
94
131
|
Core inference interfaces remain unchanged. This change adds a concrete
|
|
95
132
|
composition boundary; it does not relocate every file or add speculative APIs.
|
|
@@ -100,9 +137,20 @@ Prediction preference, bridge readiness and observed configuration responses are
|
|
|
100
137
|
different states. None proves that a candidate appeared in the App. The dashboard
|
|
101
138
|
keeps that result unknown. Integration diagnostics retain bounded, redacted
|
|
102
139
|
metadata, not conversation or image contents.
|
|
140
|
+
HTTP failures have a separate 20-entry metadata ring (`http_errors`): status,
|
|
141
|
+
safe technical code, model when observed, route, source and request IDs. Original
|
|
142
|
+
HTTP error bodies are returned unchanged but not saved in that ring. Model
|
|
143
|
+
terminal diagnostics and their counters retain their existing meaning. The
|
|
144
|
+
dashboard merges recent HTTP, model and request-timeline failures for display.
|
|
103
145
|
|
|
104
146
|
Tests cover module dependency direction, default-off behavior, concurrent writers,
|
|
105
147
|
proxy handshakes, TLS validation, streaming, history isolation and release lookup.
|
|
106
148
|
Performance measurements distinguish request preparation from model latency.
|
|
107
149
|
Release reports describe a specific environment, not an SLA or a guarantee of
|
|
108
150
|
compatibility with every future client or corporate network policy.
|
|
151
|
+
CI runs Node 22.15 and 24 on Linux, Windows and macOS. The owned temporary-prefix
|
|
152
|
+
package smoke installs 0.9.31, upgrades to the packed candidate and exercises
|
|
153
|
+
installed sharp without provider calls. It does not claim a live Codex UI test
|
|
154
|
+
or the GitHub updater's network installation; the Windows command chain has a
|
|
155
|
+
separate actual-process fixture. Direct runtime dependencies are exact versions;
|
|
156
|
+
the lockfile fixes CI transitives, not consumers' future transitive resolution.
|
package/docs/REFERENCE.md
CHANGED
|
@@ -155,8 +155,10 @@ fallback after upstream-proxy rejection is added. The default App profile
|
|
|
155
155
|
is `~/Library/Application Support/Codex`; an explicit
|
|
156
156
|
`CODEX_ELECTRON_USER_DATA_PATH` is respected. Quit the App before trust changes;
|
|
157
157
|
CCDX never kills it. The launcher uses the exact App that passed the compatibility
|
|
158
|
-
check.
|
|
159
|
-
|
|
158
|
+
check. A changed App is rechecked once at bridge startup using the existing
|
|
159
|
+
signature/protocol and profile checks. The exact App/profile identity, saved port
|
|
160
|
+
and trust must remain unchanged; unsupported updates still require explicit setup.
|
|
161
|
+
Unknown client/store/configuration formats are not forcibly rewritten.
|
|
160
162
|
These are checked compatibility boundaries, not a promise for every future App.
|
|
161
163
|
|
|
162
164
|
The bridge changes only its own prediction fields and preserves already-enabled
|
|
@@ -173,14 +175,17 @@ provide a separate prediction-model picker.
|
|
|
173
175
|
`prediction off` immediately disables new local overlays. Quit/reopen Codex to
|
|
174
176
|
clear its cached predictions and temporary route. If the App is still running,
|
|
175
177
|
trust removal is deferred; quit it and run `prediction off` again. Only the exact
|
|
176
|
-
owned certificate record is removed, never the whole store.
|
|
178
|
+
owned certificate record is removed, never the whole store. A CCDX-owned persistent
|
|
179
|
+
proxy preference is restored first, preserving all unrelated preference values.
|
|
180
|
+
User-replaced proxy preferences are not restored over. Failed activation
|
|
177
181
|
rolls back newly added trust; certificate replacement keeps old trust until the
|
|
178
182
|
new preference is committed. If the bridge stops, new connections can fall back
|
|
179
183
|
to the original route; already-interrupted requests are not replayed. An App
|
|
180
184
|
already using the saved address need not be relaunched just because CCDX restarts.
|
|
181
185
|
If its route is missing or differs, fully quit Codex and run `ccdx` to attach it.
|
|
182
|
-
`CCDX_AUTO_LAUNCH=0` keeps
|
|
183
|
-
|
|
186
|
+
`CCDX_AUTO_LAUNCH=0` keeps automatic launch disabled and never hot-attaches a
|
|
187
|
+
running App. An already-persisted direct-environment preference can still be read
|
|
188
|
+
when the App is manually opened.
|
|
184
189
|
Optional prediction failures never prevent the core adapter or image service from
|
|
185
190
|
starting. `prediction status` reports the saved preference and, when a compatible
|
|
186
191
|
running adapter responds, its bridge state, configuration-response observations
|
|
@@ -191,6 +196,36 @@ no prompt matching, UI injection, transcript scanning or extra inference is used
|
|
|
191
196
|
to invent that status. Prediction settings are stored separately in
|
|
192
197
|
`~/.config/codex-copilot-dx/native-prediction/` (or under `XDG_CONFIG_HOME`).
|
|
193
198
|
|
|
199
|
+
Since `0.9.34`, an enabled bridge has a lightweight 30-second listener check.
|
|
200
|
+
Healthy checks do not spawn processes, call upstream, inspect transcripts or
|
|
201
|
+
probe model endpoints. A failed owned listener/native company-routing worker can
|
|
202
|
+
be recreated on the saved port, using the same checked profile and certificate.
|
|
203
|
+
There are at most three recovery attempts per CCDX process, with 30/60/120-second
|
|
204
|
+
backoff gates; checks themselves run every 30 seconds. Occupied ports are not
|
|
205
|
+
stolen or rotated. Startup failures do not gain a retry loop, and configuration
|
|
206
|
+
HTTP errors or missing gray text alone do not trigger transport restarts. Existing
|
|
207
|
+
requests can fail during an outage and are never replayed by this supervisor.
|
|
208
|
+
Disabled prediction startup creates no recovery timer. The existing in-memory
|
|
209
|
+
overlay switch still observes explicit on/off changes independently.
|
|
210
|
+
|
|
211
|
+
Before enabled App launch, CCDX can persist its PAC in that verified profile's
|
|
212
|
+
`Default/Preferences`, but only in a direct environment, with initialized regular
|
|
213
|
+
profile files and the App closed. Existing explicit App proxies and all company
|
|
214
|
+
static/PAC/WPAD routes are preserved. Ownership intent is stored in `route.json`
|
|
215
|
+
before changing the one proxy field; unrelated settings are retained, concurrent
|
|
216
|
+
edits fail closed, and matching setup is not rewritten. If an App is already
|
|
217
|
+
running, first-time migration is deferred until a normal closed-App launch;
|
|
218
|
+
CCDX does not claim it can hot-attach a missing route. A manually reopened App
|
|
219
|
+
with a saved preference is reported as awaiting configuration traffic, not as
|
|
220
|
+
launch-route verified. This preference is a prevention measure, not a guarantee
|
|
221
|
+
for every future Chromium profile format or OS version. Company proxy users keep
|
|
222
|
+
the verified launch-argument path. Core inference/image routes are unchanged.
|
|
223
|
+
|
|
224
|
+
`prediction status` and `ccdx status` also expose launch-route evidence, persistent
|
|
225
|
+
route state, recovery attempts and recoveries. These are independent of the
|
|
226
|
+
unknown candidate-visibility value. A successful recovery only means the bridge
|
|
227
|
+
was recreated on the original address, not that gray text appeared.
|
|
228
|
+
|
|
194
229
|
### Configuration ownership
|
|
195
230
|
|
|
196
231
|
Core setup, image setup/guidance, config doctor, optional history compression and
|
|
@@ -207,6 +242,16 @@ Contention fails with a retry message instead of stealing a live lock. Other
|
|
|
207
242
|
applications do not participate in these locks, so snapshot conflict checks still
|
|
208
243
|
apply; the locks do not claim a global filesystem transaction.
|
|
209
244
|
|
|
245
|
+
Since `0.9.33`, local settings/auth metadata reads are capped at 1 MiB, token
|
|
246
|
+
files at 64 KiB, and saved model catalog files at 9 MiB including metadata.
|
|
247
|
+
Oversized files remain untouched. Existing strict readers reject them; optional
|
|
248
|
+
cache readers treat them as unusable. Conversation files, HTTP request limits
|
|
249
|
+
and runtime history/cache limits are unchanged.
|
|
250
|
+
Full `ccdx doctor` reports npm's global installation target and readonly credential
|
|
251
|
+
permission evidence. Windows checks existing NTFS allow entries for other
|
|
252
|
+
identities, without changing ACLs. This is not a full effective-access audit;
|
|
253
|
+
unavailable checks warn. `doctor config` performs neither npm nor ACL probes.
|
|
254
|
+
|
|
210
255
|
### Core adapter
|
|
211
256
|
|
|
212
257
|
One in-process adapter listens on `127.0.0.1:2026` by default and exposes:
|
|
@@ -311,7 +356,7 @@ npm exec --yes --package=codex-copilot-dx@latest -- ccdx
|
|
|
311
356
|
|
|
312
357
|
On a normal launch, CCDX:
|
|
313
358
|
|
|
314
|
-
1. Prints the installed package version and checks
|
|
359
|
+
1. Prints the installed package version and checks GitHub's latest stable release in the background (not npm).
|
|
315
360
|
2. Reuses a compatible running adapter when available; otherwise it reuses a compatible local Copilot credential or starts GitHub Device Flow when authentication is required.
|
|
316
361
|
3. Loads a usable model cache or attempts a live refresh, then starts listening. A cache older than two hours refreshes in the background; a fresh cache can be used immediately. A failed refresh retains the last-known-good list when one is available.
|
|
317
362
|
4. Checks the startup-managed settings in `CODEX_HOME/config.toml` (default `~/.codex/config.toml`), including the local `/v1` endpoint.
|
|
@@ -356,7 +401,18 @@ The upgrade intentionally does not delete or rewrite retired Claude or PM Studio
|
|
|
356
401
|
## Commands
|
|
357
402
|
|
|
358
403
|
Run `ccdx <command> --help` for command-specific behavior and side-effect details.
|
|
359
|
-
|
|
404
|
+
Startup uses aligned status/project/result columns and a left-aligned Ready footer
|
|
405
|
+
with the Web UI URL and `ccdx help`. Ctrl+C is shown only for the foreground-owned
|
|
406
|
+
service, never a short-lived command reusing another service. A static, favicon-style
|
|
407
|
+
atom uses ANSI green and half-block characters only on interactive color terminals
|
|
408
|
+
at least 72 columns wide; narrow terminals, `NO_COLOR`, `TERM=dumb` and redirected
|
|
409
|
+
output keep a plain title. No new graphics/font/runtime dependency is installed.
|
|
410
|
+
Credentials found are not labeled online-authorized, cached model lists are not
|
|
411
|
+
labeled fresh upstream data, and image configuration is not a provider test.
|
|
412
|
+
Ready reports core readiness independently of optional prediction/image warnings.
|
|
413
|
+
Model refresh logs show counts; `ccdx models` retains the complete live list.
|
|
414
|
+
VS Code compatibility-version details remain available in debug logging. Startup
|
|
415
|
+
does not wait for optional update/compression work or add online doctor/model probes.
|
|
360
416
|
|
|
361
417
|
### Live models
|
|
362
418
|
|
|
@@ -366,6 +422,10 @@ ccdx models
|
|
|
366
422
|
|
|
367
423
|
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.
|
|
368
424
|
|
|
425
|
+
Concurrent identical live lookups share only the active request. Caller
|
|
426
|
+
cancellation is independent; results are not retained as a fresh catalog after
|
|
427
|
+
completion. The dashboard cancels its waiter when the read is abandoned.
|
|
428
|
+
|
|
369
429
|
Interactive terminals use aligned tables for `models`, `auth status`, and `usage`. Redirected or piped output retains the plain-text layout for scripts; use `--format table` or `--format plain` when a command offers an explicit format override.
|
|
370
430
|
|
|
371
431
|
`ccdx usage` and the dashboard Model Usage table show token cache hit rate for each model and the aggregate: recorded cached input tokens divided by recorded input tokens, weighted by token count rather than averaging request percentages. This describes the upstream prompt cache; the local history and image-transform caches are separate. Incomplete historical records do not hide a computable ratio: `~` marks a rate derived from incomplete counts. A rate is `—` when input tokens are zero, usable totals are missing, or token counts are invalid. Older logs may omit explicit zero cache counts; new Responses usage records retain reported zeros. CLI tables keep existing token columns on narrow terminals and show rates below the table when the extra column does not fit.
|
|
@@ -504,7 +564,7 @@ Versions through `0.9.30` can fail with `spawn EINVAL` before the Windows
|
|
|
504
564
|
installer starts. To bootstrap this fix, run the installer directly:
|
|
505
565
|
|
|
506
566
|
```powershell
|
|
507
|
-
npm.cmd install -g --allow-git=all 'github:DaleXiao/codex-copilot-dx#v0.9.
|
|
567
|
+
npm.cmd install -g --allow-git=all 'github:DaleXiao/codex-copilot-dx#v0.9.33'
|
|
508
568
|
ccdx.cmd version
|
|
509
569
|
```
|
|
510
570
|
|
|
@@ -643,6 +703,15 @@ The status endpoint is restricted to the socket's real loopback address even whe
|
|
|
643
703
|
|
|
644
704
|
`stream_performance.recent_requests` retains at most 20 finished Responses/compact requests. Each entry contains a CCDX-owned request ID, start timestamp, bounded model/route labels, HTTP status, final model outcome, known error origin, last observed phase and provider-call count. `timings_ms` includes cumulative preparation durations and offsets from adapter entry for the first upstream dispatch, latest upstream headers, first output, latest observed upstream activity, terminal and finish. Null means not observed, not zero. Stage durations can overlap and should not be added into a total. Provider-call counts include compatibility attempts but exclude OAuth exchanges and low-level connection retries. Streams update a single activity timestamp per read; no content, headers, opaque state or unbounded event list is retained. Entries are process-local and reset on restart; normal status refresh reads them without new upstream calls or background polling.
|
|
645
705
|
|
|
706
|
+
`http_errors` separately counts HTTP failures on tracked API routes and retains
|
|
707
|
+
the latest 20. Entries contain HTTP status, technical code when safe, observed
|
|
708
|
+
model, route/source and request IDs; the message is a fixed local explanation.
|
|
709
|
+
They never retain the original body, prompt, URL query or headers. Original
|
|
710
|
+
errors are still returned unchanged. Management/dashboard reads are excluded.
|
|
711
|
+
The recent-error panel merges these entries with model failures and request
|
|
712
|
+
timelines, retaining at most ten visible items. HTTP counts do not change model
|
|
713
|
+
terminal counts; unknown sources/models remain unknown.
|
|
714
|
+
|
|
646
715
|
Every API response includes a safe `X-Request-Id` for correlation. To include the same ID in related terminal and file log lines, start with:
|
|
647
716
|
|
|
648
717
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-copilot-dx",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.34",
|
|
4
4
|
"description": "Use Codex App with GitHub Copilot",
|
|
5
5
|
"author": "Dale Xiao",
|
|
6
6
|
"type": "module",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"scripts": {
|
|
42
42
|
"test": "node --test",
|
|
43
43
|
"test:smoke": "node scripts/offline-smoke.mjs && node scripts/sse-idle-replay.mjs",
|
|
44
|
+
"test:package": "node scripts/package-lifecycle-smoke.mjs",
|
|
44
45
|
"test:e2e": "bash test/e2e.sh",
|
|
45
46
|
"bench": "node scripts/benchmark.mjs",
|
|
46
47
|
"bench:payload": "node scripts/benchmark.mjs --large-payload",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"prepublishOnly": "npm run verify"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
|
-
"sharp": "
|
|
54
|
+
"sharp": "0.35.3",
|
|
54
55
|
"smol-toml": "1.8.0"
|
|
55
56
|
}
|
|
56
57
|
}
|
package/src/adapter.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { createTerminalActivityIndicator } from "./terminal-activity.mjs";
|
|
|
15
15
|
import { ADAPTER_HEALTH_PATH, adapterHealthPayload } from "./running-adapter.mjs";
|
|
16
16
|
import { createResponsesCompactHandler, createResponsesHandler } from "./responses-handler.mjs";
|
|
17
17
|
import { createResponsesImagePressureController } from "./responses-image-pressure.mjs";
|
|
18
|
-
import { createResponseFailureDiagnostics } from "./response-failures.mjs";
|
|
18
|
+
import { createResponseFailureDiagnostics, buildHttpFailureDetails } from "./response-failures.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ADAPTER_CACHE_PATH,
|
|
21
21
|
cacheRuntimeSnapshot,
|
|
@@ -63,7 +63,7 @@ export {
|
|
|
63
63
|
} from "./responses-request.mjs";
|
|
64
64
|
|
|
65
65
|
const ADAPTER_RUNTIME_CONFIG = loadRuntimeConfig();
|
|
66
|
-
const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/ui.js"]);
|
|
66
|
+
const DASHBOARD_PATHS = new Set(["/", "/ui.css", "/theme.js", "/language.js", "/refresh.js", "/status.js", "/usage.js", "/ui.js"]);
|
|
67
67
|
const DASHBOARD_API_PATHS = new Set(["/_ccdx/ui/animation", "/_ccdx/ui/models/live", "/_ccdx/ui/usage", "/_ccdx/ui/auth"]);
|
|
68
68
|
|
|
69
69
|
export function requestPath(reqUrl) {
|
|
@@ -170,6 +170,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
170
170
|
const streamPerformanceMetrics = options.streamPerformanceMetrics || createStreamPerformanceMetrics();
|
|
171
171
|
const imagePressure = options.imagePressure || createResponsesImagePressureController();
|
|
172
172
|
const responseFailures = options.responseFailures || createResponseFailureDiagnostics();
|
|
173
|
+
const httpErrors = createResponseFailureDiagnostics({ maxEntries: 20 });
|
|
173
174
|
let imageMcpHandler = options.imageMcpHandler || null;
|
|
174
175
|
const responsesHandler = createResponsesHandler({
|
|
175
176
|
acquireRequest,
|
|
@@ -225,7 +226,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
225
226
|
return;
|
|
226
227
|
}
|
|
227
228
|
res.writeHead(200, { "Content-Type": "application/json", "Cache-Control": "no-store" });
|
|
228
|
-
res.end(JSON.stringify(runtimeStatusPayload({
|
|
229
|
+
res.end(JSON.stringify({ ...runtimeStatusPayload({
|
|
229
230
|
metrics: requestMetrics,
|
|
230
231
|
streamPerformance: streamPerformanceMetrics,
|
|
231
232
|
admission: acquireRequest,
|
|
@@ -237,7 +238,7 @@ export function createAdapterHandler(options = {}) {
|
|
|
237
238
|
codexModelRegistry,
|
|
238
239
|
codexModelCatalog,
|
|
239
240
|
clientIntegrations: options.clientIntegrationSnapshot?.(),
|
|
240
|
-
})));
|
|
241
|
+
}), http_errors: httpErrors.snapshot() }));
|
|
241
242
|
return;
|
|
242
243
|
}
|
|
243
244
|
|
|
@@ -402,9 +403,13 @@ export function createAdapterHandler(options = {}) {
|
|
|
402
403
|
} catch {}
|
|
403
404
|
}
|
|
404
405
|
let requestFinished = false;
|
|
406
|
+
let httpEvidence = {}, context;
|
|
405
407
|
const finishRequest = ({ statusCode = 0, aborted = false } = {}) => {
|
|
406
408
|
if (requestFinished) return;
|
|
407
409
|
requestFinished = true;
|
|
410
|
+
if (trackRequest && statusCode >= 400) {
|
|
411
|
+
try { httpErrors.record(buildHttpFailureDetails({ ...httpEvidence, statusCode, route: routeName, requestId, model: context?.model })); } catch {}
|
|
412
|
+
}
|
|
408
413
|
try { complete({ statusCode, aborted }); } catch {}
|
|
409
414
|
try { streamPerformance?.finish({ failed: aborted || statusCode >= 400, aborted, statusCode }); } catch {}
|
|
410
415
|
try { finishTerminalActivity(); } catch {}
|
|
@@ -436,12 +441,14 @@ export function createAdapterHandler(options = {}) {
|
|
|
436
441
|
}
|
|
437
442
|
|
|
438
443
|
try {
|
|
439
|
-
|
|
444
|
+
context = {
|
|
440
445
|
requestId,
|
|
441
446
|
pathname,
|
|
442
447
|
showRequestId: options.showRequestId === true,
|
|
443
448
|
streamPerformance,
|
|
444
|
-
|
|
449
|
+
onHttpError: evidence => { httpEvidence = evidence; },
|
|
450
|
+
};
|
|
451
|
+
const result = runWithRequestContext(context, () => dispatchRequest(req, res, pathname));
|
|
445
452
|
if (result && typeof result.then === "function") {
|
|
446
453
|
return result.catch((error) => {
|
|
447
454
|
containUnexpectedError(error);
|
|
@@ -492,7 +499,7 @@ export function startAdapter(port = 2026, host = "127.0.0.1", options = {}) {
|
|
|
492
499
|
server.listen(port, host, () => {
|
|
493
500
|
server.off("error", onListenError);
|
|
494
501
|
const actualPort = server.address()?.port || port;
|
|
495
|
-
console.log(status("ok", `Adapter listening on http://${host}:${actualPort}`));
|
|
502
|
+
(options.log || console.log)(status("ok", `Adapter listening on http://${host}:${actualPort}`));
|
|
496
503
|
resolve(server);
|
|
497
504
|
});
|
|
498
505
|
});
|