-
Notifications
You must be signed in to change notification settings - Fork 11.6k
feat(tui): add Subagents section to session sidebar #15738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,7 @@ export function Sidebar(props: { sessionID: string; overlay?: boolean }) { | |||||
| diff: true, | ||||||
| todo: true, | ||||||
| lsp: true, | ||||||
| subagents: true, | ||||||
| }) | ||||||
|
|
||||||
| // Sort MCP servers alphabetically for consistent display order | ||||||
|
|
@@ -63,6 +64,13 @@ export function Sidebar(props: { sessionID: string; overlay?: boolean }) { | |||||
| const directory = useDirectory() | ||||||
| const kv = useKV() | ||||||
|
|
||||||
| const subagents = createMemo(() => | ||||||
| sync.data.session | ||||||
| .filter((x) => x.parentID === props.sessionID) | ||||||
| .map((x) => x.id) | ||||||
| .toSorted((a, b) => (a < b ? -1 : a > b ? 1 : 0)), | ||||||
| ) | ||||||
|
|
||||||
| const hasProviders = createMemo(() => | ||||||
| sync.data.provider.some((x) => x.id !== "opencode" || Object.values(x.models).some((y) => y.cost?.input !== 0)), | ||||||
| ) | ||||||
|
|
@@ -229,6 +237,53 @@ export function Sidebar(props: { sessionID: string; overlay?: boolean }) { | |||||
| </Show> | ||||||
| </box> | ||||||
| </Show> | ||||||
| <Show when={subagents().length > 0}> | ||||||
| <box> | ||||||
| <box | ||||||
| flexDirection="row" | ||||||
| gap={1} | ||||||
| onMouseDown={() => subagents().length > 2 && setExpanded("subagents", !expanded.subagents)} | ||||||
| > | ||||||
| <Show when={subagents().length > 2}> | ||||||
| <text fg={theme.text}>{expanded.subagents ? "▼" : "▶"}</text> | ||||||
| </Show> | ||||||
| <text fg={theme.text}> | ||||||
| <b>Subagents</b> | ||||||
| <Show when={!expanded.subagents}> | ||||||
| <span style={{ fg: theme.textMuted }}> ({subagents().length})</span> | ||||||
| </Show> | ||||||
| </text> | ||||||
| </box> | ||||||
| <Show when={subagents().length <= 2 || expanded.subagents}> | ||||||
| <For each={subagents()}> | ||||||
| {(id) => { | ||||||
| const status = createMemo(() => sync.session.status(id)) | ||||||
| const title = createMemo(() => sync.session.get(id)?.title ?? id) | ||||||
| return ( | ||||||
| <box flexDirection="row" gap={1}> | ||||||
| <text | ||||||
| flexShrink={0} | ||||||
| style={{ | ||||||
| fg: status() === "idle" ? theme.success : theme.warning, | ||||||
| }} | ||||||
| > | ||||||
| • | ||||||
| </text> | ||||||
| <box flexGrow={1}> | ||||||
| <text fg={theme.text} wrapMode="word"> | ||||||
| {title()} | ||||||
| </text> | ||||||
| <text fg={theme.textMuted}> | ||||||
| {status() === "idle" ? "idle" : "working"} | ||||||
|
||||||
| {status() === "idle" ? "idle" : "working"} | |
| {status() === "idle" ? "idle" : status() === "compacting" ? "compacting" : "working"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the Subagents section is collapsed (more than 2 subagents), the header shows only the total count, e.g.,
(4). The MCP section (an established pattern in this file) shows a more informative summary in its collapsed header, e.g.,(3 active, 1 error). Since the primary reason for this feature is to track working vs. idle subagent status, the collapsed header would be more useful if it showed a count breakdown, such as(3 working, 1 idle), consistent with the MCP section pattern.