dsh-agy-link 0.4.19 → 0.4.20
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 +9 -0
- package/dist/index.js +38 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.20 (2026-08-27)
|
|
4
|
+
|
|
5
|
+
- **Fixed: Primary Account Quota Fetched With a STALE Token (主账号刷新/同步拿的值不对).**
|
|
6
|
+
- **Root cause (verified live)**: on macOS, agy >= 1.1.15 keeps its CURRENT credential in the Keychain; the on-disk `antigravity-oauth-token` was a stale leftover from a PREVIOUS account's login. `getStoredToken` read the disk file FIRST and only fell back to the Keychain — so every 刷新/同步 used the old account's (still-valid) token and displayed ITS quota under the current login's name (observed: agy authenticated as q98… while the disk file still held elegantmanco's token; UI showed the wrong account's 5h/weekly numbers).
|
|
7
|
+
- **Keychain-first token resolution**: for the primary / system-HOME account the Keychain credential now WINS over the on-disk file (disk remains the fallback for older agy builds and non-mac systems). Isolated pool accounts are pinned by test to never touch the shared Keychain. Verified end-to-end against live Google endpoints: the primary's token identity and quota now match the actual agy login (5h 91% / weekly 31% instead of the stale account's numbers).
|
|
8
|
+
- **Token-anchored identity on manual refresh**: `refreshAccountQuota(force=true)` additionally calls the OAuth userinfo endpoint once per explicit user click and re-labels the slot to the token's TRUE owner (`resetAccountIdentity`), so an external `agy logout` + re-login self-heals in one click even when logs disagree.
|
|
9
|
+
- **Log detection hardened**: `detectEmailFromAgyLogs` returns the LAST match per file (append-ordered logs → newest login wins), fixing first-match returning a superseded account.
|
|
10
|
+
- **Risk posture preserved**: background polls (force=false) still NEVER call userinfo — zero extra network on the automatic path (pinned by a regression test).
|
|
11
|
+
|
|
3
12
|
## 0.4.19 (2026-08-26)
|
|
4
13
|
|
|
5
14
|
- **Fixed: Antigravity Models Missing From the Model Picker (登录成功、额度正常但模型列表为空 — issue #1).**
|
package/dist/index.js
CHANGED
|
@@ -27726,8 +27726,11 @@ function detectEmailFromAgyLogs(homeDir) {
|
|
|
27726
27726
|
time: statSync(join(logDir, f)).mtimeMs
|
|
27727
27727
|
})).sort((a, b) => b.time - a.time).slice(0, 5);
|
|
27728
27728
|
for (const file of files) try {
|
|
27729
|
-
const
|
|
27730
|
-
|
|
27729
|
+
const content = readFileSync(join(logDir, file.name), "utf8");
|
|
27730
|
+
const re = /(?:authenticated successfully as|applyAuthResult:\s*email=|"email"\s*:\s*"|User:\s*)\s*([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/gi;
|
|
27731
|
+
let last;
|
|
27732
|
+
for (let m = re.exec(content); m !== null; m = re.exec(content)) if (m[1]) last = m[1];
|
|
27733
|
+
if (last) return last;
|
|
27731
27734
|
} catch {}
|
|
27732
27735
|
} catch {}
|
|
27733
27736
|
}
|
|
@@ -27814,21 +27817,39 @@ var QuotaService = class {
|
|
|
27814
27817
|
return join(home, ".gemini", "antigravity-cli", "antigravity-oauth-token");
|
|
27815
27818
|
}
|
|
27816
27819
|
/**
|
|
27820
|
+
* Read the system-HOME Keychain credential. Protected so tests (and future
|
|
27821
|
+
* platforms) can substitute the reader without touching the real Keychain.
|
|
27822
|
+
*/
|
|
27823
|
+
readSystemKeychainToken() {
|
|
27824
|
+
return readMacKeychainToken();
|
|
27825
|
+
}
|
|
27826
|
+
/**
|
|
27817
27827
|
* Read the active token document and normalize it to a flat StoredToken.
|
|
27818
|
-
*
|
|
27819
|
-
*
|
|
27828
|
+
*
|
|
27829
|
+
* Precedence for the primary / system-HOME account: the macOS Keychain
|
|
27830
|
+
* WINS over the on-disk token file. agy >= 1.1.15 keeps its CURRENT
|
|
27831
|
+
* credential in the Keychain; the on-disk antigravity-oauth-token can be a
|
|
27832
|
+
* stale leftover from a PREVIOUS account's login (verified live: disk
|
|
27833
|
+
* held an old account's token while agy itself was authenticated as
|
|
27834
|
+
* someone else — disk-first precedence made every quota refresh fetch the
|
|
27835
|
+
* WRONG account's numbers). Isolated pool accounts only ever read their
|
|
27836
|
+
* own directory's file; the Keychain is one shared slot they must not see.
|
|
27820
27837
|
*/
|
|
27821
27838
|
getStoredToken(account) {
|
|
27822
|
-
const
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27839
|
+
const disk = (() => {
|
|
27840
|
+
const file = this.getTokenFilePath(account);
|
|
27841
|
+
if (!existsSync(file)) return null;
|
|
27842
|
+
try {
|
|
27843
|
+
const tok = normalizeStoredToken(JSON.parse(readFileSync(file, "utf8")));
|
|
27844
|
+
if (tok && (tok.accessToken || tok.refreshToken)) return tok;
|
|
27845
|
+
} catch {}
|
|
27846
|
+
return null;
|
|
27847
|
+
})();
|
|
27827
27848
|
if (account.systemHome || !account.dir) {
|
|
27828
|
-
const keychainToken =
|
|
27829
|
-
if (keychainToken) return keychainToken;
|
|
27849
|
+
const keychainToken = this.readSystemKeychainToken();
|
|
27850
|
+
if (keychainToken && (keychainToken.accessToken || keychainToken.refreshToken)) return keychainToken;
|
|
27830
27851
|
}
|
|
27831
|
-
return
|
|
27852
|
+
return disk;
|
|
27832
27853
|
}
|
|
27833
27854
|
/** Persist refreshed tokens back in the SAME on-disk shape agy wrote. */
|
|
27834
27855
|
persistRefreshedToken(account, tokens) {
|
|
@@ -27967,9 +27988,13 @@ var QuotaService = class {
|
|
|
27967
27988
|
const detected = detectEmailFromAgyLogs(home);
|
|
27968
27989
|
if (detected) email = detected;
|
|
27969
27990
|
}
|
|
27970
|
-
if (email && email !== account.email) this.pool.resetAccountIdentity(account.id, email);
|
|
27971
27991
|
const accessToken = await this.getValidAccessToken(account);
|
|
27972
27992
|
if (!accessToken) return null;
|
|
27993
|
+
if (force) {
|
|
27994
|
+
const info = await this.fetchUserInfo(accessToken, account.proxyUrl);
|
|
27995
|
+
if (info?.email) email = info.email;
|
|
27996
|
+
}
|
|
27997
|
+
if (email && email !== account.email) this.pool.resetAccountIdentity(account.id, email);
|
|
27973
27998
|
const [summary, discovered] = await Promise.all([this.fetchQuotaSummary(accessToken, account.proxyUrl), this.fetchAvailableModels(accessToken, account.proxyUrl)]);
|
|
27974
27999
|
if (!email) {
|
|
27975
28000
|
const info = await this.fetchUserInfo(accessToken, account.proxyUrl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
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",
|