From f47d3b720b73faf0d9936cc422926746c9428c6c Mon Sep 17 00:00:00 2001 From: Simon Klee Date: Fri, 17 Apr 2026 16:17:47 +0200 Subject: [PATCH] sub agent tabs --- .../src/cli/cmd/run/footer.subagent.tsx | 32 ++++++++++++++++++- .../opencode/src/cli/cmd/run/footer.view.tsx | 7 ++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/packages/opencode/src/cli/cmd/run/footer.subagent.tsx b/packages/opencode/src/cli/cmd/run/footer.subagent.tsx index 019a550c14..ef8b6562c1 100644 --- a/packages/opencode/src/cli/cmd/run/footer.subagent.tsx +++ b/packages/opencode/src/cli/cmd/run/footer.subagent.tsx @@ -35,10 +35,35 @@ function statusIcon(status: FooterSubagentTab["status"]) { return "◔" } +function tabText(input: { + tab: FooterSubagentTab + slot: string + count: number + width: number +}) { + const perTab = Math.max(1, Math.floor((input.width - 4 - Math.max(0, input.count - 1) * 3) / Math.max(1, input.count))) + if (input.count >= 8 || perTab < 12) { + return `[${input.slot}]` + } + + const label = `[${input.slot}] ${input.tab.label}` + if (input.count >= 5 || perTab < 24) { + return label + } + + const detail = input.tab.description || input.tab.title + if (!detail) { + return label + } + + return `${label} · ${detail}` +} + export function RunFooterSubagentTabs(props: { tabs: FooterSubagentTab[] selected?: string theme: RunFooterTheme + width: number }) { return ( )} - {`[${slot}] ${tab.label}`} + {tabText({ + tab, + slot, + count: props.tabs.length, + width: props.width, + })} diff --git a/packages/opencode/src/cli/cmd/run/footer.view.tsx b/packages/opencode/src/cli/cmd/run/footer.view.tsx index 3754e7027e..60a96cfd14 100644 --- a/packages/opencode/src/cli/cmd/run/footer.view.tsx +++ b/packages/opencode/src/cli/cmd/run/footer.view.tsx @@ -87,11 +87,12 @@ function subagentShortcut(event: { return } - if (!/^[1-9]$/.test(event.name)) { + if (!/^[0-9]$/.test(event.name)) { return } - return Number(event.name) - 1 + const slot = Number(event.name) + return slot === 0 ? 9 : slot - 1 } export { TEXTAREA_MIN_ROWS, TEXTAREA_MAX_ROWS } from "./footer.prompt" @@ -280,7 +281,7 @@ export function RunFooterView(props: RunFooterViewProps) { - +