mcp: subagent and workflow messages in small print (#8303)

This commit is contained in:
Evgeny @ SimpleX Chat authored and GitHub committed 2026-11-22 07:35:37 +00:00
1 parent 9b0b6a2375
commit dbd3fd7ca5
9 files changed
+33 -26

No files matched your search

+1 -1
View File
@@ -694,7 +694,7 @@ With the channel, a message from a member of a session's group, other than `User
🤖 Explore · find the suspend callers
14 steps · 38.2k tokens · 1:05 · now: 📖 Read SuspendChat.swift
```
A subagent with no step for 2 minutes, or 10 minutes while a step runs, shows `⚠️ no step for 2:10 · last: 💻 cabal build` instead of `now:`. When it ends, the message is completed with its time, steps and tokens and the first line of its result, such as `🤖 Explore · find the suspend callers · ✅ 2:40 · 22 steps · 61.5k tokens`, with ❌ for a failure and ⏹️ for a stop. A workflow shows its phases, done agents of all started: `⚙️ review-changes · Review 4/4 ✅ · Verify 3/8 · 2 working · 412k tokens · 6:30`, and ends as `⚙️ review-changes · ✅ 6:30 · Review 4/4 · Verify 8/8 · 412k tokens`. The notification of a finished subagent or workflow gets no line, because its message shows the end. Tokens are those of the agent's latest request, as the terminal shows them, read from its transcript every 2 seconds. Teammates of an agent team, the agents of a workflow and Claude Code's internal agents get no message of their own. A message keeps its place in the chat when it is edited. Live messages still live when the session ends are completed with ⏹️.
Each line is in small print, with `!` shown as `ǃ`, as in the lines of steps. A subagent with no step for 2 minutes, or 10 minutes while a step runs, shows `⚠️ no step for 2:10 · last: 💻 cabal build` instead of `now:`. When it ends, the message is completed with its time, steps and tokens and the first line of its result, such as `🤖 Explore · find the suspend callers · ✅ 2:40 · 22 steps · 61.5k tokens`, with ❌ for a failure and ⏹️ for a stop. A workflow shows its phases, done agents of all started: `⚙️ review-changes · Review 4/4 ✅ · Verify 3/8 · 2 working · 412k tokens · 6:30`, and ends as `⚙️ review-changes · ✅ 6:30 · Review 4/4 · Verify 8/8 · 412k tokens`. The notification of a finished subagent or workflow gets no line, because its message shows the end. Tokens are those of the agent's latest request, as the terminal shows them, read from its transcript every 2 seconds. Teammates of an agent team, the agents of a workflow and Claude Code's internal agents get no message of their own. A message keeps its place in the chat when it is edited. Live messages still live when the session ends are completed with ⏹️.
- Claude marks the turn's empty live message, its texts and answers, the lines of steps, and the lines of Claude Code's own prompts, of summaries of the context and of model and effort switches as silent. The answer's last message, with its line, is important, so a turn alerts once, at its end. When the line completes a live message or the turn's empty live message, the edit marks it important; SimpleX apps alert for such an edit once they support it. A SimpleX app that supports silent messages shows them without an alert; other apps alert for them as for any message.
- A text too long for one message is posted as several messages, each as long as a message can be, measured as for `send`. The first part of an answer carries the quote. A part without a quote holds up to 14,962 Latin, 7,481 Cyrillic or 4,987 CJK characters. A prompt or an answer over 250,000 characters is cut there and ends with `…`.
- The `reply` tool sends a file to the group at once, without approval, with its text as the caption, under the file rules of `send`. It returns the file's message as `item`. A caption too long for a message with the file's preview is refused with `text: too long for a message with this TYPE; shorten it.`
+1 -1
View File
@@ -246,7 +246,7 @@ In a session started as in step 2 above:
- The plugin's folder had no `node_modules/.package-lock.json`.
- With the same keys in `.claude/settings.json` of the folder, and without `--settings`, the run had no tool of the plugin.
19. Start Claude Code as in step 2 with an empty data folder and a machine name: `SIMPLEX_MCP_HOME=/tmp/simplex-mcp-fresh SIMPLEX_MCP_MACHINE=laptop claude --plugin-dir /tmp/simplex-plugin --dangerously-load-development-channels plugin:simplex@inline`. Exit it before the QR code shows. Start it again the same way. The QR code shows within seconds, for the group "Claude Control - laptop". Stop that service: `kill $(cat /tmp/simplex-mcp-fresh/service.lock)`.
20. With the session of step 2 running and a second session started as in step 2 in another folder, the Main group shows one message for each, with the Claude account, the model and the effort, and the summary `2 sessions` with their state emojis. After `/goal` with a condition, the message and the session group's short description show `goal set`, and `goal met` once it is met. After a recap, as when the terminal loses focus at the end of a turn, the message and the group's description show it. Ask Claude to run `sleep 20` with Bash: its message shows 🟢 working. Send `Run ls with Bash.` in its group: the line shows 🟠 waiting for you, 1 approval; tap `/approve N`, and it shows 🟢 working, then 🔴 idle when the turn ends. Press Esc during a turn: the line shows 🔴 idle within 2 seconds, although Claude Code runs no Stop hook. Ask Claude to run `sleep 60` with Bash in the background: after its turn ends, the line shows ⚙️ working in the background until the command ends. Ask Claude to ask you a question with AskUserQuestion: the line shows ⛔️ waiting for you in Claude Code. Exit the second Claude Code: its message shows ⚪ stopped. `/sessions` replies with the list of sessions, the stopped one in its last line, `⚪ Not running: `. Ask Claude for a background Explore agent and a foreground agent: each gets a live message in the session group, `🤖 TYPE · DESCRIPTION` with its steps, tokens, time and current step, matching the terminal; the board message shows `🤖 2 agents working`. Pause one agent on a long `sleep` without a timeout: after 10 minutes it shows `⚠️ no step for`. Each message ends with ✅, its time, steps, tokens and result, and the agent's notification posts no line. Run a two-phase workflow: one message shows its phases with done/total, and ends with ✅.
20. With the session of step 2 running and a second session started as in step 2 in another folder, the Main group shows one message for each, with the Claude account, the model and the effort, and the summary `2 sessions` with their state emojis. After `/goal` with a condition, the message and the session group's short description show `goal set`, and `goal met` once it is met. After a recap, as when the terminal loses focus at the end of a turn, the message and the group's description show it. Ask Claude to run `sleep 20` with Bash: its message shows 🟢 working. Send `Run ls with Bash.` in its group: the line shows 🟠 waiting for you, 1 approval; tap `/approve N`, and it shows 🟢 working, then 🔴 idle when the turn ends. Press Esc during a turn: the line shows 🔴 idle within 2 seconds, although Claude Code runs no Stop hook. Ask Claude to run `sleep 60` with Bash in the background: after its turn ends, the line shows ⚙️ working in the background until the command ends. Ask Claude to ask you a question with AskUserQuestion: the line shows ⛔️ waiting for you in Claude Code. Exit the second Claude Code: its message shows ⚪ stopped. `/sessions` replies with the list of sessions, the stopped one in its last line, `⚪ Not running: `. Ask Claude for a background Explore agent and a foreground agent: each gets a live message in small print in the session group, `🤖 TYPE · DESCRIPTION` with its steps, tokens, time and current step, matching the terminal; the board message shows `🤖 2 agents working`. Pause one agent on a long `sleep` without a timeout: after 10 minutes it shows `⚠️ no step for`. Each message ends with ✅, its time, steps, tokens and result, and the agent's notification posts no line. Run a two-phase workflow: one message shows its phases with done/total, and ends with ✅.
21. Send `Read README.md, say what you are doing before each step, and then summarize it in 30 lines.` in the group. An empty message from Claude appears at once, as a reply to your message, with typing dots. Claude's first remark or step fills it, and each later remark and the answer appear from their first line, growing by whole lines, at most every 3 seconds. The steps' lines appear between them. Each message ends without an edited mark. The answer's message ends with `Done in`, the turn's time and tokens in small print, and the chat list shows the answer. In the terminal, Claude's text appears by whole lines.
22. Send `Name a fruit.` in the group, and after the answer edit that message to `Name a vegetable.` Claude answers with a vegetable, as a reply to your message. In the transcript, the second tag has the same `item` as the first and `edited="true"`. Edit it into `/list`, and nothing happens. Turn on live mode in the app, type `Name a colour.` slowly, and send it. Claude answers once, after you send it, and the transcript has one tag with `Name a colour.`
23. Send `Ask a general-purpose subagent to run ls with Bash.` in the group. Claude posts ``Subagent `general-purpose` asks to use `Bash`: ...`` with `/approve N, /approve N all or /reject N`, and the terminal shows no dialog yet. Tap `/approve N`, and `ls` runs. Ask again and tap `/reject N`: the subagent reports the refusal. Send `Run ls with Bash.`: only the channel's card appears, one card for the prompt. Ask Claude to read a claude.ai artifact made by someone outside your organization: Claude posts ``I want to use `Artifact`, and Claude Code takes its approval only in its terminal:`` with `Approve it there, or /reject N here.`; `/approve N` gets `Action N is approved only in Claude Code's terminal.`, and `/reject N` closes the terminal's dialog. Start Claude Code without the channel flag and ask for `ls` with Bash: a card appears about 3 seconds after the dialog, and `/approve N` runs `ls`.
+7 -6
View File
@@ -924,16 +924,17 @@ Posts:
| Claude | files sent by `reply`, at once | [`AgentTools.reply`, `sendFile`](../src/tools.ts), the `replyChat` of the [`Session`](../src/hub.ts) constructor |
| Claude | the rights of the member's role, below. They are posted once for each join and each role change of a member other than `User`, at its `joinedGroupMember`, `connectedToGroupMember` or `memberRole` | [`Session.announceRights`, `Hub.onEvent`](../src/hub.ts), [`approverRights`, `senderRights`, `observerRights`, `sessionApproverRoles`, `canSend`, `rightsText`](../src/control.ts) |
<a id="agent-messages"></a>Subagents and workflows ([`Session.onAgents`, `readAgents`, `showCard`, `cardEditMs`](../src/hub.ts), [`Agents`, `cardText`, `agentsLine`](../src/agents.ts), [`agentStart`, `agentStep`, `leadTask`, `taskOf`](../src/hook.ts)):
<a id="agent-messages"></a>Subagents and workflows ([`Session.onAgents`, `readAgents`, `showCard`, `cardEditMs`](../src/hub.ts), [`Agents`, `cardText`, `agentsLine`, `small`](../src/agents.ts), [`agentStart`, `agentStep`, `leadTask`, `taskOf`](../src/hook.ts)):
| State | Text | Live |
|---|---|---|
| a subagent working | `🤖 TYPE · DESCRIPTION`, then `N steps · X tokens · M:SS · now: STEP`, or `· last: STEP` with no open step | on |
| stalled: no event for over 2 min with no open step, or 10 min with one | `🤖 TYPE · DESCRIPTION`, then `N steps · X tokens · M:SS · ⚠️ no step for M:SS · last: STEP` | on |
| ended | `🤖 TYPE · DESCRIPTION · ✅ M:SS · N steps · X tokens`, then the first line of its hand-back or its answer; `❌` for a failure, `⏹️` for a kill, a stop, the last detach, the hub's stop or 23 hours | off |
| a workflow working | `⚙️ NAME · PHASE d/t · … · K working · X tokens · M:SS`, d the ended agents of the phase and t its started ones, ` ✅` after a phase that is done when a later one started | on |
| a workflow ended | `⚙️ NAME · ✅ M:SS · PHASE d/t · … · X tokens` | off |
| a subagent working | `!- 🤖 TYPE · DESCRIPTION!`, then `!- N steps · X tokens · M:SS · now: STEP!`, or `· last: STEP` with no open step | on |
| stalled: no event for over 2 min with no open step, or 10 min with one | `!- 🤖 TYPE · DESCRIPTION!`, then `!- N steps · X tokens · M:SS · ⚠️ no step for M:SS · last: STEP!` | on |
| ended | `!- 🤖 TYPE · DESCRIPTION · ✅ M:SS · N steps · X tokens!`, then `!- RESULT!`, the first line of its hand-back or its answer; `❌` for a failure, `⏹️` for a kill, a stop, the last detach, the hub's stop or 23 hours | off |
| a workflow working | `!- ⚙️ NAME · PHASE d/t · … · K working · X tokens · M:SS!`, d the ended agents of the phase and t its started ones, ` ✅` after a phase that is done when a later one started | on |
| a workflow ended | `!- ⚙️ NAME · ✅ M:SS · PHASE d/t · … · X tokens!` | off |
- Each line is its own small-print span, with each `!` of the line replaced with `ǃ` (`small`): one span over several lines is left unformatted when a later line starts a block, such as `- ` of a list item (`paragraphP` in [`Markdown.hs`](../../../src/Simplex/Chat/Markdown.hs)).
- Each subagent that SubagentStart reports with its record, and each workflow that the lead starts, get one message, with priority -1, sent live. Teammates and workflow agents get none; the lead's `Agent` and `Workflow` tool uses get no step line.
- TYPE is `agent_type`; DESCRIPTION the record's; steps the subagent's tool uses; X the input, cache and output tokens of its latest request in its transcript, read every 2 s, and at the end the figures of the lead's result or task notification; M:SS the time since its start, in 5 s steps while live.
- A live message is edited at most every 5 s while its text changes; its end is edited at once with `liveMessage: false`, and again when the task's figures arrive. The note of a task notification of a known agent or workflow is not posted. A subagent resumed after its end gets a new message.
@@ -982,7 +982,7 @@ Data flow of a prompt from the session group:
|---|---|
| <a id="agents-agents"></a>`Agents`, `Card`, `Agent`, `Workflow`, `Live`, `End`, `JournalEntry`, `stalledFor`, `stallMs`, `stallCallMs`, `maxEnded` | the session's subagents and workflows, in memory, the last 100 ended ones kept. `start` adds a subagent, also for an ID that ended (a resumed agent gets a new message). `step` counts a tool use at its start, keeps it open until its end and then as the last step. `report` keeps the hand-back's first line as the result; `stop` ends the agent `completed`, with its answer's first line when no report came. `task` ends the newest agent or workflow of its tool use, keeping the time of an earlier stop. `endAll` ends the live ones `stopped`. A subagent is stalled when its last event is over 2 minutes old with no open step, or over 10 minutes with one. |
| <a id="agents-applyjournal"></a>`applyJournal`, `journalPath`, `workflowAgentTranscript` | the `started`, `result` and `failed` lines of a workflow's `journal.jsonl`, the last per `key`, with the phase of its first line; phases in the order of their first agent. |
| <a id="agents-agenttext"></a>`cardText`, `agentText`, `workflowText`, `tokensText`, `clock`, `statusEmoji` | the texts of [api.md](api.md#agent-messages). `tokensText`: `850 tokens`, `38.2k tokens` with one decimal rounded down under 100k, `412k tokens`, `1.2M tokens`. `clock`: `M:SS`, `H:MM:SS` from 1 hour; times of live messages in 5 s steps. |
| <a id="agents-agenttext"></a>`cardText`, `agentText`, `workflowText`, `small`, `tokensText`, `clock`, `statusEmoji` | the texts of [api.md](api.md#agent-messages). `small`: `!- LINE!`, with each `!` of LINE replaced with `ǃ`. `tokensText`: `850 tokens`, `38.2k tokens` with one decimal rounded down under 100k, `412k tokens`, `1.2M tokens`. `clock`: `M:SS`, `H:MM:SS` from 1 hour; times of live messages in 5 s steps. |
| <a id="agents-agentsline"></a>`agentsLine` | the line of the session's board message: `🤖 N agents working`, counting subagents and working agents of workflows, `K stalled M:SS` with the longest stall, and `⚙️ NAME PHASE d/t` for each working workflow's last phase; none while nothing works. |
#### [`hook.ts`](../src/hook.ts), [`display.ts`](../src/display.ts), [`service-request.ts`](../src/service-request.ts), [`status-line.ts`](../src/status-line.ts), [`owner.ts`](../src/owner.ts), [`qr.ts`](../src/qr.ts)
+2 -2
View File
@@ -1903,7 +1903,7 @@ sequenceDiagram
K->>F: read subagents/agent-ID.meta.json
K->>D: POST /turn agent.start {type, description, toolUse, transcript}
D->>N: turn
N->>G: live 🤖 TYPE · DESCRIPTION, priority -1
N->>G: live !- 🤖 TYPE · DESCRIPTION!, priority -1
loop each tool use of A
A->>K: PreToolUse, PostToolUse with agent_id
K->>D: POST /turn agent.step
@@ -1921,7 +1921,7 @@ sequenceDiagram
N->>G: edit with the figures; the note not posted
L->>K: PostToolUse Workflow {runId, workflowName, transcriptDir}
K->>D: POST /turn workflow
N->>G: live ⚙️ NAME
N->>G: live !- ⚙️ NAME!
loop every 2 s
N->>F: journal.jsonl appended lines; tokens of its working agents
N->>G: edit phases, working agents, tokens, time
+9 -4
View File
@@ -174,13 +174,13 @@ function agentText(agent: Agent, now: number): string {
const {end} = agent
if (end !== undefined) {
const figures = [`${statusEmoji[end.status]} ${clock(end.ms ?? end.at - agent.startedAt)}`, stepsText(end.steps ?? agent.steps), tokensText(end.tokens ?? agent.tokens)]
return [[title, ...figures].filter(part => part !== undefined).join(" · "), agent.result].filter(line => line !== undefined).join("\n")
return [[title, ...figures].filter(part => part !== undefined).join(" · "), agent.result].filter(line => line !== undefined).map(small).join("\n")
}
const stalled = stalledFor(agent, now)
const open = [...agent.open.values()].at(-1)
const activity = stalled !== undefined ? [`⚠️ no step for ${clock(fiveSeconds(stalled))}`, last(agent)] : open !== undefined ? [`now: ${open}`] : [last(agent)]
const line = [stepsText(agent.steps), tokensText(agent.tokens), clock(fiveSeconds(now - agent.startedAt)), ...activity].filter(part => part !== undefined).join(" · ")
return `${title}\n${line}`
return `${small(title)}\n${small(line)}`
}
// spec: spec/architecture.md#agents-agenttext
@@ -195,9 +195,9 @@ function workflowText(workflow: Workflow, now: number): string {
})
const tokens = tokensText(workflow.tokens.size === 0 ? undefined : [...workflow.tokens.values()].reduce((sum, count) => sum + count, 0))
const {end} = workflow
if (end !== undefined) return [`⚙️ ${workflow.name}`, `${statusEmoji[end.status]} ${clock(end.at - workflow.startedAt)}`, ...phases, tokens].filter(part => part !== undefined).join(" · ")
if (end !== undefined) return small([`⚙️ ${workflow.name}`, `${statusEmoji[end.status]} ${clock(end.at - workflow.startedAt)}`, ...phases, tokens].filter(part => part !== undefined).join(" · "))
const working = entries.filter(({state}) => state === "started").length
return [`⚙️ ${workflow.name}`, ...phases, working === 0 ? undefined : `${working} working`, tokens, clock(fiveSeconds(now - workflow.startedAt))].filter(part => part !== undefined).join(" · ")
return small([`⚙️ ${workflow.name}`, ...phases, working === 0 ? undefined : `${working} working`, tokens, clock(fiveSeconds(now - workflow.startedAt))].filter(part => part !== undefined).join(" · "))
}
// spec: spec/architecture.md#agents-agentsline
@@ -234,6 +234,11 @@ function stepsText(steps: number): string {
return `${steps} step${steps === 1 ? "" : "s"}`
}
// spec: spec/architecture.md#agents-agenttext
function small(text: string): string {
return `!- ${text.replaceAll("!", "ǃ")}!`
}
// spec: spec/architecture.md#agents-agenttext
export function tokensText(tokens: number | undefined): string | undefined {
if (tokens === undefined) return undefined
@@ -271,12 +271,13 @@ test("the Main group shows a message of each running session with its state from
writeFileSync(record, JSON.stringify({status: "idle"}))
await client.request("POST", "/turn", {id: one, answer: ""})
await idle
const agentPosted = received(alice.chat, ({chatItem}) => chatItem.meta.itemText === "🤖 Explore · find callers\n0 steps · 0:00")
const agentPosted = received(alice.chat, ({chatItem}) => chatItem.meta.itemText === "!- 🤖 Explore · find callers!\n!- 0 steps · 0:00!")
const agentLine = edited(message, "🔴 1 · one: idle\n🤖 1 agent working")
await client.request("POST", "/turn", {id: one, agent: {id: "a1", start: {type: "Explore", description: "find callers", transcript: join(dir, "list", "agent-a1.jsonl")}}})
const agentItem = await agentPosted
expect(agentItem.chatItem.formattedText).toEqual([{format: {type: "small"}, text: "🤖 Explore · find callers"}, {text: "\n"}, {format: {type: "small"}, text: "0 steps · 0:00"}])
await agentLine
const agentEnded = updated(alice.chat, ({chatItem}) => chatItem.meta.itemId === agentItem.chatItem.meta.itemId && chatItem.meta.itemText.startsWith("🤖 Explore · find callers · ✅ ") && chatItem.meta.itemText.endsWith("\nFound 6 callers."))
const agentEnded = updated(alice.chat, ({chatItem}) => chatItem.meta.itemId === agentItem.chatItem.meta.itemId && chatItem.meta.itemText.startsWith("!- 🤖 Explore · find callers · ✅ ") && chatItem.meta.itemText.endsWith("!\n!- Found 6 callers.!"))
await client.request("POST", "/turn", {id: one, agent: {id: "a1", stop: "Found 6 callers."}})
await agentEnded
const ended = Promise.all([edited(message, "⚪ 1 · one: stopped"), edited(summary, "1 session ⚪")])
@@ -9,7 +9,7 @@ describe("agents", () => {
const agent = agents.start("a1", start, 0)
agents.step("a1", {id: "s1", text: "📖 Read SuspendChat.swift"}, 1_000)
agent.tokens = 38_200
expect(cardText(agent, 67_000)).toBe("🤖 Explore · find the suspend callers\n1 step · 38.2k tokens · 1:05 · now: 📖 Read SuspendChat.swift")
expect(cardText(agent, 67_000)).toBe("!- 🤖 Explore · find the suspend callers!\n!- 1 step · 38.2k tokens · 1:05 · now: 📖 Read SuspendChat.swift!")
})
it("shows an agent stalled 2 minutes after its last step ended, and 10 minutes while a step runs", () => {
@@ -18,16 +18,16 @@ describe("agents", () => {
agents.step("a1", {id: "s1", text: "💻 cabal build"}, 0)
const running = cardText(agent, 590_000)
agents.step("a1", {id: "s1", text: "💻 cabal build", end: true}, 600_000)
expect([running, cardText(agent, 730_000)]).toEqual(["🤖 Explore · find the suspend callers\n1 step · 9:50 · now: 💻 cabal build", "🤖 Explore · find the suspend callers\n1 step · 12:10 · ⚠️ no step for 2:10 · last: 💻 cabal build"])
expect([running, cardText(agent, 730_000)]).toEqual(["!- 🤖 Explore · find the suspend callers!\n!- 1 step · 9:50 · now: 💻 cabal build!", "!- 🤖 Explore · find the suspend callers!\n!- 1 step · 12:10 · ⚠️ no step for 2:10 · last: 💻 cabal build!"])
})
it("shows an ended agent with its status, time, steps and tokens of its task, and its report", () => {
it("shows an ended agent with its status, time, steps and tokens of its task, and its report with ǃ for each !", () => {
const agents = new Agents()
const agent = agents.start("a1", start, 0)
agents.report("a1", "Found 6 callers.")
agents.report("a1", "Found 6 callers!")
agents.stop("a1", "Done.", 160_000)
agents.task({toolUse: "toolu_1", status: "completed", tokens: 61_500, steps: 22, ms: 160_000}, 161_000)
expect(cardText(agent, 200_000)).toBe("🤖 Explore · find the suspend callers · ✅ 2:40 · 22 steps · 61.5k tokens\nFound 6 callers.")
expect(cardText(agent, 200_000)).toBe("!- 🤖 Explore · find the suspend callers · ✅ 2:40 · 22 steps · 61.5k tokens!\n!- Found 6 callersǃ!")
})
it("shows a workflow's phases in order of their first agent, done ones marked, its working agents, tokens and time", () => {
@@ -35,7 +35,7 @@ describe("agents", () => {
const workflow = agents.workflow({toolUse: "toolu_2", run: "wf_1", name: "review-changes", folder: "/t/wf_1"}, 0)
applyJournal(workflow, journal([{type: "launched"}, {type: "started", key: "k1", agentId: "b1", phase: "Review"}, {type: "result", key: "k1", agentId: "b1"}, {type: "started", key: "k2", agentId: "b2", phase: "Verify"}, {type: "started", key: "k3", agentId: "b3", phase: "Verify"}]))
workflow.tokens.set("b1", 400_000).set("b2", 12_000)
expect(cardText(workflow, 390_000)).toBe("⚙️ review-changes · Review 1/1 ✅ · Verify 0/2 · 2 working · 412k tokens · 6:30")
expect(cardText(workflow, 390_000)).toBe("!- ⚙️ review-changes · Review 1/1 ✅ · Verify 0/2 · 2 working · 412k tokens · 6:30!")
})
it("counts working agents, the agents of workflows and stalled agents, with the longest stall and each workflow's phase", () => {
@@ -2976,11 +2976,11 @@ describe("Main group", () => {
const hub = await hubWith(chat)
const session = await openSession(hub, id1, stored(1, "one"))
await session.turn({id: id1, agent: {id: "a1", start: {type: "Explore", description: "find callers", toolUse: "toolu_1", transcript: join(root, "agent-a1.jsonl")}}})
expect(chat.sent.at(-1)).toMatchObject({chat: [T.ChatType.Group, 20], live: true, messages: [{msgContent: {text: "🤖 Explore · find callers\n0 steps · 0:00"}, priority: -1}]})
expect(chat.sent.at(-1)).toMatchObject({chat: [T.ChatType.Group, 20], live: true, messages: [{msgContent: {text: "!- 🤖 Explore · find callers!\n!- 0 steps · 0:00!"}, priority: -1}]})
await session.turn({id: id1, agent: {id: "a1", stop: "Found 6 callers."}})
await session.turn({id: id1, prompt: "<task-notification>…</task-notification>", typed: false, note: "!- ✅ Agent finished!", task: {toolUse: "toolu_1", status: "completed", tokens: 61_500, steps: 22, ms: 160_000}})
await until(() => chat.updates.length === 2)
expect([chat.updates, sentTo(chat, 20).filter(text => text.includes("finished"))]).toEqual([[{chatId: 20, itemId: chat.nextItemId - 1, text: "🤖 Explore · find callers · ✅ 0:00 · 0 steps\nFound 6 callers."}, {chatId: 20, itemId: chat.nextItemId - 1, text: "🤖 Explore · find callers · ✅ 2:40 · 22 steps · 61.5k tokens\nFound 6 callers."}], []])
expect([chat.updates, sentTo(chat, 20).filter(text => text.includes("finished"))]).toEqual([[{chatId: 20, itemId: chat.nextItemId - 1, text: "!- 🤖 Explore · find callers · ✅ 0:00 · 0 steps!\n!- Found 6 callers.!"}, {chatId: 20, itemId: chat.nextItemId - 1, text: "!- 🤖 Explore · find callers · ✅ 2:40 · 22 steps · 61.5k tokens!\n!- Found 6 callers.!"}], []])
})
it("shows the working subagents in the session's board message, and ends their live messages with ⏹️ at the last detach", async () => {
@@ -2992,7 +2992,7 @@ describe("Main group", () => {
await hub.showSessions()
expect(sentTo(chat, 10).at(-2)).toBe("▶️ 1 · one: running\n🤖 1 agent working")
await session.endLive()
expect(chat.updates.at(-1)).toMatchObject({chatId: 20, text: "🤖 Explore · find callers · ⏹️ 0:00 · 0 steps"})
expect(chat.updates.at(-1)).toMatchObject({chatId: 20, text: "!- 🤖 Explore · find callers · ⏹️ 0:00 · 0 steps!"})
})
it("updates the descriptions of a session's group at most once a minute, with the latest values", async () => {