dsh-agy-link 0.6.45 → 0.6.47

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/dist/client.js CHANGED
@@ -81,6 +81,9 @@ window.__ModuleLoader__.load({
81
81
  "quota.unavailableTitle": "配额刷新失败",
82
82
  "quota.unavailable.no_license": "此账号无有效许可(接口 403)",
83
83
  "quota.unavailable.no_summary_access": "免费账号 · 仅限周配额(汇总接口被拒绝)",
84
+ "quota.unavailable.validation_required": "Google 要求网页验证账号(VALIDATION_REQUIRED)",
85
+ "quota.unavailable.tos_violation": "账号已被 Google 停用(TOS_VIOLATION)",
86
+ "quota.verifyNow": "前往验证",
84
87
  "quota.unavailable.auth": "登录凭据已失效(401)",
85
88
  "quota.unavailable.unreachable": "配额接口不可达",
86
89
  "quota.unavailable.partial": "只取到模型级数据,5 小时/周额度未更新",
@@ -192,7 +195,7 @@ window.__ModuleLoader__.load({
192
195
  "config.translateModelDesc": "翻译调用使用哪个模型;默认自动从 Gemini Flash 里挑最新的一个",
193
196
  "config.translateModelAuto": "默认(自动)",
194
197
  "config.translateEffort": "思考强度",
195
- "config.translateEffortDesc": "翻译调用的思考档;默认 medium(速度与质量折中),low 更快、high 更严谨",
198
+ "config.translateEffortDesc": "翻译调用的思考档;默认 low(速度最快,且常驻热进程),medium/high 思考更久",
196
199
  "config.translateEffortAuto": "跟随默认",
197
200
  "config.image": "生图",
198
201
  "config.imageDesc": "agy 内置 generate_image;headless 用 dsh-agy-image,与主流程共用账号池,额度/地区失败自动换号",
@@ -219,7 +222,7 @@ window.__ModuleLoader__.load({
219
222
  "tsl.plain": "人话版",
220
223
  "tsl.translate": "译成人话",
221
224
  "tsl.actionTip": "用 Gemini 把这条回复译成人话",
222
- "tsl.translating": "翻译中…(通常 20–40 秒)",
225
+ "tsl.translating": "翻译中…",
223
226
  "tsl.done": "已生成译文",
224
227
  "tsl.pending": "Gemini 正在翻译…",
225
228
  "tsl.copy": "复制",
@@ -310,6 +313,9 @@ window.__ModuleLoader__.load({
310
313
  "quota.unavailableTitle": "Quota refresh failed",
311
314
  "quota.unavailable.no_license": "this account has no valid license (HTTP 403)",
312
315
  "quota.unavailable.no_summary_access": "free-tier account · weekly quota only (the summary endpoint is refused)",
316
+ "quota.unavailable.validation_required": "Google requires web account verification (VALIDATION_REQUIRED)",
317
+ "quota.unavailable.tos_violation": "account disabled by Google (TOS_VIOLATION)",
318
+ "quota.verifyNow": "Verify now",
313
319
  "quota.unavailable.auth": "the login credential is no longer valid (401)",
314
320
  "quota.unavailable.unreachable": "the quota endpoints are unreachable",
315
321
  "quota.unavailable.partial": "only per-model data arrived; 5-hour/weekly figures are stale",
@@ -421,7 +427,7 @@ window.__ModuleLoader__.load({
421
427
  "config.translateModelDesc": "Model used for the translation call; the default picks the newest Gemini Flash automatically",
422
428
  "config.translateModelAuto": "Default (auto)",
423
429
  "config.translateEffort": "Thinking effort",
424
- "config.translateEffortDesc": "Effort for the translation call; default medium (speed/quality balance) — low is faster, high is more rigorous",
430
+ "config.translateEffortDesc": "Effort for the translation call; default low (fastest, warm worker reuse) — medium/high think longer",
425
431
  "config.translateEffortAuto": "Follow default",
426
432
  "config.image": "Image generation",
427
433
  "config.imageDesc": "Built-in agy generate_image; headless via dsh-agy-image, sharing the main account pool and rotating on quota/region failures",
@@ -448,7 +454,7 @@ window.__ModuleLoader__.load({
448
454
  "tsl.plain": "Plain language",
449
455
  "tsl.translate": "Translate to plain language",
450
456
  "tsl.actionTip": "Rewrite this reply in plain language with Gemini",
451
- "tsl.translating": "Translating… (usually 20–40s)",
457
+ "tsl.translating": "Translating…",
452
458
  "tsl.done": "Translation ready",
453
459
  "tsl.pending": "Gemini is translating…",
454
460
  "tsl.copy": "Copy",
@@ -539,6 +545,9 @@ window.__ModuleLoader__.load({
539
545
  "quota.unavailableTitle": "Falha ao atualizar a cota",
540
546
  "quota.unavailable.no_license": "esta conta não tem uma licença válida (HTTP 403)",
541
547
  "quota.unavailable.no_summary_access": "conta gratuita · apenas cota semanal (o resumo é recusado)",
548
+ "quota.unavailable.validation_required": "o Google exige verificação da conta na web (VALIDATION_REQUIRED)",
549
+ "quota.unavailable.tos_violation": "conta desativada pelo Google (TOS_VIOLATION)",
550
+ "quota.verifyNow": "Verificar agora",
542
551
  "quota.unavailable.auth": "a credencial de acesso não é mais válida (401)",
543
552
  "quota.unavailable.unreachable": "não é possível alcançar os serviços de cota",
544
553
  "quota.unavailable.partial": "só chegaram dados por modelo; os números de 5 h/semana estão desatualizados",
@@ -650,7 +659,7 @@ window.__ModuleLoader__.load({
650
659
  "config.translateModelDesc": "Modelo usado na chamada de tradução; o padrão escolhe automaticamente o Gemini Flash mais recente",
651
660
  "config.translateModelAuto": "Padrão (auto)",
652
661
  "config.translateEffort": "Intensidade de raciocínio",
653
- "config.translateEffortDesc": "Intensidade da tradução; padrão medium (equilíbrio velocidade/qualidade) — low é mais rápido, high mais rigoroso",
662
+ "config.translateEffortDesc": "Intensidade da tradução; padrão low (mais rápido, processo aquecido) — medium/high pensam mais",
654
663
  "config.translateEffortAuto": "Seguir padrão",
655
664
  "config.image": "Geração de imagem",
656
665
  "config.imageDesc": "generate_image nativo do agy; headless via dsh-agy-image, usando o mesmo pool de contas e trocando em falhas de cota/região",
@@ -677,7 +686,7 @@ window.__ModuleLoader__.load({
677
686
  "tsl.plain": "Linguagem simples",
678
687
  "tsl.translate": "Traduzir para linguagem simples",
679
688
  "tsl.actionTip": "Reescrever esta resposta em linguagem simples com o Gemini",
680
- "tsl.translating": "Traduzindo… (normalmente 20–40s)",
689
+ "tsl.translating": "Traduzindo…",
681
690
  "tsl.done": "Tradução concluída",
682
691
  "tsl.pending": "O Gemini está traduzindo…",
683
692
  "tsl.copy": "Copiar",
@@ -768,6 +777,9 @@ window.__ModuleLoader__.load({
768
777
  "quota.unavailableTitle": "No se pudo actualizar la cuota",
769
778
  "quota.unavailable.no_license": "esta cuenta no tiene una licencia válida (HTTP 403)",
770
779
  "quota.unavailable.no_summary_access": "cuenta gratuita · solo cuota semanal (el resumen se rechaza)",
780
+ "quota.unavailable.validation_required": "Google requiere verificar la cuenta en la web (VALIDATION_REQUIRED)",
781
+ "quota.unavailable.tos_violation": "cuenta deshabilitada por Google (TOS_VIOLATION)",
782
+ "quota.verifyNow": "Verificar ahora",
771
783
  "quota.unavailable.auth": "la credencial de acceso ya no es válida (401)",
772
784
  "quota.unavailable.unreachable": "no se puede alcanzar los servicios de cuota",
773
785
  "quota.unavailable.partial": "solo llegaron datos por modelo; las cifras de 5 h/semana están desactualizadas",
@@ -879,7 +891,7 @@ window.__ModuleLoader__.load({
879
891
  "config.translateModelDesc": "Modelo usado en la llamada de traducción; el valor por defecto elige automáticamente el Gemini Flash más reciente",
880
892
  "config.translateModelAuto": "Predeterminado (auto)",
881
893
  "config.translateEffort": "Intensidad de razonamiento",
882
- "config.translateEffortDesc": "Intensidad de la traducción; por defecto medium (equilibrio velocidad/calidad) — low es más rápido, high más riguroso",
894
+ "config.translateEffortDesc": "Intensidad de la traducción; por defecto low (más rápido, con proceso cálido) — medium/high piensan más",
883
895
  "config.translateEffortAuto": "Seguir predeterminado",
884
896
  "config.image": "Generación de imagen",
885
897
  "config.imageDesc": "generate_image nativo de agy; headless con dsh-agy-image, usando el mismo pool de cuentas y rotando ante fallos de cuota/región",
@@ -906,7 +918,7 @@ window.__ModuleLoader__.load({
906
918
  "tsl.plain": "Lenguaje sencillo",
907
919
  "tsl.translate": "Traducir a lenguaje sencillo",
908
920
  "tsl.actionTip": "Reescribir esta respuesta en lenguaje sencillo con Gemini",
909
- "tsl.translating": "Traduciendo… (normalmente 20–40s)",
921
+ "tsl.translating": "Traduciendo…",
910
922
  "tsl.done": "Traducción completada",
911
923
  "tsl.pending": "Gemini está traduciendo…",
912
924
  "tsl.copy": "Copiar",
@@ -1720,12 +1732,14 @@ window.__ModuleLoader__.load({
1720
1732
  let listenerAttached = false;
1721
1733
  const settleListeners = /* @__PURE__ */ new Set();
1722
1734
  let overlaySuspended = false;
1735
+ let overlaySuspendRefs = 0;
1723
1736
  function onScrollActivity() {
1724
1737
  isScrolling = true;
1725
1738
  if (scrollTimer !== null) clearTimeout(scrollTimer);
1726
1739
  scrollTimer = setTimeout(() => {
1727
1740
  isScrolling = false;
1728
1741
  scrollTimer = null;
1742
+ if (overlaySuspended || overlaySuspendRefs > 0) return;
1729
1743
  for (const fn of settleListeners) try {
1730
1744
  fn();
1731
1745
  } catch {}
@@ -1743,17 +1757,30 @@ window.__ModuleLoader__.load({
1743
1757
  function setOverlaySuspended(active) {
1744
1758
  if (overlaySuspended === active) return;
1745
1759
  overlaySuspended = active;
1746
- if (!active) for (const fn of settleListeners) try {
1760
+ if (!active && overlaySuspendRefs === 0) for (const fn of settleListeners) try {
1747
1761
  fn();
1748
1762
  } catch {}
1749
1763
  }
1764
+ /** Ref-counted suspend for mounted Settings views (e.g. DSH native Settings dialog). */
1765
+ function acquireOverlaySuspend() {
1766
+ overlaySuspendRefs += 1;
1767
+ let released = false;
1768
+ return () => {
1769
+ if (released) return;
1770
+ released = true;
1771
+ overlaySuspendRefs = Math.max(0, overlaySuspendRefs - 1);
1772
+ if (!overlaySuspended && overlaySuspendRefs === 0) for (const fn of settleListeners) try {
1773
+ fn();
1774
+ } catch {}
1775
+ };
1776
+ }
1750
1777
  /**
1751
1778
  * The one predicate every overlay scanner should gate on: may I mutate the DOM
1752
1779
  * right now? False during an active scroll gesture AND while an overlay owns
1753
1780
  * the screen. Scanners must not act while this is true.
1754
1781
  */
1755
1782
  function isInteractionLocked() {
1756
- return isScrolling || overlaySuspended;
1783
+ return isScrolling || overlaySuspended || overlaySuspendRefs > 0;
1757
1784
  }
1758
1785
  /** Register a callback to run once scrolling has settled. Returns an unregister function. */
1759
1786
  function onScrollSettle(fn) {
@@ -1787,6 +1814,7 @@ window.__ModuleLoader__.load({
1787
1814
  settleListeners.clear();
1788
1815
  isScrolling = false;
1789
1816
  overlaySuspended = false;
1817
+ overlaySuspendRefs = 0;
1790
1818
  }
1791
1819
  //#endregion
1792
1820
  //#region src/common/timeouts.ts
@@ -6836,23 +6864,21 @@ body.dark,
6836
6864
  border-radius: 50%;
6837
6865
  }
6838
6866
  .agy-card-hover {
6839
- transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
6867
+ transition: border-color 0.15s ease, opacity 0.15s ease;
6840
6868
  }
6841
6869
  .agy-card-hover:hover {
6842
6870
  border-color: var(--agy-border-card-primary, #3b82f6) !important;
6843
- box-shadow: var(--agy-shadow-card-hover) !important;
6844
6871
  }
6845
6872
 
6846
6873
  .agy-btn {
6847
- transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease, transform 0.15s ease;
6874
+ transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
6848
6875
  user-select: none;
6849
6876
  }
6850
6877
  .agy-btn:hover:not(:disabled) {
6851
- filter: brightness(1.08);
6852
- transform: translateY(-0.5px);
6878
+ opacity: 0.9;
6853
6879
  }
6854
6880
  .agy-btn:active:not(:disabled) {
6855
- transform: translateY(0.5px);
6881
+ opacity: 0.78;
6856
6882
  }
6857
6883
 
6858
6884
  /* Standalone enable/disable toggle (rows without a segment group). Class-based
@@ -6900,9 +6926,9 @@ body.dark,
6900
6926
  .agy-shimmer-track {
6901
6927
  position: relative;
6902
6928
  overflow: hidden;
6903
- contain: paint;
6904
- transform: translateZ(0);
6905
- isolation: isolate;
6929
+ /* No contain: paint / transform: translateZ(0) / isolation: isolate here:
6930
+ forcing GPU layer promotion on quota tracks inside a scrolling settings
6931
+ menu/modal triggers Chromium/Electron backing-layer drop flicker. */
6906
6932
  }
6907
6933
  .agy-shimmer-track::after {
6908
6934
  content: '';
@@ -7695,7 +7721,54 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7695
7721
  const key = typeof id === "string" ? id.trim().toLowerCase() : "";
7696
7722
  return EFFORT_LABELS[key] ?? (typeof id === "string" ? id.trim() : "");
7697
7723
  }
7698
- [...REASONING_EFFORTS].sort((a, b) => b.length - a.length || a.localeCompare(b));
7724
+ /**
7725
+ * Effort suffixes ordered so a LONGER suffix always wins: `gemini-4-hydrogen-xhigh`
7726
+ * must fold as `gemini-4-hydrogen` + `xhigh`, never as `gemini-4-hydrogen-x` + `high`.
7727
+ */
7728
+ const EFFORT_SUFFIXES = [...REASONING_EFFORTS].sort((a, b) => b.length - a.length || a.localeCompare(b));
7729
+ /**
7730
+ * Split a discovered agy slug into (base, effort).
7731
+ *
7732
+ * Returns `effort: undefined` when the slug carries no effort suffix. The
7733
+ * caller still decides whether the base is real — a lone `gemini-x-medium`
7734
+ * with no siblings must stay verbatim rather than inventing a base.
7735
+ */
7736
+ function splitEffortSuffix(slug) {
7737
+ const id = typeof slug === "string" ? slug.trim() : "";
7738
+ for (const effort of EFFORT_SUFFIXES) {
7739
+ const suffix = "-" + effort;
7740
+ if (id.length > suffix.length && id.endsWith(suffix)) return {
7741
+ base: id.slice(0, -suffix.length),
7742
+ effort
7743
+ };
7744
+ }
7745
+ return { base: id };
7746
+ }
7747
+ /**
7748
+ * Canonical ordering + de-duplication of an effort set.
7749
+ *
7750
+ * Order is always `REASONING_EFFORTS`, so the picker and the settings
7751
+ * dropdowns can never disagree about the order of Low/Medium/High/Extra.
7752
+ *
7753
+ * Ids this build does not know yet (a newer agy level, or a hand-written
7754
+ * `fallbackModels` entry) are kept AFTER the known ones in first-seen order —
7755
+ * dropping them would silently delete a user's configuration.
7756
+ */
7757
+ function normalizeEfforts(list) {
7758
+ if (list === void 0 || list === null) return [];
7759
+ const present = /* @__PURE__ */ new Set();
7760
+ const order = [];
7761
+ for (const raw of list) {
7762
+ if (typeof raw !== "string") continue;
7763
+ const id = raw.trim().toLowerCase();
7764
+ if (id === "" || present.has(id)) continue;
7765
+ present.add(id);
7766
+ order.push(id);
7767
+ }
7768
+ const known = REASONING_EFFORTS.filter((e) => present.has(e));
7769
+ const unknown = order.filter((e) => !REASONING_EFFORTS.includes(e));
7770
+ return [...known, ...unknown];
7771
+ }
7699
7772
  //#endregion
7700
7773
  //#region src/client/hooks/useTranslation.ts
7701
7774
  function useAgyTranslation(locale) {
@@ -8248,6 +8321,197 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8248
8321
  }, uiIcon("x", 12)));
8249
8322
  }
8250
8323
  //#endregion
8324
+ //#region src/common/pool-types.ts
8325
+ /**
8326
+ * Map a model slug to its backend quota counter family.
8327
+ *
8328
+ * Gemini 4 Argon (Pro/Ultra-only) bills against its OWN weekly quota pool —
8329
+ * never the plain Gemini one. Its ids look like `gemini-4-argon-low/-medium`
8330
+ * and MUST be detected before the generic `gemini-` prefix below, otherwise
8331
+ * argon usage would silently drain/report the Gemini counter.
8332
+ */
8333
+ function modelFamilyOf(modelId) {
8334
+ if (!modelId) return "unknown";
8335
+ const id = modelId.toLowerCase();
8336
+ if (id.includes("argon")) return "argon";
8337
+ if (id.startsWith("claude-") || id.includes("claude")) return "anthropic";
8338
+ if (id.startsWith("gemini-") || id.startsWith("gemma-") || id.includes("gemini")) return "google";
8339
+ if (id.startsWith("gpt-") || id.startsWith("openai/") || id.includes("gpt-oss")) return "openai";
8340
+ return "unknown";
8341
+ }
8342
+ //#endregion
8343
+ //#region src/common/account-models.ts
8344
+ const FAMILY_LABELS = {
8345
+ google: "Gemini",
8346
+ argon: "Argon",
8347
+ anthropic: "Claude",
8348
+ openai: "OpenAI",
8349
+ unknown: "Other"
8350
+ };
8351
+ const QUOTA_FAMILIES = [
8352
+ "google",
8353
+ "argon",
8354
+ "anthropic",
8355
+ "openai"
8356
+ ];
8357
+ function familyLabelOf(family) {
8358
+ return FAMILY_LABELS[family] ?? "Other";
8359
+ }
8360
+ function isInternalNoiseSlug(id) {
8361
+ const lower = id.trim().toLowerCase();
8362
+ return /-sonar$/i.test(lower) || /-image(?:$|-)/i.test(lower);
8363
+ }
8364
+ function isEffortFoldableSlug(id) {
8365
+ const lower = id.trim().toLowerCase();
8366
+ return lower.startsWith("gemini") || lower.startsWith("argon") || lower.startsWith("claude");
8367
+ }
8368
+ function stripTieredSuffix(id) {
8369
+ return id.endsWith("-tiered") && id.length > 7 ? id.slice(0, -7) : id;
8370
+ }
8371
+ function canonicalQuotaBaseId(rawId) {
8372
+ const trimmed = rawId.trim().toLowerCase();
8373
+ if (!isEffortFoldableSlug(trimmed)) return { base: trimmed };
8374
+ const split = splitEffortSuffix(trimmed);
8375
+ if (split.effort !== void 0) return {
8376
+ base: stripTieredSuffix(split.base),
8377
+ effort: split.effort
8378
+ };
8379
+ return { base: stripTieredSuffix(trimmed) };
8380
+ }
8381
+ function cleanFallbackDisplayName(rawName, baseId, effort) {
8382
+ const name = typeof rawName === "string" ? rawName.trim() : "";
8383
+ if (name === "" || name.toLowerCase() === baseId.toLowerCase()) return baseId;
8384
+ let cleaned = name;
8385
+ if (isEffortFoldableSlug(baseId)) {
8386
+ cleaned = cleaned.replace(/\s*\(tiered\)\s*$/i, "").trim();
8387
+ if (effort) {
8388
+ const effLabel = effort === "xhigh" ? "(?:xhigh|extra)" : effort;
8389
+ cleaned = cleaned.replace(new RegExp(`\\s*\\(?${effLabel}\\)?\\s*$`, "i"), "").replace(/\s*\(tiered\)\s*$/i, "").trim();
8390
+ }
8391
+ }
8392
+ return cleaned !== "" ? cleaned : baseId;
8393
+ }
8394
+ function collectAccountQuotaModels(acc) {
8395
+ const out = [];
8396
+ for (const fam of QUOTA_FAMILIES) {
8397
+ const models = acc.quotas?.[fam]?.models;
8398
+ if (!Array.isArray(models)) continue;
8399
+ for (const model of models) if (model && typeof model.modelId === "string" && model.modelId.trim() !== "") out.push({
8400
+ family: fam,
8401
+ model
8402
+ });
8403
+ }
8404
+ return out;
8405
+ }
8406
+ function pickQuotaStats(matches) {
8407
+ let minFrac;
8408
+ let bestReset;
8409
+ for (const m of matches) {
8410
+ if (typeof m.remainingFraction === "number" && Number.isFinite(m.remainingFraction)) {
8411
+ if (minFrac === void 0 || m.remainingFraction < minFrac) {
8412
+ minFrac = m.remainingFraction;
8413
+ if (m.resetTime) bestReset = m.resetTime;
8414
+ }
8415
+ }
8416
+ if (!bestReset && m.resetTime) bestReset = m.resetTime;
8417
+ }
8418
+ return {
8419
+ ...minFrac === void 0 ? {} : { remainingFraction: minFrac },
8420
+ ...bestReset ? { resetTime: bestReset } : {}
8421
+ };
8422
+ }
8423
+ function projectFromAuthoritativeCatalog(acc, catalogModels) {
8424
+ const quotaModels = collectAccountQuotaModels(acc);
8425
+ const seenIds = /* @__PURE__ */ new Set();
8426
+ const rows = [];
8427
+ for (const entry of catalogModels) {
8428
+ if (!entry || typeof entry.id !== "string") continue;
8429
+ const id = entry.id.trim();
8430
+ const lowerId = id.toLowerCase();
8431
+ if (id === "" || seenIds.has(lowerId)) continue;
8432
+ seenIds.add(lowerId);
8433
+ const name = typeof entry.name === "string" && entry.name.trim() !== "" ? entry.name.trim() : id;
8434
+ const family = modelFamilyOf(id);
8435
+ const efforts = normalizeEfforts(entry.efforts);
8436
+ let stats = pickQuotaStats(quotaModels.filter(({ model }) => {
8437
+ const raw = model.modelId.trim().toLowerCase();
8438
+ return raw === lowerId || canonicalQuotaBaseId(raw).base === lowerId;
8439
+ }).map(({ model }) => model));
8440
+ if (stats.remainingFraction === void 0 && !stats.resetTime) {
8441
+ const bucket = acc.quotas?.[family] ?? (family === "argon" ? acc.quotas?.google : void 0);
8442
+ const frac = typeof bucket?.remainingFraction === "number" ? bucket.remainingFraction : typeof bucket?.weeklyFraction === "number" ? bucket.weeklyFraction : void 0;
8443
+ const reset = bucket?.resetTime || bucket?.weeklyResetTime || void 0;
8444
+ stats = {
8445
+ ...frac === void 0 ? {} : { remainingFraction: frac },
8446
+ ...reset ? { resetTime: reset } : {}
8447
+ };
8448
+ }
8449
+ rows.push({
8450
+ id,
8451
+ name,
8452
+ family,
8453
+ familyLabel: familyLabelOf(family),
8454
+ efforts,
8455
+ ...stats
8456
+ });
8457
+ }
8458
+ return rows;
8459
+ }
8460
+ function projectFromQuotaFallback(acc) {
8461
+ const quotaModels = collectAccountQuotaModels(acc);
8462
+ const items = [];
8463
+ const byIdKey = /* @__PURE__ */ new Map();
8464
+ const byNameKey = /* @__PURE__ */ new Map();
8465
+ for (const { family: rawFam, model } of quotaModels) {
8466
+ const rawId = model.modelId.trim();
8467
+ if (rawId === "" || isInternalNoiseSlug(rawId)) continue;
8468
+ const { base, effort } = canonicalQuotaBaseId(rawId);
8469
+ const detected = modelFamilyOf(base);
8470
+ const family = detected !== "unknown" ? detected : rawFam;
8471
+ const cleanName = cleanFallbackDisplayName(model.displayName, base, effort);
8472
+ const idKey = `${family}::${base}`;
8473
+ const nameKey = `${family}::name::${cleanName.toLowerCase()}`;
8474
+ let item = byIdKey.get(idKey) ?? byNameKey.get(nameKey);
8475
+ if (!item) {
8476
+ item = {
8477
+ id: base,
8478
+ name: cleanName,
8479
+ family,
8480
+ efforts: /* @__PURE__ */ new Set()
8481
+ };
8482
+ items.push(item);
8483
+ } else if (item.name === item.id && cleanName !== base) item.name = cleanName;
8484
+ byIdKey.set(idKey, item);
8485
+ byNameKey.set(nameKey, item);
8486
+ if (effort) item.efforts.add(effort);
8487
+ if (typeof model.remainingFraction === "number" && Number.isFinite(model.remainingFraction)) {
8488
+ if (item.remainingFraction === void 0 || model.remainingFraction < item.remainingFraction) {
8489
+ item.remainingFraction = model.remainingFraction;
8490
+ if (model.resetTime) item.resetTime = model.resetTime;
8491
+ }
8492
+ }
8493
+ if (!item.resetTime && model.resetTime) item.resetTime = model.resetTime;
8494
+ }
8495
+ return items.map((item) => ({
8496
+ id: item.id,
8497
+ name: item.name,
8498
+ family: item.family,
8499
+ familyLabel: familyLabelOf(item.family),
8500
+ efforts: normalizeEfforts(item.efforts),
8501
+ ...item.remainingFraction === void 0 ? {} : { remainingFraction: item.remainingFraction },
8502
+ ...item.resetTime ? { resetTime: item.resetTime } : {}
8503
+ }));
8504
+ }
8505
+ /**
8506
+ * Build the exact, 0-redundancy model list to display on an account card.
8507
+ * Prefers the account's own discovered `agy models` catalog when available,
8508
+ * and falls back to deduplicating/cleaning raw REST quota rows otherwise.
8509
+ */
8510
+ function buildAccountModelRows(acc, catalogModels) {
8511
+ if (Array.isArray(catalogModels) && catalogModels.length > 0) return projectFromAuthoritativeCatalog(acc, catalogModels);
8512
+ return projectFromQuotaFallback(acc);
8513
+ }
8514
+ //#endregion
8251
8515
  //#region src/common/quota-pacing.ts
8252
8516
  /**
8253
8517
  * Compare remaining quota fraction against remaining reset window fraction.
@@ -8382,7 +8646,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8382
8646
  };
8383
8647
  }
8384
8648
  const renderLine = (t, windowName, percent, c, resetStr, windowDurationMs, rawFraction, rawReset, isRefreshing = false) => {
8385
- const isShimmer = percent < 0 || isRefreshing;
8649
+ const isShimmer = isRefreshing;
8386
8650
  const { pacing, tooltipText, showTimeMarker, markerLeftPct } = describePacing(t, windowDurationMs, resetStr, rawFraction, rawReset);
8387
8651
  return h("div", {
8388
8652
  className: "agy-quota-line",
@@ -8523,22 +8787,37 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8523
8787
  if (!state) return null;
8524
8788
  const newest = Math.max(0, ...Object.values(acc.quotas).map((q) => q?.updatedAt ?? 0));
8525
8789
  const reason = t(`quota.unavailable.${state.reason}`);
8790
+ const isCritical = state.reason === "validation_required" || state.reason === "tos_violation";
8791
+ const toneText = isCritical ? "var(--agy-quota-low-text)" : "var(--agy-quota-med-text)";
8792
+ const toneBg = isCritical ? "var(--agy-quota-low-bg)" : "var(--agy-quota-med-bg)";
8793
+ const toneBorder = isCritical ? "var(--agy-quota-low-border)" : "var(--agy-quota-med-border)";
8794
+ const actionUrl = typeof state.actionUrl === "string" && state.actionUrl.startsWith("https://") ? state.actionUrl : void 0;
8526
8795
  return h("div", {
8527
8796
  key: "agy-quota-unavailable",
8528
8797
  style: {
8529
8798
  display: "flex",
8530
8799
  alignItems: "center",
8800
+ flexWrap: "wrap",
8531
8801
  gap: "5px",
8532
8802
  margin: "2px 0 5px 0",
8533
8803
  padding: "3px 7px",
8534
8804
  borderRadius: "6px",
8535
8805
  fontSize: "11px",
8536
8806
  fontWeight: 600,
8537
- color: "var(--agy-quota-med-text)",
8538
- background: "var(--agy-quota-med-bg)",
8539
- border: "1px solid var(--agy-quota-med-border)"
8807
+ color: toneText,
8808
+ background: toneBg,
8809
+ border: `1px solid ${toneBorder}`
8540
8810
  }
8541
- }, uiIcon("alert", 10, "var(--agy-quota-med-text)"), h("span", null, `${t("quota.unavailableTitle")} · ${reason}`), newest > 0 ? h("span", { style: {
8811
+ }, uiIcon("alert", 10, toneText), h("span", null, `${t("quota.unavailableTitle")} · ${reason}`), actionUrl ? h("a", {
8812
+ href: actionUrl,
8813
+ target: "_blank",
8814
+ rel: "noopener noreferrer",
8815
+ style: {
8816
+ color: toneText,
8817
+ textDecoration: "underline",
8818
+ fontWeight: 700
8819
+ }
8820
+ }, t("quota.verifyNow")) : null, newest > 0 ? h("span", { style: {
8542
8821
  fontWeight: 500,
8543
8822
  opacity: .85
8544
8823
  } }, t("quota.unavailableSince", { time: formatSnapshotStamp(newest) })) : null);
@@ -8546,7 +8825,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8546
8825
  //#endregion
8547
8826
  //#region src/client/sections/AccountsPanel.ts
8548
8827
  function AccountsPanel(props) {
8549
- const { t, pool, accounts, loadingAction, quotaRefreshing = [], proxyInputs, setProxyInputs, editingProxyId, setEditingProxyId, expandedModels, toggleExpand, optimisticActiveId, handlers } = props;
8828
+ const { t, pool, accounts, accountModels, loadingAction, quotaRefreshing = [], proxyInputs, setProxyInputs, editingProxyId, setEditingProxyId, expandedModels, toggleExpand, optimisticActiveId, handlers } = props;
8550
8829
  const accountActionBusy = (acc, action) => loadingAction === `${action}:${acc.id}`;
8551
8830
  const renderQuotaBar = (label, familyKey, acc) => renderFamilyQuotaBar(t, label, familyKey, acc, loadingAction === "refresh:all" || loadingAction === `refresh:${acc.id}` || quotaRefreshing.includes(acc.id));
8552
8831
  const authoritativeActiveId = pool?.activeAccountId ?? pool?.lastActiveAccountId ?? pool?.activeAccountIds?.google ?? pool?.primaryAccountId;
@@ -8573,24 +8852,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8573
8852
  };
8574
8853
  const legacyDefault = acc.defaultAlias === void 0 && acc.systemHome && acc.alias === "主账号 (系统登录)";
8575
8854
  const displayAlias = acc.defaultAlias || legacyDefault ? acc.systemHome ? t("account.defaultAlias") : t("account.aliasDefault", { number: accIndex + 1 }) : acc.alias;
8576
- const allChildModels = [
8577
- ...(acc.quotas.google?.models ?? []).map((m) => ({
8578
- family: "Google",
8579
- model: m
8580
- })),
8581
- ...(acc.quotas.argon?.models ?? []).map((m) => ({
8582
- family: "Argon",
8583
- model: m
8584
- })),
8585
- ...(acc.quotas.anthropic?.models ?? []).map((m) => ({
8586
- family: "Anthropic",
8587
- model: m
8588
- })),
8589
- ...(acc.quotas.openai?.models ?? []).map((m) => ({
8590
- family: "OpenAI",
8591
- model: m
8592
- }))
8593
- ];
8855
+ const childModels = buildAccountModelRows(acc, accountModels?.[acc.id]);
8594
8856
  return h("div", {
8595
8857
  key: acc.id,
8596
8858
  className: "agy-card-hover",
@@ -8622,7 +8884,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8622
8884
  margin: "4px 0 2px 0"
8623
8885
  },
8624
8886
  onClick: () => toggleExpand(acc.id)
8625
- }, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 10), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers"))), isExpanded ? h("div", { key: "expanded-details" }, renderQuotaBar("Claude", "anthropic", acc), renderQuotaBar("GPT-OSS", "openai", acc), allChildModels.length > 0 ? renderChildModels(t, allChildModels) : null) : null), hasCooldown ? renderCooldownBanner(t, acc, loadingAction, accountActionBusy, handlers) : null, isEditingProxy ? renderProxyEditor(t, acc, pool, proxyInputs, setProxyInputs, setEditingProxyId, loadingAction, accountActionBusy, handlers) : null);
8887
+ }, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 10), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers"))), isExpanded ? h("div", { key: "expanded-details" }, renderQuotaBar("Claude", "anthropic", acc), renderQuotaBar("GPT-OSS", "openai", acc), childModels.length > 0 ? renderChildModels(t, childModels) : null) : null), hasCooldown ? renderCooldownBanner(t, acc, loadingAction, accountActionBusy, handlers) : null, isEditingProxy ? renderProxyEditor(t, acc, pool, proxyInputs, setProxyInputs, setEditingProxyId, loadingAction, accountActionBusy, handlers) : null);
8626
8888
  });
8627
8889
  }
8628
8890
  function extractActionUrl(text) {
@@ -8956,7 +9218,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8956
9218
  onClick: () => void handlers.removeAccount(acc.id, displayAlias)
8957
9219
  }, loadingAction === `remove:${acc.id}` ? Spinner() : uiIcon("trash", 11, "var(--agy-danger-text)")) : null);
8958
9220
  }
8959
- function renderChildModels(t, allChildModels) {
9221
+ function renderChildModels(t, childModels) {
8960
9222
  return h("div", { style: {
8961
9223
  marginTop: "6px",
8962
9224
  paddingTop: "6px",
@@ -8966,28 +9228,56 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8966
9228
  marginBottom: "6px",
8967
9229
  fontWeight: 600,
8968
9230
  fontSize: "11px"
8969
- } }, t("account.models")), allChildModels.map(({ family, model }) => {
8970
- const frac = model.remainingFraction ?? 1;
8971
- const pct = Math.round(frac * 100);
9231
+ } }, `${t("account.models")} (${childModels.length})`), childModels.map((model) => {
9232
+ const pct = typeof model.remainingFraction === "number" ? Math.round((model.remainingFraction ?? 0) * 100) : null;
8972
9233
  const w = formatQuotaWindow(t, model.resetTime);
8973
- const pColor = pct <= 20 ? "var(--agy-quota-low-text)" : pct <= 50 ? "var(--agy-quota-med-text)" : "var(--agy-quota-high-text)";
9234
+ const pColor = pct === null ? "var(--agy-text-secondary)" : pct <= 20 ? "var(--agy-quota-low-text)" : pct <= 50 ? "var(--agy-quota-med-text)" : "var(--agy-quota-high-text)";
9235
+ const effortTag = model.efforts.length > 0 ? model.efforts.map(effortLabel).join("/") : "";
8974
9236
  return h("div", {
8975
- key: `${family}-${model.modelId}`,
9237
+ key: `${model.family}-${model.id}`,
8976
9238
  className: "agy-submodel-row"
8977
- }, h("span", { style: {
8978
- fontWeight: 500,
8979
- color: "var(--agy-text-primary)"
8980
- } }, `[${family}] ${model.displayName || model.modelId}`), h("div", { style: {
8981
- display: "flex",
8982
- alignItems: "center",
8983
- gap: "8px"
8984
- } }, h("span", { style: {
8985
- color: pColor,
8986
- fontWeight: 700
8987
- } }, `${pct}%`), w.resetText ? h("span", { style: {
8988
- color: "var(--agy-text-tertiary)",
8989
- fontSize: "10.5px"
8990
- } }, `↻ ${w.resetText}`) : null));
9239
+ }, h("div", {
9240
+ key: "left",
9241
+ style: {
9242
+ display: "flex",
9243
+ alignItems: "center",
9244
+ gap: "6px",
9245
+ minWidth: 0,
9246
+ flexWrap: "wrap"
9247
+ }
9248
+ }, h("span", {
9249
+ key: "label",
9250
+ style: {
9251
+ fontWeight: 500,
9252
+ color: "var(--agy-text-primary)"
9253
+ }
9254
+ }, `[${model.familyLabel}] ${model.name}`), effortTag ? h("span", {
9255
+ key: "efforts",
9256
+ style: {
9257
+ color: "var(--agy-text-tertiary)",
9258
+ fontSize: "10px"
9259
+ }
9260
+ }, effortTag) : null), h("div", {
9261
+ key: "right",
9262
+ style: {
9263
+ display: "flex",
9264
+ alignItems: "center",
9265
+ gap: "8px",
9266
+ flexShrink: 0
9267
+ }
9268
+ }, pct !== null ? h("span", {
9269
+ key: "pct",
9270
+ style: {
9271
+ color: pColor,
9272
+ fontWeight: 700
9273
+ }
9274
+ }, `${pct}%`) : null, w.resetText ? h("span", {
9275
+ key: "reset",
9276
+ style: {
9277
+ color: "var(--agy-text-tertiary)",
9278
+ fontSize: "10.5px"
9279
+ }
9280
+ }, `↻ ${w.resetText}`) : null));
8991
9281
  }));
8992
9282
  }
8993
9283
  function renderCooldownBanner(t, acc, loadingAction, accountActionBusy, handlers) {
@@ -9212,6 +9502,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9212
9502
  const [editingProxyId, setEditingProxyId] = useState(null);
9213
9503
  const [expandedModels, setExpandedModels] = useState({});
9214
9504
  const [optimisticActiveId, setOptimisticActiveId] = useState(null);
9505
+ useEffect(() => {
9506
+ return acquireOverlaySuspend();
9507
+ }, []);
9215
9508
  const [, setTimeTick] = useState(0);
9216
9509
  useEffect(() => {
9217
9510
  const timer = setInterval(() => setTimeTick((n) => n + 1), 3e4);
@@ -9298,6 +9591,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9298
9591
  t,
9299
9592
  pool,
9300
9593
  accounts,
9594
+ accountModels: status.accountModels,
9301
9595
  loadingAction,
9302
9596
  quotaRefreshing: status.quotaRefreshing ?? [],
9303
9597
  proxyInputs,