stateservice

package
v0.32.5 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLIConfigPatch

type CLIConfigPatch struct {
	DefaultModel                *string
	DefaultProvider             *string
	DefaultAltModel             *string
	DefaultAltProvider          *string
	DefaultAutocompleteModel    *string
	DefaultAutocompleteProvider *string
	DefaultMaxTokens            *string
	DefaultChain                *string
	HITLPolicyName              *string
}

CLIConfigPatch selects which CLI default keys to write; nil means "do not change".

type CLIConfigSnapshot

type CLIConfigSnapshot struct {
	DefaultModel                string
	DefaultProvider             string
	DefaultAltModel             string
	DefaultAltProvider          string
	DefaultAutocompleteModel    string
	DefaultAutocompleteProvider string
	DefaultMaxTokens            string
	DefaultChain                string
	HITLPolicyName              string
	ResolvedFrom                map[string]string
}

CLIConfigSnapshot is the resolved KV values after an update.

type Service

type Service interface {
	Get(ctx context.Context) ([]statetype.BackendRuntimeState, error)
	// SetupStatus returns readiness from KV defaults, registered backends, and current runtime state.
	SetupStatus(ctx context.Context) (setupcheck.Result, error)
	// Refresh reconciles registered backends/models, then returns the updated setup status.
	Refresh(ctx context.Context) (setupcheck.Result, error)
	// SetCLIConfig updates CLI default keys in SQLite KV (same as contenox config set / PUT /cli-config).
	// Nil fields in the patch are left unchanged. Empty string fields are written and can clear a resolved setting.
	SetCLIConfig(ctx context.Context, patch CLIConfigPatch) (CLIConfigSnapshot, error)
}

Service exposes runtime backend state plus onboarding/setup evaluation (same inputs as GET /setup-status).

func New

func New(state *runtimestate.State, db libdbexec.DBManager, workspaceID string) Service

New returns a state service backed by runtime state and the same DB used for backends + CLI KV. workspaceID scopes workspace-specific config (default-chain, hitl-policy-name) with global fallback.

func WithActivityTracker

func WithActivityTracker(service Service, tracker libtracker.ActivityTracker) Service

WithActivityTracker wraps a StateService with activity tracking

Jump to

Keyboard shortcuts

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