@@ -229,16 +229,14 @@ export function resolveEmbeddedAttemptToolConstructionPlan(params: {
229229 } ;
230230}
231231
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 {
242240 if ( ! params . toolsEnabled || params . disableTools === true ) {
243241 return false ;
244242 }
@@ -251,8 +249,20 @@ export function shouldCreateBundleMcpRuntimeForAttempt(params: {
251249 if ( hasWildcardToolAllowlist ( params . toolsAllow ) ) {
252250 return true ;
253251 }
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 ) => {
256266 return isBundleMcpAllowlistName ( normalized ) || isPluginGroupAllowlistName ( normalized ) ;
257267 } ) ;
258268}
@@ -267,20 +277,7 @@ export function shouldCreateBundleLspRuntimeForAttempt(params: {
267277 disableTools ?: boolean ;
268278 toolsAllow ?: string [ ] ;
269279} ) : 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 ) => {
284281 return normalized . startsWith ( "lsp_" ) ;
285282 } ) ;
286283}
0 commit comments