diff --git a/hermes_cli/plugins.py b/hermes_cli/plugins.py index b7dd1af972..7c4a7bc980 100644 --- a/hermes_cli/plugins.py +++ b/hermes_cli/plugins.py @@ -43,21 +43,12 @@ from hermes_cli.plugins_manifest import ( # noqa: F401 — re-exported parse_manifest_file, portable_plugin_manifest, _CONFIG_SCHEMA_TYPES, - _KNOWN_MANIFEST_FIELDS, - _VALID_PLUGIN_KINDS, SUPPORTED_MANIFEST_VERSION, PluginManifest, - _detect_kind_from_source, - _display_author, - _manifest_field_of_type, - _parse_manifest_v2_fields, _portable_skill_namespace, - _read_source_from_origin, - _resolve_module_source, resolve_module_origin, resolve_plugin_load_order, validate_config_schema, - yaml, ) from hermes_cli.plugins_discovery import ( # noqa: F401 — re-exported collect_directory_manifests, @@ -65,10 +56,8 @@ from hermes_cli.plugins_discovery import ( # noqa: F401 — re-exported scan_directory, ENTRY_POINT_CAPABILITIES_GROUP, ENTRY_POINTS_GROUP, - _classify_entrypoint_value_kind, _get_disabled_plugins, _get_enabled_plugins, - _select_entry_point_group, discover_entrypoint_manifests, ) from hermes_cli.plugins_loader import ( # noqa: F401 — re-exported @@ -82,9 +71,6 @@ from hermes_cli.plugins_loader import ( # noqa: F401 — re-exported ) from hermes_cli.plugins_dispatch import ( # noqa: F401 — re-exported PluginDispatchMixin, - _HOOK_TIMEOUT_BOUNDED_HOOKS, - _HOOK_TIMEOUT_FAIL_CLOSED_HOOKS, - _HOOK_CALLER_THREAD_HOOKS, _HOOK_TIMEOUT_SUPPRESSION_SECONDS, _PRE_TOOL_CALL_TIMEOUT_BLOCK_MESSAGE, SYSTEM_PROMPT_SECTION_POSITIONS, @@ -92,8 +78,6 @@ from hermes_cli.plugins_dispatch import ( # noqa: F401 — re-exported MAX_SYSTEM_PROMPT_SECTION_CHARS, MAX_SYSTEM_PROMPT_SECTIONS, MAX_SYSTEM_PROMPT_SECTIONS_TOTAL_CHARS, - _SYSTEM_PROMPT_SECTION_ID_RE, - _SYSTEM_PROMPT_SECTION_HEADING_PREFIX, PLUGIN_SECTIONS_START, PLUGIN_SECTIONS_END, is_valid_system_prompt_section_id, @@ -102,35 +86,22 @@ from hermes_cli.plugins_dispatch import ( # noqa: F401 — re-exported HERMES_EVENT_NAMESPACE, _EVENT_EMIT_DEPTH_CAP, _EVENT_PENDING_CAP, - _EVENT_WORKER_STOP, PluginSystemPromptSection, RenderedPluginSystemPromptSection, _EventSubscription, - _QueuedPluginEvent, _HOOK_CALLBACK_TIMEOUT_SECS, - _HOOK_SKIPPED, _MAX_HOOK_CALLBACK_TIMEOUT_SECS, - _hook_uses_callback_timeout, - _pre_tool_call_timeout_block, ) from hermes_cli.plugins_ledger import ( # noqa: F401 — re-exported PluginLedgerMixin, PluginRegistration, ) from hermes_cli.plugins_state import ( # noqa: F401 — re-exported - _PLUGIN_SETTING_RESERVED_ROOTS, - _PLUGIN_SETTING_SEGMENT_RE, - _PLUGIN_STATE_KEY_RE, - _PLUGIN_STATE_LOCKS, - _PLUGIN_STATE_LOCKS_GUARD, - _PLUGIN_STATE_QUOTA_BYTES, PluginState, _locked_plugin_state, _nested_plugin_mapping, _nested_plugin_value, - _plugin_data_namespace, _plugin_relative_segments, - _state_thread_lock, ) @@ -320,7 +291,6 @@ class PluginContext: logger.warning("Rejected config path %r from plugin %s", key, self.plugin_id) raise from hermes_cli.config import load_config_readonly - config = load_config_readonly() or {} plugins = config.get("plugins") if isinstance(config, Mapping) else None entries = plugins.get("entries") if isinstance(plugins, Mapping) else None @@ -341,11 +311,9 @@ class PluginContext: logger.warning("Rejected config path %r from plugin %s", key, self.plugin_id) raise from hermes_cli import config as config_mod - if config_mod.is_managed(): raise PermissionError("Plugin settings cannot be changed in a managed install") from hermes_cli import managed_scope - dotted_path = ".".join(("plugins", "entries", self.plugin_id, "settings", *segments)) if managed_scope.is_key_managed(dotted_path): raise PermissionError(f"Plugin setting {dotted_path!r} is administrator-managed") @@ -567,7 +535,6 @@ class PluginContext: ) from tools.registry import registry - scope = self._manager.scope_key previous = registry.snapshot_registration(name, scope=scope) effective = registry.get_entry(name, scope=scope) @@ -637,7 +604,6 @@ class PluginContext: timeout = max(1.0, min(timeout, 600.0)) from tools.mcp_tool import _make_tool_handler - handler = _make_tool_handler(server, tool, timeout) raw = handler(dict(arguments or {})) @@ -841,7 +807,6 @@ class PluginContext: """Dispatch a tool call through the registry with the parent agent (when available) resolved automatically; returns the handler's JSON string. ``kwargs`` forward to dispatch.""" from tools.registry import registry - # In gateway mode _cli_ref is None — tools degrade gracefully (no spinner, TERMINAL_CWD). if "parent_agent" not in kwargs: cli = self._manager._cli_ref @@ -885,7 +850,6 @@ class PluginContext: from agent.context_references import ( ContextReferenceProvider as _CRP, register_context_reference_provider as _register, ) - if self._wrong_type(provider, _CRP, "context reference provider"): return try: @@ -904,7 +868,6 @@ class PluginContext: ``memory.provider``; a provider reaching here was loaded by the general manager, and without this method its ``register()`` would fail on a missing attribute.""" from agent.memory_provider import MemoryProvider - if self._wrong_type(provider, MemoryProvider, "memory provider"): return self._memory_provider = provider @@ -922,7 +885,6 @@ class PluginContext: from hermes_cli.dashboard_auth.registry import ( register_global_provider, unregister_global_provider, ) - if self._wrong_type(provider, DashboardAuthProvider, "dashboard-auth provider"): return registry_name = provider.name @@ -963,7 +925,6 @@ class PluginContext: unknown keys raise TypeError. """ from gateway.platform_registry import platform_registry, PlatformEntry - entry_kwargs.setdefault("plugin_name", self.manifest.name) entry = PlatformEntry( name=name, label=label, adapter_factory=adapter_factory, check_fn=check_fn, @@ -1062,7 +1023,6 @@ class PluginContext: ) from hermes_cli.main import _AUX_TASKS as _BUILTIN_AUX_TASKS - builtin_keys = {k for k, _name, _desc in _BUILTIN_AUX_TASKS} if key in builtin_keys: raise ValueError( @@ -1109,7 +1069,6 @@ class PluginContext: invalid entries warn and are skipped. """ from agent.redact import register_redaction_patterns as _register - try: count = _register(patterns, source=f"plugin:{self.manifest.name}") except Exception as exc: @@ -1238,7 +1197,6 @@ class PluginContext: Not in ``~/.hermes/skills/`` nor ```` — explicit loads only. Raises ``ValueError`` (``':'``/invalid chars) or ``FileNotFoundError``.""" from agent.skill_utils import _NAMESPACE_RE - if ":" in name: raise ValueError( f"Skill name '{name}' must not contain ':' " @@ -1633,7 +1591,6 @@ class PluginManager(PluginLoaderMixin, PluginDispatchMixin, PluginLedgerMixin): ) -> None: """Register one plugin-owned approval transport for this profile.""" from hermes_cli.approval_transport import RegisteredApprovalTransport - clean = str(name).strip().lower() if clean == "builtin": raise ValueError("approval transport name 'builtin' is reserved") @@ -2087,7 +2044,6 @@ def _get_pre_tool_call_directive_details( return _PreToolCallDirective(action="block", message=fmt.format(tool_name=tool_name)) from hermes_cli.lifecycle import invoke_hook as invoke_lifecycle_hook - hook_results = invoke_lifecycle_hook( "pre_tool_call", tool_name=tool_name, args=args if isinstance(args, dict) else {}, task_id=task_id, session_id=session_id, tool_call_id=tool_call_id, turn_id=turn_id, @@ -2242,7 +2198,6 @@ def get_plugin_error_classification( ``None``. Privacy: ``error_message``/``error_body`` may be unredacted. """ from agent.error_classifier import FailoverReason - hook_results = invoke_hook( "transform_api_error_classification", provider=provider, model=model, status_code=status_code, error_type=error_type, error_code=error_code, diff --git a/hermes_cli/plugins_discovery.py b/hermes_cli/plugins_discovery.py index 7e1ea680b6..a5c8b54caa 100644 --- a/hermes_cli/plugins_discovery.py +++ b/hermes_cli/plugins_discovery.py @@ -166,7 +166,6 @@ def collect_directory_manifests() -> List[PluginManifest]: opt-in project) without loading or mutating anything, so startup probes share the exact precedence/containment rules of the real discovery sweep.""" from hermes_cli import plugins as _origin # patched names resolve through the origin - manifests: List[PluginManifest] = [] # Excluded bundled top-level categories have their own discovery; platforms scan separately. repo_plugins = _origin.get_bundled_plugins_dir() diff --git a/hermes_cli/plugins_dispatch.py b/hermes_cli/plugins_dispatch.py index 93b4c1b2d3..f19a5a0e85 100644 --- a/hermes_cli/plugins_dispatch.py +++ b/hermes_cli/plugins_dispatch.py @@ -215,7 +215,6 @@ class PluginDispatchMixin: return ``{"context": "..."}`` (or a plain string) to inject into the turn. """ from hermes_cli.plugins import _resolve_hook_callback_timeout - # Gateway platform events define event-local envelopes; a bus-wide version here would turn # unrelated adapter payloads into one monolithic compatibility contract. if hook_name != "gateway_platform_event": @@ -359,7 +358,6 @@ class PluginDispatchMixin: def _deliver_event(self, item: _QueuedPluginEvent) -> None: """Deliver one queued event on the host-owned worker thread.""" from hermes_cli.plugins import resolve_plugin_command_result - with self._event_lock: if item.generation != self._event_generation: return diff --git a/hermes_cli/plugins_ledger.py b/hermes_cli/plugins_ledger.py index b4fb4bd3b8..33139828fb 100644 --- a/hermes_cli/plugins_ledger.py +++ b/hermes_cli/plugins_ledger.py @@ -189,7 +189,6 @@ class PluginLedgerMixin: def _dispose_registrations(self, registrations: List[PluginRegistration]) -> None: """Dispose registrations in reverse acquisition order, best effort.""" from hermes_cli.plugins import _PLUGINS_DEBUG - for registration in reversed(registrations): try: registration.dispose() @@ -202,7 +201,6 @@ class PluginLedgerMixin: @staticmethod def _resolve_plugin_key(plugin: Union[str, PluginManifest, LoadedPlugin]) -> str: from hermes_cli.plugins import LoadedPlugin - if isinstance(plugin, LoadedPlugin): return manifest_key(plugin.manifest) if isinstance(plugin, PluginManifest): @@ -264,7 +262,6 @@ class PluginLedgerMixin: # without a ledger entry (pre-ledger or manually set state) are swept here so they do not # survive a force reload as zombies. from gateway.platform_registry import platform_registry - for platform_name in tuple(self._plugin_platform_names): platform_registry.unregister(platform_name) # Ledger-owned tool names are excluded: their handles already restored the previous entry, diff --git a/hermes_cli/plugins_loader.py b/hermes_cli/plugins_loader.py index 8671ab9d21..6b26502f96 100644 --- a/hermes_cli/plugins_loader.py +++ b/hermes_cli/plugins_loader.py @@ -85,7 +85,6 @@ class PluginLoaderMixin: ``platform_registry`` is first asked for it; a placeholder ``LoadedPlugin`` keeps it visible in ``hermes plugins list`` until then.""" from hermes_cli.plugins import LoadedPlugin - lookup_key = manifest_key(manifest) platform_name = self._platform_name_from_manifest(manifest) @@ -141,7 +140,6 @@ class PluginLoaderMixin: ``tools`` submodule so ``__init__`` stays import-light. """ from hermes_cli.plugins import PluginContext, _PLUGINS_DEBUG - if not manifest.provides_tools: return @@ -264,7 +262,6 @@ class PluginLoaderMixin: def _load_plugin_scoped(self, manifest: PluginManifest) -> None: """Load one plugin with the manager's home bound as current.""" from hermes_cli.plugins import LoadedPlugin, PluginContext, _PLUGINS_DEBUG - loaded = LoadedPlugin(manifest=manifest) logger.debug( "Loading plugin '%s' (source=%s, kind=%s, path=%s)", @@ -324,7 +321,6 @@ class PluginLoaderMixin: from hermes_cli.plugins import PluginContext from tools.registry import registry as _registry - with replacement_coordinator.transaction(): previous_policy = _registry.snapshot_plugin_override_policy( module_name, scope=self.scope_key @@ -377,7 +373,6 @@ class PluginLoaderMixin: def _load_portable_plugin(self, manifest: PluginManifest, loaded: LoadedPlugin) -> None: """Load validated portable components without importing Python code.""" from hermes_cli.plugins import PluginContext - lookup_key = manifest_key(manifest) try: from hermes_cli.agent_plugins import load_agent_plugin diff --git a/hermes_cli/plugins_manifest.py b/hermes_cli/plugins_manifest.py index bab47297a8..d2b0e5e2ce 100644 --- a/hermes_cli/plugins_manifest.py +++ b/hermes_cli/plugins_manifest.py @@ -26,7 +26,6 @@ logger = logging.getLogger("hermes_cli.plugins") def _plugins_debug() -> bool: from hermes_cli import plugins as _origin - return _origin._PLUGINS_DEBUG @@ -226,7 +225,6 @@ def resolve_plugin_load_order(manifests: Mapping[str, "PluginManifest"]) -> List but never removes the dependent plugin (loads never hard-fail on advisory deps). """ import graphlib - keys = sorted(manifests.keys()) by_name: Dict[str, str] = {} for k in keys: @@ -410,7 +408,6 @@ class PluginManifest: def portable_plugin_manifest(child: Path, source: str, prefix: str) -> PluginManifest: """Build the manifest for a portable Agent Plugin directory (``plugin.json``); diagnostics warn.""" from hermes_cli.agent_plugins import read_agent_plugin_manifest - data, diagnostics = read_agent_plugin_manifest(child) for diagnostic in diagnostics: logger.warning("Agent Plugin '%s': %s", child, diagnostic.message)