Skip to content
Closed
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
20 changes: 18 additions & 2 deletions packages/core/src/tools/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,24 @@ export class ShellToolInvocation extends BaseToolInvocation<
switch (event.type) {
case 'data':
if (isBinaryStream) break;
cumulativeOutput = event.chunk;
shouldUpdate = true;
// PTY mode emits AnsiOutput (full terminal snapshot) —
// overwrite. Pipe mode emits partial strings — accumulate
// so intermediate chunks aren't lost between throttled
// UI updates.
if (typeof event.chunk === 'string') {
cumulativeOutput =
typeof cumulativeOutput === 'string'
? cumulativeOutput + event.chunk
: event.chunk;
} else {
cumulativeOutput = event.chunk;
}
// Throttle UI updates to avoid excessive re-renders when
// commands produce high-volume output (e.g. thousands of
// warning lines).
if (Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
shouldUpdate = true;
}
break;
case 'binary_detected':
isBinaryStream = true;
Expand Down