Skip to content

Commit 834a12c

Browse files
committed
fix(web): long tool arguments get a height-capped block in the inspector
The inspector printed every tool argument inline after its key, so a multi-line script or file body grew the panel without bound. Arguments that span lines or run past 300 characters now render in the same scrollable, height-capped block the inspector uses for JSON and JavaScript.
1 parent 043df2b commit 834a12c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/web/src/components/chat/V2ItemInspector.tsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ export function FetchedToolOutput(props: {
197197
);
198198
}
199199

200+
// Scripts, file contents, and other large arguments get a height-capped block of their own
201+
// instead of growing the inspector without bound after their key.
202+
function isBlockToolArg(value: string): boolean {
203+
return value.length > 300 || value.includes("\n");
204+
}
205+
200206
function ToolCallBody(
201207
props: ToolOutputState & {
202208
readonly command?: string;
@@ -218,6 +224,8 @@ function ToolCallBody(
218224
<span className="text-muted-foreground">{key} </span>
219225
{key === "code" && isJavaScriptReplTool(props.toolName) ? (
220226
<StructuredValue value={value} language="typescript" />
227+
) : isBlockToolArg(value) ? (
228+
<StructuredValue value={value} />
221229
) : (
222230
value
223231
)}

0 commit comments

Comments
 (0)