pennyrouter 0.3.22 → 0.3.23

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +28 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pennyrouter",
3
- "version": "0.3.22",
3
+ "version": "0.3.23",
4
4
  "description": "Install and manage PennyRouter local coding-agent integrations.",
5
5
  "homepage": "https://pennyrouter.com",
6
6
  "bugs": {
package/src/cli.js CHANGED
@@ -1280,15 +1280,38 @@ async function update(flags) {
1280
1280
 
1281
1281
  const updateContexts = new Map();
1282
1282
  for (const record of targets) {
1283
- const profile = record.profile || profileFromManifestRecord(record) || flags.profile;
1284
- const launchConfig = await loadPennyConfig({ profile });
1283
+ const preferredProfile = record.profile || profileFromManifestRecord(record) || flags.profile;
1284
+ let profile = preferredProfile;
1285
+ let launchConfig = await loadPennyConfig({ profile });
1285
1286
  const globalAuth = await readClaudeCodeGatewayAuth();
1286
- const apiKey = flags.pennyKey || launchConfig.api_key || globalAuth.apiKey;
1287
- const gatewayBaseUrl = flags.gatewayBaseUrl
1287
+ let apiKey = flags.pennyKey || launchConfig.api_key || globalAuth.apiKey;
1288
+ let gatewayBaseUrl = flags.gatewayBaseUrl
1288
1289
  || launchConfig.gateway_base_url
1289
1290
  || globalAuth.gatewayBaseUrl
1290
1291
  || process.env.PENNYROUTER_GATEWAY_BASE_URL
1291
1292
  || DEFAULT_GATEWAY_BASE_URL;
1293
+
1294
+ // A pre-profile manifest may say "cloud" simply because that was the old default,
1295
+ // even though the user only has a private profile now. An unqualified update should
1296
+ // use an available credential rather than treating that stale hint as authoritative.
1297
+ if (!apiKey && !flags.profile && !flags.pennyKey) {
1298
+ const candidates = [
1299
+ activePennyProfile(launchConfig),
1300
+ ...listPennyProfiles(launchConfig),
1301
+ ].filter((name, index, all) => name && all.indexOf(name) === index);
1302
+ for (const candidate of candidates) {
1303
+ const candidateConfig = await loadPennyConfig({ profile: candidate });
1304
+ if (!candidateConfig.api_key) continue;
1305
+ profile = candidate;
1306
+ launchConfig = candidateConfig;
1307
+ apiKey = candidateConfig.api_key;
1308
+ gatewayBaseUrl = flags.gatewayBaseUrl
1309
+ || candidateConfig.gateway_base_url
1310
+ || process.env.PENNYROUTER_GATEWAY_BASE_URL
1311
+ || DEFAULT_GATEWAY_BASE_URL;
1312
+ break;
1313
+ }
1314
+ }
1292
1315
  if (!apiKey) {
1293
1316
  const suffix = profile ? ` for profile "${profile}"` : "";
1294
1317
  throw new Error(
@@ -1371,6 +1394,7 @@ async function update(flags) {
1371
1394
 
1372
1395
  next.updated_at = new Date().toISOString();
1373
1396
  if (record.harness === "codex") next.openai_subscription_auth = codexSubscriptionAuth;
1397
+ next.profile = profile;
1374
1398
  upsertManifestRecord(manifest, next);
1375
1399
  await saveManifest(manifest);
1376
1400
  console.log(`Updated ${record.harness}.`);