Skip to content

Commit 1864e8c

Browse files
ariane-emoryactions-useropencode-agent[bot]rekram1-node
authored
feat: toggle tool details visibility (resolves sst#4824) (sst#4882)
Co-authored-by: GitHub Action <[email protected]> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: rekram1-node <[email protected]>
1 parent 61d0d66 commit 1864e8c

File tree

1 file changed

+26
-0
lines changed
  • packages/opencode/src/cli/cmd/tui/routes/session

1 file changed

+26
-0
lines changed

packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const context = createContext<{
8181
conceal: () => boolean
8282
showThinking: () => boolean
8383
showTimestamps: () => boolean
84+
showDetails: () => boolean
8485
diffWrapMode: () => "word" | "none"
8586
sync: ReturnType<typeof useSync>
8687
}>()
@@ -114,6 +115,7 @@ export function Session() {
114115
const [conceal, setConceal] = createSignal(true)
115116
const [showThinking, setShowThinking] = createSignal(kv.get("thinking_visibility", true))
116117
const [showTimestamps, setShowTimestamps] = createSignal(kv.get("timestamps", "hide") === "show")
118+
const [showDetails, setShowDetails] = createSignal(kv.get("tool_details_visibility", true))
117119
const [diffWrapMode, setDiffWrapMode] = createSignal<"word" | "none">("word")
118120

119121
const wide = createMemo(() => dimensions().width > 120)
@@ -462,6 +464,17 @@ export function Session() {
462464
dialog.clear()
463465
},
464466
},
467+
{
468+
title: showDetails() ? "Hide tool details" : "Show tool details",
469+
value: "session.toggle.actions",
470+
category: "Session",
471+
onSelect: (dialog) => {
472+
const newValue = !showDetails()
473+
setShowDetails(newValue)
474+
kv.set("tool_details_visibility", newValue)
475+
dialog.clear()
476+
},
477+
},
465478
{
466479
title: "Page up",
467480
value: "session.page.up",
@@ -763,6 +776,7 @@ export function Session() {
763776
conceal,
764777
showThinking,
765778
showTimestamps,
779+
showDetails,
766780
diffWrapMode,
767781
sync,
768782
}}
@@ -1137,9 +1151,21 @@ function TextPart(props: { last: boolean; part: TextPart; message: AssistantMess
11371151

11381152
function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) {
11391153
const { theme } = useTheme()
1154+
const { showDetails } = use()
11401155
const sync = useSync()
11411156
const [margin, setMargin] = createSignal(0)
11421157
const component = createMemo(() => {
1158+
// Hide tool if showDetails is false and tool completed successfully
1159+
// But always show if there's an error or permission is required
1160+
const shouldHide =
1161+
!showDetails() &&
1162+
props.part.state.status === "completed" &&
1163+
!sync.data.permission[props.message.sessionID]?.some((x) => x.callID === props.part.callID)
1164+
1165+
if (shouldHide) {
1166+
return undefined
1167+
}
1168+
11431169
const render = ToolRegistry.render(props.part.tool) ?? GenericTool
11441170

11451171
const metadata = props.part.state.status === "pending" ? {} : (props.part.state.metadata ?? {})

0 commit comments

Comments
 (0)