@smithers-orchestrator/accounts 0.25.0 → 0.25.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithers-orchestrator/accounts",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "description": "Manage multiple Claude/Antigravity/Codex/Gemini/Kimi subscription and API-key accounts that Smithers agents can round-robin through.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -20,7 +20,7 @@
20
20
  "src/"
21
21
  ],
22
22
  "dependencies": {
23
- "@smithers-orchestrator/errors": "0.25.0"
23
+ "@smithers-orchestrator/errors": "0.25.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/bun": "latest",
@@ -25,8 +25,16 @@ const API_KEY_PROVIDERS = new Set([
25
25
 
26
26
  /**
27
27
  * Parses a raw JSON string into a validated AccountsFile. Throws SmithersError
28
- * with code `ACCOUNTS_FILE_INVALID` if the shape is wrong. Tolerates missing
29
- * accounts.json (caller passes an empty string for that).
28
+ * with code `ACCOUNTS_FILE_INVALID` if the file itself is unparseable or has the
29
+ * wrong top-level shape. Tolerates missing accounts.json (caller passes an empty
30
+ * string for that).
31
+ *
32
+ * Individual account entries whose `provider` is not a recognized value (e.g. a
33
+ * legacy `gemini` account left over after that subscription provider was
34
+ * removed) are SKIPPED with a warning rather than failing the whole file, so one
35
+ * stale entry can't lock a user out of all their valid accounts. Entries that
36
+ * are recognized but malformed (missing label, missing required configDir/apiKey,
37
+ * etc.) still throw, since those indicate real corruption of a live account.
30
38
  *
31
39
  * @param {string} raw
32
40
  * @returns {import("./AccountsFile.ts").AccountsFile}
@@ -65,8 +73,13 @@ export function parseAccountsFile(raw) {
65
73
  if (typeof e.label !== "string" || !e.label.trim()) {
66
74
  throw new SmithersError("ACCOUNTS_FILE_INVALID", `accounts.json: accounts[${i}].label must be a non-empty string`);
67
75
  }
76
+ // An unrecognized provider is almost always a legacy entry (e.g. a
77
+ // `gemini` subscription account left over after that provider was
78
+ // dropped). Skip it with a warning instead of failing the whole file so
79
+ // one stale account doesn't lock the user out of every valid one.
68
80
  if (typeof e.provider !== "string" || !VALID_PROVIDERS.has(e.provider)) {
69
- throw new SmithersError("ACCOUNTS_FILE_INVALID", `accounts.json: accounts[${i}].provider must be one of ${[...VALID_PROVIDERS].join(", ")}, got ${JSON.stringify(e.provider)}`);
81
+ console.warn(`accounts.json: skipping account ${JSON.stringify(e.label)} with unknown provider ${JSON.stringify(e.provider)} (valid providers: ${[...VALID_PROVIDERS].join(", ")})`);
82
+ continue;
70
83
  }
71
84
  if (seenLabels.has(e.label)) {
72
85
  throw new SmithersError("ACCOUNTS_FILE_INVALID", `accounts.json: duplicate label ${JSON.stringify(e.label)}`);