dsh-agy-link 0.6.27 → 0.6.28

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.28 (2026-11-15)
4
+
5
+ ### English
6
+
7
+ - **Fix(auth): a terminal TOS quarantine can no longer be cleared by the same warmup request (fixes #114).** v0.6.26 correctly marked a `TOS_VIOLATION` account `authRequired`, but `handlePoolWarmup` then ran an unconditional `refreshAccountQuota(acc, true)`; the quota pipeline (and boot hygiene / token refresh) calls `clearAuthRequired` on any successful refresh. A banned account still has a valid refresh token, so the flag was set and cleared within one HTTP request, and `needsAuthReverify` would have retried it every 10 minutes. `clearAuthRequired(id, force = false)` now refuses to lift a terminal ban; only **explicit user actions** (a completed OAuth login or a fresh credential import) pass `force: true`. `needsAuthReverify()` excludes terminal errors. Regression tests: pure classifier, real `AccountPoolManager` stickiness, and a route-level warmup → forced quota refresh → still `authRequired` test.
8
+
9
+ ### 中文
10
+
11
+ - **修复(认证):TOS 终态隔离不再被同一轮 warmup 清除(修复 #114)。** v0.6.26 已正确把 `TOS_VIOLATION` 账号标为 `authRequired`,但 `handlePoolWarmup` 随后无条件执行 `refreshAccountQuota(acc, true)`,而配额流水线(以及启动凭据恢复、token 刷新)在任何一次刷新成功后都会调用 `clearAuthRequired`。被停用账号的 refresh_token 仍然有效,于是「打标记 → 清标记」发生在同一次 HTTP 请求内,`needsAuthReverify` 还会每 10 分钟重试一次。现在 `clearAuthRequired(id, force = false)` 拒绝解除终态封禁;只有**显式用户操作**(完成 OAuth 登录、重新导入凭据)传入 `force: true`。`needsAuthReverify()` 也排除终态错误。回归测试覆盖:纯分类器、真实 `AccountPoolManager` 的粘性,以及路由级「预热 → 强制配额刷新 → authRequired 仍为真」。
12
+
3
13
  ## 0.6.27 (2026-11-15)
4
14
 
5
15
  ### English
@@ -1491,6 +1491,16 @@ function accountSupportsModel(acc, model, pool, catalog) {
1491
1491
  if (acc.quotas && Object.keys(acc.quotas).length > 0 && acc.quotas.google !== void 0) return false;
1492
1492
  return true;
1493
1493
  }
1494
+ /**
1495
+ * A flagged account whose flag is old enough (or whose flag predates the
1496
+ * authMarkedAt bookkeeping) may be re-verified in the background. If the
1497
+ * stored token still works the flag clears itself; if not, the flag is
1498
+ * simply re-stamped.
1499
+ */
1500
+ /** A terminal account ban (Google TOS_VIOLATION) is not a transient auth error. */
1501
+ function isTerminalAuthError(message) {
1502
+ return typeof message === "string" && /TOS_VIOLATION/i.test(message);
1503
+ }
1494
1504
  function defaultPoolData() {
1495
1505
  return {
1496
1506
  version: 1,
@@ -7135,9 +7145,19 @@ var PoolAdmin = class {
7135
7145
  delete acc.authMarkedAt;
7136
7146
  this.deps.persist();
7137
7147
  }
7138
- clearAuthRequired(id) {
7148
+ /**
7149
+ * Drop the "needs re-login" flag.
7150
+ *
7151
+ * Automatic paths (a successful quota/token refresh, boot-time credential
7152
+ * recovery) must NOT lift a TERMINAL TOS ban: those accounts still have a
7153
+ * valid refresh token, so every refresh would succeed and clear the ban
7154
+ * (issue #114). `force` is reserved for explicit user actions — a completed
7155
+ * re-login or a fresh credential import.
7156
+ */
7157
+ clearAuthRequired(id, force = false) {
7139
7158
  const acc = this.account(id);
7140
7159
  if (!acc) return;
7160
+ if (!force && isTerminalAuthError(acc.authError)) return;
7141
7161
  delete acc.authRequired;
7142
7162
  delete acc.authError;
7143
7163
  delete acc.authMarkedAt;
@@ -7954,8 +7974,8 @@ var AccountPoolManager = class {
7954
7974
  resetAccountIdentity(id, newEmail) {
7955
7975
  this.admin.resetAccountIdentity(id, newEmail);
7956
7976
  }
7957
- clearAuthRequired(id) {
7958
- this.admin.clearAuthRequired(id);
7977
+ clearAuthRequired(id, force = false) {
7978
+ this.admin.clearAuthRequired(id, force);
7959
7979
  }
7960
7980
  /** Drop an email label that is provably wrong (e.g. a foreign token overwrote it). */
7961
7981
  clearAccountEmail(id) {
package/dist/index.js CHANGED
@@ -595,9 +595,14 @@ const AUTH_REVERIFY_DELAY_MS = 6e5;
595
595
  * stored token still works the flag clears itself; if not, the flag is
596
596
  * simply re-stamped.
597
597
  */
598
+ /** A terminal account ban (Google TOS_VIOLATION) is not a transient auth error. */
599
+ function isTerminalAuthError(message) {
600
+ return typeof message === "string" && /TOS_VIOLATION/i.test(message);
601
+ }
598
602
  function needsAuthReverify(account, now = Date.now()) {
599
603
  if (!account.enabled) return false;
600
604
  if (!account.authRequired) return false;
605
+ if (isTerminalAuthError(account.authError)) return false;
601
606
  if (typeof account.authMarkedAt !== "number") return true;
602
607
  return now - account.authMarkedAt > AUTH_REVERIFY_DELAY_MS;
603
608
  }
@@ -7710,9 +7715,19 @@ var PoolAdmin = class {
7710
7715
  delete acc.authMarkedAt;
7711
7716
  this.deps.persist();
7712
7717
  }
7713
- clearAuthRequired(id) {
7718
+ /**
7719
+ * Drop the "needs re-login" flag.
7720
+ *
7721
+ * Automatic paths (a successful quota/token refresh, boot-time credential
7722
+ * recovery) must NOT lift a TERMINAL TOS ban: those accounts still have a
7723
+ * valid refresh token, so every refresh would succeed and clear the ban
7724
+ * (issue #114). `force` is reserved for explicit user actions — a completed
7725
+ * re-login or a fresh credential import.
7726
+ */
7727
+ clearAuthRequired(id, force = false) {
7714
7728
  const acc = this.account(id);
7715
7729
  if (!acc) return;
7730
+ if (!force && isTerminalAuthError(acc.authError)) return;
7716
7731
  delete acc.authRequired;
7717
7732
  delete acc.authError;
7718
7733
  delete acc.authMarkedAt;
@@ -8221,8 +8236,8 @@ var AccountPoolManager = class {
8221
8236
  resetAccountIdentity(id, newEmail) {
8222
8237
  this.admin.resetAccountIdentity(id, newEmail);
8223
8238
  }
8224
- clearAuthRequired(id) {
8225
- this.admin.clearAuthRequired(id);
8239
+ clearAuthRequired(id, force = false) {
8240
+ this.admin.clearAuthRequired(id, force);
8226
8241
  }
8227
8242
  /** Drop an email label that is provably wrong (e.g. a foreign token overwrote it). */
8228
8243
  clearAccountEmail(id) {
@@ -37521,7 +37536,7 @@ var PoolAuthFlow = class {
37521
37536
  } catch {}
37522
37537
  if (alias?.trim()) this.pool.setAccountAlias(existing.id, alias.trim());
37523
37538
  if (proxyUrl?.trim()) this.pool.setAccountProxy(existing.id, proxyUrl.trim());
37524
- this.pool.clearAuthRequired(existing.id);
37539
+ this.pool.clearAuthRequired(existing.id, true);
37525
37540
  this.pool.clearCooldown(existing.id, void 0, true);
37526
37541
  this.pool.updateAccountQuotas(existing.id, existing.quotas ?? {}, email);
37527
37542
  this.quota.refreshAccountQuota(existing).catch(() => void 0);
@@ -37634,7 +37649,7 @@ var PoolAuthFlow = class {
37634
37649
  renameSync(stagedFile, targetFile);
37635
37650
  saveCredentialBackup(targetFile);
37636
37651
  this.pool.updateAccountQuotas(account.id, {}, email);
37637
- this.pool.clearAuthRequired(account.id);
37652
+ this.pool.clearAuthRequired(account.id, true);
37638
37653
  this.pool.cleanupStagingSlot(flow.dir);
37639
37654
  this.quota.refreshAccountQuota(account).catch(() => void 0);
37640
37655
  this.flow = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.27",
3
+ "version": "0.6.28",
4
4
  "description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
5
5
  "type": "module",
6
6
  "license": "MIT",