dsh-agy-link 0.4.95 → 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 +32 -0
- package/dist/client.js +70 -61
- package/dist/index.js +40 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
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
|
+
|
|
17
|
+
## 0.4.96 (2026-10-30)
|
|
18
|
+
|
|
19
|
+
### English
|
|
20
|
+
|
|
21
|
+
- **Fix(client/mermaid): serialize diagram rendering so multiple charts don't clobber each other and silently degrade to code blocks.**
|
|
22
|
+
- `mermaid.render()` is not reentrant: it injects shared temporary nodes into `document.body`, and `renderInto()`'s post-render `cleanupTempElements()` sweeps all of them. When one scan pass found two or more diagrams at once (a long answer with several charts, or the first lazy load resolving for every already-pending block), concurrent renders removed each other's in-flight temp DOM — the losers threw and auto-sniffed blocks silently set `data-agy-mermaid="fallback"`, i.e. the diagram simply stayed a plain `代码块`. All renders now go through a single `enqueueMermaidRender()` promise chain so exactly one diagram is drawn at a time; a failing task never breaks the chain. Adds serialization regression tests (verified live: 4 concurrent generic fences now all render).
|
|
23
|
+
- **Fix(adapter): session-title calls keep their format constraints (forward the system prompt) and don't force plan mode.**
|
|
24
|
+
- When DSH generates a session title (`options.purpose === 'session-title'`), the length/single-line/no-prefix constraints live in `options.system`, which was dropped (forwardSystemPrompt off, only review whitelisted), and aux calls were forced into `--mode plan` — chatty models then emitted conversational preambles that DSH stored verbatim as the title. Title calls now forward `options.system` and use `cfg.permissionMode` (no forced plan). Corrected from #63 (which used an invalid `'default'` mode); adds a regression test.
|
|
25
|
+
|
|
26
|
+
### 中文
|
|
27
|
+
|
|
28
|
+
- **修复(client/mermaid):串行化图表渲染,避免一次扫描内的多个图表相互踩踏、静默降级成代码块。**
|
|
29
|
+
- `mermaid.render()` 不是可重入的:它会向 `document.body` 注入共享的临时节点,而 `renderInto()` 渲染后的 `cleanupTempElements()` 会清扫全部这类节点。当一次扫描同时命中两个及以上图表(长回答里有多个图表,或首次懒加载对所有待渲染块同时 resolve)时,并发渲染会互相删掉对方正在用的临时 DOM——败者抛错,自动嗅探的块静默进入 `data-agy-mermaid="fallback"`,也就是图表没渲染、仍显示成普通「代码块」。现在所有渲染都经过单一 `enqueueMermaidRender()` promise 链串行执行,单个任务失败也不会中断整条链。新增串行化回归测试(已在真实客户端实测:4 个并发通用代码围栏全部渲染成功)。
|
|
30
|
+
- **修复(adapter):会话标题调用保留格式约束(转发系统提示词)且不强制 plan 模式。**
|
|
31
|
+
- 生成会话标题时,单行/无前缀等格式约束位于 `options.system`,此前被丢弃且 aux 调用被强加 `--mode plan`,导致模型输出客套前缀被原样当作标题。现标题调用转发 `options.system` 并使用 `cfg.permissionMode`(不再强制 plan)。实现修正自 #63(其使用了无效的 `'default'` 模式);补充回归测试。
|
|
32
|
+
|
|
33
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.4.95...v0.4.96
|
|
34
|
+
|
|
3
35
|
## 0.4.95 (2026-10-30)
|
|
4
36
|
|
|
5
37
|
### English
|
package/dist/client.js
CHANGED
|
@@ -3339,77 +3339,86 @@ body > [id^="iagy-mmd"] .error-icon {
|
|
|
3339
3339
|
if (svg.includes("viewBox=\"0 0 0 0\"") || svg.includes("viewBox=\"-8 -8 16 16\"") || svg.includes("max-width: 16px") || svg.includes("max-width: 0px")) return true;
|
|
3340
3340
|
return false;
|
|
3341
3341
|
}
|
|
3342
|
+
let renderChain = Promise.resolve();
|
|
3343
|
+
/** Queue a render task behind the previous one. Failures never break the chain. */
|
|
3344
|
+
function enqueueMermaidRender(task) {
|
|
3345
|
+
const run = renderChain.then(task, task);
|
|
3346
|
+
renderChain = run.then(() => void 0, () => void 0);
|
|
3347
|
+
return run;
|
|
3348
|
+
}
|
|
3342
3349
|
async function renderInto(block, source, lang = "") {
|
|
3343
3350
|
block.querySelector("[data-agy-mermaid-svg]")?.remove();
|
|
3344
3351
|
const mount = document.createElement("div");
|
|
3345
3352
|
mount.setAttribute("data-agy-mermaid-svg", "1");
|
|
3346
3353
|
block.appendChild(mount);
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
} catch (parseErr) {
|
|
3363
|
-
const repaired = repairMermaidSource(targetSource);
|
|
3364
|
-
if (repaired !== targetSource) try {
|
|
3365
|
-
await api.parse(repaired);
|
|
3366
|
-
targetSource = repaired;
|
|
3354
|
+
await enqueueMermaidRender(async () => {
|
|
3355
|
+
const api = await loadMermaid();
|
|
3356
|
+
if (api === null) {
|
|
3357
|
+
block.setAttribute("data-agy-mermaid", "error");
|
|
3358
|
+
mount.setAttribute("data-agy-mermaid-error", "1");
|
|
3359
|
+
mount.textContent = "Mermaid renderer unavailable (offline). Diagram source stays below.";
|
|
3360
|
+
return;
|
|
3361
|
+
}
|
|
3362
|
+
renderSeq += 1;
|
|
3363
|
+
const id = "agy-mmd-" + renderSeq;
|
|
3364
|
+
let targetSource = source;
|
|
3365
|
+
try {
|
|
3366
|
+
let parseValidated = false;
|
|
3367
|
+
if (typeof api.parse === "function") try {
|
|
3368
|
+
await api.parse(targetSource);
|
|
3367
3369
|
parseValidated = true;
|
|
3368
|
-
} catch {
|
|
3369
|
-
|
|
3370
|
+
} catch (parseErr) {
|
|
3371
|
+
const repaired = repairMermaidSource(targetSource);
|
|
3372
|
+
if (repaired !== targetSource) try {
|
|
3373
|
+
await api.parse(repaired);
|
|
3374
|
+
targetSource = repaired;
|
|
3375
|
+
parseValidated = true;
|
|
3376
|
+
} catch {
|
|
3377
|
+
throw parseErr;
|
|
3378
|
+
}
|
|
3379
|
+
else throw parseErr;
|
|
3370
3380
|
}
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3381
|
+
if (!parseValidated && typeof api.parse !== "function") targetSource = repairMermaidSource(targetSource);
|
|
3382
|
+
const { svg } = await api.render(id, targetSource);
|
|
3383
|
+
if (isInvalidOrCollapsedSvg(svg)) throw new Error("Mermaid returned an empty or invalid diagram");
|
|
3384
|
+
mount.innerHTML = "";
|
|
3385
|
+
const toolbar = document.createElement("div");
|
|
3386
|
+
toolbar.className = "agy-mermaid-toolbar";
|
|
3387
|
+
const toggleBtn = document.createElement("button");
|
|
3388
|
+
toggleBtn.type = "button";
|
|
3389
|
+
toggleBtn.className = "agy-mermaid-toggle";
|
|
3390
|
+
toggleBtn.textContent = "查看源码";
|
|
3391
|
+
toggleBtn.title = "切换图表与原始代码";
|
|
3392
|
+
toggleBtn.addEventListener("click", (ev) => {
|
|
3393
|
+
ev.preventDefault();
|
|
3394
|
+
ev.stopPropagation();
|
|
3395
|
+
if (block.getAttribute("data-agy-mermaid-view") === "source") {
|
|
3396
|
+
block.removeAttribute("data-agy-mermaid-view");
|
|
3397
|
+
toggleBtn.textContent = "查看源码";
|
|
3398
|
+
} else {
|
|
3399
|
+
block.setAttribute("data-agy-mermaid-view", "source");
|
|
3400
|
+
toggleBtn.textContent = "查看图表";
|
|
3401
|
+
}
|
|
3402
|
+
});
|
|
3403
|
+
toolbar.appendChild(toggleBtn);
|
|
3404
|
+
mount.appendChild(toolbar);
|
|
3405
|
+
const bodyDiv = document.createElement("div");
|
|
3406
|
+
bodyDiv.className = "agy-mermaid-body";
|
|
3407
|
+
bodyDiv.innerHTML = svg;
|
|
3408
|
+
mount.appendChild(bodyDiv);
|
|
3409
|
+
block.setAttribute("data-agy-mermaid", "done");
|
|
3410
|
+
} catch (e) {
|
|
3411
|
+
if (!isMermaidLang(lang)) {
|
|
3412
|
+
mount.remove();
|
|
3413
|
+
block.setAttribute("data-agy-mermaid", "fallback");
|
|
3390
3414
|
} else {
|
|
3391
|
-
block.setAttribute("data-agy-mermaid
|
|
3392
|
-
|
|
3415
|
+
block.setAttribute("data-agy-mermaid", "error");
|
|
3416
|
+
mount.innerHTML = "<div class=\"agy-mermaid-warn\">⚠️ Mermaid 图表解析失败,已保留原始代码呈现</div>";
|
|
3393
3417
|
}
|
|
3394
|
-
}
|
|
3395
|
-
|
|
3396
|
-
mount.appendChild(toolbar);
|
|
3397
|
-
const bodyDiv = document.createElement("div");
|
|
3398
|
-
bodyDiv.className = "agy-mermaid-body";
|
|
3399
|
-
bodyDiv.innerHTML = svg;
|
|
3400
|
-
mount.appendChild(bodyDiv);
|
|
3401
|
-
block.setAttribute("data-agy-mermaid", "done");
|
|
3402
|
-
} catch (e) {
|
|
3403
|
-
if (!isMermaidLang(lang)) {
|
|
3404
|
-
mount.remove();
|
|
3405
|
-
block.setAttribute("data-agy-mermaid", "fallback");
|
|
3406
|
-
} else {
|
|
3407
|
-
block.setAttribute("data-agy-mermaid", "error");
|
|
3408
|
-
mount.innerHTML = "<div class=\"agy-mermaid-warn\">⚠️ Mermaid 图表解析失败,已保留原始代码呈现</div>";
|
|
3418
|
+
} finally {
|
|
3419
|
+
cleanupTempElements(id);
|
|
3409
3420
|
}
|
|
3410
|
-
}
|
|
3411
|
-
cleanupTempElements(id);
|
|
3412
|
-
}
|
|
3421
|
+
});
|
|
3413
3422
|
}
|
|
3414
3423
|
let scanTimer$1 = null;
|
|
3415
3424
|
function scheduleScan$1() {
|
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
|
-
|
|
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) {
|
|
@@ -30851,7 +30869,8 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
30851
30869
|
const bin = this.deps.bin();
|
|
30852
30870
|
if (!bin) throw new LlmError("agy binary not found on PATH — install it via https://antigravity.google/docs/cli/install", Err.AGY_NOT_INSTALLED);
|
|
30853
30871
|
const isReview = typeof options.system === "string" && options.system.includes("REVIEW_POLICY");
|
|
30854
|
-
const
|
|
30872
|
+
const isTitle = options.purpose === "session-title";
|
|
30873
|
+
const isAux = options.purpose === "compaction" || isTitle || isReview;
|
|
30855
30874
|
if (isAux && !isReview && !cfg.allowAuxiliary) throw new LlmError("auxiliary calls are disabled for the antigravity route (allowAuxiliary: false)", Err.AUX_DISABLED);
|
|
30856
30875
|
const toolNames = new Set((options.tools ?? []).map((t) => t.name));
|
|
30857
30876
|
const isCodeMode = toolNames.has("run_code") && !toolNames.has("agy_tool");
|
|
@@ -31116,7 +31135,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31116
31135
|
if (binding.interrupted === true) prompt = "[the previous turn was interrupted before it finished — do not continue or answer that unfinished work; respond only to the newest request below]\n\n" + prompt;
|
|
31117
31136
|
}
|
|
31118
31137
|
}
|
|
31119
|
-
if (cfg.forwardSystemPrompt || isReview) {
|
|
31138
|
+
if (cfg.forwardSystemPrompt || isReview || isTitle) {
|
|
31120
31139
|
const sysInstruction = options.system || (() => {
|
|
31121
31140
|
const sm = messages.find((m) => m.role === "system");
|
|
31122
31141
|
return sm ? textOf(sm).trim() : "";
|
|
@@ -31266,7 +31285,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31266
31285
|
model: activeModelForArgs,
|
|
31267
31286
|
effort,
|
|
31268
31287
|
conversationId: !isAux && binding !== void 0 ? binding.conversationId : void 0,
|
|
31269
|
-
permissionMode: isAux ? "plan" : cfg.permissionMode,
|
|
31288
|
+
permissionMode: isAux && !isTitle ? "plan" : cfg.permissionMode,
|
|
31270
31289
|
timeoutMs: cfg.timeoutMs,
|
|
31271
31290
|
printTimeoutMinutes,
|
|
31272
31291
|
extraArgs: cfg.extraArgs,
|
|
@@ -31278,7 +31297,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
|
|
|
31278
31297
|
model: activeModelForArgs,
|
|
31279
31298
|
effort,
|
|
31280
31299
|
conversationId: !isAux && binding !== void 0 ? binding.conversationId : void 0,
|
|
31281
|
-
permissionMode: isAux ? "plan" : cfg.permissionMode,
|
|
31300
|
+
permissionMode: isAux && !isTitle ? "plan" : cfg.permissionMode,
|
|
31282
31301
|
timeoutMs: cfg.timeoutMs,
|
|
31283
31302
|
printTimeoutMinutes,
|
|
31284
31303
|
extraArgs: cfg.extraArgs,
|
|
@@ -35889,6 +35908,7 @@ function apply(ctx, entryConfig = {}) {
|
|
|
35889
35908
|
const body = await readBody(req);
|
|
35890
35909
|
const id = typeof body.id === "string" ? body.id : "";
|
|
35891
35910
|
pool.deleteAccount(id);
|
|
35911
|
+
notifyPicker();
|
|
35892
35912
|
sendJson(res, 200, {
|
|
35893
35913
|
ok: true,
|
|
35894
35914
|
pool: pool.getPoolData()
|
|
@@ -35909,6 +35929,7 @@ function apply(ctx, entryConfig = {}) {
|
|
|
35909
35929
|
const id = typeof body.id === "string" ? body.id : "";
|
|
35910
35930
|
const enabled = typeof body.enabled === "boolean" ? body.enabled : true;
|
|
35911
35931
|
const ok = pool.setAccountEnabled(id, enabled);
|
|
35932
|
+
if (ok) notifyPicker();
|
|
35912
35933
|
sendJson(res, ok ? 200 : 400, {
|
|
35913
35934
|
ok,
|
|
35914
35935
|
pool: pool.getPoolData()
|
|
@@ -35947,7 +35968,10 @@ function apply(ctx, entryConfig = {}) {
|
|
|
35947
35968
|
}
|
|
35948
35969
|
const body = await readBody(req);
|
|
35949
35970
|
const id = typeof body.id === "string" ? body.id : "";
|
|
35950
|
-
pool.setPrimaryAccount(id)
|
|
35971
|
+
if (pool.setPrimaryAccount(id)) {
|
|
35972
|
+
notifyPicker();
|
|
35973
|
+
catalog.forceRefreshAndNotify(id).catch(() => void 0);
|
|
35974
|
+
}
|
|
35951
35975
|
sendJson(res, 200, {
|
|
35952
35976
|
ok: true,
|
|
35953
35977
|
pool: pool.getPoolData()
|
|
@@ -36082,7 +36106,10 @@ function apply(ctx, entryConfig = {}) {
|
|
|
36082
36106
|
const body = await readBody(req);
|
|
36083
36107
|
const id = typeof body.id === "string" ? body.id : "";
|
|
36084
36108
|
const ok = id !== "" && pool.setActiveAccount(id);
|
|
36085
|
-
if (ok)
|
|
36109
|
+
if (ok) {
|
|
36110
|
+
notifyPicker();
|
|
36111
|
+
catalog.forceRefreshAndNotify(id).catch(() => void 0);
|
|
36112
|
+
}
|
|
36086
36113
|
sendJson(res, ok ? 200 : 400, {
|
|
36087
36114
|
ok,
|
|
36088
36115
|
pool: pool.getPoolData()
|
|
@@ -36101,7 +36128,11 @@ function apply(ctx, entryConfig = {}) {
|
|
|
36101
36128
|
}
|
|
36102
36129
|
const body = await readBody(req);
|
|
36103
36130
|
const ids = Array.isArray(body.ids) ? body.ids.filter((x) => typeof x === "string") : [];
|
|
36104
|
-
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
|
+
}
|
|
36105
36136
|
sendJson(res, 200, {
|
|
36106
36137
|
ok: true,
|
|
36107
36138
|
pool: pool.getPoolData()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.4.
|
|
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",
|