codex-copilot-dx 0.9.26 → 0.9.27
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 +10 -2
- package/docs/README.md +1 -0
- package/docs/REFERENCE.md +11 -2
- package/package.json +1 -1
- package/src/native-prediction-profile.mjs +10 -2
- package/src/native-prediction-windows.mjs +0 -12
- package/src/windows-prediction-certificate.cs +60 -0
- package/src/windows-prediction-certificate.mjs +33 -0
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ The dashboard does not poll in the background; refresh when needed.
|
|
|
74
74
|
hosts is decrypted locally, but only prediction configuration is changed.
|
|
75
75
|
Other domains and the CCDX model endpoint stay on their existing routes.
|
|
76
76
|
No program files or OS trust are changed. Static HTTP/HTTPS/SOCKS5 proxies and bypass rules are retained.
|
|
77
|
-
Windows supports company PAC/WPAD
|
|
77
|
+
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.
|
|
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.
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -24,10 +24,18 @@ on those hosts are forwarded unchanged. The bridge does not replace Copilot or
|
|
|
24
24
|
image-provider networking, modify client program files, or install system trust.
|
|
25
25
|
Static upstream proxy routes and bypass rules are preserved. macOS dynamic
|
|
26
26
|
PAC/WPAD and static CIDR bypass rules are reported as unsupported, not discarded.
|
|
27
|
-
The Windows adapter isolates registration, process, proxy
|
|
27
|
+
The Windows adapter isolates registration, process, proxy and NTFS
|
|
28
28
|
interfaces in `native-prediction-windows.mjs`. The bridge, overlay, model selection
|
|
29
29
|
and lifecycle remain shared. Windows discovery requires verified registration
|
|
30
30
|
and an existing unambiguous profile; no generalized OS framework is introduced.
|
|
31
|
+
Windows certificate issuance is a separate one-shot helper
|
|
32
|
+
(`windows-prediction-certificate.mjs` / `.cs`), not part of the network worker.
|
|
33
|
+
Node generates RSA keys and sends them through stdin to the system .NET
|
|
34
|
+
`CertificateRequest` API; only public certificates return through stdout.
|
|
35
|
+
The existing PEM reader, App-profile trust schema and transactional activation
|
|
36
|
+
remain shared. Issuance requires neither external OpenSSL nor a Windows
|
|
37
|
+
certificate store. Valid existing credentials skip issuance; default-off startup
|
|
38
|
+
does not invoke it. macOS keeps the existing system OpenSSL implementation.
|
|
31
39
|
Windows automatic-proxy support has one isolated native WinHTTP worker
|
|
32
40
|
(`windows-prediction-network.mjs` / `.cs`) for company routing, authentication and
|
|
33
41
|
TLS trust. Its private, credit-based pipes stream data without transcript files.
|
|
@@ -52,7 +60,7 @@ per-file lock, reread current contents and preserve unrelated values. Locks do
|
|
|
52
60
|
not coordinate editors or other applications that ignore them. Read-only status
|
|
53
61
|
and doctor commands do not write configuration.
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
Core inference interfaces remain unchanged. This change adds a concrete
|
|
56
64
|
composition boundary; it does not relocate every file or add speculative APIs.
|
|
57
65
|
|
|
58
66
|
## Evidence and verification
|
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.27: Windows certificate setup without Git/OpenSSL](RELEASE_0.9.27.md)
|
|
20
21
|
- [0.9.26: Windows native predictions, safe ownership recovery and dashboard disclosures](RELEASE_0.9.26.md)
|
|
21
22
|
- [Windows prediction validation history](WINDOWS_PREDICTION_PREVIEW.md)
|
|
22
23
|
- [0.9.25: static proxy compatibility, integration boundaries and release diagnostics](RELEASE_0.9.25.md)
|
package/docs/REFERENCE.md
CHANGED
|
@@ -35,8 +35,17 @@ Version `0.9.26` adds Windows platform adapters. Native gray suggestions,
|
|
|
35
35
|
adoption/sending and switching predictions off were verified on Windows with the
|
|
36
36
|
`.4` candidate. Windows setup
|
|
37
37
|
requires a current-user, Store-signed `OpenAI.Codex` MSIX registration (Store and
|
|
38
|
-
official offline MSIX use the same registration), an initialized Codex profile
|
|
39
|
-
|
|
38
|
+
official offline MSIX use the same registration), an initialized Codex profile,
|
|
39
|
+
Windows PowerShell and .NET Framework 4.7.2 or later. Since `0.9.27`, prediction
|
|
40
|
+
setup and renewal do not require Git or OpenSSL. Node generates ephemeral RSA
|
|
41
|
+
keys; the Windows .NET certificate API signs the same scoped CA/leaf certificate
|
|
42
|
+
pair. Private keys travel only through a child-process stdin pipe; only the leaf
|
|
43
|
+
key and public certificates are saved in CCDX's private directory. No Windows
|
|
44
|
+
certificate store is opened. Existing valid PEM credentials are reused without
|
|
45
|
+
conversion or reauthorization. macOS retains its system OpenSSL setup path.
|
|
46
|
+
CCDX does not download a runtime or bypass company PowerShell policy; unavailable
|
|
47
|
+
system APIs fail the optional setup without preventing core service startup.
|
|
48
|
+
This does not remove Git from the separate `ccdx update github` installation path.
|
|
40
49
|
Run CCDX using Windows-native Node, not inside WSL. The App's agent may still use
|
|
41
50
|
WSL independently. No administrator prompt or execution-policy change is added.
|
|
42
51
|
AppData may be virtualized by MSIX: setup selects an existing `Codex/Local State`
|
package/package.json
CHANGED
|
@@ -8,7 +8,8 @@ import { userSettingsPath } from "./user-settings.mjs";
|
|
|
8
8
|
import { resolveNetworkRoute } from "./network-route.mjs";
|
|
9
9
|
import { codexPaths } from "./codex-paths.mjs";
|
|
10
10
|
import { assertWindowsCodexClosed, installedWindowsPredictionApp, windowsPredictionProfile,
|
|
11
|
-
|
|
11
|
+
windowsPrivatePredictionPath } from "./native-prediction-windows.mjs";
|
|
12
|
+
import { windowsPredictionCertificate } from "./windows-prediction-certificate.mjs";
|
|
12
13
|
|
|
13
14
|
export function predictionPaths({ env = process.env, home = os.homedir(), platform = process.platform, app } = {}) {
|
|
14
15
|
const directory = path.join(path.dirname(userSettingsPath({ env, home })), "native-prediction");
|
|
@@ -136,7 +137,14 @@ export function readPredictionCertificate(directory, { allowExpired = false, pla
|
|
|
136
137
|
|
|
137
138
|
export function createPredictionCertificate(directory, { exec = execFileSync, platform = process.platform, ...options } = {}) {
|
|
138
139
|
privateDirectory(directory, { ...options, exec, platform });
|
|
139
|
-
|
|
140
|
+
if (platform === "win32") {
|
|
141
|
+
const { cert, key, ca } = windowsPredictionCertificate({ ...options, exec });
|
|
142
|
+
atomicWriteFileSync(path.join(directory, "bridge.key"), key, { preserveMode: false });
|
|
143
|
+
atomicWriteFileSync(path.join(directory, "bridge.pem"), cert, { preserveMode: false });
|
|
144
|
+
atomicWriteFileSync(path.join(directory, "ca.pem"), ca, { preserveMode: false });
|
|
145
|
+
return readPredictionCertificate(directory, { ...options, exec, platform });
|
|
146
|
+
}
|
|
147
|
+
const openssl = "/usr/bin/openssl";
|
|
140
148
|
const temporary = fs.mkdtempSync(path.join(directory, "certificate-"));
|
|
141
149
|
try {
|
|
142
150
|
const config = `[req]\nprompt=no\ndistinguished_name=dn\nx509_extensions=ext\n[dn]\nCN=CCDX native prediction local bridge\n[ext]\nbasicConstraints=critical,CA:TRUE,pathlen:0\nkeyUsage=critical,keyCertSign,digitalSignature\nextendedKeyUsage=serverAuth\nsubjectAltName=DNS:chatgpt.com,DNS:ab.chatgpt.com\nnameConstraints=critical,permitted;DNS:chatgpt.com\n`;
|
|
@@ -97,18 +97,6 @@ export function windowsPredictionProfile({ app, env = process.env, preferredProf
|
|
|
97
97
|
return profiles[0];
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
export function windowsPredictionOpenSSL(options = {}) {
|
|
101
|
-
const raw = powershell(`$found=Get-Command openssl.exe -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1;
|
|
102
|
-
if($found){$found.Source}else{
|
|
103
|
-
$paths=@("$env:ProgramFiles\\Git\\usr\\bin\\openssl.exe", "$env:LOCALAPPDATA\\Programs\\Git\\usr\\bin\\openssl.exe");
|
|
104
|
-
$paths | Where-Object {Test-Path -LiteralPath $_ -PathType Leaf} | Select-Object -First 1
|
|
105
|
-
}`, options);
|
|
106
|
-
if (!path.win32.isAbsolute(raw) || !/openssl\.exe$/i.test(path.win32.basename(raw))) {
|
|
107
|
-
throw new Error("Native prediction needs OpenSSL on Windows; install Git for Windows (includes OpenSSL) and retry");
|
|
108
|
-
}
|
|
109
|
-
return raw;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
100
|
export function windowsPrivatePredictionPath(filePath, { create = false, env = process.env, ...options } = {}) {
|
|
113
101
|
powershell(`$p=$env:CCDX_PREDICTION_PRIVATE_PATH;$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User;
|
|
114
102
|
$acl=Get-Acl -LiteralPath $p;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// One-shot certificate issuance using the Windows .NET Framework. Keys remain
|
|
2
|
+
// ephemeral; only public certificates return through stdout. No store is opened.
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Security.Cryptography;
|
|
6
|
+
using System.Security.Cryptography.X509Certificates;
|
|
7
|
+
using System.Web.Script.Serialization;
|
|
8
|
+
|
|
9
|
+
public static class CCDXPredictionCertificate {
|
|
10
|
+
static byte[] Decode(Dictionary<string, object> key, string name, int size = 0) {
|
|
11
|
+
string value = ((string)key[name]).Replace('-', '+').Replace('_', '/');
|
|
12
|
+
var bytes = Convert.FromBase64String(value.PadRight((value.Length + 3) / 4 * 4, '='));
|
|
13
|
+
if (size == 0 || bytes.Length == size) return bytes;
|
|
14
|
+
if (bytes.Length > size) throw new InvalidOperationException("Invalid RSA component length");
|
|
15
|
+
var padded = new byte[size]; Buffer.BlockCopy(bytes, 0, padded, size - bytes.Length, bytes.Length); return padded;
|
|
16
|
+
}
|
|
17
|
+
static void Import(RSACng rsa, Dictionary<string, object> key) {
|
|
18
|
+
var modulus = Decode(key, "n"); var half = modulus.Length / 2;
|
|
19
|
+
rsa.ImportParameters(new RSAParameters { Modulus = modulus, Exponent = Decode(key, "e"),
|
|
20
|
+
D = Decode(key, "d", modulus.Length), P = Decode(key, "p", half), Q = Decode(key, "q", half),
|
|
21
|
+
DP = Decode(key, "dp", half), DQ = Decode(key, "dq", half), InverseQ = Decode(key, "qi", half) });
|
|
22
|
+
if (!rsa.Key.IsEphemeral) throw new InvalidOperationException("An ephemeral key is required");
|
|
23
|
+
}
|
|
24
|
+
static CertificateRequest Request(string name, RSA key, bool ca) {
|
|
25
|
+
var request = new CertificateRequest(name, key, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
|
|
26
|
+
request.CertificateExtensions.Add(new X509BasicConstraintsExtension(ca, ca, 0, true));
|
|
27
|
+
request.CertificateExtensions.Add(new X509KeyUsageExtension(ca
|
|
28
|
+
? X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.DigitalSignature
|
|
29
|
+
: X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.KeyEncipherment, true));
|
|
30
|
+
var usages = new OidCollection(); usages.Add(new Oid("1.3.6.1.5.5.7.3.1"));
|
|
31
|
+
request.CertificateExtensions.Add(new X509EnhancedKeyUsageExtension(usages, false));
|
|
32
|
+
var names = new SubjectAlternativeNameBuilder();
|
|
33
|
+
names.AddDnsName("chatgpt.com"); names.AddDnsName("ab.chatgpt.com");
|
|
34
|
+
request.CertificateExtensions.Add(names.Build(false));
|
|
35
|
+
if (ca) {
|
|
36
|
+
// DER NameConstraints: permitted DNS chatgpt.com, matching the existing CA.
|
|
37
|
+
request.CertificateExtensions.Add(new X509Extension("2.5.29.30", new byte[] {
|
|
38
|
+
0x30, 0x11, 0xa0, 0x0f, 0x30, 0x0d, 0x82, 0x0b,
|
|
39
|
+
0x63, 0x68, 0x61, 0x74, 0x67, 0x70, 0x74, 0x2e, 0x63, 0x6f, 0x6d }, true));
|
|
40
|
+
}
|
|
41
|
+
return request;
|
|
42
|
+
}
|
|
43
|
+
public static void Run() {
|
|
44
|
+
var json = new JavaScriptSerializer { MaxJsonLength = 16 * 1024 };
|
|
45
|
+
var input = json.Deserialize<Dictionary<string, object>>(Console.In.ReadToEnd());
|
|
46
|
+
using (var caKey = new RSACng())
|
|
47
|
+
using (var leafKey = new RSACng())
|
|
48
|
+
using (var random = RandomNumberGenerator.Create()) {
|
|
49
|
+
Import(caKey, (Dictionary<string, object>)input["ca"]);
|
|
50
|
+
Import(leafKey, (Dictionary<string, object>)input["leaf"]);
|
|
51
|
+
var now = DateTimeOffset.FromUnixTimeSeconds(DateTimeOffset.UtcNow.ToUnixTimeSeconds());
|
|
52
|
+
var before = now.AddMinutes(-5); var after = now.AddDays(90);
|
|
53
|
+
var serial = new byte[16]; random.GetBytes(serial); serial[0] = (byte)((serial[0] & 0x7f) | 1);
|
|
54
|
+
using (var ca = Request("CN=CCDX native prediction local bridge", caKey, true).CreateSelfSigned(before, after))
|
|
55
|
+
using (var leaf = Request("CN=CCDX local prediction bridge", leafKey, false).Create(ca, before, after, serial)) {
|
|
56
|
+
Console.Out.WriteLine(json.Serialize(new { ca = Convert.ToBase64String(ca.RawData), cert = Convert.ToBase64String(leaf.RawData) }));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { generateKeyPairSync } from "node:crypto";
|
|
5
|
+
import { windowsPowerShellEnvironment } from "./native-prediction-windows.mjs";
|
|
6
|
+
|
|
7
|
+
// Explicit Windows setup only. Private keys use stdin, never command arguments,
|
|
8
|
+
// environment variables, compiler source, or the Windows certificate store.
|
|
9
|
+
export function windowsPredictionCertificate({ env = process.env, exec = execFileSync } = {}) {
|
|
10
|
+
const ca = generateKeyPairSync("rsa", { modulusLength: 2048 });
|
|
11
|
+
const leaf = generateKeyPairSync("rsa", { modulusLength: 2048 });
|
|
12
|
+
const input = JSON.stringify({ ca: ca.privateKey.export({ format: "jwk" }), leaf: leaf.privateKey.export({ format: "jwk" }) });
|
|
13
|
+
const command = path.win32.join(env.SystemRoot || "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
14
|
+
const source = fileURLToPath(new URL("./windows-prediction-certificate.cs", import.meta.url));
|
|
15
|
+
let certificates;
|
|
16
|
+
try {
|
|
17
|
+
const raw = exec(command, ["-NoProfile", "-NonInteractive", "-Command",
|
|
18
|
+
"$ErrorActionPreference='Stop';Add-Type -Path $env:CCDX_PREDICTION_CERTIFICATE_SOURCE -ReferencedAssemblies System.dll,System.Core.dll,System.Security.dll,System.Web.Extensions.dll;[CCDXPredictionCertificate]::Run()"],
|
|
19
|
+
{ env: { ...windowsPowerShellEnvironment(env), CCDX_PREDICTION_CERTIFICATE_SOURCE: source }, input,
|
|
20
|
+
encoding: "utf8", timeout: 30_000, maxBuffer: 64 * 1024, windowsHide: true });
|
|
21
|
+
certificates = JSON.parse(raw);
|
|
22
|
+
for (const name of ["ca", "cert"]) {
|
|
23
|
+
if (typeof certificates?.[name] !== "string" || !/^[A-Za-z0-9+/]+={0,2}$/.test(certificates[name])
|
|
24
|
+
|| certificates[name].length > 16 * 1024) throw new Error();
|
|
25
|
+
}
|
|
26
|
+
} catch {
|
|
27
|
+
// Do not expose child-process diagnostics: they can contain private input.
|
|
28
|
+
throw new Error("Windows prediction certificate generation failed; verify Windows PowerShell, .NET Framework 4.7.2 or later and current-user policy");
|
|
29
|
+
}
|
|
30
|
+
const pem = value => `-----BEGIN CERTIFICATE-----\n${value.match(/.{1,64}/g).join("\n")}\n-----END CERTIFICATE-----\n`;
|
|
31
|
+
return { ca: pem(certificates.ca), cert: pem(certificates.cert),
|
|
32
|
+
key: leaf.privateKey.export({ type: "pkcs8", format: "pem" }) };
|
|
33
|
+
}
|