Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: limit bash tool rendered output (#1827)

Eric Hayes103aea8b0400
diff --git a/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx b/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx
index 8ed74abbe5..d73a32cbd4 100644
--- a/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx
+++ b/js/app/packages/core/component/AI/component/tool/BashCodeExecution.tsx
@@ -24,12 +24,18 @@ function CodeFence(props: { content: string; maxLines: number }) {
const [expanded, setExpanded] = createSignal(false);
const lines = () => props.content.split('\n');
- const needsTruncation = () => lines().length > props.maxLines;
+ const needsTruncation = () =>
+ lines().length > props.maxLines ||
+ props.content.length > MAX_COMMAND_LENGTH;
+
const displayContent = () => {
if (expanded() || !needsTruncation()) {
return props.content;
}
- return lines().slice(0, props.maxLines).join('\n');
+ return lines()
+ .slice(0, props.maxLines)
+ .join('\n')
+ .slice(0, MAX_COMMAND_LENGTH);
};
return (
@@ -69,7 +75,7 @@ function BashResult(props: { result: BashCodeExecutionResult }) {
return parts.join('\n');
};
- const hasOutput = () => output().trim().length > 0;
+ const hasOutput = () => props.result.stdout.trim().length > 0;
return (
<div class="flex flex-col gap-1">