dsh-agy-link 0.6.13 → 0.6.14

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,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.14 (2026-11-10)
4
+
5
+ ### English
6
+
7
+ - **Feat(stability): optional `maxTurnMinutes` wall-clock cap — a self-driving turn can no longer run unbounded (issue #92).**
8
+ - 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.
9
+ - 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.
10
+
11
+ ### 中文
12
+
13
+ - **新增(稳定性):可选 `maxTurnMinutes` 墙钟上限——自驱动轮次不再可能无限运行(issue #92)。**
14
+ - 空闲看门狗会被每一行输出重置,所以「持续有输出」的 agy 轮次(异步 `task-xxxx` 回执、工具碎碎念)永远不会触发;`longToolIdleMinutes`(默认 240)只约束**静默**。新增 `maxTurnMinutes` 约束整轮墙钟,触发时 runner 会杀掉 agy 进程树(组 `SIGTERM`→`SIGKILL`,Windows `taskkill /T /F`),并返回可续跑的 `maxTurnMinutes` 错误。
15
+ - 默认 `0` = **关闭**,不改变现有行为;需要时显式开启(如排障类会话设 `DSH_AGY_MAX_TURN_MINUTES=60`)。含 env + 配置键、README/CONFIGURATION 说明,以及上限与配置优先级的测试。
16
+
17
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.13...v0.6.14
18
+
3
19
  ## 0.6.13 (2026-11-10)
4
20
 
5
21
  ### 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
  };
@@ -32064,6 +32082,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
32064
32082
  args,
32065
32083
  cwd: workspaceRoot,
32066
32084
  timeoutMs: cfg.timeoutMs,
32085
+ maxTurnMs: cfg.maxTurnMinutes > 0 ? cfg.maxTurnMinutes * 6e4 : void 0,
32067
32086
  signal: options.signal,
32068
32087
  env,
32069
32088
  stdinPayload,
@@ -32148,6 +32167,11 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
32148
32167
  code: "ABORTED",
32149
32168
  message: "agy run aborted by caller"
32150
32169
  };
32170
+ else if (outcome.capped) failure = {
32171
+ kind: "error",
32172
+ code: Err.TIMEOUT,
32173
+ message: "agy turn exceeded maxTurnMinutes (" + cfg.maxTurnMinutes + " min) — the agy process tree was terminated. Re-send to continue. 本轮超过 maxTurnMinutes 上限,已终止 agy 进程树"
32174
+ };
32151
32175
  else if (outcome.timedOut) failure = {
32152
32176
  kind: "error",
32153
32177
  code: Err.TIMEOUT,
@@ -32270,7 +32294,7 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
32270
32294
  }
32271
32295
  }
32272
32296
  this.deps.onRun?.({
32273
- processOk: !outcome.aborted && !outcome.timedOut && outcome.code === 0,
32297
+ processOk: !outcome.aborted && !outcome.timedOut && !outcome.capped && outcome.code === 0,
32274
32298
  processCode: outcome.aborted ? "ABORTED" : outcome.timedOut ? Err.TIMEOUT : outcome.code === 0 ? "OK" : "EXIT_" + String(outcome.code),
32275
32299
  toolErrors: rec.toolErrors(),
32276
32300
  durationMs: outcome.durationMs,
@@ -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.14",
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",