Skip to content

Commit eacf3ad

Browse files
authored
fix(tui): restore showDetails check removed in Permission rework (#7285)
1 parent 72062d2 commit eacf3ad

File tree

1 file changed

+57
-47
lines changed
  • packages/opencode/src/cli/cmd/tui/routes/session

1 file changed

+57
-47
lines changed

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

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,8 +1303,16 @@ function TextPart(props: { last: boolean; part: TextPart; message: AssistantMess
13031303
// Pending messages moved to individual tool pending functions
13041304

13051305
function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMessage }) {
1306+
const ctx = use()
13061307
const sync = useSync()
13071308

1309+
// Hide tool if showDetails is false and tool completed successfully
1310+
const shouldHide = createMemo(() => {
1311+
if (ctx.showDetails()) return false
1312+
if (props.part.state.status !== "completed") return false
1313+
return true
1314+
})
1315+
13081316
const toolprops = {
13091317
get metadata() {
13101318
return props.part.state.status === "pending" ? {} : (props.part.state.metadata ?? {})
@@ -1329,53 +1337,55 @@ function ToolPart(props: { last: boolean; part: ToolPart; message: AssistantMess
13291337
}
13301338

13311339
return (
1332-
<Switch>
1333-
<Match when={props.part.tool === "bash"}>
1334-
<Bash {...toolprops} />
1335-
</Match>
1336-
<Match when={props.part.tool === "glob"}>
1337-
<Glob {...toolprops} />
1338-
</Match>
1339-
<Match when={props.part.tool === "read"}>
1340-
<Read {...toolprops} />
1341-
</Match>
1342-
<Match when={props.part.tool === "grep"}>
1343-
<Grep {...toolprops} />
1344-
</Match>
1345-
<Match when={props.part.tool === "list"}>
1346-
<List {...toolprops} />
1347-
</Match>
1348-
<Match when={props.part.tool === "webfetch"}>
1349-
<WebFetch {...toolprops} />
1350-
</Match>
1351-
<Match when={props.part.tool === "codesearch"}>
1352-
<CodeSearch {...toolprops} />
1353-
</Match>
1354-
<Match when={props.part.tool === "websearch"}>
1355-
<WebSearch {...toolprops} />
1356-
</Match>
1357-
<Match when={props.part.tool === "write"}>
1358-
<Write {...toolprops} />
1359-
</Match>
1360-
<Match when={props.part.tool === "edit"}>
1361-
<Edit {...toolprops} />
1362-
</Match>
1363-
<Match when={props.part.tool === "task"}>
1364-
<Task {...toolprops} />
1365-
</Match>
1366-
<Match when={props.part.tool === "patch"}>
1367-
<Patch {...toolprops} />
1368-
</Match>
1369-
<Match when={props.part.tool === "todowrite"}>
1370-
<TodoWrite {...toolprops} />
1371-
</Match>
1372-
<Match when={props.part.tool === "question"}>
1373-
<Question {...toolprops} />
1374-
</Match>
1375-
<Match when={true}>
1376-
<GenericTool {...toolprops} />
1377-
</Match>
1378-
</Switch>
1340+
<Show when={!shouldHide()}>
1341+
<Switch>
1342+
<Match when={props.part.tool === "bash"}>
1343+
<Bash {...toolprops} />
1344+
</Match>
1345+
<Match when={props.part.tool === "glob"}>
1346+
<Glob {...toolprops} />
1347+
</Match>
1348+
<Match when={props.part.tool === "read"}>
1349+
<Read {...toolprops} />
1350+
</Match>
1351+
<Match when={props.part.tool === "grep"}>
1352+
<Grep {...toolprops} />
1353+
</Match>
1354+
<Match when={props.part.tool === "list"}>
1355+
<List {...toolprops} />
1356+
</Match>
1357+
<Match when={props.part.tool === "webfetch"}>
1358+
<WebFetch {...toolprops} />
1359+
</Match>
1360+
<Match when={props.part.tool === "codesearch"}>
1361+
<CodeSearch {...toolprops} />
1362+
</Match>
1363+
<Match when={props.part.tool === "websearch"}>
1364+
<WebSearch {...toolprops} />
1365+
</Match>
1366+
<Match when={props.part.tool === "write"}>
1367+
<Write {...toolprops} />
1368+
</Match>
1369+
<Match when={props.part.tool === "edit"}>
1370+
<Edit {...toolprops} />
1371+
</Match>
1372+
<Match when={props.part.tool === "task"}>
1373+
<Task {...toolprops} />
1374+
</Match>
1375+
<Match when={props.part.tool === "patch"}>
1376+
<Patch {...toolprops} />
1377+
</Match>
1378+
<Match when={props.part.tool === "todowrite"}>
1379+
<TodoWrite {...toolprops} />
1380+
</Match>
1381+
<Match when={props.part.tool === "question"}>
1382+
<Question {...toolprops} />
1383+
</Match>
1384+
<Match when={true}>
1385+
<GenericTool {...toolprops} />
1386+
</Match>
1387+
</Switch>
1388+
</Show>
13791389
)
13801390
}
13811391

0 commit comments

Comments
 (0)