@@ -39,6 +39,12 @@ interface BashToolCallProps {
3939 onSendToBackground ?: ( ) => void ;
4040}
4141
42+ const EMPTY_LIVE_OUTPUT = {
43+ stdout : "" ,
44+ stderr : "" ,
45+ truncated : false ,
46+ } ;
47+
4248export const BashToolCall : React . FC < BashToolCallProps > = ( {
4349 workspaceId,
4450 toolCallId,
@@ -108,9 +114,14 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
108114 status === "completed" && result && "backgroundProcessId" in result ? "backgrounded" : status ;
109115
110116 const resultHasOutput = typeof ( result as { output ?: unknown } | undefined ) ?. output === "string" ;
111- const showLiveOutput = Boolean (
112- liveOutput && ! isBackground && ( status === "executing" || ! resultHasOutput )
113- ) ;
117+
118+ const hasLiveOutputSource = Boolean ( workspaceId && toolCallId ) ;
119+ const showLiveOutput =
120+ ! isBackground &&
121+ hasLiveOutputSource &&
122+ ( status === "executing" || ( Boolean ( liveOutput ) && ! resultHasOutput ) ) ;
123+
124+ const liveOutputView = liveOutput ?? EMPTY_LIVE_OUTPUT ;
114125 const liveLabelSuffix = status === "executing" ? " (live)" : " (tail)" ;
115126
116127 return (
@@ -176,9 +187,9 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
176187
177188 { expanded && (
178189 < ToolDetails >
179- { showLiveOutput && liveOutput && (
190+ { showLiveOutput && (
180191 < >
181- { liveOutput . truncated && (
192+ { liveOutputView . truncated && (
182193 < div className = "text-muted px-2 text-[10px] italic" >
183194 Live output truncated (showing last ~1MB)
184195 </ div >
@@ -191,10 +202,10 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
191202 onScroll = { ( e ) => updatePinned ( e . currentTarget , stdoutPinnedRef ) }
192203 className = { cn (
193204 "px-2 py-1.5" ,
194- liveOutput . stdout . length === 0 && "text-muted italic"
205+ liveOutputView . stdout . length === 0 && "text-muted italic"
195206 ) }
196207 >
197- { liveOutput . stdout . length > 0 ? liveOutput . stdout : "No output yet" }
208+ { liveOutputView . stdout . length > 0 ? liveOutputView . stdout : "No output yet" }
198209 </ DetailContent >
199210 </ DetailSection >
200211
@@ -205,10 +216,10 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
205216 onScroll = { ( e ) => updatePinned ( e . currentTarget , stderrPinnedRef ) }
206217 className = { cn (
207218 "px-2 py-1.5" ,
208- liveOutput . stderr . length === 0 && "text-muted italic"
219+ liveOutputView . stderr . length === 0 && "text-muted italic"
209220 ) }
210221 >
211- { liveOutput . stderr . length > 0 ? liveOutput . stderr : "No output yet" }
222+ { liveOutputView . stderr . length > 0 ? liveOutputView . stderr : "No output yet" }
212223 </ DetailContent >
213224 </ DetailSection >
214225 </ >
@@ -248,7 +259,7 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
248259 </ >
249260 ) }
250261
251- { status === "executing" && ! result && (
262+ { status === "executing" && ! result && ! showLiveOutput && (
252263 < DetailSection >
253264 < DetailContent className = "px-2 py-1.5" >
254265 Waiting for result
0 commit comments