@auroraflow/code 0.0.14 → 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,6 +250,14 @@ 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 };
|
|
@@ -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) {
|