fix(app): never count subagents in the new timeline (#64017)

This commit is contained in:
Dax
2026-11-14 22:49:38 -05:00
committed by GitHub
Unverified
parent 38bd73789a
commit 0cfe2c2610
12 changed files with 209 additions and 119 deletions
@@ -4,11 +4,10 @@ import { For, Show, createMemo } from "solid-js"
import { BasicTool } from "../components/basic-tool"
import { useData } from "../context/data"
import { taskAgentName } from "../tools/tool-renderer"
import { kindKeys, summarizeEvents, verbKeys, type TimelineEvent } from "./events"
import { summarizeShells, verbKeys, type TimelineEvent } from "./events"
/**
* A run of subagent and background shell events, read like a group label: "Started 2 subagents · Finished 1 shell".
* Opening it lists each one; a subagent opens its session, and a shell jumps to the call that ran it.
* A run of background shells. Opening its summary lists each command and links back to its call.
*/
export function TimelineEventRow(props: {
events: readonly TimelineEvent[]
@@ -17,7 +16,7 @@ export function TimelineEventRow(props: {
onRevealShell?: (shellID: string) => void
}) {
const i18n = useI18n()
const summary = createMemo(() => summarizeEvents(props.events))
const summary = createMemo(() => summarizeShells(props.events))
const items = createMemo(() => props.events.filter((event) => event.title))
return (
@@ -40,7 +39,7 @@ export function TimelineEventRow(props: {
</Show>
<span data-slot="context-tool-group-verb">{i18n.t(verbKeys[bucket.verb])}</span>
<span data-slot="context-tool-group-detail">
{bucket.kinds.map((item) => i18n.plural(kindKeys[item.kind], item.count)).join(", ")}
{i18n.plural("ui.timeline.event.shells", bucket.count)}
</span>
</>
)}
@@ -75,10 +74,12 @@ export function TimelineEventItem(props: { event: TimelineEvent; onRevealShell?:
const i18n = useI18n()
const data = useData()
const name = () =>
props.event.kind === "shell"
? i18n.t("ui.tool.shell")
: (taskAgentName(props.event.agent, data.store.agent) ?? i18n.t("ui.tool.agent.default"))
const name = () => {
if (props.event.kind === "shell") return i18n.t("ui.tool.shell")
const agent = taskAgentName(props.event.agent, data.store.agent)
return agent ? i18n.t("ui.timeline.subagent.name", { name: agent }) : i18n.t("ui.tool.agent.default")
}
const href = () => (props.event.sessionID ? data.sessionHref?.(props.event.sessionID) : undefined)
@@ -92,17 +93,29 @@ export function TimelineEventItem(props: { event: TimelineEvent; onRevealShell?:
const clickable = () => !!((props.event.sessionID && (data.navigateToSession || href())) || props.event.shellID)
const status = () => {
if (props.event.failed) return i18n.t("ui.toolErrorCard.failed")
if (props.event.verb === "updated") return i18n.t("ui.timeline.subagent.updated")
if (props.event.verb === "ran" || props.event.verb === "finished") return i18n.t("ui.timeline.subagent.completed")
return i18n.t(verbKeys[props.event.verb])
}
return (
<a
data-slot="timeline-event-item"
data-kind={props.event.kind}
href={href()}
role={clickable() && !href() ? "button" : undefined}
role={clickable() && !href() ? (props.event.kind === "subagent" ? "link" : "button") : undefined}
tabIndex={clickable() ? 0 : undefined}
aria-disabled={clickable() ? undefined : "true"}
onClick={(event) => {
if (event.button !== 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return
if (href() && !data.navigateToSession) return
if (!clickable()) return
event.preventDefault()
open()
@@ -113,9 +126,23 @@ export function TimelineEventItem(props: { event: TimelineEvent; onRevealShell?:
open()
}}
>
<span data-slot="timeline-event-item-name">{name()}</span>
<span data-slot="timeline-event-item-title">{props.event.title}</span>
<Show when={props.event.failed}>
<Show
when={props.event.kind === "subagent"}
fallback={<span data-slot="timeline-event-item-name">{name()}</span>}
>
<Badge data-slot="timeline-event-item-name" variant="neutral">
{name()}
</Badge>
</Show>
<Show when={props.event.title}>
<bdi dir="auto" data-slot="timeline-event-item-title">
{props.event.title}
</bdi>
</Show>
<Show when={props.event.kind === "subagent"}>
<span class={props.event.failed ? "text-v2-state-fg-danger" : "text-v2-text-text-muted"}>{status()}</span>
</Show>
<Show when={props.event.failed && props.event.kind === "shell"}>
<Badge variant="danger">{i18n.t("ui.toolErrorCard.failed")}</Badge>
</Show>
</a>
+23 -39
View File
@@ -3,16 +3,12 @@ import { Option, Schema } from "effect"
import { currentToolInput, currentToolMetadata } from "../message/current-tool-state"
import { toolRule } from "./rules"
/**
* Subagents and background shells read as events rather than tool rows: started, ran, finished and stopped, counted by
* kind. Titles and commands stay in the background panel above the composer.
*/
export type TimelineEventKind = "subagent" | "shell"
export type TimelineEventVerb = "started" | "ran" | "finished" | "stopped"
export type TimelineEvent = {
verb: TimelineEventVerb
verb: TimelineEventVerb | "updated"
kind: TimelineEventKind
failed: boolean
/** What opening the row lists: a subagent's task or a shell's command, and where each leads. */
@@ -22,7 +18,7 @@ export type TimelineEvent = {
shellID?: string
}
/** How an events row names each verb and kind: "Started 2 subagents". */
/** Status labels shared by task rows and shell summaries. */
export const verbKeys = {
started: "ui.timeline.event.started",
ran: "ui.timeline.activity.ran",
@@ -30,17 +26,12 @@ export const verbKeys = {
stopped: "ui.timeline.event.stopped",
} as const
export const kindKeys = {
subagent: "ui.timeline.event.subagents",
shell: "ui.timeline.event.shells",
} as const
/** How a group's label counts work that runs on, beside its other calls: "1 command, started 1 shell". */
export const launchKeys = {
started: { shell: "ui.timeline.activity.startedShells", subagent: "ui.timeline.activity.startedSubagents" },
ran: { shell: "ui.timeline.activity.commands", subagent: "ui.timeline.activity.subagents" },
finished: { shell: "ui.timeline.activity.finishedShells", subagent: "ui.timeline.activity.finishedSubagents" },
stopped: { shell: "ui.timeline.activity.stoppedShells", subagent: "ui.timeline.activity.stoppedSubagents" },
started: "ui.timeline.activity.startedShells",
ran: "ui.timeline.activity.commands",
finished: "ui.timeline.activity.finishedShells",
stopped: "ui.timeline.activity.stoppedShells",
} as const
// Text a call or notice carries, where it is not empty.
@@ -57,16 +48,17 @@ export function toolEvent(tool: SessionMessageAssistantTool): TimelineEvent | un
if (state.status === "streaming") return undefined
const input = currentToolInput(tool)
const metadata = currentToolMetadata(tool)
const followUp = kind === "subagent" ? Option.getOrUndefined(decodeText(input.sessionID)) : undefined
const item = {
kind,
title: Option.getOrUndefined(decodeText(kind === "shell" ? input.command : input.description)),
agent: kind === "subagent" ? Option.getOrUndefined(decodeText(input.agent)) : undefined,
sessionID: kind === "subagent" ? Option.getOrUndefined(decodeText(metadata.sessionID)) : undefined,
agent: kind === "subagent" ? Option.getOrUndefined(decodeText(input.agent ?? input.subagent_type)) : undefined,
sessionID: kind === "subagent" ? (Option.getOrUndefined(decodeText(metadata.sessionID)) ?? followUp) : undefined,
shellID: kind === "shell" ? Option.getOrUndefined(decodeText(metadata.shellID)) : undefined,
} as const
if (state.status === "running") return { ...item, verb: "started", failed: false }
if (state.status === "running") return { ...item, verb: followUp ? "updated" : "started", failed: false }
const background =
kind === "subagent" ? metadata.status !== "completed" : metadata.status === "running" || input.background === true
@@ -77,6 +69,8 @@ export function toolEvent(tool: SessionMessageAssistantTool): TimelineEvent | un
return { ...item, verb: background ? "started" : "ran", failed: true }
}
if (followUp) return { ...item, verb: "updated", failed: false }
return { ...item, verb: background ? "started" : "ran", failed: false }
}
@@ -108,26 +102,16 @@ export function workKey(event: TimelineEvent) {
return id ? `${event.kind}:${id}` : undefined
}
/**
* A run of events as one label: each verb once, in the order it first happened, with how many of each kind, and how
* many failed overall. Two finishes in a row read "Finished 2 subagents".
*/
export function summarizeEvents(events: readonly TimelineEvent[]) {
const verbs = events.reduce<{ verb: TimelineEventVerb; kinds: { kind: TimelineEventKind; count: number }[] }[]>(
(result, event) => {
const bucket = result.find((item) => item.verb === event.verb) ?? { verb: event.verb, kinds: [] }
/** Count background shells by verb in the order they happened. Subagents have individual task rows. */
export function summarizeShells(events: readonly TimelineEvent[]) {
const counts = new Map<TimelineEventVerb, number>()
const shells = events.filter((event) => event.kind === "shell")
shells.forEach(({ verb }) => {
if (verb !== "updated") counts.set(verb, (counts.get(verb) ?? 0) + 1)
})
if (!result.includes(bucket)) result.push(bucket)
const kind = bucket.kinds.find((item) => item.kind === event.kind)
if (kind) kind.count += 1
if (!kind) bucket.kinds.push({ kind: event.kind, count: 1 })
return result
},
[],
)
return { verbs, failed: events.filter((event) => event.failed).length }
return {
verbs: Array.from(counts, ([verb, count]) => ({ verb, count })),
failed: shells.filter((event) => event.failed).length,
}
}
@@ -150,7 +150,7 @@ describe("New timeline projection", () => {
])
})
test("a subagent finishes in the group that started it only when nothing comes between; otherwise it reports in its own row", () => {
test("each subagent event stays in order in both visible placements, even without a title or visible launch", () => {
const launched: SessionMessageInfo[] = [
{ id: "user", type: "user", text: "Go", time: { created: 0 } },
step("launch", 1, {
@@ -195,13 +195,15 @@ describe("New timeline projection", () => {
timelineDetail: () => detail,
})
const result = projection
.rows()
.flatMap((row) =>
Predicate.isTagged(row, "AssistantPart") && row.group.type !== "part"
? [`${row.group.type}:${row.group.refs.map((ref) => ref.messageID).join("+")}`]
: [],
)
const result = projection.rows().flatMap((row) => {
if (Predicate.isTagged(row, "Notice")) return [`notice:${row.messageID}`]
if (!Predicate.isTagged(row, "AssistantPart")) return []
if (row.group.type === "part") return [`part:${row.group.ref.messageID}`]
return [`${row.group.type}:${row.group.refs.map((ref) => ref.messageID).join("+")}`]
})
dispose()
@@ -210,9 +212,20 @@ describe("New timeline projection", () => {
const grouped = { ...detailed, subagents: { placement: "grouped" as const } }
expect(groups([...launched, report], grouped)).toEqual(["context:launch+report"])
expect(groups([...launched, said, report], grouped)).toEqual(["context:launch", "events:report"])
expect(groups([...launched, report], detailed)).toEqual(["events:launch", "events:report"])
for (const detail of [grouped, detailed]) {
expect(groups([...launched, report], detail)).toEqual(["subagent:launch", "subagent:report"])
expect(groups([...launched, said, report], detail)).toEqual(["subagent:launch", "part:said", "subagent:report"])
expect(groups([launched[0]!, report], detail)).toEqual(["subagent:report"])
if (report.type !== "synthetic") throw new Error("Expected a subagent report")
expect(groups([...launched, report, { ...report, id: "untitled", description: undefined }], detail)).toEqual([
"subagent:launch",
"subagent:report",
"subagent:untitled",
])
}
expect(groups([...launched, report], messagesOnly)).toEqual([])
})
test("a move shows only when it changes where the session is", () => {
@@ -639,9 +639,8 @@ function turnCommentary(entries: Entry[], settled: boolean, visible: (content: C
}
/**
* Notices fold into the rows around them: grouped notices join the activity group, and background work reporting back
* one after another reads as one events row, "Finished 2 subagents". Anything else between them keeps them apart, so
* the order of events stays true.
* Grouped notices join the activity group, shell reports can share an events row, and each subagent report keeps
* its own place in the timeline.
*/
function groupNotices(
rows: TimelineRow.TimelineRow[],
@@ -657,7 +656,8 @@ function groupNotices(
// Work that reports back right after the activity group that started it, with nothing between, finishes there.
if (
event &&
message &&
event?.kind === "shell" &&
!event.failed &&
Predicate.isTagged(previous, "AssistantPart") &&
previous.group.type === "context" &&
@@ -672,7 +672,7 @@ function groupNotices(
return result
}
const type = message ? noticeGroup(detail, message) : undefined
const type = message ? noticeGroup(detail, message, event) : undefined
const current =
Predicate.isTagged(row, "Notice") && type
@@ -750,8 +750,8 @@ function launches(
)
}
function noticeGroup(detail: TimelineDetail, message: SessionMessageInfo) {
if (noticeEvent(message)) return "events" as const
function noticeGroup(detail: TimelineDetail, message: SessionMessageInfo, event?: TimelineEvent) {
if (event) return event.kind === "subagent" ? ("subagent" as const) : ("events" as const)
return noticePlacement(detail, message) === "grouped" ? ("context" as const) : undefined
}
@@ -929,6 +929,17 @@ function groupContent(
items.forEach((item) => {
const type = contentGroup(detail, item.content, commentary)
if (type === "subagent") {
flush()
groups.push({
type,
key: `subagent:${item.messageID}:${item.partID}`,
refs: [{ messageID: item.messageID, partID: item.partID }],
})
return
}
if (type) {
if (adjacent?.type !== type) flush()
adjacent ??= { type, refs: [] }
@@ -955,5 +966,5 @@ function isNotice(message: SessionMessageInfo): message is Notice {
if (message.type !== "synthetic") return true
return !!message.description?.trim() || timelineNoticeRequired(message)
return message.metadata?.source === "subagent" || !!message.description?.trim() || timelineNoticeRequired(message)
}
+15 -3
View File
@@ -49,7 +49,7 @@ import { Badge } from "@opencode/ui/badge"
import { attached } from "../components/message-file"
import { CompactionMessage, CompactionQueued } from "./compaction"
import { unwrapErrorMessage } from "./errors"
import { TimelineEventRow } from "./event-row"
import { TimelineEventItem, TimelineEventRow } from "./event-row"
import { noticeEvent, toolEvent } from "./events"
import { trackNestedRails } from "./nested-rail"
import { contentEntries, createNextTimelineProjection, resolveContent, workedDuration } from "./projection"
@@ -413,11 +413,11 @@ export function createNextTimelineRowRenderer(input: {
)
}
if (row().group.type === "events") {
if (row().group.type === "events" || row().group.type === "subagent") {
const events = createMemo(() => {
const group = row().group
if (group.type !== "events") return []
if (group.type !== "events" && group.type !== "subagent") return []
const contents = indexGroupContents(group.refs)
// A call starts the work; a notice under its message's own ID reports it back.
@@ -436,6 +436,18 @@ export function createNextTimelineRowRenderer(input: {
})
})
if (row().group.type === "subagent") {
return (
<Show when={events()[0]}>
{(event) => (
<div data-component="timeline-subagent">
<TimelineEventItem event={event()} />
</div>
)}
</Show>
)
}
return (
<TimelineEventRow
events={events()}
@@ -72,6 +72,15 @@ describe("starting work that runs on follows its own setting", () => {
expect(contentGroup(preset("everything"), backgroundShell, new Set())).toBe("events")
})
test("prompting an existing child produces an update linked to that session", () => {
expect(toolEvent(tool("subagent", { sessionID: "child", agent: "explore" }))).toMatchObject({
verb: "updated",
agent: "explore",
sessionID: "child",
title: undefined,
})
})
test("a launch that failed keeps its own row, whatever the setting", () => {
const failed = errored(
"shell",
@@ -82,9 +91,9 @@ describe("starting work that runs on follows its own setting", () => {
expect(contentGroup(preset("compact"), failed, new Set())).toBe("events")
})
test("a subagent follows the subagent setting, not the tools or shell one", () => {
expect(contentGroup(preset("compact"), tool("subagent"), new Set())).toBe("events")
expect(contentGroup(custom({ subagents: { placement: "grouped" } }), tool("subagent"), new Set())).toBe("context")
test.each(["subagent", "task"])("%s has its own row in both visible placements", (name) => {
expect(contentGroup(preset("compact"), tool(name), new Set())).toBe("subagent")
expect(contentGroup(custom({ subagents: { placement: "grouped" } }), tool(name), new Set())).toBe("subagent")
})
test("a background shell's report follows the shell setting", () => {
@@ -19,8 +19,7 @@ export type ToolMode = "explore" | "edit" | "run" | "tool"
* How a call shows when it stands on its own:
* - `line`: one line of activity, a command's included: commands run long, so its row cuts the command to a line.
* - `file`: a file's name and changes, opening to its whole diff.
* - `event`: work that runs on: a subagent, or a shell started in the background. Grouped, starting it is counted in
* the group's label; on its own, it is counted with others like it: Started 2 subagents.
* - `event`: a subagent task or a shell started in the background.
*/
export type ToolLayout = "line" | "file" | "event"
@@ -122,7 +121,8 @@ export function textShows(content: Exclude<Content, { type: "tool" }>) {
/**
* The group a part folds into with its neighbours, or none when it stands on its own:
* - `events`: subagents and background shells, counted in one row.
* - `subagent`: a single event about a task.
* - `events`: background shells counted in one row.
* - `context`: the activity group, where the part's category is grouped.
* - `read`: files read one after another, where reads stand on their own.
* - `file`: a file's changes, as a card.
@@ -133,6 +133,8 @@ export function contentGroup(detail: TimelineDetail, content: Content, commentar
if (content.type === "reasoning") return detail.thinking.placement === "grouped" ? ("context" as const) : undefined
const rule = toolRule(content)
if (rule.category === "subagents") return "subagent" as const
// Starting work that runs on is an action like any other, so it joins the activity group where its setting groups
// it. A launch that failed keeps its own row, as failures do.
if (rule.layout === "event")
@@ -662,6 +662,17 @@ const backgroundWork: Beat[] = [
output: "The subagent is working in the background.",
metadata: { sessionID: "session_child_docs", status: "running" },
},
{
kind: "tool",
name: "subagent",
input: {
sessionID: "session_child_docs",
agent: "explore",
description: "Check the migration guide",
prompt: "Include the migration guide in your review.",
},
metadata: { sessionID: "session_child_docs", status: "running" },
},
{
kind: "tool",
name: "shell",
@@ -783,10 +794,30 @@ const encryptedThinking: Beat[] = [
{ kind: "idle" },
]
const subagentBetweenTools: Beat[] = [
{ kind: "user", text: "Check the theme store, ask for a review, then run its tests." },
{ kind: "tool", name: "read", input: { path: "/workspace/src/theme/scheme.ts" }, output: schemeBefore },
{
kind: "tool",
name: "subagent",
input: { agent: "review", description: "Review the theme store", prompt: "Review it." },
metadata: { sessionID: "session_child_store", status: "running" },
},
{
kind: "tool",
name: "shell",
input: { command: "bun test src/theme", description: "Run the theme tests" },
output: "4 pass, 0 fail",
},
{ kind: "say", text: "The theme tests pass. The store review is running." },
{ kind: "idle" },
]
export const scenarios = {
"Feature work": featureWork,
"Every tool": everyTool,
"Background work": backgroundWork,
"Subagent between tools": subagentBetweenTools,
"Thinking only": thinkingOnly,
"Thinking after tools": thinkingAfterTools,
"Encrypted thinking": encryptedThinking,
@@ -237,7 +237,12 @@
padding-top: 4px;
}
[data-timeline="next"] :is([data-component="timeline-event-list"], [data-slot="context-tool-group-item"]) {
[data-timeline="next"]
:is(
[data-component="timeline-event-list"],
[data-slot="context-tool-group-item"],
[data-component="timeline-subagent"]
) {
[data-slot="timeline-event-item"] {
display: flex;
align-items: center;
@@ -314,6 +319,25 @@
padding above and below, taken back by margins of the same size, so neighbouring click areas meet without overlapping.
An open row's header ends the small gap above its first nested row. */
[data-timeline="next"] {
[data-component="timeline-subagent"] {
display: grid;
> [data-slot="timeline-event-item"] {
gap: 8px;
margin-inline: -6px;
padding-inline: 6px;
border-radius: var(--radius-sm);
@media (hover: hover) {
&:hover:not([aria-disabled]) {
cursor: pointer;
background-color: var(--v2-overlay-simple-overlay-hover);
}
}
}
}
[data-component="timeline-subagent"] > [data-slot="timeline-event-item"],
[data-component="collapsible"].tool-collapsible > [data-slot="collapsible-trigger"],
[data-component="card"][data-kind="tool-error-card"]
> [data-component="collapsible"]
@@ -25,7 +25,7 @@ import {
type ContextGroupPart,
} from "../../tools/tool-renderer"
import { TimelineEventRow } from "../event-row"
import { kindKeys, launchKeys, summarizeEvents, toolEvent, verbKeys, workKey, type TimelineEvent } from "../events"
import { launchKeys, summarizeShells, toolEvent, verbKeys, workKey, type TimelineEvent } from "../events"
import { toolRule, toolStopped, type ToolMode } from "../rules"
import { FileGroup } from "./file-group"
import { ThoughtRow } from "./thought"
@@ -64,13 +64,7 @@ export function ContextGroup(props: {
const thoughtsOnly = createMemo(() => reasoning().length > 0 && reasoning().length === props.parts.length)
const events = createMemo(() => [...workEvents(props.parts).values()])
// A group of only subagents and work reporting back reads as the events row it is, not a group around one. Until a
// call has anything to count, it stays a group, so the row never renders empty.
const workOnly = createMemo(
() =>
events().length > 0 &&
props.parts.every((part) => part.type === "event" || (part.type === "tool" && toolRule(part).name === "subagent")),
)
const workOnly = createMemo(() => events().length > 0 && props.parts.every((part) => part.type === "event"))
const activity = createMemo(() => activityLabel(tools(), events(), i18n))
@@ -95,25 +89,9 @@ export function ContextGroup(props: {
>((groups, tool) => {
const previous = groups.at(-1)
// Subagents started one after another, and work reporting back, read as one events row nested in the group:
// "Started 3 subagents". The rows keep the order things happened in, which the label does not.
if (tool.type === "event" || (tool.type === "tool" && toolRule(tool).name === "subagent")) {
// A subagent still being asked for has nothing to list yet.
const event = tool.type === "event" ? tool.event : toolEvent(tool)
if (!event) return groups
if (tool.type === "event") {
const event = tool.event
const run = previous && !Array.isArray(previous) && previous.type === "work" ? previous : undefined
const key = tool.type === "event" ? workKey(event) : undefined
// Work reporting back right after its launch, with nothing between, finishes the launch's row. With
// anything between, the launch and the report each keep their row.
const launch = key && run ? run.events.findIndex((item) => item.verb === "started" && workKey(item) === key) : -1
if (run && launch >= 0) {
run.events[launch] = { ...run.events[launch]!, verb: event.verb, failed: event.failed }
return groups
}
if (run) {
run.events.push(event)
@@ -544,7 +522,7 @@ function usedLabel(parts: ActivityGroupPart[], i18n: UiI18n) {
}
/**
* What each subagent or background shell in a group did, for its label. Work that reports back anywhere in the group
* What each background shell in a group did, for its label. Work that reports back anywhere in the group
* that started it is counted once, as how it ended: "Finished", not "Started" and "Finished".
*/
function workEvents(parts: ActivityGroupPart[]) {
@@ -603,16 +581,12 @@ const decodeChangedPath = Schema.decodeUnknownOption(Schema.Struct({ file: Schem
/**
* Names a stretch of the agent's work by its main mode, then what its other calls did: "Edited 4 files · 2 commands,
* started 1 shell". Work that runs on is counted by what happened to it, not among the calls that started it; a
* stretch of only that reads like an events row: "Started 2 subagents · finished 2 subagents".
* started 1 shell". A background shell is counted once by its outcome.
*/
function activityLabel(group: SessionMessageAssistantTool[], events: TimelineEvent[], i18n: UiI18n) {
const tools = group.filter((tool) => toolRule(tool).layout !== "event")
const launches = summarizeEvents(events).verbs
const launched = launches.flatMap((bucket) =>
bucket.kinds.map((item) => i18n.plural(launchKeys[bucket.verb][item.kind], item.count)),
)
const launches = summarizeShells(events).verbs
const launched = launches.map((bucket) => i18n.plural(launchKeys[bucket.verb], bucket.count))
const modes = new Set(tools.map((tool) => toolRule(tool).mode))
const mode = modePriority.find((item) => modes.has(item))
@@ -624,8 +598,8 @@ function activityLabel(group: SessionMessageAssistantTool[], events: TimelineEve
return {
verb: i18n.t(verbKeys[first.verb]),
main: first.kinds.map((item) => i18n.plural(kindKeys[item.kind], item.count)).join(", "),
others: rest.length ? launched.slice(first.kinds.length) : [],
main: i18n.plural("ui.timeline.event.shells", first.count),
others: rest.map((bucket) => i18n.plural(launchKeys[bucket.verb], bucket.count)),
}
}
@@ -18,8 +18,8 @@ export type PartGroup =
}
| {
key: string
/** `events`: subagents and background shells counted in one row, in the New timeline. */
type: "file" | "read" | "events"
/** A subagent row holds one call or report; events count background shells. */
type: "file" | "read" | "events" | "subagent"
refs: PartRef[]
}
+3
View File
@@ -190,6 +190,9 @@ const source = {
"ui.timeline.activity.stoppedSubagents.other": "stopped {{count}} subagents",
"ui.timeline.event.started": "Started",
"ui.timeline.event.finished": "Finished",
"ui.timeline.subagent.name": "{{name}} Agent",
"ui.timeline.subagent.updated": "Updated",
"ui.timeline.subagent.completed": "Completed",
"ui.timeline.event.stopped": "Stopped",
"ui.timeline.event.subagents.one": "{{count}} subagent",
"ui.timeline.event.subagents.other": "{{count}} subagents",