swarm: list an agent's bash tasks from their published status
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.
This commit is contained in:
parent
cc7b298cf3
commit
5de20f31dd
2 changed files with 625 additions and 11 deletions
|
|
@ -42,6 +42,7 @@ import {
|
|||
startsOpen,
|
||||
type DetailSection,
|
||||
} from "./sections.js";
|
||||
import { BashTasks } from "../terminal/BashTasks.js";
|
||||
import { SubagentTerms } from "../terminal/SubagentTerms.js";
|
||||
import { WantedMenu } from "../roster/WantedMenu.js";
|
||||
import "./AgentDetail.css";
|
||||
|
|
@ -313,6 +314,8 @@ function SectionBody({
|
|||
return <AgentTermPreview agentName={row.name} />;
|
||||
case "subagents":
|
||||
return <SubagentTerms key={row.name} agentName={row.name} />;
|
||||
case "tasks":
|
||||
return <BashTasks key={row.name} agentName={row.name} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +327,7 @@ export function AgentDetail({
|
|||
}: {
|
||||
row: AgentRow;
|
||||
actions: AgentActions;
|
||||
/** Add the live terminal and subagents sections. */
|
||||
/** Add the live terminal, subagents and background tasks sections. */
|
||||
withTerminal?: boolean;
|
||||
/**
|
||||
* An opened card, whose header already shows the state rows. Without it
|
||||
|
|
|
|||
|
|
@ -3,24 +3,30 @@
|
|||
// agent's state, message and wanted state, so the sections hold the rest.
|
||||
|
||||
/** One folded block of an opened agent card. */
|
||||
export type DetailSection = "status" | "terminal" | "subagents" | "settings";
|
||||
export type DetailSection =
|
||||
| "status"
|
||||
| "terminal"
|
||||
| "subagents"
|
||||
| "tasks"
|
||||
| "settings";
|
||||
|
||||
/** What each section's header says. */
|
||||
export const SECTION_TITLE: Record<DetailSection, string> = {
|
||||
status: "status",
|
||||
terminal: "terminal",
|
||||
subagents: "subagents",
|
||||
tasks: "background tasks",
|
||||
settings: "settings",
|
||||
};
|
||||
|
||||
/**
|
||||
* The sections a card shows, top to bottom. The terminal and subagents are
|
||||
* The sections a card shows, top to bottom. The terminal, subagents and tasks are
|
||||
* left out where the page is already beside a terminal (the terminal page's
|
||||
* details popover).
|
||||
*/
|
||||
export function sectionsFor(withTerminal: boolean): DetailSection[] {
|
||||
return withTerminal
|
||||
? ["status", "terminal", "subagents", "settings"]
|
||||
? ["status", "terminal", "subagents", "tasks", "settings"]
|
||||
: ["status", "settings"];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue