@@ -10,13 +10,20 @@ import {
10
10
LanguageModelToolInvocationPrepareOptions ,
11
11
LanguageModelToolResult ,
12
12
PreparedToolInvocation ,
13
+ workspace ,
13
14
} from 'vscode' ;
14
15
import { PythonExtension } from '../api/types' ;
15
16
import { IServiceContainer } from '../ioc/types' ;
16
17
import { ICodeExecutionService } from '../terminals/types' ;
17
18
import { TerminalCodeExecutionProvider } from '../terminals/codeExecution/terminalCodeExecution' ;
18
19
import { 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' ;
20
27
import { resolveFilePath } from './utils' ;
21
28
import { getPythonPackagesResponse } from './listPackagesTool' ;
22
29
import { ITerminalHelper } from '../common/terminal/types' ;
@@ -45,6 +52,10 @@ export class GetEnvironmentInfoTool implements LanguageModelTool<IResourceRefere
45
52
options : LanguageModelToolInvocationOptions < IResourceReference > ,
46
53
token : CancellationToken ,
47
54
) : Promise < LanguageModelToolResult > {
55
+ if ( ! workspace . isTrusted ) {
56
+ return getUntrustedWorkspaceResponse ( ) ;
57
+ }
58
+
48
59
const resourcePath = resolveFilePath ( options . input . resourcePath ) ;
49
60
const notebookResponse = getToolResponseIfNotebook ( resourcePath ) ;
50
61
if ( notebookResponse ) {
0 commit comments