Skip to content

Commit 5e0aca1

Browse files
committed
feat(tui): show [truncated] indicator on tool calls
When a tool output is truncated and saved to file, the TUI now shows a [truncated] indicator in the tool call line so users can see at a glance that the output was truncated. Shows in warning color on both InlineTool and BlockTool displays.
1 parent 95d5a56 commit 5e0aca1

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/routes/session

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,11 @@ function InlineTool(props: {
14241424
const ctx = use()
14251425
const sync = useSync()
14261426

1427+
const truncated = createMemo(() => {
1428+
if (props.part.state.status !== "completed") return false
1429+
return props.part.state.metadata?.truncated === true
1430+
})
1431+
14271432
const permission = createMemo(() => {
14281433
const callID = sync.data.permission[ctx.sessionID]?.at(0)?.tool?.callID
14291434
if (!callID) return false
@@ -1470,6 +1475,9 @@ function InlineTool(props: {
14701475
<text paddingLeft={3} fg={fg()} attributes={denied() ? TextAttributes.STRIKETHROUGH : undefined}>
14711476
<Show fallback={<>~ {props.pending}</>} when={props.complete}>
14721477
<span style={{ fg: props.iconColor }}>{props.icon}</span> {props.children}
1478+
<Show when={truncated()}>
1479+
<span style={{ fg: theme.warning }}> [truncated]</span>
1480+
</Show>
14731481
</Show>
14741482
</text>
14751483
<Show when={error() && !denied()}>
@@ -1484,6 +1492,10 @@ function BlockTool(props: { title: string; children: JSX.Element; onClick?: () =
14841492
const renderer = useRenderer()
14851493
const [hover, setHover] = createSignal(false)
14861494
const error = createMemo(() => (props.part?.state.status === "error" ? props.part.state.error : undefined))
1495+
const truncated = createMemo(() => {
1496+
if (props.part?.state.status !== "completed") return false
1497+
return props.part.state.metadata?.truncated === true
1498+
})
14871499
return (
14881500
<box
14891501
border={["left"]}
@@ -1504,6 +1516,9 @@ function BlockTool(props: { title: string; children: JSX.Element; onClick?: () =
15041516
>
15051517
<text paddingLeft={3} fg={theme.textMuted}>
15061518
{props.title}
1519+
<Show when={truncated()}>
1520+
<span style={{ fg: theme.warning }}> [truncated]</span>
1521+
</Show>
15071522
</text>
15081523
{props.children}
15091524
<Show when={error()}>

0 commit comments

Comments
 (0)