codex-copilot-dx 0.9.29 → 0.9.30
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 +1 -1
- package/docs/ARCHITECTURE.md +7 -2
- package/docs/README.md +1 -0
- package/docs/REFERENCE.md +23 -7
- package/package.json +1 -1
- package/src/cli-options.mjs +1 -1
- package/src/launcher.mjs +51 -3
- package/src/native-prediction.mjs +12 -6
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Auto refresh runs every 30 minutes while visible and can be switched off. Hidden
|
|
|
56
56
|
Codex, run `ccdx doctor`; fully quit the App (**Command-Q** on macOS) before reopening.
|
|
57
57
|
CCDX does not claim it can verify the App's internal model cache externally.
|
|
58
58
|
- After a package upgrade, restart the running CCDX adapter. Choosing a model or
|
|
59
|
-
effort on a current adapter takes effect on its next Auto-review request.
|
|
59
|
+
effort on a current adapter takes effect on its next Auto-review request. Native prediction ports persist on macOS/Windows; an older random route may need one full App quit. A busy saved port disables only predictions.
|
|
60
60
|
- `0.9.28` adds verified local plaintext recovery after connection-owned compaction rejection; see the reference for strict source and safety limits. Request-body bytes, local-history bytes and the model's token window are
|
|
61
61
|
different limits. Request-context figures are observed metadata, not exact
|
|
62
62
|
live session occupancy. Prompts and images are not retained by that panel.
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -42,8 +42,13 @@ TLS trust. Its private, credit-based pipes stream data without transcript files.
|
|
|
42
42
|
The App PAC delegates unrelated URLs to the company script; Node never executes
|
|
43
43
|
that script. This worker is not a shared inference/image network backend and is
|
|
44
44
|
not started for disabled predictions or static/direct configurations.
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
Bridge-port ownership is shared across macOS and Windows in the existing
|
|
46
|
+
prediction lifecycle, with locked first-start persistence and no replacement
|
|
47
|
+
on conflict. OS process inspection stays in the launcher/platform boundary;
|
|
48
|
+
it runs only for explicit prediction-enabled launch/reuse, not per model request.
|
|
49
|
+
macOS uses bounded system `ps` reads and Windows retains its existing registered
|
|
50
|
+
process checks. No process is stopped, no permanent watcher or dependency is
|
|
51
|
+
added. Core inference keeps its existing service port and lifecycle.
|
|
47
52
|
|
|
48
53
|
Connection-ownership replay rejection is a provider-owned retry policy. It
|
|
49
54
|
removes only unavailable reasoning once, preserving visible history and tools.
|
package/docs/README.md
CHANGED
|
@@ -17,6 +17,7 @@ These reports record a specific release and test environment. Their version,
|
|
|
17
17
|
test counts, timings, live-provider observations, and limitations remain
|
|
18
18
|
historical facts rather than current guarantees.
|
|
19
19
|
|
|
20
|
+
- [0.9.30: persistent prediction routes and verified macOS launch](RELEASE_0.9.30.md)
|
|
20
21
|
- [0.9.29: visible-page refresh, atom favicon and safe reasoning declarations](RELEASE_0.9.29.md)
|
|
21
22
|
- [0.9.28: verified local plaintext recovery and validation boundaries](RELEASE_0.9.28.md)
|
|
22
23
|
- [0.9.27: Windows certificate setup without Git/OpenSSL](RELEASE_0.9.27.md)
|
package/docs/REFERENCE.md
CHANGED
|
@@ -82,15 +82,29 @@ profile override is preserved and the optional launch is skipped. There is no
|
|
|
82
82
|
shell, account replacement, new profile, `CODEX_HOME` change or forced App exit. Disabled predictions
|
|
83
83
|
add no Windows probe or launch. `CCDX_AUTO_LAUNCH=0` is still respected.
|
|
84
84
|
|
|
85
|
-
Windows
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
Since `0.9.30`, macOS and Windows remember their own loopback bridge port after
|
|
86
|
+
the first successful bridge start and reuse it across service restarts and
|
|
87
|
+
package updates. Windows already used this policy in `0.9.26`. Each user setup
|
|
88
|
+
gets its own port, not a shared fixed port. A busy saved port is not stolen or
|
|
89
|
+
silently replaced; only the optional prediction bridge becomes unavailable,
|
|
90
|
+
and core inference and enabled image tools can still start. Port settings are
|
|
91
|
+
committed under the existing file lock; a concurrent preference change aborts
|
|
92
|
+
and closes the uncommitted bridge. Restarting with a saved port does not rewrite
|
|
93
|
+
the preference or rotate certificates. Before launch, CCDX checks only verified App main-process route
|
|
88
94
|
metadata. A running App with an old/unreadable PAC receives an explicit quit and
|
|
89
95
|
relaunch instruction; it is not killed or reported as newly connected. The first
|
|
90
|
-
upgrade from an ephemeral-port
|
|
96
|
+
upgrade from an ephemeral-port version may require one full App quit. Successful
|
|
91
97
|
process creation is not proof of configuration traffic. A bounded post-launch
|
|
92
98
|
main-process check verifies retained PAC arguments; adapter readiness is reported
|
|
93
|
-
separately from App route readiness.
|
|
99
|
+
separately from App route readiness. macOS reads exact App main-process metadata
|
|
100
|
+
using the system `ps`, never prints complete process arguments, and polls only
|
|
101
|
+
for a bounded interval after a new launch, not while ordinary inference runs.
|
|
102
|
+
Matching running Apps are reused without relaunch. Unreadable or mismatched
|
|
103
|
+
routes get a warning, never a forced exit or an unverified success message.
|
|
104
|
+
The stable address prevents port-change failures; it does not replay interrupted
|
|
105
|
+
requests, clear App configuration caches or guarantee immediate gray suggestions
|
|
106
|
+
after every restart. Network-policy changes and App compatibility checks still
|
|
107
|
+
have the separate restart/setup requirements described below.
|
|
94
108
|
|
|
95
109
|
```bash
|
|
96
110
|
# Fully quit Codex App first.
|
|
@@ -162,8 +176,10 @@ trust removal is deferred; quit it and run `prediction off` again. Only the exac
|
|
|
162
176
|
owned certificate record is removed, never the whole store. Failed activation
|
|
163
177
|
rolls back newly added trust; certificate replacement keeps old trust until the
|
|
164
178
|
new preference is committed. If the bridge stops, new connections can fall back
|
|
165
|
-
to the original route; already-interrupted requests are not replayed.
|
|
166
|
-
|
|
179
|
+
to the original route; already-interrupted requests are not replayed. An App
|
|
180
|
+
already using the saved address need not be relaunched just because CCDX restarts.
|
|
181
|
+
If its route is missing or differs, fully quit Codex and run `ccdx` to attach it.
|
|
182
|
+
`CCDX_AUTO_LAUNCH=0` keeps
|
|
167
183
|
automatic launch disabled and does not attach the route to a manually opened App.
|
|
168
184
|
Optional prediction failures never prevent the core adapter or image service from
|
|
169
185
|
starting. `prediction status` reports the saved preference and, when a compatible
|
package/package.json
CHANGED
package/src/cli-options.mjs
CHANGED
|
@@ -372,7 +372,7 @@ function topicHelp(name, topic) {
|
|
|
372
372
|
"image-status": `Usage:\n ${name} image-status\n\nShows provider configuration and locally advertised generation/editing tools without generating an image or exposing its API key.`,
|
|
373
373
|
"auto-review-model": `Usage:\n ${name} auto-review-model\n\nSelect a Responses model, then an advertised reasoning effort. Enter keeps the default/current choice; q cancels both steps without saving. Effort 0 follows the client (low when omitted). Settings apply only to Auto-review on the next request; no client patch or restart is required for adapters running 0.9.13 or newer.`,
|
|
374
374
|
"suggestion": `The CCDX prediction panel has been retired. Run ${name} suggestion off to safely remove unchanged CCDX registrations. This cleanup does not change native predictions; see ${name} prediction --help for that separate opt-in feature.`,
|
|
375
|
-
prediction: `Usage:\n ${name} prediction [status|on|off]\n\nOptional native next-message predictions; off by default. macOS and Windows
|
|
375
|
+
prediction: `Usage:\n ${name} prediction [status|on|off]\n\nOptional native next-message predictions; off by default. macOS and Windows. Windows requires the registered official MSIX App, an initialized profile, Windows PowerShell and .NET Framework 4.7.2+; Git/OpenSSL is not required for prediction setup. Quit Codex before on/off, then restart ccdx. On adds private App-profile certificate trust and an App-only route for chatgpt.com and ab.chatgpt.com. HTTPS on those hosts is decrypted locally; only prediction configuration is changed. No client program files, OS trust, account permissions, MCP or Hooks are changed. Static HTTP/HTTPS/SOCKS5 proxies and bypass rules are preserved. Windows supports company PAC/WPAD; macOS dynamic PAC/WPAD and CIDR bypass rules are reported as unsupported. The bridge port persists across restarts/updates; a busy saved port disables only predictions. Launch/reuse checks the App's actual route; an older random or missing route may require one full App quit. Official prediction configuration is preserved; the conversation's model is used. App updates require another compatibility check. Status distinguishes saved preference and observed config traffic from unverified candidate visibility.`,
|
|
376
376
|
update: `Usage:\n ${name} update [npm|github]\n\nUpdates the global package from the configured npm registry or the latest stable GitHub release. With no source, an interactive terminal prompts for one.`,
|
|
377
377
|
version: `Usage:\n ${name} --version`,
|
|
378
378
|
};
|
package/src/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { spawn, execFileSync } from "node:child_process";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { installedWindowsPredictionApp, windowsPredictionAppProcesses } from "./native-prediction-windows.mjs";
|
|
@@ -39,8 +39,30 @@ export function launchAttempts() {
|
|
|
39
39
|
return [["-b", CODEX_BUNDLE_ID], ...APP_PATH_CANDIDATES.map((path) => [path])];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
export function macPredictionAppProcesses(app, { exec = execFileSync } = {}) {
|
|
43
|
+
if (!APP_PATH_CANDIDATES.includes(app)) throw new Error("Unknown macOS prediction App");
|
|
44
|
+
const options = { encoding: "utf8", timeout: 2000, maxBuffer: 1024 * 1024 };
|
|
45
|
+
const listing = exec("/bin/ps", ["-axo", "pid=,comm="], options);
|
|
46
|
+
const rows = [];
|
|
47
|
+
for (const line of listing.split("\n")) {
|
|
48
|
+
const match = line.match(/^\s*(\d+)\s+(.+?)\s*$/);
|
|
49
|
+
if (!match || ![`${app}/Contents/MacOS/ChatGPT`, `${app}/Contents/MacOS/Codex`].includes(match[2])) continue;
|
|
50
|
+
const pid = Number(match[1]);
|
|
51
|
+
try {
|
|
52
|
+
const args = exec("/bin/ps", ["-p", String(pid), "-o", "args="], options);
|
|
53
|
+
const route = args.match(/(?:^|\s)--proxy-pac-url=(?:"(http:\/\/127\.0\.0\.1:\d{1,5}\/proxy\.pac)"|(http:\/\/127\.0\.0\.1:\d{1,5}\/proxy\.pac)(?=\s|$))/);
|
|
54
|
+
const readable = args.trim() === match[2] || args.trimStart().startsWith(`${match[2]} `);
|
|
55
|
+
const uniqueRoute = (args.match(/(?:^|\s)--proxy-pac-url=/g) || []).length === 1;
|
|
56
|
+
rows.push({ pid, readable, route: readable && uniqueRoute ? route?.[1] || route?.[2] || null : null });
|
|
57
|
+
} catch { rows.push({ pid, readable: false, route: null }); }
|
|
58
|
+
if (rows.length === 2) break;
|
|
59
|
+
}
|
|
60
|
+
return rows;
|
|
61
|
+
}
|
|
62
|
+
|
|
42
63
|
export async function openCodex({ env = process.env, spawnImpl = spawn, platform = process.platform, predictionPacUrl = null, predictionApp = null, predictionProfile = null,
|
|
43
|
-
resolveWindowsApp = installedWindowsPredictionApp, windowsAppProcesses = windowsPredictionAppProcesses
|
|
64
|
+
resolveWindowsApp = installedWindowsPredictionApp, windowsAppProcesses = windowsPredictionAppProcesses,
|
|
65
|
+
macAppProcesses = macPredictionAppProcesses } = {}) {
|
|
44
66
|
if (platform === "win32" && autoLaunchEnabled(env) && typeof predictionPacUrl === "string"
|
|
45
67
|
&& /^http:\/\/127\.0\.0\.1:\d{1,5}\/proxy\.pac$/.test(predictionPacUrl)
|
|
46
68
|
&& typeof predictionApp === "string" && path.win32.isAbsolute(predictionApp)) {
|
|
@@ -99,7 +121,33 @@ export async function openCodex({ env = process.env, spawnImpl = spawn, platform
|
|
|
99
121
|
const extraArgs = typeof predictionPacUrl === "string" && /^http:\/\/127\.0\.0\.1:\d{1,5}\/proxy\.pac$/.test(predictionPacUrl)
|
|
100
122
|
&& APP_PATH_CANDIDATES.includes(predictionApp)
|
|
101
123
|
? ["--args", `--proxy-pac-url=${predictionPacUrl}`] : [];
|
|
102
|
-
|
|
124
|
+
if (extraArgs.length) {
|
|
125
|
+
try {
|
|
126
|
+
const running = macAppProcesses(predictionApp);
|
|
127
|
+
if (running.length) {
|
|
128
|
+
if (running.length === 1 && running[0].readable && running[0].route === predictionPacUrl) {
|
|
129
|
+
console.log(status("ok", "Running Codex App uses the current prediction route"));return true;
|
|
130
|
+
}
|
|
131
|
+
throw new Error("Running Codex App uses an old or unverified prediction route. Fully quit the App, then run ccdx again; no process was stopped");
|
|
132
|
+
}
|
|
133
|
+
if (!await tryOpen([predictionApp, ...extraArgs], { spawnImpl })) {
|
|
134
|
+
console.log(status("warn", "Could not launch the verified macOS Codex App"));return false;
|
|
135
|
+
}
|
|
136
|
+
for (let attempt = 0; attempt < 10; attempt++) {
|
|
137
|
+
const actual = macAppProcesses(predictionApp);
|
|
138
|
+
if (actual.length === 1 && actual[0].readable && actual[0].route === predictionPacUrl) {
|
|
139
|
+
console.log(status("info", "Codex launch route verified; prediction status will show when configuration traffic is observed"));return true;
|
|
140
|
+
}
|
|
141
|
+
if (actual.length) break;
|
|
142
|
+
if (attempt < 9) await new Promise(resolve => setTimeout(resolve, 100));
|
|
143
|
+
}
|
|
144
|
+
console.log(status("warn", "Codex launch requested, but the active App did not retain the current prediction route. Core adapter remains available"));
|
|
145
|
+
return false;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
console.log(status("warn", `Optional macOS prediction launch skipped: ${error.message}`));return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const attempts = launchAttempts();
|
|
103
151
|
for (const attempt of attempts) {
|
|
104
152
|
const args = [...attempt, ...extraArgs];
|
|
105
153
|
if (await tryOpen(args, { spawnImpl })) {
|
|
@@ -146,9 +146,9 @@ export async function startNativePrediction({ env = process.env, platform = proc
|
|
|
146
146
|
if (!["darwin", "win32"].includes(platform)) throw new Error("Native predictions were skipped: unsupported platform");
|
|
147
147
|
const network = predictionNetworkOptions(opts);
|
|
148
148
|
let networkRoute = network.networkRoute;
|
|
149
|
-
if (
|
|
149
|
+
if (settings.bridgePort !== undefined
|
|
150
150
|
&& (!Number.isInteger(settings.bridgePort) || settings.bridgePort < 1024 || settings.bridgePort > 65535)) {
|
|
151
|
-
throw new Error("Saved
|
|
151
|
+
throw new Error("Saved prediction bridge port is invalid; no route was replaced");
|
|
152
152
|
}
|
|
153
153
|
if (!predictionAppMatches(settings.app)) throw new Error("Codex App changed; run ccdx prediction on after quitting it to recheck compatibility");
|
|
154
154
|
const paths = predictionPaths({ ...opts, app: settings.app });
|
|
@@ -183,7 +183,7 @@ export async function startNativePrediction({ env = process.env, platform = proc
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
transport = await startPredictionTransport({ ...certificate, enabled: () => enabled,
|
|
186
|
-
listenPort:
|
|
186
|
+
listenPort: settings.bridgePort || 0,
|
|
187
187
|
networkRoute, agent: networkRoute?.https ? createProxyAgent(networkRoute) : undefined,
|
|
188
188
|
...(windowsNetwork ? { requestImpl: windowsNetwork.requestImpl, pacImpl: windowsNetwork.pac } : {}),
|
|
189
189
|
onEvent: (event) => state?.event(event),
|
|
@@ -196,7 +196,7 @@ export async function startNativePrediction({ env = process.env, platform = proc
|
|
|
196
196
|
return result.changed ? JSON.parse(result.body) : parsed;
|
|
197
197
|
},
|
|
198
198
|
});
|
|
199
|
-
if (
|
|
199
|
+
if (settings.bridgePort === undefined) {
|
|
200
200
|
await withFileLock(`${paths.settings}.lock`, () => {
|
|
201
201
|
const current = readPredictionSettings(opts);
|
|
202
202
|
if (!current.enabled || current.certificateHash !== settings.certificateHash || current.store !== settings.store
|
|
@@ -206,10 +206,16 @@ export async function startNativePrediction({ env = process.env, platform = proc
|
|
|
206
206
|
writePredictionSettings({ ...current, bridgePort: transport.port }, opts);
|
|
207
207
|
}, { timeoutMs: 2000 });
|
|
208
208
|
}
|
|
209
|
-
} catch (error) {
|
|
209
|
+
} catch (error) {
|
|
210
|
+
clearInterval(timer);await transport?.close();windowsNetwork?.close();
|
|
211
|
+
if (error.code === "EADDRINUSE" && settings.bridgePort !== undefined) {
|
|
212
|
+
error.message = `Saved prediction port ${settings.bridgePort} is already in use; it was not replaced. Native predictions are unavailable; the core adapter remains available`;
|
|
213
|
+
}
|
|
214
|
+
throw error;
|
|
215
|
+
}
|
|
210
216
|
state?.running(windowsNetwork ? { source: "system", type: "auto", bypass_rules: null, proxy_credentials: false } : networkRouteSnapshot(networkRoute));
|
|
211
217
|
warning("Native prediction bridge enabled; only the two configuration hosts use its App-only route.");
|
|
212
|
-
warning("If Codex
|
|
218
|
+
warning("If Codex uses a different or missing prediction route, fully quit it and run ccdx again.");
|
|
213
219
|
return {
|
|
214
220
|
app: settings.app.app,
|
|
215
221
|
...(platform === "win32" ? { profile: paths.profile } : {}),
|