GET /api/agents/{name}/bash-tasks reads the agent's keys of the bash-task-status
bucket and reports each task's state, command and times, with a live task whose
daemon stopped reporting as stale. The swarm UI shows them in a background tasks
section of the agent card, running ones first. The task output stays unread.
34 lines
948 B
JavaScript
34 lines
948 B
JavaScript
// The sections an opened agent card holds. Run by `npm test`, which Node runs
|
|
// with its built-in test runner and type stripping.
|
|
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import {
|
|
SECTION_TITLE,
|
|
sectionsFor,
|
|
startsOpen,
|
|
} from "../src/agent/detail/sections.ts";
|
|
|
|
test("a card holds status, terminal, subagents, background tasks, then settings", () => {
|
|
assert.deepEqual(sectionsFor(true), [
|
|
"status",
|
|
"terminal",
|
|
"subagents",
|
|
"tasks",
|
|
"settings",
|
|
]);
|
|
});
|
|
|
|
test("a page beside a terminal leaves the terminal, subagents and tasks out", () => {
|
|
assert.deepEqual(sectionsFor(false), ["status", "settings"]);
|
|
});
|
|
|
|
test("the status and the terminal start open", () => {
|
|
assert.deepEqual(sectionsFor(true).filter(startsOpen), [
|
|
"status",
|
|
"terminal",
|
|
]);
|
|
});
|
|
|
|
test("every section has a header", () => {
|
|
for (const s of sectionsFor(true)) assert.ok(SECTION_TITLE[s], s);
|
|
});
|