summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useToolScheduler.ts
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-05-30 12:43:59 -0700
committerGitHub <[email protected]>2025-05-30 12:43:59 -0700
commita0ba65944fd1f940c161e7bb2aa7f01f62ae1c15 (patch)
tree37907b281443d7f95c09a02c254791e0e687f76f /packages/cli/src/ui/hooks/useToolScheduler.ts
parent31a7affb74a9d11008685c6654d1619f805b3898 (diff)
disable markdown rendering of shell tool output (#625)
Diffstat (limited to 'packages/cli/src/ui/hooks/useToolScheduler.ts')
-rw-r--r--packages/cli/src/ui/hooks/useToolScheduler.ts23
1 files changed, 21 insertions, 2 deletions
diff --git a/packages/cli/src/ui/hooks/useToolScheduler.ts b/packages/cli/src/ui/hooks/useToolScheduler.ts
index af8715e9..7a5985c2 100644
--- a/packages/cli/src/ui/hooks/useToolScheduler.ts
+++ b/packages/cli/src/ui/hooks/useToolScheduler.ts
@@ -541,6 +541,18 @@ export function mapToDisplay(
): HistoryItemToolGroup {
const tools = Array.isArray(tool) ? tool : [tool];
const toolsDisplays = tools.map((t): IndividualToolCallDisplay => {
+ // Determine if markdown rendering should be skipped for this tool
+ let renderOutputAsMarkdown = true; // Default to true
+ if (t.status === 'error') {
+ // For errors, the tool object might not be available, so check t.request.name
+ if (t.request.name === 'execute_bash_command') {
+ renderOutputAsMarkdown = false;
+ }
+ } else if ('tool' in t && t.tool?.name === 'execute_bash_command') {
+ // For other statuses, check t.tool.name if tool exists
+ renderOutputAsMarkdown = false;
+ }
+
switch (t.status) {
case 'success':
return {
@@ -550,15 +562,17 @@ export function mapToDisplay(
resultDisplay: t.response.resultDisplay,
status: mapStatus(t.status),
confirmationDetails: undefined,
+ renderOutputAsMarkdown,
};
case 'error':
return {
callId: t.request.callId,
- name: t.request.name,
- description: '',
+ name: t.request.name, // Use request.name as tool might be undefined
+ description: '', // No description available if tool is undefined
resultDisplay: t.response.resultDisplay,
status: mapStatus(t.status),
confirmationDetails: undefined,
+ renderOutputAsMarkdown,
};
case 'cancelled':
return {
@@ -568,6 +582,7 @@ export function mapToDisplay(
resultDisplay: t.response.resultDisplay,
status: mapStatus(t.status),
confirmationDetails: undefined,
+ renderOutputAsMarkdown,
};
case 'awaiting_approval':
return {
@@ -577,6 +592,7 @@ export function mapToDisplay(
resultDisplay: undefined,
status: mapStatus(t.status),
confirmationDetails: t.confirmationDetails,
+ renderOutputAsMarkdown,
};
case 'executing':
return {
@@ -586,6 +602,7 @@ export function mapToDisplay(
resultDisplay: t.liveOutput ?? undefined,
status: mapStatus(t.status),
confirmationDetails: undefined,
+ renderOutputAsMarkdown,
};
case 'validating': // Add this case
return {
@@ -595,6 +612,7 @@ export function mapToDisplay(
resultDisplay: undefined,
status: mapStatus(t.status),
confirmationDetails: undefined,
+ renderOutputAsMarkdown,
};
case 'scheduled':
return {
@@ -604,6 +622,7 @@ export function mapToDisplay(
resultDisplay: undefined,
status: mapStatus(t.status),
confirmationDetails: undefined,
+ renderOutputAsMarkdown,
};
default: {
// ensures every case is checked for above