dsh-agy-link 0.6.7 → 0.6.9
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 +34 -0
- package/dist/index.js +81 -27
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.9 (2026-11-09)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(pool): `pool.json` can no longer be torn by two writers, and a corrupt file recovers from a last-good snapshot instead of emptying the pool (issue #90).**
|
|
8
|
+
- Persists used a single fixed `.pool.json.tmp`, so two host processes writing at once could overwrite/truncate each other and leave a half-written file that `load()` could only discard — the UI then showed an empty account pool. Writes now go through a tmp name unique per writer (pid + random), a JSON round-trip validation, and `rename` with retries.
|
|
9
|
+
- Every successful persist also refreshes `pool.json.last-good`. If the primary file is unparsable, `load()` keeps the forensic `pool.json.corrupt-<ts>` copy **and** restores the last-good snapshot (`recoveredFromLastGood` is observable for diagnostics) before falling back to defaults.
|
|
10
|
+
|
|
11
|
+
### 中文
|
|
12
|
+
|
|
13
|
+
- **修复(pool):两个写者同时持久化不再撕裂 `pool.json`,损坏时会从 last-good 快照恢复而不是把账号池清空(issue #90)。**
|
|
14
|
+
- 持久化过去固定用 `.pool.json.tmp`,两个宿主进程同时写会互相覆盖/截断,留下半截文件,`load()` 只能丢弃——UI 表现为「账号全没了」。现在写入改为**每写者唯一**的 tmp 名(pid + 随机)、写后 JSON 往返校验、`rename` 重试。
|
|
15
|
+
- 每次成功持久化同时刷新 `pool.json.last-good`;主文件无法解析时,`load()` 先保留 `pool.json.corrupt-<ts>` 取证副本,**再**恢复 last-good 快照(`recoveredFromLastGood` 可供诊断),两者都失败才回落默认池。
|
|
16
|
+
|
|
17
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.8...v0.6.9
|
|
18
|
+
|
|
19
|
+
## 0.6.8 (2026-11-08)
|
|
20
|
+
|
|
21
|
+
### English
|
|
22
|
+
|
|
23
|
+
- **Fix(warmup): the 7-day warmup no longer freezes on a floating post-reset window, and probes use models each account actually has.** (thanks @Ronnoc, #88)
|
|
24
|
+
- After an upstream weekly reset (or for an account with zero usage), Google returns a floating `resetTime = now + 7 days` with no `description`. The old trigger only fired at `now >= resetTs - 60s`, so those accounts were never probed and the weekly timer floated at "7d 0h" forever. A probe now also fires when `remainingMs >= 6 days`, and the cooldown key is deterministic (`identity:family:weekly`) so a floating reset can no longer invalidate it.
|
|
25
|
+
- Argon is exposed with effort tiers; probing the bare `gemini-4-argon` got a 404. It maps to `gemini-4-argon-low`, and when the account's quota row lists Argon models the low tier is picked from it.
|
|
26
|
+
- Accounts differ in which Claude generation they can use (legacy `claude-sonnet-4-6` vs migrated `claude-sonnet-5-5-*`). The probe model is now chosen per account from `quotas.anthropic.models` (monitored pick → any Sonnet low/medium → any Sonnet → any Claude), instead of a global `claude-sonnet-4-6`.
|
|
27
|
+
|
|
28
|
+
### 中文
|
|
29
|
+
|
|
30
|
+
- **修复(warmup):7 天预热不再卡在「重置后的浮动窗口」,且探测模型按账号实际可用选择。**(感谢 @Ronnoc,#88)
|
|
31
|
+
- 上游周额度重置后(或本周期零使用),Google 返回浮动的 `resetTime = now + 7 天` 且无 `description`;旧逻辑只在 `now >= resetTs - 60s` 时触发,于是这些账号永远不被探活,周计时器一直显示浮动「7d 0h」。现在 `remainingMs >= 6 天` 也会触发,且冷却键固定为 `identity:family:weekly`,浮动 reset 不会再让它失效。
|
|
32
|
+
- Argon 上游按思考档位暴露模型,直接探测 `gemini-4-argon` 会 404;现映射到 `gemini-4-argon-low`,并优先从该账号的配额模型列表里取 low 档。
|
|
33
|
+
- 不同账号可用的 Claude 代际不同(旧账号 `claude-sonnet-4-6`,迁移账号 `claude-sonnet-5-5-*`);探测模型改为按 `quotas.anthropic.models` **逐账号**选择(monitored 命中 → 任意 Sonnet low/medium → 任意 Sonnet → 任意 Claude),不再全局写死 `claude-sonnet-4-6`。
|
|
34
|
+
|
|
35
|
+
**Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.7...v0.6.8
|
|
36
|
+
|
|
3
37
|
## 0.6.7 (2026-11-08)
|
|
4
38
|
|
|
5
39
|
### English
|
package/dist/index.js
CHANGED
|
@@ -4380,6 +4380,29 @@ function detectSystemProxy(platform = process.platform) {
|
|
|
4380
4380
|
expiresAt: now + 3e5
|
|
4381
4381
|
};
|
|
4382
4382
|
}
|
|
4383
|
+
/**
|
|
4384
|
+
* Write `body` to `file` without ever publishing a torn snapshot: a tmp name
|
|
4385
|
+
* unique per writer (pid + random), a JSON round-trip check, then `rename`
|
|
4386
|
+
* with retries. Two host processes persisting at once used to collide on one
|
|
4387
|
+
* fixed `.pool.json.tmp` and silently truncate the pool (2026-11-04).
|
|
4388
|
+
*/
|
|
4389
|
+
function writeJsonAtomic(file, body) {
|
|
4390
|
+
const dir = dirname(file);
|
|
4391
|
+
const tmp = join(dir, "." + basename(file) + "." + process.pid + "." + Math.random().toString(36).slice(2, 8) + ".tmp");
|
|
4392
|
+
writeFileSync(tmp, body, "utf8");
|
|
4393
|
+
JSON.parse(readFileSync(tmp, "utf8"));
|
|
4394
|
+
let lastErr;
|
|
4395
|
+
for (let attempt = 0; attempt < 3; attempt++) try {
|
|
4396
|
+
renameSync(tmp, file);
|
|
4397
|
+
return;
|
|
4398
|
+
} catch (e) {
|
|
4399
|
+
lastErr = e;
|
|
4400
|
+
}
|
|
4401
|
+
try {
|
|
4402
|
+
unlinkSync(tmp);
|
|
4403
|
+
} catch {}
|
|
4404
|
+
throw lastErr;
|
|
4405
|
+
}
|
|
4383
4406
|
function defaultPoolDir(home = homedir()) {
|
|
4384
4407
|
if (process.env.DSH_STATE_DIR) return join(process.env.DSH_STATE_DIR, "agy-accounts");
|
|
4385
4408
|
const idx = home.replace(/\\/g, "/").indexOf("/.dsh/agy-accounts/");
|
|
@@ -4409,6 +4432,8 @@ var AccountPoolManager = class {
|
|
|
4409
4432
|
authStrikes = /* @__PURE__ */ new Map();
|
|
4410
4433
|
/** Serialized snapshot of the last successful persist/load; skips no-op writes. */
|
|
4411
4434
|
persistedJson = "";
|
|
4435
|
+
/** True when load() had to fall back to pool.json.last-good (observable for diagnostics). */
|
|
4436
|
+
recoveredFromLastGood = false;
|
|
4412
4437
|
constructor(baseDir = defaultPoolDir()) {
|
|
4413
4438
|
this.baseDir = baseDir;
|
|
4414
4439
|
this.file = join(baseDir, "pool.json");
|
|
@@ -4427,9 +4452,22 @@ var AccountPoolManager = class {
|
|
|
4427
4452
|
return this.baseDir;
|
|
4428
4453
|
}
|
|
4429
4454
|
load() {
|
|
4455
|
+
const primary = this.readPoolFile(this.file);
|
|
4456
|
+
if (primary) return primary;
|
|
4430
4457
|
try {
|
|
4431
|
-
if (existsSync(this.file))
|
|
4432
|
-
|
|
4458
|
+
if (existsSync(this.file)) copyFileSync(this.file, this.file + ".corrupt-" + Date.now());
|
|
4459
|
+
} catch {}
|
|
4460
|
+
const lastGood = this.readPoolFile(this.file + ".last-good");
|
|
4461
|
+
if (lastGood) {
|
|
4462
|
+
this.recoveredFromLastGood = true;
|
|
4463
|
+
return lastGood;
|
|
4464
|
+
}
|
|
4465
|
+
return defaultPoolData();
|
|
4466
|
+
}
|
|
4467
|
+
readPoolFile(file) {
|
|
4468
|
+
try {
|
|
4469
|
+
if (existsSync(file)) {
|
|
4470
|
+
const raw = readFileSync(file, "utf8");
|
|
4433
4471
|
const parsed = JSON.parse(raw);
|
|
4434
4472
|
if (parsed && Array.isArray(parsed.accounts)) {
|
|
4435
4473
|
parsed.accounts = parsed.accounts.filter((acc) => acc && typeof acc === "object" && acc.type !== "gemini-web");
|
|
@@ -4453,12 +4491,8 @@ var AccountPoolManager = class {
|
|
|
4453
4491
|
};
|
|
4454
4492
|
}
|
|
4455
4493
|
}
|
|
4456
|
-
} catch {
|
|
4457
|
-
|
|
4458
|
-
if (existsSync(this.file)) copyFileSync(this.file, this.file + ".corrupt-" + Date.now());
|
|
4459
|
-
} catch {}
|
|
4460
|
-
}
|
|
4461
|
-
return defaultPoolData();
|
|
4494
|
+
} catch {}
|
|
4495
|
+
return null;
|
|
4462
4496
|
}
|
|
4463
4497
|
persist() {
|
|
4464
4498
|
const serialized = JSON.stringify(this.data);
|
|
@@ -4482,11 +4516,13 @@ var AccountPoolManager = class {
|
|
|
4482
4516
|
try {
|
|
4483
4517
|
mkdirSync(dirname(this.file), { recursive: true });
|
|
4484
4518
|
if (serialized === this.persistedJson && merged === this.data) return;
|
|
4485
|
-
const
|
|
4486
|
-
|
|
4487
|
-
renameSync(tmp, this.file);
|
|
4519
|
+
const body = JSON.stringify(merged, null, 2);
|
|
4520
|
+
writeJsonAtomic(this.file, body);
|
|
4488
4521
|
this.persistedJson = JSON.stringify(merged);
|
|
4489
4522
|
if (merged !== this.data) this.data = merged;
|
|
4523
|
+
try {
|
|
4524
|
+
writeJsonAtomic(this.file + ".last-good", body);
|
|
4525
|
+
} catch {}
|
|
4490
4526
|
} catch (e) {
|
|
4491
4527
|
try {
|
|
4492
4528
|
console.error("[dsh-agy-link] pool persist failed: " + String(e));
|
|
@@ -35837,14 +35873,31 @@ function toCanonicalWarmupModel(model) {
|
|
|
35837
35873
|
const clean = model.trim().toLowerCase();
|
|
35838
35874
|
if (clean === "gemini-3-flash") return "gemini-3.8-flash-tiered";
|
|
35839
35875
|
if (/^gemini-3\.\d+-flash$/.test(clean)) return clean + "-tiered";
|
|
35840
|
-
if (clean
|
|
35876
|
+
if (clean === "gemini-4-argon" || clean === "argon") return "gemini-4-argon-low";
|
|
35841
35877
|
return model.trim();
|
|
35842
35878
|
}
|
|
35843
35879
|
/** Select target model for a given family honoring user monitored_models preferences. */
|
|
35844
|
-
function pickWarmupModelForFamily(family, monitoredModels = []) {
|
|
35845
|
-
if (family === "
|
|
35880
|
+
function pickWarmupModelForFamily(family, monitoredModels = [], account) {
|
|
35881
|
+
if (family === "argon") {
|
|
35882
|
+
if (account?.quotas?.argon?.models?.length) {
|
|
35883
|
+
const m = account.quotas.argon.models.find((x) => x.modelId.includes("argon-low")) ?? account.quotas.argon.models.find((x) => x.modelId.includes("argon"));
|
|
35884
|
+
if (m) return m.modelId;
|
|
35885
|
+
}
|
|
35886
|
+
return "gemini-4-argon-low";
|
|
35887
|
+
}
|
|
35888
|
+
if (family === "anthropic") {
|
|
35889
|
+
const accountModels = account?.quotas?.anthropic?.models?.map((m) => m.modelId) ?? [];
|
|
35890
|
+
if (accountModels.length > 0) {
|
|
35891
|
+
const preferred = monitoredModels.find((m) => accountModels.includes(m));
|
|
35892
|
+
if (preferred) return preferred;
|
|
35893
|
+
const sonnet = accountModels.find((m) => m.includes("sonnet") && (m.includes("low") || m.includes("medium"))) ?? accountModels.find((m) => m.includes("sonnet"));
|
|
35894
|
+
if (sonnet) return sonnet;
|
|
35895
|
+
const anyClaude = accountModels.find((m) => m.toLowerCase().includes("claude"));
|
|
35896
|
+
if (anyClaude) return anyClaude;
|
|
35897
|
+
}
|
|
35898
|
+
return monitoredModels.find((m) => m.toLowerCase().includes("claude")) ?? "claude-sonnet-4-6";
|
|
35899
|
+
}
|
|
35846
35900
|
if (family === "openai") return monitoredModels.find((m) => m.toLowerCase().includes("gpt")) ?? "gpt-oss-120b-medium";
|
|
35847
|
-
if (family === "argon") return "gemini-4-argon";
|
|
35848
35901
|
return monitoredModels.find((m) => m.toLowerCase().includes("gemini") && !m.toLowerCase().includes("argon")) ?? "gemini-3.8-flash";
|
|
35849
35902
|
}
|
|
35850
35903
|
/**
|
|
@@ -36176,23 +36229,24 @@ var WarmupService = class {
|
|
|
36176
36229
|
const weeklyFrac = q.weeklyFraction;
|
|
36177
36230
|
if (weeklyFrac === void 0 || weeklyFrac < .999) continue;
|
|
36178
36231
|
let shouldWarm = false;
|
|
36179
|
-
|
|
36180
|
-
|
|
36181
|
-
|
|
36182
|
-
|
|
36183
|
-
|
|
36184
|
-
|
|
36185
|
-
|
|
36232
|
+
const historyKey = `${identity}:${fam}:weekly`;
|
|
36233
|
+
const hasRecentWarmup = this.history.checkCooldown(historyKey, SIX_DAYS_MS, now);
|
|
36234
|
+
if (options.force) shouldWarm = true;
|
|
36235
|
+
else if (!hasRecentWarmup) {
|
|
36236
|
+
if (!q.weeklyResetTime) shouldWarm = true;
|
|
36237
|
+
else {
|
|
36238
|
+
const resetTs = Date.parse(q.weeklyResetTime);
|
|
36239
|
+
if (isNaN(resetTs)) shouldWarm = true;
|
|
36240
|
+
else {
|
|
36241
|
+
const remainingMs = resetTs - now;
|
|
36242
|
+
if (now >= resetTs - 6e4 || remainingMs >= SIX_DAYS_MS) shouldWarm = true;
|
|
36186
36243
|
}
|
|
36187
36244
|
}
|
|
36188
|
-
} else {
|
|
36189
|
-
historyKey = `${identity}:${fam}:weekly:initial`;
|
|
36190
|
-
shouldWarm = options.force || !this.history.checkCooldown(historyKey, SIX_DAYS_MS, now);
|
|
36191
36245
|
}
|
|
36192
36246
|
const failureKey = `${historyKey}:failed`;
|
|
36193
36247
|
if (shouldWarm && !options.force && this.history.checkCooldown(failureKey, FAILURE_BACKOFF_MS, now)) shouldWarm = false;
|
|
36194
36248
|
if (shouldWarm) {
|
|
36195
|
-
const model = pickWarmupModelForFamily(fam, monitored);
|
|
36249
|
+
const model = pickWarmupModelForFamily(fam, monitored, account);
|
|
36196
36250
|
modelsToPing.push({
|
|
36197
36251
|
family: fam,
|
|
36198
36252
|
model,
|
|
@@ -36202,7 +36256,7 @@ var WarmupService = class {
|
|
|
36202
36256
|
}
|
|
36203
36257
|
}
|
|
36204
36258
|
if (modelsToPing.length === 0 && options.force) {
|
|
36205
|
-
const fallbackModel = pickWarmupModelForFamily("google", monitored);
|
|
36259
|
+
const fallbackModel = pickWarmupModelForFamily("google", monitored, account);
|
|
36206
36260
|
modelsToPing.push({
|
|
36207
36261
|
family: "google",
|
|
36208
36262
|
model: fallbackModel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
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",
|