dsh-agy-link 0.6.13 → 0.6.15

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 CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.15 (2026-11-10)
4
+
5
+ ### English
6
+
7
+ - **Fix(catalog): `listModels()` is side-effect free — the `agy models` feedback loop is gone (no more 100% CPU / fan spin / UI flashing).**
8
+ - `listModels()` kicked off `catalog.refreshIfNeeded()`, and a refresh that discovered models emits `llm/adapters-updated` — which makes DSH call `listModels()` again. Each round could spawn `agy models`, producing a self-sustaining probe loop until the TTL happened to suppress it (and for an account with no cached catalog the TTL guards were skipped entirely).
9
+ - Listing is now pure: it reads the cached catalog only. Freshness is owned by the startup probe, a new **30-minute periodic TTL refresh** (one probe per window at most), account switches (`forceRefreshAndNotify`) and the explicit `/agy` refresh paths.
10
+ - Test asserts two consecutive `listModels()` calls spawn zero discovery processes even with a zero TTL.
11
+
12
+ ### 中文
13
+
14
+ - **修复(catalog):`listModels()` 无副作用——`agy models` 反馈循环消失(不再 100% CPU / 风扇狂转 / UI 闪烁)。**
15
+ - 原实现里 `listModels()` 会触发 `catalog.refreshIfNeeded()`,而刷新发现新模型时会发 `llm/adapters-updated`,DSH 收到后又调用 `listModels()`——每轮都可能 spawn `agy models`,形成自维持的探测循环(对「尚无缓存目录」的账号更是完全跳过 TTL 守卫)。
16
+ - 现在列举是纯读缓存;新鲜度由启动探测、新增的**每 30 分钟 TTL 刷新**(每窗口最多一次探测)、切换账号(`forceRefreshAndNotify`)与显式 `/agy` 刷新负责。
17
+ - 测试断言:即使 TTL=0,连续两次 `listModels()` 也不会 spawn 任何探测进程。
18
+
19
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.14...v0.6.15
20
+
21
+ ## 0.6.14 (2026-11-10)
22
+
23
+ ### English
24
+
25
+ - **Feat(stability): optional `maxTurnMinutes` wall-clock cap — a self-driving turn can no longer run unbounded (issue #92).**
26
+ - The idle watchdog is re-armed by every output line, so an agy turn that keeps emitting events (async `task-xxxx` receipts, tool chatter) never trips it: `longToolIdleMinutes` (default 240) only bounds *silence*. A new `maxTurnMinutes` bounds the whole turn regardless of activity; when it fires the runner kills the agy process tree (SIGTERM group → SIGKILL escalation, `taskkill /T /F` on Windows) and the turn fails with a resumable `maxTurnMinutes` error.
27
+ - Default `0` = **off**, so behaviour is unchanged until you opt in (e.g. `DSH_AGY_MAX_TURN_MINUTES=60` for exploratory sessions). Env + config key, README/CONFIGURATION rows, and tests for the cap and the config precedence.
28
+
29
+ ### 中文
30
+
31
+ - **新增(稳定性):可选 `maxTurnMinutes` 墙钟上限——自驱动轮次不再可能无限运行(issue #92)。**
32
+ - 空闲看门狗会被每一行输出重置,所以「持续有输出」的 agy 轮次(异步 `task-xxxx` 回执、工具碎碎念)永远不会触发;`longToolIdleMinutes`(默认 240)只约束**静默**。新增 `maxTurnMinutes` 约束整轮墙钟,触发时 runner 会杀掉 agy 进程树(组 `SIGTERM`→`SIGKILL`,Windows `taskkill /T /F`),并返回可续跑的 `maxTurnMinutes` 错误。
33
+ - 默认 `0` = **关闭**,不改变现有行为;需要时显式开启(如排障类会话设 `DSH_AGY_MAX_TURN_MINUTES=60`)。含 env + 配置键、README/CONFIGURATION 说明,以及上限与配置优先级的测试。
34
+
35
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.13...v0.6.14
36
+
3
37
  ## 0.6.13 (2026-11-10)
4
38
 
5
39
  ### English
package/README.md CHANGED
@@ -162,6 +162,7 @@ dsh plugin --profile web add dsh-agy-link
162
162
  | `hiddenModels` | `DSH_AGY_HIDDEN_MODELS` | `[]` | 在 `/model` 选择器中隐藏的模型 slug 列表(黑名单语义,新模型默认可见;建议直接在设置面板"模型显示"中点选管理) |
163
163
  | `timeoutMs` | `DSH_AGY_TIMEOUT_MS` | `600000` | 单轮活跃看门狗超时(毫秒) |
164
164
  | `longToolIdleMinutes` | `DSH_AGY_LONG_TOOL_IDLE_MINUTES` | `240` | 存在未完成工具步骤(ACTIVE)时的空闲预算(分钟);`0` = 不抬高预算,卡死的工具按 `timeoutMs` 快速失败 |
165
+ | `maxTurnMinutes` | `DSH_AGY_MAX_TURN_MINUTES` | `0` | 单轮**墙钟**硬上限(分钟),`0` = 不限。空闲看门狗会被每一行输出重置,因此持续自驱动的会话只能靠它兜底;超限会终止 agy 进程树并返回可续跑错误(issue #92) |
165
166
  | `contextWindowDefault` | `DSH_AGY_CONTEXT_WINDOW` | `1048576` | 上报给 DSH 的模型上下文窗口(token)。agy 的模型列表不上报窗口,所以统一用该值;若你的模型实际是 256K(如部分 Claude/Gemini 配置),设为 `262144` 即可让「上下文已用 %」正确 |
166
167
  | `maxTokensDefault` | `DSH_AGY_MAX_TOKENS` | `65536` | 单次输出 token 上限(上报给 DSH) |
167
168
  | `workspaceRoot` | `DSH_AGY_WORKSPACE_ROOT` | 会话 cwd | agy 工作区根目录(默认跟随当前会话工作区) |
@@ -395,6 +396,7 @@ dsh plugin --profile web add dsh-agy-link
395
396
  | `hiddenModels` | `DSH_AGY_HIDDEN_MODELS` | `[]` | Model slugs hidden from the `/model` picker (deny-list, newly discovered models stay visible; manage them via the "Model visibility" row in the settings panel) |
396
397
  | `timeoutMs` | `DSH_AGY_TIMEOUT_MS` | `600000` | Activity watchdog timeout in milliseconds |
397
398
  | `longToolIdleMinutes` | `DSH_AGY_LONG_TOOL_IDLE_MINUTES` | `240` | Idle budget while a tool step is ACTIVE (minutes); `0` keeps the normal `timeoutMs` budget so wedged tools fail fast |
399
+ | `maxTurnMinutes` | `DSH_AGY_MAX_TURN_MINUTES` | `0` | Hard **wall-clock** cap per turn (minutes); `0` = unlimited. The idle watchdog is re-armed on every output line, so a self-driving session can only be bounded by this; exceeding it kills the agy process tree and returns a resumable error (issue #92) |
398
400
  | `contextWindowDefault` | `DSH_AGY_CONTEXT_WINDOW` | `1048576` | Model context window (tokens) reported to DSH. agy's model list carries no window, so this single value is used for every model; if yours is really 256K, set `262144` and the "context used %" becomes correct |
399
401
  | `maxTokensDefault` | `DSH_AGY_MAX_TOKENS` | `65536` | Output token cap reported to DSH |
400
402
  | `workspaceRoot` | `DSH_AGY_WORKSPACE_ROOT` | session cwd | Working directory root |
package/dist/index.js CHANGED
@@ -78,6 +78,7 @@ function defaultConfig() {
78
78
  defaultEffort: "high",
79
79
  timeoutMs: 6e5,
80
80
  longToolIdleMinutes: 240,
81
+ maxTurnMinutes: 0,
81
82
  /**
82
83
  * Hard cap (minutes) on waiting for the Windows credential slot before the
83
84
  * dispatch releases, backs off and retries (dispatchRetries). Each attempt
@@ -530,6 +531,7 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
530
531
  defaultEffort: asString(get("defaultEffort")) ?? base.defaultEffort,
531
532
  timeoutMs: asNum(get("timeoutMs")) ?? base.timeoutMs,
532
533
  longToolIdleMinutes: asNum(get("longToolIdleMinutes")) ?? base.longToolIdleMinutes,
534
+ maxTurnMinutes: asNum(get("maxTurnMinutes")) ?? base.maxTurnMinutes,
533
535
  dispatchTimeoutMinutes: asNum(get("dispatchTimeoutMinutes")) ?? base.dispatchTimeoutMinutes,
534
536
  dispatchRetries: asNum(get("dispatchRetries")) ?? base.dispatchRetries,
535
537
  parallelSameAccount: asBool(get("parallelSameAccount")) ?? base.parallelSameAccount,
@@ -596,6 +598,10 @@ function resolveConfig(entry, env = process.env, overrides = readOverrides()) {
596
598
  const t = asNum(env.DSH_AGY_LONG_TOOL_IDLE_MINUTES);
597
599
  if (t !== void 0 && t >= 0) cfg.longToolIdleMinutes = t;
598
600
  }
601
+ if (env.DSH_AGY_MAX_TURN_MINUTES) {
602
+ const mt = asNum(env.DSH_AGY_MAX_TURN_MINUTES);
603
+ if (mt !== void 0 && mt >= 0) cfg.maxTurnMinutes = mt;
604
+ }
599
605
  if (env.DSH_AGY_CONTEXT_WINDOW) {
600
606
  const w = asNum(env.DSH_AGY_CONTEXT_WINDOW);
601
607
  if (w !== void 0 && w > 0) cfg.contextWindowDefault = Math.floor(w);
@@ -3965,6 +3971,7 @@ function startAgyProcess(opts) {
3965
3971
  let stderr = "";
3966
3972
  let timedOut = false;
3967
3973
  let aborted = false;
3974
+ let capped = false;
3968
3975
  let settled = false;
3969
3976
  child.stdin?.on("error", () => {});
3970
3977
  if (opts.stdinPayload !== void 0) try {
@@ -3985,6 +3992,14 @@ function startAgyProcess(opts) {
3985
3992
  }, idleBudgetMs);
3986
3993
  };
3987
3994
  refreshWatchdog();
3995
+ let turnCap = null;
3996
+ if (opts.maxTurnMs !== void 0 && opts.maxTurnMs > 0) {
3997
+ turnCap = setTimeout(() => {
3998
+ capped = true;
3999
+ killTree(child);
4000
+ }, opts.maxTurnMs);
4001
+ turnCap.unref?.();
4002
+ }
3988
4003
  const onAbort = () => {
3989
4004
  aborted = true;
3990
4005
  killTree(child);
@@ -4019,6 +4034,7 @@ function startAgyProcess(opts) {
4019
4034
  if (settled) return;
4020
4035
  settled = true;
4021
4036
  if (watchdog) clearTimeout(watchdog);
4037
+ if (turnCap) clearTimeout(turnCap);
4022
4038
  opts.signal?.removeEventListener("abort", onAbort);
4023
4039
  const stdoutTail = stdoutDecoder.flush();
4024
4040
  if (stdoutTail !== "") {
@@ -4036,6 +4052,7 @@ function startAgyProcess(opts) {
4036
4052
  signal,
4037
4053
  timedOut,
4038
4054
  aborted,
4055
+ capped,
4039
4056
  stdout,
4040
4057
  stderrTail: stderr,
4041
4058
  durationMs: Date.now() - started
@@ -4055,6 +4072,7 @@ function startAgyProcess(opts) {
4055
4072
  if (reason === "timeout") timedOut = true;
4056
4073
  else aborted = true;
4057
4074
  if (watchdog) clearTimeout(watchdog);
4075
+ if (turnCap) clearTimeout(turnCap);
4058
4076
  killTree(child);
4059
4077
  }
4060
4078
  };
@@ -31252,7 +31270,6 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
31252
31270
  }
31253
31271
  async listModels(_provider) {
31254
31272
  const activeAcc = this.getActiveAccount();
31255
- this.deps.catalog.refreshIfNeeded(activeAcc?.id);
31256
31273
  const cfg = this.deps.getConfig();
31257
31274
  const cat = this.deps.catalog.get(activeAcc?.id);
31258
31275
  let models = cat.models;
@@ -32064,6 +32081,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
32064
32081
  args,
32065
32082
  cwd: workspaceRoot,
32066
32083
  timeoutMs: cfg.timeoutMs,
32084
+ maxTurnMs: cfg.maxTurnMinutes > 0 ? cfg.maxTurnMinutes * 6e4 : void 0,
32067
32085
  signal: options.signal,
32068
32086
  env,
32069
32087
  stdinPayload,
@@ -32148,6 +32166,11 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
32148
32166
  code: "ABORTED",
32149
32167
  message: "agy run aborted by caller"
32150
32168
  };
32169
+ else if (outcome.capped) failure = {
32170
+ kind: "error",
32171
+ code: Err.TIMEOUT,
32172
+ message: "agy turn exceeded maxTurnMinutes (" + cfg.maxTurnMinutes + " min) — the agy process tree was terminated. Re-send to continue. 本轮超过 maxTurnMinutes 上限,已终止 agy 进程树"
32173
+ };
32151
32174
  else if (outcome.timedOut) failure = {
32152
32175
  kind: "error",
32153
32176
  code: Err.TIMEOUT,
@@ -32270,7 +32293,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
32270
32293
  }
32271
32294
  }
32272
32295
  this.deps.onRun?.({
32273
- processOk: !outcome.aborted && !outcome.timedOut && outcome.code === 0,
32296
+ processOk: !outcome.aborted && !outcome.timedOut && !outcome.capped && outcome.code === 0,
32274
32297
  processCode: outcome.aborted ? "ABORTED" : outcome.timedOut ? Err.TIMEOUT : outcome.code === 0 ? "OK" : "EXIT_" + String(outcome.code),
32275
32298
  toolErrors: rec.toolErrors(),
32276
32299
  durationMs: outcome.durationMs,
@@ -37341,6 +37364,11 @@ function apply(ctx, entryConfig = {}) {
37341
37364
  }, 4e3);
37342
37365
  bootProbeTimer.unref?.();
37343
37366
  ctx.effect(() => () => clearTimeout(bootProbeTimer));
37367
+ const catalogPollTimer = setInterval(() => {
37368
+ catalog.refreshIfNeeded().catch(() => void 0);
37369
+ }, 18e5);
37370
+ catalogPollTimer.unref?.();
37371
+ ctx.effect(() => () => clearInterval(catalogPollTimer));
37344
37372
  if (getConfig().enabled) try {
37345
37373
  ctx.llm.registerAdapter([PROVIDER_ID], adapter);
37346
37374
  log("registered provider route: antigravity");
@@ -32,6 +32,7 @@ Resolution order (highest first): `DSH_AGY_*` environment variable → runtime o
32
32
  | Key | Environment | Default | Description |
33
33
  | --- | --- | --- | --- |
34
34
  | `timeoutMs` | `DSH_AGY_TIMEOUT_MS` | `600000` | Activity watchdog timeout per turn |
35
+ | `maxTurnMinutes` | `DSH_AGY_MAX_TURN_MINUTES` | `0` | Hard wall-clock cap per turn (0 = unlimited); bounds a self-driving turn that never goes idle |
35
36
  | `longToolIdleMinutes` | `DSH_AGY_LONG_TOOL_IDLE_MINUTES` | `240` | Idle budget while a tool step is open; `0` keeps `timeoutMs` so wedged tools fail fast |
36
37
  | `dispatchTimeoutMinutes` | `—` | `15` | Cap on waiting for the Windows credential slot before backing off and retrying; `0` waits indefinitely |
37
38
  | `dispatchRetries` | `—` | `1` | Extra dispatch attempts after a credential-slot timeout |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.13",
3
+ "version": "0.6.15",
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",