dsh-agy-link 0.6.17 → 0.6.18
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 +16 -0
- package/dist/cli-image.mjs +94 -25
- package/dist/index.js +96 -26
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.18 (2026-11-11)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(catalog): the model picker shows the pool-wide model set, and dispatch routes Argon to an account that actually has it.** (thanks @Ronnoc, #95)
|
|
8
|
+
- The picker now exposes the **union** of models across enabled accounts (fallback + discovered + quota-reported), so Argon is visible whenever *some* account in the pool can serve it — not only when the currently active account can. Listing stays synchronous and side-effect-free (no probing).
|
|
9
|
+
- **Model resolution is pure again**: an earlier revision switched the active account inside `resolveModel()`; that now happens only at turn dispatch, so rendering the picker or inspecting a model can never rewrite `lastActiveAccountId`.
|
|
10
|
+
- Eligibility gained an explicit `unsupported` reason (distinct from `quota`/`cooldown`): when no enabled account has access to the family, the error says so and the hint no longer suggests a quota fix. Argon requests route via family eligibility (accounts without Argon are `unsupported` for that family).
|
|
11
|
+
|
|
12
|
+
### 中文
|
|
13
|
+
|
|
14
|
+
- **修复(目录):模型选单展示号池全集,Argon 请求路由到真正具备权限的账号。**(感谢 @Ronnoc,#95)
|
|
15
|
+
- 选单合并所有启用账号的模型(回退 + 发现 + 配额上报),只要池中有账号支持 Argon 就可见;列举仍为同步、无副作用(不探测)。
|
|
16
|
+
- **模型解析恢复纯读**:早期修订在 `resolveModel()` 里切换活动账号,现只在**请求派发**时切换,渲染选单/查看模型不会再改 `lastActiveAccountId`。
|
|
17
|
+
- 资格判定新增 `unsupported` 原因(区别于 `quota`/`cooldown`):全池都无该族权限时错误会明确说明,提示也不再误导为配额问题;Argon 请求按族资格路由。
|
|
18
|
+
|
|
3
19
|
## 0.6.17 (2026-11-11)
|
|
4
20
|
|
|
5
21
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -1295,6 +1295,11 @@ function formatBytes(n) {
|
|
|
1295
1295
|
}
|
|
1296
1296
|
//#endregion
|
|
1297
1297
|
//#region src/common/pool-types.ts
|
|
1298
|
+
/** Check if a model identifier belongs to the Gemini 4 Argon family. */
|
|
1299
|
+
function isArgonModel(modelId) {
|
|
1300
|
+
if (!modelId) return false;
|
|
1301
|
+
return modelId.trim().toLowerCase().includes("argon");
|
|
1302
|
+
}
|
|
1298
1303
|
/**
|
|
1299
1304
|
* Map a model slug to its backend quota counter family.
|
|
1300
1305
|
*
|
|
@@ -1312,6 +1317,24 @@ function modelFamilyOf(modelId) {
|
|
|
1312
1317
|
if (id.startsWith("gpt-") || id.startsWith("openai/") || id.includes("gpt-oss")) return "openai";
|
|
1313
1318
|
return "unknown";
|
|
1314
1319
|
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Determine whether a managed account has confirmed access to the Gemini 4 Argon family.
|
|
1322
|
+
*
|
|
1323
|
+
* An account qualifies for Argon when:
|
|
1324
|
+
* 1. It carries an authoritative Argon quota bucket.
|
|
1325
|
+
* 2. It has a dedicated Argon group recorded by the pool.
|
|
1326
|
+
* 3. Its Google per-model quota breakdown includes an Argon model.
|
|
1327
|
+
* 4. Or its discovered catalog includes Argon (when no negative quota breakdown is present).
|
|
1328
|
+
*/
|
|
1329
|
+
function accountHasArgon(acc, pool, catalog) {
|
|
1330
|
+
if (!acc) return false;
|
|
1331
|
+
if (acc.quotas?.argon !== void 0) return true;
|
|
1332
|
+
if (pool && typeof pool.hasDedicatedGroup === "function" && pool.hasDedicatedGroup(acc.id, "argon")) return true;
|
|
1333
|
+
if (acc.quotas?.google?.models?.some((m) => isArgonModel(m.modelId))) return true;
|
|
1334
|
+
if (Array.isArray(acc.quotas?.google?.models)) return false;
|
|
1335
|
+
if (catalog && catalog.source === "discovered") return catalog.models?.some((m) => isArgonModel(m.id)) ?? false;
|
|
1336
|
+
return false;
|
|
1337
|
+
}
|
|
1315
1338
|
function defaultPoolData() {
|
|
1316
1339
|
return {
|
|
1317
1340
|
version: 1,
|
|
@@ -2628,23 +2651,10 @@ var EventMapper = class {
|
|
|
2628
2651
|
};
|
|
2629
2652
|
//#endregion
|
|
2630
2653
|
//#region src/host/models.ts
|
|
2631
|
-
/** Check
|
|
2632
|
-
function
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
/**
|
|
2636
|
-
* Determine whether a managed account has confirmed access to the Gemini 4 Argon family.
|
|
2637
|
-
* Argon is exclusive to paid Pro/Ultra plans and returns a separate quota bucket
|
|
2638
|
-
* and/or dedicated model list from agy cli. Free/standard accounts do not have Argon.
|
|
2639
|
-
*/
|
|
2640
|
-
function accountHasArgon(acc, pool, catalog) {
|
|
2641
|
-
if (!acc) return false;
|
|
2642
|
-
if (acc.quotas?.argon !== void 0) return true;
|
|
2643
|
-
if (pool && typeof pool.hasDedicatedGroup === "function" && pool.hasDedicatedGroup(acc.id, "argon")) return true;
|
|
2644
|
-
if (acc.quotas?.google?.models?.some((m) => isArgonModel(m.modelId))) return true;
|
|
2645
|
-
if (Array.isArray(acc.quotas?.google?.models)) return false;
|
|
2646
|
-
if (catalog && catalog.source === "discovered") return catalog.models.some((m) => isArgonModel(m.id));
|
|
2647
|
-
return false;
|
|
2654
|
+
/** Check whether any enabled account in the pool has confirmed access to Argon. */
|
|
2655
|
+
function poolHasArgon(pool, catalog) {
|
|
2656
|
+
if (!pool) return false;
|
|
2657
|
+
return pool.getAccounts().filter((a) => a.enabled).some((acc) => accountHasArgon(acc, pool, catalog?.get(acc.id)));
|
|
2648
2658
|
}
|
|
2649
2659
|
/** Parse `agy models` stdout: JSON shapes first, then two-column text. */
|
|
2650
2660
|
function parseModelsOutput(stdout) {
|
|
@@ -2831,6 +2841,7 @@ function sanitizeCatalogEntries(models) {
|
|
|
2831
2841
|
}
|
|
2832
2842
|
var ModelCatalog = class ModelCatalog {
|
|
2833
2843
|
discover;
|
|
2844
|
+
fallbackDefs;
|
|
2834
2845
|
ttlMs;
|
|
2835
2846
|
onUpdate;
|
|
2836
2847
|
current;
|
|
@@ -2846,6 +2857,7 @@ var ModelCatalog = class ModelCatalog {
|
|
|
2846
2857
|
lastAttemptAt = 0;
|
|
2847
2858
|
constructor(discover, fallbackDefs, ttlMs, onUpdate) {
|
|
2848
2859
|
this.discover = discover;
|
|
2860
|
+
this.fallbackDefs = fallbackDefs;
|
|
2849
2861
|
this.ttlMs = ttlMs;
|
|
2850
2862
|
this.onUpdate = onUpdate;
|
|
2851
2863
|
this.current = {
|
|
@@ -2854,6 +2866,51 @@ var ModelCatalog = class ModelCatalog {
|
|
|
2854
2866
|
discoveredAt: 0
|
|
2855
2867
|
};
|
|
2856
2868
|
}
|
|
2869
|
+
/**
|
|
2870
|
+
* Return the complete full set of all known models across fallbacks, base
|
|
2871
|
+
* discovered catalog, per-account discovered catalogs, and quota-reported models.
|
|
2872
|
+
* Nothing is excluded, providing the true superset ("全集") for settings and manual picking.
|
|
2873
|
+
*/
|
|
2874
|
+
getAllKnownModels(accounts = []) {
|
|
2875
|
+
const list = [];
|
|
2876
|
+
const fallbacks = buildFallbackCatalog(this.fallbackDefs);
|
|
2877
|
+
for (const m of fallbacks) list.push(m);
|
|
2878
|
+
for (const m of this.current.models) list.push(m);
|
|
2879
|
+
for (const acc of accounts) {
|
|
2880
|
+
if (!acc.enabled) continue;
|
|
2881
|
+
const cat = this.accountCatalogs.get(acc.id);
|
|
2882
|
+
if (cat) for (const m of cat.models) list.push(m);
|
|
2883
|
+
if (acc.quotas) for (const fam of [
|
|
2884
|
+
"argon",
|
|
2885
|
+
"anthropic",
|
|
2886
|
+
"google"
|
|
2887
|
+
]) {
|
|
2888
|
+
const models = acc.quotas[fam]?.models;
|
|
2889
|
+
if (models?.length) {
|
|
2890
|
+
const raw = models.map((m) => ({
|
|
2891
|
+
slug: m.modelId,
|
|
2892
|
+
label: m.displayName || m.modelId
|
|
2893
|
+
}));
|
|
2894
|
+
for (const m of foldEfforts(raw)) list.push(m);
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
return list;
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Return the union of all models available across all pool accounts,
|
|
2902
|
+
* merged with discovered catalogs, per-account quota models, and fallback models.
|
|
2903
|
+
* If any enabled account in the pool has Argon access, Argon is included in the union.
|
|
2904
|
+
*/
|
|
2905
|
+
getUnion(accounts = [], pool) {
|
|
2906
|
+
if (accounts.length === 0 && !pool) return this.current.models;
|
|
2907
|
+
const all = this.getAllKnownModels(accounts);
|
|
2908
|
+
const hasAnyArgon = pool ? poolHasArgon(pool, this) : accounts.some((a) => accountHasArgon(a, pool, this.get(a.id)));
|
|
2909
|
+
return all.filter((entry) => {
|
|
2910
|
+
if (isArgonModel(entry.id) && !hasAnyArgon) return false;
|
|
2911
|
+
return true;
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2857
2914
|
get(accountId) {
|
|
2858
2915
|
if (accountId && this.accountCatalogs.has(accountId)) return this.accountCatalogs.get(accountId);
|
|
2859
2916
|
return this.current;
|
|
@@ -4909,6 +4966,10 @@ var AccountPoolManager = class {
|
|
|
4909
4966
|
}
|
|
4910
4967
|
return false;
|
|
4911
4968
|
}
|
|
4969
|
+
/** Determine whether a managed account has confirmed access to Gemini 4 Argon. */
|
|
4970
|
+
accountHasArgon(acc) {
|
|
4971
|
+
return accountHasArgon(acc, this);
|
|
4972
|
+
}
|
|
4912
4973
|
/**
|
|
4913
4974
|
* Why this account cannot serve `family` right now, or null when it can.
|
|
4914
4975
|
*
|
|
@@ -4919,6 +4980,7 @@ var AccountPoolManager = class {
|
|
|
4919
4980
|
explainIneligibility(acc, family, now = Date.now()) {
|
|
4920
4981
|
if (!acc.enabled) return "disabled";
|
|
4921
4982
|
if (acc.authRequired) return "auth";
|
|
4983
|
+
if (family === "argon" && !this.accountHasArgon(acc)) return "unsupported";
|
|
4922
4984
|
const cd = acc.cooldowns?.[family];
|
|
4923
4985
|
if (cd && cd.cooldownUntil > now) return "cooldown";
|
|
4924
4986
|
if (this.isQuotaBenched(acc, family, now)) return "quota";
|
|
@@ -30980,12 +31042,10 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
30980
31042
|
return activeId ? pool.getAccount(activeId) : void 0;
|
|
30981
31043
|
}
|
|
30982
31044
|
async listModels(_provider) {
|
|
30983
|
-
const
|
|
31045
|
+
const pool = this.deps.pool;
|
|
31046
|
+
const accounts = pool ? pool.getAccounts().filter((a) => a.enabled) : [];
|
|
30984
31047
|
const cfg = this.deps.getConfig();
|
|
30985
|
-
const
|
|
30986
|
-
let models = cat.models;
|
|
30987
|
-
if (!activeAcc || !accountHasArgon(activeAcc, this.deps.pool, cat)) models = models.filter((m) => !isArgonModel(m.id));
|
|
30988
|
-
const { entries, dropped } = sanitizeCatalogEntries(models);
|
|
31048
|
+
const { entries, dropped } = sanitizeCatalogEntries(this.deps.catalog.getUnion(accounts, pool));
|
|
30989
31049
|
if (dropped.length > 0) this.warnOnce("catalog-dupes", "model catalog contained duplicate ids [" + dropped.join(", ") + "] — kept first occurrence so DSH does not drop the whole provider group (INVALID_CATALOG)");
|
|
30990
31050
|
const hidden = new Set(cfg.hiddenModels.map((s) => s.trim()));
|
|
30991
31051
|
return entries.filter((m) => !hidden.has(m.id)).map((m) => ({
|
|
@@ -30996,12 +31056,15 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
30996
31056
|
}));
|
|
30997
31057
|
}
|
|
30998
31058
|
async resolveModel(_provider, model, _signal) {
|
|
31059
|
+
const pool = this.deps.pool;
|
|
30999
31060
|
const activeAcc = this.getActiveAccount();
|
|
31000
31061
|
const cfg = this.deps.getConfig();
|
|
31001
|
-
const
|
|
31062
|
+
const accounts = pool ? pool.getAccounts().filter((a) => a.enabled) : [];
|
|
31002
31063
|
const rawModel = typeof model === "string" ? model.trim() : "";
|
|
31003
31064
|
const cleanId = rawModel !== "" ? rawModel : cfg.defaultModel;
|
|
31004
|
-
const
|
|
31065
|
+
const unionModels = this.deps.catalog.getUnion(accounts, pool);
|
|
31066
|
+
const allModels = this.deps.catalog.getAllKnownModels(accounts);
|
|
31067
|
+
const entry = unionModels.find((m) => m.id === cleanId) ?? allModels.find((m) => m.id === cleanId) ?? findEntry(this.deps.catalog.get(activeAcc?.id), cleanId) ?? findEntry(this.deps.catalog.get(), cleanId);
|
|
31005
31068
|
const rawName = entry ? entry.name : cleanId;
|
|
31006
31069
|
const name = typeof rawName === "string" && rawName.trim() !== "" ? rawName.trim() : cleanId;
|
|
31007
31070
|
const contextWindow = typeof cfg.contextWindowDefault === "number" && cfg.contextWindowDefault > 0 ? cfg.contextWindowDefault : 2e5;
|
|
@@ -31273,6 +31336,9 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31273
31336
|
}
|
|
31274
31337
|
}
|
|
31275
31338
|
if (!account && this.deps.pool) account = this.deps.pool.selectAccount(family) ?? void 0;
|
|
31339
|
+
if (account && this.deps.pool) {
|
|
31340
|
+
if (this.deps.pool.getPoolData().lastActiveAccountId !== account.id) this.deps.pool.setActiveAccount(account.id, family);
|
|
31341
|
+
}
|
|
31276
31342
|
if (this.deps.pool && this.deps.pool.getAccounts().length > 0 && !account) {
|
|
31277
31343
|
if (cfg.autoFallbackModel) {
|
|
31278
31344
|
const familyModel = {
|
|
@@ -31304,6 +31370,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31304
31370
|
const reasons = accounts.map((a) => typeof pool.explainIneligibility === "function" ? pool.explainIneligibility(a, family) : pool.isAccountEligible(a, family) ? null : "cooldown");
|
|
31305
31371
|
const cooling = reasons.filter((r) => r === "cooldown").length;
|
|
31306
31372
|
const quotaBlocked = reasons.filter((r) => r === "quota").length;
|
|
31373
|
+
const unsupported = reasons.filter((r) => r === "unsupported").length;
|
|
31307
31374
|
const signedOut = accounts.filter((a) => a.authRequired === true).length;
|
|
31308
31375
|
const countdown = pool.getEarliestAvailableCountdown?.(family) ?? pool.getEarliestResetCountdown(family);
|
|
31309
31376
|
if (countdown !== null && countdown > 0 && countdown <= 2e4) {
|
|
@@ -31318,13 +31385,15 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31318
31385
|
const details = [];
|
|
31319
31386
|
if (cooling > 0) details.push(`${cooling} in cooldown`);
|
|
31320
31387
|
if (quotaBlocked > 0) details.push(`${quotaBlocked} quota-exhausted`);
|
|
31388
|
+
if (unsupported > 0) details.push(`${unsupported} lack ${family} access`);
|
|
31321
31389
|
if (signedOut > 0) details.push(`${signedOut} signed out`);
|
|
31322
31390
|
if (disabled > 0) details.push(`${disabled} disabled`);
|
|
31323
31391
|
const detailStr = details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
31324
31392
|
why = `no account can serve ${family} right now${detailStr}`;
|
|
31325
31393
|
}
|
|
31326
31394
|
const waitStr = countdown !== null && countdown > 0 ? ` (earliest reset in ${Math.ceil(countdown / 1e3)}s)` : "";
|
|
31327
|
-
|
|
31395
|
+
const hint = unsupported > 0 && quotaBlocked === 0 && cooling === 0 ? `No enabled account has access to ${family} (requires a plan with ${family} enabled).` : quotaBlocked > 0 && cooling === 0 ? "Add an account, wait for the quota reset, or run /agy clear-cooldown to override the current quota snapshot." : "Add an account, wait for reset, or run /agy clear-cooldown.";
|
|
31396
|
+
throw new LlmError(`All Antigravity accounts are unavailable: ${why}${waitStr}. ${hint}`, Err.AGY_ERROR);
|
|
31328
31397
|
}
|
|
31329
31398
|
}
|
|
31330
31399
|
}
|
package/dist/index.js
CHANGED
|
@@ -706,6 +706,11 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
|
|
|
706
706
|
}
|
|
707
707
|
//#endregion
|
|
708
708
|
//#region src/common/pool-types.ts
|
|
709
|
+
/** Check if a model identifier belongs to the Gemini 4 Argon family. */
|
|
710
|
+
function isArgonModel(modelId) {
|
|
711
|
+
if (!modelId) return false;
|
|
712
|
+
return modelId.trim().toLowerCase().includes("argon");
|
|
713
|
+
}
|
|
709
714
|
/**
|
|
710
715
|
* Map a model slug to its backend quota counter family.
|
|
711
716
|
*
|
|
@@ -724,6 +729,24 @@ function modelFamilyOf(modelId) {
|
|
|
724
729
|
return "unknown";
|
|
725
730
|
}
|
|
726
731
|
/**
|
|
732
|
+
* Determine whether a managed account has confirmed access to the Gemini 4 Argon family.
|
|
733
|
+
*
|
|
734
|
+
* An account qualifies for Argon when:
|
|
735
|
+
* 1. It carries an authoritative Argon quota bucket.
|
|
736
|
+
* 2. It has a dedicated Argon group recorded by the pool.
|
|
737
|
+
* 3. Its Google per-model quota breakdown includes an Argon model.
|
|
738
|
+
* 4. Or its discovered catalog includes Argon (when no negative quota breakdown is present).
|
|
739
|
+
*/
|
|
740
|
+
function accountHasArgon(acc, pool, catalog) {
|
|
741
|
+
if (!acc) return false;
|
|
742
|
+
if (acc.quotas?.argon !== void 0) return true;
|
|
743
|
+
if (pool && typeof pool.hasDedicatedGroup === "function" && pool.hasDedicatedGroup(acc.id, "argon")) return true;
|
|
744
|
+
if (acc.quotas?.google?.models?.some((m) => isArgonModel(m.modelId))) return true;
|
|
745
|
+
if (Array.isArray(acc.quotas?.google?.models)) return false;
|
|
746
|
+
if (catalog && catalog.source === "discovered") return catalog.models?.some((m) => isArgonModel(m.id)) ?? false;
|
|
747
|
+
return false;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
727
750
|
* Whether the background quota poller should touch this account at all.
|
|
728
751
|
* Disabled, auth-quarantined and cooldown accounts are skipped so automatic
|
|
729
752
|
* polling never hammers Google endpoints for accounts already known to be
|
|
@@ -2455,23 +2478,10 @@ var EventMapper = class {
|
|
|
2455
2478
|
};
|
|
2456
2479
|
//#endregion
|
|
2457
2480
|
//#region src/host/models.ts
|
|
2458
|
-
/** Check
|
|
2459
|
-
function
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
/**
|
|
2463
|
-
* Determine whether a managed account has confirmed access to the Gemini 4 Argon family.
|
|
2464
|
-
* Argon is exclusive to paid Pro/Ultra plans and returns a separate quota bucket
|
|
2465
|
-
* and/or dedicated model list from agy cli. Free/standard accounts do not have Argon.
|
|
2466
|
-
*/
|
|
2467
|
-
function accountHasArgon(acc, pool, catalog) {
|
|
2468
|
-
if (!acc) return false;
|
|
2469
|
-
if (acc.quotas?.argon !== void 0) return true;
|
|
2470
|
-
if (pool && typeof pool.hasDedicatedGroup === "function" && pool.hasDedicatedGroup(acc.id, "argon")) return true;
|
|
2471
|
-
if (acc.quotas?.google?.models?.some((m) => isArgonModel(m.modelId))) return true;
|
|
2472
|
-
if (Array.isArray(acc.quotas?.google?.models)) return false;
|
|
2473
|
-
if (catalog && catalog.source === "discovered") return catalog.models.some((m) => isArgonModel(m.id));
|
|
2474
|
-
return false;
|
|
2481
|
+
/** Check whether any enabled account in the pool has confirmed access to Argon. */
|
|
2482
|
+
function poolHasArgon(pool, catalog) {
|
|
2483
|
+
if (!pool) return false;
|
|
2484
|
+
return pool.getAccounts().filter((a) => a.enabled).some((acc) => accountHasArgon(acc, pool, catalog?.get(acc.id)));
|
|
2475
2485
|
}
|
|
2476
2486
|
/** Parse `agy models` stdout: JSON shapes first, then two-column text. */
|
|
2477
2487
|
function parseModelsOutput(stdout) {
|
|
@@ -2658,6 +2668,7 @@ function sanitizeCatalogEntries(models) {
|
|
|
2658
2668
|
}
|
|
2659
2669
|
var ModelCatalog = class ModelCatalog {
|
|
2660
2670
|
discover;
|
|
2671
|
+
fallbackDefs;
|
|
2661
2672
|
ttlMs;
|
|
2662
2673
|
onUpdate;
|
|
2663
2674
|
current;
|
|
@@ -2673,6 +2684,7 @@ var ModelCatalog = class ModelCatalog {
|
|
|
2673
2684
|
lastAttemptAt = 0;
|
|
2674
2685
|
constructor(discover, fallbackDefs, ttlMs, onUpdate) {
|
|
2675
2686
|
this.discover = discover;
|
|
2687
|
+
this.fallbackDefs = fallbackDefs;
|
|
2676
2688
|
this.ttlMs = ttlMs;
|
|
2677
2689
|
this.onUpdate = onUpdate;
|
|
2678
2690
|
this.current = {
|
|
@@ -2681,6 +2693,51 @@ var ModelCatalog = class ModelCatalog {
|
|
|
2681
2693
|
discoveredAt: 0
|
|
2682
2694
|
};
|
|
2683
2695
|
}
|
|
2696
|
+
/**
|
|
2697
|
+
* Return the complete full set of all known models across fallbacks, base
|
|
2698
|
+
* discovered catalog, per-account discovered catalogs, and quota-reported models.
|
|
2699
|
+
* Nothing is excluded, providing the true superset ("全集") for settings and manual picking.
|
|
2700
|
+
*/
|
|
2701
|
+
getAllKnownModels(accounts = []) {
|
|
2702
|
+
const list = [];
|
|
2703
|
+
const fallbacks = buildFallbackCatalog(this.fallbackDefs);
|
|
2704
|
+
for (const m of fallbacks) list.push(m);
|
|
2705
|
+
for (const m of this.current.models) list.push(m);
|
|
2706
|
+
for (const acc of accounts) {
|
|
2707
|
+
if (!acc.enabled) continue;
|
|
2708
|
+
const cat = this.accountCatalogs.get(acc.id);
|
|
2709
|
+
if (cat) for (const m of cat.models) list.push(m);
|
|
2710
|
+
if (acc.quotas) for (const fam of [
|
|
2711
|
+
"argon",
|
|
2712
|
+
"anthropic",
|
|
2713
|
+
"google"
|
|
2714
|
+
]) {
|
|
2715
|
+
const models = acc.quotas[fam]?.models;
|
|
2716
|
+
if (models?.length) {
|
|
2717
|
+
const raw = models.map((m) => ({
|
|
2718
|
+
slug: m.modelId,
|
|
2719
|
+
label: m.displayName || m.modelId
|
|
2720
|
+
}));
|
|
2721
|
+
for (const m of foldEfforts(raw)) list.push(m);
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
return list;
|
|
2726
|
+
}
|
|
2727
|
+
/**
|
|
2728
|
+
* Return the union of all models available across all pool accounts,
|
|
2729
|
+
* merged with discovered catalogs, per-account quota models, and fallback models.
|
|
2730
|
+
* If any enabled account in the pool has Argon access, Argon is included in the union.
|
|
2731
|
+
*/
|
|
2732
|
+
getUnion(accounts = [], pool) {
|
|
2733
|
+
if (accounts.length === 0 && !pool) return this.current.models;
|
|
2734
|
+
const all = this.getAllKnownModels(accounts);
|
|
2735
|
+
const hasAnyArgon = pool ? poolHasArgon(pool, this) : accounts.some((a) => accountHasArgon(a, pool, this.get(a.id)));
|
|
2736
|
+
return all.filter((entry) => {
|
|
2737
|
+
if (isArgonModel(entry.id) && !hasAnyArgon) return false;
|
|
2738
|
+
return true;
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2684
2741
|
get(accountId) {
|
|
2685
2742
|
if (accountId && this.accountCatalogs.has(accountId)) return this.accountCatalogs.get(accountId);
|
|
2686
2743
|
return this.current;
|
|
@@ -4976,6 +5033,10 @@ var AccountPoolManager = class {
|
|
|
4976
5033
|
}
|
|
4977
5034
|
return false;
|
|
4978
5035
|
}
|
|
5036
|
+
/** Determine whether a managed account has confirmed access to Gemini 4 Argon. */
|
|
5037
|
+
accountHasArgon(acc) {
|
|
5038
|
+
return accountHasArgon(acc, this);
|
|
5039
|
+
}
|
|
4979
5040
|
/**
|
|
4980
5041
|
* Why this account cannot serve `family` right now, or null when it can.
|
|
4981
5042
|
*
|
|
@@ -4986,6 +5047,7 @@ var AccountPoolManager = class {
|
|
|
4986
5047
|
explainIneligibility(acc, family, now = Date.now()) {
|
|
4987
5048
|
if (!acc.enabled) return "disabled";
|
|
4988
5049
|
if (acc.authRequired) return "auth";
|
|
5050
|
+
if (family === "argon" && !this.accountHasArgon(acc)) return "unsupported";
|
|
4989
5051
|
const cd = acc.cooldowns?.[family];
|
|
4990
5052
|
if (cd && cd.cooldownUntil > now) return "cooldown";
|
|
4991
5053
|
if (this.isQuotaBenched(acc, family, now)) return "quota";
|
|
@@ -31296,12 +31358,10 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31296
31358
|
return activeId ? pool.getAccount(activeId) : void 0;
|
|
31297
31359
|
}
|
|
31298
31360
|
async listModels(_provider) {
|
|
31299
|
-
const
|
|
31361
|
+
const pool = this.deps.pool;
|
|
31362
|
+
const accounts = pool ? pool.getAccounts().filter((a) => a.enabled) : [];
|
|
31300
31363
|
const cfg = this.deps.getConfig();
|
|
31301
|
-
const
|
|
31302
|
-
let models = cat.models;
|
|
31303
|
-
if (!activeAcc || !accountHasArgon(activeAcc, this.deps.pool, cat)) models = models.filter((m) => !isArgonModel(m.id));
|
|
31304
|
-
const { entries, dropped } = sanitizeCatalogEntries(models);
|
|
31364
|
+
const { entries, dropped } = sanitizeCatalogEntries(this.deps.catalog.getUnion(accounts, pool));
|
|
31305
31365
|
if (dropped.length > 0) this.warnOnce("catalog-dupes", "model catalog contained duplicate ids [" + dropped.join(", ") + "] — kept first occurrence so DSH does not drop the whole provider group (INVALID_CATALOG)");
|
|
31306
31366
|
const hidden = new Set(cfg.hiddenModels.map((s) => s.trim()));
|
|
31307
31367
|
return entries.filter((m) => !hidden.has(m.id)).map((m) => ({
|
|
@@ -31312,12 +31372,15 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31312
31372
|
}));
|
|
31313
31373
|
}
|
|
31314
31374
|
async resolveModel(_provider, model, _signal) {
|
|
31375
|
+
const pool = this.deps.pool;
|
|
31315
31376
|
const activeAcc = this.getActiveAccount();
|
|
31316
31377
|
const cfg = this.deps.getConfig();
|
|
31317
|
-
const
|
|
31378
|
+
const accounts = pool ? pool.getAccounts().filter((a) => a.enabled) : [];
|
|
31318
31379
|
const rawModel = typeof model === "string" ? model.trim() : "";
|
|
31319
31380
|
const cleanId = rawModel !== "" ? rawModel : cfg.defaultModel;
|
|
31320
|
-
const
|
|
31381
|
+
const unionModels = this.deps.catalog.getUnion(accounts, pool);
|
|
31382
|
+
const allModels = this.deps.catalog.getAllKnownModels(accounts);
|
|
31383
|
+
const entry = unionModels.find((m) => m.id === cleanId) ?? allModels.find((m) => m.id === cleanId) ?? findEntry(this.deps.catalog.get(activeAcc?.id), cleanId) ?? findEntry(this.deps.catalog.get(), cleanId);
|
|
31321
31384
|
const rawName = entry ? entry.name : cleanId;
|
|
31322
31385
|
const name = typeof rawName === "string" && rawName.trim() !== "" ? rawName.trim() : cleanId;
|
|
31323
31386
|
const contextWindow = typeof cfg.contextWindowDefault === "number" && cfg.contextWindowDefault > 0 ? cfg.contextWindowDefault : 2e5;
|
|
@@ -31589,6 +31652,9 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31589
31652
|
}
|
|
31590
31653
|
}
|
|
31591
31654
|
if (!account && this.deps.pool) account = this.deps.pool.selectAccount(family) ?? void 0;
|
|
31655
|
+
if (account && this.deps.pool) {
|
|
31656
|
+
if (this.deps.pool.getPoolData().lastActiveAccountId !== account.id) this.deps.pool.setActiveAccount(account.id, family);
|
|
31657
|
+
}
|
|
31592
31658
|
if (this.deps.pool && this.deps.pool.getAccounts().length > 0 && !account) {
|
|
31593
31659
|
if (cfg.autoFallbackModel) {
|
|
31594
31660
|
const familyModel = {
|
|
@@ -31620,6 +31686,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31620
31686
|
const reasons = accounts.map((a) => typeof pool.explainIneligibility === "function" ? pool.explainIneligibility(a, family) : pool.isAccountEligible(a, family) ? null : "cooldown");
|
|
31621
31687
|
const cooling = reasons.filter((r) => r === "cooldown").length;
|
|
31622
31688
|
const quotaBlocked = reasons.filter((r) => r === "quota").length;
|
|
31689
|
+
const unsupported = reasons.filter((r) => r === "unsupported").length;
|
|
31623
31690
|
const signedOut = accounts.filter((a) => a.authRequired === true).length;
|
|
31624
31691
|
const countdown = pool.getEarliestAvailableCountdown?.(family) ?? pool.getEarliestResetCountdown(family);
|
|
31625
31692
|
if (countdown !== null && countdown > 0 && countdown <= 2e4) {
|
|
@@ -31634,13 +31701,15 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31634
31701
|
const details = [];
|
|
31635
31702
|
if (cooling > 0) details.push(`${cooling} in cooldown`);
|
|
31636
31703
|
if (quotaBlocked > 0) details.push(`${quotaBlocked} quota-exhausted`);
|
|
31704
|
+
if (unsupported > 0) details.push(`${unsupported} lack ${family} access`);
|
|
31637
31705
|
if (signedOut > 0) details.push(`${signedOut} signed out`);
|
|
31638
31706
|
if (disabled > 0) details.push(`${disabled} disabled`);
|
|
31639
31707
|
const detailStr = details.length > 0 ? ` (${details.join(", ")})` : "";
|
|
31640
31708
|
why = `no account can serve ${family} right now${detailStr}`;
|
|
31641
31709
|
}
|
|
31642
31710
|
const waitStr = countdown !== null && countdown > 0 ? ` (earliest reset in ${Math.ceil(countdown / 1e3)}s)` : "";
|
|
31643
|
-
|
|
31711
|
+
const hint = unsupported > 0 && quotaBlocked === 0 && cooling === 0 ? `No enabled account has access to ${family} (requires a plan with ${family} enabled).` : quotaBlocked > 0 && cooling === 0 ? "Add an account, wait for the quota reset, or run /agy clear-cooldown to override the current quota snapshot." : "Add an account, wait for reset, or run /agy clear-cooldown.";
|
|
31712
|
+
throw new LlmError(`All Antigravity accounts are unavailable: ${why}${waitStr}. ${hint}`, Err.AGY_ERROR);
|
|
31644
31713
|
}
|
|
31645
31714
|
}
|
|
31646
31715
|
}
|
|
@@ -37706,6 +37775,7 @@ function apply(ctx, entryConfig = {}) {
|
|
|
37706
37775
|
(async () => {
|
|
37707
37776
|
const cfg = getConfig();
|
|
37708
37777
|
const cat = catalog.get();
|
|
37778
|
+
const allKnown = catalog.getAllKnownModels(pool.getAccounts());
|
|
37709
37779
|
sendJson(res, 200, {
|
|
37710
37780
|
plugin: "dsh-agy-link",
|
|
37711
37781
|
bin: bin(),
|
|
@@ -37725,7 +37795,7 @@ function apply(ctx, entryConfig = {}) {
|
|
|
37725
37795
|
count: cat.models.length,
|
|
37726
37796
|
lastError: cat.lastError ?? null
|
|
37727
37797
|
},
|
|
37728
|
-
catalogModels: sanitizeCatalogEntries(
|
|
37798
|
+
catalogModels: sanitizeCatalogEntries(allKnown).entries,
|
|
37729
37799
|
hiddenModels: cfg.hiddenModels,
|
|
37730
37800
|
autoWarmup: cfg.autoWarmup,
|
|
37731
37801
|
warmupModels: cfg.warmupModels,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
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",
|