dsh-baton-host 0.6.18 → 0.6.19
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/lib/index.js +42 -4
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -28,6 +28,10 @@ const ACTIVITY_MAX_ERRORS = 10
|
|
|
28
28
|
// A run taken up after a plugin reload whose message Harness had not admitted yet.
|
|
29
29
|
const TAKE_UP_RETRY_MS = 3000
|
|
30
30
|
const takeUpAdmitMs = () => Number(process.env.DSH_BATON_TAKE_UP_ADMIT_MS) || 5 * 60_000
|
|
31
|
+
// How long a run whose own turn ended waits for background jobs or reminders (not sub-agents,
|
|
32
|
+
// which are part of the task) before it completes anyway, saying what is left (left_running).
|
|
33
|
+
// A search over the whole home folder held a reply back for 15 minutes (Mac, 2026-11-22).
|
|
34
|
+
const jobWaitMs = () => Number(process.env.DSH_BATON_JOB_WAIT_MS) || 5 * 60_000
|
|
31
35
|
const MAX_REQUEST_BYTES = 4 * 1024 * 1024
|
|
32
36
|
const MAX_WAIT_S = 24 * 3600
|
|
33
37
|
const MAX_HUMAN_INPUTS = 10
|
|
@@ -257,6 +261,7 @@ export function apply(ctx) {
|
|
|
257
261
|
...(run.sender ? { sender: run.sender } : {}),
|
|
258
262
|
...(run.model ? { model: run.model } : {}),
|
|
259
263
|
...(run.waitingOn ? { waiting_on: run.waitingOn } : {}),
|
|
264
|
+
...(run.leftRunning ? { left_running: run.leftRunning } : {}),
|
|
260
265
|
...(run.supersededBy ? { superseded_by: run.supersededBy } : {}),
|
|
261
266
|
...(run.humanInputs?.length ? { human_interjections: run.humanInputs } : {}),
|
|
262
267
|
...(run.approvalsAllowed?.length ? { approvals_allowed: run.approvalsAllowed } : {}),
|
|
@@ -547,7 +552,12 @@ export function apply(ctx) {
|
|
|
547
552
|
// completed one ends it only once the session is quiet (no sub-agents or jobs
|
|
548
553
|
// left), because Harness wakes the agent again when those report back.
|
|
549
554
|
const reason = data.reason ?? null
|
|
550
|
-
for (const run of receivers) {
|
|
555
|
+
for (const run of receivers) {
|
|
556
|
+
// The reply of the run's own turn, kept apart from what later wake-up turns say.
|
|
557
|
+
if (!run.turnEnd && (!reason?.kind || reason.kind === 'completed')) run.turnText = run.finalText ?? null
|
|
558
|
+
run.turnEnd = reason
|
|
559
|
+
persist(run)
|
|
560
|
+
}
|
|
551
561
|
if (reason?.kind && reason.kind !== 'completed') for (const run of receivers) settle(run, 'failed')
|
|
552
562
|
else scheduleQuietCheck(session.id, 1000)
|
|
553
563
|
turns.delete(session.id)
|
|
@@ -597,8 +607,16 @@ export function apply(ctx) {
|
|
|
597
607
|
// Closed runs: the running turn belongs to a newer run, so only their
|
|
598
608
|
// background work (sub-agents, jobs, reminders) keeps them open.
|
|
599
609
|
const background = items.filter((g) => g.kind !== 'turn')
|
|
610
|
+
// Only jobs or reminders left, past the limit since the run's own turn ended: done anyway.
|
|
611
|
+
const outlasted = (run) => {
|
|
612
|
+
if (!background.length || items.some((g) => g.kind === 'turn' || g.kind === 'subagent')) { delete run.jobsSince; return false }
|
|
613
|
+
run.jobsSince ??= Date.now()
|
|
614
|
+
return Date.now() - run.jobsSince >= jobWaitMs()
|
|
615
|
+
}
|
|
600
616
|
for (const run of receivers.filter((r) => r.outputClosed)) {
|
|
601
|
-
|
|
617
|
+
noteWaited(run, background)
|
|
618
|
+
if (background.length === 0) finishQuiet(run)
|
|
619
|
+
else if (outlasted(run)) finishQuiet(run, { leftRunning: summary(background) })
|
|
602
620
|
else { run.waitingOn = summary(background); persist(run) }
|
|
603
621
|
}
|
|
604
622
|
// A run whose own turn has not ended (and that has not seen the agent idle) is not done yet.
|
|
@@ -615,14 +633,34 @@ export function apply(ctx) {
|
|
|
615
633
|
return
|
|
616
634
|
}
|
|
617
635
|
quietSinceBySession.delete(sessionId)
|
|
618
|
-
for (const run of open)
|
|
636
|
+
for (const run of open) finishQuiet(run)
|
|
619
637
|
return
|
|
620
638
|
}
|
|
621
639
|
quietSinceBySession.delete(sessionId)
|
|
622
|
-
for (const run of open) run
|
|
640
|
+
for (const run of open) noteWaited(run, items)
|
|
641
|
+
const late = open.filter((r) => r.turnEnd && outlasted(r))
|
|
642
|
+
for (const run of late) finishQuiet(run, { leftRunning: summary(background) })
|
|
643
|
+
for (const run of open.filter((r) => !late.includes(r))) run.waitingOn = items.length ? summary(items) : run.waitingOn
|
|
623
644
|
if (receiversFor(sessionId).length) scheduleQuietCheck(sessionId, 3000)
|
|
624
645
|
}
|
|
625
646
|
|
|
647
|
+
// The kinds of background work a run has waited for, to tell what its later turns are about.
|
|
648
|
+
function noteWaited(run, list) {
|
|
649
|
+
const kinds = list.map((g) => g.kind).filter((k) => k !== 'turn' && !(run.waitedKinds ?? []).includes(k))
|
|
650
|
+
if (kinds.length) run.waitedKinds = [...(run.waitedKinds ?? []), ...kinds]
|
|
651
|
+
}
|
|
652
|
+
// A run that waited for sub-agents ends with their summary turn as its reply. One that waited
|
|
653
|
+
// only for jobs or reminders keeps its own turn's reply, with what the later turns said after it:
|
|
654
|
+
// a turn woken by a job is about that job, and replacing the reply with it lost a whole
|
|
655
|
+
// review (Antigravity, 2026-11-22).
|
|
656
|
+
function finishQuiet(run, extra = {}) {
|
|
657
|
+
const reply = run.turnText
|
|
658
|
+
const later = run.finalText
|
|
659
|
+
const kinds = run.waitedKinds ?? []
|
|
660
|
+
const keep = reply && later && later !== reply && kinds.length && !kinds.includes('subagent')
|
|
661
|
+
settle(run, 'completed', { waitingOn: null, error: null, ...(keep ? { finalText: `${reply}\n\n${later}` } : {}), ...extra })
|
|
662
|
+
}
|
|
663
|
+
|
|
626
664
|
ctx.effect(() => () => { for (const t of quietTimers.values()) clearTimeout(t) }, 'dsh-baton-host quiet timers')
|
|
627
665
|
|
|
628
666
|
ctx.on('agent/status', guard('agent/status', ({ agent, status }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-baton-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.19",
|
|
4
4
|
"description": "Hand coding tasks from Claude Code, Codex or Antigravity to DeepSeek Harness: they run live in the Harness window and come back with the changed files and test results. 让 Claude Code、Codex 和 Antigravity 把编码任务交给 DeepSeek Harness:在 Harness 窗口里实时跑,做完带着改动文件和测试结果交回。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"docs"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"dsh-baton-mcp": "0.6.
|
|
27
|
+
"dsh-baton-mcp": "0.6.19"
|
|
28
28
|
},
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dsh": {
|