The open source coding agent.
TypeScript
feat: toggle tool details visibility (resolves #4824) (#4882)
Ariane Emory1864e8c8632b
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsxindex 2338604e3cd..9af2ce37873 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: () => booleanshowThinking: () => booleanshowTimestamps: () => boolean+ showDetails: () => booleandiffWrapMode: () => "word" | "none"sync: ReturnType<typeof useSync>}>()@@ -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: AssistantMessfunction 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) ?? GenericToolconst metadata = props.part.state.status === "pending" ? {} : (props.part.state.metadata ?? {})