Skip to content

Commit 75141ac

Browse files
Merge pull request #137 from ai-action/fix/tools
2 parents d987b96 + a9e36e8 commit 75141ac

12 files changed

Lines changed: 605 additions & 26 deletions

File tree

src/cli.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ToolResult } from './types';
2+
13
type RunAction = (model: string, prompt: string) => Promise<void>;
24
type ResumeAction = (sessionId: string) => Promise<void>;
35

@@ -59,14 +61,11 @@ vi.mock('./utils', () => ({
5961
const result = (await executeTool(
6062
toolCall.function.name,
6163
toolCall.function.arguments,
62-
)) as { content: string; error?: string };
64+
)) as ToolResult;
6365
return result;
6466
},
65-
formatToolResultContent: (
66-
toolName: string,
67-
result: { content: string; error?: string },
68-
) =>
69-
`Tool ${toolName} result:\n${result.content}${result.error ? `\nError: ${result.error}` : ''}`,
67+
formatToolResultContent: (toolName: string, result: ToolResult) =>
68+
`Tool ${toolName} result:\n${result.content}${result.error ? `\nError: ${result.error}` : ''}${result.stack ? `\nStack trace:\n${result.stack}` : ''}`,
7069
},
7170
}));
7271
vi.mock('./tui', () => ({ renderApp }));
@@ -239,6 +238,7 @@ describe('cli', () => {
239238
executeTool.mockResolvedValueOnce({
240239
content: 'partial output',
241240
error: 'shell failed',
241+
stack: 'Error: shell failed\n at runShell',
242242
});
243243

244244
await commandState.runAction?.('gemma4', 'review diff');
@@ -252,7 +252,7 @@ describe('cli', () => {
252252
{
253253
role: 'system',
254254
content:
255-
'Tool run_shell result:\npartial output\nError: shell failed',
255+
'Tool run_shell result:\npartial output\nError: shell failed\nStack trace:\nError: shell failed\n at runShell',
256256
},
257257
],
258258
'gemma4',

0 commit comments

Comments
 (0)