stateservice

package
v0.28.9 Latest Latest
Warning

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

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

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
	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
	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 (model, provider, chain, hitl-policy-name) 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