Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/opencode/src/cli/cmd/tui/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const appBindingCommands = [
"app.toggle.diffwrap",
"app.toggle.paste_summary",
"app.toggle.session_directory_filter",
"session.toggle.thinking",
] as const

export function tuiRendererConfig(_config: TuiConfig.Resolved): CliRendererConfig {
Expand Down Expand Up @@ -929,6 +930,16 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
dialog.clear()
},
},
{
name: "session.toggle.thinking",
title: kv.get("thinking_mode", "hide") === "show" ? "Collapse thinking" : "Expand thinking",
category: "System",
run: () => {
const current = kv.get("thinking_mode", "hide")
kv.set("thinking_mode", current === "show" ? "hide" : "show")
dialog.clear()
},
},
].map((command) => ({
namespace: "palette",
...command,
Expand Down
40 changes: 12 additions & 28 deletions packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ import * as Model from "../../util/model"
import { formatTranscript } from "../../util/transcript"
import { UI } from "@/cli/ui.ts"
import { useTuiConfig } from "../../context/tui-config"
import { nextThinkingMode, reasoningSummary, useThinkingMode, type ThinkingMode } from "../../context/thinking"
import { reasoningSummary, useThinkingMode, type ThinkingMode } from "../../context/thinking"
import { getScrollAcceleration } from "../../util/scroll"
import { collapseToolOutput } from "../../util/collapse-tool-output"
import { TuiPluginRuntime } from "@/cli/cmd/tui/plugin/runtime"
Expand Down Expand Up @@ -130,7 +130,6 @@ const sessionBindingCommands = [
"session.sidebar.toggle",
"session.toggle.conceal",
"session.toggle.timestamps",
"session.toggle.thinking",
"session.toggle.actions",
"session.toggle.scrollbar",
"session.toggle.generic_tool_output",
Expand Down Expand Up @@ -692,23 +691,6 @@ export function Session() {
dialog.clear()
},
},
{
title: (() => {
const next = nextThinkingMode(thinkingMode())
if (next === "hide") return "Collapse thinking"
return "Expand thinking"
})(),
value: "session.toggle.thinking",
category: "Session",
slash: {
name: "thinking",
aliases: ["toggle-thinking"],
},
run: () => {
thinking.set(nextThinkingMode(thinkingMode()))
dialog.clear()
},
},
{
title: showDetails() ? "Hide tool details" : "Show tool details",
value: "session.toggle.actions",
Expand Down Expand Up @@ -1561,15 +1543,17 @@ function ReasoningPart(props: { last: boolean; part: ReasoningPart; message: Ass
return (
<Show when={content()}>
<box id={"text-" + props.part.id} paddingLeft={3} marginTop={1} flexDirection="column" flexShrink={0}>
<box onMouseUp={toggle}>
<ReasoningHeader
toggleable={inMinimal()}
open={!inMinimal() || expanded()}
done={isDone()}
title={summary().title}
duration={isDone() ? Locale.duration(duration()) : undefined}
/>
</box>
<Show when={!isDone()}>
<box onMouseUp={toggle}>
<ReasoningHeader
toggleable={inMinimal()}
open={!inMinimal() || expanded()}
done={isDone()}
title={summary().title}
duration={isDone() ? Locale.duration(duration()) : undefined}
/>
</box>
</Show>
<Show when={(!inMinimal() || expanded()) && summary().body}>
<box paddingLeft={inMinimal() ? 2 : 0} marginTop={1}>
<code
Expand Down