OUTPUT #1008 | 6557 karakter | 140 satır
========== YENİ KOMUT | 23.09.2026 02:26:21 ==========


========== YENİ KOMUT | 23.09.2026 02:26:21 ==========

            return
        try:
            from hermes_cli.config import load_config
            secrets = (load_config() or {}).get("secrets") or {}
        except Exception:
            secrets = {}

        def _enabled(source) -> bool:
            section = secrets.get(getattr(source, "name", ""))
            try:
                return bool(source.is_enabled(section if isinstance(section, dict) else {}))
            except Exception:
                return False  # mirrors the orchestrator: a raising is_enabled() is skipped

        enabled_names = [getattr(s, "name", "") for s in plugin_sources if _enabled(s)]
        if not enabled_names:
            return
        try:
            reset_secret_source_cache()
            load_hermes_dotenv()
            logger.debug("Re-applied secret sources after plugin discovery for: %s",
                         ", ".join(sorted(enabled_names)))
        except Exception as exc:
            logger.debug("secret source re-apply after discovery failed: %s", exc)

    def _discover_and_load_inner(self) -> None:
        """The actual discovery sweep — see :meth:`discover_and_load`."""
        manifests: List[PluginManifest] = self._collect_directory_manifests()
        # Entry points are separate from the directory scan: the startup MCP probe must not import
        # or register them.
        ep_manifests = self._scan_entry_points()
        logger.debug("  entrypoints: %d manifest(s)", len(ep_manifests))
        manifests.extend(ep_manifests)
        disabled = _get_disabled_plugins()
        enabled = _get_enabled_plugins()  # None = opt-in default (nothing enabled)
        stale_relay_keys = legacy_relay_plugin_keys(enabled)
        if stale_relay_keys:
            logger.warning("Removed Hermes plugin %s is still listed in plugins.enabled; "
                           "remove it and configure native Relay plugins with %s",
                           ", ".join(stale_relay_keys), RELAY_PLUGINS_CONFIG_ENV)
        # Later sources win on key collision (project > user > bundled); gate the winners, then
        # load survivors in requires_plugins order (see resolve_plugin_load_order).
        winners = {manifest_key(m): m for m in manifests}
        to_load = {k: m for k, m in winners.items() if self._gate_manifest(m, disabled, enabled)}
        for lookup_key in resolve_plugin_load_order(to_load):
            manifest = to_load[lookup_key]
            self._warn_python_dependencies(manifest)
            self._validate_plugin_config_schema(manifest)
            self._load_plugin(manifest)
        if manifests:
            logger.info("Plugin discovery complete: %d found, %d enabled", len(self._plugins),
                        sum(1 for p in self._plugins.values() if p.enabled))
        self._refresh_plugin_compat_report(list(to_load.values()))

    def _refresh_plugin_compat_report(self, manifests: List[PluginManifest]) -> None:
        """Refresh HERMES_HOME/.plugin-compat-report.json from this discovery pass (hermes_cli.plugin_compat).

        The Desktop boot modal has no Python runtime of its own and reads that file after the ``serve``
        backend is up, so the scan must run wherever plugins are discovered — not only under the CLI
        banner / doctor / update, which never run inside the Desktop's backend. Fail-open: never raises.
        """
        try:
            from hermes_cli.plugin_compat import compat_report
            compat_report(manifests, force=True)
        except Exception as exc:
            logger.debug("plugin compat report refresh skipped: %s", exc)

    def _gate_manifest(
        self, manifest: PluginManifest, disabled: Set[str], enabled: Optional[Set[str]],
    ) -> bool:
        """Route one winning manifest per :func:`gate_manifest`: load now, defer, or record as
        skipped (introspection-only placeholder). Returns True only for plugins that go through the
        dependency-ordered load pass."""
        verdict = gate_manifest(manifest, disabled, enabled)
        if verdict.action == "load":
            return True
        if verdict.action == "load_now":
            self._load_plugin(manifest)
        elif verdict.action == "defer":
            self._register_deferred_platform(manifest)
        else:
            self._plugins[manifest_key(manifest)] = LoadedPlugin(
                manifest=manifest, enabled=verdict.enabled, error=verdict.error)
        if verdict.log:
            logger.log(*verdict.log)
        return False

    def register_approval_transport(self, name: str, present_fn: Callable, *, plugin_id: str) -> None:
        """Manager-level registration (public API kept for out-of-tree plugins); the PluginContext
        method is the tracked path plugins normally use. Same validation, no unload tracking."""
        from hermes_cli.approval_transport import RegisteredApprovalTransport
        clean = str(name).strip().lower()
        if clean == "builtin":
            raise ValueError("approval transport name 'builtin' is reserved")
        if not re.fullmatch(r"[a-z0-9][a-z0-9_-]{0,63}", clean):
            raise ValueError("approval transport name must match [a-z0-9][a-z0-9_-]{0,63}")
        if not callable(present_fn):
            raise TypeError("approval transport present_fn must be callable")
        if clean in self._approval_transports:
            owner = self._approval_transports[clean].plugin_id
            raise ValueError(f"approval transport {clean!r} is already registered by {owner!r}")
---CONFIG PLUGINS---
163-  destructive_slash_confirm: false
164-command_allowlist:
165-- script execution via heredoc
166-- script execution via -e/-c flag
167-- execute_code
168:plugins:
169-  enabled: []
170-  disabled:
171-  - shorts-production-guard
172-  entries:
173-    shorts-production-guard:
174-      allow_tool_override: false
175-kanban:
176-  review_dispatch: true
177-code_execution:
178-  timeout: 300
179-  max_tool_calls: 50
180-streaming:
181-  enabled: false
182-onboarding:
183-  seen:
184-    tool_progress_prompt: true
185-telemetry:
186-  shared_metrics:
187-    enabled: false
188-updates:
189-  pre_update_backup: false
190-  backup_keep: 5
191-  non_interactive_local_changes: stash
192-computer_use:
193-  backend: cua
root@213-238-170-219:/home/hermes/.hermes/hermes-agent#