@@ -78,7 +78,7 @@ export class RunPythonTool implements vscode.LanguageModelTool<IRunPythonParamet
7878 // eslint-disable-next-line @typescript-eslint/no-explicit-any
7979 error : ( message : string , ...args : any [ ] ) => logger . error ( `Pyodide => ${ message } ` , ...args ) ,
8080 // eslint-disable-next-line @typescript-eslint/no-explicit-any
81- info : ( message : string , ...args : any [ ] ) => logger . info ( `Pyodide => ${ message } ` , ...args )
81+ info : ( message : string , ...args : any [ ] ) => logger . debug ( `Pyodide => ${ message } ` , ...args )
8282 }
8383 } ) ;
8484 }
@@ -88,19 +88,13 @@ export class RunPythonTool implements vscode.LanguageModelTool<IRunPythonParamet
8888 _token : vscode . CancellationToken
8989 ) {
9090 const code = sanitizePythonCode ( options . input . code ) ;
91- logger . debug ( `Executing Python Code for "${ options . input . reason } "` ) ;
92- logger . debug ( `Code => ` ) ;
93- logger . debug ( code ) ;
91+ logger . info ( `Executing Python Code for "${ options . input . reason || '' } "` ) ;
92+ logger . info ( `Code => ` , code ) ;
9493
9594 this . pendingRequests = this . pendingRequests . finally ( ) . then ( ( ) => this . _kernel . execute ( code ) ) ;
9695 const result = await this . pendingRequests as Awaited < ReturnType < typeof Kernel . prototype . execute > > ;
9796
98- logger . debug ( `Result => ` ) ;
99- Object . keys ( result || { } ) . forEach ( key => {
100- logger . debug ( `${ key } :` ) ;
101- // eslint-disable-next-line @typescript-eslint/no-explicit-any
102- logger . debug ( ( result as any ) [ key ] ) ;
103- } ) ;
97+ logger . debug ( `Result => ` , JSON . stringify ( result ) ) ;
10498
10599 const content : ( vscode . LanguageModelPromptTsxPart | vscode . LanguageModelTextPart ) [ ] = [ ]
106100 if ( result && result [ 'text/plain' ] ) {
@@ -112,7 +106,9 @@ export class RunPythonTool implements vscode.LanguageModelTool<IRunPythonParamet
112106 }
113107
114108 if ( result && result [ 'application/vnd.code.notebook.error' ] ) {
115- throw result [ 'application/vnd.code.notebook.error' ] as Error ;
109+ const error = result [ 'application/vnd.code.notebook.error' ] as Error ;
110+ logger . error ( `Toolcall failed, Error ${ error . name } , ${ error . message } ` ) ;
111+ throw error ;
116112 }
117113 return new vscode . LanguageModelToolResult ( content ) ;
118114 }
@@ -188,7 +184,7 @@ export class InstallPythonPackageTool implements vscode.LanguageModelTool<IInsta
188184 options : vscode . LanguageModelToolInvocationOptions < IInstallPythonPackage > ,
189185 token : vscode . CancellationToken
190186 ) {
191- logger . debug ( `Installing Package "${ options . input . package } "` ) ;
187+ logger . info ( `Installing Package "${ options . input . package } "` ) ;
192188 const result = await this . pythonTool . invoke ( {
193189 input : {
194190 code : `import ${ options . input . package } ` ,
@@ -197,8 +193,7 @@ export class InstallPythonPackageTool implements vscode.LanguageModelTool<IInsta
197193 tokenizationOptions : options . tokenizationOptions
198194 } , token ) ;
199195
200- logger . debug ( `Result after installing package ${ options . input . package } => ` ) ;
201- logger . debug ( JSON . stringify ( result ) ) ;
196+ logger . debug ( `Result after installing package ${ options . input . package } => ` , JSON . stringify ( result ) ) ;
202197
203198 return new vscode . LanguageModelToolResult ( [ new vscode . LanguageModelTextPart ( 'Installation successful' ) ] ) ;
204199 }
0 commit comments