dsh-plugin-subscription-oauth 0.17.4 → 0.17.5

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.
@@ -609,6 +609,13 @@ export class AntigravityAdapter extends LlmAdapter {
609
609
  diag.push(`403 on ${token.account}, another account already cooling; stopping the sweep`);
610
610
  }
611
611
  if (!response.ok) {
612
+ if (response.status === 400) {
613
+ // Google's 400 puts the offending field in error.details / fieldViolations, which
614
+ // the generic errorBodyMessage does not surface; log the whole body so the real
615
+ // cause is visible, since a bare "invalid argument" gives nothing to act on.
616
+ const body = await response.clone().text().catch(() => '');
617
+ this.options.onWarn?.(`antigravity: HTTP 400 body: ${body.slice(0, 600)}`);
618
+ }
612
619
  diag.push(`fail ${response.status} on ${token.account} (no switch)`);
613
620
  const error = await httpLlmError(response, 'Antigravity API');
614
621
  // The diagnostic rides the message so it surfaces where the user sees the
@@ -96,7 +96,13 @@ async function errorBodyMessage(response) {
96
96
  const record = parsed;
97
97
  const error = record.error;
98
98
  if (typeof error === 'object' && error !== null) {
99
- const message = error.message;
99
+ const errorRecord = error;
100
+ const message = errorRecord.message;
101
+ // Google puts the offending field in details[].fieldViolations, which the bare
102
+ // message omits; surface it so a 400 names what to fix instead of "invalid argument".
103
+ const detail = extractFieldViolations(errorRecord.details);
104
+ if (detail !== undefined)
105
+ return `${String(message ?? '').trim()} — ${detail}`;
100
106
  if (typeof message === 'string' && message.trim() !== '')
101
107
  return message.trim();
102
108
  }
@@ -115,6 +121,29 @@ async function errorBodyMessage(response) {
115
121
  return undefined;
116
122
  }
117
123
  }
124
+ /** The offending-field text inside a Google RPC error's `details` list, when present. */
125
+ function extractFieldViolations(details) {
126
+ if (!Array.isArray(details))
127
+ return undefined;
128
+ const out = [];
129
+ for (const entry of details) {
130
+ if (typeof entry !== 'object' || entry === null)
131
+ continue;
132
+ const violations = entry.fieldViolations;
133
+ if (!Array.isArray(violations))
134
+ continue;
135
+ for (const violation of violations) {
136
+ if (typeof violation !== 'object' || violation === null)
137
+ continue;
138
+ const field = violation.field;
139
+ const description = violation.description;
140
+ if (typeof description === 'string' && description.trim() !== '') {
141
+ out.push(typeof field === 'string' && field.trim() !== '' ? `${field}: ${description.trim()}` : description.trim());
142
+ }
143
+ }
144
+ }
145
+ return out.length === 0 ? undefined : out.join('; ');
146
+ }
118
147
  /**
119
148
  * Turn a non-2xx provider response into an LlmError carrying the status and
120
149
  * any rate-limit hint the headers disclosed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-subscription-oauth",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "description": "Use subscription accounts as DeepSeek Harness LLM providers — Kimi Code (OAuth device flow), Grok / X Premium (OIDC + PKCE), Google Antigravity (Google OAuth + Cloud Code Assist) and GLM / BigModel (ZCode's browser sign-in) — with per-model visibility, drag-to-reorder Auto fallback and plan quotas from the web Settings page",
5
5
  "license": "MIT",
6
6
  "author": "EricFL1998",