@aws/lsp-codewhisperer 0.0.80 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/out/language-server/agenticChat/tools/mcp/agentPermissionManager.d.ts +50 -7
- package/out/language-server/agenticChat/tools/mcp/agentPermissionManager.js +291 -35
- package/out/language-server/agenticChat/tools/mcp/agentPermissionManager.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpEventHandler.js +44 -7
- package/out/language-server/agenticChat/tools/mcp/mcpEventHandler.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpManager.d.ts +14 -2
- package/out/language-server/agenticChat/tools/mcp/mcpManager.js +144 -53
- package/out/language-server/agenticChat/tools/mcp/mcpManager.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpTypes.js +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpTypes.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpUtils.d.ts +2 -1
- package/out/language-server/agenticChat/tools/mcp/mcpUtils.js +87 -54
- package/out/language-server/agenticChat/tools/mcp/mcpUtils.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReview.js +15 -5
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReview.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.js +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewTypes.d.ts +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.d.ts +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.js +3 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.js.map +1 -1
- package/out/language-server/agenticChat/tools/toolServer.js +1 -0
- package/out/language-server/agenticChat/tools/toolServer.js.map +1 -1
- package/out/language-server/inline-completion/codeWhispererServer.js +3 -3
- package/out/language-server/inline-completion/codeWhispererServer.js.map +1 -1
- package/out/language-server/inline-completion/editCompletionHandler.js +1 -1
- package/out/language-server/inline-completion/editCompletionHandler.js.map +1 -1
- package/out/language-server/inline-completion/session/sessionManager.d.ts +2 -2
- package/out/language-server/inline-completion/session/sessionManager.js +3 -2
- package/out/language-server/inline-completion/session/sessionManager.js.map +1 -1
- package/out/language-server/inline-completion/telemetry.js +1 -1
- package/out/language-server/netTransform/artifactManager.js +0 -11
- package/out/language-server/netTransform/artifactManager.js.map +1 -1
- package/out/shared/amazonQServiceManager/AmazonQTokenServiceManager.js +1 -1
- package/out/shared/amazonQServiceManager/AmazonQTokenServiceManager.js.map +1 -1
- package/out/shared/telemetry/telemetryService.js +4 -2
- package/out/shared/telemetry/telemetryService.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.81](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.80...lsp-codewhisperer/v0.0.81) (2025-09-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **amazonq:** fix for delete mcp for mcp config, disable and create corresponding agent file ([#2298](https://github.com/aws/language-servers/issues/2298)) ([8641860](https://github.com/aws/language-servers/commit/8641860295c4e089d09154fa5411c305f2f4ecce))
|
|
9
|
+
* **amazonq:** fix for legacy mcp permission consistentcy and config update ([#2300](https://github.com/aws/language-servers/issues/2300)) ([c8aa7bd](https://github.com/aws/language-servers/commit/c8aa7bd3e9d39ed327972bbc950ad72e8e401581))
|
|
10
|
+
* **amazonq:** fix for mcp permissions read/write inconsistencies ([#2296](https://github.com/aws/language-servers/issues/2296)) ([c7a9a8e](https://github.com/aws/language-servers/commit/c7a9a8e1ba5c1a284d661e683dd46133860a1d3d))
|
|
11
|
+
* **amazonq:** fix to add filewatcher for mcp config files ([#2295](https://github.com/aws/language-servers/issues/2295)) ([fcee77c](https://github.com/aws/language-servers/commit/fcee77c1b06e69f9096d8e98a0cfcc42d7fddb01))
|
|
12
|
+
* **amazonq:** fix to normlize workspace paths in windows ([#2306](https://github.com/aws/language-servers/issues/2306)) ([fab073c](https://github.com/aws/language-servers/commit/fab073c855109b15005bfd880894471c35652ffc))
|
|
13
|
+
* **amazonq:** improve messaging for code review ([#2303](https://github.com/aws/language-servers/issues/2303)) ([60bc68d](https://github.com/aws/language-servers/commit/60bc68d1d4d2ce8a0373be6ce7551e961fc2cdb8))
|
|
14
|
+
* **amazonq:** support mcp config files for backwards compatbility ([#2292](https://github.com/aws/language-servers/issues/2292)) ([41c99af](https://github.com/aws/language-servers/commit/41c99af02b3f415e39898f11c3c21ac530f9c406))
|
|
15
|
+
* inline UTD empty cases dont differentiate Edit and Completion ([#2287](https://github.com/aws/language-servers/issues/2287)) ([84e2c8c](https://github.com/aws/language-servers/commit/84e2c8c12f5d828192a302fa11483063d33b059c))
|
|
16
|
+
* inline UTD telemetry empty cases dont differentiate Edit and Completion ([#2288](https://github.com/aws/language-servers/issues/2288)) ([d207b6e](https://github.com/aws/language-servers/commit/d207b6e9dfded650c6f65c675ee45c52f8222571))
|
|
17
|
+
* quick fix for repeated logging from squashed commit ([#2291](https://github.com/aws/language-servers/issues/2291)) ([36f3eed](https://github.com/aws/language-servers/commit/36f3eedd1cad3fca4fc48792ba40b6470f733bfa))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Reverts
|
|
21
|
+
|
|
22
|
+
* inline UTD telemetry empty cases dont differentiate Edit and Completion ([#2288](https://github.com/aws/language-servers/issues/2288)) ([#2297](https://github.com/aws/language-servers/issues/2297)) ([eb081e6](https://github.com/aws/language-servers/commit/eb081e6bc6bef4182ab89e295bff97c4e828096b))
|
|
23
|
+
|
|
3
24
|
## [0.0.80](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.79...lsp-codewhisperer/v0.0.80) (2025-09-16)
|
|
4
25
|
|
|
5
26
|
|
|
@@ -8,7 +8,10 @@ import { AgentConfig, McpPermissionType } from './mcpTypes';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class AgentPermissionManager {
|
|
10
10
|
private agentConfig;
|
|
11
|
-
|
|
11
|
+
private getAvailableTools?;
|
|
12
|
+
private getAllAvailableServers?;
|
|
13
|
+
private getAllBuiltinTools?;
|
|
14
|
+
constructor(agentConfig: AgentConfig, getAvailableTools?: ((serverName: string) => string[]) | undefined, getAllAvailableServers?: (() => string[]) | undefined, getAllBuiltinTools?: (() => string[]) | undefined);
|
|
12
15
|
/**
|
|
13
16
|
* Check if a tool matches a pattern using glob-style wildcards
|
|
14
17
|
*/
|
|
@@ -26,13 +29,9 @@ export declare class AgentPermissionManager {
|
|
|
26
29
|
*/
|
|
27
30
|
getToolPermission(serverName: string, toolName: string): McpPermissionType;
|
|
28
31
|
/**
|
|
29
|
-
* Set permission for a tool
|
|
32
|
+
* Set permission for a tool - removes conflicting wildcards and replaces with explicit tools
|
|
30
33
|
*/
|
|
31
34
|
setToolPermission(serverName: string, toolName: string, permission: McpPermissionType): void;
|
|
32
|
-
/**
|
|
33
|
-
* Remove wildcards that would conflict with specific tool permission
|
|
34
|
-
*/
|
|
35
|
-
private removeConflictingWildcards;
|
|
36
35
|
/**
|
|
37
36
|
* Add tool to tools array
|
|
38
37
|
*/
|
|
@@ -46,13 +45,57 @@ export declare class AgentPermissionManager {
|
|
|
46
45
|
*/
|
|
47
46
|
private addToAllowedTools;
|
|
48
47
|
/**
|
|
49
|
-
* Remove tool from allowedTools array
|
|
48
|
+
* Remove tool from allowedTools array (only exact matches)
|
|
50
49
|
*/
|
|
51
50
|
private removeFromAllowedTools;
|
|
52
51
|
/**
|
|
53
52
|
* Set server-wide permission (uses @serverName pattern)
|
|
54
53
|
*/
|
|
55
54
|
setServerPermission(serverName: string, permission: McpPermissionType): void;
|
|
55
|
+
/**
|
|
56
|
+
* Convert server-wide permission to individual tools, excluding the denied tool
|
|
57
|
+
*/
|
|
58
|
+
private convertServerWideToIndividualTools;
|
|
59
|
+
/**
|
|
60
|
+
* Remove conflicting wildcards from tools when denying a tool
|
|
61
|
+
*/
|
|
62
|
+
private removeConflictingWildcardsForDeny;
|
|
63
|
+
/**
|
|
64
|
+
* Remove conflicting wildcards from allowedTools when denying a tool
|
|
65
|
+
*/
|
|
66
|
+
private removeConflictingAllowedWildcardsForDeny;
|
|
67
|
+
/**
|
|
68
|
+
* Remove conflicting wildcards from allowedTools when setting to ask
|
|
69
|
+
*/
|
|
70
|
+
private removeConflictingAllowedWildcardsForAsk;
|
|
71
|
+
/**
|
|
72
|
+
* Expand global wildcard (*) to all available tools except the denied one
|
|
73
|
+
*/
|
|
74
|
+
private expandGlobalWildcard;
|
|
75
|
+
/**
|
|
76
|
+
* Expand @builtin wildcard to all builtin tools except the denied one
|
|
77
|
+
*/
|
|
78
|
+
private expandBuiltinWildcard;
|
|
79
|
+
/**
|
|
80
|
+
* Remove pattern wildcards that match the tool and expand them
|
|
81
|
+
*/
|
|
82
|
+
private removeMatchingPatternWildcards;
|
|
83
|
+
/**
|
|
84
|
+
* Expand a pattern wildcard to individual tools except the denied one
|
|
85
|
+
*/
|
|
86
|
+
private expandPatternWildcard;
|
|
87
|
+
/**
|
|
88
|
+
* Expand allowedTools pattern wildcard except the denied tool
|
|
89
|
+
*/
|
|
90
|
+
private expandAllowedPatternWildcard;
|
|
91
|
+
/**
|
|
92
|
+
* Get all available servers
|
|
93
|
+
*/
|
|
94
|
+
private getAvailableServers;
|
|
95
|
+
/**
|
|
96
|
+
* Get all builtin tools
|
|
97
|
+
*/
|
|
98
|
+
private getBuiltinTools;
|
|
56
99
|
/**
|
|
57
100
|
* Get updated agent config
|
|
58
101
|
*/
|
|
@@ -11,8 +11,14 @@ const mcpTypes_1 = require("./mcpTypes");
|
|
|
11
11
|
*/
|
|
12
12
|
class AgentPermissionManager {
|
|
13
13
|
agentConfig;
|
|
14
|
-
|
|
14
|
+
getAvailableTools;
|
|
15
|
+
getAllAvailableServers;
|
|
16
|
+
getAllBuiltinTools;
|
|
17
|
+
constructor(agentConfig, getAvailableTools, getAllAvailableServers, getAllBuiltinTools) {
|
|
15
18
|
this.agentConfig = agentConfig;
|
|
19
|
+
this.getAvailableTools = getAvailableTools;
|
|
20
|
+
this.getAllAvailableServers = getAllAvailableServers;
|
|
21
|
+
this.getAllBuiltinTools = getAllBuiltinTools;
|
|
16
22
|
}
|
|
17
23
|
/**
|
|
18
24
|
* Check if a tool matches a pattern using glob-style wildcards
|
|
@@ -36,20 +42,31 @@ class AgentPermissionManager {
|
|
|
36
42
|
isToolEnabled(serverName, toolName) {
|
|
37
43
|
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
38
44
|
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
39
|
-
// Check exact matches first
|
|
45
|
+
// Check exact matches first (exact matches take precedence)
|
|
40
46
|
if (this.agentConfig.tools.includes(toolId))
|
|
41
47
|
return true;
|
|
42
48
|
if (serverPrefix && this.agentConfig.tools.includes(serverPrefix))
|
|
43
49
|
return true;
|
|
50
|
+
// Check for global wildcard
|
|
51
|
+
if (this.agentConfig.tools.includes('*'))
|
|
52
|
+
return true;
|
|
53
|
+
// Check for @builtin pattern (built-in tools only)
|
|
54
|
+
if (!serverName && this.agentConfig.tools.includes('@builtin'))
|
|
55
|
+
return true;
|
|
44
56
|
// Check wildcard patterns
|
|
45
57
|
for (const tool of this.agentConfig.tools) {
|
|
46
58
|
if (tool.includes('*') || tool.includes('?')) {
|
|
59
|
+
// For server patterns like @*-mcp, match against server prefix
|
|
60
|
+
if (serverName && tool.startsWith('@') && !tool.includes('/')) {
|
|
61
|
+
if (this.matchesPattern(serverPrefix, tool))
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
// For full tool patterns
|
|
47
65
|
if (this.matchesPattern(toolId, tool))
|
|
48
66
|
return true;
|
|
49
67
|
}
|
|
50
68
|
}
|
|
51
|
-
|
|
52
|
-
return this.agentConfig.tools.includes('*');
|
|
69
|
+
return false;
|
|
53
70
|
}
|
|
54
71
|
/**
|
|
55
72
|
* Check if a tool is always allowed (in allowedTools array)
|
|
@@ -75,59 +92,66 @@ class AgentPermissionManager {
|
|
|
75
92
|
* Get permission type for a tool
|
|
76
93
|
*/
|
|
77
94
|
getToolPermission(serverName, toolName) {
|
|
95
|
+
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
96
|
+
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
97
|
+
// Check exact matches first (exact matches take precedence over patterns)
|
|
98
|
+
const exactInTools = this.agentConfig.tools.includes(toolId);
|
|
99
|
+
const exactInAllowed = this.agentConfig.allowedTools.includes(toolId);
|
|
100
|
+
const serverInTools = serverPrefix && this.agentConfig.tools.includes(serverPrefix);
|
|
101
|
+
const serverInAllowed = serverPrefix && this.agentConfig.allowedTools.includes(serverPrefix);
|
|
102
|
+
// If exact match in allowedTools or server-wide in allowedTools
|
|
103
|
+
if (exactInAllowed || serverInAllowed) {
|
|
104
|
+
return mcpTypes_1.McpPermissionType.alwaysAllow;
|
|
105
|
+
}
|
|
106
|
+
// If exact match in tools, check if also in allowedTools patterns
|
|
107
|
+
if (exactInTools) {
|
|
108
|
+
const isAlwaysAllowed = this.isToolAlwaysAllowed(serverName, toolName);
|
|
109
|
+
return isAlwaysAllowed ? mcpTypes_1.McpPermissionType.alwaysAllow : mcpTypes_1.McpPermissionType.ask;
|
|
110
|
+
}
|
|
111
|
+
// If server-wide in tools, check if also in allowedTools patterns
|
|
112
|
+
if (serverInTools) {
|
|
113
|
+
const isAlwaysAllowed = this.isToolAlwaysAllowed(serverName, toolName);
|
|
114
|
+
return isAlwaysAllowed ? mcpTypes_1.McpPermissionType.alwaysAllow : mcpTypes_1.McpPermissionType.ask;
|
|
115
|
+
}
|
|
116
|
+
// Fall back to pattern matching
|
|
78
117
|
const isEnabled = this.isToolEnabled(serverName, toolName);
|
|
79
118
|
const isAlwaysAllowed = this.isToolAlwaysAllowed(serverName, toolName);
|
|
80
|
-
//
|
|
81
|
-
if (isAlwaysAllowed) {
|
|
119
|
+
// Tool must be enabled first before it can be always allowed
|
|
120
|
+
if (isEnabled && isAlwaysAllowed) {
|
|
82
121
|
return mcpTypes_1.McpPermissionType.alwaysAllow;
|
|
83
122
|
}
|
|
84
|
-
// If tool is enabled but not always allowed, ask for permission
|
|
85
123
|
if (isEnabled) {
|
|
86
124
|
return mcpTypes_1.McpPermissionType.ask;
|
|
87
125
|
}
|
|
88
|
-
// Tool is not enabled and not always allowed
|
|
89
126
|
return mcpTypes_1.McpPermissionType.deny;
|
|
90
127
|
}
|
|
91
128
|
/**
|
|
92
|
-
* Set permission for a tool
|
|
129
|
+
* Set permission for a tool - removes conflicting wildcards and replaces with explicit tools
|
|
93
130
|
*/
|
|
94
131
|
setToolPermission(serverName, toolName, permission) {
|
|
95
132
|
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
96
133
|
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
97
|
-
// Remove conflicting wildcards that would affect this tool
|
|
98
|
-
this.removeConflictingWildcards(toolId);
|
|
99
134
|
switch (permission) {
|
|
100
135
|
case mcpTypes_1.McpPermissionType.deny:
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
136
|
+
this.removeConflictingWildcardsForDeny(serverName, toolName);
|
|
137
|
+
this.removeConflictingAllowedWildcardsForDeny(serverName, toolName);
|
|
103
138
|
break;
|
|
104
139
|
case mcpTypes_1.McpPermissionType.ask:
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
140
|
+
this.removeConflictingAllowedWildcardsForAsk(serverName, toolName);
|
|
141
|
+
if (!this.isToolEnabled(serverName, toolName)) {
|
|
142
|
+
this.addTool(toolId);
|
|
143
|
+
}
|
|
107
144
|
break;
|
|
108
145
|
case mcpTypes_1.McpPermissionType.alwaysAllow:
|
|
109
|
-
this.
|
|
110
|
-
|
|
146
|
+
if (!this.isToolEnabled(serverName, toolName)) {
|
|
147
|
+
this.addTool(toolId);
|
|
148
|
+
}
|
|
149
|
+
if (!this.isToolAlwaysAllowed(serverName, toolName)) {
|
|
150
|
+
this.addToAllowedTools(toolId);
|
|
151
|
+
}
|
|
111
152
|
break;
|
|
112
153
|
}
|
|
113
154
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Remove wildcards that would conflict with specific tool permission
|
|
116
|
-
*/
|
|
117
|
-
removeConflictingWildcards(toolId) {
|
|
118
|
-
// Remove wildcards from tools array that would match this tool
|
|
119
|
-
this.agentConfig.tools = this.agentConfig.tools.filter(tool => {
|
|
120
|
-
if (!tool.includes('*') && !tool.includes('?'))
|
|
121
|
-
return true;
|
|
122
|
-
return !this.matchesPattern(toolId, tool);
|
|
123
|
-
});
|
|
124
|
-
// Remove wildcards from allowedTools array that would match this tool
|
|
125
|
-
this.agentConfig.allowedTools = this.agentConfig.allowedTools.filter(tool => {
|
|
126
|
-
if (!tool.includes('*') && !tool.includes('?'))
|
|
127
|
-
return true;
|
|
128
|
-
return !this.matchesPattern(toolId, tool);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
155
|
/**
|
|
132
156
|
* Add tool to tools array
|
|
133
157
|
*/
|
|
@@ -151,7 +175,7 @@ class AgentPermissionManager {
|
|
|
151
175
|
}
|
|
152
176
|
}
|
|
153
177
|
/**
|
|
154
|
-
* Remove tool from allowedTools array
|
|
178
|
+
* Remove tool from allowedTools array (only exact matches)
|
|
155
179
|
*/
|
|
156
180
|
removeFromAllowedTools(toolId, serverPrefix) {
|
|
157
181
|
this.agentConfig.allowedTools = this.agentConfig.allowedTools.filter(tool => tool !== toolId && tool !== serverPrefix);
|
|
@@ -179,6 +203,238 @@ class AgentPermissionManager {
|
|
|
179
203
|
break;
|
|
180
204
|
}
|
|
181
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* Convert server-wide permission to individual tools, excluding the denied tool
|
|
208
|
+
*/
|
|
209
|
+
convertServerWideToIndividualTools(serverName, deniedToolName) {
|
|
210
|
+
const serverPrefix = `@${serverName}`;
|
|
211
|
+
// Remove server-wide permission
|
|
212
|
+
this.agentConfig.tools = this.agentConfig.tools.filter(tool => tool !== serverPrefix);
|
|
213
|
+
// If we have a callback to get available tools, add them individually
|
|
214
|
+
if (this.getAvailableTools) {
|
|
215
|
+
const availableTools = this.getAvailableTools(serverName);
|
|
216
|
+
for (const toolName of availableTools) {
|
|
217
|
+
if (toolName !== deniedToolName) {
|
|
218
|
+
const toolId = `@${serverName}/${toolName}`;
|
|
219
|
+
this.addTool(toolId);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// If no callback, we just remove server-wide permission (limitation)
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Remove conflicting wildcards from tools when denying a tool
|
|
227
|
+
*/
|
|
228
|
+
removeConflictingWildcardsForDeny(serverName, toolName) {
|
|
229
|
+
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
230
|
+
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
231
|
+
// Handle global wildcard (*)
|
|
232
|
+
if (this.agentConfig.tools.includes('*')) {
|
|
233
|
+
this.expandGlobalWildcard(serverName, toolName);
|
|
234
|
+
}
|
|
235
|
+
// Handle server-wide wildcard (@server)
|
|
236
|
+
if (serverPrefix && this.agentConfig.tools.includes(serverPrefix)) {
|
|
237
|
+
this.convertServerWideToIndividualTools(serverName, toolName);
|
|
238
|
+
}
|
|
239
|
+
// Handle @builtin wildcard
|
|
240
|
+
if (!serverName && this.agentConfig.tools.includes('@builtin')) {
|
|
241
|
+
this.expandBuiltinWildcard(toolName);
|
|
242
|
+
}
|
|
243
|
+
// Handle pattern wildcards
|
|
244
|
+
this.removeMatchingPatternWildcards(serverName, toolName);
|
|
245
|
+
// Remove explicit tool entry
|
|
246
|
+
this.removeTool(toolId, serverPrefix);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Remove conflicting wildcards from allowedTools when denying a tool
|
|
250
|
+
*/
|
|
251
|
+
removeConflictingAllowedWildcardsForDeny(serverName, toolName) {
|
|
252
|
+
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
253
|
+
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
254
|
+
// Remove exact matches
|
|
255
|
+
this.agentConfig.allowedTools = this.agentConfig.allowedTools.filter(tool => tool !== toolId && tool !== serverPrefix);
|
|
256
|
+
// Remove matching wildcards and expand them
|
|
257
|
+
const toRemove = [];
|
|
258
|
+
for (const allowedTool of this.agentConfig.allowedTools) {
|
|
259
|
+
if (allowedTool.includes('*') || allowedTool.includes('?')) {
|
|
260
|
+
if (this.matchesPattern(toolId, allowedTool)) {
|
|
261
|
+
toRemove.push(allowedTool);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
for (const pattern of toRemove) {
|
|
266
|
+
this.expandAllowedPatternWildcard(pattern, serverName, toolName);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Remove conflicting wildcards from allowedTools when setting to ask
|
|
271
|
+
*/
|
|
272
|
+
removeConflictingAllowedWildcardsForAsk(serverName, toolName) {
|
|
273
|
+
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
274
|
+
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
275
|
+
// Remove exact matches
|
|
276
|
+
this.agentConfig.allowedTools = this.agentConfig.allowedTools.filter(tool => tool !== toolId && tool !== serverPrefix);
|
|
277
|
+
// Remove matching wildcards and expand them (excluding the tool being set to ask)
|
|
278
|
+
const toRemove = [];
|
|
279
|
+
for (const allowedTool of this.agentConfig.allowedTools) {
|
|
280
|
+
if (allowedTool.includes('*') || allowedTool.includes('?')) {
|
|
281
|
+
if (this.matchesPattern(toolId, allowedTool)) {
|
|
282
|
+
toRemove.push(allowedTool);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
for (const pattern of toRemove) {
|
|
287
|
+
this.expandAllowedPatternWildcard(pattern, serverName, toolName);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Expand global wildcard (*) to all available tools except the denied one
|
|
292
|
+
*/
|
|
293
|
+
expandGlobalWildcard(deniedServerName, deniedToolName) {
|
|
294
|
+
this.agentConfig.tools = this.agentConfig.tools.filter(tool => tool !== '*');
|
|
295
|
+
if (this.getAvailableTools) {
|
|
296
|
+
// Get all available servers (this should be provided by the manager)
|
|
297
|
+
const allServers = this.getAvailableServers();
|
|
298
|
+
for (const serverName of allServers) {
|
|
299
|
+
const tools = this.getAvailableTools(serverName);
|
|
300
|
+
for (const toolName of tools) {
|
|
301
|
+
if (!(serverName === deniedServerName && toolName === deniedToolName)) {
|
|
302
|
+
this.addTool(`@${serverName}/${toolName}`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// Add builtin tools (except denied one)
|
|
307
|
+
const builtinTools = this.getBuiltinTools();
|
|
308
|
+
for (const toolName of builtinTools) {
|
|
309
|
+
if (!(deniedServerName === '' && toolName === deniedToolName)) {
|
|
310
|
+
this.addTool(toolName);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Expand @builtin wildcard to all builtin tools except the denied one
|
|
317
|
+
*/
|
|
318
|
+
expandBuiltinWildcard(deniedToolName) {
|
|
319
|
+
this.agentConfig.tools = this.agentConfig.tools.filter(tool => tool !== '@builtin');
|
|
320
|
+
const builtinTools = this.getBuiltinTools();
|
|
321
|
+
for (const toolName of builtinTools) {
|
|
322
|
+
if (toolName !== deniedToolName) {
|
|
323
|
+
this.addTool(toolName);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Remove pattern wildcards that match the tool and expand them
|
|
329
|
+
*/
|
|
330
|
+
removeMatchingPatternWildcards(serverName, toolName) {
|
|
331
|
+
const toolId = serverName ? `@${serverName}/${toolName}` : toolName;
|
|
332
|
+
const serverPrefix = serverName ? `@${serverName}` : '';
|
|
333
|
+
const toRemove = [];
|
|
334
|
+
for (const tool of this.agentConfig.tools) {
|
|
335
|
+
if (tool.includes('*') || tool.includes('?')) {
|
|
336
|
+
if (serverName && tool.startsWith('@') && !tool.includes('/')) {
|
|
337
|
+
if (this.matchesPattern(serverPrefix, tool)) {
|
|
338
|
+
toRemove.push(tool);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
else if (this.matchesPattern(toolId, tool)) {
|
|
342
|
+
toRemove.push(tool);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
for (const pattern of toRemove) {
|
|
347
|
+
this.expandPatternWildcard(pattern, serverName, toolName);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Expand a pattern wildcard to individual tools except the denied one
|
|
352
|
+
*/
|
|
353
|
+
expandPatternWildcard(pattern, deniedServerName, deniedToolName) {
|
|
354
|
+
this.agentConfig.tools = this.agentConfig.tools.filter(tool => tool !== pattern);
|
|
355
|
+
if (!this.getAvailableTools)
|
|
356
|
+
return;
|
|
357
|
+
if (pattern.startsWith('@') && !pattern.includes('/')) {
|
|
358
|
+
// Server pattern like @*-mcp
|
|
359
|
+
const allServers = this.getAvailableServers();
|
|
360
|
+
for (const serverName of allServers) {
|
|
361
|
+
const serverPrefix = `@${serverName}`;
|
|
362
|
+
if (this.matchesPattern(serverPrefix, pattern)) {
|
|
363
|
+
const tools = this.getAvailableTools(serverName);
|
|
364
|
+
for (const toolName of tools) {
|
|
365
|
+
if (!(serverName === deniedServerName && toolName === deniedToolName)) {
|
|
366
|
+
this.addTool(`@${serverName}/${toolName}`);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
// Tool pattern like @fs/read_*
|
|
374
|
+
const allServers = this.getAvailableServers();
|
|
375
|
+
for (const serverName of allServers) {
|
|
376
|
+
const tools = this.getAvailableTools(serverName);
|
|
377
|
+
for (const toolName of tools) {
|
|
378
|
+
const toolId = `@${serverName}/${toolName}`;
|
|
379
|
+
if (this.matchesPattern(toolId, pattern)) {
|
|
380
|
+
if (!(serverName === deniedServerName && toolName === deniedToolName)) {
|
|
381
|
+
this.addTool(toolId);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Expand allowedTools pattern wildcard except the denied tool
|
|
390
|
+
*/
|
|
391
|
+
expandAllowedPatternWildcard(pattern, deniedServerName, deniedToolName) {
|
|
392
|
+
this.agentConfig.allowedTools = this.agentConfig.allowedTools.filter(tool => tool !== pattern);
|
|
393
|
+
if (!this.getAvailableTools)
|
|
394
|
+
return;
|
|
395
|
+
if (pattern.startsWith('@') && !pattern.includes('/')) {
|
|
396
|
+
// Server pattern like @git
|
|
397
|
+
const allServers = this.getAvailableServers();
|
|
398
|
+
for (const serverName of allServers) {
|
|
399
|
+
const serverPrefix = `@${serverName}`;
|
|
400
|
+
if (this.matchesPattern(serverPrefix, pattern)) {
|
|
401
|
+
const tools = this.getAvailableTools(serverName);
|
|
402
|
+
for (const toolName of tools) {
|
|
403
|
+
if (!(serverName === deniedServerName && toolName === deniedToolName)) {
|
|
404
|
+
this.addToAllowedTools(`@${serverName}/${toolName}`);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
// Tool pattern like @fs/*
|
|
412
|
+
const allServers = this.getAvailableServers();
|
|
413
|
+
for (const serverName of allServers) {
|
|
414
|
+
const tools = this.getAvailableTools(serverName);
|
|
415
|
+
for (const toolName of tools) {
|
|
416
|
+
const toolId = `@${serverName}/${toolName}`;
|
|
417
|
+
if (this.matchesPattern(toolId, pattern)) {
|
|
418
|
+
if (!(serverName === deniedServerName && toolName === deniedToolName)) {
|
|
419
|
+
this.addToAllowedTools(toolId);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Get all available servers
|
|
428
|
+
*/
|
|
429
|
+
getAvailableServers() {
|
|
430
|
+
return this.getAllAvailableServers?.() || [];
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Get all builtin tools
|
|
434
|
+
*/
|
|
435
|
+
getBuiltinTools() {
|
|
436
|
+
return this.getAllBuiltinTools?.() || [];
|
|
437
|
+
}
|
|
182
438
|
/**
|
|
183
439
|
* Get updated agent config
|
|
184
440
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentPermissionManager.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/mcp/agentPermissionManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAA2D;AAE3D;;GAEG;AACH,MAAa,sBAAsB;IACX;IAApB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD;;OAEG;IACK,cAAc,CAAC,QAAgB,EAAE,OAAe;QACpD,6BAA6B;QAC7B,IAAI,OAAO,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAA;QAErC,gCAAgC;QAChC,iDAAiD;QACjD,MAAM,YAAY,GAAG,OAAO;aACvB,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,6BAA6B;aAClE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,yBAAyB;aAC9C,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA,CAAC,6BAA6B;QAEtD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAA;QAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,Q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,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,YAAY,GAAG,CAAC,CAAC,CAAA;QACpG,IAAI,CAAC,WAAW,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,CAChE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,YAAY,GAAG,CAAC,CAC/C,CAAA;QAED,QAAQ,UAAU,EAAE,CAAC;YACjB,KAAK,4BAAiB,CAAC,IAAI;gBACvB,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;gBAC3C,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;gBACvD,MAAK;YAET,KAAK,4BAAiB,CAAC,GAAG;gBACtB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBAC1B,IAAI,CAAC,sBAAsB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;gBACvD,MAAK;YAET,KAAK,4BAAiB,CAAC,WAAW;gBAC9B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;gBAC1B,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;gBACpC,MAAK;QACb,CAAC;IACL,CAAC;IAED;;OAEG;IACH,cAAc;QACV,OAAO,IAAI,CAAC,WAAW,CAAA;IAC3B,CAAC;CACJ;AAxMD,wDAwMC"}
|
|
1
|
+
{"version":3,"file":"agentPermissionManager.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/mcp/agentPermissionManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yCAA2D;AAE3D;;GAEG;AACH,MAAa,sBAAsB;IAEnB;IACA;IACA;IACA;IAJZ,YACY,WAAwB,EACxB,iBAAoD,EACpD,sBAAuC,EACvC,kBAAmC;QAHnC,gBAAW,GAAX,WAAW,CAAa;QACxB,sBAAiB,GA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aAAM,CAAC;YACJ,0BAA0B;YAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAA;YAC7C,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE,CAAC;gBAClC,MAAM,KAAK,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA;gBAChD,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;oBAC3B,MAAM,MAAM,GAAG,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAA;oBAC3C,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;wBACvC,IAAI,CAAC,CAAC,UAAU,KAAK,gBAAgB,IAAI,QAAQ,KAAK,cAAc,CAAC,EAAE,CAAC;4BACpE,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA;wBAClC,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACK,mBAAmB;QACvB,OAAO,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,CAAA;IAChD,CAAC;IAED;;OAEG;IACK,eAAe;QACnB,OAAO,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,CAAA;IAC5C,CAAC;IAED;;OAEG;IACH,cAAc;QACV,OAAO,IAAI,CAAC,WAAW,CAAA;IAC3B,CAAC;CACJ;AA1eD,wDA0eC"}
|
|
@@ -670,8 +670,11 @@ class McpEventHandler {
|
|
|
670
670
|
try {
|
|
671
671
|
if (isEditMode && originalServerName) {
|
|
672
672
|
const serverToRemove = this.#serverNameBeforeUpdate || originalServerName;
|
|
673
|
+
const serverConfig = mcpManager_1.McpManager.instance.getAllServerConfigs().get(serverToRemove);
|
|
674
|
+
const isLegacyMcpServer = serverConfig?.__configPath__?.endsWith('mcp.json') ?? false;
|
|
675
|
+
const configPath = isLegacyMcpServer ? await this.#getMcpConfigPath(isGlobal) : agentPath;
|
|
673
676
|
await mcpManager_1.McpManager.instance.removeServer(serverToRemove);
|
|
674
|
-
await mcpManager_1.McpManager.instance.addServer(serverName, config,
|
|
677
|
+
await mcpManager_1.McpManager.instance.addServer(serverName, config, configPath, isLegacyMcpServer);
|
|
675
678
|
}
|
|
676
679
|
else {
|
|
677
680
|
// Create new server
|
|
@@ -1086,7 +1089,9 @@ class McpEventHandler {
|
|
|
1086
1089
|
enabled: true,
|
|
1087
1090
|
numTools: mcpManager_1.McpManager.instance.getAllToolsWithPermissions(serverName).length,
|
|
1088
1091
|
scope: serverConfig.__configPath__ ===
|
|
1089
|
-
(0, mcpUtils_1.getGlobalAgentConfigPath)(this.#features.workspace.fs.getUserHomeDir())
|
|
1092
|
+
(0, mcpUtils_1.getGlobalAgentConfigPath)(this.#features.workspace.fs.getUserHomeDir()) ||
|
|
1093
|
+
serverConfig.__configPath__ ===
|
|
1094
|
+
(0, mcpUtils_1.getGlobalMcpConfigPath)(this.#features.workspace.fs.getUserHomeDir())
|
|
1090
1095
|
? 'global'
|
|
1091
1096
|
: 'workspace',
|
|
1092
1097
|
transportType: transportType,
|
|
@@ -1110,10 +1115,11 @@ class McpEventHandler {
|
|
|
1110
1115
|
const mcpManager = mcpManager_1.McpManager.instance;
|
|
1111
1116
|
const serverConfigs = mcpManager.getAllServerConfigs();
|
|
1112
1117
|
const activeServers = Array.from(serverConfigs.entries()).filter(([name, _]) => !mcpManager.isServerDisabled(name));
|
|
1113
|
-
// Get the global
|
|
1118
|
+
// Get the global paths
|
|
1114
1119
|
const globalAgentPath = (0, mcpUtils_1.getGlobalAgentConfigPath)(this.#features.workspace.fs.getUserHomeDir());
|
|
1120
|
+
const globalMcpPath = (0, mcpUtils_1.getGlobalMcpConfigPath)(this.#features.workspace.fs.getUserHomeDir());
|
|
1115
1121
|
// Count global vs project servers
|
|
1116
|
-
const globalServers = Array.from(serverConfigs.entries()).filter(([_, config]) => config.__configPath__ === globalAgentPath).length;
|
|
1122
|
+
const globalServers = Array.from(serverConfigs.entries()).filter(([_, config]) => config.__configPath__ === globalAgentPath || config.__configPath__ === globalMcpPath).length;
|
|
1117
1123
|
const projectServers = serverConfigs.size - globalServers;
|
|
1118
1124
|
// Count tools by permission
|
|
1119
1125
|
let toolsAlwaysAllowed = 0;
|
|
@@ -1147,7 +1153,9 @@ class McpEventHandler {
|
|
|
1147
1153
|
url: transportType === TransportType.HTTP ? config.url : undefined,
|
|
1148
1154
|
enabled: enabled,
|
|
1149
1155
|
numTools: mcpManager.getAllToolsWithPermissions(serverName).length,
|
|
1150
|
-
scope: config.__configPath__ === globalAgentPath
|
|
1156
|
+
scope: config.__configPath__ === globalAgentPath || config.__configPath__ === globalMcpPath
|
|
1157
|
+
? 'global'
|
|
1158
|
+
: 'workspace',
|
|
1151
1159
|
transportType: transportType,
|
|
1152
1160
|
languageServerVersion: this.#features.runtime.serverInfo.version,
|
|
1153
1161
|
});
|
|
@@ -1208,6 +1216,34 @@ class McpEventHandler {
|
|
|
1208
1216
|
// Return global path if workspace path doesn't exist or there was an error
|
|
1209
1217
|
return globalAgentPath;
|
|
1210
1218
|
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Gets the appropriate MCP config path, checking workspace path first if it exists
|
|
1221
|
+
* @returns The MCP config path to use (workspace if exists, otherwise global)
|
|
1222
|
+
*/
|
|
1223
|
+
async #getMcpConfigPath(isGlobal = true) {
|
|
1224
|
+
const globalMcpPath = (0, mcpUtils_1.getGlobalMcpConfigPath)(this.#features.workspace.fs.getUserHomeDir());
|
|
1225
|
+
if (isGlobal) {
|
|
1226
|
+
return globalMcpPath;
|
|
1227
|
+
}
|
|
1228
|
+
// Get workspace folders and check for workspace MCP path
|
|
1229
|
+
const workspaceFolders = this.#features.workspace.getAllWorkspaceFolders();
|
|
1230
|
+
if (workspaceFolders && workspaceFolders.length > 0) {
|
|
1231
|
+
const workspacePaths = workspaceFolders.map(folder => folder.uri);
|
|
1232
|
+
const workspaceMcpPaths = (0, mcpUtils_1.getWorkspaceMcpConfigPaths)(workspacePaths);
|
|
1233
|
+
if (Array.isArray(workspaceMcpPaths) && workspaceMcpPaths.length > 0) {
|
|
1234
|
+
try {
|
|
1235
|
+
// Convert URI format to filesystem path if needed using the utility function
|
|
1236
|
+
const mcpPath = (0, mcpUtils_1.normalizePathFromUri)(workspaceMcpPaths[0], this.#features.logging);
|
|
1237
|
+
return mcpPath;
|
|
1238
|
+
}
|
|
1239
|
+
catch (e) {
|
|
1240
|
+
this.#features.logging.warn(`Failed to check if workspace MCP path exists: ${e}`);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
// Return global path if workspace path doesn't exist or there was an error
|
|
1245
|
+
return globalMcpPath;
|
|
1246
|
+
}
|
|
1211
1247
|
/**
|
|
1212
1248
|
* Processes permission updates from the UI
|
|
1213
1249
|
*/
|
|
@@ -1271,12 +1307,13 @@ class McpEventHandler {
|
|
|
1271
1307
|
catch (e) {
|
|
1272
1308
|
this.#features.logging.warn(`Failed to get user home directory: ${e}`);
|
|
1273
1309
|
}
|
|
1274
|
-
//
|
|
1310
|
+
// Watch both agent config files and MCP config files
|
|
1275
1311
|
const agentPaths = [
|
|
1276
1312
|
...(0, mcpUtils_1.getWorkspaceAgentConfigPaths)(wsUris),
|
|
1277
1313
|
...(homeDir ? [(0, mcpUtils_1.getGlobalAgentConfigPath)(homeDir)] : []),
|
|
1278
1314
|
];
|
|
1279
|
-
const
|
|
1315
|
+
const mcpPaths = [...(0, mcpUtils_1.getWorkspaceMcpConfigPaths)(wsUris), ...(homeDir ? [(0, mcpUtils_1.getGlobalMcpConfigPath)(homeDir)] : [])];
|
|
1316
|
+
const allPaths = [...agentPaths, ...mcpPaths];
|
|
1280
1317
|
this.#fileWatcher.watchPaths(allPaths, () => {
|
|
1281
1318
|
// Store the current programmatic state when the event is triggered
|
|
1282
1319
|
this.#lastProgrammaticState = this.#isProgrammaticChange;
|