dsh-agy-link 0.6.35 → 0.6.36
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 +12 -0
- package/dist/cli-image.mjs +81 -1
- package/dist/index.js +81 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.36 (2026-11-19)
|
|
4
|
+
|
|
5
|
+
### English
|
|
6
|
+
|
|
7
|
+
- **Fix: an idle-reaped turn no longer loses its final answer (fixes #128 bug 2, addresses #127).** When the 5s idle reaper ended a turn whose final `PLANNER_RESPONSE` was already written to agy's `transcript.jsonl` but had not been flushed to stdout, the synthesized result carried `response: ''` — DSH then rendered a clean "completed" turn with **no reply bubble**, which reads as success for work that was never confirmed. `recoverFinalReply()` now reads a bounded (≤256 KiB) tail of `<brainDir>/.system_generated/logs/transcript.jsonl` and returns the last `PLANNER_RESPONSE` **after the final `USER_INPUT`** whose `content` is non-empty and which carries no pending `tool_calls`; the synthesized result uses it. When nothing can be recovered, a bilingual notice states the background wait ended without a confirmed outcome and that some steps may have run — the turn still finishes cleanly, and turns that already produced an answer are untouched.
|
|
8
|
+
- **Already fixed upstream, verified:** #128 bug 1 (historical subagent banners replayed on `--conversation` resume) is covered by v0.6.35's `SubagentTracker` baseline (`resumed` + `baselineExisting()`), which seeds pre-existing descriptors into `seenStepKeys` and starts transcripts at EOF.
|
|
9
|
+
|
|
10
|
+
### 中文
|
|
11
|
+
|
|
12
|
+
- **修复:被 idle 回收的轮次不再丢失最终答复(修复 #128 bug 2,回应 #127)。** 当 5s 回收发生在「最终 `PLANNER_RESPONSE` 已写入 agy `transcript.jsonl`、但尚未由 stdout 刷出」的时间窗内时,合成的 result 里 `response` 是空串,DSH 因此显示「正常完成」却**没有任何正文气泡**——这会被读成任务成功,而实际结果未确认。新增 `recoverFinalReply()`:有界读取(≤256 KiB)`<brainDir>/.system_generated/logs/transcript.jsonl` 尾部,返回**最后一条 `USER_INPUT` 之后**、`content` 非空且**无待执行 `tool_calls`** 的 `PLANNER_RESPONSE`,并写入合成 result。恢复不到时改为中英双语提示「后台等待已结束、结果未确认、部分操作可能已执行」;该轮仍以正常 finish 收尾,已有答复的回合完全不受影响。
|
|
13
|
+
- **上游已修复并核实**:#128 bug 1(`--conversation` 续接时重放历史子代理横幅)已由 v0.6.35 的 `SubagentTracker` 基线机制覆盖(`resumed` + `baselineExisting()`,把既有描述符预先记入 `seenStepKeys` 并把 transcript 起点设在 EOF)。
|
|
14
|
+
|
|
3
15
|
## 0.6.35 (2026-11-18)
|
|
4
16
|
|
|
5
17
|
### English
|
package/dist/cli-image.mjs
CHANGED
|
@@ -34203,6 +34203,85 @@ async function startAttemptProcess(deps, input, spawn, recorder, slot) {
|
|
|
34203
34203
|
};
|
|
34204
34204
|
}
|
|
34205
34205
|
//#endregion
|
|
34206
|
+
//#region src/provider/idle-grace-reply.ts
|
|
34207
|
+
/**
|
|
34208
|
+
* How much of the transcript tail to inspect. The file grows for the lifetime
|
|
34209
|
+
* of a conversation, and only the newest turn matters, so a bounded tail read
|
|
34210
|
+
* keeps this O(1) regardless of history size.
|
|
34211
|
+
*/
|
|
34212
|
+
const TAIL_BYTES = 262144;
|
|
34213
|
+
/**
|
|
34214
|
+
* Shown when the idle reaper ended the turn without a recoverable reply.
|
|
34215
|
+
*
|
|
34216
|
+
* Silently finishing with no text made DSH render "completed" while the user
|
|
34217
|
+
* saw no answer at all, which reads as success for work that was never
|
|
34218
|
+
* confirmed (issue #127). The turn is still a clean finish — this only explains
|
|
34219
|
+
* what happened instead of leaving a blank turn.
|
|
34220
|
+
*/
|
|
34221
|
+
const IDLE_GRACE_NO_REPLY_NOTICE = "⚠️ 后台等待已结束,本轮没有收到最终答复;任务结果未确认,部分操作可能已经执行。\n⚠️ Background wait ended without a final reply — the task outcome is unconfirmed and some steps may have run.\n";
|
|
34222
|
+
/**
|
|
34223
|
+
* The final assistant reply written during the CURRENT turn, or '' when the
|
|
34224
|
+
* transcript does not prove one.
|
|
34225
|
+
*
|
|
34226
|
+
* "Current turn" = after the last `USER_INPUT` row. A `PLANNER_RESPONSE` still
|
|
34227
|
+
* carrying `tool_calls` is an in-flight step, not a final answer, and is
|
|
34228
|
+
* skipped. Anything unreadable degrades to '' so the caller keeps its previous
|
|
34229
|
+
* behaviour.
|
|
34230
|
+
*/
|
|
34231
|
+
function recoverFinalReply(conversationId, accountHome) {
|
|
34232
|
+
const logPath = transcriptPath(conversationId, accountHome);
|
|
34233
|
+
if (logPath === null) return "";
|
|
34234
|
+
let text;
|
|
34235
|
+
try {
|
|
34236
|
+
text = readTail(logPath);
|
|
34237
|
+
} catch {
|
|
34238
|
+
return "";
|
|
34239
|
+
}
|
|
34240
|
+
const rows = text.split("\n").filter((line) => line.trim() !== "");
|
|
34241
|
+
let lastUserInput = -1;
|
|
34242
|
+
for (let i = 0; i < rows.length; i++) if (rowType(rows[i]) === "USER_INPUT") lastUserInput = i;
|
|
34243
|
+
for (let i = rows.length - 1; i > lastUserInput; i--) {
|
|
34244
|
+
const row = parseRow(rows[i]);
|
|
34245
|
+
if (row === null || row.type !== "PLANNER_RESPONSE") continue;
|
|
34246
|
+
if (Array.isArray(row.tool_calls) && row.tool_calls.length > 0) continue;
|
|
34247
|
+
if (typeof row.content !== "string") continue;
|
|
34248
|
+
if (row.content.trim() !== "") return row.content;
|
|
34249
|
+
}
|
|
34250
|
+
return "";
|
|
34251
|
+
}
|
|
34252
|
+
function transcriptPath(conversationId, accountHome) {
|
|
34253
|
+
const brainDir = findBrainDir(conversationId, accountHome);
|
|
34254
|
+
if (brainDir === null) return null;
|
|
34255
|
+
const logPath = join(brainDir, ".system_generated", "logs", "transcript.jsonl");
|
|
34256
|
+
return existsSync(logPath) ? logPath : null;
|
|
34257
|
+
}
|
|
34258
|
+
function readTail(logPath) {
|
|
34259
|
+
const size = statSync(logPath).size;
|
|
34260
|
+
const start = Math.max(0, size - TAIL_BYTES);
|
|
34261
|
+
const length = size - start;
|
|
34262
|
+
if (length <= 0) return "";
|
|
34263
|
+
const buf = Buffer.alloc(length);
|
|
34264
|
+
const fd = openSync(logPath, "r");
|
|
34265
|
+
try {
|
|
34266
|
+
readSync(fd, buf, 0, length, start);
|
|
34267
|
+
} finally {
|
|
34268
|
+
closeSync(fd);
|
|
34269
|
+
}
|
|
34270
|
+
return buf.toString("utf8");
|
|
34271
|
+
}
|
|
34272
|
+
function parseRow(line) {
|
|
34273
|
+
try {
|
|
34274
|
+
const parsed = JSON.parse(line);
|
|
34275
|
+
return parsed !== null && typeof parsed === "object" ? parsed : null;
|
|
34276
|
+
} catch {
|
|
34277
|
+
return null;
|
|
34278
|
+
}
|
|
34279
|
+
}
|
|
34280
|
+
function rowType(line) {
|
|
34281
|
+
const row = parseRow(line);
|
|
34282
|
+
return row !== null && typeof row.type === "string" ? row.type : "";
|
|
34283
|
+
}
|
|
34284
|
+
//#endregion
|
|
34206
34285
|
//#region src/provider/failure.ts
|
|
34207
34286
|
function brief(s) {
|
|
34208
34287
|
const flat = s.trim().replace(/\s+/g, " ");
|
|
@@ -34609,11 +34688,12 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
34609
34688
|
recorder.drain(input.agyOnEvent);
|
|
34610
34689
|
const conversationId = recorder.conversationId();
|
|
34611
34690
|
if (!rec.hasResult && outcome.idleGraceTerminated) {
|
|
34691
|
+
const recovered = conversationId === null ? "" : recoverFinalReply(conversationId, rec.accountHome);
|
|
34612
34692
|
const synthResult = {
|
|
34613
34693
|
kind: "result",
|
|
34614
34694
|
conversationId: conversationId ?? "",
|
|
34615
34695
|
ok: true,
|
|
34616
|
-
response: "",
|
|
34696
|
+
response: recovered === "" ? IDLE_GRACE_NO_REPLY_NOTICE : recovered,
|
|
34617
34697
|
usage: rec.finalUsage({}),
|
|
34618
34698
|
raw: {}
|
|
34619
34699
|
};
|
package/dist/index.js
CHANGED
|
@@ -34945,6 +34945,85 @@ async function startAttemptProcess(deps, input, spawn, recorder, slot) {
|
|
|
34945
34945
|
};
|
|
34946
34946
|
}
|
|
34947
34947
|
//#endregion
|
|
34948
|
+
//#region src/provider/idle-grace-reply.ts
|
|
34949
|
+
/**
|
|
34950
|
+
* How much of the transcript tail to inspect. The file grows for the lifetime
|
|
34951
|
+
* of a conversation, and only the newest turn matters, so a bounded tail read
|
|
34952
|
+
* keeps this O(1) regardless of history size.
|
|
34953
|
+
*/
|
|
34954
|
+
const TAIL_BYTES = 262144;
|
|
34955
|
+
/**
|
|
34956
|
+
* Shown when the idle reaper ended the turn without a recoverable reply.
|
|
34957
|
+
*
|
|
34958
|
+
* Silently finishing with no text made DSH render "completed" while the user
|
|
34959
|
+
* saw no answer at all, which reads as success for work that was never
|
|
34960
|
+
* confirmed (issue #127). The turn is still a clean finish — this only explains
|
|
34961
|
+
* what happened instead of leaving a blank turn.
|
|
34962
|
+
*/
|
|
34963
|
+
const IDLE_GRACE_NO_REPLY_NOTICE = "⚠️ 后台等待已结束,本轮没有收到最终答复;任务结果未确认,部分操作可能已经执行。\n⚠️ Background wait ended without a final reply — the task outcome is unconfirmed and some steps may have run.\n";
|
|
34964
|
+
/**
|
|
34965
|
+
* The final assistant reply written during the CURRENT turn, or '' when the
|
|
34966
|
+
* transcript does not prove one.
|
|
34967
|
+
*
|
|
34968
|
+
* "Current turn" = after the last `USER_INPUT` row. A `PLANNER_RESPONSE` still
|
|
34969
|
+
* carrying `tool_calls` is an in-flight step, not a final answer, and is
|
|
34970
|
+
* skipped. Anything unreadable degrades to '' so the caller keeps its previous
|
|
34971
|
+
* behaviour.
|
|
34972
|
+
*/
|
|
34973
|
+
function recoverFinalReply(conversationId, accountHome) {
|
|
34974
|
+
const logPath = transcriptPath(conversationId, accountHome);
|
|
34975
|
+
if (logPath === null) return "";
|
|
34976
|
+
let text;
|
|
34977
|
+
try {
|
|
34978
|
+
text = readTail(logPath);
|
|
34979
|
+
} catch {
|
|
34980
|
+
return "";
|
|
34981
|
+
}
|
|
34982
|
+
const rows = text.split("\n").filter((line) => line.trim() !== "");
|
|
34983
|
+
let lastUserInput = -1;
|
|
34984
|
+
for (let i = 0; i < rows.length; i++) if (rowType(rows[i]) === "USER_INPUT") lastUserInput = i;
|
|
34985
|
+
for (let i = rows.length - 1; i > lastUserInput; i--) {
|
|
34986
|
+
const row = parseRow(rows[i]);
|
|
34987
|
+
if (row === null || row.type !== "PLANNER_RESPONSE") continue;
|
|
34988
|
+
if (Array.isArray(row.tool_calls) && row.tool_calls.length > 0) continue;
|
|
34989
|
+
if (typeof row.content !== "string") continue;
|
|
34990
|
+
if (row.content.trim() !== "") return row.content;
|
|
34991
|
+
}
|
|
34992
|
+
return "";
|
|
34993
|
+
}
|
|
34994
|
+
function transcriptPath(conversationId, accountHome) {
|
|
34995
|
+
const brainDir = findBrainDir(conversationId, accountHome);
|
|
34996
|
+
if (brainDir === null) return null;
|
|
34997
|
+
const logPath = join(brainDir, ".system_generated", "logs", "transcript.jsonl");
|
|
34998
|
+
return existsSync(logPath) ? logPath : null;
|
|
34999
|
+
}
|
|
35000
|
+
function readTail(logPath) {
|
|
35001
|
+
const size = statSync(logPath).size;
|
|
35002
|
+
const start = Math.max(0, size - TAIL_BYTES);
|
|
35003
|
+
const length = size - start;
|
|
35004
|
+
if (length <= 0) return "";
|
|
35005
|
+
const buf = Buffer.alloc(length);
|
|
35006
|
+
const fd = openSync(logPath, "r");
|
|
35007
|
+
try {
|
|
35008
|
+
readSync(fd, buf, 0, length, start);
|
|
35009
|
+
} finally {
|
|
35010
|
+
closeSync(fd);
|
|
35011
|
+
}
|
|
35012
|
+
return buf.toString("utf8");
|
|
35013
|
+
}
|
|
35014
|
+
function parseRow(line) {
|
|
35015
|
+
try {
|
|
35016
|
+
const parsed = JSON.parse(line);
|
|
35017
|
+
return parsed !== null && typeof parsed === "object" ? parsed : null;
|
|
35018
|
+
} catch {
|
|
35019
|
+
return null;
|
|
35020
|
+
}
|
|
35021
|
+
}
|
|
35022
|
+
function rowType(line) {
|
|
35023
|
+
const row = parseRow(line);
|
|
35024
|
+
return row !== null && typeof row.type === "string" ? row.type : "";
|
|
35025
|
+
}
|
|
35026
|
+
//#endregion
|
|
34948
35027
|
//#region src/provider/failure.ts
|
|
34949
35028
|
function brief(s) {
|
|
34950
35029
|
const flat = s.trim().replace(/\s+/g, " ");
|
|
@@ -35351,11 +35430,12 @@ async function handleAttemptOutcome(deps, input, ctx) {
|
|
|
35351
35430
|
recorder.drain(input.agyOnEvent);
|
|
35352
35431
|
const conversationId = recorder.conversationId();
|
|
35353
35432
|
if (!rec.hasResult && outcome.idleGraceTerminated) {
|
|
35433
|
+
const recovered = conversationId === null ? "" : recoverFinalReply(conversationId, rec.accountHome);
|
|
35354
35434
|
const synthResult = {
|
|
35355
35435
|
kind: "result",
|
|
35356
35436
|
conversationId: conversationId ?? "",
|
|
35357
35437
|
ok: true,
|
|
35358
|
-
response: "",
|
|
35438
|
+
response: recovered === "" ? IDLE_GRACE_NO_REPLY_NOTICE : recovered,
|
|
35359
35439
|
usage: rec.finalUsage({}),
|
|
35360
35440
|
raw: {}
|
|
35361
35441
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-agy-link",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.36",
|
|
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",
|