[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
@@ -1,6 +1,7 @@
import { Injectable } from '@nestjs/common';
import { CodeInterpreterDriverFactory } from 'src/engine/core-modules/code-interpreter/code-interpreter-driver.factory';
import { CodeInterpreterDriverType } from 'src/engine/core-modules/code-interpreter/code-interpreter.interface';
import {
type CodeExecutionResult,
type CodeInterpreterDriver,
@@ -8,13 +9,22 @@ import {
type InputFile,
type StreamCallbacks,
} from 'src/engine/core-modules/code-interpreter/drivers/interfaces/code-interpreter-driver.interface';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
@Injectable()
export class CodeInterpreterService implements CodeInterpreterDriver {
constructor(
private readonly codeInterpreterDriverFactory: CodeInterpreterDriverFactory,
private readonly twentyConfigService: TwentyConfigService,
) {}
isEnabled(): boolean {
return (
this.twentyConfigService.get('CODE_INTERPRETER_TYPE') !==
CodeInterpreterDriverType.DISABLED
);
}
execute(
code: string,
files?: InputFile[],