feat: dynamic toolset generation for plugin platforms
Plugin platforms now get full toolset support without any entries in toolsets.py. tools_config._get_platform_tools(): Falls back to 'hermes-<name>' when the platform isn't in the static PLATFORMS dict. No more KeyError for plugin platforms. toolsets.resolve_toolset(): Auto-generates a toolset for plugin platforms (hermes-<name>) containing _HERMES_CORE_TOOLS plus any tools the plugin registered into a matching toolset name. This means a plugin can call ctx.register_tool(toolset='irc', ...) and those tools will be included in the hermes-irc toolset automatically. webhook.py: Registry-aware cross-platform delivery. run_agent.py: Platform hints from plugin registry. IRC adapter: Token lock + platform hint. Removed dead token-empty-warning extension. Updated docs.
This commit is contained in:
21
toolsets.py
21
toolsets.py
@ -564,6 +564,27 @@ def resolve_toolset(name: str, visited: Set[str] = None) -> List[str]:
|
||||
# Get toolset definition
|
||||
toolset = get_toolset(name)
|
||||
if not toolset:
|
||||
# Auto-generate a toolset for plugin platforms (hermes-<name>).
|
||||
# Gives them _HERMES_CORE_TOOLS plus any tools the plugin registered
|
||||
# into a toolset matching the platform name.
|
||||
if name.startswith("hermes-"):
|
||||
platform_name = name[len("hermes-"):]
|
||||
try:
|
||||
from gateway.platform_registry import platform_registry
|
||||
if platform_registry.is_registered(platform_name):
|
||||
plugin_tools = set(_HERMES_CORE_TOOLS)
|
||||
try:
|
||||
from tools.registry import registry
|
||||
plugin_tools.update(
|
||||
e.name for e in registry._tools.values()
|
||||
if e.toolset == platform_name
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return list(plugin_tools)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return []
|
||||
|
||||
# Collect direct tools
|
||||
|
||||
Reference in New Issue
Block a user