dsh-agy-link 0.6.47 → 0.6.48
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 +18 -0
- package/dist/cli-image.mjs +28 -8
- package/dist/index.js +28 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.48 (2026-11-20)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix(idle-grace): three linked causes of `INVALID_OUTPUT: agy stream ended without a result event` (merges PR #147).** Follow-up to #144/#146, from a report that the failure could still replay three times within milliseconds on continuation retries:
|
|
8
|
+
- **`waiting up to <duration> for N background task(s)`** is a second wording agy emits (e.g. `waiting up to 240m0s for 1 background task(s)`). `backgroundTasksFrom()` only matched `waiting for N`, so this variant returned `null` and the reaper was still armed for a positive count. The regex now accepts the optional `up to <duration>` segment.
|
|
9
|
+
- **An empty error result no longer hides the recoverable reply.** On SIGTERM agy can flush `{ ok: false, response: '' }`; `hasResult` counted that envelope, so the `idleGraceTerminated` recovery was skipped while `EventMapper` ignored the empty result without finishing. The guard is now `hasConsumableResult` (ok, or non-empty response), so a usable reply or the explicit notice is always appended.
|
|
10
|
+
- **A settled recording with no finishable event stops replaying.** When a continuation had no consumable result and no cuttable tool step after its resume point, every DSH retry re-drove the same dead recording (~20 ms each) until retries were exhausted. `hasFinishableEventFrom()` makes the adapter forget such a recording and spawn a fresh attempt instead. **This is the part that goes beyond what shipped in v0.6.47**, which only checked the result dimension — a recording cut mid-tool-step now resumes instead of re-running the work.
|
|
11
|
+
- Note: v0.6.47 independently landed the first two items and the `recording` helpers; this merge keeps that structure and takes the wider adapter predicate plus PR #147's regression suite (4 new tests, 347 lines).
|
|
12
|
+
|
|
13
|
+
### 中文
|
|
14
|
+
|
|
15
|
+
- **修复(idle-grace):`INVALID_OUTPUT: agy stream ended without a result event` 的三条关联成因(合并 PR #147)。** 是 #144/#146 的后续,源于「该失败在续接重试时仍会在毫秒级重复三次」的报告:
|
|
16
|
+
- **`waiting up to <duration> for N background task(s)`** 是 agy 的第二种措辞(例如 `waiting up to 240m0s for 1 background task(s)`)。`backgroundTasksFrom()` 只匹配 `waiting for N`,该变体返回 `null`,于是正数计数下收割器仍会被武装。正则现在接受可选的 `up to <duration>` 片段。
|
|
17
|
+
- **空的错误 result 不再掩盖可恢复的回复。** SIGTERM 时 agy 可能刷出 `{ ok: false, response: '' }`;`hasResult` 把这个信封算作结果,导致 `idleGraceTerminated` 的恢复逻辑被跳过,而 `EventMapper` 又忽略空结果、不置 finished。判据改为 `hasConsumableResult`(ok 或非空 response),因此总会补上可用回复或明确提示。
|
|
18
|
+
- **没有可完成事件的 settled recording 不再被重放。** 续接点在可消费 result 与可切割工具步骤之后都没有事件时,DSH 每次重试都会重驱同一份死 recording(每次约 20ms)直到重试耗尽。`hasFinishableEventFrom()` 让适配器遗忘这种 recording 并新起一次尝试。**这部分超出 v0.6.47 已发布的内容**——它只检查 result 维度;在工具步骤中途被切断的 recording 现在会续接,而不是重跑已有工作。
|
|
19
|
+
- 说明:v0.6.47 已独立落地前两项与 `recording` 辅助方法;本次合并保留其结构,吸收更宽的适配器判据与 PR #147 的回归测试(4 条新用例,347 行)。
|
|
20
|
+
|
|
3
21
|
## 0.6.47 (2026-11-20)
|
|
4
22
|
|
|
5
23
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -2497,6 +2497,27 @@ var RunRecording = class {
|
|
|
2497
2497
|
get hasResult() {
|
|
2498
2498
|
return this.events.some((e) => e.kind === "result");
|
|
2499
2499
|
}
|
|
2500
|
+
/** Whether a result event that EventMapper will finish on (ok, or non-empty error response) was recorded. */
|
|
2501
|
+
get hasConsumableResult() {
|
|
2502
|
+
const r = this.getResultEvent();
|
|
2503
|
+
return r !== null && (r.ok || r.response !== "");
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* Whether any recorded event at or after `from` can finish a span cleanly
|
|
2507
|
+
* (a consumable result envelope, or a completed tool step when `cutOnTool`
|
|
2508
|
+
* is enabled). A settled recording with `failureInfo === null` and no such
|
|
2509
|
+
* event would otherwise replay `INVALID_OUTPUT: agy stream ended without a
|
|
2510
|
+
* result event` on every continuation retry.
|
|
2511
|
+
*/
|
|
2512
|
+
hasFinishableEventFrom(from, cutOnTool = true) {
|
|
2513
|
+
for (let i = Math.max(0, from); i < this.events.length; i++) {
|
|
2514
|
+
const ev = this.events[i];
|
|
2515
|
+
if (ev === void 0) continue;
|
|
2516
|
+
if (ev.kind === "result" && (ev.ok || ev.response !== "")) return true;
|
|
2517
|
+
if (cutOnTool && ev.kind === "step" && ev.stepKind === "tool" && ev.tool !== void 0 && (ev.state === "DONE" || ev.state === "ERROR" || ev.state === "RUNNING" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) return true;
|
|
2518
|
+
}
|
|
2519
|
+
return false;
|
|
2520
|
+
}
|
|
2500
2521
|
/** The last result envelope's finish-relevant projection, when one arrived. */
|
|
2501
2522
|
getResultEvent() {
|
|
2502
2523
|
for (let i = this.events.length - 1; i >= 0; i--) {
|
|
@@ -5333,7 +5354,7 @@ function preemptAgyAutoUpdate(env = process.env, now = Date.now()) {
|
|
|
5333
5354
|
* boundary cut the line), which keeps the conservative "arm the grace" path.
|
|
5334
5355
|
*/
|
|
5335
5356
|
function backgroundTasksFrom(text) {
|
|
5336
|
-
const match = /root agent idle;\s*waiting\s+for\s+(\d+)\s+background/i.exec(text);
|
|
5357
|
+
const match = /root agent idle;\s*waiting(?:\s+up\s+to\s+\S+)?\s+for\s+(\d+)\s+background/i.exec(text);
|
|
5337
5358
|
if (match === null) return null;
|
|
5338
5359
|
const count = Number(match[1]);
|
|
5339
5360
|
return Number.isSafeInteger(count) && count >= 0 ? count : null;
|
|
@@ -34825,8 +34846,7 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
34825
34846
|
deps.clearInFlightPrompt(sessionKey, spawn.prompt);
|
|
34826
34847
|
recorder.drain(input.agyOnEvent);
|
|
34827
34848
|
const conversationId = recorder.conversationId();
|
|
34828
|
-
|
|
34829
|
-
if (!(existingRes !== null && (existingRes.ok || existingRes.response !== "")) && outcome.idleGraceTerminated) {
|
|
34849
|
+
if (!rec.hasConsumableResult && outcome.idleGraceTerminated) {
|
|
34830
34850
|
const recovered = conversationId === null ? "" : recoverFinalReply(conversationId, rec.accountHome);
|
|
34831
34851
|
const synthResult = {
|
|
34832
34852
|
kind: "result",
|
|
@@ -34887,7 +34907,7 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
34887
34907
|
* queue notices; the outcome closure runs detached exactly as before.
|
|
34888
34908
|
*/
|
|
34889
34909
|
async function* runAgyAttempt(deps, input) {
|
|
34890
|
-
const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId
|
|
34910
|
+
const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId);
|
|
34891
34911
|
const spawn = buildSpawnArgs(input, recorder.printTimeoutMinutes, deps.log);
|
|
34892
34912
|
const slot = yield* dispatchCredentialSlot(deps, {
|
|
34893
34913
|
...input,
|
|
@@ -35132,14 +35152,14 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
35132
35152
|
if (continuation !== null) {
|
|
35133
35153
|
const rec = this.deps.runs.get(continuation.runId);
|
|
35134
35154
|
const deadFailure = rec !== void 0 && rec.isSettled ? rec.failureInfo : null;
|
|
35135
|
-
const
|
|
35136
|
-
if (rec !== void 0 && !
|
|
35155
|
+
const deadNoResult = rec !== void 0 && rec.isSettled && deadFailure === null && !rec.hasFinishableEventFrom(continuation.eventIndex + 1, hasToolSupport);
|
|
35156
|
+
if (rec !== void 0 && !deadNoResult && !(deadFailure !== null && this.claimFailover(sessionKey, deadFailure.code))) {
|
|
35137
35157
|
yield* driveSpan(this.deps, rec, continuation.eventIndex + 1, hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal);
|
|
35138
35158
|
return;
|
|
35139
35159
|
}
|
|
35140
35160
|
if (rec !== void 0) {
|
|
35141
35161
|
this.deps.runs.forget(continuation.runId);
|
|
35142
|
-
this.warnOnce("dead-continuation:" + continuation.runId,
|
|
35162
|
+
this.warnOnce("dead-continuation:" + continuation.runId, deadNoResult ? "agy run " + continuation.runId + " settled without a consumable result — retrying this step instead of replaying it" : "agy run " + continuation.runId + " settled in " + (deadFailure?.code ?? "") + " — retrying this step instead of replaying it" + (deadFailure?.code === Err.NETWORK && this.sharesSingleEgress() ? " on the same account (shared egress)" : " on another account"));
|
|
35143
35163
|
} else this.warnOnce("stale-continuation:" + continuation.runId, "agy run " + continuation.runId + " is no longer available in memory (server restarted?) — falling back to fresh turn prompt assembly");
|
|
35144
35164
|
}
|
|
35145
35165
|
const catalog = this.deps.catalog.get();
|
|
@@ -35324,7 +35344,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
35324
35344
|
signal: options.signal,
|
|
35325
35345
|
agyOnEvent: options.agyOnEvent
|
|
35326
35346
|
});
|
|
35327
|
-
yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice
|
|
35347
|
+
yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice);
|
|
35328
35348
|
}
|
|
35329
35349
|
};
|
|
35330
35350
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -3243,7 +3243,7 @@ function describeAgyAutoUpdate(env = process.env, now = Date.now()) {
|
|
|
3243
3243
|
* boundary cut the line), which keeps the conservative "arm the grace" path.
|
|
3244
3244
|
*/
|
|
3245
3245
|
function backgroundTasksFrom(text) {
|
|
3246
|
-
const match = /root agent idle;\s*waiting\s+for\s+(\d+)\s+background/i.exec(text);
|
|
3246
|
+
const match = /root agent idle;\s*waiting(?:\s+up\s+to\s+\S+)?\s+for\s+(\d+)\s+background/i.exec(text);
|
|
3247
3247
|
if (match === null) return null;
|
|
3248
3248
|
const count = Number(match[1]);
|
|
3249
3249
|
return Number.isSafeInteger(count) && count >= 0 ? count : null;
|
|
@@ -30934,6 +30934,27 @@ var RunRecording = class {
|
|
|
30934
30934
|
get hasResult() {
|
|
30935
30935
|
return this.events.some((e) => e.kind === "result");
|
|
30936
30936
|
}
|
|
30937
|
+
/** Whether a result event that EventMapper will finish on (ok, or non-empty error response) was recorded. */
|
|
30938
|
+
get hasConsumableResult() {
|
|
30939
|
+
const r = this.getResultEvent();
|
|
30940
|
+
return r !== null && (r.ok || r.response !== "");
|
|
30941
|
+
}
|
|
30942
|
+
/**
|
|
30943
|
+
* Whether any recorded event at or after `from` can finish a span cleanly
|
|
30944
|
+
* (a consumable result envelope, or a completed tool step when `cutOnTool`
|
|
30945
|
+
* is enabled). A settled recording with `failureInfo === null` and no such
|
|
30946
|
+
* event would otherwise replay `INVALID_OUTPUT: agy stream ended without a
|
|
30947
|
+
* result event` on every continuation retry.
|
|
30948
|
+
*/
|
|
30949
|
+
hasFinishableEventFrom(from, cutOnTool = true) {
|
|
30950
|
+
for (let i = Math.max(0, from); i < this.events.length; i++) {
|
|
30951
|
+
const ev = this.events[i];
|
|
30952
|
+
if (ev === void 0) continue;
|
|
30953
|
+
if (ev.kind === "result" && (ev.ok || ev.response !== "")) return true;
|
|
30954
|
+
if (cutOnTool && ev.kind === "step" && ev.stepKind === "tool" && ev.tool !== void 0 && (ev.state === "DONE" || ev.state === "ERROR" || ev.state === "RUNNING" || ev.state === void 0 && (ev.tool.output !== void 0 || ev.tool.error !== void 0))) return true;
|
|
30955
|
+
}
|
|
30956
|
+
return false;
|
|
30957
|
+
}
|
|
30937
30958
|
/** The last result envelope's finish-relevant projection, when one arrived. */
|
|
30938
30959
|
getResultEvent() {
|
|
30939
30960
|
for (let i = this.events.length - 1; i >= 0; i--) {
|
|
@@ -35617,8 +35638,7 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
35617
35638
|
deps.clearInFlightPrompt(sessionKey, spawn.prompt);
|
|
35618
35639
|
recorder.drain(input.agyOnEvent);
|
|
35619
35640
|
const conversationId = recorder.conversationId();
|
|
35620
|
-
|
|
35621
|
-
if (!(existingRes !== null && (existingRes.ok || existingRes.response !== "")) && outcome.idleGraceTerminated) {
|
|
35641
|
+
if (!rec.hasConsumableResult && outcome.idleGraceTerminated) {
|
|
35622
35642
|
const recovered = conversationId === null ? "" : recoverFinalReply(conversationId, rec.accountHome);
|
|
35623
35643
|
const synthResult = {
|
|
35624
35644
|
kind: "result",
|
|
@@ -35679,7 +35699,7 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
35679
35699
|
* queue notices; the outcome closure runs detached exactly as before.
|
|
35680
35700
|
*/
|
|
35681
35701
|
async function* runAgyAttempt(deps, input) {
|
|
35682
|
-
const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId
|
|
35702
|
+
const recorder = createAttemptRecorder(deps, input.cfg, input.account, input.binding?.conversationId);
|
|
35683
35703
|
const spawn = buildSpawnArgs(input, recorder.printTimeoutMinutes, deps.log);
|
|
35684
35704
|
const slot = yield* dispatchCredentialSlot(deps, {
|
|
35685
35705
|
...input,
|
|
@@ -35924,14 +35944,14 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
35924
35944
|
if (continuation !== null) {
|
|
35925
35945
|
const rec = this.deps.runs.get(continuation.runId);
|
|
35926
35946
|
const deadFailure = rec !== void 0 && rec.isSettled ? rec.failureInfo : null;
|
|
35927
|
-
const
|
|
35928
|
-
if (rec !== void 0 && !
|
|
35947
|
+
const deadNoResult = rec !== void 0 && rec.isSettled && deadFailure === null && !rec.hasFinishableEventFrom(continuation.eventIndex + 1, hasToolSupport);
|
|
35948
|
+
if (rec !== void 0 && !deadNoResult && !(deadFailure !== null && this.claimFailover(sessionKey, deadFailure.code))) {
|
|
35929
35949
|
yield* driveSpan(this.deps, rec, continuation.eventIndex + 1, hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal);
|
|
35930
35950
|
return;
|
|
35931
35951
|
}
|
|
35932
35952
|
if (rec !== void 0) {
|
|
35933
35953
|
this.deps.runs.forget(continuation.runId);
|
|
35934
|
-
this.warnOnce("dead-continuation:" + continuation.runId,
|
|
35954
|
+
this.warnOnce("dead-continuation:" + continuation.runId, deadNoResult ? "agy run " + continuation.runId + " settled without a consumable result — retrying this step instead of replaying it" : "agy run " + continuation.runId + " settled in " + (deadFailure?.code ?? "") + " — retrying this step instead of replaying it" + (deadFailure?.code === Err.NETWORK && this.sharesSingleEgress() ? " on the same account (shared egress)" : " on another account"));
|
|
35935
35955
|
} else this.warnOnce("stale-continuation:" + continuation.runId, "agy run " + continuation.runId + " is no longer available in memory (server restarted?) — falling back to fresh turn prompt assembly");
|
|
35936
35956
|
}
|
|
35937
35957
|
const catalog = this.deps.catalog.get();
|
|
@@ -36116,7 +36136,7 @@ var AgyAdapter = class extends LlmAdapter {
|
|
|
36116
36136
|
signal: options.signal,
|
|
36117
36137
|
agyOnEvent: options.agyOnEvent
|
|
36118
36138
|
});
|
|
36119
|
-
yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice
|
|
36139
|
+
yield* driveSpan(this.deps, rec, 0, policy.mirrorTools && hasToolSupport, isCodeMode, goalContext, supportsGoalUpdate, supportsPlanExit, options.signal, compactionNotice);
|
|
36120
36140
|
}
|
|
36121
36141
|
};
|
|
36122
36142
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.48",
|
|
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",
|