codex-copilot-dx 0.9.29 → 0.9.31
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 +2 -2
- package/docs/ARCHITECTURE.md +14 -2
- package/docs/README.md +2 -0
- package/docs/REFERENCE.md +46 -7
- package/package.json +1 -1
- package/src/cli-options.mjs +2 -2
- package/src/launcher.mjs +51 -3
- package/src/native-prediction.mjs +12 -6
- package/src/package-update.mjs +9 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ ccdx
|
|
|
19
19
|
CCDX reuses a compatible local credential or starts GitHub Device Flow, listens
|
|
20
20
|
on `127.0.0.1:2026`, configures Codex, and opens the App. No client binary patch
|
|
21
21
|
is needed. On Windows, open the App manually unless native prediction setup is
|
|
22
|
-
enabled. The configured `dummy` API key is a placeholder, not a credential.
|
|
22
|
+
enabled. If PowerShell blocks scripts, use `npm.cmd` / `ccdx.cmd`; do not change company policy. The configured `dummy` API key is a placeholder, not a credential.
|
|
23
23
|
|
|
24
24
|
Open [the local dashboard](http://127.0.0.1:2026/) for status, model discovery,
|
|
25
25
|
usage, cache/limits, recent failures, request context and animation settings.
|
|
@@ -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
|
@@ -18,6 +18,13 @@ The CLI composes the service. Client integration owns its `configure`, `start`,
|
|
|
18
18
|
render the dashboard. The adapter exposes integration snapshots and keeps
|
|
19
19
|
management/MCP routes separate from the Responses path.
|
|
20
20
|
|
|
21
|
+
Package installation is an explicit management operation in `package-update.mjs`,
|
|
22
|
+
not part of inference or optional client integration. Windows uses the system
|
|
23
|
+
command interpreter only for the fixed `npm.cmd` installer command; stable-tag
|
|
24
|
+
validation remains upstream of launch. macOS/Linux use direct npm argv. There
|
|
25
|
+
is no generic shell runner or package-manager framework, and npm's configured
|
|
26
|
+
registry/proxy environment remains owned by the user.
|
|
27
|
+
|
|
21
28
|
Native prediction has a separate loopback transport and an isolated HTTPS agent.
|
|
22
29
|
Only its two selected hosts use the App-specific route. Non-configuration requests
|
|
23
30
|
on those hosts are forwarded unchanged. The bridge does not replace Copilot or
|
|
@@ -42,8 +49,13 @@ TLS trust. Its private, credit-based pipes stream data without transcript files.
|
|
|
42
49
|
The App PAC delegates unrelated URLs to the company script; Node never executes
|
|
43
50
|
that script. This worker is not a shared inference/image network backend and is
|
|
44
51
|
not started for disabled predictions or static/direct configurations.
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
Bridge-port ownership is shared across macOS and Windows in the existing
|
|
53
|
+
prediction lifecycle, with locked first-start persistence and no replacement
|
|
54
|
+
on conflict. OS process inspection stays in the launcher/platform boundary;
|
|
55
|
+
it runs only for explicit prediction-enabled launch/reuse, not per model request.
|
|
56
|
+
macOS uses bounded system `ps` reads and Windows retains its existing registered
|
|
57
|
+
process checks. No process is stopped, no permanent watcher or dependency is
|
|
58
|
+
added. Core inference keeps its existing service port and lifecycle.
|
|
47
59
|
|
|
48
60
|
Connection-ownership replay rejection is a provider-owned retry policy. It
|
|
49
61
|
removes only unavailable reasoning once, preserving visible history and tools.
|
package/docs/README.md
CHANGED
|
@@ -17,6 +17,8 @@ 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.31: verified Windows package-update process launch](RELEASE_0.9.31.md)
|
|
21
|
+
- [0.9.30: persistent prediction routes and verified macOS launch](RELEASE_0.9.30.md)
|
|
20
22
|
- [0.9.29: visible-page refresh, atom favicon and safe reasoning declarations](RELEASE_0.9.29.md)
|
|
21
23
|
- [0.9.28: verified local plaintext recovery and validation boundaries](RELEASE_0.9.28.md)
|
|
22
24
|
- [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
|
|
@@ -475,6 +491,29 @@ ccdx update npm
|
|
|
475
491
|
ccdx update github
|
|
476
492
|
```
|
|
477
493
|
|
|
494
|
+
In Windows PowerShell, use `ccdx.cmd update github` (or `ccdx.cmd update npm`)
|
|
495
|
+
when script policy blocks npm's `.ps1` shim. Since `0.9.31`, the updater runs
|
|
496
|
+
`npm.cmd` through the system `cmd.exe`, with AutoRun and delayed expansion
|
|
497
|
+
disabled, fixed installer arguments and a validated stable release tag.
|
|
498
|
+
It does not enable Node's generic `shell` option, change PowerShell policy,
|
|
499
|
+
rewrite npm configuration or add an external dependency. The caller's PATH,
|
|
500
|
+
registry, proxy, prefix/cache settings and terminal streams are preserved.
|
|
501
|
+
macOS/Linux retain direct `npm` execution and separate argument arrays.
|
|
502
|
+
|
|
503
|
+
Versions through `0.9.30` can fail with `spawn EINVAL` before the Windows
|
|
504
|
+
installer starts. To bootstrap this fix, run the installer directly:
|
|
505
|
+
|
|
506
|
+
```powershell
|
|
507
|
+
npm.cmd install -g --allow-git=all 'github:DaleXiao/codex-copilot-dx#v0.9.31'
|
|
508
|
+
ccdx.cmd version
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
This GitHub installation still requires Git on PATH. Stop/restart the running
|
|
512
|
+
adapter after installation; installation alone does not update a running process.
|
|
513
|
+
Installer errors and nonzero exits fail the update without a success message or
|
|
514
|
+
automatic retry. Missing Git, blocked dependency downloads or npm cache-only
|
|
515
|
+
settings remain npm/environment errors, not fixed by changing the launcher.
|
|
516
|
+
|
|
478
517
|
Normal startup checks the official GitHub `releases/latest` web endpoint once in
|
|
479
518
|
the background, without accessing the npm registry or REST API. The anonymous
|
|
480
519
|
check requires no PAT or Copilot credentials, has a two-second deadline, validates
|
package/package.json
CHANGED
package/src/cli-options.mjs
CHANGED
|
@@ -372,8 +372,8 @@ 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
|
|
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.`,
|
|
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
|
+
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. Windows uses system cmd.exe to run npm.cmd without changing PowerShell policy; use the .cmd entrypoint if scripts are blocked. GitHub installs require Git on PATH and dependencies may still use the configured npm registry. Restart the running adapter after installation.`,
|
|
377
377
|
version: `Usage:\n ${name} --version`,
|
|
378
378
|
};
|
|
379
379
|
return sections[topic];
|
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 } : {}),
|
package/src/package-update.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { createInterface } from "node:readline/promises";
|
|
3
4
|
import { lookupLatestRelease, githubReleaseVersion } from "./version.mjs";
|
|
4
5
|
|
|
@@ -100,10 +101,17 @@ export async function runPackageUpdateCommand({
|
|
|
100
101
|
const update = globalUpdateCommand(selectedSource, { platform, releaseTag: release?.tagName });
|
|
101
102
|
const sourceLabel = selectedSource === "npm" ? "npm registry" : `GitHub release ${release.tagName}`;
|
|
102
103
|
output.write(`Updating ${PACKAGE_NAME} from ${sourceLabel}...\n`);
|
|
103
|
-
const
|
|
104
|
+
const windows = platform === "win32";
|
|
105
|
+
// npm.cmd needs cmd.exe. Only fixed install arguments and a validated stable
|
|
106
|
+
// release tag enter this command line; no user-supplied command is evaluated.
|
|
107
|
+
const command = windows
|
|
108
|
+
? path.win32.join(env.SystemRoot || env.WINDIR || "C:\\Windows", "System32", "cmd.exe") : update.command;
|
|
109
|
+
const args = windows ? ["/d", "/s", "/v:off", "/c", `"${[update.command, ...update.args].join(" ")}"`] : update.args;
|
|
110
|
+
const child = spawnImpl(command, args, {
|
|
104
111
|
env,
|
|
105
112
|
shell: false,
|
|
106
113
|
stdio: "inherit",
|
|
114
|
+
...(windows ? { windowsVerbatimArguments: true, windowsHide: true } : {}),
|
|
107
115
|
});
|
|
108
116
|
await waitForExit(child);
|
|
109
117
|
output.write(`Updated ${PACKAGE_NAME} from ${sourceLabel}. Restart the running adapter to use the new version.\n`);
|