dsh-agy-link 0.5.4 → 0.5.5

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.5.5 (2026-11-05)
4
+
5
+ ### English
6
+
7
+ - **Fix(client): locale/dictionary registration is idempotent — retry & re-sync no longer trap the plugin in FAILED.** (thanks @Ronnoc, #70)
8
+ - 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.
9
+
10
+ ### 中文
11
+
12
+ - **修复(client):locale/词典注册幂等——重试与重新同步不再把插件卡进 FAILED。**(感谢 @Ronnoc,#70)
13
+ - 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 槽位注册失败隔离。
14
+
15
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.5.4...v0.5.5
16
+
3
17
  ## 0.5.4 (2026-11-05)
4
18
 
5
19
  ### 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 */
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
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",