1+ import type { ToolResult } from './types' ;
2+
13type RunAction = ( model : string , prompt : string ) => Promise < void > ;
24type 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} ) ) ;
7271vi . 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