dsh-agy-link 0.6.26 → 0.6.28
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 +22 -0
- package/dist/cli-image.mjs +39 -4
- package/dist/index.js +36 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.28 (2026-11-15)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(auth): a terminal TOS quarantine can no longer be cleared by the same warmup request (fixes #114).** v0.6.26 correctly marked a `TOS_VIOLATION` account `authRequired`, but `handlePoolWarmup` then ran an unconditional `refreshAccountQuota(acc, true)`; the quota pipeline (and boot hygiene / token refresh) calls `clearAuthRequired` on any successful refresh. A banned account still has a valid refresh token, so the flag was set and cleared within one HTTP request, and `needsAuthReverify` would have retried it every 10 minutes. `clearAuthRequired(id, force = false)` now refuses to lift a terminal ban; only **explicit user actions** (a completed OAuth login or a fresh credential import) pass `force: true`. `needsAuthReverify()` excludes terminal errors. Regression tests: pure classifier, real `AccountPoolManager` stickiness, and a route-level warmup → forced quota refresh → still `authRequired` test.
|
|
8
|
+
|
|
9
|
+
### 中文
|
|
10
|
+
|
|
11
|
+
- **修复(认证):TOS 终态隔离不再被同一轮 warmup 清除(修复 #114)。** v0.6.26 已正确把 `TOS_VIOLATION` 账号标为 `authRequired`,但 `handlePoolWarmup` 随后无条件执行 `refreshAccountQuota(acc, true)`,而配额流水线(以及启动凭据恢复、token 刷新)在任何一次刷新成功后都会调用 `clearAuthRequired`。被停用账号的 refresh_token 仍然有效,于是「打标记 → 清标记」发生在同一次 HTTP 请求内,`needsAuthReverify` 还会每 10 分钟重试一次。现在 `clearAuthRequired(id, force = false)` 拒绝解除终态封禁;只有**显式用户操作**(完成 OAuth 登录、重新导入凭据)传入 `force: true`。`needsAuthReverify()` 也排除终态错误。回归测试覆盖:纯分类器、真实 `AccountPoolManager` 的粘性,以及路由级「预热 → 强制配额刷新 → authRequired 仍为真」。
|
|
12
|
+
|
|
13
|
+
## 0.6.27 (2026-11-15)
|
|
14
|
+
|
|
15
|
+
### English
|
|
16
|
+
|
|
17
|
+
- **Fix(security): DSH plan mode is now read-only at the agy layer (issue #113, part 2).** `permissionMode` was always taken from the static config (default `skip` → `--dangerously-skip-permissions`), so during a plan-mode turn agy could still write files and the `exit_plan_mode` approval card only constrained the prompt. A new `effectivePermissionMode()` forces `--mode plan` when the host is in plan mode, using the presence of the `exit_plan_mode` tool as a **current-turn** signal so exiting plan mode immediately restores the configured mode; auxiliary calls keep their existing read-only policy. Pure decision matrix + real-spawn argv regression tests.
|
|
18
|
+
- **Not planned: interactive `ask_question` / `/grill-me` (issue #113, part 1).** This is not a filter bug: agy's `-p` / `--input-format stream-json` print mode is one-way and auto-answers `ask_question` with `User Skipped`. Making it interactive requires replacing the bridge's transport with ACP (`agy acp`, stdio JSON-RPC) — a different session lifecycle, streaming protocol and tool-mirroring path, i.e. a separate architectural project, not a patch. The question card rendering already exists; it appears after the turn because print mode cannot pause. Tracked in the issue reply, not shipped here.
|
|
19
|
+
|
|
20
|
+
### 中文
|
|
21
|
+
|
|
22
|
+
- **修复(安全):DSH plan mode 在 agy 层也强制只读(issue #113 第 2 项)。** `permissionMode` 此前只取静态配置(缺省 `skip` → `--dangerously-skip-permissions`),所以规划轮次里 agy 仍能直接写文件,`exit_plan_mode` 审批卡只约束了提示词。新增 `effectivePermissionMode()`:当宿主处于 plan mode 时强制 `--mode plan`,并以「本轮提供了 `exit_plan_mode` 工具」作为当前轮次信号(避免历史里的 plan 提示词让会话永久只读),退出 plan mode 立即恢复配置值;辅助调用沿用既有只读策略。纯函数矩阵 + 真实 spawn argv 双重回归测试。
|
|
23
|
+
- **暂不实现:交互式 `ask_question` / `/grill-me`(issue #113 第 1 项)。** 这不是过滤逻辑缺陷:agy 的 `-p` / `--input-format stream-json` 是单向 print 模式,会把 `ask_question` 自动回填 `User Skipped`。要真正交互必须把桥接层传输协议换成 ACP(`agy acp`,stdio JSON-RPC),涉及完全不同的会话生命周期、流式协议与工具镜像链路,属于独立架构项目而非补丁。问题卡片渲染已存在,只是因为 print 模式无法暂停而出现在轮次结束之后。已在 issue 回复中说明,本版本不发布该能力。
|
|
24
|
+
|
|
3
25
|
## 0.6.26 (2026-11-15)
|
|
4
26
|
|
|
5
27
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -1491,6 +1491,16 @@ function accountSupportsModel(acc, model, pool, catalog) {
|
|
|
1491
1491
|
if (acc.quotas && Object.keys(acc.quotas).length > 0 && acc.quotas.google !== void 0) return false;
|
|
1492
1492
|
return true;
|
|
1493
1493
|
}
|
|
1494
|
+
/**
|
|
1495
|
+
* A flagged account whose flag is old enough (or whose flag predates the
|
|
1496
|
+
* authMarkedAt bookkeeping) may be re-verified in the background. If the
|
|
1497
|
+
* stored token still works the flag clears itself; if not, the flag is
|
|
1498
|
+
* simply re-stamped.
|
|
1499
|
+
*/
|
|
1500
|
+
/** A terminal account ban (Google TOS_VIOLATION) is not a transient auth error. */
|
|
1501
|
+
function isTerminalAuthError(message) {
|
|
1502
|
+
return typeof message === "string" && /TOS_VIOLATION/i.test(message);
|
|
1503
|
+
}
|
|
1494
1504
|
function defaultPoolData() {
|
|
1495
1505
|
return {
|
|
1496
1506
|
version: 1,
|
|
@@ -1502,6 +1512,20 @@ function defaultPoolData() {
|
|
|
1502
1512
|
}
|
|
1503
1513
|
//#endregion
|
|
1504
1514
|
//#region src/provider/call-context.ts
|
|
1515
|
+
/**
|
|
1516
|
+
* Effective agy permission mode for one turn.
|
|
1517
|
+
*
|
|
1518
|
+
* DSH plan mode is a READ-ONLY contract. `cfg.permissionMode` is static and
|
|
1519
|
+
* defaults to `skip` (`--dangerously-skip-permissions`); without this override
|
|
1520
|
+
* agy can write files while the host believes it is only planning (issue #113).
|
|
1521
|
+
* The caller supplies `dshPlanMode` from a CURRENT-turn signal (the host only
|
|
1522
|
+
* exposes `exit_plan_mode` while plan mode is active), never from stale
|
|
1523
|
+
* history, so exiting plan mode restores the configured mode immediately.
|
|
1524
|
+
* Auxiliary calls already have their own read-only policy.
|
|
1525
|
+
*/
|
|
1526
|
+
function effectivePermissionMode(configured, dshPlanMode, isAux) {
|
|
1527
|
+
return dshPlanMode && !isAux ? "plan" : configured;
|
|
1528
|
+
}
|
|
1505
1529
|
function resolveCallContext(input) {
|
|
1506
1530
|
const { options, cfg, bin } = input;
|
|
1507
1531
|
if (!bin) throw new LlmError("agy binary not found on PATH — install it via https://antigravity.google/docs/cli/install", Err.AGY_NOT_INSTALLED);
|
|
@@ -7121,9 +7145,19 @@ var PoolAdmin = class {
|
|
|
7121
7145
|
delete acc.authMarkedAt;
|
|
7122
7146
|
this.deps.persist();
|
|
7123
7147
|
}
|
|
7124
|
-
|
|
7148
|
+
/**
|
|
7149
|
+
* Drop the "needs re-login" flag.
|
|
7150
|
+
*
|
|
7151
|
+
* Automatic paths (a successful quota/token refresh, boot-time credential
|
|
7152
|
+
* recovery) must NOT lift a TERMINAL TOS ban: those accounts still have a
|
|
7153
|
+
* valid refresh token, so every refresh would succeed and clear the ban
|
|
7154
|
+
* (issue #114). `force` is reserved for explicit user actions — a completed
|
|
7155
|
+
* re-login or a fresh credential import.
|
|
7156
|
+
*/
|
|
7157
|
+
clearAuthRequired(id, force = false) {
|
|
7125
7158
|
const acc = this.account(id);
|
|
7126
7159
|
if (!acc) return;
|
|
7160
|
+
if (!force && isTerminalAuthError(acc.authError)) return;
|
|
7127
7161
|
delete acc.authRequired;
|
|
7128
7162
|
delete acc.authError;
|
|
7129
7163
|
delete acc.authMarkedAt;
|
|
@@ -7940,8 +7974,8 @@ var AccountPoolManager = class {
|
|
|
7940
7974
|
resetAccountIdentity(id, newEmail) {
|
|
7941
7975
|
this.admin.resetAccountIdentity(id, newEmail);
|
|
7942
7976
|
}
|
|
7943
|
-
clearAuthRequired(id) {
|
|
7944
|
-
this.admin.clearAuthRequired(id);
|
|
7977
|
+
clearAuthRequired(id, force = false) {
|
|
7978
|
+
this.admin.clearAuthRequired(id, force);
|
|
7945
7979
|
}
|
|
7946
7980
|
/** Drop an email label that is provably wrong (e.g. a foreign token overwrote it). */
|
|
7947
7981
|
clearAccountEmail(id) {
|
|
@@ -34030,6 +34064,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
34030
34064
|
const goalContext = resolveGoalContext(options.messages, liveGoal);
|
|
34031
34065
|
const supportsGoalUpdate = Boolean(options.tools?.some((t) => t.name === "update_goal"));
|
|
34032
34066
|
const supportsPlanExit = Boolean(options.tools?.some((t) => t.name === "exit_plan_mode")) && isPlanMode(options.messages);
|
|
34067
|
+
const agyPermissionMode = effectivePermissionMode(permissionMode, supportsPlanExit, isAux);
|
|
34033
34068
|
const continuation = detectContinuation(options.messages);
|
|
34034
34069
|
if (continuation !== null) {
|
|
34035
34070
|
const rec = this.deps.runs.get(continuation.runId);
|
|
@@ -34209,7 +34244,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
34209
34244
|
}, {
|
|
34210
34245
|
cfg,
|
|
34211
34246
|
bin,
|
|
34212
|
-
permissionMode,
|
|
34247
|
+
permissionMode: agyPermissionMode,
|
|
34213
34248
|
sessionKey,
|
|
34214
34249
|
workspaceRoot,
|
|
34215
34250
|
isAux,
|
package/dist/index.js
CHANGED
|
@@ -595,9 +595,14 @@ const AUTH_REVERIFY_DELAY_MS = 6e5;
|
|
|
595
595
|
* stored token still works the flag clears itself; if not, the flag is
|
|
596
596
|
* simply re-stamped.
|
|
597
597
|
*/
|
|
598
|
+
/** A terminal account ban (Google TOS_VIOLATION) is not a transient auth error. */
|
|
599
|
+
function isTerminalAuthError(message) {
|
|
600
|
+
return typeof message === "string" && /TOS_VIOLATION/i.test(message);
|
|
601
|
+
}
|
|
598
602
|
function needsAuthReverify(account, now = Date.now()) {
|
|
599
603
|
if (!account.enabled) return false;
|
|
600
604
|
if (!account.authRequired) return false;
|
|
605
|
+
if (isTerminalAuthError(account.authError)) return false;
|
|
601
606
|
if (typeof account.authMarkedAt !== "number") return true;
|
|
602
607
|
return now - account.authMarkedAt > AUTH_REVERIFY_DELAY_MS;
|
|
603
608
|
}
|
|
@@ -2916,6 +2921,20 @@ async function runAgyOnce(deps, req) {
|
|
|
2916
2921
|
}
|
|
2917
2922
|
//#endregion
|
|
2918
2923
|
//#region src/provider/call-context.ts
|
|
2924
|
+
/**
|
|
2925
|
+
* Effective agy permission mode for one turn.
|
|
2926
|
+
*
|
|
2927
|
+
* DSH plan mode is a READ-ONLY contract. `cfg.permissionMode` is static and
|
|
2928
|
+
* defaults to `skip` (`--dangerously-skip-permissions`); without this override
|
|
2929
|
+
* agy can write files while the host believes it is only planning (issue #113).
|
|
2930
|
+
* The caller supplies `dshPlanMode` from a CURRENT-turn signal (the host only
|
|
2931
|
+
* exposes `exit_plan_mode` while plan mode is active), never from stale
|
|
2932
|
+
* history, so exiting plan mode restores the configured mode immediately.
|
|
2933
|
+
* Auxiliary calls already have their own read-only policy.
|
|
2934
|
+
*/
|
|
2935
|
+
function effectivePermissionMode(configured, dshPlanMode, isAux) {
|
|
2936
|
+
return dshPlanMode && !isAux ? "plan" : configured;
|
|
2937
|
+
}
|
|
2919
2938
|
function resolveCallContext(input) {
|
|
2920
2939
|
const { options, cfg, bin } = input;
|
|
2921
2940
|
if (!bin) throw new LlmError("agy binary not found on PATH — install it via https://antigravity.google/docs/cli/install", Err.AGY_NOT_INSTALLED);
|
|
@@ -7696,9 +7715,19 @@ var PoolAdmin = class {
|
|
|
7696
7715
|
delete acc.authMarkedAt;
|
|
7697
7716
|
this.deps.persist();
|
|
7698
7717
|
}
|
|
7699
|
-
|
|
7718
|
+
/**
|
|
7719
|
+
* Drop the "needs re-login" flag.
|
|
7720
|
+
*
|
|
7721
|
+
* Automatic paths (a successful quota/token refresh, boot-time credential
|
|
7722
|
+
* recovery) must NOT lift a TERMINAL TOS ban: those accounts still have a
|
|
7723
|
+
* valid refresh token, so every refresh would succeed and clear the ban
|
|
7724
|
+
* (issue #114). `force` is reserved for explicit user actions — a completed
|
|
7725
|
+
* re-login or a fresh credential import.
|
|
7726
|
+
*/
|
|
7727
|
+
clearAuthRequired(id, force = false) {
|
|
7700
7728
|
const acc = this.account(id);
|
|
7701
7729
|
if (!acc) return;
|
|
7730
|
+
if (!force && isTerminalAuthError(acc.authError)) return;
|
|
7702
7731
|
delete acc.authRequired;
|
|
7703
7732
|
delete acc.authError;
|
|
7704
7733
|
delete acc.authMarkedAt;
|
|
@@ -8207,8 +8236,8 @@ var AccountPoolManager = class {
|
|
|
8207
8236
|
resetAccountIdentity(id, newEmail) {
|
|
8208
8237
|
this.admin.resetAccountIdentity(id, newEmail);
|
|
8209
8238
|
}
|
|
8210
|
-
clearAuthRequired(id) {
|
|
8211
|
-
this.admin.clearAuthRequired(id);
|
|
8239
|
+
clearAuthRequired(id, force = false) {
|
|
8240
|
+
this.admin.clearAuthRequired(id, force);
|
|
8212
8241
|
}
|
|
8213
8242
|
/** Drop an email label that is provably wrong (e.g. a foreign token overwrote it). */
|
|
8214
8243
|
clearAccountEmail(id) {
|
|
@@ -34549,6 +34578,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
34549
34578
|
const goalContext = resolveGoalContext(options.messages, liveGoal);
|
|
34550
34579
|
const supportsGoalUpdate = Boolean(options.tools?.some((t) => t.name === "update_goal"));
|
|
34551
34580
|
const supportsPlanExit = Boolean(options.tools?.some((t) => t.name === "exit_plan_mode")) && isPlanMode(options.messages);
|
|
34581
|
+
const agyPermissionMode = effectivePermissionMode(permissionMode, supportsPlanExit, isAux);
|
|
34552
34582
|
const continuation = detectContinuation(options.messages);
|
|
34553
34583
|
if (continuation !== null) {
|
|
34554
34584
|
const rec = this.deps.runs.get(continuation.runId);
|
|
@@ -34728,7 +34758,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
34728
34758
|
}, {
|
|
34729
34759
|
cfg,
|
|
34730
34760
|
bin,
|
|
34731
|
-
permissionMode,
|
|
34761
|
+
permissionMode: agyPermissionMode,
|
|
34732
34762
|
sessionKey,
|
|
34733
34763
|
workspaceRoot,
|
|
34734
34764
|
isAux,
|
|
@@ -37506,7 +37536,7 @@ var PoolAuthFlow = class {
|
|
|
37506
37536
|
} catch {}
|
|
37507
37537
|
if (alias?.trim()) this.pool.setAccountAlias(existing.id, alias.trim());
|
|
37508
37538
|
if (proxyUrl?.trim()) this.pool.setAccountProxy(existing.id, proxyUrl.trim());
|
|
37509
|
-
this.pool.clearAuthRequired(existing.id);
|
|
37539
|
+
this.pool.clearAuthRequired(existing.id, true);
|
|
37510
37540
|
this.pool.clearCooldown(existing.id, void 0, true);
|
|
37511
37541
|
this.pool.updateAccountQuotas(existing.id, existing.quotas ?? {}, email);
|
|
37512
37542
|
this.quota.refreshAccountQuota(existing).catch(() => void 0);
|
|
@@ -37619,7 +37649,7 @@ var PoolAuthFlow = class {
|
|
|
37619
37649
|
renameSync(stagedFile, targetFile);
|
|
37620
37650
|
saveCredentialBackup(targetFile);
|
|
37621
37651
|
this.pool.updateAccountQuotas(account.id, {}, email);
|
|
37622
|
-
this.pool.clearAuthRequired(account.id);
|
|
37652
|
+
this.pool.clearAuthRequired(account.id, true);
|
|
37623
37653
|
this.pool.cleanupStagingSlot(flow.dir);
|
|
37624
37654
|
this.quota.refreshAccountQuota(account).catch(() => void 0);
|
|
37625
37655
|
this.flow = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.28",
|
|
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",
|