dsh-agy-link 0.5.4 → 0.5.6

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,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.6 (2026-11-05)
4
+
5
+ ### English
6
+
7
+ - **Fix(host): a proxy blip is classified NETWORK, not AUTH (issue #71).**
8
+ - `runLogText` reached only the narrow `looksLikeAuthVerificationJitter` set. agy 1.4.12 logs a two-second proxy flap as `keyringAuth: token validation failed due to network error (token may still be valid)`, which only the wide `looksLikeNetworkError` matches — so `transportFailure` was false and a healthy account was quarantined as `AUTH`. The decision now lives in a pure, tested `isTransportFailure({…})` seam that feeds the same evidence (raw error, auth text, stderr, stdout head, run log) to both matchers; the exact 1.4.12 log is a regression test.
9
+
10
+ - **Perf(client): stop re-sweeping expanded think rows and avoid forced layout.** (thanks @Ronnoc, #72)
11
+ - `scanThinkingRows()` now queries `div[data-variant="think"]:not([data-agy-expanded="true"])`, so already-handled turns are filtered by the selector engine instead of re-walked on every mutation. `tryExpandThinkRow()` checks `aria-expanded`/`data-expanded`/hidden-display before reading `body.clientHeight`, removing a forced synchronous layout from the critical path in long conversations.
12
+
13
+ ### 中文
14
+
15
+ - **修复(host):代理抖动判为 NETWORK 而非 AUTH(issue #71)。**
16
+ - `runLogText` 只喂给了窄匹配 `looksLikeAuthVerificationJitter`。agy 1.4.12 会把两秒的代理抖动记成 `keyringAuth: token validation failed due to network error (token may still be valid)`,而只有宽匹配 `looksLikeNetworkError` 认这句 → `transportFailure` 为 false,健康账号被当作 `AUTH` 隔离。现把判断收敛到纯函数、可测试的 `isTransportFailure({…})`(原始错误、auth 文本、stderr、stdout 头部、运行日志统一输入两个匹配器),并把真实 1.4.12 日志作为回归用例。
17
+
18
+ - **性能(client):不再重复扫描已展开的思考行,且避免强制重排。**(感谢 @Ronnoc,#72)
19
+ - `scanThinkingRows()` 改为查询 `div[data-variant="think"]:not([data-agy-expanded="true"])`,已处理的轮次由选择器引擎过滤;`tryExpandThinkRow()` 先查 `aria-expanded`/`data-expanded`/隐藏样式,再读 `body.clientHeight`,把强制同步布局移出长会话关键路径。
20
+
21
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.5.5...v0.5.6
22
+
23
+ ## 0.5.5 (2026-11-05)
24
+
25
+ ### English
26
+
27
+ - **Fix(client): locale/dictionary registration is idempotent — retry & re-sync no longer trap the plugin in FAILED.** (thanks @Ronnoc, #70)
28
+ - DSH's `locale.addLanguage`/`locale.register` throw when an entry already exists (`locale "pt-BR" is already registered`). The apply effect registered `pt-BR`/`es` and four `agy-link` dictionaries unconditionally, so re-applying the module (inventory page retry / fiber reconciliation) threw and marked the entry `FAILED`. Registration now checks the existing catalog and tolerates only the documented `already registered` / `already has locale` errors (anything else still rethrows); disposing never removes host-owned entries. Also hardens the settings nav-icon observer against a missing `<body>`/DOMContentLoaded timing, and isolates toolview slot registration failures.
29
+
30
+ ### 中文
31
+
32
+ - **修复(client):locale/词典注册幂等——重试与重新同步不再把插件卡进 FAILED。**(感谢 @Ronnoc,#70)
33
+ - DSH 的 `locale.addLanguage`/`locale.register` 在条目已存在时会抛错(`locale "pt-BR" is already registered`)。apply effect 无条件注册 `pt-BR`/`es` 与四份 `agy-link` 词典,插件重载/条目重试时会抛异常并把条目置为 `FAILED`。现注册前检查现有目录,仅容忍 `already registered`/`already has locale` 两类错误(其它仍抛出);dispose 不会删除宿主已有的条目。同时加固设置导航图标的 observer(body/DOMContentLoaded 时机)并把 toolview 槽位注册失败隔离。
34
+
35
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.5.4...v0.5.5
36
+
3
37
  ## 0.5.4 (2026-11-05)
4
38
 
5
39
  ### English
package/dist/client.js CHANGED
@@ -2771,26 +2771,30 @@ window.__ModuleLoader__.load({
2771
2771
  });
2772
2772
  }
2773
2773
  function installAgyToolView(ctx) {
2774
- ctx.slots.inject("tool.call.toolview", () => {
2775
- const d1 = ctx.slots.register({
2776
- name: "tool.call.toolview",
2777
- key: "agy_tool",
2778
- id: "agy-tool-view",
2779
- label: "Antigravity tool",
2780
- locale: NS
2781
- }, AgyMirrorToolView);
2782
- const d2 = ctx.slots.register({
2783
- name: "tool.call.toolview",
2784
- key: "run_code",
2785
- id: "agy-run-code-view",
2786
- label: "Antigravity (code mode)",
2787
- locale: NS
2788
- }, AgyRunCodeToolView);
2789
- return () => {
2790
- d2();
2791
- d1();
2792
- };
2793
- });
2774
+ try {
2775
+ ctx.slots?.inject?.("tool.call.toolview", () => {
2776
+ const d1 = ctx.slots.register({
2777
+ name: "tool.call.toolview",
2778
+ key: "agy_tool",
2779
+ id: "agy-tool-view",
2780
+ label: "Antigravity tool",
2781
+ locale: NS
2782
+ }, AgyMirrorToolView);
2783
+ const d2 = ctx.slots.register({
2784
+ name: "tool.call.toolview",
2785
+ key: "run_code",
2786
+ id: "agy-run-code-view",
2787
+ label: "Antigravity (code mode)",
2788
+ locale: NS
2789
+ }, AgyRunCodeToolView);
2790
+ return () => {
2791
+ d2();
2792
+ d1();
2793
+ };
2794
+ });
2795
+ } catch (err) {
2796
+ console.warn("[dsh-agy-link] agy tool view slot registration failed:", err);
2797
+ }
2794
2798
  }
2795
2799
  const ROW_CSS = `
2796
2800
  /* Container */
@@ -3913,7 +3917,7 @@ div[data-variant="think"] [class*="thinkBody"] {
3913
3917
  });
3914
3918
  }
3915
3919
  if (isInteractionLocked()) return;
3916
- if (body.clientHeight > 8) {
3920
+ if (toggle.getAttribute("aria-expanded") === "true" || toggle.dataset.expanded === "true" || root.dataset.expanded === "true" || !body.hidden && body.style.display !== "none" && body.clientHeight > 8) {
3917
3921
  handledTurns.add(turnKey);
3918
3922
  root.dataset.agyExpanded = "true";
3919
3923
  return;
@@ -3927,7 +3931,7 @@ div[data-variant="think"] [class*="thinkBody"] {
3927
3931
  function scanThinkingRows() {
3928
3932
  if (typeof document === "undefined") return;
3929
3933
  if (isInteractionLocked()) return;
3930
- const rows = document.querySelectorAll("div[data-variant=\"think\"]");
3934
+ const rows = document.querySelectorAll("div[data-variant=\"think\"]:not([data-agy-expanded=\"true\"])");
3931
3935
  for (let i = 0; i < rows.length; i++) {
3932
3936
  const row = rows[i];
3933
3937
  if (row) tryExpandThinkRow(row);
@@ -5177,7 +5181,8 @@ body.dark .agy-tsl-card,
5177
5181
  tag.dataset.plugin = "dsh-agy-link";
5178
5182
  tag.dataset.pluginCss = "dsh-agy-link/settings-nav-icon";
5179
5183
  tag.textContent = navIconCss(agyNavLogoUrl());
5180
- document.head.appendChild(tag);
5184
+ const head = document.head ?? document.documentElement;
5185
+ if (head) head.appendChild(tag);
5181
5186
  let disposed = false;
5182
5187
  let scheduled = false;
5183
5188
  const sync = () => {
@@ -5197,15 +5202,28 @@ body.dark .agy-tsl-card,
5197
5202
  queueMicrotask(sync);
5198
5203
  };
5199
5204
  sync();
5200
- const observer = new MutationObserver(schedule);
5201
- observer.observe(document.body, {
5202
- childList: true,
5203
- subtree: true,
5204
- attributeFilter: [NAV_ICON_MARKER]
5205
- });
5205
+ let observer = null;
5206
+ const setupObserver = () => {
5207
+ if (disposed || !document.body) return;
5208
+ try {
5209
+ observer = new MutationObserver(schedule);
5210
+ observer.observe(document.body, {
5211
+ childList: true,
5212
+ subtree: true,
5213
+ attributeFilter: [NAV_ICON_MARKER]
5214
+ });
5215
+ } catch (err) {
5216
+ console.warn("[dsh-agy-link] nav icon observer setup failed:", err);
5217
+ }
5218
+ };
5219
+ if (document.readyState === "loading") window.addEventListener("DOMContentLoaded", setupObserver, { once: true });
5220
+ else setupObserver();
5206
5221
  return () => {
5207
5222
  disposed = true;
5208
- observer.disconnect();
5223
+ if (observer !== null) {
5224
+ observer.disconnect();
5225
+ observer = null;
5226
+ }
5209
5227
  for (const row of Array.from(document.querySelectorAll(`[${NAV_ICON_MARKER}]`))) row.removeAttribute(NAV_ICON_MARKER);
5210
5228
  tag.remove();
5211
5229
  };
@@ -6137,20 +6155,41 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6137
6155
  }, "agy-link: status polling");
6138
6156
  const locale = ctx.locale;
6139
6157
  ctx.effect(() => {
6140
- const disposePtBR = locale.addLanguage({
6158
+ const safeAddLanguage = (lang) => {
6159
+ try {
6160
+ const snapshotLocales = typeof locale?.getSnapshot === "function" ? locale.getSnapshot()?.locales : void 0;
6161
+ const list = Array.isArray(snapshotLocales) ? snapshotLocales : typeof locale?.localeList === "function" ? locale.localeList() : [];
6162
+ if (Array.isArray(list) && list.some((l) => l?.id?.toLowerCase() === lang.id.toLowerCase())) return () => {};
6163
+ return locale.addLanguage(lang);
6164
+ } catch (err) {
6165
+ const message = String(err?.message || err);
6166
+ if (/already registered/i.test(message)) return () => {};
6167
+ throw err;
6168
+ }
6169
+ };
6170
+ const safeRegister = (ns, langOrDicts, dict) => {
6171
+ try {
6172
+ return locale.register(ns, langOrDicts, dict);
6173
+ } catch (err) {
6174
+ const message = String(err?.message || err);
6175
+ if (/already has locale/i.test(message)) return () => {};
6176
+ throw err;
6177
+ }
6178
+ };
6179
+ const disposePtBR = safeAddLanguage({
6141
6180
  id: "pt-BR",
6142
6181
  label: "Português (Brasil)",
6143
6182
  fallback: "en"
6144
6183
  });
6145
- const disposeEs = locale.addLanguage({
6184
+ const disposeEs = safeAddLanguage({
6146
6185
  id: "es",
6147
6186
  label: "Español",
6148
6187
  fallback: "en"
6149
6188
  });
6150
- const disposeZh = locale.register(NS, "zh", zh);
6151
- const disposeEn = locale.register(NS, "en", en);
6152
- const disposePtBRDictionary = locale.register(NS, "pt-BR", ptBR);
6153
- const disposeEsDictionary = locale.register(NS, "es", es);
6189
+ const disposeZh = safeRegister(NS, "zh", zh);
6190
+ const disposeEn = safeRegister(NS, "en", en);
6191
+ const disposePtBRDictionary = safeRegister(NS, "pt-BR", ptBR);
6192
+ const disposeEsDictionary = safeRegister(NS, "es", es);
6154
6193
  return () => {
6155
6194
  disposeEsDictionary();
6156
6195
  disposePtBRDictionary();
@@ -7476,7 +7515,11 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7476
7515
  if (typeof document !== "undefined" && document.documentElement) document.documentElement.classList.remove("agy-modal-open");
7477
7516
  };
7478
7517
  });
7479
- installAgyToolView(ctx);
7518
+ try {
7519
+ installAgyToolView(ctx);
7520
+ } catch (err) {
7521
+ console.warn("[dsh-agy-link] agy tool view registration failed:", err);
7522
+ }
7480
7523
  ctx.effect(() => installAutoExpandReasoning());
7481
7524
  ctx.effect(() => installMermaidRendering());
7482
7525
  ctx.effect(() => installImageEnhancer());
package/dist/index.js CHANGED
@@ -184,6 +184,26 @@ function looksLikeNetworkError(message) {
184
184
  return /dial tcp|fetch failed|econn(?:refused|reset|aborted)|enotfound|ehostunreach|enetunreach|socket hang up|getaddrinfo|bad gateway|service unavailable|unexpected eof|\beof\b|tls handshake timeout|i\/o timeout|network (?:error|is unreachable)|no route to host|connection reset|context deadline exceeded|temporary failure in name resolution|proxyconnect|token validation failed|validate (?:the )?token|silent auth failed/i.test(message);
185
185
  }
186
186
  /**
187
+ * Decide AUTH vs NETWORK for one failed agy run.
188
+ *
189
+ * Both the wide transport regex and the narrow keyring-jitter regex must see
190
+ * the SAME evidence. The run log used to reach only the narrow one, so a proxy
191
+ * blip that agy 1.4.12 logs as "keyringAuth: token validation failed due to
192
+ * network error" was classified AUTH and quarantined a healthy account
193
+ * (issue #71). Exported so the decision stays a pure, testable seam.
194
+ */
195
+ function isTransportFailure(input) {
196
+ const runLogText = input.runLogText ?? "";
197
+ if (looksLikeAuthVerificationJitter(runLogText)) return true;
198
+ return looksLikeNetworkError([
199
+ input.rawErrText,
200
+ input.authFailureText ?? "",
201
+ input.stderrTail ?? "",
202
+ (input.stdoutHead ?? "").slice(0, 4e3),
203
+ runLogText
204
+ ].filter(Boolean).join(" "));
205
+ }
206
+ /**
187
207
  * Backoff schedule for CONSECUTIVE transport (NETWORK) failures.
188
208
  *
189
209
  * DSH's generic backoff starts at 2s and doubles, which spends the whole retry
@@ -31872,12 +31892,13 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
31872
31892
  const isRateLimit = looksLikeRateLimit(rawErrText);
31873
31893
  const runLogText = readAgyRunLogText(runLogHome, runLogsBefore);
31874
31894
  const keyringJitter = looksLikeAuthVerificationJitter(runLogText);
31875
- const transportFailure = keyringJitter || looksLikeNetworkError([
31895
+ const transportFailure = isTransportFailure({
31876
31896
  rawErrText,
31877
- parser.stats.authFailureText ?? "",
31878
- outcome.stderrTail,
31879
- outcome.stdout.slice(0, 4e3)
31880
- ].filter(Boolean).join(" "));
31897
+ authFailureText: parser.stats.authFailureText ?? "",
31898
+ stderrTail: outcome.stderrTail,
31899
+ stdoutHead: outcome.stdout,
31900
+ runLogText
31901
+ });
31881
31902
  const silentTimeout = outcome.timedOut === true && outcome.stdout.trim() === "";
31882
31903
  let failure = null;
31883
31904
  if (outcome.aborted) failure = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
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",