@auroraflow/code 0.0.15 → 0.0.16

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.
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { runAuroraClaude } from "../packages/cli/src/index.js";
3
3
 
4
- await runAuroraClaude(process.argv.slice(2));
4
+ try {
5
+ await runAuroraClaude(process.argv.slice(2));
6
+ } catch (error) {
7
+ console.error(`Aurora Claude error: ${error?.message || error}`);
8
+ process.exit(1);
9
+ }
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { runAuroraCodex } from "../packages/cli/src/index.js";
3
3
 
4
- await runAuroraCodex(process.argv.slice(2));
4
+ try {
5
+ await runAuroraCodex(process.argv.slice(2));
6
+ } catch (error) {
7
+ console.error(`Aurora Codex error: ${error?.message || error}`);
8
+ process.exit(1);
9
+ }
@@ -1,13 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { installOfficialClients, isGlobalNpmLifecycle, officialClientStatuses } from "../packages/clients/src/index.js";
3
3
 
4
- if (!process.env.AURORA_SKIP_OFFICIAL_CLIENT_INSTALL && isGlobalNpmLifecycle()) {
4
+ if (process.env.AURORA_INSTALL_OFFICIAL_CLIENTS === "1" && isGlobalNpmLifecycle()) {
5
5
  try {
6
6
  await installOfficialClients();
7
7
  } catch (error) {
8
8
  console.error(`[aurora-code] official client install failed: ${error.message}`);
9
9
  console.error("[aurora-code] run `aurora install-clients` after installation.");
10
10
  }
11
+ } else if (isGlobalNpmLifecycle()) {
12
+ console.error("[aurora-code] installed Aurora launcher. Official Claude/Codex clients are not auto-installed.");
13
+ console.error("[aurora-code] run `aurora install-clients`, or install only what you need: `npm install -g @openai/codex@latest`.");
11
14
  }
12
15
 
13
16
  const statuses = officialClientStatuses();
package/bin/aurora.js CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { runAuroraCLI } from "../packages/cli/src/index.js";
3
3
 
4
- await runAuroraCLI(process.argv.slice(2));
4
+ try {
5
+ await runAuroraCLI(process.argv.slice(2));
6
+ } catch (error) {
7
+ console.error(`Aurora error: ${error?.message || error}`);
8
+ process.exit(1);
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auroraflow/code",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "description": "Aurora launcher and sidecar for official Codex and Claude Code clients.",
6
6
  "repository": {
@@ -8,6 +8,7 @@ import { ensureSidecarRunning } from "../../service/src/index.js";
8
8
 
9
9
  const here = dirname(fileURLToPath(import.meta.url));
10
10
  const packageRoot = resolve(here, "..", "..", "..");
11
+ const CODEX_MODEL_CATALOG_TIMEOUT_MS = 30000;
11
12
 
12
13
  const OFFICIAL_CLIENTS = {
13
14
  claude: {
@@ -24,10 +25,10 @@ const OFFICIAL_CLIENTS = {
24
25
 
25
26
  export async function createClientLaunchSpec(client, args = []) {
26
27
  const command = officialClientBin(client);
27
- const sidecar = await ensureSidecarRunning();
28
28
  const state = await readState();
29
29
  const model = selectedModelAlias(state);
30
30
  const key = selectedKey(state);
31
+ const sidecar = await ensureSidecarRunning();
31
32
  if (client === "claude") {
32
33
  const env = {
33
34
  ...process.env,
@@ -171,13 +172,18 @@ stream_idle_timeout_ms = 300000
171
172
 
172
173
  async function writeCodexModelCatalog(sidecar, modelCatalogPath) {
173
174
  const clientVersion = "0.137.0";
174
- const response = await fetch(
175
- `${sidecar.baseURL}/v1/models?client_version=${encodeURIComponent(clientVersion)}`,
176
- {
177
- headers: { authorization: `Bearer ${sidecar.token}` },
178
- signal: AbortSignal.timeout(5000)
179
- }
180
- );
175
+ let response;
176
+ try {
177
+ response = await fetch(
178
+ `${sidecar.baseURL}/v1/models?client_version=${encodeURIComponent(clientVersion)}`,
179
+ {
180
+ headers: { authorization: `Bearer ${sidecar.token}` },
181
+ signal: AbortSignal.timeout(CODEX_MODEL_CATALOG_TIMEOUT_MS)
182
+ }
183
+ );
184
+ } catch (error) {
185
+ throw new Error(`Aurora Codex model catalog request timed out after ${CODEX_MODEL_CATALOG_TIMEOUT_MS / 1000}s. Check Aurora Desktop key/model selection and network to Aurora Gateway. (${error?.message || error})`);
186
+ }
181
187
  if (!response.ok) {
182
188
  throw new Error(`Aurora Codex model catalog request failed with HTTP ${response.status}`);
183
189
  }
@@ -48,6 +48,7 @@ export async function ensureSidecarIdentity() {
48
48
  }
49
49
 
50
50
  export async function startSidecar(options = {}) {
51
+ installSidecarProcessGuards();
51
52
  const tokenOverride = options.token || readArg("--token") || process.env.AURORA_SIDECAR_TOKEN;
52
53
  const portOverride = options.port || readArg("--port") || process.env.AURORA_SIDECAR_PORT;
53
54
  const identity = await ensureSidecarIdentity();
@@ -134,18 +135,22 @@ async function pingLocalSidecar(port, token) {
134
135
  }
135
136
  }
136
137
 
137
- // The sidecar is a long-lived local proxy that Claude Code / Codex depend on
138
- // for every request. A single bad request (e.g. a mid-stream upstream drop)
139
- // must NOT kill the process: an orphaned sidecar with no live supervisor never
140
- // comes back, leaving the client stuck on ConnectionRefused. Log and keep
141
- // serving; the HTTP server stays healthy for the next request.
142
- process.on("uncaughtException", error => {
143
- console.error(`Aurora sidecar uncaught exception: ${error?.stack || error?.message || error}`);
144
- });
138
+ function installSidecarProcessGuards() {
139
+ if (process.__auroraSidecarProcessGuardsInstalled) return;
140
+ process.__auroraSidecarProcessGuardsInstalled = true;
141
+ // The sidecar is a long-lived local proxy that Claude Code / Codex depend on
142
+ // for every request. A single bad request (e.g. a mid-stream upstream drop)
143
+ // must NOT kill the process: an orphaned sidecar with no live supervisor never
144
+ // comes back, leaving the client stuck on ConnectionRefused. Log and keep
145
+ // serving; the HTTP server stays healthy for the next request.
146
+ process.on("uncaughtException", error => {
147
+ console.error(`Aurora sidecar uncaught exception: ${error?.stack || error?.message || error}`);
148
+ });
145
149
 
146
- process.on("unhandledRejection", reason => {
147
- console.error(`Aurora sidecar unhandled rejection: ${reason?.stack || reason?.message || reason}`);
148
- });
150
+ process.on("unhandledRejection", reason => {
151
+ console.error(`Aurora sidecar unhandled rejection: ${reason?.stack || reason?.message || reason}`);
152
+ });
153
+ }
149
154
 
150
155
  async function handle(request, response, token) {
151
156
  if (!isAuthorized(request, token)) {