diff options
| author | Dax Raad <[email protected]> | 2025-11-10 20:33:53 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-11-10 20:34:04 -0500 |
| commit | dea668b0ea406065d15936fd436b7820dee8b310 (patch) | |
| tree | b2cf1750e940f090fcb0f22941f9e56a8b5c32ea | |
| parent | 1bc3e92376adc15a92a6c8c367b81aa92a33073e (diff) | |
| download | opencode-dea668b0ea406065d15936fd436b7820dee8b310.tar.gz opencode-dea668b0ea406065d15936fd436b7820dee8b310.zip | |
tui: help users read thinking blocks and trust todo syncs
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | 37 |
1 files changed, 23 insertions, 14 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 bed658153..7b91aa3fc 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -17,7 +17,7 @@ import { useRoute, useRouteData } from "@tui/context/route" import { useSync } from "@tui/context/sync" import { SplitBorder } from "@tui/component/border" import { useTheme } from "@tui/context/theme" -import { BoxRenderable, ScrollBoxRenderable, addDefaultParsers } from "@opentui/core" +import { BoxRenderable, ScrollBoxRenderable, TextAttributes, addDefaultParsers } from "@opentui/core" import { Prompt, type PromptRef } from "@tui/component/prompt" import type { AssistantMessage, Part, ToolPart, UserMessage, TextPart, ReasoningPart } from "@opencode-ai/sdk" import { useLocal } from "@tui/context/local" @@ -950,14 +950,14 @@ const PART_MAPPING = { function ReasoningPart(props: { last: boolean; part: ReasoningPart; message: AssistantMessage }) { const { theme, syntax } = useTheme() const ctx = use() + const content = createMemo(() => props.part.text.trim()) return ( - <Show when={props.part.text.trim()}> + <Show when={content()}> <box id={"text-" + props.part.id} paddingLeft={2} marginTop={1} - flexDirection="row" - gap={1} + flexDirection="column" border={["left"]} customBorderChars={SplitBorder.customBorderChars} borderColor={theme.backgroundElement} @@ -967,7 +967,7 @@ function ReasoningPart(props: { last: boolean; part: ReasoningPart; message: Ass drawUnstyledText={false} streaming={true} syntaxStyle={syntax()} - content={props.part.text.trim()} + content={"_Thinking:_ " + content()} conceal={ctx.conceal()} fg={theme.text} /> @@ -1450,15 +1450,24 @@ ToolRegistry.register<typeof TodoWriteTool>({ render(props) { const { theme } = useTheme() return ( - <box> - <For each={props.input.todos ?? []}> - {(todo) => ( - <text style={{ fg: todo.status === "in_progress" ? theme.success : theme.textMuted }}> - [{todo.status === "completed" ? "✓" : " "}] {todo.content} - </text> - )} - </For> - </box> + <> + <Show when={!props.input.todos?.length}> + <ToolTitle icon="⚙" fallback="Updating todos..." when={true}> + Updating todos... + </ToolTitle> + </Show> + <Show when={props.metadata.todos?.length}> + <box> + <For each={props.input.todos ?? []}> + {(todo) => ( + <text style={{ fg: todo.status === "in_progress" ? theme.success : theme.textMuted }}> + [{todo.status === "completed" ? "✓" : " "}] {todo.content} + </text> + )} + </For> + </box> + </Show> + </> ) }, }) |
