[AI] Unify code-interpreter streaming rendering and fix assistant width jitter (#19235)

closes
https://discord.com/channels/1130383047699738754/1480991390782455838

- Use data-code-execution as the streaming source of truth and hide
duplicate code-interpreter tool parts (including tool-execute_tool
wrappers).
- Ensure wrapped execute_tool code-interpreter outputs still render
correctly after refetch.
- Gate code-interpreter server behavior by enablement state and keep
assistant messages full-width to avoid streaming vs completed width
shifts.

Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
nitin
2026-04-02 16:28:14 +05:30
committed by GitHub
parent 1c7bda8448
commit 223943550c
9 changed files with 126 additions and 31 deletions
@@ -0,0 +1,22 @@
import { isToolUIPart } from 'ai';
import { type ExtendedUIMessagePart } from 'twenty-shared/ai';
export const isCodeInterpreterToolPart = (
part: ExtendedUIMessagePart,
): boolean => {
if (!isToolUIPart(part)) {
return false;
}
if (part.type === 'tool-code_interpreter') {
return true;
}
if (part.type === 'tool-execute_tool') {
const input = part.input as Record<string, unknown> | null | undefined;
return input?.toolName === 'code_interpreter';
}
return false;
};