Add skill enable controls and data factory SQL skill

This commit is contained in:
武阳
2026-05-08 14:56:32 +08:00
parent 046b0eeab0
commit bd2f260b9f
16 changed files with 1167 additions and 25 deletions
+13
View File
@@ -20,6 +20,11 @@ if TYPE_CHECKING:
from .agent_runtime import LocalCodingAgent
ALWAYS_ENABLED_HIDDEN_SKILL_NAMES = frozenset(
{'update-config', 'verify', 'simplify', 'debug'}
)
@dataclass(frozen=True)
class BundledSkill:
"""A bundled skill definition."""
@@ -265,6 +270,7 @@ def find_bundled_skill(name: str, cwd: Path | str | None = None) -> BundledSkill
def format_skills_for_system_prompt(
max_chars: int = 8000,
cwd: Path | str | None = None,
enabled_skill_names: tuple[str, ...] | set[str] | None = None,
) -> str:
"""Format bundled skills for inclusion in system-reminder messages.
@@ -272,10 +278,17 @@ def format_skills_for_system_prompt(
"""
lines = ['Available skills (invoke via Skill tool):']
char_count = len(lines[0])
enabled_names = (
{name.strip().lower() for name in enabled_skill_names if name.strip()}
if enabled_skill_names is not None
else None
)
for skill in get_bundled_skills(cwd):
if not skill.user_invocable:
continue
if enabled_names is not None and skill.name.lower() not in enabled_names:
continue
entry = f'- {skill.name}: {skill.description}'
if skill.when_to_use:
entry += f' When to use: {skill.when_to_use}'