dsh-agy-link 0.4.96 → 0.4.97

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.97 (2026-10-30)
4
+
5
+ ### English
6
+
7
+ - **Fix(pool): switching the active account ("设为当前使用" / set primary) now refreshes that account's model catalog and always re-announces the model picker, so the composer's cached list updates immediately (e.g. Gemini 4 Argon appears after switching to a Pro/Ultra account).**
8
+ - `/pool/set-active` refreshed via `catalog.forceRefresh(id)` and relied on `ModelCatalog` emitting an update *only when the catalog contents changed*. But the composer model picker caches its snapshot and re-reads only on the `llm/adapters-updated` event, and the visible set also depends on the active account's plan (`listModels()` filters the Argon family). So switching to an account whose catalog happened to match the previous one left the picker showing the old models (Argon missing). Added `ModelCatalog.forceRefreshAndNotify()` — refresh the target account, then emit unconditionally — and wired it into `/pool/set-active`, `/pool/primary` and `/pool/reorder`; `enable`/`remove` now announce too. Adds a regression test (identical catalog still re-announces).
9
+
10
+ ### 中文
11
+
12
+ - **修复(pool):切换「设为当前使用」/主用账号后会刷新该账号的模型目录并强制重新广播,会话窗口的模型列表立即更新(切到 Pro/Ultra 账号后 Gemini 4 Argon 正常出现)。**
13
+ - `/pool/set-active` 之前只调 `catalog.forceRefresh(id)`,且 `ModelCatalog` 仅在**目录内容发生变化**时才发更新事件;但会话模型选择器缓存快照、只在 `llm/adapters-updated` 事件后重读,而可见集还取决于当前账号的套餐(`listModels()` 会按账号过滤 Argon)。因此切到「目录恰好与之前相同」的账号时,选择器仍显示旧模型(Argon 不出现)。新增 `ModelCatalog.forceRefreshAndNotify()`(刷新目标账号后**无条件**广播),并接入 `/pool/set-active`、`/pool/primary`、`/pool/reorder`;`enable`/`remove` 也会广播。补充回归测试(目录未变也重新广播)。
14
+
15
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.96...v0.4.97
16
+
3
17
  ## 0.4.96 (2026-10-30)
4
18
 
5
19
  ### English
package/dist/index.js CHANGED
@@ -2364,7 +2364,25 @@ var ModelCatalog = class ModelCatalog {
2364
2364
  await this.refresh(accountId);
2365
2365
  return this.get(accountId);
2366
2366
  }
2367
- async refresh(accountId) {
2367
+ /**
2368
+ * Refresh one account's catalog, then ALWAYS announce a picker update.
2369
+ *
2370
+ * `refresh()` only fires onUpdate when the catalog *contents* changed. But
2371
+ * switching the active account changes the picker's visible set even when
2372
+ * the catalog itself is identical — `listModels()` filters the Argon family
2373
+ * by the active account's plan, and it resolves `catalog.get(accountId)`,
2374
+ * which must be populated for the newly active account before the picker
2375
+ * re-reads. So an account switch must (a) discover that account's catalog and
2376
+ * (b) emit the update unconditionally, or the composer's cached model
2377
+ * snapshot keeps showing the previous account's models (e.g. no Argon after
2378
+ * switching to a Pro/Ultra account).
2379
+ */
2380
+ async forceRefreshAndNotify(accountId) {
2381
+ await this.refresh(accountId, false);
2382
+ this.onUpdate?.();
2383
+ return this.get(accountId);
2384
+ }
2385
+ async refresh(accountId, announce = true) {
2368
2386
  try {
2369
2387
  const ac = new AbortController();
2370
2388
  const timer = setTimeout(() => ac.abort(), 3e4);
@@ -2382,7 +2400,7 @@ var ModelCatalog = class ModelCatalog {
2382
2400
  const changed = prev.source !== "discovered" || prev.models.length !== newModels.length || prev.models.some((m, i) => m.id !== newModels[i]?.id);
2383
2401
  if (accountId) this.accountCatalogs.set(accountId, newCatalog);
2384
2402
  else this.current = newCatalog;
2385
- if (changed) this.onUpdate?.();
2403
+ if (changed && announce) this.onUpdate?.();
2386
2404
  return;
2387
2405
  }
2388
2406
  if (accountId) {
@@ -35890,6 +35908,7 @@ function apply(ctx, entryConfig = {}) {
35890
35908
  const body = await readBody(req);
35891
35909
  const id = typeof body.id === "string" ? body.id : "";
35892
35910
  pool.deleteAccount(id);
35911
+ notifyPicker();
35893
35912
  sendJson(res, 200, {
35894
35913
  ok: true,
35895
35914
  pool: pool.getPoolData()
@@ -35910,6 +35929,7 @@ function apply(ctx, entryConfig = {}) {
35910
35929
  const id = typeof body.id === "string" ? body.id : "";
35911
35930
  const enabled = typeof body.enabled === "boolean" ? body.enabled : true;
35912
35931
  const ok = pool.setAccountEnabled(id, enabled);
35932
+ if (ok) notifyPicker();
35913
35933
  sendJson(res, ok ? 200 : 400, {
35914
35934
  ok,
35915
35935
  pool: pool.getPoolData()
@@ -35948,7 +35968,10 @@ function apply(ctx, entryConfig = {}) {
35948
35968
  }
35949
35969
  const body = await readBody(req);
35950
35970
  const id = typeof body.id === "string" ? body.id : "";
35951
- pool.setPrimaryAccount(id);
35971
+ if (pool.setPrimaryAccount(id)) {
35972
+ notifyPicker();
35973
+ catalog.forceRefreshAndNotify(id).catch(() => void 0);
35974
+ }
35952
35975
  sendJson(res, 200, {
35953
35976
  ok: true,
35954
35977
  pool: pool.getPoolData()
@@ -36083,7 +36106,10 @@ function apply(ctx, entryConfig = {}) {
36083
36106
  const body = await readBody(req);
36084
36107
  const id = typeof body.id === "string" ? body.id : "";
36085
36108
  const ok = id !== "" && pool.setActiveAccount(id);
36086
- if (ok) catalog.forceRefresh(id).catch(() => void 0);
36109
+ if (ok) {
36110
+ notifyPicker();
36111
+ catalog.forceRefreshAndNotify(id).catch(() => void 0);
36112
+ }
36087
36113
  sendJson(res, ok ? 200 : 400, {
36088
36114
  ok,
36089
36115
  pool: pool.getPoolData()
@@ -36102,7 +36128,11 @@ function apply(ctx, entryConfig = {}) {
36102
36128
  }
36103
36129
  const body = await readBody(req);
36104
36130
  const ids = Array.isArray(body.ids) ? body.ids.filter((x) => typeof x === "string") : [];
36105
- pool.reorderAccounts(ids);
36131
+ if (pool.reorderAccounts(ids)) {
36132
+ const activeId = pool.getActiveAccountId("google");
36133
+ notifyPicker();
36134
+ if (activeId) catalog.forceRefreshAndNotify(activeId).catch(() => void 0);
36135
+ }
36106
36136
  sendJson(res, 200, {
36107
36137
  ok: true,
36108
36138
  pool: pool.getPoolData()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.4.96",
3
+ "version": "0.4.97",
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",