@auroraflow/code 0.0.13 → 0.0.15
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/package.json
CHANGED
|
@@ -23,6 +23,7 @@ const OFFICIAL_CLIENTS = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export async function createClientLaunchSpec(client, args = []) {
|
|
26
|
+
const command = officialClientBin(client);
|
|
26
27
|
const sidecar = await ensureSidecarRunning();
|
|
27
28
|
const state = await readState();
|
|
28
29
|
const model = selectedModelAlias(state);
|
|
@@ -42,7 +43,7 @@ export async function createClientLaunchSpec(client, args = []) {
|
|
|
42
43
|
DISABLE_AUTOUPDATER: "1"
|
|
43
44
|
};
|
|
44
45
|
env.ANTHROPIC_MODEL = model;
|
|
45
|
-
return { command
|
|
46
|
+
return { command, args, env };
|
|
46
47
|
}
|
|
47
48
|
await writeCodexRuntimeFiles({ sidecar, model, key });
|
|
48
49
|
const env = {
|
|
@@ -53,7 +54,7 @@ export async function createClientLaunchSpec(client, args = []) {
|
|
|
53
54
|
OPENAI_BASE_URL: `${sidecar.baseURL}/v1`
|
|
54
55
|
};
|
|
55
56
|
env.OPENAI_MODEL = model;
|
|
56
|
-
return { command
|
|
57
|
+
return { command, args, env };
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export async function runClient(client, args = []) {
|
|
@@ -82,9 +83,9 @@ export async function updateOfficialClients() {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export async function installOfficialClients() {
|
|
85
|
-
const npm =
|
|
86
|
+
const npm = npmCommandSpec();
|
|
86
87
|
const args = ["install", "-g", "@anthropic-ai/claude-code@latest", "@openai/codex@latest"];
|
|
87
|
-
await spawnAndWait(npm, args, { ...process.env });
|
|
88
|
+
await spawnAndWait(npm.command, [...npm.args, ...args], { ...process.env });
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export function isGlobalNpmLifecycle() {
|
|
@@ -249,27 +250,24 @@ function spawnSyncCompat(command, args) {
|
|
|
249
250
|
});
|
|
250
251
|
}
|
|
251
252
|
|
|
253
|
+
function npmCommandSpec() {
|
|
254
|
+
const npmExecPath = process.env.npm_execpath || "";
|
|
255
|
+
if (npmExecPath.endsWith(".js")) {
|
|
256
|
+
return { command: process.execPath, args: [npmExecPath] };
|
|
257
|
+
}
|
|
258
|
+
return { command: npmExecPath || "npm", args: [] };
|
|
259
|
+
}
|
|
260
|
+
|
|
252
261
|
function windowsCommandSpec(command, args) {
|
|
253
262
|
if (process.platform !== "win32" || !command.toLowerCase().endsWith(".cmd")) {
|
|
254
263
|
return { command, args, shell: false };
|
|
255
264
|
}
|
|
256
265
|
// Windows npm global bins are .cmd shims, commonly under "C:\Program Files".
|
|
257
|
-
//
|
|
258
|
-
//
|
|
259
|
-
// one quoted command line so paths with spaces survive.
|
|
266
|
+
// Invoke the batch file through cmd.exe + call so cmd receives the script
|
|
267
|
+
// path as an argv item instead of reparsing one pre-quoted command string.
|
|
260
268
|
return {
|
|
261
269
|
command: process.env.ComSpec || "cmd.exe",
|
|
262
|
-
args: ["/d", "/
|
|
270
|
+
args: ["/d", "/c", "call", command, ...args],
|
|
263
271
|
shell: false
|
|
264
272
|
};
|
|
265
273
|
}
|
|
266
|
-
|
|
267
|
-
function windowsCmdLine(parts) {
|
|
268
|
-
return parts.map(windowsCmdQuote).join(" ");
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function windowsCmdQuote(value) {
|
|
272
|
-
const text = String(value);
|
|
273
|
-
if (/^[A-Za-z0-9_./:=+-]+$/.test(text)) return text;
|
|
274
|
-
return `"${text.replace(/"/g, '""')}"`;
|
|
275
|
-
}
|
|
@@ -181,12 +181,19 @@ async function proxyModels(response, incomingURL) {
|
|
|
181
181
|
const upstreamURL = clientVersion
|
|
182
182
|
? `${gatewayURL}/v1/aurora-cli/models?client_version=${encodeURIComponent(clientVersion)}`
|
|
183
183
|
: `${gatewayURL}/v1/aurora-cli/models`;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
184
|
+
let upstream;
|
|
185
|
+
try {
|
|
186
|
+
upstream = await fetch(upstreamURL, {
|
|
187
|
+
headers: {
|
|
188
|
+
...selectedKeyHeaders(state),
|
|
189
|
+
"accept-encoding": "identity"
|
|
190
|
+
},
|
|
191
|
+
signal: AbortSignal.timeout(GATEWAY_HEADER_TIMEOUT_MS)
|
|
192
|
+
});
|
|
193
|
+
} catch (error) {
|
|
194
|
+
writeJSON(response, 502, { error: { type: "gateway_unreachable", message: error?.message || String(error) } });
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
190
197
|
const payload = await upstream.json().catch(() => ({ object: "list", data: [] }));
|
|
191
198
|
const sourceModels = Array.isArray(payload.data) ? payload.data : [];
|
|
192
199
|
if (clientVersion) {
|