dsh-agy-link 0.6.31 → 0.6.32
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 +14 -0
- package/dist/cli-image.mjs +67 -15
- package/dist/index.js +67 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.32 (2026-11-17)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(provider): a turn can no longer hang for hours on agy background tasks (merges PR #119).** When a command backgrounds itself (a dev server, or a GUI dialog blocking on an uncaught exception), agy's root agent finishes the reply but then waits up to 4h for the background task. Routine daemon stderr chatter (`fetchAvailableModels`, `token refreshed`, `loadCodeAssist`, …) was re-arming the stderr keepalive watchdog every ~6 minutes, so neither the 10-minute idle budget nor the 240-minute print timeout ever fired and `proc.outcome` never settled — DSH hung at `eventsFrom`. Now background stderr noise is filtered, `root agent idle; waiting …` starts a 5s grace then terminates the process tree (`idleGraceTerminated`), `classifyFailure()` treats that as a normal completion, and a synthetic successful `result` event closes the mapper/usage/finish chain when agy emitted no envelope. `openToolKeys` is released when the model resumes text/thinking or a tool reaches `RUNNING`, and `printTimeoutMinutes` respects `maxTurnMinutes` (default `longToolIdleMinutes: 240` is unchanged).
|
|
8
|
+
- **Refactor(timeouts): `IDLE_BACKGROUND_GRACE_MS` lives in `common/timeouts.ts`** alongside the other deadlines — no second constant inside `process.ts`. `.spec/process-lifecycle.md` documents the termination invariants (local, gitignored).
|
|
9
|
+
- Tests: five subprocess-bounded regressions (idle grace, both message forms, normal-completion classification, `RUNNING` tool card, noise not feeding the watchdog). Thanks to @Ronnoc for the diagnosis and patch.
|
|
10
|
+
|
|
11
|
+
### 中文
|
|
12
|
+
|
|
13
|
+
- **修复(provider):一轮对话不再因 agy 后台任务挂起数小时(合并 PR #119)。** 命令自行后台化(dev server、未捕获异常卡住的 GUI 弹窗等)时,agy 根 Agent 已产出全部回复,却会为后台任务等待最多 4 小时;守护进程每约 6 分钟打印的例行 stderr 日志(`fetchAvailableModels`、`token refreshed`、`loadCodeAssist` 等)又不断喂狗,10 分钟空闲预算与 240 分钟 print 超时都不会触发,`proc.outcome` 永不 settle,DSH 卡在 `eventsFrom`。现在过滤后台噪声、识别 `root agent idle; waiting …` 后给 5s 宽限并终止进程树(`idleGraceTerminated`),`classifyFailure()` 视为正常完成;若 agy 未发 result envelope,则合成一条成功的 result 事件闭合 mapper/usage/finish 链。模型恢复 text/thinking 或工具进入 `RUNNING` 时释放 `openToolKeys`,`printTimeoutMinutes` 受 `maxTurnMinutes` 约束(缺省 `longToolIdleMinutes: 240` 不变)。
|
|
14
|
+
- **重构(超时常量)**:`IDLE_BACKGROUND_GRACE_MS` 与其他 deadline 一起收敛到 `common/timeouts.ts`,`process.ts` 不再另立常量。`.spec/process-lifecycle.md` 记录终止不变式(本地 gitignored)。
|
|
15
|
+
- 测试:5 条子进程有界回归(idle 宽限、两种文案、正常完成分类、`RUNNING` 工具卡片、噪声不喂狗)。感谢 @Ronnoc 的定位与补丁。
|
|
16
|
+
|
|
3
17
|
## 0.6.31 (2026-11-16)
|
|
4
18
|
|
|
5
19
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -2818,7 +2818,7 @@ var EventMapper = class {
|
|
|
2818
2818
|
return;
|
|
2819
2819
|
}
|
|
2820
2820
|
if (ev.stepKind === "tool" && ev.tool) {
|
|
2821
|
-
if (!(ev.state === "DONE" || ev.state === "ERROR" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) {
|
|
2821
|
+
if (!(ev.state === "DONE" || ev.state === "ERROR" || ev.state === "RUNNING" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) {
|
|
2822
2822
|
if (this.opts.cutOnTool && !this.finished && ev.state === "ACTIVE" && !this.pendingAnnounced.has(ev.stepKey)) {
|
|
2823
2823
|
this.pendingAnnounced.add(ev.stepKey);
|
|
2824
2824
|
yield* this.ensureBlock("reasoning");
|
|
@@ -2829,6 +2829,7 @@ var EventMapper = class {
|
|
|
2829
2829
|
}
|
|
2830
2830
|
return;
|
|
2831
2831
|
}
|
|
2832
|
+
if (ev.state === "RUNNING" && ev.tool.output === void 0) ev.tool.output = ev.text !== "" ? ev.text : "Tool is running as a background task";
|
|
2832
2833
|
if (this.announcedTools.has(ev.stepKey)) return;
|
|
2833
2834
|
this.announcedTools.add(ev.stepKey);
|
|
2834
2835
|
if (!this.opts.cutOnTool) return;
|
|
@@ -4898,6 +4899,13 @@ function nodeScriptEnv(env) {
|
|
|
4898
4899
|
* own idle budget so short-budget tests and genuine idle kills stay prompt.
|
|
4899
4900
|
*/
|
|
4900
4901
|
const WATCHDOG_GRACE_MS = 5e3;
|
|
4902
|
+
/**
|
|
4903
|
+
* Grace after agy reports `root agent idle; waiting ... for background task(s)`.
|
|
4904
|
+
* The prompt turn's answer is already streamed; a stuck GUI dialog / background
|
|
4905
|
+
* child would otherwise keep print mode alive for hours (issue #119). Short and
|
|
4906
|
+
* fixed so the turn settles promptly instead of hanging DSH's event stream.
|
|
4907
|
+
*/
|
|
4908
|
+
const IDLE_BACKGROUND_GRACE_MS = 5e3;
|
|
4901
4909
|
//#endregion
|
|
4902
4910
|
//#region src/host/auto-updater.ts
|
|
4903
4911
|
function nonBlank(v) {
|
|
@@ -5059,7 +5067,9 @@ function createRunState(opts) {
|
|
|
5059
5067
|
idleBudgetMs: opts.timeoutMs,
|
|
5060
5068
|
watchdog: null,
|
|
5061
5069
|
watchdogGraceUsed: false,
|
|
5062
|
-
turnCap: null
|
|
5070
|
+
turnCap: null,
|
|
5071
|
+
idleGraceTimer: null,
|
|
5072
|
+
idleGraceTerminated: false
|
|
5063
5073
|
};
|
|
5064
5074
|
}
|
|
5065
5075
|
function spawnAgyChild(opts, env, viaCmd, isNode) {
|
|
@@ -5143,6 +5153,9 @@ function armTurnCap(child, opts, state) {
|
|
|
5143
5153
|
state.turnCap.unref?.();
|
|
5144
5154
|
}
|
|
5145
5155
|
}
|
|
5156
|
+
function isBackgroundStderrNoise(line) {
|
|
5157
|
+
return line.includes("fetchAvailableModels") || line.includes("loadCodeAssist") || line.includes("token refreshed") || line.includes("FetchConfig") || line.includes("ListExperiments") || line.includes("daily-cloudcode-pa.googleapis.com") || line.includes("http_helpers.go");
|
|
5158
|
+
}
|
|
5146
5159
|
function attachOutputStreams(child, opts, state, refreshWatchdog) {
|
|
5147
5160
|
const stdoutDecoder = makeLineDecoder(consoleOutputEncoding());
|
|
5148
5161
|
const stderrDecoder = makeLineDecoder(consoleOutputEncoding());
|
|
@@ -5161,9 +5174,21 @@ function attachOutputStreams(child, opts, state, refreshWatchdog) {
|
|
|
5161
5174
|
}
|
|
5162
5175
|
});
|
|
5163
5176
|
child.stderr?.on("data", (chunk) => {
|
|
5164
|
-
if (opts.stderrKeepalive) refreshWatchdog();
|
|
5165
5177
|
const text = stderrDecoder.push(chunk);
|
|
5166
|
-
if (text !== "")
|
|
5178
|
+
if (text !== "") {
|
|
5179
|
+
state.stderr = (state.stderr + text).slice(-4096);
|
|
5180
|
+
if (/root agent idle;\s*waiting/i.test(text)) {
|
|
5181
|
+
if (!state.idleGraceTimer) {
|
|
5182
|
+
state.idleGraceTimer = setTimeout(() => {
|
|
5183
|
+
if (!state.settled) {
|
|
5184
|
+
state.idleGraceTerminated = true;
|
|
5185
|
+
killTree(child);
|
|
5186
|
+
}
|
|
5187
|
+
}, IDLE_BACKGROUND_GRACE_MS);
|
|
5188
|
+
state.idleGraceTimer.unref?.();
|
|
5189
|
+
}
|
|
5190
|
+
} else if (opts.stderrKeepalive && !isBackgroundStderrNoise(text)) refreshWatchdog();
|
|
5191
|
+
}
|
|
5167
5192
|
});
|
|
5168
5193
|
return {
|
|
5169
5194
|
stdoutDecoder,
|
|
@@ -5177,6 +5202,7 @@ function awaitOutcome(child, opts, state, decoders, onAbort, started) {
|
|
|
5177
5202
|
state.settled = true;
|
|
5178
5203
|
if (state.watchdog) clearTimeout(state.watchdog);
|
|
5179
5204
|
if (state.turnCap) clearTimeout(state.turnCap);
|
|
5205
|
+
if (state.idleGraceTimer) clearTimeout(state.idleGraceTimer);
|
|
5180
5206
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
5181
5207
|
const stdoutTail = decoders.stdoutDecoder.flush();
|
|
5182
5208
|
if (stdoutTail !== "") {
|
|
@@ -5195,6 +5221,7 @@ function awaitOutcome(child, opts, state, decoders, onAbort, started) {
|
|
|
5195
5221
|
timedOut: state.timedOut,
|
|
5196
5222
|
aborted: state.aborted,
|
|
5197
5223
|
capped: state.capped,
|
|
5224
|
+
idleGraceTerminated: state.idleGraceTerminated,
|
|
5198
5225
|
stdout: state.stdout,
|
|
5199
5226
|
stderrTail: state.stderr,
|
|
5200
5227
|
durationMs: Date.now() - started
|
|
@@ -5237,6 +5264,7 @@ function startAgyProcess(opts) {
|
|
|
5237
5264
|
else state.aborted = true;
|
|
5238
5265
|
if (state.watchdog) clearTimeout(state.watchdog);
|
|
5239
5266
|
if (state.turnCap) clearTimeout(state.turnCap);
|
|
5267
|
+
if (state.idleGraceTimer) clearTimeout(state.idleGraceTimer);
|
|
5240
5268
|
killTree(child);
|
|
5241
5269
|
}
|
|
5242
5270
|
};
|
|
@@ -6604,6 +6632,7 @@ function classifyEvent(obj, seq) {
|
|
|
6604
6632
|
const text = delta !== void 0 ? delta : extractText(src);
|
|
6605
6633
|
const stateV = pick(src, ["state"]);
|
|
6606
6634
|
if (stateV === "ERROR" && toolInfo && !toolInfo.error) toolInfo.error = "tool execution failed";
|
|
6635
|
+
if (stateV === "RUNNING" && toolInfo && toolInfo.output === void 0 && text !== "") toolInfo.output = text;
|
|
6607
6636
|
const usageRaw = pick(src, ["usage"]);
|
|
6608
6637
|
return {
|
|
6609
6638
|
kind: "step",
|
|
@@ -33172,7 +33201,8 @@ function createToolWatchdog(log, cfg) {
|
|
|
33172
33201
|
const openToolKeys = /* @__PURE__ */ new Set();
|
|
33173
33202
|
const openToolSince = /* @__PURE__ */ new Map();
|
|
33174
33203
|
const longToolIdleMinutes = cfg.longToolIdleMinutes > 0 ? cfg.longToolIdleMinutes : 0;
|
|
33175
|
-
|
|
33204
|
+
let printTimeoutMinutes = Math.max(longToolIdleMinutes > 0 ? longToolIdleMinutes : Math.ceil(cfg.timeoutMs / 6e4), Math.ceil(cfg.timeoutMs / 6e4));
|
|
33205
|
+
if (cfg.maxTurnMinutes > 0 && printTimeoutMinutes > cfg.maxTurnMinutes) printTimeoutMinutes = cfg.maxTurnMinutes;
|
|
33176
33206
|
const longToolIdleMs = longToolIdleMinutes > 0 ? longToolIdleMinutes * 6e4 : cfg.timeoutMs;
|
|
33177
33207
|
const generationIdleMs = Math.max(cfg.timeoutMs, 9e5);
|
|
33178
33208
|
let runningProc = null;
|
|
@@ -33217,18 +33247,27 @@ function createToolWatchdog(log, cfg) {
|
|
|
33217
33247
|
apply();
|
|
33218
33248
|
},
|
|
33219
33249
|
trackStep: (ev) => {
|
|
33220
|
-
if (ev.kind !== "step"
|
|
33221
|
-
if (
|
|
33222
|
-
if (!
|
|
33223
|
-
openToolKeys.
|
|
33224
|
-
|
|
33250
|
+
if (ev.kind !== "step") return;
|
|
33251
|
+
if (ev.stepKind === "tool" && ev.tool !== void 0) {
|
|
33252
|
+
if (!(ev.state === "DONE" || ev.state === "ERROR" || ev.state === "RUNNING" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) {
|
|
33253
|
+
if (!openToolKeys.has(ev.stepKey)) {
|
|
33254
|
+
openToolKeys.add(ev.stepKey);
|
|
33255
|
+
openToolSince.set(ev.stepKey, Date.now());
|
|
33256
|
+
apply();
|
|
33257
|
+
start();
|
|
33258
|
+
}
|
|
33259
|
+
} else if (openToolKeys.delete(ev.stepKey)) {
|
|
33260
|
+
openToolSince.delete(ev.stepKey);
|
|
33225
33261
|
apply();
|
|
33226
|
-
|
|
33262
|
+
if (openToolKeys.size === 0) stop();
|
|
33263
|
+
}
|
|
33264
|
+
} else if (ev.stepKind === "text" || ev.stepKind === "thinking") {
|
|
33265
|
+
if (openToolKeys.size > 0) {
|
|
33266
|
+
openToolKeys.clear();
|
|
33267
|
+
openToolSince.clear();
|
|
33268
|
+
apply();
|
|
33269
|
+
stop();
|
|
33227
33270
|
}
|
|
33228
|
-
} else if (openToolKeys.delete(ev.stepKey)) {
|
|
33229
|
-
openToolSince.delete(ev.stepKey);
|
|
33230
|
-
apply();
|
|
33231
|
-
if (openToolKeys.size === 0) stop();
|
|
33232
33271
|
}
|
|
33233
33272
|
},
|
|
33234
33273
|
stop: () => {
|
|
@@ -33460,6 +33499,7 @@ function classifyFailure(c) {
|
|
|
33460
33499
|
code: Err.TIMEOUT,
|
|
33461
33500
|
message: "agy run was idle for " + c.cfg.timeoutMs + "ms without output" + (c.silentTimeout ? " — agy never emitted a single event; it is likely unable to reach Google (check proxy/network). 无法连接 Google,请检查代理或网络配置" : "")
|
|
33462
33501
|
};
|
|
33502
|
+
else if (c.outcome.idleGraceTerminated) return null;
|
|
33463
33503
|
else if (!c.consumable) {
|
|
33464
33504
|
if (c.sawAuthFailure) return c.transportFailure ? {
|
|
33465
33505
|
kind: "error",
|
|
@@ -33809,6 +33849,18 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
33809
33849
|
deps.clearInFlightPrompt(sessionKey, spawn.prompt);
|
|
33810
33850
|
recorder.drain(input.agyOnEvent);
|
|
33811
33851
|
const conversationId = recorder.conversationId();
|
|
33852
|
+
if (!rec.hasResult && outcome.idleGraceTerminated) {
|
|
33853
|
+
const synthResult = {
|
|
33854
|
+
kind: "result",
|
|
33855
|
+
conversationId: conversationId ?? "",
|
|
33856
|
+
ok: true,
|
|
33857
|
+
response: "",
|
|
33858
|
+
usage: rec.finalUsage({}),
|
|
33859
|
+
raw: {}
|
|
33860
|
+
};
|
|
33861
|
+
rec.append(synthResult);
|
|
33862
|
+
input.agyOnEvent?.(synthResult);
|
|
33863
|
+
}
|
|
33812
33864
|
const { failure, rawErrText, runLogText, silentTimeout } = classifyRun({
|
|
33813
33865
|
cfg,
|
|
33814
33866
|
outcome,
|
package/dist/index.js
CHANGED
|
@@ -1354,6 +1354,7 @@ function classifyEvent(obj, seq) {
|
|
|
1354
1354
|
const text = delta !== void 0 ? delta : extractText$1(src);
|
|
1355
1355
|
const stateV = pick$1(src, ["state"]);
|
|
1356
1356
|
if (stateV === "ERROR" && toolInfo && !toolInfo.error) toolInfo.error = "tool execution failed";
|
|
1357
|
+
if (stateV === "RUNNING" && toolInfo && toolInfo.output === void 0 && text !== "") toolInfo.output = text;
|
|
1357
1358
|
const usageRaw = pick$1(src, ["usage"]);
|
|
1358
1359
|
return {
|
|
1359
1360
|
kind: "step",
|
|
@@ -1945,6 +1946,13 @@ const QUOTA_REFRESH_DEDUP_MS = 9e4;
|
|
|
1945
1946
|
* own idle budget so short-budget tests and genuine idle kills stay prompt.
|
|
1946
1947
|
*/
|
|
1947
1948
|
const WATCHDOG_GRACE_MS = 5e3;
|
|
1949
|
+
/**
|
|
1950
|
+
* Grace after agy reports `root agent idle; waiting ... for background task(s)`.
|
|
1951
|
+
* The prompt turn's answer is already streamed; a stuck GUI dialog / background
|
|
1952
|
+
* child would otherwise keep print mode alive for hours (issue #119). Short and
|
|
1953
|
+
* fixed so the turn settles promptly instead of hanging DSH's event stream.
|
|
1954
|
+
*/
|
|
1955
|
+
const IDLE_BACKGROUND_GRACE_MS = 5e3;
|
|
1948
1956
|
function nonBlank(v) {
|
|
1949
1957
|
return (v ?? "").trim();
|
|
1950
1958
|
}
|
|
@@ -2122,7 +2130,9 @@ function createRunState(opts) {
|
|
|
2122
2130
|
idleBudgetMs: opts.timeoutMs,
|
|
2123
2131
|
watchdog: null,
|
|
2124
2132
|
watchdogGraceUsed: false,
|
|
2125
|
-
turnCap: null
|
|
2133
|
+
turnCap: null,
|
|
2134
|
+
idleGraceTimer: null,
|
|
2135
|
+
idleGraceTerminated: false
|
|
2126
2136
|
};
|
|
2127
2137
|
}
|
|
2128
2138
|
function spawnAgyChild(opts, env, viaCmd, isNode) {
|
|
@@ -2206,6 +2216,9 @@ function armTurnCap(child, opts, state) {
|
|
|
2206
2216
|
state.turnCap.unref?.();
|
|
2207
2217
|
}
|
|
2208
2218
|
}
|
|
2219
|
+
function isBackgroundStderrNoise(line) {
|
|
2220
|
+
return line.includes("fetchAvailableModels") || line.includes("loadCodeAssist") || line.includes("token refreshed") || line.includes("FetchConfig") || line.includes("ListExperiments") || line.includes("daily-cloudcode-pa.googleapis.com") || line.includes("http_helpers.go");
|
|
2221
|
+
}
|
|
2209
2222
|
function attachOutputStreams(child, opts, state, refreshWatchdog) {
|
|
2210
2223
|
const stdoutDecoder = makeLineDecoder(consoleOutputEncoding());
|
|
2211
2224
|
const stderrDecoder = makeLineDecoder(consoleOutputEncoding());
|
|
@@ -2224,9 +2237,21 @@ function attachOutputStreams(child, opts, state, refreshWatchdog) {
|
|
|
2224
2237
|
}
|
|
2225
2238
|
});
|
|
2226
2239
|
child.stderr?.on("data", (chunk) => {
|
|
2227
|
-
if (opts.stderrKeepalive) refreshWatchdog();
|
|
2228
2240
|
const text = stderrDecoder.push(chunk);
|
|
2229
|
-
if (text !== "")
|
|
2241
|
+
if (text !== "") {
|
|
2242
|
+
state.stderr = (state.stderr + text).slice(-4096);
|
|
2243
|
+
if (/root agent idle;\s*waiting/i.test(text)) {
|
|
2244
|
+
if (!state.idleGraceTimer) {
|
|
2245
|
+
state.idleGraceTimer = setTimeout(() => {
|
|
2246
|
+
if (!state.settled) {
|
|
2247
|
+
state.idleGraceTerminated = true;
|
|
2248
|
+
killTree(child);
|
|
2249
|
+
}
|
|
2250
|
+
}, IDLE_BACKGROUND_GRACE_MS);
|
|
2251
|
+
state.idleGraceTimer.unref?.();
|
|
2252
|
+
}
|
|
2253
|
+
} else if (opts.stderrKeepalive && !isBackgroundStderrNoise(text)) refreshWatchdog();
|
|
2254
|
+
}
|
|
2230
2255
|
});
|
|
2231
2256
|
return {
|
|
2232
2257
|
stdoutDecoder,
|
|
@@ -2240,6 +2265,7 @@ function awaitOutcome(child, opts, state, decoders, onAbort, started) {
|
|
|
2240
2265
|
state.settled = true;
|
|
2241
2266
|
if (state.watchdog) clearTimeout(state.watchdog);
|
|
2242
2267
|
if (state.turnCap) clearTimeout(state.turnCap);
|
|
2268
|
+
if (state.idleGraceTimer) clearTimeout(state.idleGraceTimer);
|
|
2243
2269
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
2244
2270
|
const stdoutTail = decoders.stdoutDecoder.flush();
|
|
2245
2271
|
if (stdoutTail !== "") {
|
|
@@ -2258,6 +2284,7 @@ function awaitOutcome(child, opts, state, decoders, onAbort, started) {
|
|
|
2258
2284
|
timedOut: state.timedOut,
|
|
2259
2285
|
aborted: state.aborted,
|
|
2260
2286
|
capped: state.capped,
|
|
2287
|
+
idleGraceTerminated: state.idleGraceTerminated,
|
|
2261
2288
|
stdout: state.stdout,
|
|
2262
2289
|
stderrTail: state.stderr,
|
|
2263
2290
|
durationMs: Date.now() - started
|
|
@@ -2300,6 +2327,7 @@ function startAgyProcess(opts) {
|
|
|
2300
2327
|
else state.aborted = true;
|
|
2301
2328
|
if (state.watchdog) clearTimeout(state.watchdog);
|
|
2302
2329
|
if (state.turnCap) clearTimeout(state.turnCap);
|
|
2330
|
+
if (state.idleGraceTimer) clearTimeout(state.idleGraceTimer);
|
|
2303
2331
|
killTree(child);
|
|
2304
2332
|
}
|
|
2305
2333
|
};
|
|
@@ -4663,7 +4691,7 @@ var EventMapper = class {
|
|
|
4663
4691
|
return;
|
|
4664
4692
|
}
|
|
4665
4693
|
if (ev.stepKind === "tool" && ev.tool) {
|
|
4666
|
-
if (!(ev.state === "DONE" || ev.state === "ERROR" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) {
|
|
4694
|
+
if (!(ev.state === "DONE" || ev.state === "ERROR" || ev.state === "RUNNING" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) {
|
|
4667
4695
|
if (this.opts.cutOnTool && !this.finished && ev.state === "ACTIVE" && !this.pendingAnnounced.has(ev.stepKey)) {
|
|
4668
4696
|
this.pendingAnnounced.add(ev.stepKey);
|
|
4669
4697
|
yield* this.ensureBlock("reasoning");
|
|
@@ -4674,6 +4702,7 @@ var EventMapper = class {
|
|
|
4674
4702
|
}
|
|
4675
4703
|
return;
|
|
4676
4704
|
}
|
|
4705
|
+
if (ev.state === "RUNNING" && ev.tool.output === void 0) ev.tool.output = ev.text !== "" ? ev.text : "Tool is running as a background task";
|
|
4677
4706
|
if (this.announcedTools.has(ev.stepKey)) return;
|
|
4678
4707
|
this.announcedTools.add(ev.stepKey);
|
|
4679
4708
|
if (!this.opts.cutOnTool) return;
|
|
@@ -33686,7 +33715,8 @@ function createToolWatchdog(log, cfg) {
|
|
|
33686
33715
|
const openToolKeys = /* @__PURE__ */ new Set();
|
|
33687
33716
|
const openToolSince = /* @__PURE__ */ new Map();
|
|
33688
33717
|
const longToolIdleMinutes = cfg.longToolIdleMinutes > 0 ? cfg.longToolIdleMinutes : 0;
|
|
33689
|
-
|
|
33718
|
+
let printTimeoutMinutes = Math.max(longToolIdleMinutes > 0 ? longToolIdleMinutes : Math.ceil(cfg.timeoutMs / 6e4), Math.ceil(cfg.timeoutMs / 6e4));
|
|
33719
|
+
if (cfg.maxTurnMinutes > 0 && printTimeoutMinutes > cfg.maxTurnMinutes) printTimeoutMinutes = cfg.maxTurnMinutes;
|
|
33690
33720
|
const longToolIdleMs = longToolIdleMinutes > 0 ? longToolIdleMinutes * 6e4 : cfg.timeoutMs;
|
|
33691
33721
|
const generationIdleMs = Math.max(cfg.timeoutMs, 9e5);
|
|
33692
33722
|
let runningProc = null;
|
|
@@ -33731,18 +33761,27 @@ function createToolWatchdog(log, cfg) {
|
|
|
33731
33761
|
apply();
|
|
33732
33762
|
},
|
|
33733
33763
|
trackStep: (ev) => {
|
|
33734
|
-
if (ev.kind !== "step"
|
|
33735
|
-
if (
|
|
33736
|
-
if (!
|
|
33737
|
-
openToolKeys.
|
|
33738
|
-
|
|
33764
|
+
if (ev.kind !== "step") return;
|
|
33765
|
+
if (ev.stepKind === "tool" && ev.tool !== void 0) {
|
|
33766
|
+
if (!(ev.state === "DONE" || ev.state === "ERROR" || ev.state === "RUNNING" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) {
|
|
33767
|
+
if (!openToolKeys.has(ev.stepKey)) {
|
|
33768
|
+
openToolKeys.add(ev.stepKey);
|
|
33769
|
+
openToolSince.set(ev.stepKey, Date.now());
|
|
33770
|
+
apply();
|
|
33771
|
+
start();
|
|
33772
|
+
}
|
|
33773
|
+
} else if (openToolKeys.delete(ev.stepKey)) {
|
|
33774
|
+
openToolSince.delete(ev.stepKey);
|
|
33739
33775
|
apply();
|
|
33740
|
-
|
|
33776
|
+
if (openToolKeys.size === 0) stop();
|
|
33777
|
+
}
|
|
33778
|
+
} else if (ev.stepKind === "text" || ev.stepKind === "thinking") {
|
|
33779
|
+
if (openToolKeys.size > 0) {
|
|
33780
|
+
openToolKeys.clear();
|
|
33781
|
+
openToolSince.clear();
|
|
33782
|
+
apply();
|
|
33783
|
+
stop();
|
|
33741
33784
|
}
|
|
33742
|
-
} else if (openToolKeys.delete(ev.stepKey)) {
|
|
33743
|
-
openToolSince.delete(ev.stepKey);
|
|
33744
|
-
apply();
|
|
33745
|
-
if (openToolKeys.size === 0) stop();
|
|
33746
33785
|
}
|
|
33747
33786
|
},
|
|
33748
33787
|
stop: () => {
|
|
@@ -33974,6 +34013,7 @@ function classifyFailure(c) {
|
|
|
33974
34013
|
code: Err.TIMEOUT,
|
|
33975
34014
|
message: "agy run was idle for " + c.cfg.timeoutMs + "ms without output" + (c.silentTimeout ? " — agy never emitted a single event; it is likely unable to reach Google (check proxy/network). 无法连接 Google,请检查代理或网络配置" : "")
|
|
33976
34015
|
};
|
|
34016
|
+
else if (c.outcome.idleGraceTerminated) return null;
|
|
33977
34017
|
else if (!c.consumable) {
|
|
33978
34018
|
if (c.sawAuthFailure) return c.transportFailure ? {
|
|
33979
34019
|
kind: "error",
|
|
@@ -34323,6 +34363,18 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
34323
34363
|
deps.clearInFlightPrompt(sessionKey, spawn.prompt);
|
|
34324
34364
|
recorder.drain(input.agyOnEvent);
|
|
34325
34365
|
const conversationId = recorder.conversationId();
|
|
34366
|
+
if (!rec.hasResult && outcome.idleGraceTerminated) {
|
|
34367
|
+
const synthResult = {
|
|
34368
|
+
kind: "result",
|
|
34369
|
+
conversationId: conversationId ?? "",
|
|
34370
|
+
ok: true,
|
|
34371
|
+
response: "",
|
|
34372
|
+
usage: rec.finalUsage({}),
|
|
34373
|
+
raw: {}
|
|
34374
|
+
};
|
|
34375
|
+
rec.append(synthResult);
|
|
34376
|
+
input.agyOnEvent?.(synthResult);
|
|
34377
|
+
}
|
|
34326
34378
|
const { failure, rawErrText, runLogText, silentTimeout } = classifyRun({
|
|
34327
34379
|
cfg,
|
|
34328
34380
|
outcome,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.32",
|
|
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",
|