Delete the in-tree model-provider plugins plugins/model-providers/copilot/ (provider `copilot`: Copilot API via the GitHub->Copilot token exchange) and plugins/model-providers/copilot-acp/ (provider `copilot-acp`: Copilot CLI over ACP). Both ship as ONE plugin, `github-copilot`, in NousResearch/hermes-labs-plugins; the LEFT_CORE row added before this commit installs it for every profile that routes through copilot/copilot-acp, and every "unknown provider" surface names `hermes plugins install github-copilot`. Core keeps no Copilot code: the generic seams the plugins fill stay, and agent/copilot_acp_client.py stays as the deprecated alias the kimchi-acp catalog plugin subclasses (agent.acp_client.ACPClient is the public base). This commit is revertible on its own: reverting it restores the bundled providers (the labs plugin stays inert on a core that bundles them). Test files that only tested the plugins move to the labs plugin's tests: tests/plugins/model_providers/test_copilot_acp_client.py tests/plugins/model_providers/test_copilot_acp_deprecation.py tests/plugins/model_providers/test_copilot_auth.py tests/plugins/model_providers/test_copilot_catalog_oauth_fallback.py tests/plugins/model_providers/test_copilot_context.py tests/plugins/model_providers/test_copilot_custom_model_ids.py tests/plugins/model_providers/test_copilot_hosts.py tests/plugins/model_providers/test_copilot_pool_exchange.py tests/plugins/model_providers/test_copilot_profile.py tests/plugins/model_providers/test_copilot_refresh_notice.py tests/plugins/model_providers/test_copilot_setup.py tests/plugins/model_providers/test_copilot_token_exchange.py tests/agent/test_copilot_initiator.py tests/agent/test_copilot_native_vision_headers.py tests/hermes_cli/test_copilot_in_model_list.py tests/hermes_cli/test_copilot_model_api_mode.py tests/hermes_cli/test_copilot_runtime_api_mode.py tests/hermes_cli/test_copilot_runtime_api_mode_stale.py tests/hermes_cli/test_model_switch_copilot_api_mode.py tests/e2e/core/providers/test_native_copilot_acp.py tests/e2e/core/providers/test_native_copilot_acp_errors.py tests/e2e/core/providers/test_native_copilot_acp_streaming.py tests/fakes/providers/copilot_acp.py Copilot-behaviour cases extracted from generic test files (same move): test_credential_pool (Copilot pool seeding / gh / env suppression), test_reasoning_carriers (Copilot carriers), test_run_agent (Copilot gpt-5 reasoning, xhigh), test_run_agent_codex_responses (Copilot 401 refresh), test_codex_transport (Copilot reasoning), test_auxiliary_main_first (vision headers), test_private_credential_writers (JWT store row), test_provider_client_seam (copilot-acp client), test_provider_wire_snapshot + its fixture (copilot / github-models cells), test_api_key_providers, test_auth_commands, test_credential_pool_off_loop (exchange single-flight), test_external_process_auth_status (Copilot CLI token stores), test_external_process_provider_seam, test_model_cache_fallback_rows, test_model_validation, test_models_relay_base_url (copilot row), test_multiplex_cli_cache_scope, test_provider_catalog, test_cold_start_gil_stall. Tests that used Copilot only as an example provider now use a fake ProviderProfile (or another in-tree provider) with the same assertions: test_auxiliary_client, test_auxiliary_named_custom_providers, test_init_fallback_on_exhausted_pool, test_intent_ack_continuation, test_models_dev, test_turn_retry_state, test_one_turn_route_publish, test_mcp_catalog_env_boundary, test_plugin_provider_picker_residue, test_delegate_external_provider, test_delegation_profile_route, test_overlay_slug_resolution, test_installed_plugin_discovery, plus the generic halves of test_run_agent_codex_responses, test_codex_transport, test_api_key_providers, test_external_process_auth_status and test_model_cache_fallback_rows.
79 lines
3.2 KiB
Python
79 lines
3.2 KiB
Python
"""A provider installed by ``hermes plugins install`` must actually be found.
|
|
|
|
The installer clones into ``$HERMES_HOME/plugins/<name>/`` (flat), provider
|
|
discovery only scanned ``plugins/model-providers/<name>/``, and PluginManager
|
|
skips ``kind: model-provider`` on purpose — so the documented install path
|
|
reported success and registered nothing. These tests pin the join, and that
|
|
discovery keeps its hands off every other plugin in that directory.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import textwrap
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
_PROFILE_SOURCE = textwrap.dedent(
|
|
"""
|
|
from providers import register_provider
|
|
from providers.base import ProviderProfile
|
|
|
|
register_provider(ProviderProfile(name="{name}", aliases=("{name}-alias",),
|
|
base_url="acp://{name}", auth_type="external_process"))
|
|
"""
|
|
)
|
|
|
|
|
|
def _clear_provider_caches():
|
|
import providers as _pkg
|
|
|
|
_pkg._REGISTRY.clear()
|
|
_pkg._ALIASES.clear()
|
|
_pkg._PROVIDER_LIST_CACHE = None
|
|
_pkg._discovered = False
|
|
for mod in list(sys.modules):
|
|
if mod.startswith(("plugins.model_providers", "_hermes_user_provider")):
|
|
del sys.modules[mod]
|
|
|
|
|
|
def _write_plugin(directory: Path, *, name: str, manifest: str | None):
|
|
directory.mkdir(parents=True, exist_ok=True)
|
|
if manifest is not None:
|
|
(directory / "plugin.yaml").write_text(manifest, encoding="utf-8")
|
|
# Registers a provider on import, so an unwanted import is *visible*.
|
|
(directory / "__init__.py").write_text(_PROFILE_SOURCE.format(name=name), encoding="utf-8")
|
|
|
|
|
|
@pytest.fixture
|
|
def hermes_home(tmp_path, monkeypatch):
|
|
monkeypatch.setenv("HERMES_HOME", str(tmp_path))
|
|
_clear_provider_caches()
|
|
yield tmp_path
|
|
_clear_provider_caches()
|
|
|
|
|
|
def test_flat_installed_model_provider_plugins_are_discovered_alongside_nested_ones(hermes_home):
|
|
_write_plugin(hermes_home / "plugins" / "installed-acp", name="installed-acp",
|
|
manifest='name: installed-acp\nkind: "model-provider"\n')
|
|
_write_plugin(hermes_home / "plugins" / "model-providers" / "nested-acp", name="nested-acp",
|
|
manifest="name: nested-acp\nkind: model-provider\n")
|
|
from providers import get_provider_profile
|
|
|
|
assert get_provider_profile("installed-acp").base_url == "acp://installed-acp"
|
|
assert get_provider_profile("installed-acp-alias") is not None
|
|
assert get_provider_profile("nested-acp") is not None
|
|
|
|
|
|
def test_other_plugins_in_the_flat_directory_are_left_to_the_plugin_manager(hermes_home):
|
|
_write_plugin(hermes_home / "plugins" / "other-standalone", name="other-standalone",
|
|
manifest="name: other-standalone\nkind: standalone\n")
|
|
_write_plugin(hermes_home / "plugins" / "manifestless", name="manifestless", manifest=None)
|
|
_write_plugin(hermes_home / "plugins" / "broken-manifest", name="broken-manifest",
|
|
manifest="kind: [this is: not valid\n")
|
|
from providers import get_provider_profile, list_providers
|
|
|
|
assert not [p for p in list_providers() if p.name in ("other-standalone", "manifestless", "broken-manifest")]
|
|
assert get_provider_profile("openrouter") is not None # bundled set still intact
|