fix(coding-agent): configure inline tool image width

closes #3508
This commit is contained in:
Mario Zechner
2026-04-22 00:56:01 +02:00
parent 780d536727
commit 97a38bf652
6 changed files with 57 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import { theme } from "../theme/theme.js";
export interface ToolExecutionOptions {
showImages?: boolean;
imageWidthCells?: number;
}
export class ToolExecutionComponent extends Container {
@@ -23,6 +24,7 @@ export class ToolExecutionComponent extends Container {
private args: any;
private expanded = false;
private showImages: boolean;
private imageWidthCells: number;
private isPartial = true;
private toolDefinition?: ToolDefinition<any, any>;
private builtInToolDefinition?: ToolDefinition<any, any>;
@@ -54,6 +56,7 @@ export class ToolExecutionComponent extends Container {
this.toolDefinition = toolDefinition;
this.builtInToolDefinition = createAllToolDefinitions(cwd)[toolName as ToolName];
this.showImages = options.showImages ?? true;
this.imageWidthCells = options.imageWidthCells ?? 60;
this.ui = ui;
this.cwd = cwd;
@@ -205,6 +208,11 @@ export class ToolExecutionComponent extends Container {
this.updateDisplay();
}
setImageWidthCells(width: number): void {
this.imageWidthCells = Math.max(1, Math.floor(width));
this.updateDisplay();
}
override invalidate(): void {
super.invalidate();
this.updateDisplay();
@@ -312,7 +320,7 @@ export class ToolExecutionComponent extends Container {
imageData,
imageMimeType,
{ fallbackColor: (s: string) => theme.fg("toolOutput", s) },
{ maxWidthCells: 60 },
{ maxWidthCells: this.imageWidthCells },
);
this.imageComponents.push(imageComponent);
this.addChild(imageComponent);