dsh-agy-link 0.5.2 → 0.5.4
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/index.js +50 -60
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.4 (2026-11-05)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(quota): serialize Windows CLI quota refresh and close two Windows slot-isolation holes.** (thanks @Ronnoc, #69)
|
|
8
|
+
- `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.
|
|
9
|
+
- `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.
|
|
10
|
+
- 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).
|
|
11
|
+
|
|
12
|
+
### 中文
|
|
13
|
+
|
|
14
|
+
- **修复(quota):Windows 下串行化 CLI 额度刷新,并堵住两个槽位隔离漏洞。**(感谢 @Ronnoc,#69)
|
|
15
|
+
- `readCliUsageFamilies` 调 `agy -p /usage` 时**没有**持 `credentialSlotMutex`。Windows 的凭据存储是单槽,子账号运行会临时换槽,于是进行中的 CLI 读取可能把子账号的额度/重置时间记到主账号。现读取期间持锁(4s 超时,争用则回退 REST),Windows 的强制刷新也改为顺序执行。
|
|
16
|
+
- `cliSlotHoldsAccount()` 在缺少独立持久凭据/磁盘 token 时可能拿槽位与自己比对(恒真);`getStoredToken()` 新增 `allowKeychainFallback`,该检查拒绝这种自匹配。
|
|
17
|
+
- 通过 `wincred.readWindowsCredentialRaw` 复用 Windows 凭据读取;`defaultPoolDir()`/`isolatedHomeEnv()` 在隔离账号目录内调用时恢复到顶层 `.dsh/agy-accounts`(避免嵌套凭据文件与账号误标)。
|
|
18
|
+
|
|
19
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.5.3...v0.5.4
|
|
20
|
+
|
|
21
|
+
## 0.5.3 (2026-11-05)
|
|
22
|
+
|
|
23
|
+
### English
|
|
24
|
+
|
|
25
|
+
- **Fix(models): a missing Google per-model quota breakdown no longer hides Gemini 4 Argon for Google AI Ultra (issue #68).**
|
|
26
|
+
- `accountHasArgon()` treated *"a `google` quota group exists but has no `models` list"* as an authoritative negative, so the discovered-catalog fallback below it was unreachable. Ultra folds Argon into the shared Gemini bucket and omits the per-model list entirely, so Ultra accounts never saw `Gemini 4 Argon` in `/model`. A negative is now only authoritative when the Google group DOES enumerate its models (a free/standard account listing them without Argon); a missing list is treated as unknown and the per-account discovered catalog decides. Adds Ultra + free-breakdown regression tests.
|
|
27
|
+
|
|
28
|
+
### 中文
|
|
29
|
+
|
|
30
|
+
- **修复(models):Google 配额缺少逐模型明细时不再把 Gemini 4 Argon 从 Google AI Ultra 账号隐藏(issue #68)。**
|
|
31
|
+
- `accountHasArgon()` 把「存在 `google` 配额组但没有 `models` 列表」当成权威否定,导致后面的已发现目录回退永远不可达。Ultra 会把 Argon 折进共享的 Gemini 桶并完全不发逐模型列表,因此 Ultra 账号在 `/model` 里始终看不到 `Gemini 4 Argon`。现在只有 Google 组**确实枚举了模型**时(免费/标准账号列出模型但不含 Argon)才判为否定;缺少列表视为未知,由该账号的已发现目录决定。补充 Ultra 与免费账号逐模型明细的回归测试。
|
|
32
|
+
|
|
33
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.5.2...v0.5.3
|
|
34
|
+
|
|
3
35
|
## 0.5.2 (2026-11-04)
|
|
4
36
|
|
|
5
37
|
### English
|
package/dist/index.js
CHANGED
|
@@ -2295,7 +2295,7 @@ function accountHasArgon(acc, pool, catalog) {
|
|
|
2295
2295
|
if (acc.quotas?.argon !== void 0) return true;
|
|
2296
2296
|
if (pool && typeof pool.hasDedicatedGroup === "function" && pool.hasDedicatedGroup(acc.id, "argon")) return true;
|
|
2297
2297
|
if (acc.quotas?.google?.models?.some((m) => isArgonModel(m.modelId))) return true;
|
|
2298
|
-
if (acc.quotas?.google
|
|
2298
|
+
if (Array.isArray(acc.quotas?.google?.models)) return false;
|
|
2299
2299
|
if (catalog && catalog.source === "discovered") return catalog.models.some((m) => isArgonModel(m.id));
|
|
2300
2300
|
return false;
|
|
2301
2301
|
}
|
|
@@ -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.4",
|
|
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",
|