@@ -229,16 +229,14 @@ export function resolveEmbeddedAttemptToolConstructionPlan(params: {
|
229 | 229 | }; |
230 | 230 | } |
231 | 231 | |
232 | | -/** |
233 | | - * Decides whether the bundled MCP runtime is needed for this attempt. Bundle |
234 | | - * runtime creation follows explicit bundle/plugin allowlist names rather than |
235 | | - * generic local tool names. |
236 | | - */ |
237 | | -export function shouldCreateBundleMcpRuntimeForAttempt(params: { |
238 | | -toolsEnabled: boolean; |
239 | | -disableTools?: boolean; |
240 | | -toolsAllow?: string[]; |
241 | | -}): boolean { |
| 232 | +function shouldCreateBundleRuntimeForAttempt( |
| 233 | +params: { |
| 234 | +toolsEnabled: boolean; |
| 235 | +disableTools?: boolean; |
| 236 | +toolsAllow?: string[]; |
| 237 | +}, |
| 238 | +matchesAllowlist: (normalizedToolName: string) => boolean, |
| 239 | +): boolean { |
242 | 240 | if (!params.toolsEnabled || params.disableTools === true) { |
243 | 241 | return false; |
244 | 242 | } |
@@ -251,8 +249,20 @@ export function shouldCreateBundleMcpRuntimeForAttempt(params: {
|
251 | 249 | if (hasWildcardToolAllowlist(params.toolsAllow)) { |
252 | 250 | return true; |
253 | 251 | } |
254 | | -return params.toolsAllow.some((toolName) => { |
255 | | -const normalized = normalizeToolName(toolName); |
| 252 | +return params.toolsAllow.some((toolName) => matchesAllowlist(normalizeToolName(toolName))); |
| 253 | +} |
| 254 | + |
| 255 | +/** |
| 256 | + * Decides whether the bundled MCP runtime is needed for this attempt. Bundle |
| 257 | + * runtime creation follows explicit bundle/plugin allowlist names rather than |
| 258 | + * generic local tool names. |
| 259 | + */ |
| 260 | +export function shouldCreateBundleMcpRuntimeForAttempt(params: { |
| 261 | +toolsEnabled: boolean; |
| 262 | +disableTools?: boolean; |
| 263 | +toolsAllow?: string[]; |
| 264 | +}): boolean { |
| 265 | +return shouldCreateBundleRuntimeForAttempt(params, (normalized) => { |
256 | 266 | return isBundleMcpAllowlistName(normalized) || isPluginGroupAllowlistName(normalized); |
257 | 267 | }); |
258 | 268 | } |
@@ -267,20 +277,7 @@ export function shouldCreateBundleLspRuntimeForAttempt(params: {
|
267 | 277 | disableTools?: boolean; |
268 | 278 | toolsAllow?: string[]; |
269 | 279 | }): boolean { |
270 | | -if (!params.toolsEnabled || params.disableTools === true) { |
271 | | -return false; |
272 | | -} |
273 | | -if (!params.toolsAllow) { |
274 | | -return true; |
275 | | -} |
276 | | -if (params.toolsAllow.length === 0) { |
277 | | -return false; |
278 | | -} |
279 | | -if (hasWildcardToolAllowlist(params.toolsAllow)) { |
280 | | -return true; |
281 | | -} |
282 | | -return params.toolsAllow.some((toolName) => { |
283 | | -const normalized = normalizeToolName(toolName); |
| 280 | +return shouldCreateBundleRuntimeForAttempt(params, (normalized) => { |
284 | 281 | return normalized.startsWith("lsp_"); |
285 | 282 | }); |
286 | 283 | } |