setupcheck

package
v0.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package setupcheck evaluates local runtime readiness (defaults, backends) for Beam and CLI.

Index

Constants

View Source
const (
	CategoryDefaults     = "defaults"
	CategoryRegistration = "registration"
	CategoryHealth       = "health"
)

Variables

This section is empty.

Functions

func StatesFromMap

StatesFromMap flattens runtime state snapshots for Evaluate / GatherInput.

Types

type BackendCheck

type BackendCheck struct {
	ID              string   `json:"id"`
	Name            string   `json:"name"`
	Type            string   `json:"type"`
	BaseURL         string   `json:"baseUrl"`
	Status          string   `json:"status"`
	Reachable       bool     `json:"reachable"`
	DefaultProvider bool     `json:"defaultProvider"`
	ModelCount      int      `json:"modelCount"`
	ChatModelCount  int      `json:"chatModelCount"`
	ChatModels      []string `json:"chatModels,omitempty"`
	Error           string   `json:"error,omitempty"`
	Hint            string   `json:"hint,omitempty"`
}

BackendCheck reports the runtime status of one registered backend.

type Input

type Input struct {
	DefaultModel    string
	DefaultProvider string
	DefaultChain    string
	States          []statetype.BackendRuntimeState
	// RegisteredBackendCount, if non-nil, overrides len(RegisteredBackends) / len(States)
	// for BackendCount. CLI doctor sets this from ListBackends when runtime state sync is unavailable.
	RegisteredBackendCount *int
	RegisteredBackends     []runtimetypes.Backend
}

Input is everything needed to compute readiness; callers gather from DB + runtime state.

func GatherInput

func GatherInput(ctx context.Context, db libdbexec.DBManager, states []statetype.BackendRuntimeState) (Input, error)

GatherInput builds Input from SQLite KV defaults, registered backend count, and a runtime state snapshot. Callers obtain states from stateservice.Get or runtimestate.State.Get (values from the map, in stable order if needed).

type Issue

type Issue struct {
	Code       string `json:"code"`
	Severity   string `json:"severity"`
	Category   string `json:"category,omitempty"`
	Message    string `json:"message"`
	FixPath    string `json:"fixPath,omitempty"`
	CLICommand string `json:"cliCommand,omitempty"`
}

Issue describes one setup problem and how to fix it.

type Result

type Result struct {
	DefaultModel          string         `json:"defaultModel"`
	DefaultProvider       string         `json:"defaultProvider"`
	DefaultChain          string         `json:"defaultChain"`
	BackendCount          int            `json:"backendCount"`
	ReachableBackendCount int            `json:"reachableBackendCount"`
	Issues                []Issue        `json:"issues"`
	BackendChecks         []BackendCheck `json:"backendChecks,omitempty"`
}

Result is returned by GET /setup-status and contenox doctor.

func Evaluate

func Evaluate(in Input) Result

Evaluate returns readiness from gathered input (no I/O).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL