@@ -10,13 +10,20 @@ import {
1010 LanguageModelToolInvocationPrepareOptions ,
1111 LanguageModelToolResult ,
1212 PreparedToolInvocation ,
13+ workspace ,
1314} from 'vscode' ;
1415import { PythonExtension } from '../api/types' ;
1516import { IServiceContainer } from '../ioc/types' ;
1617import { ICodeExecutionService } from '../terminals/types' ;
1718import { TerminalCodeExecutionProvider } from '../terminals/codeExecution/terminalCodeExecution' ;
1819import { IProcessServiceFactory , IPythonExecutionFactory } from '../common/process/types' ;
19- import { getEnvironmentDetails , getToolResponseIfNotebook , IResourceReference , raceCancellationError } from './utils' ;
20+ import {
21+ getEnvironmentDetails ,
22+ getToolResponseIfNotebook ,
23+ getUntrustedWorkspaceResponse ,
24+ IResourceReference ,
25+ raceCancellationError ,
26+ } from './utils' ;
2027import { resolveFilePath } from './utils' ;
2128import { getPythonPackagesResponse } from './listPackagesTool' ;
2229import { ITerminalHelper } from '../common/terminal/types' ;
@@ -45,6 +52,10 @@ export class GetEnvironmentInfoTool implements LanguageModelTool<IResourceRefere
4552 options : LanguageModelToolInvocationOptions < IResourceReference > ,
4653 token : CancellationToken ,
4754 ) : Promise < LanguageModelToolResult > {
55+ if ( ! workspace . isTrusted ) {
56+ return getUntrustedWorkspaceResponse ( ) ;
57+ }
58+
4859 const resourcePath = resolveFilePath ( options . input . resourcePath ) ;
4960 const notebookResponse = getToolResponseIfNotebook ( resourcePath ) ;
5061 if ( notebookResponse ) {
0 commit comments