@@ -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' ;
@@ -44,6 +51,10 @@ export class GetEnvironmentInfoTool implements LanguageModelTool<IResourceRefere
4451 options : LanguageModelToolInvocationOptions < IResourceReference > ,
4552 token : CancellationToken ,
4653 ) : Promise < LanguageModelToolResult > {
54+ if ( ! workspace . isTrusted ) {
55+ return getUntrustedWorkspaceResponse ( ) ;
56+ }
57+
4758 const resourcePath = resolveFilePath ( options . input . resourcePath ) ;
4859 const notebookResponse = getToolResponseIfNotebook ( resourcePath ) ;
4960 if ( notebookResponse ) {
0 commit comments