dsh-agy-link 0.5.3 → 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 +32 -0
- package/dist/client.js +78 -35
- package/dist/index.js +49 -59
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
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
|
+
|
|
17
|
+
## 0.5.4 (2026-11-05)
|
|
18
|
+
|
|
19
|
+
### English
|
|
20
|
+
|
|
21
|
+
- **Fix(quota): serialize Windows CLI quota refresh and close two Windows slot-isolation holes.** (thanks @Ronnoc, #69)
|
|
22
|
+
- `readCliUsageFamilies` ran `agy -p /usage` **without** the credential-slot mutex. On Windows the OS credential store is one shared slot that secondary runs temporarily swap, so an in-flight CLI read could attribute a secondary account's quota/reset to the primary. The read now holds `credentialSlotMutex` (4 s timeout, REST fallback on contention), and forced refreshes run sequentially on Windows.
|
|
23
|
+
- `cliSlotHoldsAccount()` could tautologically match the slot against itself when no independent durable credential/disk token existed; `getStoredToken()` now takes `allowKeychainFallback` and the slot check refuses that self-match.
|
|
24
|
+
- Deduplicates the Windows credential read via `wincred.readWindowsCredentialRaw`, and makes `defaultPoolDir()`/`isolatedHomeEnv()` recover the top-level `.dsh/agy-accounts` when invoked inside an isolated account dir (prevents nested credential files / mislabeled accounts).
|
|
25
|
+
|
|
26
|
+
### 中文
|
|
27
|
+
|
|
28
|
+
- **修复(quota):Windows 下串行化 CLI 额度刷新,并堵住两个槽位隔离漏洞。**(感谢 @Ronnoc,#69)
|
|
29
|
+
- `readCliUsageFamilies` 调 `agy -p /usage` 时**没有**持 `credentialSlotMutex`。Windows 的凭据存储是单槽,子账号运行会临时换槽,于是进行中的 CLI 读取可能把子账号的额度/重置时间记到主账号。现读取期间持锁(4s 超时,争用则回退 REST),Windows 的强制刷新也改为顺序执行。
|
|
30
|
+
- `cliSlotHoldsAccount()` 在缺少独立持久凭据/磁盘 token 时可能拿槽位与自己比对(恒真);`getStoredToken()` 新增 `allowKeychainFallback`,该检查拒绝这种自匹配。
|
|
31
|
+
- 通过 `wincred.readWindowsCredentialRaw` 复用 Windows 凭据读取;`defaultPoolDir()`/`isolatedHomeEnv()` 在隔离账号目录内调用时恢复到顶层 `.dsh/agy-accounts`(避免嵌套凭据文件与账号误标)。
|
|
32
|
+
|
|
33
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.5.3...v0.5.4
|
|
34
|
+
|
|
3
35
|
## 0.5.3 (2026-11-05)
|
|
4
36
|
|
|
5
37
|
### English
|
package/dist/client.js
CHANGED
|
@@ -2771,26 +2771,30 @@ window.__ModuleLoader__.load({
|
|
|
2771
2771
|
});
|
|
2772
2772
|
}
|
|
2773
2773
|
function installAgyToolView(ctx) {
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
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.
|
|
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
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
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
|
|
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
|
|
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 =
|
|
6184
|
+
const disposeEs = safeAddLanguage({
|
|
6146
6185
|
id: "es",
|
|
6147
6186
|
label: "Español",
|
|
6148
6187
|
fallback: "en"
|
|
6149
6188
|
});
|
|
6150
|
-
const disposeZh =
|
|
6151
|
-
const disposeEn =
|
|
6152
|
-
const disposePtBRDictionary =
|
|
6153
|
-
const disposeEsDictionary =
|
|
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
|
-
|
|
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
|
@@ -3315,7 +3315,8 @@ function isolatedHomeEnv(dir) {
|
|
|
3315
3315
|
HOME: dir,
|
|
3316
3316
|
GEMINI_CLI_HOME: geminiDir,
|
|
3317
3317
|
ANTIGRAVITY_GEMINI_DIR: geminiDir,
|
|
3318
|
-
ANTIGRAVITY_APP_DATA_DIR: join(geminiDir, "antigravity-cli")
|
|
3318
|
+
ANTIGRAVITY_APP_DATA_DIR: join(geminiDir, "antigravity-cli"),
|
|
3319
|
+
DSH_STATE_DIR: process.env.DSH_STATE_DIR || join(homedir(), ".dsh")
|
|
3319
3320
|
};
|
|
3320
3321
|
if (IS_WIN$2) {
|
|
3321
3322
|
env.USERPROFILE = dir;
|
|
@@ -4229,9 +4230,14 @@ function detectSystemProxy(platform = process.platform) {
|
|
|
4229
4230
|
expiresAt: now + 3e5
|
|
4230
4231
|
};
|
|
4231
4232
|
}
|
|
4232
|
-
function defaultPoolDir() {
|
|
4233
|
-
|
|
4234
|
-
|
|
4233
|
+
function defaultPoolDir(home = homedir()) {
|
|
4234
|
+
if (process.env.DSH_STATE_DIR) return join(process.env.DSH_STATE_DIR, "agy-accounts");
|
|
4235
|
+
const idx = home.replace(/\\/g, "/").indexOf("/.dsh/agy-accounts/");
|
|
4236
|
+
if (idx !== -1) {
|
|
4237
|
+
const realHome = home.slice(0, idx);
|
|
4238
|
+
return join(realHome, ".dsh", "agy-accounts");
|
|
4239
|
+
}
|
|
4240
|
+
return join(home, ".dsh", "agy-accounts");
|
|
4235
4241
|
}
|
|
4236
4242
|
var AccountPoolManager = class {
|
|
4237
4243
|
data;
|
|
@@ -34977,45 +34983,7 @@ async function readMacKeychainToken() {
|
|
|
34977
34983
|
async function readWindowsCredentialToken() {
|
|
34978
34984
|
if (process.platform !== "win32") return null;
|
|
34979
34985
|
try {
|
|
34980
|
-
const raw = (
|
|
34981
|
-
"-NoProfile",
|
|
34982
|
-
"-NonInteractive",
|
|
34983
|
-
"-ExecutionPolicy",
|
|
34984
|
-
"Bypass",
|
|
34985
|
-
"-Command",
|
|
34986
|
-
[
|
|
34987
|
-
"$sig = @'",
|
|
34988
|
-
"using System;",
|
|
34989
|
-
"using System.Runtime.InteropServices;",
|
|
34990
|
-
"public class AgyCred {",
|
|
34991
|
-
" [DllImport(\"advapi32.dll\", SetLastError=true, CharSet=CharSet.Unicode)]",
|
|
34992
|
-
" public static extern bool CredRead(string target, int type, int flags, out IntPtr credential);",
|
|
34993
|
-
" [DllImport(\"advapi32.dll\", SetLastError=true)]",
|
|
34994
|
-
" public static extern void CredFree(IntPtr cred);",
|
|
34995
|
-
" [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]",
|
|
34996
|
-
" public struct CREDENTIAL {",
|
|
34997
|
-
" public int Flags; public int Type; public IntPtr TargetName;",
|
|
34998
|
-
" public IntPtr Comment; public long LastWritten; public int CredentialBlobSize;",
|
|
34999
|
-
" public IntPtr CredentialBlob; public int Persist; public int AttributeCount;",
|
|
35000
|
-
" public IntPtr Attributes; public IntPtr TargetAlias; public IntPtr UserName;",
|
|
35001
|
-
" }",
|
|
35002
|
-
" public static byte[] Read(string target) {",
|
|
35003
|
-
" IntPtr p;",
|
|
35004
|
-
" if (!CredRead(target, 1, 0, out p)) return null;",
|
|
35005
|
-
" CREDENTIAL c = (CREDENTIAL)Marshal.PtrToStructure(p, typeof(CREDENTIAL));",
|
|
35006
|
-
" byte[] b = new byte[c.CredentialBlobSize];",
|
|
35007
|
-
" Marshal.Copy(c.CredentialBlob, b, 0, c.CredentialBlobSize);",
|
|
35008
|
-
" CredFree(p);",
|
|
35009
|
-
" return b;",
|
|
35010
|
-
" }",
|
|
35011
|
-
"}",
|
|
35012
|
-
"'@",
|
|
35013
|
-
"Add-Type -TypeDefinition $sig -ErrorAction Stop",
|
|
35014
|
-
"$b = [AgyCred]::Read('gemini:antigravity')",
|
|
35015
|
-
"if ($b -eq $null) { exit 1 }",
|
|
35016
|
-
"[Console]::Out.Write([System.Text.Encoding]::UTF8.GetString($b))"
|
|
35017
|
-
].join("\n")
|
|
35018
|
-
], 8e3)).trim();
|
|
34986
|
+
const raw = readWindowsCredentialRaw("gemini:antigravity");
|
|
35019
34987
|
if (!raw) return null;
|
|
35020
34988
|
return parseGoKeyringPayload(raw);
|
|
35021
34989
|
} catch {
|
|
@@ -35061,18 +35029,32 @@ var QuotaService = class {
|
|
|
35061
35029
|
const bin = this.cliDeps.bin?.();
|
|
35062
35030
|
if (!bin) return null;
|
|
35063
35031
|
if (account.dir && !account.systemHome) return null;
|
|
35064
|
-
|
|
35065
|
-
|
|
35066
|
-
|
|
35067
|
-
|
|
35068
|
-
|
|
35069
|
-
|
|
35070
|
-
|
|
35071
|
-
|
|
35072
|
-
|
|
35073
|
-
|
|
35074
|
-
|
|
35075
|
-
|
|
35032
|
+
let releaseMutex = null;
|
|
35033
|
+
if (process.platform === "win32") try {
|
|
35034
|
+
releaseMutex = await credentialSlotMutex.acquire({
|
|
35035
|
+
timeoutMs: 4e3,
|
|
35036
|
+
pollMs: 500,
|
|
35037
|
+
shouldProceed: () => true
|
|
35038
|
+
});
|
|
35039
|
+
} catch {
|
|
35040
|
+
return null;
|
|
35041
|
+
}
|
|
35042
|
+
try {
|
|
35043
|
+
if (!await this.cliSlotHoldsAccount(account)) return null;
|
|
35044
|
+
const groups = await readAgyUsage({
|
|
35045
|
+
bin,
|
|
35046
|
+
env: {
|
|
35047
|
+
...process.env,
|
|
35048
|
+
...account.dir ? isolatedHomeEnv(account.dir) : {},
|
|
35049
|
+
...proxyEnvFor(this.proxyFor(account))
|
|
35050
|
+
},
|
|
35051
|
+
timeoutMs: 2e4,
|
|
35052
|
+
preemptAutoUpdate: this.cliDeps.preemptAutoUpdate?.()
|
|
35053
|
+
});
|
|
35054
|
+
return groups === null ? null : usageGroupsToFamilies(groups);
|
|
35055
|
+
} finally {
|
|
35056
|
+
releaseMutex?.();
|
|
35057
|
+
}
|
|
35076
35058
|
}
|
|
35077
35059
|
/**
|
|
35078
35060
|
* True when the machine credential slot provably holds this account's grant.
|
|
@@ -35085,7 +35067,9 @@ var QuotaService = class {
|
|
|
35085
35067
|
async cliSlotHoldsAccount(account) {
|
|
35086
35068
|
const slot = await this.readSystemKeychainToken();
|
|
35087
35069
|
if (slot === null) return false;
|
|
35088
|
-
|
|
35070
|
+
const stored = await this.getStoredToken(account, false);
|
|
35071
|
+
if (stored === null) return false;
|
|
35072
|
+
return sameCredentialGrant(slot, stored);
|
|
35089
35073
|
}
|
|
35090
35074
|
/** Dedicated account proxy wins, then the global config proxy, then detected system proxy. */
|
|
35091
35075
|
proxyFor(account) {
|
|
@@ -35117,7 +35101,7 @@ var QuotaService = class {
|
|
|
35117
35101
|
* WRONG account's numbers). Isolated pool accounts only ever read their
|
|
35118
35102
|
* own directory's file; the Keychain is one shared slot they must not see.
|
|
35119
35103
|
*/
|
|
35120
|
-
async getStoredToken(account) {
|
|
35104
|
+
async getStoredToken(account, allowKeychainFallback = true) {
|
|
35121
35105
|
const disk = (() => {
|
|
35122
35106
|
const file = this.getTokenFilePath(account);
|
|
35123
35107
|
if (!existsSync(file)) return null;
|
|
@@ -35133,8 +35117,10 @@ var QuotaService = class {
|
|
|
35133
35117
|
const storedToken = stored ? parseCredentialDoc(stored.raw) : null;
|
|
35134
35118
|
if (storedToken && (storedToken.accessToken || storedToken.refreshToken)) return storedToken;
|
|
35135
35119
|
}
|
|
35136
|
-
|
|
35137
|
-
|
|
35120
|
+
if (allowKeychainFallback) {
|
|
35121
|
+
const keychainToken = await this.readSystemKeychainToken();
|
|
35122
|
+
if (keychainToken && (keychainToken.accessToken || keychainToken.refreshToken)) return keychainToken;
|
|
35123
|
+
}
|
|
35138
35124
|
}
|
|
35139
35125
|
return disk;
|
|
35140
35126
|
}
|
|
@@ -35595,6 +35581,10 @@ var QuotaService = class {
|
|
|
35595
35581
|
}
|
|
35596
35582
|
return;
|
|
35597
35583
|
}
|
|
35584
|
+
if (process.platform === "win32") {
|
|
35585
|
+
for (const acc of accounts) await this.refreshAccountQuota(acc, force).catch(() => null);
|
|
35586
|
+
return;
|
|
35587
|
+
}
|
|
35598
35588
|
await Promise.allSettled(accounts.map((acc) => this.refreshAccountQuota(acc, force)));
|
|
35599
35589
|
}
|
|
35600
35590
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.5.
|
|
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",
|