From 6c0f983f67dd810f90932f2c7ce089aeb3ac5e09 Mon Sep 17 00:00:00 2001 From: Robert Dailey Date: Tue, 10 Feb 2026 10:36:14 -0600 Subject: [PATCH 1/2] feat(tui): show thinking indicator when reasoning is hidden This adds a collapsed "Thinking..." spinner in the chat area when the user has toggled thinking visibility off via `/thinking`. The indicator uses the same braille spinner as tools/subagents and disappears when reasoning finishes or the session is interrupted. --- .../src/cli/cmd/tui/routes/session/index.tsx | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) 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 70ff5eaf9fb6..8440b03c93d1 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1327,28 +1327,44 @@ function ReasoningPart(props: { last: boolean; part: ReasoningPart; message: Ass // OpenRouter sends encrypted reasoning data that appears as [REDACTED] return props.part.text.replace("[REDACTED]", "").trim() }) + const pending = createMemo(() => !props.part.time.end && !props.message.time.completed) + const color = createMemo(() => + RGBA.fromInts( + Math.round(theme.markdownEmph.r * 255), + Math.round(theme.markdownEmph.g * 255), + Math.round(theme.markdownEmph.b * 255), + Math.round(theme.thinkingOpacity * 255), + ), + ) return ( - - - - - + + + + + + + + + Thinking... + + + ) } From 352bfefe1f6a757909c89337841c485a3fc6baed Mon Sep 17 00:00:00 2001 From: Ariane Emory Date: Thu, 18 Jun 2026 00:36:50 -0400 Subject: [PATCH 2/2] fix(tui): wire thinking toggle to thinking_mode KV key The command-palette-consistency merge on the integration branch moved the thinking toggle from session/index.tsx to app.tsx but rewired it to the legacy thinking_visibility boolean instead of thinking_mode. The rendering components read thinking_mode (defaulting to "hide"), so the toggle had no effect and thinking was always collapsed. Move the toggle to app.tsx on this branch too (matching the integration layout) and wire it to thinking_mode. --- packages/opencode/src/cli/cmd/tui/app.tsx | 11 ++++++++++ .../src/cli/cmd/tui/routes/session/index.tsx | 20 +------------------ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index c889817be2a7..1fe7e3b0eb91 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -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 { @@ -929,6 +930,16 @@ function App(props: { onSnapshot?: () => Promise }) { 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, 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 ab965fa78a37..d6428ba0ecfb 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -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" @@ -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", @@ -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",