dsh-plugin-subscription-oauth 0.8.4 → 0.8.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.
@@ -458,10 +458,11 @@ export class AntigravityAdapter extends LlmAdapter {
458
458
  const diag = [`pool=${accounts.join(',') || '(none)'}`];
459
459
  const tried = new Set();
460
460
  let token = await this.options.tokens.resolve();
461
- // Move an account known to be spent (from a past failure) to the back, so a fresh
462
- // request starts on one that has allowance. A lone account still serves.
463
- const order = [...accounts.filter((a) => a !== token.account && !this.isSpent(a)), token.account,
464
- ...accounts.filter((a) => a !== token.account && this.isSpent(a))];
461
+ // Stay on the default account until it refuses. opencodex keeps account affinity —
462
+ // a request stays on one account and only moves after a 429 — because switching
463
+ // accounts on every request is what reads to Google as two accounts in play at once
464
+ // and trips the verify gate. Reordering here caused exactly that.
465
+ const order = [token.account, ...accounts.filter((a) => a !== token.account)];
465
466
  for (const accountKey of order) {
466
467
  if (tried.has(accountKey))
467
468
  continue;
@@ -130,28 +130,17 @@ export async function* streamProviderResponses(options, input) {
130
130
  if (models.length === 0) {
131
131
  throw new LlmError(`${label} has no enabled model to dispatch to`, EMPTY_RESPONSE_CODE);
132
132
  }
133
- // When the provider meters per account and an account's allowance can run out,
134
- // every account is a candidate: a spent one falls through to the next, so one
135
- // model id draws on the whole pool's allowance. Accounts are tried in order;
136
- // the first that serves the request wins.
133
+ // Stay on the default account until it refuses. opencodex keeps account affinity — a
134
+ // request stays on one account and only moves after a 429 — because switching accounts
135
+ // on every request is what reads to a provider as several accounts in play at once and
136
+ // trips the safety gate. Reordering candidates here caused exactly that.
137
137
  let accounts = input.accounts === undefined
138
138
  ? undefined
139
139
  : [...await input.accounts()];
140
- // Send work straight to an account that has allowance: one already known to be
141
- // spent until a future reset is moved to the back, so a fresh request does not
142
- // fail against it once to find out. This is a preference, not a skip — a lone
143
- // account still serves, and the spent-retry below catches a stale record.
144
- if (accounts !== undefined && accounts.length > 1 && input.isAccountSpent !== undefined) {
145
- const fresh = [];
146
- const tired = [];
147
- for (const account of accounts) {
148
- if (await input.isAccountSpent(account))
149
- tired.push(account);
150
- else
151
- fresh.push(account);
152
- }
153
- if (tired.length > 0 && fresh.length > 0) {
154
- accounts = [...fresh, ...tired];
140
+ if (accounts !== undefined && accounts.length > 1) {
141
+ const defaultAccount = await tokens.defaultAccount();
142
+ if (defaultAccount !== undefined) {
143
+ accounts = [defaultAccount, ...accounts.filter((a) => a !== defaultAccount)];
155
144
  }
156
145
  }
157
146
  const tryAccounts = accounts === undefined || accounts.length === 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-subscription-oauth",
3
- "version": "0.8.4",
3
+ "version": "0.8.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",