Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/browser/components/tools/BashToolCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const BashToolCall: React.FC<BashToolCallProps> = ({
<ToolDetails>
<DetailSection>
<DetailLabel>Script</DetailLabel>
<DetailContent>{args.script}</DetailContent>
<DetailContent className="px-2 py-1.5">{args.script}</DetailContent>
</DetailSection>

{result && (
Expand Down
71 changes: 71 additions & 0 deletions src/browser/stories/App.chat.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
createCompactionRequestMessage,
createFileReadTool,
createFileEditTool,
createBashTool,
createTerminalTool,
createStatusTool,
createGenericTool,
Expand Down Expand Up @@ -180,6 +181,76 @@ export const WithTerminal: AppStory = {
),
};

/** Bash tool with expanded script and output sections */
export const WithBashTool: AppStory = {
render: () => (
<AppWithMocks
setup={() =>
setupSimpleChatStory({
workspaceId: "ws-bash",
messages: [
createUserMessage("msg-1", "Check project status", {
historySequence: 1,
timestamp: STABLE_TIMESTAMP - 100000,
}),
createAssistantMessage("msg-2", "Let me check the git status and run tests:", {
historySequence: 2,
timestamp: STABLE_TIMESTAMP - 90000,
toolCalls: [
createBashTool(
"call-1",
`#!/bin/bash
set -e

# Check git status
echo "=== Git Status ==="
git status --short

# Run tests
echo "=== Running Tests ==="
npm test 2>&1 | head -20`,
[
"=== Git Status ===",
" M src/api/users.ts",
" M src/auth/jwt.ts",
"?? src/api/users.test.ts",
"",
"=== Running Tests ===",
"PASS src/api/users.test.ts",
" ✓ should authenticate (24ms)",
" ✓ should reject invalid tokens (18ms)",
"",
"Tests: 2 passed, 2 total",
].join("\n"),
0,
10,
1250
),
],
}),
],
})
}
/>
),
parameters: {
docs: {
description: {
story: "Bash tool showing multi-line script in expanded view with proper padding.",
},
},
},
play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
const canvas = within(canvasElement);

// Expand the bash tool to show Script section with padding
await waitFor(async () => {
const toolHeader = canvas.getByText(/set -e/);
await userEvent.click(toolHeader);
});
},
};

/** Chat with agent status indicator */
export const WithAgentStatus: AppStory = {
render: () => (
Expand Down
18 changes: 18 additions & 0 deletions src/browser/stories/mockFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,24 @@ export function createFileEditTool(toolCallId: string, filePath: string, diff: s
};
}

export function createBashTool(
toolCallId: string,
script: string,
output: string,
exitCode = 0,
timeoutSecs = 3,
durationMs = 50
): MuxPart {
return {
type: "dynamic-tool",
toolCallId,
toolName: "bash",
state: "output-available",
input: { script, run_in_background: false, timeout_secs: timeoutSecs },
output: { success: exitCode === 0, output, exitCode, wall_duration_ms: durationMs },
};
}

export function createTerminalTool(
toolCallId: string,
command: string,
Expand Down