From e3a787a7a3c093935e7972ba606b3f0e3e7d2890 Mon Sep 17 00:00:00 2001 From: Dax Date: Tue, 3 Mar 2026 14:46:07 -0500 Subject: [PATCH] tui: use arrow indicator for active tool execution (#15887) --- .../src/cli/cmd/tui/routes/session/index.tsx | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index 9d7098413..7a7f6ce9f 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -241,7 +241,6 @@ export function Session() { const logo = UI.logo(" ").split(/\r?\n/) return exit.message.set( [ - ``, `${logo[0] ?? ""}`, `${logo[1] ?? ""}`, `${logo[2] ?? ""}`, @@ -1897,10 +1896,8 @@ function Read(props: ToolProps) { {(filepath) => ( - - - ↳ Loaded {normalizePath(filepath)} - + + ⤷ Loaded {normalizePath(filepath)} )} @@ -1994,33 +1991,32 @@ function Task(props: ToolProps) { return assistant - first }) + const content = createMemo(() => { + if (!props.input.description) return "" + let content = [`Task ${props.input.description}`] + + if (isRunning() && tools().length > 0) { + // content[0] += ` · ${tools().length} toolcalls` + if (current()) content.push(`└ ${Locale.titlecase(current()!.tool)} ${(current()!.state as any).title}`) + else content.push(`└ Running...`) + } + + if (props.part.state.status === "completed") { + content.push(`└ ${tools().length} toolcalls · ${Locale.duration(duration())}`) + } + + return content.join("\n") + }) + return ( - {props.input.description} - 0}> - {" "} - · {tools().length} toolcalls - - {(item) => { - const title = createMemo(() => (item().state as any).title) - return ( - <> - {"\n"}└ {Locale.titlecase(item().tool)} {title()} - - ) - }} - - - - {"\n "} - {tools().length} toolcalls · {Locale.duration(duration())} - + {content()} ) } @@ -2240,10 +2236,16 @@ function Diagnostics(props: { diagnostics?: Record[] function normalizePath(input?: string) { if (!input) return "" - if (path.isAbsolute(input)) { - return path.relative(process.cwd(), input) || "." - } - return input + + const cwd = process.cwd() + const absolute = path.isAbsolute(input) ? input : path.resolve(cwd, input) + const relative = path.relative(cwd, absolute) + + if (!relative) return "." + if (!relative.startsWith("..")) return relative + + // outside cwd - use absolute + return absolute } function input(input: Record, omit?: string[]): string {