dsh-agy-link 0.6.51 → 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/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
  /**