Skip to content

The agent that grows with you

Merge copilot-seams/l2 into integration

Teknium537d26b05d14
diff --cc plugins/model-providers/copilot-acp/__init__.py
index e72ec7a4be8,ab9ca16b881..436f48af2e1
--- a/plugins/model-providers/copilot-acp/__init__.py
+++ b/plugins/model-providers/copilot-acp/__init__.py
@@@ -15,9 -15,18 +15,18 @@@ from providers.base import ProviderProf
class CopilotACPProfile(ProviderProfile):
"""GitHub Copilot ACP — external process, no REST models endpoint."""
+ def external_auth_evidence(self) -> tuple[bool, str | None] | None:
+ """The Copilot CLI's token stores, read without spawning it; None (binary check) without the
+ copilot plugin that owns the token rules."""
+ try:
+ from plugins.model_providers.copilot.credentials import copilot_cli_auth_evidence
+ except ImportError:
+ return None
+ return copilot_cli_auth_evidence()
+
def create_client(self, **client_kwargs: Any) -> Any:
"""Build the ACP stdio shim rather than an HTTP client."""
- from agent.copilot_acp_client import CopilotACPClient
+ from .client import CopilotACPClient
return CopilotACPClient(**client_kwargs)
diff --cc plugins/model-providers/copilot/__init__.py
index 5aa60bc20e8,5245572bcb3..0a19b705f3f
--- a/plugins/model-providers/copilot/__init__.py
+++ b/plugins/model-providers/copilot/__init__.py
@@@ -10,10 -10,10 +10,11 @@@ from typing import An
from providers import register_provider
from providers.base import ProviderProfile
+from .catalog import HOSTNAMES, METADATA_HOSTNAMES, MODELS_DEV_ID, CopilotCatalogMixin
+ from .credentials import CopilotCredentialsMixin
- class CopilotProfile(CopilotCatalogMixin, ProviderProfile):
-class CopilotProfile(CopilotCredentialsMixin, ProviderProfile):
++class CopilotProfile(CopilotCatalogMixin, CopilotCredentialsMixin, ProviderProfile):
"""GitHub Copilot / GitHub Models — editor headers + reasoning."""
def build_api_kwargs_extras(
@@@ -40,8 -40,7 +41,8 @@@
copilot = CopilotProfile(
name="copilot", aliases=("github-copilot", "github-models", "github-model", "github"),
env_vars=("COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"), base_url="https://api.githubcopilot.com",
- auth_type="copilot",
+ auth_type="copilot", ambient_credentials=True,
+ hostnames=HOSTNAMES, metadata_hostnames=METADATA_HOSTNAMES, models_dev_id=MODELS_DEV_ID,
)
register_provider(copilot)
diff --cc providers/base.py
index f164f27e22b,743a4a93a8a..88f43151a8d
--- a/providers/base.py
+++ b/providers/base.py
@@@ -542,20 -537,46 +542,64 @@@ class ProviderProfile
logger.debug("fetch_models(%s): %s", self.name, exc)
return None
+ # ── Lane L4: catalog / metadata seams ─────────────────────
+ # Hosts (exact or any subdomain) that serve THIS provider's API, so a ``custom`` endpoint or an
+ # auto-routed aux client at one of them is recognised as this provider (``providers.profile_for_host``).
+ hostnames: tuple = ()
+ # Hosts that identify this provider's catalog for model metadata (context length, models.dev) but
+ # take other credentials; matched only by ``profile_for_host(url, metadata=True)``.
+ metadata_hostnames: tuple = ()
+ # models.dev provider id when it differs from ``name`` (e.g. ``fireworks`` -> ``fireworks-ai``).
+ models_dev_id: str = ""
+
+ def live_context_length(self, model: str, *, api_key: str = "", base_url: str = "") -> int | None:
+ """Context window from the provider's live, credentialed catalog; consulted after the persistent cache."""
+ return None
+
+ def normalize_model_id(self, model: str, *, api_key: str = "") -> str | None:
+ """Provider-native id for *model* (alias table, catalog repair); None = core's generic normalization."""
+ return None
++
+ # ── Lane L2: provider-owned credential seams ──────────────────────────────
+ # Credentials are commonly ambient (another tool's login, a token exported for other purposes):
+ # never auto-detected as the inference provider, and the auxiliary fallback chain skips the
+ # provider unless the user explicitly configured it.
+ ambient_credentials: bool = field(default=False, kw_only=True)
+
+ def resolve_api_key_secret(self) -> tuple[str, str] | None:
+ """Provider-owned ``(runtime_api_key, source)`` resolution; None = generic env/pool ladder."""
+ return None
+
+ def runtime_base_url(self, *, api_key: str, default: str, env_url: str) -> str | None:
+ """Runtime base URL derived from the credential (e.g. an account endpoint); None = env or default."""
+ return None
+
+ def prepare_pool_entry(self, entry: Any, api_key: str) -> str:
+ """Turn the selected pool row's secret into the runtime key (may update ``entry``); default as-is."""
+ return api_key
+
+ def seed_pool_credentials(self, *, is_suppressed: Callable[[str], bool],
+ explicitly_configured: Callable[[], bool]) -> list[dict] | None:
+ """Pool rows ``{source, access_token, base_url, label}`` this provider seeds itself; None = generic env seeding."""
+ return None
+
+ def remove_credential_source(self, source: str) -> tuple[tuple[str, ...], tuple[str, ...]] | None:
+ """``hermes auth remove`` of *source*: ``(sources_to_suppress, hints)``; None = generic removal."""
+ return None
+
+ def refresh_runtime_credentials(self, *, reason: str) -> tuple[str, str | None] | None:
+ """Re-mint the live client's ``(api_key, base_url or None)`` on ``reason`` (``unauthorized`` |
+ ``stale`` | ``auxiliary_unauthorized``); None = nothing fresher. Error path only, I/O allowed."""
+ return None
+
+ def is_stale_credential_error(self, *, status_code: int | None, message: str) -> bool:
+ """True when a non-auth error really means the credential went stale (pure, no I/O)."""
+ return False
+
+ def request_rejection_hint(self, *, status_code: int | None, base_url: str) -> tuple[str, ...]:
+ """User-facing lines explaining an endpoint's hard rejection of *any* route (pure); default none."""
+ return ()
+
+ def external_auth_evidence(self) -> tuple[bool, str | None] | None:
+ """Subprocess-free ``(verified, source)`` login evidence for an external CLI; None = binary resolves."""
+ return None