Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: close a subagent terminal when its subagent leaves the list

This commit is contained in:
iris 2026-10-21 20:58:54 +02:00 • committed by mara
commit 393213054d
3 changed files with 38 additions and 4 deletions

View file

@ -9,6 +9,7 @@ import {
isRunning,
runningLabel,
splitRunning,
stillListed,
} from "../src/agent/terminal/subagent-list.ts";
const NOW = 1_000_000;
@ -59,3 +60,12 @@ test("the badge counts in words", () => {
assert.equal(runningLabel(1), "1 running subagent");
assert.equal(runningLabel(4), "4 running subagents");
});
test("a pick holds only while the refreshed list still has it", () => {
const subs = [sub("a", 10), sub("b", 20)];
assert.equal(stillListed("a", subs), "a");
assert.equal(stillListed("gone", subs), null);
assert.equal(stillListed("a", []), null);
assert.equal(stillListed("a", null), null);
assert.equal(stillListed(null, subs), null);
});