Documentation
¶
Overview ¶
Package runtime is the **recommended entry point** for host applications (e.g. hawk). Start by calling runtime.Load to get a *Runtime, then rt.ChatProvider to obtain a client.Provider that you can hand to your agent loop.
Note: the "stable" surface of eyrie is actually a set of cooperating subpackages, not just this one. The full list hawk (and other host applications) actually import is:
github.com/GrayCodeAI/eyrie/runtime (this package — bootstrap facade) github.com/GrayCodeAI/eyrie/client (Provider interface, message/response types) github.com/GrayCodeAI/eyrie/catalog (model catalog: pricing, capabilities, registry) github.com/GrayCodeAI/eyrie/catalog/registry (ProviderSpec catalog: 16 registered providers) github.com/GrayCodeAI/eyrie/catalog/xiaomi (Xiaomi-specific catalog helpers) github.com/GrayCodeAI/eyrie/config (provider config + env var resolution) github.com/GrayCodeAI/eyrie/credentials (OS keyring + OIDC keyless CI auth) github.com/GrayCodeAI/eyrie/setup (CLI/setup wiring, RoutingPreviewJSON) github.com/GrayCodeAI/eyrie/storage (conversation DAG persistence)
They are all considered part of the public API; changes to exported names are gated by semver. Anything under internal/ is implementation detail and may change without notice.
Index ¶
- func ActiveModel(ctx context.Context) string
- func ActiveProvider(ctx context.Context) string
- func AllModelIDs(ctx context.Context) ([]string, error)
- func ClearActiveSelection(ctx context.Context) error
- func CommitCredential(ctx context.Context, inference CredentialInference, secret string) error
- func DefaultModelProviderFilter(ctx context.Context) string
- func DefaultPaths() (catalogPath, providerPath string)
- func FormatPreflightReport(r PreflightReport) string
- func FormatSetupError(providerID string, err error) error
- func ModelsForProvider(ctx context.Context, provider string) ([]catalog.ModelCatalogEntry, error)
- func PrimaryAPIKeyEnv(deploymentID string) string
- func ProbeCredential(ctx context.Context, envKey, secret string) error
- func ProviderIDForDeployment(deploymentID string) string
- func SaveCredential(ctx context.Context, inference CredentialInference, secret string) error
- func SetActiveModel(ctx context.Context, modelID string) error
- func SetActiveProvider(ctx context.Context, provider string) error
- func SetCredential(ctx context.Context, envKey, secret string) error
- func SetupUIFromCatalog(ctx context.Context, providerFilter string) (*setup.SetupUI, error)
- func ValidateKeyFormat(secret string) error
- type ApplyResult
- type CredentialInference
- type CredentialProviderOption
- type CredentialResolveResult
- type CredentialTarget
- type DeploymentRow
- type ListModelSource
- type ListModelsOpts
- type ModelEntry
- type PreflightCheck
- type PreflightReport
- type PreflightStatus
- type ProviderSetupOption
- type Runtime
- func (r *Runtime) ChatProvider(ctx context.Context) (client.Provider, error)
- func (r *Runtime) CredentialTargets() []CredentialTarget
- func (r *Runtime) DeploymentRows() ([]DeploymentRow, error)
- func (r *Runtime) ModelEntriesForProvider(provider string) []catalog.ModelCatalogEntry
- func (r *Runtime) ModelIDs() []string
- func (r *Runtime) ProviderConfigJSON() (string, error)
- func (r *Runtime) RoutingPreviewJSON(model string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveModel ¶
ActiveModel returns the selected model from provider.json.
func ActiveProvider ¶
ActiveProvider returns the selected provider from provider.json.
func AllModelIDs ¶
AllModelIDs returns every canonical model ID in the catalog (sorted).
func ClearActiveSelection ¶
ClearActiveSelection removes active provider/model from provider.json.
func CommitCredential ¶
func CommitCredential(ctx context.Context, inference CredentialInference, secret string) error
CommitCredential runs format + provider validation + probe (no persistence).
func DefaultModelProviderFilter ¶
DefaultModelProviderFilter returns the catalog provider id to use when listing models with no explicit provider (e.g. /config model picker after paste-key). Order: provider.json default → first configured deployment (stable sort by id).
func DefaultPaths ¶
func DefaultPaths() (catalogPath, providerPath string)
DefaultPaths reports standard eyrie paths on disk.
func FormatPreflightReport ¶
func FormatPreflightReport(r PreflightReport) string
FormatPreflightReport returns human-readable preflight output.
func FormatSetupError ¶
FormatSetupError maps provider setup failures to user-facing hints.
func ModelsForProvider ¶
ModelsForProvider loads the catalog cache and returns models for provider. Prefer ListModels for host UIs (registry-aware live vs cache).
func PrimaryAPIKeyEnv ¶
PrimaryAPIKeyEnv returns the main env var for a deployment ID from the catalog.
func ProbeCredential ¶
ProbeCredential validates a key against the provider HTTP API.
func ProviderIDForDeployment ¶
ProviderIDForDeployment maps a deployment id to catalog provider id.
func SaveCredential ¶
func SaveCredential(ctx context.Context, inference CredentialInference, secret string) error
SaveCredential validates, stores in the OS secret store, then probes the provider API. The key is persisted before the probe so a network or auth failure does not discard user input.
func SetActiveModel ¶
SetActiveModel persists the user's model choice to provider.json.
func SetActiveProvider ¶
SetActiveProvider persists active_provider to provider.json.
func SetCredential ¶
SetCredential stores a provider secret (env var name + value). Never log the secret argument.
func SetupUIFromCatalog ¶
SetupUIFromCatalog builds provider/model picker rows from the current catalog cache.
func ValidateKeyFormat ¶
ValidateKeyFormat rejects empty/placeholder keys before provider selection.
Types ¶
type ApplyResult ¶
type ApplyResult struct {
Catalog *catalog.RefreshResult
Provider *config.ProviderConfig
ProviderPath string
RoutingJSON string
Setup *setup.SetupUI
}
ApplyResult summarizes an Apply call.
func Apply ¶
func Apply(ctx context.Context, creds catalog.Credentials) (*ApplyResult, error)
Apply discovers the model catalog and writes ~/.eyrie/provider.json (routing only; secrets stay in env).
type CredentialInference ¶
type CredentialInference = config.CredentialInference
Credential types re-exported for host apps.
func InferCredentialsFromAPIKey ¶
func InferCredentialsFromAPIKey(ctx context.Context, secret string) []CredentialInference
InferCredentialsFromAPIKey is deprecated; use InferenceForProvider after gateway selection.
func InferenceForProvider ¶
func InferenceForProvider(providerID string) (CredentialInference, error)
InferenceForProvider returns save metadata for a gateway selected in setup UI.
func LocalCredentialInference ¶
func LocalCredentialInference(providerID string) (CredentialInference, error)
LocalCredentialInference returns setup metadata for no-key providers.
type CredentialProviderOption ¶
type CredentialProviderOption = config.CredentialProviderOption
Credential types re-exported for host apps.
func ListCredentialProviders ¶
func ListCredentialProviders() []CredentialProviderOption
ListCredentialProviders returns all registry providers for setup UIs.
type CredentialResolveResult ¶
type CredentialResolveResult = config.CredentialResolveResult
Credential types re-exported for host apps.
func ResolveCredential ¶
func ResolveCredential(ctx context.Context, secret string) CredentialResolveResult
ResolveCredential validates format and lists registered providers (gateway must be chosen first).
type CredentialTarget ¶
CredentialTarget is one API key slot in a host /config UI.
type DeploymentRow ¶
type DeploymentRow struct {
ID string
Name string
ProviderID string
Configured bool
Status string
PrimaryEnv string
}
DeploymentRow is a deployment plus env credential status.
type ListModelSource ¶
type ListModelSource string
ListModelSource selects cache vs live model listing.
const ( ListSourceAuto ListModelSource = "auto" ListSourceCache ListModelSource = "cache" ListSourceLive ListModelSource = "live" )
type ListModelsOpts ¶
type ListModelsOpts struct {
ProviderID string
Source ListModelSource
Refresh bool
}
ListModelsOpts configures unified model listing for host UIs.
type ModelEntry ¶
type ModelEntry struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Owner string `json:"owner,omitempty"`
ProviderID string `json:"provider_id"`
ContextWindow int `json:"context_window,omitempty"`
InputPricePer1M float64 `json:"input_price_per_1m,omitempty"`
OutputPricePer1M float64 `json:"output_price_per_1m,omitempty"`
Source string `json:"source"`
Installed bool `json:"installed,omitempty"`
}
ModelEntry is one row for host model pickers.
func ListModels ¶
func ListModels(ctx context.Context, opts ListModelsOpts) ([]ModelEntry, error)
ListModels returns models for a provider using registry-driven source selection.
type PreflightCheck ¶
type PreflightCheck struct {
Name string `json:"name"`
Status PreflightStatus `json:"status"`
Detail string `json:"detail"`
}
PreflightCheck is one readiness row.
type PreflightReport ¶
type PreflightReport struct {
Ready bool `json:"ready"`
Checks []PreflightCheck `json:"checks"`
}
PreflightReport summarizes whether hawk can chat.
func Preflight ¶
func Preflight(ctx context.Context) PreflightReport
Preflight evaluates catalog, credentials, model selection, and optional live model access.
type PreflightStatus ¶
type PreflightStatus string
PreflightStatus is ok, warn, or fail.
const ( PreflightOK PreflightStatus = "ok" PreflightWarn PreflightStatus = "warn" PreflightFail PreflightStatus = "fail" )
type ProviderSetupOption ¶
ProviderSetupOption is one hub row in host /config.
func ListProviderSetupOptions ¶
func ListProviderSetupOptions(ctx context.Context) []ProviderSetupOption
ListProviderSetupOptions returns hub rows for host /config UIs.
type Runtime ¶
type Runtime struct {
Catalog *catalog.CompiledCatalogV1
Provider *config.ProviderConfig
ProviderPath string
}
Runtime is a loaded eyrie control plane: catalog cache + routing + env-backed credentials.
func (*Runtime) ChatProvider ¶
ChatProvider builds the LLM client (deployment router when configured).
func (*Runtime) CredentialTargets ¶
func (r *Runtime) CredentialTargets() []CredentialTarget
CredentialTargets lists provider-facing API key env vars for simple UIs.
func (*Runtime) DeploymentRows ¶
func (r *Runtime) DeploymentRows() ([]DeploymentRow, error)
DeploymentRows lists deployments with credential status from env (not from provider.json secrets).
func (*Runtime) ModelEntriesForProvider ¶
func (r *Runtime) ModelEntriesForProvider(provider string) []catalog.ModelCatalogEntry
ModelEntriesForProvider returns models for a provider from this runtime's catalog snapshot.
func (*Runtime) ProviderConfigJSON ¶
ProviderConfigJSON returns provider.json as indented JSON.