Documentation
¶
Index ¶
- func CheckCommand(name string, connectivity bool) string
- func SetupCommand(descriptor providercatalog.Descriptor, name string, setActive bool) string
- func UseCommand(name string) string
- type Action
- type DetectedLocalRuntime
- type LocalDetectOptions
- type LocalRuntime
- type ProviderState
- type SetupProbeClass
- type SetupProbeError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCommand ¶
func SetupCommand ¶
func SetupCommand(descriptor providercatalog.Descriptor, name string, setActive bool) string
func UseCommand ¶
Types ¶
type Action ¶
func MissingCredentialAction ¶
func MissingCredentialAction(profile config.ProviderProfile) (Action, bool)
func ProviderActions ¶
func ProviderActions(profile config.ProviderProfile, active bool) []Action
type DetectedLocalRuntime ¶
type DetectedLocalRuntime struct {
LocalRuntime
Reachable bool
Models []string
}
DetectedLocalRuntime is a LocalRuntime that has been probed. Reachable reports whether its default endpoint answered the probe; Models is the list of model ids the runtime advertised (best-effort, empty when the probe could not parse a model list).
func DetectLocalRuntimes ¶
func DetectLocalRuntimes(ctx context.Context, options LocalDetectOptions) []DetectedLocalRuntime
DetectLocalRuntimes probes each candidate's default endpoint and returns only the runtimes that answered successfully. A runtime is "reachable" when its OpenAI-compatible models endpoint returns a 2xx; transport errors (closed port), timeouts, and non-2xx responses are treated as "not running" and the candidate is dropped. Detection never errors — a machine with nothing running locally simply yields an empty slice.
func (DetectedLocalRuntime) SetupAction ¶
func (runtime DetectedLocalRuntime) SetupAction() Action
SetupAction returns the no-key onboarding action for a detected local runtime.
type LocalDetectOptions ¶
type LocalDetectOptions struct {
HTTPClient *http.Client
Timeout time.Duration
Candidates []LocalRuntime
}
LocalDetectOptions configures DetectLocalRuntimes. All fields are optional; the zero value probes the built-in candidates with a short default timeout using http.DefaultClient. Tests inject HTTPClient and Candidates.
type LocalRuntime ¶
type LocalRuntime struct {
CatalogID string
Name string
BaseURL string
DefaultModel string
RequiresKey bool
}
LocalRuntime describes a local, OpenAI-compatible model server that ZERO can adopt with no API key. These are the runtimes the launch audience is most likely to already be running (Ollama, LM Studio), so the first-run wizard auto-detects them on their default ports and offers them with no key step.
func LocalRuntimeCandidates ¶
func LocalRuntimeCandidates() []LocalRuntime
LocalRuntimeCandidates returns the built-in local-runtime candidates derived from the provider catalog. Only catalog entries flagged Local are returned, so the default ports stay the single source of truth (catalog.go).
type ProviderState ¶
type ProviderState struct {
Profile config.ProviderProfile
Active bool
}
func (ProviderState) Actions ¶
func (state ProviderState) Actions() []Action
type SetupProbeClass ¶
type SetupProbeClass string
SetupProbeClass is the stable, machine-readable class of a first-run probe failure. It exists so the wizard can render a specific, fixable remedy instead of a raw stack trace: each class maps to one concrete thing the user changes.
const ( SetupProbeAuth SetupProbeClass = "auth" // bad / missing API key SetupProbeEndpoint SetupProbeClass = "endpoint" // wrong base URL, unreachable, timeout SetupProbeModel SetupProbeClass = "model" // model not found at the provider SetupProbeRateLimit SetupProbeClass = "rate_limit" // throttled; key works, retry later SetupProbeConfig SetupProbeClass = "config" // local profile is incomplete SetupProbeUnknown SetupProbeClass = "unknown" // unclassified provider error )
type SetupProbeError ¶
type SetupProbeError struct {
Class SetupProbeClass
Message string
Detail string
}
SetupProbeError is a classified, user-facing first-run probe failure. It is a value type (not panicking) so a failing probe can be rendered as a single fixable line. Message is the remedy; Detail is the underlying (already secret-scrubbed) provider message for context.
func ClassifySetupProbe ¶
func ClassifySetupProbe(result providerhealth.Result) (SetupProbeError, bool)
ClassifySetupProbe maps a provider health probe result to a specific, fixable error. It returns ok=false when the probe passed (nothing to fix). It never panics: an empty or degenerate result classifies to SetupProbeUnknown rather than dereferencing a nil check.
The whole point is that "paste key -> working" fails loudly with the one thing to change — wrong base URL, bad key, or model not found — not a stack trace.
func (SetupProbeError) Error ¶
func (err SetupProbeError) Error() string