dsh-agy-link 0.6.52 → 0.6.53

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,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.53 (2026-11-21)
4
+
5
+ ### English
6
+
7
+ - **Feat(settings): the model list becomes a tick-list over the real selectable universe (merges PR #149, closes #131).** The "Model visibility" block was a deny-list of chips fed only by `agy models`, so a host without the CLI offered the 7 static fallback rows while the account pool already knew that account could run 23+ models — the picker looked broken.
8
+ - **Ticking writes an allow-list.** `selectedModels` (`POST /config`, `DSH_AGY_SELECTED_MODELS`) is applied after `hiddenModels`, so a denied model stays denied (and its chip says why). An empty selection still means "no restriction", which keeps the shipped default byte-for-byte and makes unticking the last model unable to blank the picker.
9
+ - **New pure module `src/domain/models/quota-catalog.ts`** folds `accounts[].quotas.<family>.models[]` into catalog entries (same effort-folding rules as the CLI list) and merges them into whatever `agy models` discovered — CLI order and naming stay authoritative, quota rows only contribute models the catalog never mentioned. `/status` scopes this to the active account (or the whole pool under `poolWideCatalog`) and echoes `selectedModels`; model resolution merges the same way so a quota-only model still resolves.
10
+ - **Resolution is deliberately NOT filtered**: a session already running a model the user later untickes keeps resolving it — unticking must not break in-flight work. Only `listModels` (the picker) filters.
11
+ - Merge note: the PR's inline config validation was replaced by the unified `validateConfigValue()` that landed in v0.6.52, extended to cover `selectedModels`, and the maintainer-owned `CHANGELOG.md`/`package.json` were kept.
12
+
13
+ ### 中文
14
+
15
+ - **特性(设置):模型列表改为「真实可选集合」的勾选清单(合并 PR #149,关闭 #131)。** 原「模型可见性」是只由 `agy models` 供数的**拒绝清单**,于是没有 CLI 的宿主只列出 7 条静态兜底、而账号池其实知道该账号能跑 23+ 个模型——选择器看起来像坏了。
16
+ - **勾选写入允许清单。** `selectedModels`(`POST /config`、`DSH_AGY_SELECTED_MODELS`)在 `hiddenModels` **之后**应用,因此被拒绝的模型仍然隐藏(chip 会说明原因);空选择仍表示「无限制」,默认配置逐字节不变,也不会因为取消最后一个勾选而把选择器清空。
17
+ - **新增纯模块 `src/domain/models/quota-catalog.ts`**:把 `accounts[].quotas.<family>.models[]` 折叠成目录条目(与 CLI 列表同一套 effort 折叠规则),再并入 `agy models` 的结果——CLI 的顺序与命名保持权威,配额行只贡献目录里从未出现的模型。`/status` 按活跃账号(或 `poolWideCatalog` 下的整池)限定范围并回显 `selectedModels`;模型解析同样合并,使「只有配额快照才知道」的模型仍可解析。
18
+ - **解析刻意不做过滤**:用户后来取消勾选的模型,已在运行的会话仍能解析——取消勾选不得打断进行中的工作。只有 `listModels`(选择器)过滤。
19
+ - 合并说明:PR 内联的配置校验已替换为 v0.6.52 引入的统一 `validateConfigValue()` 并补充 `selectedModels`;维护者自有的 `CHANGELOG.md`/`package.json` 保持。
20
+
3
21
  ## 0.6.52 (2026-11-21)
4
22
 
5
23
  ### English
@@ -141,6 +141,7 @@ function defaultConfig() {
141
141
  workspaceRoot: "",
142
142
  fallbackModels: DEFAULT_FALLBACK_MODELS,
143
143
  hiddenModels: [],
144
+ selectedModels: [],
144
145
  askTool: false,
145
146
  mediaDir: "",
146
147
  mediaTtlMs: 864e5,
@@ -606,6 +607,7 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
606
607
  workspaceRoot: asString(get("workspaceRoot")) ?? base.workspaceRoot,
607
608
  fallbackModels: Array.isArray(get("fallbackModels")) ? get("fallbackModels").filter((x) => !!x && typeof x === "object" && typeof x.id === "string") : base.fallbackModels,
608
609
  hiddenModels: asStringArray(get("hiddenModels")) ?? base.hiddenModels,
610
+ selectedModels: asStringArray(get("selectedModels")) ?? base.selectedModels,
609
611
  askTool: asBool(get("askTool")) ?? base.askTool,
610
612
  mediaDir: asString(get("mediaDir")) ?? base.mediaDir,
611
613
  mediaTtlMs: asNum(get("mediaTtlMs")) ?? base.mediaTtlMs,
@@ -687,6 +689,10 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
687
689
  const list = asStringArray(env.DSH_AGY_HIDDEN_MODELS.split(","));
688
690
  if (list) cfg.hiddenModels = list;
689
691
  }
692
+ if (env.DSH_AGY_SELECTED_MODELS) {
693
+ const list = asStringArray(env.DSH_AGY_SELECTED_MODELS.split(","));
694
+ if (list && list.length > 0) cfg.selectedModels = list;
695
+ }
690
696
  if (env.DSH_AGY_WORKSPACE_ROOT) cfg.workspaceRoot = env.DSH_AGY_WORKSPACE_ROOT;
691
697
  if (env.DSH_AGY_MEDIA_DIR) cfg.mediaDir = env.DSH_AGY_MEDIA_DIR;
692
698
  if (env.DSH_AGY_MEDIA_TTL_MS) {
@@ -5980,6 +5986,136 @@ var ModelCatalog = class ModelCatalog {
5980
5986
  }
5981
5987
  };
5982
5988
  //#endregion
5989
+ //#region src/domain/models/quota-catalog.ts
5990
+ /** Families whose quota rows describe models the picker may offer. */
5991
+ const QUOTA_FAMILIES = [
5992
+ "google",
5993
+ "argon",
5994
+ "anthropic",
5995
+ "openai"
5996
+ ];
5997
+ /**
5998
+ * Models an account's quota snapshot says are available.
5999
+ *
6000
+ * `displayName` is preferred over the raw slug for the label (agy's quota rows
6001
+ * say "Gemini 4 Neon (Low)", the picker should not show `gemini-4-neon-low`).
6002
+ * Rows without a usable `modelId` are skipped rather than guessed at.
6003
+ */
6004
+ function quotaModelsForAccount(account) {
6005
+ const quotas = account?.quotas;
6006
+ if (!quotas) return [];
6007
+ const out = [];
6008
+ const seen = /* @__PURE__ */ new Set();
6009
+ for (const family of QUOTA_FAMILIES) {
6010
+ const rows = quotas[family]?.models;
6011
+ if (!Array.isArray(rows)) continue;
6012
+ for (const row of rows) {
6013
+ if (!row || typeof row.modelId !== "string") continue;
6014
+ const slug = row.modelId.trim();
6015
+ if (slug === "" || seen.has(slug)) continue;
6016
+ seen.add(slug);
6017
+ const label = typeof row.displayName === "string" && row.displayName.trim() !== "" ? row.displayName.trim() : slug;
6018
+ out.push({
6019
+ slug,
6020
+ label
6021
+ });
6022
+ }
6023
+ }
6024
+ return out;
6025
+ }
6026
+ /** Same as {@link quotaModelsForAccount}, folded into picker entries. */
6027
+ function quotaCatalogForAccount(account) {
6028
+ return foldEfforts(quotaModelsForAccount(account));
6029
+ }
6030
+ /**
6031
+ * Merge the CLI-discovered catalog with quota-derived entries.
6032
+ *
6033
+ * Precedence: a discovered entry wins on IDENTITY and ORDER (agy is
6034
+ * authoritative about what it can run and in which order it lists models), but
6035
+ * a quota row may CONTRIBUTE a model the catalog never mentioned — that is the
6036
+ * whole point of the merge: on a CLI-less host the catalog is a 7-row fallback
6037
+ * and the account knows about 23+ real models.
6038
+ *
6039
+ * Effort sets are unioned so a folded catalog entry (`gemini-4-neon` with
6040
+ * low/medium/high) keeps any extra level only the quota rows knew about.
6041
+ */
6042
+ function mergeCatalogWithQuotaModels(discovered, quota) {
6043
+ if (quota.length === 0) return [...discovered];
6044
+ const merged = [];
6045
+ const byId = /* @__PURE__ */ new Map();
6046
+ const index = /* @__PURE__ */ new Map();
6047
+ const add = (entry, allowOverrideName) => {
6048
+ const existingAt = index.get(entry.id);
6049
+ if (existingAt === void 0) {
6050
+ index.set(entry.id, merged.length);
6051
+ byId.set(entry.id, entry);
6052
+ merged.push(entry);
6053
+ return;
6054
+ }
6055
+ const existing = byId.get(entry.id);
6056
+ if (!existing) return;
6057
+ const efforts = unionEfforts(existing.efforts, entry.efforts);
6058
+ const name = allowOverrideName && existing.name === existing.id && entry.name !== entry.id ? entry.name : existing.name;
6059
+ const next = {
6060
+ id: existing.id,
6061
+ name,
6062
+ efforts
6063
+ };
6064
+ byId.set(entry.id, next);
6065
+ merged[existingAt] = next;
6066
+ };
6067
+ for (const entry of discovered) add(entry, false);
6068
+ for (const entry of quota) add(entry, true);
6069
+ return disambiguateLabels(merged);
6070
+ }
6071
+ /**
6072
+ * Make sure no two rows render under the same label.
6073
+ *
6074
+ * The quota snapshot is not above this. On a current pool `gemini-2.5-flash`,
6075
+ * `gemini-2.5-flash-lite`, `gemini-2.5-flash-thinking` and
6076
+ * `gemini-3.5-flash-lite` ALL report "Gemini 3.5 Flash Lite" (upstream keeps the
6077
+ * legacy slugs pointing at the current model), and effort-folding makes
6078
+ * `gemini-4-hydrogen-tiered` inherit "Gemini 4 Hydrogen" from its `(High)`
6079
+ * siblings. Identical chips are unusable — the user cannot tell which box ticks
6080
+ * what.
6081
+ *
6082
+ * Resolution is not "first wins", it is a stem test: a colliding row keeps its
6083
+ * label only when every other row in the group is an ID-DERIVED VARIANT of it
6084
+ * (`<id>-<something>`). That keeps "Gemini 4 Hydrogen" on the base model and
6085
+ * demotes `-tiered`/`-sonar`, while a group of genuinely different models (the
6086
+ * 2.5/3.5 legacy aliases) has no stem and every row falls back to its id — which
6087
+ * is unique by construction and is what the picker sends back anyway.
6088
+ */
6089
+ function disambiguateLabels(entries) {
6090
+ const groups = /* @__PURE__ */ new Map();
6091
+ for (const entry of entries) {
6092
+ const bucket = groups.get(entry.name);
6093
+ if (bucket) bucket.push(entry);
6094
+ else groups.set(entry.name, [entry]);
6095
+ }
6096
+ const keep = /* @__PURE__ */ new Set();
6097
+ for (const rows of groups.values()) {
6098
+ if (rows.length === 1) continue;
6099
+ const stem = rows.find((candidate) => candidate.name !== candidate.id && rows.every((other) => other === candidate || other.id.startsWith(candidate.id + "-")));
6100
+ if (stem) keep.add(stem.id);
6101
+ }
6102
+ return entries.map((entry) => {
6103
+ if (entry.name === entry.id) return entry;
6104
+ if ((groups.get(entry.name) ?? []).length <= 1) return entry;
6105
+ return keep.has(entry.id) ? entry : {
6106
+ ...entry,
6107
+ name: entry.id
6108
+ };
6109
+ });
6110
+ }
6111
+ function unionEfforts(a, b) {
6112
+ const left = a ?? [];
6113
+ const right = b ?? [];
6114
+ if (right.length === 0) return a;
6115
+ if (left.length === 0) return b;
6116
+ return (/* @__PURE__ */ new Set([...left, ...right])).size === left.length ? a : [...left, ...right.filter((e) => !left.includes(e))];
6117
+ }
6118
+ //#endregion
5983
6119
  //#region src/provider/model-resolution.ts
5984
6120
  function activeAccount(deps) {
5985
6121
  const pool = deps.pool;
@@ -5999,14 +6135,73 @@ function listAvailableModels(deps) {
5999
6135
  } else models = deps.catalog.getUnion(accounts, pool);
6000
6136
  const { entries, dropped } = sanitizeCatalogEntries(models);
6001
6137
  if (dropped.length > 0) deps.warnOnce("catalog-dupes", "model catalog contained duplicate ids [" + dropped.join(", ") + "] — kept first occurrence so DSH does not drop the whole provider group (INVALID_CATALOG)");
6002
- const hidden = new Set(cfg.hiddenModels.map((s) => s.trim()));
6003
- return entries.filter((m) => !hidden.has(m.id)).map((m) => ({
6138
+ return visibleEntries(entries, quotaScopeAccounts(pool, accounts, activeAcc, cfg.poolWideCatalog), cfg).map((m) => ({
6004
6139
  provider: PROVIDER_ID,
6005
6140
  id: m.id,
6006
6141
  name: m.name,
6007
6142
  inputModalities: ["text", "image"]
6008
6143
  }));
6009
6144
  }
6145
+ /**
6146
+ * Accounts whose quota snapshots describe models the picker may offer.
6147
+ *
6148
+ * Narrow mode (default) describes ONE account — the same account whose `agy
6149
+ * models` catalog the picker is showing, so the two sources never contradict
6150
+ * each other. Pool-wide mode describes every enabled account because the
6151
+ * scheduler can route to any of them (issue #107).
6152
+ */
6153
+ function quotaScopeAccounts(pool, accounts, activeAcc, poolWide) {
6154
+ if (!pool) return [];
6155
+ if (poolWide) return accounts;
6156
+ if (activeAcc) return [activeAcc];
6157
+ return accounts.slice(0, 1);
6158
+ }
6159
+ /**
6160
+ * Fold quota-derived models into the catalog and apply BOTH visibility filters.
6161
+ *
6162
+ * Quota rows are merged in because a host without the agy CLI only ever has the
6163
+ * static fallback catalog, while every quota refresh already stored the real
6164
+ * per-account model list — that list is what makes the picker useful at all
6165
+ * (issue #131). Merge, don't replace: `agy models` stays authoritative for the
6166
+ * models it knows about.
6167
+ *
6168
+ * Visibility order is allow-list THEN deny-list: `selectedModels` is the
6169
+ * checkbox state the settings panel writes, `hiddenModels` remains the older
6170
+ * deny-list (env/config escape hatch) and still wins on a conflict so an
6171
+ * operator can hide a model without editing the selection.
6172
+ */
6173
+ function visibleEntries(entries, quotaScope, cfg) {
6174
+ const merged = mergeCatalogWithQuotaModels(entries, quotaCatalogForAccounts(quotaScope));
6175
+ const selected = cfg.selectedModels.map((s) => s.trim()).filter((s) => s !== "");
6176
+ const hidden = new Set(cfg.hiddenModels.map((s) => s.trim()));
6177
+ return merged.filter((m) => (selected.length === 0 || isSelected(m.id, selected)) && !hidden.has(m.id));
6178
+ }
6179
+ /**
6180
+ * Whether a stored selection still covers a catalog row.
6181
+ *
6182
+ * Selections are persisted, and catalog rows are not stable: effort variants
6183
+ * (`gemini-4-hydrogen-tiered`) fold into their base row (`gemini-4-hydrogen`)
6184
+ * once the CLI or a quota snapshot reports the family, and the base row then
6185
+ * carries the effort as a flag instead of an id. Matching by exact id only
6186
+ * would turn every such row into a stale entry that silently hides the base
6187
+ * model - the user ticked it, the panel shows nothing, and nothing on screen
6188
+ * explains why. `modelMatches` degrades an effort-suffixed / aliased id to its
6189
+ * base slug, so a selection made before a fold keeps selecting the same model.
6190
+ */
6191
+ function isSelected(id, selected) {
6192
+ return selected.some((want) => modelMatches(want, id));
6193
+ }
6194
+ /** Union of the quota-derived catalogs of several accounts, first label wins. */
6195
+ function quotaCatalogForAccounts(accounts) {
6196
+ const out = [];
6197
+ const seen = /* @__PURE__ */ new Set();
6198
+ for (const acc of accounts) for (const entry of quotaCatalogForAccount(acc)) {
6199
+ if (seen.has(entry.id)) continue;
6200
+ seen.add(entry.id);
6201
+ out.push(entry);
6202
+ }
6203
+ return out;
6204
+ }
6010
6205
  function resolveModelInfo(deps, model) {
6011
6206
  const pool = deps.pool;
6012
6207
  const activeAcc = activeAccount(deps);
@@ -6016,7 +6211,7 @@ function resolveModelInfo(deps, model) {
6016
6211
  const cleanId = rawModel !== "" ? rawModel : cfg.defaultModel;
6017
6212
  const unionModels = deps.catalog.getUnion(accounts, pool);
6018
6213
  const allModels = deps.catalog.getAllKnownModels(accounts);
6019
- const entry = unionModels.find((m) => m.id === cleanId) ?? allModels.find((m) => m.id === cleanId) ?? findEntry(deps.catalog.get(activeAcc?.id), cleanId) ?? findEntry(deps.catalog.get(), cleanId);
6214
+ const entry = unionModels.find((m) => m.id === cleanId) ?? allModels.find((m) => m.id === cleanId) ?? findEntry(deps.catalog.get(activeAcc?.id), cleanId) ?? findEntry(deps.catalog.get(), cleanId) ?? quotaCatalogForAccounts(quotaScopeAccounts(pool, accounts, activeAcc, cfg.poolWideCatalog)).find((m) => m.id === cleanId);
6020
6215
  const rawName = entry ? entry.name : cleanId;
6021
6216
  const name = typeof rawName === "string" && rawName.trim() !== "" ? rawName.trim() : cleanId;
6022
6217
  const contextWindow = typeof cfg.contextWindowDefault === "number" && cfg.contextWindowDefault > 0 ? cfg.contextWindowDefault : 2e5;
package/dist/client.js CHANGED
@@ -156,9 +156,10 @@ window.__ModuleLoader__.load({
156
156
  "pool.label": "号池调度:",
157
157
  "pool.sequential": "顺次耗尽",
158
158
  "pool.roundRobin": "轮询均衡",
159
- "models.label": "模型显示:",
159
+ "models.label": "模型显示(已选 {selected} / {total}):",
160
160
  "models.empty": "模型目录还没有可用模型,发一次对话或点“刷新额度”后再来管理",
161
- "models.hint": "点击切换显示/隐藏;关闭的模型不在模型选择器中列出,进行中的会话不受影响。",
161
+ "models.deniedHint": "该模型被 hiddenModels 黑名单禁用,勾选也不会出现在模型选择器中。",
162
+ "models.hint": "点击勾选要显示的模型;一个都不勾表示全部显示。进行中的会话不受影响。",
162
163
  "header.refreshQuota": "刷新额度",
163
164
  "header.refreshing": "刷新中",
164
165
  "console.close": "关闭(Esc)",
@@ -393,9 +394,10 @@ window.__ModuleLoader__.load({
393
394
  "pool.label": "Account-pool scheduling:",
394
395
  "pool.sequential": "Use sequentially",
395
396
  "pool.roundRobin": "Round-robin",
396
- "models.label": "Model visibility:",
397
+ "models.label": "Model visibility ({selected} of {total} selected):",
397
398
  "models.empty": "No models in the catalog yet — send a message or click \"Refresh quota\", then come back to manage them",
398
- "models.hint": "Click to show/hide. Hidden models are not listed in the model picker; ongoing sessions are unaffected.",
399
+ "models.deniedHint": "This model is blocked by the hiddenModels deny-list; ticking it will not add it to the picker.",
400
+ "models.hint": "Click to tick the models to show; ticking none shows them all. Ongoing sessions are unaffected.",
399
401
  "header.refreshQuota": "Refresh quota",
400
402
  "header.refreshing": "Refreshing...",
401
403
  "console.close": "Close (Esc)",
@@ -630,9 +632,10 @@ window.__ModuleLoader__.load({
630
632
  "pool.label": "Agendamento do pool de contas:",
631
633
  "pool.sequential": "Usar em sequência",
632
634
  "pool.roundRobin": "Rodízio",
633
- "models.label": "Visibilidade dos modelos:",
635
+ "models.label": "Visibilidade dos modelos ({selected} de {total} selecionados):",
634
636
  "models.empty": "Ainda não há modelos no catálogo — envie uma mensagem ou clique em \"Atualizar cota\" e volte para gerenciá-los",
635
- "models.hint": "Clique para mostrar/ocultar. Modelos ocultos não aparecem no seletor de modelos; as sessões em andamento não são afetadas.",
637
+ "models.deniedHint": "Este modelo está bloqueado pela lista hiddenModels; marcá-lo não o adicionará ao seletor.",
638
+ "models.hint": "Clique para marcar os modelos que deseja exibir; sem nenhum marcado, todos aparecem. As sessões em andamento não são afetadas.",
636
639
  "header.refreshQuota": "Atualizar cota",
637
640
  "header.refreshing": "Atualizando...",
638
641
  "console.close": "Fechar (Esc)",
@@ -867,9 +870,10 @@ window.__ModuleLoader__.load({
867
870
  "pool.label": "Programación del pool de cuentas:",
868
871
  "pool.sequential": "Usar en secuencia",
869
872
  "pool.roundRobin": "Turno rotativo",
870
- "models.label": "Visibilidad de modelos:",
873
+ "models.label": "Visibilidad de modelos ({selected} de {total} seleccionados):",
871
874
  "models.empty": "Aún no hay modelos en el catálogo: envía un mensaje o haz clic en \"Actualizar cuota\" y vuelve para gestionarlos",
872
- "models.hint": "Haz clic para mostrar/ocultar. Los modelos ocultos no aparecen en el selector de modelos; las sesiones en curso no se ven afectadas.",
875
+ "models.deniedHint": "Este modelo está bloqueado por la lista hiddenModels; marcarlo no lo añadirá al selector.",
876
+ "models.hint": "Haz clic para marcar los modelos que quieres ver; sin ninguno marcado se muestran todos. Las sesiones en curso no se ven afectadas.",
873
877
  "header.refreshQuota": "Actualizar cuota",
874
878
  "header.refreshing": "Actualizando...",
875
879
  "console.close": "Cerrar (Esc)",
@@ -8138,6 +8142,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8138
8142
  //#region src/client/hooks/useConfig.ts
8139
8143
  function useConfig({ status, refresh, showToast, setLoadingAction, t }) {
8140
8144
  const hiddenPendingRef = useRef(null);
8145
+ const selectedPendingRef = useRef(null);
8141
8146
  const actionFailed = () => {
8142
8147
  showToast(t("api.genericError"), "error");
8143
8148
  };
@@ -8163,6 +8168,27 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8163
8168
  if (hiddenPendingRef.current === next) hiddenPendingRef.current = null;
8164
8169
  }
8165
8170
  };
8171
+ /**
8172
+ * Replace the picker-facing allow-list in ONE write.
8173
+ *
8174
+ * An EMPTY list means "no restriction" (every model shows) — that is the
8175
+ * shipped default, and it is also why the panel computes the whole next set
8176
+ * itself instead of toggling one id at a time: leaving "no restriction"
8177
+ * state requires knowing what was implicitly visible.
8178
+ *
8179
+ * The PENDING array is written before the request and read by rapid
8180
+ * follow-up clicks, so two fast clicks compose instead of the second
8181
+ * overwriting the first with a stale snapshot.
8182
+ */
8183
+ const setSelectedModels = async (ids) => {
8184
+ const next = [...ids];
8185
+ selectedPendingRef.current = next;
8186
+ try {
8187
+ await setCfg("selectedModels", next);
8188
+ } finally {
8189
+ if (selectedPendingRef.current === next) selectedPendingRef.current = null;
8190
+ }
8191
+ };
8166
8192
  const setMode = async (mode) => {
8167
8193
  setLoadingAction(`mode:${mode}`);
8168
8194
  const res = await postPool("mode", { mode });
@@ -8177,6 +8203,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8177
8203
  return {
8178
8204
  setCfg,
8179
8205
  toggleModelHidden,
8206
+ setSelectedModels,
8180
8207
  setMode
8181
8208
  };
8182
8209
  }
@@ -8377,6 +8404,28 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
8377
8404
  if (id.startsWith("gpt-") || id.startsWith("openai/") || id.includes("gpt-oss")) return "openai";
8378
8405
  return "unknown";
8379
8406
  }
8407
+ const EFFORT_SUFFIX_RE = /-(?:tiered-)?(?:low|medium|high|xhigh|tiered|thinking)$/i;
8408
+ /**
8409
+ * Return the un-tiered base model slug (e.g. claude-opus-4-6-thinking -> claude-opus-4-6,
8410
+ * claude-opus-5-5-high -> claude-opus-5-5).
8411
+ */
8412
+ function baseModelSlug(id) {
8413
+ const s = id.trim().toLowerCase().replace(/\./g, "-");
8414
+ if (s === "claude-opus-4-6" || s === "claude-opus-4-8" || s === "claude-opus-4-5") return "claude-opus-4-6";
8415
+ if (s === "claude-sonnet-4-5") return "claude-sonnet-4-6";
8416
+ return s.replace(EFFORT_SUFFIX_RE, "");
8417
+ }
8418
+ /**
8419
+ * Test whether a requested model matches a candidate model id (accounting for
8420
+ * aliases, effort variants, and base model families).
8421
+ */
8422
+ function modelMatches(requestedModel, candidateModelId) {
8423
+ if (!requestedModel || !candidateModelId) return false;
8424
+ const r = requestedModel.trim().toLowerCase();
8425
+ const c = candidateModelId.trim().toLowerCase();
8426
+ if (r === c) return true;
8427
+ return baseModelSlug(r) === baseModelSlug(c);
8428
+ }
8380
8429
  //#endregion
8381
8430
  //#region src/common/account-models.ts
8382
8431
  const FAMILY_LABELS = {
@@ -9467,7 +9516,22 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9467
9516
  }
9468
9517
  //#endregion
9469
9518
  //#region src/client/sections/ModelsPanel.ts
9470
- function ModelsPanel({ t, catalogModels, hiddenModelSet, loadingAction, toggleModelHidden }) {
9519
+ function ModelsPanel({ t, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, setSelectedModels }) {
9520
+ const unrestricted = selectedModelSet.size === 0;
9521
+ const selected = Array.from(selectedModelSet);
9522
+ const isTicked = (id) => unrestricted || selected.some((want) => modelMatches(want, id));
9523
+ const isVisible = (id) => !hiddenModelSet.has(id) && isTicked(id);
9524
+ const visibleCount = catalogModels.filter((m) => isVisible(m.id)).length;
9525
+ const busy = loadingAction === "config:selectedModels";
9526
+ const onChipClick = (id) => {
9527
+ if (!unrestricted) {
9528
+ const next = new Set(selected.filter((want) => !modelMatches(want, id)));
9529
+ if (!isTicked(id)) next.add(id);
9530
+ setSelectedModels(Array.from(next));
9531
+ return;
9532
+ }
9533
+ setSelectedModels(catalogModels.filter((m) => !hiddenModelSet.has(m.id) && m.id !== id).map((m) => m.id));
9534
+ };
9471
9535
  return h("div", { style: {
9472
9536
  display: "flex",
9473
9537
  flexDirection: "column",
@@ -9476,24 +9540,28 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9476
9540
  color: "var(--agy-text-primary)",
9477
9541
  fontWeight: 600,
9478
9542
  fontSize: "12.5px"
9479
- } }, t("models.label")), catalogModels.length === 0 ? h("span", { style: S.muted }, t("models.empty")) : h("div", { style: {
9543
+ } }, t("models.label", {
9544
+ selected: visibleCount,
9545
+ total: catalogModels.length
9546
+ })), catalogModels.length === 0 ? h("span", { style: S.muted }, t("models.empty")) : h("div", { style: {
9480
9547
  display: "flex",
9481
9548
  flexWrap: "wrap",
9482
9549
  gap: "6px"
9483
9550
  } }, catalogModels.map((m) => {
9484
- const isHidden = hiddenModelSet.has(m.id);
9551
+ const denied = hiddenModelSet.has(m.id);
9552
+ const ticked = isVisible(m.id);
9485
9553
  const efforts = (m.efforts ?? []).map((id) => effortLabel(id));
9486
- const title = efforts.length > 0 ? m.id + " · " + efforts.join(" / ") : m.id;
9554
+ const title = (efforts.length > 0 ? m.id + " · " + efforts.join(" / ") : m.id) + (denied ? "\n" + t("models.deniedHint") : "");
9487
9555
  return h(Button, {
9488
9556
  key: m.id,
9489
- variant: isHidden ? "seg" : "segActive",
9557
+ variant: ticked ? "segActive" : "seg",
9490
9558
  title,
9491
- disabled: loadingAction === "config:hiddenModels",
9492
- style: isHidden ? {
9559
+ disabled: busy,
9560
+ style: ticked ? void 0 : {
9493
9561
  opacity: .45,
9494
9562
  textDecoration: "line-through"
9495
- } : void 0,
9496
- onClick: () => void toggleModelHidden(m.id, !isHidden)
9563
+ },
9564
+ onClick: () => onChipClick(m.id)
9497
9565
  }, m.name);
9498
9566
  })), h("span", { style: S.muted }, t("models.hint")));
9499
9567
  }
@@ -9670,6 +9738,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9670
9738
  const pool = status?.pool;
9671
9739
  const catalogModels = status?.catalogModels ?? [];
9672
9740
  const hiddenModelSet = new Set(status?.hiddenModels ?? []);
9741
+ const selectedModelSet = new Set(status?.selectedModels ?? []);
9673
9742
  const accounts = pool?.accounts ?? [];
9674
9743
  const isAuthed = authPhase === "ok" || accounts.length > 0;
9675
9744
  const isBusy = loadingAction !== null;
@@ -9723,10 +9792,10 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9723
9792
  ...accountActions,
9724
9793
  beginReauth: auth.handleBeginReauth
9725
9794
  }
9726
- }), renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, loadingAction, {
9795
+ }), renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, {
9727
9796
  setCfg: config.setCfg,
9728
9797
  setMode: config.setMode,
9729
- toggleModelHidden: config.toggleModelHidden,
9798
+ setSelectedModels: config.setSelectedModels,
9730
9799
  copyImageCommand
9731
9800
  }));
9732
9801
  };
@@ -9979,8 +10048,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
9979
10048
  }
9980
10049
  };
9981
10050
  }
9982
- function renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, loadingAction, actions) {
9983
- const { setCfg, setMode, toggleModelHidden, copyImageCommand } = actions;
10051
+ function renderRuntimeConfig(t, status, pool, catalogModels, hiddenModelSet, selectedModelSet, loadingAction, actions) {
10052
+ const { setCfg, setMode, setSelectedModels, copyImageCommand } = actions;
9984
10053
  const caption = (text, desc) => h("div", { style: {
9985
10054
  display: "flex",
9986
10055
  flexDirection: "column"
@@ -10082,8 +10151,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
10082
10151
  t,
10083
10152
  catalogModels,
10084
10153
  hiddenModelSet,
10154
+ selectedModelSet,
10085
10155
  loadingAction,
10086
- toggleModelHidden
10156
+ setSelectedModels
10087
10157
  })));
10088
10158
  }
10089
10159
  /**
package/dist/index.js CHANGED
@@ -141,6 +141,7 @@ function defaultConfig() {
141
141
  workspaceRoot: "",
142
142
  fallbackModels: DEFAULT_FALLBACK_MODELS,
143
143
  hiddenModels: [],
144
+ selectedModels: [],
144
145
  askTool: false,
145
146
  mediaDir: "",
146
147
  mediaTtlMs: 864e5,
@@ -1420,7 +1421,7 @@ function defaultPoolDir(home) {
1420
1421
  const LOW_QUOTA_5H = .1;
1421
1422
  const LOW_QUOTA_WEEKLY = .05;
1422
1423
  /** Ordered quota families tracked on an account card. */
1423
- const QUOTA_FAMILIES = [
1424
+ const QUOTA_FAMILIES$1 = [
1424
1425
  "google",
1425
1426
  "argon",
1426
1427
  "anthropic",
@@ -1463,7 +1464,7 @@ function isQuotaBenched(acc, family, now) {
1463
1464
  * `quotas.argon` row, since `google` itself already reflects that shared bucket.
1464
1465
  */
1465
1466
  function accountHasQuotaBench(acc, now) {
1466
- return QUOTA_FAMILIES.some((fam) => (fam !== "argon" || acc.quotas?.argon !== void 0) && isQuotaBenched(acc, fam, now));
1467
+ return QUOTA_FAMILIES$1.some((fam) => (fam !== "argon" || acc.quotas?.argon !== void 0) && isQuotaBenched(acc, fam, now));
1467
1468
  }
1468
1469
  /**
1469
1470
  * True when the account cannot operate due to auth expiration, web verification
@@ -30317,6 +30318,7 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
30317
30318
  workspaceRoot: asString(get("workspaceRoot")) ?? base.workspaceRoot,
30318
30319
  fallbackModels: Array.isArray(get("fallbackModels")) ? get("fallbackModels").filter((x) => !!x && typeof x === "object" && typeof x.id === "string") : base.fallbackModels,
30319
30320
  hiddenModels: asStringArray(get("hiddenModels")) ?? base.hiddenModels,
30321
+ selectedModels: asStringArray(get("selectedModels")) ?? base.selectedModels,
30320
30322
  askTool: asBool(get("askTool")) ?? base.askTool,
30321
30323
  mediaDir: asString(get("mediaDir")) ?? base.mediaDir,
30322
30324
  mediaTtlMs: asNum(get("mediaTtlMs")) ?? base.mediaTtlMs,
@@ -30398,6 +30400,10 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
30398
30400
  const list = asStringArray(env.DSH_AGY_HIDDEN_MODELS.split(","));
30399
30401
  if (list) cfg.hiddenModels = list;
30400
30402
  }
30403
+ if (env.DSH_AGY_SELECTED_MODELS) {
30404
+ const list = asStringArray(env.DSH_AGY_SELECTED_MODELS.split(","));
30405
+ if (list && list.length > 0) cfg.selectedModels = list;
30406
+ }
30401
30407
  if (env.DSH_AGY_WORKSPACE_ROOT) cfg.workspaceRoot = env.DSH_AGY_WORKSPACE_ROOT;
30402
30408
  if (env.DSH_AGY_MEDIA_DIR) cfg.mediaDir = env.DSH_AGY_MEDIA_DIR;
30403
30409
  if (env.DSH_AGY_MEDIA_TTL_MS) {
@@ -33435,6 +33441,136 @@ var SpawnLimiter = class {
33435
33441
  }
33436
33442
  };
33437
33443
  //#endregion
33444
+ //#region src/domain/models/quota-catalog.ts
33445
+ /** Families whose quota rows describe models the picker may offer. */
33446
+ const QUOTA_FAMILIES = [
33447
+ "google",
33448
+ "argon",
33449
+ "anthropic",
33450
+ "openai"
33451
+ ];
33452
+ /**
33453
+ * Models an account's quota snapshot says are available.
33454
+ *
33455
+ * `displayName` is preferred over the raw slug for the label (agy's quota rows
33456
+ * say "Gemini 4 Neon (Low)", the picker should not show `gemini-4-neon-low`).
33457
+ * Rows without a usable `modelId` are skipped rather than guessed at.
33458
+ */
33459
+ function quotaModelsForAccount(account) {
33460
+ const quotas = account?.quotas;
33461
+ if (!quotas) return [];
33462
+ const out = [];
33463
+ const seen = /* @__PURE__ */ new Set();
33464
+ for (const family of QUOTA_FAMILIES) {
33465
+ const rows = quotas[family]?.models;
33466
+ if (!Array.isArray(rows)) continue;
33467
+ for (const row of rows) {
33468
+ if (!row || typeof row.modelId !== "string") continue;
33469
+ const slug = row.modelId.trim();
33470
+ if (slug === "" || seen.has(slug)) continue;
33471
+ seen.add(slug);
33472
+ const label = typeof row.displayName === "string" && row.displayName.trim() !== "" ? row.displayName.trim() : slug;
33473
+ out.push({
33474
+ slug,
33475
+ label
33476
+ });
33477
+ }
33478
+ }
33479
+ return out;
33480
+ }
33481
+ /** Same as {@link quotaModelsForAccount}, folded into picker entries. */
33482
+ function quotaCatalogForAccount(account) {
33483
+ return foldEfforts(quotaModelsForAccount(account));
33484
+ }
33485
+ /**
33486
+ * Merge the CLI-discovered catalog with quota-derived entries.
33487
+ *
33488
+ * Precedence: a discovered entry wins on IDENTITY and ORDER (agy is
33489
+ * authoritative about what it can run and in which order it lists models), but
33490
+ * a quota row may CONTRIBUTE a model the catalog never mentioned — that is the
33491
+ * whole point of the merge: on a CLI-less host the catalog is a 7-row fallback
33492
+ * and the account knows about 23+ real models.
33493
+ *
33494
+ * Effort sets are unioned so a folded catalog entry (`gemini-4-neon` with
33495
+ * low/medium/high) keeps any extra level only the quota rows knew about.
33496
+ */
33497
+ function mergeCatalogWithQuotaModels(discovered, quota) {
33498
+ if (quota.length === 0) return [...discovered];
33499
+ const merged = [];
33500
+ const byId = /* @__PURE__ */ new Map();
33501
+ const index = /* @__PURE__ */ new Map();
33502
+ const add = (entry, allowOverrideName) => {
33503
+ const existingAt = index.get(entry.id);
33504
+ if (existingAt === void 0) {
33505
+ index.set(entry.id, merged.length);
33506
+ byId.set(entry.id, entry);
33507
+ merged.push(entry);
33508
+ return;
33509
+ }
33510
+ const existing = byId.get(entry.id);
33511
+ if (!existing) return;
33512
+ const efforts = unionEfforts(existing.efforts, entry.efforts);
33513
+ const name = allowOverrideName && existing.name === existing.id && entry.name !== entry.id ? entry.name : existing.name;
33514
+ const next = {
33515
+ id: existing.id,
33516
+ name,
33517
+ efforts
33518
+ };
33519
+ byId.set(entry.id, next);
33520
+ merged[existingAt] = next;
33521
+ };
33522
+ for (const entry of discovered) add(entry, false);
33523
+ for (const entry of quota) add(entry, true);
33524
+ return disambiguateLabels(merged);
33525
+ }
33526
+ /**
33527
+ * Make sure no two rows render under the same label.
33528
+ *
33529
+ * The quota snapshot is not above this. On a current pool `gemini-2.5-flash`,
33530
+ * `gemini-2.5-flash-lite`, `gemini-2.5-flash-thinking` and
33531
+ * `gemini-3.5-flash-lite` ALL report "Gemini 3.5 Flash Lite" (upstream keeps the
33532
+ * legacy slugs pointing at the current model), and effort-folding makes
33533
+ * `gemini-4-hydrogen-tiered` inherit "Gemini 4 Hydrogen" from its `(High)`
33534
+ * siblings. Identical chips are unusable — the user cannot tell which box ticks
33535
+ * what.
33536
+ *
33537
+ * Resolution is not "first wins", it is a stem test: a colliding row keeps its
33538
+ * label only when every other row in the group is an ID-DERIVED VARIANT of it
33539
+ * (`<id>-<something>`). That keeps "Gemini 4 Hydrogen" on the base model and
33540
+ * demotes `-tiered`/`-sonar`, while a group of genuinely different models (the
33541
+ * 2.5/3.5 legacy aliases) has no stem and every row falls back to its id — which
33542
+ * is unique by construction and is what the picker sends back anyway.
33543
+ */
33544
+ function disambiguateLabels(entries) {
33545
+ const groups = /* @__PURE__ */ new Map();
33546
+ for (const entry of entries) {
33547
+ const bucket = groups.get(entry.name);
33548
+ if (bucket) bucket.push(entry);
33549
+ else groups.set(entry.name, [entry]);
33550
+ }
33551
+ const keep = /* @__PURE__ */ new Set();
33552
+ for (const rows of groups.values()) {
33553
+ if (rows.length === 1) continue;
33554
+ const stem = rows.find((candidate) => candidate.name !== candidate.id && rows.every((other) => other === candidate || other.id.startsWith(candidate.id + "-")));
33555
+ if (stem) keep.add(stem.id);
33556
+ }
33557
+ return entries.map((entry) => {
33558
+ if (entry.name === entry.id) return entry;
33559
+ if ((groups.get(entry.name) ?? []).length <= 1) return entry;
33560
+ return keep.has(entry.id) ? entry : {
33561
+ ...entry,
33562
+ name: entry.id
33563
+ };
33564
+ });
33565
+ }
33566
+ function unionEfforts(a, b) {
33567
+ const left = a ?? [];
33568
+ const right = b ?? [];
33569
+ if (right.length === 0) return a;
33570
+ if (left.length === 0) return b;
33571
+ return (/* @__PURE__ */ new Set([...left, ...right])).size === left.length ? a : [...left, ...right.filter((e) => !left.includes(e))];
33572
+ }
33573
+ //#endregion
33438
33574
  //#region src/provider/model-resolution.ts
33439
33575
  function activeAccount(deps) {
33440
33576
  const pool = deps.pool;
@@ -33454,14 +33590,73 @@ function listAvailableModels(deps) {
33454
33590
  } else models = deps.catalog.getUnion(accounts, pool);
33455
33591
  const { entries, dropped } = sanitizeCatalogEntries(models);
33456
33592
  if (dropped.length > 0) deps.warnOnce("catalog-dupes", "model catalog contained duplicate ids [" + dropped.join(", ") + "] — kept first occurrence so DSH does not drop the whole provider group (INVALID_CATALOG)");
33457
- const hidden = new Set(cfg.hiddenModels.map((s) => s.trim()));
33458
- return entries.filter((m) => !hidden.has(m.id)).map((m) => ({
33593
+ return visibleEntries(entries, quotaScopeAccounts(pool, accounts, activeAcc, cfg.poolWideCatalog), cfg).map((m) => ({
33459
33594
  provider: PROVIDER_ID,
33460
33595
  id: m.id,
33461
33596
  name: m.name,
33462
33597
  inputModalities: ["text", "image"]
33463
33598
  }));
33464
33599
  }
33600
+ /**
33601
+ * Accounts whose quota snapshots describe models the picker may offer.
33602
+ *
33603
+ * Narrow mode (default) describes ONE account — the same account whose `agy
33604
+ * models` catalog the picker is showing, so the two sources never contradict
33605
+ * each other. Pool-wide mode describes every enabled account because the
33606
+ * scheduler can route to any of them (issue #107).
33607
+ */
33608
+ function quotaScopeAccounts(pool, accounts, activeAcc, poolWide) {
33609
+ if (!pool) return [];
33610
+ if (poolWide) return accounts;
33611
+ if (activeAcc) return [activeAcc];
33612
+ return accounts.slice(0, 1);
33613
+ }
33614
+ /**
33615
+ * Fold quota-derived models into the catalog and apply BOTH visibility filters.
33616
+ *
33617
+ * Quota rows are merged in because a host without the agy CLI only ever has the
33618
+ * static fallback catalog, while every quota refresh already stored the real
33619
+ * per-account model list — that list is what makes the picker useful at all
33620
+ * (issue #131). Merge, don't replace: `agy models` stays authoritative for the
33621
+ * models it knows about.
33622
+ *
33623
+ * Visibility order is allow-list THEN deny-list: `selectedModels` is the
33624
+ * checkbox state the settings panel writes, `hiddenModels` remains the older
33625
+ * deny-list (env/config escape hatch) and still wins on a conflict so an
33626
+ * operator can hide a model without editing the selection.
33627
+ */
33628
+ function visibleEntries(entries, quotaScope, cfg) {
33629
+ const merged = mergeCatalogWithQuotaModels(entries, quotaCatalogForAccounts(quotaScope));
33630
+ const selected = cfg.selectedModels.map((s) => s.trim()).filter((s) => s !== "");
33631
+ const hidden = new Set(cfg.hiddenModels.map((s) => s.trim()));
33632
+ return merged.filter((m) => (selected.length === 0 || isSelected(m.id, selected)) && !hidden.has(m.id));
33633
+ }
33634
+ /**
33635
+ * Whether a stored selection still covers a catalog row.
33636
+ *
33637
+ * Selections are persisted, and catalog rows are not stable: effort variants
33638
+ * (`gemini-4-hydrogen-tiered`) fold into their base row (`gemini-4-hydrogen`)
33639
+ * once the CLI or a quota snapshot reports the family, and the base row then
33640
+ * carries the effort as a flag instead of an id. Matching by exact id only
33641
+ * would turn every such row into a stale entry that silently hides the base
33642
+ * model - the user ticked it, the panel shows nothing, and nothing on screen
33643
+ * explains why. `modelMatches` degrades an effort-suffixed / aliased id to its
33644
+ * base slug, so a selection made before a fold keeps selecting the same model.
33645
+ */
33646
+ function isSelected(id, selected) {
33647
+ return selected.some((want) => modelMatches(want, id));
33648
+ }
33649
+ /** Union of the quota-derived catalogs of several accounts, first label wins. */
33650
+ function quotaCatalogForAccounts(accounts) {
33651
+ const out = [];
33652
+ const seen = /* @__PURE__ */ new Set();
33653
+ for (const acc of accounts) for (const entry of quotaCatalogForAccount(acc)) {
33654
+ if (seen.has(entry.id)) continue;
33655
+ seen.add(entry.id);
33656
+ out.push(entry);
33657
+ }
33658
+ return out;
33659
+ }
33465
33660
  function resolveModelInfo(deps, model) {
33466
33661
  const pool = deps.pool;
33467
33662
  const activeAcc = activeAccount(deps);
@@ -33471,7 +33666,7 @@ function resolveModelInfo(deps, model) {
33471
33666
  const cleanId = rawModel !== "" ? rawModel : cfg.defaultModel;
33472
33667
  const unionModels = deps.catalog.getUnion(accounts, pool);
33473
33668
  const allModels = deps.catalog.getAllKnownModels(accounts);
33474
- const entry = unionModels.find((m) => m.id === cleanId) ?? allModels.find((m) => m.id === cleanId) ?? findEntry(deps.catalog.get(activeAcc?.id), cleanId) ?? findEntry(deps.catalog.get(), cleanId);
33669
+ const entry = unionModels.find((m) => m.id === cleanId) ?? allModels.find((m) => m.id === cleanId) ?? findEntry(deps.catalog.get(activeAcc?.id), cleanId) ?? findEntry(deps.catalog.get(), cleanId) ?? quotaCatalogForAccounts(quotaScopeAccounts(pool, accounts, activeAcc, cfg.poolWideCatalog)).find((m) => m.id === cleanId);
33475
33670
  const rawName = entry ? entry.name : cleanId;
33476
33671
  const name = typeof rawName === "string" && rawName.trim() !== "" ? rawName.trim() : cleanId;
33477
33672
  const contextWindow = typeof cfg.contextWindowDefault === "number" && cfg.contextWindowDefault > 0 ? cfg.contextWindowDefault : 2e5;
@@ -42693,6 +42888,19 @@ const queryParam = (req, key) => {
42693
42888
  };
42694
42889
  //#endregion
42695
42890
  //#region src/transport/http/routes/status.ts
42891
+ /**
42892
+ * The selectable universe the Settings ticks describe.
42893
+ *
42894
+ * Deliberately UNFILTERED by `selectedModels`/`hiddenModels`: unticking a model
42895
+ * must stay reversible, so the panel always receives the full set and knows the
42896
+ * current selection separately. Quota-derived models are merged in because a
42897
+ * host without the agy CLI has only the static fallback catalog while the
42898
+ * account's own quota snapshot already lists the real models (issue #131).
42899
+ */
42900
+ function selectableModels(supportedModels, quotaScope) {
42901
+ const quota = quotaScope.flatMap((acc) => quotaCatalogForAccount(acc));
42902
+ return sanitizeCatalogEntries(mergeCatalogWithQuotaModels(sanitizeCatalogEntries(supportedModels).entries, quota)).entries;
42903
+ }
42696
42904
  function handleStatus(services, req, res) {
42697
42905
  const { getConfig, bin, store, pool, quota, catalog, auth, poolAuth, adapter, translation, lastRun } = services;
42698
42906
  const { version: versionCache, dormantReason } = services.status;
@@ -42705,7 +42913,9 @@ function handleStatus(services, req, res) {
42705
42913
  let supportedModels;
42706
42914
  if (cfg.poolWideCatalog || !activeAcc || !pool || typeof catalog.getModelsForAccount !== "function") supportedModels = typeof catalog.getUnion === "function" ? catalog.getUnion(pool?.getAccounts ? pool.getAccounts() : [], pool) : typeof catalog.getAllKnownModels === "function" ? catalog.getAllKnownModels(pool?.getAccounts ? pool.getAccounts() : []) : catalog.get().models ?? [];
42707
42915
  else supportedModels = catalog.getModelsForAccount(activeAcc, pool);
42708
- const sanitizedCatalogModels = sanitizeCatalogEntries(supportedModels).entries;
42916
+ const allAccounts = typeof pool?.getAccounts === "function" ? pool.getAccounts() : [];
42917
+ const quotaScope = cfg.poolWideCatalog ? allAccounts : activeAcc ? [activeAcc] : allAccounts.slice(0, 1);
42918
+ const sanitizedCatalogModels = selectableModels(supportedModels, quotaScope);
42709
42919
  const activeCat = !cfg.poolWideCatalog && activeAcc && typeof catalog.getAccountCatalog === "function" ? catalog.getAccountCatalog(activeAcc.id) ?? cat : cat;
42710
42920
  const catalogCount = typeof catalog.getModelsForAccount === "function" ? sanitizedCatalogModels.length : activeCat.models.length;
42711
42921
  const accountModels = {};
@@ -42736,6 +42946,7 @@ function handleStatus(services, req, res) {
42736
42946
  catalogModels: sanitizedCatalogModels,
42737
42947
  accountModels,
42738
42948
  hiddenModels: cfg.hiddenModels,
42949
+ selectedModels: cfg.selectedModels,
42739
42950
  autoWarmup: cfg.autoWarmup,
42740
42951
  warmupModels: cfg.warmupModels,
42741
42952
  autoTranslate: cfg.autoTranslate,
@@ -43382,6 +43593,7 @@ const PERMISSION_MODES = /* @__PURE__ */ new Set([
43382
43593
  ]);
43383
43594
  function validateConfigValue(key, value) {
43384
43595
  if (key === "hiddenModels") return Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "hiddenModels must be an array of model ids";
43596
+ if (key === "selectedModels") return Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "selectedModels must be an array of model ids";
43385
43597
  if (key === "warmupModels") return Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "warmupModels must be an array of model names";
43386
43598
  if (key === "permissionMode") return typeof value === "string" && PERMISSION_MODES.has(value) ? null : "permissionMode must be skip, plan, or accept-edits";
43387
43599
  return null;
@@ -43421,7 +43633,8 @@ function handleConfig(services, req, res) {
43421
43633
  "imageRetries",
43422
43634
  "showHeaderBadge",
43423
43635
  "showTranslateAction",
43424
- "poolWideCatalog"
43636
+ "poolWideCatalog",
43637
+ "selectedModels"
43425
43638
  ].includes(key)) {
43426
43639
  sendJson(res, 400, { error: "key not settable" });
43427
43640
  return;
@@ -43433,7 +43646,7 @@ function handleConfig(services, req, res) {
43433
43646
  }
43434
43647
  setOverride(key, body.value);
43435
43648
  onConfigWritten(key, body.value);
43436
- if (key === "hiddenModels" || key === "poolWideCatalog" || key === "enabled") notifyPicker();
43649
+ if (key === "hiddenModels" || key === "selectedModels" || key === "poolWideCatalog" || key === "enabled") notifyPicker();
43437
43650
  sendJson(res, 200, {
43438
43651
  ok: true,
43439
43652
  key,
@@ -8,7 +8,8 @@ client bundle and one CLI, with a one-way dependency rule.
8
8
  ```
9
9
  common/ pure types, protocol extensions, config schema, errors
10
10
  ↑
11
- domain/ pure business rules (quota bucket math, account paths/eligibility)
11
+ domain/ pure business rules (quota bucket math, account paths/eligibility,
12
+ model-catalog folding/merging in domain/models/)
12
13
  ↑
13
14
  runtime/ process and platform I/O (agy runner/parser/mapper, proxy/env)
14
15
  ↑
@@ -23,7 +23,8 @@ Resolution order (highest first): `DSH_AGY_*` environment variable → runtime o
23
23
  | `defaultModel` | `DSH_AGY_DEFAULT_MODEL` | `''` (agy default) | Initial model slug |
24
24
  | `defaultEffort` | `DSH_AGY_DEFAULT_EFFORT` | `high` | Initial thinking effort; the settings row and the session menu offer exactly the levels the live catalog advertises (`low` / `medium` / `high` / `xhigh` (Extra) / `max`), plus `auto` |
25
25
  | `poolWideCatalog` | `DSH_AGY_POOL_WIDE_CATALOG` | `false` | Show the union of models supported by **all** enabled accounts in the picker instead of only the active account's models; `selectAccount(family, model)` then routes automatically to an account that can serve the chosen model (issue #107) |
26
- | `hiddenModels` | `DSH_AGY_HIDDEN_MODELS` | `[]` | Slugs hidden from the model picker (comma separated) |
26
+ | `hiddenModels` | `DSH_AGY_HIDDEN_MODELS` | `[]` | Slugs hidden from the model picker (comma separated). Applied **after** `selectedModels`, so it always wins |
27
+ | `selectedModels` | `DSH_AGY_SELECTED_MODELS` | `[]` | Allow-list: only these slugs appear in the model picker (comma separated). Empty means "no restriction" — every model shows. Written by the tick-list in the settings page; a deselected model still resolves for sessions already using it (issue #131) |
27
28
  | `fallbackModels` | `—` | agy 1.5.7 lineup: Gemini 4 Argon, Gemini 4 Hydrogen, Orchestrator (Argon), Gemini 3.8 Flash, Claude Opus 5.5, Claude Sonnet 5.5, GPT-OSS 120B (Medium) | Catalog shown before `agy models` succeeds (signed out or offline); mirrors `agy models` exactly, no retired entries |
28
29
  | `autoFallbackModel` | `DSH_AGY_AUTO_FALLBACK_MODEL` | `false` | Retry on a fallback model when the selected one cannot run |
29
30
  | `modelsCacheTtlMs` | `—` | `300000` | Model catalog cache lifetime |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.52",
3
+ "version": "0.6.53",
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",