refactor(cli): defer tool-call commit to prevent live-to-static flicker (#778)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-02-01 19:45:17 -08:00
committed by GitHub
parent ac2950b2a2
commit 790eb2278a
2 changed files with 175 additions and 105 deletions

View File

@@ -182,24 +182,23 @@ export const ToolCallMessage = memo(
// If name exceeds available width, fall back to simple wrapped rendering
const fallback = displayName.length >= rightWidth;
// Determine dot state based on phase
const getDotElement = () => {
const dotColor = (() => {
switch (line.phase) {
case "streaming":
return <Text color={colors.tool.streaming}></Text>;
return colors.tool.streaming;
case "ready":
return <BlinkDot color={colors.tool.pending} />;
return colors.tool.pending;
case "running":
return <BlinkDot color={colors.tool.running} />;
return colors.tool.running;
case "finished":
if (line.resultOk === false) {
return <Text color={colors.tool.error}></Text>;
}
return <Text color={colors.tool.completed}></Text>;
return line.resultOk === false
? colors.tool.error
: colors.tool.completed;
default:
return <Text></Text>;
return undefined;
}
};
})();
const dotShouldAnimate = line.phase === "ready" || line.phase === "running";
// Format result for display
const getResultElement = () => {
@@ -770,7 +769,7 @@ export const ToolCallMessage = memo(
{/* Tool call with exact wrapping logic from old codebase */}
<Box flexDirection="row">
<Box width={2} flexShrink={0}>
{getDotElement()}
<BlinkDot color={dotColor} shouldAnimate={dotShouldAnimate} />
<Text></Text>
</Box>
<Box flexGrow={1} width={rightWidth}>