fix(delegate): retain composite child toolsets

This commit is contained in:
KoNit-K
2026-09-15 16:13:14 +08:00
committed by Teknium
parent ae5666f7fc
commit 3d4c4cc24d
2 changed files with 14 additions and 3 deletions
+5 -2
View File
@@ -5,7 +5,7 @@ from __future__ import annotations
import logging
from typing import List, Optional
from toolsets import TOOLSETS
from toolsets import TOOLSETS, resolve_toolset
from tools.delegate_tool_config import _get_inherit_mcp_toolsets
logger = logging.getLogger("tools.delegate_tool") # log-record parity with the origin module
@@ -51,7 +51,10 @@ def _strip_blocked_tools(toolsets: List[str]) -> List[str]:
"""Remove toolsets whose tools are ALL blocked (derived from DELEGATE_BLOCKED_TOOLS so the two can't drift) plus
composite toolsets children must never get (``delegation``, ``kanban``)."""
blocked_toolset_names = {"delegation", "kanban"} | {
name for name, defn in TOOLSETS.items() if all(t in DELEGATE_BLOCKED_TOOLS for t in defn.get("tools", []))
name
for name in TOOLSETS
if (resolved_tools := resolve_toolset(name, include_registry=False))
and all(tool in DELEGATE_BLOCKED_TOOLS for tool in resolved_tools)
}
return [t for t in toolsets if t not in blocked_toolset_names]