From 1864e8c8632bdf8802d527a9d30809f4e8fa587b Mon Sep 17 00:00:00 2001 From: Ariane Emory <97994360+ariane-emory@users.noreply.github.com> Date: Mon, 1 Dec 2025 20:38:44 -0500 Subject: [PATCH] feat: toggle tool details visibility (resolves #4824) (#4882) Co-authored-by: GitHub Action Co-authored-by: opencode-agent[bot] Co-authored-by: rekram1-node --- .../src/cli/cmd/tui/routes/session/index.tsx | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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 2338604e3..9af2ce378 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -81,6 +81,7 @@ const context = createContext<{ conceal: () => boolean showThinking: () => boolean showTimestamps: () => boolean + showDetails: () => boolean diffWrapMode: () => "word" | "none" sync: ReturnType }>() @@ -114,6 +115,7 @@ export function Session() { const [conceal, setConceal] = createSignal(true) const [showThinking, setShowThinking] = createSignal(kv.get("thinking_visibility", true)) const [showTimestamps, setShowTimestamps] = createSignal(kv.get("timestamps", "hide") === "show") + const [showDetails, setShowDetails] = createSignal(kv.get("tool_details_visibility", true)) const [diffWrapMode, setDiffWrapMode] = createSignal<"word" | "none">("word") const wide = createMemo(() => dimensions().width > 120) @@ -462,6 +464,17 @@ export function Session() { dialog.clear() }, }, + { + title: showDetails() ? "Hide tool details" : "Show tool details", + value: "session.toggle.actions", + category: "Session", + onSelect: (dialog) => { + const newValue = !showDetails() + setShowDetails(newValue) + kv.set("tool_details_visibility", newValue) + dialog.clear() + }, + }, { title: "Page up", value: "session.page.up", @@ -763,6 +776,7 @@ export function Session() { conceal, showThinking, showTimestamps, + showDetails, diffWrapMode, sync, }} @@ -1137,9 +1151,21 @@ function TextPart(props: { last: boolean; part: TextPart; message: AssistantMess function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) { const { theme } = useTheme() + const { showDetails } = use() const sync = useSync() const [margin, setMargin] = createSignal(0) const component = createMemo(() => { + // Hide tool if showDetails is false and tool completed successfully + // But always show if there's an error or permission is required + const shouldHide = + !showDetails() && + props.part.state.status === "completed" && + !sync.data.permission[props.message.sessionID]?.some((x) => x.callID === props.part.callID) + + if (shouldHide) { + return undefined + } + const render = ToolRegistry.render(props.part.tool) ?? GenericTool const metadata = props.part.state.status === "pending" ? {} : (props.part.state.metadata ?? {})