mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-06 05:17:15 +00:00
The github-copilot labs plugin's own `hermes model` flows still imported three core privates (r4-labs/CORE_GAPS.md): _persist_model, _note_setup_failure and env_loader's format_secret_source_suffix. They encode core config/metric/secret-source rules a plugin must not copy, so core publishes documented names: hermes_cli.model_setup.persist_model_selection and note_setup_failure (new public module, in the plugin-validate allow-list) and agent.secret_scope.secret_source_label (already a public module). Documented in model-provider-plugin.md. The private names stay (core flows use them; no catalog pin imports them).
26 lines
1.2 KiB
Python
26 lines
1.2 KiB
Python
"""Public helpers for a provider plugin's own ``hermes model`` step (``ProviderProfile.model_setup_flow``).
|
|
|
|
Documented in website/docs/developer-guide/model-provider-plugin.md: these are the contract a plugin
|
|
flow calls instead of re-implementing core's config rules.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
def persist_model_selection(model: str, provider: str, *, base_url: str | None = None,
|
|
api_mode: str | None = None) -> dict:
|
|
"""Save *model* on *provider* as the default: writes the ``model:`` section (``provider``, then
|
|
``base_url`` and ``api_mode`` when given), scrubs inline endpoint credentials from it, saves
|
|
config.yaml and deactivates the previously active OAuth provider. Returns the saved section."""
|
|
from hermes_cli.model_setup_flows_common import _persist_model
|
|
|
|
return _persist_model(model, provider, base_url=base_url, api_mode=api_mode)
|
|
|
|
|
|
def note_setup_failure(failure_class: str) -> None:
|
|
"""Record why the flow ends without a pick (``"auth"``, ``"no_models"``, ...) for the opt-in
|
|
provider-setup metric; a no-op outside a tracked ``hermes model`` / setup flow."""
|
|
from hermes_cli.model_setup_flows_common import _note_setup_failure
|
|
|
|
_note_setup_failure(failure_class)
|