Skip to content

Commit a059669

Browse files
committed
feat: add position indicator to subagent session header
Show current/total (e.g. '2 / 5') next to the 'Subagent session' label to give users visual context of their position in the navigation cycle. Closes anomalyco#9989
1 parent 4f51c09 commit a059669

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

  • packages/opencode/src/cli/cmd/tui/routes/session

‎packages/opencode/src/cli/cmd/tui/routes/session/header.tsx‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ export function Header() {
6666
const dimensions = useTerminalDimensions()
6767
const narrow = createMemo(() => dimensions().width < 80)
6868

69+
const siblings = createMemo(() => {
70+
const parentID = session()?.parentID
71+
if (!parentID) return []
72+
return sync.data.session
73+
.filter((x) => x.parentID === parentID)
74+
.toSorted((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
75+
})
76+
77+
const currentIndex = createMemo(() => siblings().findIndex((x) => x.id === session()?.id))
78+
const total = createMemo(() => siblings().length)
79+
6980
return (
7081
<box flexShrink={0}>
7182
<box
@@ -84,7 +95,10 @@ export function Header() {
8495
<box flexDirection="column" gap={1}>
8596
<box flexDirection={narrow() ? "column" : "row"} justifyContent="space-between" gap={narrow() ? 1 : 0}>
8697
<text fg={theme.text}>
87-
<b>Subagent session</b>
98+
<b>Subagent session</b>{" "}
99+
<span style={{ fg: theme.textMuted }}>
100+
{currentIndex() + 1} / {total()}
101+
</span>
88102
</text>
89103
<ContextInfo context={context} cost={cost} />
90104
</box>

0 commit comments

Comments
 (0)