From cf5aba279f14fcf79d2302d9107e3a828a7a50de Mon Sep 17 00:00:00 2001 From: chezsmithy Date: Sat, 12 Apr 2025 01:01:49 -0700 Subject: [PATCH] merged in the ultimate terminal changes --- core/protocol/passThrough.ts | 1 - .../gui/ToolCallDiv/RunTerminalCommand.tsx | 70 +++++++++++++------ 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 32b34d756..560e2a14b 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -80,7 +80,6 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "setTTSActive", "getWebviewHistoryLength", "getCurrentSessionId", - "didCloseFiles", "toolCallPartialOutput", "process/isBackgroundedResponse", "docs/suggestions", diff --git a/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx b/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx index 03fa777f8..0c3f24c26 100644 --- a/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx +++ b/gui/src/pages/gui/ToolCallDiv/RunTerminalCommand.tsx @@ -72,41 +72,65 @@ function parseTerminalOutput(output: string): { }; } -const OutputContainer = styled.div` - margin-top: 8px; - border-top: 1px solid rgba(128, 128, 128, 0.2); - padding-top: 8px; -`; - -const OutputTitle = styled.div` +const CommandStatus = styled.div` font-size: 12px; - color: #888; - margin-bottom: 4px; + color: #666; + margin-top: 8px; + padding-left: 8px; + padding-right: 8px; display: flex; align-items: center; `; -const RunningDot = styled.div` +const StatusIcon = styled.span<{ status: 'running' | 'completed' | 'failed' | 'background' }>` width: 8px; height: 8px; - background-color: #4caf50; border-radius: 50%; - margin-left: 6px; - animation: pulse 1.5s infinite; + margin-right: 8px; + background-color: ${props => + props.status === 'running' ? '#4caf50' : + props.status === 'completed' ? '#4caf50' : + props.status === 'background' ? '#2196f3' : + '#f44336'}; + ${props => props.status === 'running' ? 'animation: pulse 1.5s infinite;' : ''} +`; + +// Removed unused styled components + +const BackgroundLink = styled.a` + font-size: 12px; + color: #0077cc; + margin-left: 12px; + cursor: pointer; + text-decoration: none; - @keyframes pulse { - 0% { - opacity: 0.4; - } - 50% { - opacity: 1; - } - 100% { - opacity: 0.4; - } + &:hover { + text-decoration: underline; } `; +// Extract status message from terminal output +function parseTerminalOutput(output: string): { + commandOutput: string; + statusMessage: string | null; +} { + // Match status messages like [Command is running...], [Command completed], etc. + const statusRegex = /\n\[(Command .+?)\]$/; + const match = output.match(statusRegex); + + if (match) { + return { + commandOutput: output.replace(statusRegex, ''), + statusMessage: match[1] + }; + } + + return { + commandOutput: output, + statusMessage: null + }; +} + export function RunTerminalCommand(props: RunTerminalCommandToolCallProps) { const dispatch = useDispatch>();