fix(prompt-size): respect enabled/disabled toolsets per platform

The `hermes prompt-size` command now uses `_get_platform_tools()` to resolve
platform-specific toolsets the same way the gateway does, and also honors
`agent.disabled_toolsets` from config. This fixes the discrepancy where
`prompt-size` reported more tools than actually available in real sessions
for a given platform.

Fixes #41445.
This commit is contained in:
EdderTalmor 2026-06-07 18:54:33 -04:00 committed by Teknium
parent 6d359e0681
commit fe8d02cec7

View file

@ -34,11 +34,17 @@ def _build_inspection_agent(platform: str) -> Any:
"""
from run_agent import AIAgent
from hermes_cli.config import load_config
from hermes_cli.tools_config import _get_platform_tools
cfg = load_config()
model_cfg = cfg.get("model", {}) if isinstance(cfg.get("model"), dict) else {}
model = model_cfg.get("default") or model_cfg.get("model") or ""
# Resolve platform-specific toolsets the same way the gateway does.
enabled_toolsets = sorted(_get_platform_tools(cfg, platform))
agent_cfg = cfg.get("agent") or {}
disabled_toolsets = agent_cfg.get("disabled_toolsets") or None
return AIAgent(
model=model,
api_key="inspect-only",
@ -46,6 +52,8 @@ def _build_inspection_agent(platform: str) -> Any:
quiet_mode=True,
save_trajectories=False,
platform=platform,
enabled_toolsets=enabled_toolsets,
disabled_toolsets=disabled_toolsets,
)